From 25b44ac6a6610ae31fda19b4313cd9f56ce3ff46 Mon Sep 17 00:00:00 2001 From: fabiorj Date: Fri, 26 Nov 2021 20:07:34 -0300 Subject: [PATCH 01/34] Commit Inicial --- .gitignore | 10 + pom.xml | 350 + src/META-INF/MANIFEST.MF | 3 + src/br/inf/portalfiscal/bpe/EvNaoEmbBPe.java | 134 + .../inf/portalfiscal/bpe/ObjectFactory.java | 316 + src/br/inf/portalfiscal/bpe/TBPe.java | 6042 +++++++++++++++++ src/br/inf/portalfiscal/bpe/TConsSitBPe.java | 155 + src/br/inf/portalfiscal/bpe/TEndeEmi.java | 371 + src/br/inf/portalfiscal/bpe/TEndereco.java | 439 ++ src/br/inf/portalfiscal/bpe/TEnviBPe.java | 127 + src/br/inf/portalfiscal/bpe/TEvento.java | 599 ++ src/br/inf/portalfiscal/bpe/TImp.java | 1193 ++++ src/br/inf/portalfiscal/bpe/TProcEvento.java | 154 + src/br/inf/portalfiscal/bpe/TProtBPe.java | 436 ++ src/br/inf/portalfiscal/bpe/TRetBPe.java | 240 + .../portalfiscal/bpe/TRetConsStatServ.java | 343 + src/br/inf/portalfiscal/bpe/TRetEvento.java | 571 ++ src/br/inf/portalfiscal/bpe/TUf.java | 98 + src/br/inf/portalfiscal/bpe/TUfSemEX.java | 96 + .../inf/portalfiscal/bpe/evento/TEvento.java | 599 ++ .../portalfiscal/bpe/evento/TEventoMsg.java | 47 + .../portalfiscal/bpe/evento/TRetEvento.java | 568 ++ .../portalfiscal/bpe/evento/package-info.java | 1 + src/br/inf/portalfiscal/bpe/package-info.java | 23 + .../hstcajservice/ws/BilheteService.java | 261 + .../ws/BilheteServiceService.java | 55 + .../hstcajservice/ws/Bilhetes.java | 25 + .../hstcajservice/ws/BuscarBilhetes.java | 222 + .../ws/BuscarBilhetesInconsistente.java | 222 + .../BuscarBilhetesInconsistenteResponse.java | 69 + .../ws/BuscarBilhetesResponse.java | 69 + .../ws/BuscarReceitaDespesa.java | 195 + .../ws/BuscarReceitaDespesaResponse.java | 69 + .../hstcajservice/ws/CadAgencia.java | 60 + .../hstcajservice/ws/CadAgenciaResponse.java | 69 + .../hstcajservice/ws/CadBeneficio.java | 87 + .../ws/CadBeneficioResponse.java | 69 + .../hstcajservice/ws/CadBilheteiro.java | 141 + .../ws/CadBilheteiroResponse.java | 69 + .../hstcajservice/ws/CadCliente.java | 60 + .../hstcajservice/ws/CadClienteResponse.java | 69 + .../hstcajservice/ws/CadEstado.java | 60 + .../hstcajservice/ws/CadEstadoResponse.java | 69 + .../hstcajservice/ws/CadFormaPagamento.java | 60 + .../ws/CadFormaPagamentoResponse.java | 69 + .../hstcajservice/ws/CadLinha.java | 87 + .../hstcajservice/ws/CadLinhaResponse.java | 69 + .../hstcajservice/ws/CadLocalidade.java | 60 + .../ws/CadLocalidadeResponse.java | 69 + .../hstcajservice/ws/CadReceitaDespesa.java | 60 + .../ws/CadReceitaDespesaResponse.java | 69 + .../ws/ExportaIntegracaoCadAgenciaWS.java | 114 + .../ws/ExportaIntegracaoCadBeneficioWS.java | 276 + .../ws/ExportaIntegracaoCadBilheteiroWS.java | 168 + .../ws/ExportaIntegracaoCadClienteWS.java | 330 + .../ws/ExportaIntegracaoCadEstadoWS.java | 195 + .../ExportaIntegracaoCadFormaPagamentoWS.java | 87 + .../ws/ExportaIntegracaoCadLinhaWS.java | 222 + .../ws/ExportaIntegracaoCadLocalidadeWS.java | 168 + .../ExportaIntegracaoCadReceitaDespesaWS.java | 195 + .../ws/ExportaIntegracaoReceitaDespesaWS.java | 303 + .../hstcajservice/ws/ExportaIntegracaoWS.java | 2747 ++++++++ .../hstcajservice/ws/ObjectFactory.java | 555 ++ .../routing/DynamicDataSourceHolder.java | 18 + .../routing/MultipleDataSource.java | 10 + .../routing/ReadOnlyConnection.java | 12 + .../routing/ReadOnlyRouteInterceptor.java | 39 + .../ventaboletos/auditoria/AuditControl.java | 233 + .../ventaboletos/auditoria/AuditManager.java | 14 + .../interceptor/AuditInterceptor.java | 184 + .../ventaboletos/constantes/Constantes.java | 138 + .../constantes/ConstantesFuncionSistema.java | 37 + .../constantes/ConstantesTipoDesconto.java | 7 + .../constantes/ConstantesTipoValidaVenta.java | 8 + .../constantes/ConstantesVendaEmbarcada.java | 11 + .../constantes/DescricaoTipoVenta.java | 24 + .../constantes/TipoEventoExtra.java | 95 + .../ventaboletos/constantes/TipoSeguro.java | 8 + .../ventaboletos/dao/AbastoBoletoDAO.java | 12 + .../ventaboletos/dao/AbastoCentralDAO.java | 34 + .../ventaboletos/dao/AbastoHistoDAO.java | 16 + .../ventaboletos/dao/AgruparParadaDAO.java | 21 + .../ventaboletos/dao/AidfDAO.java | 27 + .../ventaboletos/dao/AidfEspecieDAO.java | 7 + .../ventaboletos/dao/AidfTipoDAO.java | 7 + .../dao/AjusteEventoExtraDAO.java | 7 + .../ventaboletos/dao/AlertaCtrlDAO.java | 24 + .../ventaboletos/dao/AliasServicoDAO.java | 60 + .../dao/AliquotaEstadoDestinoDAO.java | 12 + .../ventaboletos/dao/ArticuloDAO.java | 17 + .../ventaboletos/dao/AsientoExclusivoDAO.java | 14 + .../ventaboletos/dao/AuditLogDAO.java | 12 + .../ventaboletos/dao/AuditModuleDAO.java | 7 + .../ventaboletos/dao/AuditServiceDAO.java | 7 + .../ventaboletos/dao/AutobusDAO.java | 18 + .../ventaboletos/dao/AutobusDocDAO.java | 10 + .../ventaboletos/dao/AutorizacionDAO.java | 17 + .../dao/AutorizacionPerfilDAO.java | 19 + .../ventaboletos/dao/BancoDAO.java | 17 + .../ventaboletos/dao/BoletoDAO.java | 26 + .../ventaboletos/dao/BpeDAO.java | 26 + .../dao/BusquedaDatosTicketDAO.java | 12 + .../ventaboletos/dao/CajaDAO.java | 39 + .../ventaboletos/dao/CalcularPeajeDAO.java | 14 + .../ventaboletos/dao/CancelacionCargoDAO.java | 14 + .../ventaboletos/dao/CancelacionCtrlDAO.java | 21 + .../ventaboletos/dao/CasetaPeajeDAO.java | 13 + .../dao/CasetaPeajeExcepcionDAO.java | 10 + .../dao/CategoriaBloqueioImpPosteriorDAO.java | 7 + .../ventaboletos/dao/CategoriaClaseDAO.java | 17 + .../ventaboletos/dao/CategoriaCorridaDAO.java | 17 + .../ventaboletos/dao/CategoriaCtrlDAO.java | 15 + .../ventaboletos/dao/CategoriaDAO.java | 21 + .../dao/CategoriaDescuentoDAO.java | 18 + .../ventaboletos/dao/CategoriaMarcaDAO.java | 17 + .../ventaboletos/dao/CategoriaMercadoDAO.java | 17 + .../ventaboletos/dao/CategoriaOrgaoDAO.java | 10 + .../ventaboletos/dao/CategoriaPeriodoDAO.java | 20 + .../dao/CategoriaTipoPtoVtaDAO.java | 22 + .../ventaboletos/dao/CiudadDAO.java | 25 + .../dao/ClaseservicioEquivalenciaDAO.java | 22 + .../ventaboletos/dao/ClasseServicoDAO.java | 23 + .../ventaboletos/dao/ClienteCursoDAO.java | 11 + .../ventaboletos/dao/ClienteDAO.java | 17 + .../ventaboletos/dao/ClienteDescuentoDAO.java | 12 + .../ventaboletos/dao/ClienteDireccionDAO.java | 19 + .../ventaboletos/dao/ClientePacoteDAO.java | 12 + .../dao/CobrancaAdcPuntoVentaDAO.java | 16 + .../dao/CoeficienteTarifaDAO.java | 10 + .../ventaboletos/dao/ColoniaDAO.java | 22 + .../dao/ComisionistaExternoDAO.java | 17 + .../ventaboletos/dao/ComissaoDAO.java | 24 + .../ventaboletos/dao/ComissaoLogDAO.java | 15 + .../ventaboletos/dao/ComissaoReceitaDAO.java | 15 + .../ventaboletos/dao/CompaniaBancariaDAO.java | 19 + .../ventaboletos/dao/ConductorDAO.java | 17 + .../ventaboletos/dao/ConexionConfDAO.java | 14 + .../ventaboletos/dao/ConexionCtrlDAO.java | 11 + .../ventaboletos/dao/ConexionDAO.java | 24 + .../dao/ConexionDescuentoDAO.java | 9 + .../dao/ConexionExcepcionDAO.java | 11 + .../dao/ConexionExcepcionRutaDAO.java | 11 + .../ventaboletos/dao/ConexionRutaConfDAO.java | 25 + .../ventaboletos/dao/ConexionRutaCtrlDAO.java | 17 + .../dao/ConexionRutaExcepcionPtoVtaDAO.java | 14 + .../ConexionRutaExcepcionTipoPtoVtaDAO.java | 12 + .../dao/ConexionRutaTramoCtrlDAO.java | 23 + .../dao/ConfContratoPuntoVentaDAO.java | 15 + .../dao/ConfRestricaoCanalVentaDAO.java | 16 + .../dao/ConfRestricaoExcecaoDAO.java | 7 + .../dao/ConfRestricaoOrgaoConcedenteDAO.java | 6 + .../dao/ConfRestricaoPtovtaDAO.java | 6 + .../dao/ConfRestricaoRutasDAO.java | 6 + .../dao/ConfRestricaoTramoDAO.java | 7 + .../dao/ConfRestricaoTramoOCDAO.java | 6 + .../dao/ConfRestricaoVendaWebDAO.java | 7 + .../ventaboletos/dao/ConfTotemDAO.java | 12 + .../dao/ConferenciaComissaoDAO.java | 68 + .../dao/ConferenciaPendenciaDAO.java | 11 + .../dao/ConfigRestriccionPagoDAO.java | 25 + .../ventaboletos/dao/ConstanteDAO.java | 21 + .../dao/ContaCorrenteAgenciaDAO.java | 17 + .../ventaboletos/dao/ContaMDDAO.java | 7 + .../ventaboletos/dao/ConvenioDAO.java | 17 + .../ventaboletos/dao/ConvenioDetDAO.java | 14 + .../ventaboletos/dao/CorridaCtrlDAO.java | 23 + .../ventaboletos/dao/CorridaDAO.java | 109 + .../ventaboletos/dao/CorridaTramoDAO.java | 19 + .../dao/CortesiaBeneficiarioDAO.java | 16 + .../ventaboletos/dao/CortesiaDAO.java | 23 + .../dao/CortesiaDireccionDAO.java | 24 + .../ventaboletos/dao/CotacaoDAO.java | 12 + .../dao/CtrlFechamentoCaixaDAO.java | 11 + .../ventaboletos/dao/CtrlSerieBPeDAO.java | 12 + .../dao/CtrlSerieEmbarcadaDAO.java | 25 + .../ventaboletos/dao/CuponConvenioDAO.java | 20 + .../ventaboletos/dao/CuponSecretariaDAO.java | 14 + .../ventaboletos/dao/CursoDAO.java | 9 + .../ventaboletos/dao/CustomDAO.java | 15 + .../ventaboletos/dao/DepositoBancarioDAO.java | 14 + .../ventaboletos/dao/DescontoComissaoDAO.java | 12 + .../ventaboletos/dao/DetAbastoBoletoDAO.java | 23 + .../dao/DetDiagramaAutobusDAO.java | 30 + .../ventaboletos/dao/DiagramaAutobusDAO.java | 20 + .../dao/DispositivoEmbarcadaDAO.java | 28 + .../dao/DispositivoEmbarcadaHistoricoDAO.java | 10 + .../ventaboletos/dao/DivisionDAO.java | 11 + .../dao/EmbarcadaDispOperadorDAO.java | 15 + .../dao/EmbarqueCatracaRodoviariaDAO.java | 11 + .../ventaboletos/dao/EmpleadoDAO.java | 21 + .../dao/EmpresaContaBancariaDAO.java | 11 + .../ventaboletos/dao/EmpresaDAO.java | 77 + .../dao/EmpresaEmailConfigDAO.java | 14 + .../ventaboletos/dao/EmpresaEmailDAO.java | 14 + .../dao/EmpresaEmailFlexBusDAO.java | 14 + .../dao/EmpresaEquivalenciaDAO.java | 21 + .../ventaboletos/dao/EmpresaImpostoDAO.java | 22 + .../dao/EmpresaSaferConfigDAO.java | 14 + .../dao/EmpresaTrocoSimplesDAO.java | 8 + .../ventaboletos/dao/EnderecoApanheDAO.java | 12 + .../ventaboletos/dao/EscolaDAO.java | 10 + .../dao/EsquemaAgrupacionDAO.java | 24 + .../ventaboletos/dao/EsquemaAsientoDAO.java | 21 + .../ventaboletos/dao/EsquemaCorridaDAO.java | 85 + .../EsquemaCorridaEmbarqueDesembarqueDAO.java | 12 + .../dao/EsquemaOperacionalDAO.java | 20 + .../ventaboletos/dao/EsquemaTramoDAO.java | 24 + .../ventaboletos/dao/EstacionDAO.java | 54 + .../ventaboletos/dao/EstacionSitefDAO.java | 22 + .../ventaboletos/dao/EstadoDAO.java | 30 + .../ventaboletos/dao/EventoExtraDAO.java | 10 + .../ventaboletos/dao/ExcepcionPeajeDAO.java | 12 + .../ventaboletos/dao/ExcepcionRedondoDAO.java | 26 + .../dao/FechamentoParamgeralDAO.java | 12 + .../dao/FechamentoParamptovtaDAO.java | 16 + .../ventaboletos/dao/FeriadoDAO.java | 19 + .../dao/FiscalAliquotaEmpresaDAO.java | 7 + .../ventaboletos/dao/FiscalDAO.java | 75 + .../dao/FiscalFormapagoEmpresa.java | 5 + .../ventaboletos/dao/FiscalImpressoraDAO.java | 47 + .../dao/FiscalImpressoraEstadoDAO.java | 19 + .../dao/FiscalRelgerencialEmpresa.java | 5 + .../dao/FiscalTotnaofiscalEmpresaDAO.java | 6 + .../ventaboletos/dao/FlywayUtilDAO.java | 5 + .../ventaboletos/dao/FolioPreimpresoDAO.java | 11 + .../dao/FormaPagamentoAgenciaDAO.java | 12 + .../ventaboletos/dao/FormaPagoDAO.java | 19 + .../ventaboletos/dao/FormaPagoDetDAO.java | 14 + .../ventaboletos/dao/FuncionSistemaDAO.java | 14 + .../ventaboletos/dao/GenericDAO.java | 29 + .../ventaboletos/dao/GenericDAOInforme.java | 19 + .../ventaboletos/dao/GrupoCategoriaDAO.java | 10 + .../ventaboletos/dao/GrupoCortesiasDAO.java | 19 + .../ventaboletos/dao/GrupoRutaDAO.java | 19 + .../ventaboletos/dao/HotelDAO.java | 10 + .../ventaboletos/dao/ImagemDAO.java | 16 + .../dao/InformeCategoriaVentaDAO.java | 12 + .../dao/InformePasajeroServicioDAO.java | 12 + .../dao/InformeServicioDiarioDAO.java | 12 + .../dao/InformeVentasPuntoVentaDAO.java | 12 + .../ventaboletos/dao/InstiFinanceiraDAO.java | 15 + .../ventaboletos/dao/IntegracaoDerPrDAO.java | 15 + .../ventaboletos/dao/IntegracaoTotvsDAO.java | 7 + .../dao/IntgeracaoTotvsHibernateDAO.java | 20 + .../ventaboletos/dao/ItemAdicionalDAO.java | 12 + .../ventaboletos/dao/ItemDescontoDAO.java | 11 + .../ventaboletos/dao/LogAuditoriaDAO.java | 11 + .../dao/LogDespesaReceitaDivDAO.java | 11 + .../dao/LogHistoricoContingenciaDAO.java | 15 + .../ventaboletos/dao/MarcaAutobusDAO.java | 9 + .../dao/MarcaClaseServicioDAO.java | 28 + .../ventaboletos/dao/MarcaDAO.java | 29 + .../ventaboletos/dao/MensagemRecusaDAO.java | 7 + .../ventaboletos/dao/MensajeDAO.java | 7 + .../ventaboletos/dao/MensajeEmpresaDAO.java | 12 + .../dao/MensajePuntoVentaDAO.java | 12 + .../ventaboletos/dao/MensajeUsuarioDAO.java | 12 + .../ventaboletos/dao/MercadoCompetidoDAO.java | 22 + .../ventaboletos/dao/MerchantBancarioDAO.java | 17 + .../ventaboletos/dao/MonedaDAO.java | 17 + .../ventaboletos/dao/MonitoramentoCCFDAO.java | 15 + .../ventaboletos/dao/MonitoramentoCRZDAO.java | 11 + .../dao/MotivoCancelVendaPacoteDAO.java | 22 + .../dao/MotivoCancelacionDAO.java | 23 + .../dao/MotivoDevolucaoBilheteDAO.java | 21 + .../dao/MotivoReimpresionDAO.java | 17 + .../ventaboletos/dao/MotivoViajeDAO.java | 16 + .../dao/MotivocancelacionEquivalenciaDAO.java | 23 + .../ventaboletos/dao/NodoDAO.java | 19 + .../dao/NotaCreditoVendaPacoteDAO.java | 14 + .../ventaboletos/dao/OCDDAO.java | 14 + .../ventaboletos/dao/OCDParamDAO.java | 13 + .../ventaboletos/dao/OCDPtoVtaParamDAO.java | 14 + .../dao/OperadorEmbarcadaDAO.java | 18 + .../dao/OperadorEmbarcadaLinhaDAO.java | 17 + .../dao/OperadorEmbarcadaServicoDAO.java | 25 + .../ventaboletos/dao/OrgaoCancelacionDAO.java | 15 + .../ventaboletos/dao/OrgaoConcedenteDAO.java | 19 + .../ventaboletos/dao/OrgaoEmpParamDAO.java | 15 + .../ventaboletos/dao/OrgaoTramoDAO.java | 28 + .../ventaboletos/dao/PacoteConvenioDAO.java | 10 + .../ventaboletos/dao/PacoteDAO.java | 7 + .../dao/PacoteDescontoBilheteDAO.java | 11 + .../ventaboletos/dao/PacoteItemDAO.java | 15 + .../ventaboletos/dao/PacoteTarifaDAO.java | 15 + .../ventaboletos/dao/PaisDAO.java | 17 + .../dao/ParadaCodOrgaoConcedenteDAO.java | 7 + .../ventaboletos/dao/ParadaDAO.java | 59 + .../dao/ParadaEquivalenciaDAO.java | 21 + .../dao/ParamAcumulaMasivoDAO.java | 23 + .../dao/ParamAcumulaPuntoDAO.java | 19 + .../ventaboletos/dao/ParamArticuloDAO.java | 7 + .../ventaboletos/dao/ParamCanjePuntoDAO.java | 19 + .../ventaboletos/dao/ParamCompraPuntoDAO.java | 21 + .../ventaboletos/dao/ParamConexionDAO.java | 8 + .../dao/ParamCostoTarjetaDAO.java | 18 + .../ventaboletos/dao/ParamRecoleccionDAO.java | 16 + .../ventaboletos/dao/PerfilDAO.java | 19 + .../ventaboletos/dao/PerfilFuncionDAO.java | 16 + .../dao/PeriodoVacacionalDAO.java | 20 + .../ventaboletos/dao/PlazaDAO.java | 17 + .../dao/PrecioFixoPedagioDAO.java | 24 + .../ventaboletos/dao/PrecioVentajaDAO.java | 21 + .../ventaboletos/dao/PrecoApanheDAO.java | 10 + .../ventaboletos/dao/PricingAsientoDAO.java | 18 + .../ventaboletos/dao/PricingCategoriaDAO.java | 18 + .../ventaboletos/dao/PricingClaseDAO.java | 18 + .../dao/PricingClasseTarifariaDAO.java | 9 + .../ventaboletos/dao/PricingCorridaDAO.java | 18 + .../ventaboletos/dao/PricingCtrlDAO.java | 17 + .../ventaboletos/dao/PricingDAO.java | 33 + .../ventaboletos/dao/PricingDiaDAO.java | 17 + .../dao/PricingEspecificoAgenciaDAO.java | 9 + .../dao/PricingEspecificoCanalVendasDAO.java | 9 + .../dao/PricingEspecificoCategoriaDAO.java | 9 + .../dao/PricingEspecificoDAO.java | 26 + .../dao/PricingEspecificoOcupacionDAO.java | 7 + .../ventaboletos/dao/PricingFormapagoDAO.java | 6 + .../ventaboletos/dao/PricingImporteDAO.java | 18 + .../ventaboletos/dao/PricingMarcaDAO.java | 18 + .../ventaboletos/dao/PricingMercadoDAO.java | 18 + .../dao/PricingOcupaAntecipaDAO.java | 19 + .../dao/PricingPuntoVentaDAO.java | 18 + .../ventaboletos/dao/PricingRutaDAO.java | 18 + .../dao/PricingTipoPtoVtaDAO.java | 18 + .../dao/PricingTipoServicioDAO.java | 18 + .../ventaboletos/dao/PricingVigenciaDAO.java | 22 + .../dao/ProdClaseServicioDAO.java | 14 + .../ventaboletos/dao/ProdFormaPagoDAO.java | 14 + .../ventaboletos/dao/ProdMarcaDAO.java | 14 + .../ventaboletos/dao/ProdMercadoDAO.java | 14 + .../ventaboletos/dao/ProdPrecioDAO.java | 33 + .../ventaboletos/dao/ProdPuntoVentaDAO.java | 14 + .../ventaboletos/dao/ProdRutaDAO.java | 14 + .../ventaboletos/dao/ProdTipoptovtaDAO.java | 14 + .../ventaboletos/dao/ProdVigenciaDAO.java | 17 + .../ventaboletos/dao/ProductoServicioDAO.java | 19 + .../ventaboletos/dao/PtoVtaCheckinDAO.java | 8 + .../ventaboletos/dao/PtoVtaSeguroDAO.java | 8 + .../dao/PtoVtaUsuarioBancarioDAO.java | 16 + .../ventaboletos/dao/PtovtaAgenciaDAO.java | 13 + .../dao/PtovtaAntecipacomissaoDAO.java | 13 + .../ventaboletos/dao/PtovtaAntifraudeDAO.java | 7 + .../ventaboletos/dao/PtovtaCatIndDAO.java | 6 + .../ventaboletos/dao/PtovtaComissaoDAO.java | 16 + .../ventaboletos/dao/PtovtaContaMDDAO.java | 9 + .../ventaboletos/dao/PtovtaDiversosDAO.java | 15 + .../dao/PtovtaEmpresaBloqueadaDAO.java | 8 + .../dao/PtovtaEmpresaContaBancariaDAO.java | 15 + .../ventaboletos/dao/PtovtaEmpresaDAO.java | 19 + .../ventaboletos/dao/PtovtaEstoqueDAO.java | 17 + .../ventaboletos/dao/PtovtaHorarioDAO.java | 18 + .../dao/PtovtaTipoEstoqueDAO.java | 11 + .../ventaboletos/dao/PtovtaTitularDAO.java | 14 + .../ventaboletos/dao/PuntoVentaDAO.java | 44 + .../ventaboletos/dao/ReceitaDespesaDAO.java | 19 + .../ventaboletos/dao/RedondeoCtrlDAO.java | 21 + .../ventaboletos/dao/RedondeoDAO.java | 21 + .../ventaboletos/dao/RedondeoMarcaDAO.java | 20 + .../dao/RegionMetropolitanaDAO.java | 7 + .../ventaboletos/dao/RelatorioAgepanDAO.java | 13 + .../dao/RemessaCNABBancosDAO.java | 33 + .../dao/RequisicionBoletoDAO.java | 7 + .../dao/ReservaEspecialClienteDAO.java | 11 + .../dao/ReservacionCategoriaDAO.java | 14 + .../ventaboletos/dao/ReservacionClaseDAO.java | 14 + .../ventaboletos/dao/ReservacionCtrlDAO.java | 19 + .../ventaboletos/dao/ReservacionMarcaDAO.java | 14 + .../dao/ReservacionMercadoDAO.java | 14 + .../dao/ReservacionPuntoVentaDAO.java | 14 + .../ventaboletos/dao/RestriccionPagoDAO.java | 14 + .../ventaboletos/dao/RhPagoConductorDAO.java | 14 + .../ventaboletos/dao/RolOperativoDAO.java | 24 + .../ventaboletos/dao/RutaCasetaDAO.java | 11 + .../ventaboletos/dao/RutaCombinacionDAO.java | 92 + .../ventaboletos/dao/RutaDAO.java | 75 + .../dao/RutaEmbarqueDesembarqueDAO.java | 12 + .../ventaboletos/dao/RutaEmpresaDAO.java | 22 + .../dao/RutaIcmsExcepcionDAO.java | 15 + .../ventaboletos/dao/RutaSecuenciaDAO.java | 56 + .../ventaboletos/dao/SapDAO.java | 16 + .../ventaboletos/dao/SecretariaDAO.java | 23 + .../dao/SecretariaEmpresaDAO.java | 11 + .../ventaboletos/dao/SegVKMDAO.java | 23 + .../dao/SeguradoraEmpresaDAO.java | 8 + .../ventaboletos/dao/SeguroKmDAO.java | 19 + .../ventaboletos/dao/SeguroTarifaDAO.java | 18 + .../ventaboletos/dao/SisdapDAO.java | 9 + .../ventaboletos/dao/SistemaDAO.java | 14 + .../ventaboletos/dao/TarifaCategoriaDAO.java | 18 + .../ventaboletos/dao/TarifaDAO.java | 82 + .../ventaboletos/dao/TarifaEmbarcadaDAO.java | 30 + .../dao/TarifaEmbarcadaHistDAO.java | 10 + .../ventaboletos/dao/TarifaHistDAO.java | 14 + .../ventaboletos/dao/TarifaKmDAO.java | 13 + .../ventaboletos/dao/TarifaMinimaDAO.java | 53 + .../ventaboletos/dao/TarifaOficialDAO.java | 101 + .../ventaboletos/dao/TarifaTipoptovtaDAO.java | 14 + .../ventaboletos/dao/TarjetaCreditoDAO.java | 7 + .../ventaboletos/dao/TarjetaFidelidadDAO.java | 22 + .../dao/TarjetaRecaudacionDAO.java | 16 + .../ventaboletos/dao/TarjetaViajeDAO.java | 20 + .../dao/TaxaEmbLevanteCtrlDAO.java | 6 + .../ventaboletos/dao/TaxaEmbarqueKmDAO.java | 20 + .../dao/TaxaEmbarqueParadaDAO.java | 26 + .../ventaboletos/dao/TipoCambioCiudadDAO.java | 14 + .../ventaboletos/dao/TipoCambioCtrlDAO.java | 14 + .../ventaboletos/dao/TipoConvenioDAO.java | 16 + .../ventaboletos/dao/TipoCorteDAO.java | 17 + .../ventaboletos/dao/TipoCortesiaDAO.java | 19 + .../dao/TipoCortesiaDescuentoDAO.java | 27 + .../ventaboletos/dao/TipoDocAutobusDAO.java | 7 + .../ventaboletos/dao/TipoDomicilioDAO.java | 19 + .../ventaboletos/dao/TipoEmpleadoDAO.java | 16 + .../ventaboletos/dao/TipoEventoExtraDAO.java | 11 + .../dao/TipoEventoExtraEmpresaDAO.java | 10 + .../dao/TipoEventoExtraPtovtaDAO.java | 6 + .../dao/TipoIdentificacionDAO.java | 11 + .../dao/TipoInformativoComissaoDAO.java | 8 + .../dao/TipoMovimentacionDAO.java | 12 + .../ventaboletos/dao/TipoMovimientoDAO.java | 17 + .../ventaboletos/dao/TipoOcupacionDAO.java | 19 + .../ventaboletos/dao/TipoParadaDAO.java | 17 + .../ventaboletos/dao/TipoPuntoVentaDAO.java | 32 + .../ventaboletos/dao/TipoServicioDAO.java | 19 + .../ventaboletos/dao/TipoTarifaPacoteDAO.java | 12 + .../ventaboletos/dao/TipoVentaDAO.java | 23 + .../ventaboletos/dao/TramoDAO.java | 56 + .../ventaboletos/dao/TramoKmServicioDAO.java | 17 + .../ventaboletos/dao/TramoServicioDAO.java | 50 + .../ventaboletos/dao/TramoTiempoDAO.java | 38 + .../ventaboletos/dao/TurnoDAO.java | 17 + .../ventaboletos/dao/UsuarioBancarioDAO.java | 16 + .../ventaboletos/dao/UsuarioDAO.java | 44 + .../ventaboletos/dao/UsuarioEmpresaDAO.java | 14 + .../ventaboletos/dao/UsuarioPerfilDAO.java | 18 + .../ventaboletos/dao/UsuarioSesionDAO.java | 22 + .../ventaboletos/dao/UsuarioUbicacionDAO.java | 21 + .../ventaboletos/dao/VendaPacoteDAO.java | 7 + .../ventaboletos/dao/ViaDAO.java | 17 + .../ventaboletos/dao/VigenciaTarifaDAO.java | 27 + .../hibernate/AbastoBoletoHibernateDAO.java | 30 + .../hibernate/AbastoCentralHibernateDAO.java | 216 + .../hibernate/AbastoHistoHibernateDAO.java | 68 + .../hibernate/AgruparParadaHibernateDAO.java | 48 + .../hibernate/AidfEspecieHibernateDAO.java | 32 + .../dao/hibernate/AidfHibernateDAO.java | 223 + .../dao/hibernate/AidfTipoHibernateDAO.java | 32 + .../AjusteEventoExtraHibernateDAO.java | 34 + .../dao/hibernate/AlertaCtrlHibernateDAO.java | 66 + .../hibernate/AliasServicoHibernateDAO.java | 142 + .../AliquotaEstadoDestinoHibernateDAO.java | 41 + .../dao/hibernate/ArticuloHibernateDAO.java | 46 + .../AsientoExclusivoHibernateDAO.java | 37 + .../dao/hibernate/AuditLogHibernateDAO.java | 84 + .../hibernate/AuditModuleHibernateDAO.java | 28 + .../hibernate/AuditServiceHibernateDAO.java | 35 + .../dao/hibernate/AutobusDocHibernateDAO.java | 43 + .../dao/hibernate/AutobusHibernateDAO.java | 49 + .../hibernate/AutorizacionHibernateDAO.java | 49 + .../AutorizacionPerfilHibernateDAO.java | 40 + .../dao/hibernate/BancoHibernateDAO.java | 50 + .../dao/hibernate/BoletoHibernateDAO.java | 352 + .../dao/hibernate/BpeHibernateDAO.java | 1711 +++++ .../BusquedaDatosTicketHibernateDAO.java | 645 ++ .../dao/hibernate/CajaHibernateDAO.java | 704 ++ .../hibernate/CalcularPeajeHibernateDAO.java | 635 ++ .../CancelacionCargoHibernateDAO.java | 26 + .../CancelacionCtrlHibernateDAO.java | 56 + .../CasetaPeajeExcepcionHibernateDAO.java | 40 + .../hibernate/CasetaPeajeHibernateDAO.java | 59 + ...goriaBloqueioImpPosteriorHibernateDAO.java | 19 + .../hibernate/CategoriaClaseHibernateDAO.java | 45 + .../CategoriaCorridaHibernateDAO.java | 45 + .../hibernate/CategoriaCtrlHibernateDAO.java | 37 + .../CategoriaDescuentoHibernateDAO.java | 80 + .../dao/hibernate/CategoriaHibernateDAO.java | 79 + .../hibernate/CategoriaMarcaHibernateDAO.java | 45 + .../CategoriaMercadoHibernateDAO.java | 46 + .../hibernate/CategoriaOrgaoHibernateDAO.java | 44 + .../CategoriaPeriodoHibernateDAO.java | 74 + .../CategoriaTipoPtoVtaHibernateDAO.java | 55 + .../dao/hibernate/CiudadHibernateDAO.java | 79 + ...ClaseservicioEquivalenciaHibernateDAO.java | 52 + .../hibernate/ClasseServicoHibernateDAO.java | 91 + .../hibernate/ClienteCursoHibernateDAO.java | 43 + .../ClienteDescuentoHibernateDAO.java | 33 + .../ClienteDireccionHibernateDAO.java | 55 + .../dao/hibernate/ClienteHibernateDAO.java | 95 + .../hibernate/ClientePacoteHibernateDAO.java | 55 + .../CobrancaAdcPuntoVentaHibernateDAO.java | 82 + .../CoeficienteTarifaHibernateDAO.java | 44 + .../dao/hibernate/ColoniaHibernateDAO.java | 78 + .../ComisionistaExternoHibernateDAO.java | 50 + .../dao/hibernate/ComissaoHibernateDAO.java | 283 + .../hibernate/ComissaoLogHibernateDAO.java | 66 + .../ComissaoReceitaHibernateDAO.java | 62 + .../CompaniaBancariaHibernateDAO.java | 38 + .../dao/hibernate/ConductorHibernateDAO.java | 54 + .../hibernate/ConexionConfHibernateDAO.java | 53 + .../hibernate/ConexionCtrlHibernateDAO.java | 42 + .../ConexionDescuentoHibernateDAO.java | 33 + .../ConexionExcepcionHibernateDAO.java | 31 + .../ConexionExcepcionRutaHibernateDAO.java | 31 + .../dao/hibernate/ConexionHibernateDAO.java | 297 + .../ConexionRutaConfHibernateDAO.java | 313 + .../ConexionRutaCtrlHibernateDAO.java | 146 + ...onRutaExcepcionTipoPtoVtaHibernateDAO.java | 32 + ...nexionRutaRestricaoPtoVtaHibernateDAO.java | 39 + .../ConexionRutaTramoCtrlHibernateDAO.java | 159 + .../ConfContratoPuntoVentaHibernateDAO.java | 134 + .../ConfRestricaoCanalVentaHibernateDAO.java | 18 + .../ConfRestricaoExcecaoHibernateDAO.java | 19 + ...fRestricaoOrgaoConcedenteHibernateDAO.java | 19 + .../ConfRestricaoPtovtaHibernateDAO.java | 19 + .../ConfRestricaoRutasHibernateDAO.java | 19 + .../ConfRestricaoTramoHibernateDAO.java | 19 + .../ConfRestricaoTramoOCHibernateDAO.java | 19 + .../ConfRestricaoVendaWebHibernateDAO.java | 33 + .../dao/hibernate/ConfTotemHibernateDAO.java | 44 + .../ConferenciaComissaoHibernateDAO.java | 1462 ++++ .../ConferenciaPendenciaHibernateDAO.java | 35 + .../ConfigRestriccionPagoHibernateDAO.java | 84 + .../dao/hibernate/ConstanteHibernateDAO.java | 69 + .../ContaCorrenteAgenciaHibernateDAO.java | 76 + .../dao/hibernate/ContaMDHibernateDAO.java | 46 + .../hibernate/ConvenioDetHibernateDAO.java | 37 + .../dao/hibernate/ConvenioHibernateDAO.java | 49 + .../hibernate/CorridaCtrlHibernateDAO.java | 87 + .../dao/hibernate/CorridaHibernateDAO.java | 1100 +++ .../hibernate/CorridaTramoHibernateDAO.java | 96 + .../CortesiaBeneficiarioHibernateDAO.java | 38 + .../CortesiaDireccionHibernateDAO.java | 115 + .../dao/hibernate/CortesiaHibernateDAO.java | 79 + .../dao/hibernate/CotacaoHibernateDAO.java | 51 + .../CtrlFechamentoCaixaHibernateDAO.java | 37 + .../hibernate/CtrlSerieBPeHibernateDAO.java | 131 + .../CtrlSerieEmbarcadaHibernateDAO.java | 297 + .../hibernate/CuponConvenioHibernateDAO.java | 50 + .../CuponSecretariaHibernateDAO.java | 37 + .../dao/hibernate/CursoHibernateDAO.java | 42 + .../dao/hibernate/CustomHibernateDAO.java | 53 + .../DepositoBancarioHibernateDAO.java | 37 + .../DescontoComissaoHibernateDAO.java | 45 + .../DetAbastoBoletoHibernateDAO.java | 130 + .../DetDiagramaAutobusHibernateDAO.java | 48 + .../DiagramaAutobusHibernateDAO.java | 110 + .../DispositivoEmbarcadaHibernateDAO.java | 200 + ...ositivoEmbarcadaHistoricoHibernateDAO.java | 82 + .../dao/hibernate/DivisionHibernateDAO.java | 32 + .../EmbarcadaDispOperadorHibernateDAO.java | 106 + ...EmbarqueCatracaRodoviariaHibernateDAO.java | 30 + .../dao/hibernate/EmpleadoHibernateDAO.java | 56 + .../EmpresaContaBancariaHibernateDAO.java | 27 + .../EmpresaEmailConfigHibernateDAO.java | 41 + .../EmpresaEmailFlexBusHibernateDAO.java | 42 + .../hibernate/EmpresaEmailHibernateDAO.java | 41 + .../EmpresaEquivalenciaHibernateDAO.java | 52 + .../dao/hibernate/EmpresaHibernateDAO.java | 406 ++ .../hibernate/EmpresaImpostoHibernateDAO.java | 53 + .../EmpresaSaferConfigHibernateDAO.java | 41 + .../EmpresaTrocoSimplesHibernateDAO.java | 30 + .../hibernate/EnderecoApanheHibernateDAO.java | 47 + .../dao/hibernate/EscolaHibernateDAO.java | 46 + .../EsquemaAgrupacionHibernateDAO.java | 86 + .../hibernate/EsquemaAsientoHibernateDAO.java | 54 + ...orridaEmbarqueDesembarqueHibernateDAO.java | 33 + .../hibernate/EsquemaCorridaHibernateDAO.java | 305 + .../EsquemaOperacionalHibernateDAO.java | 50 + .../hibernate/EsquemaTramoHibernateDAO.java | 67 + .../dao/hibernate/EstacionHibernateDAO.java | 282 + .../hibernate/EstacionSitefHibernateDAO.java | 61 + .../dao/hibernate/EstadoHibernateDAO.java | 181 + .../hibernate/EventoExtraHibernateDAO.java | 40 + .../hibernate/ExcepcionPeajeHibernateDAO.java | 68 + .../ExcepcionRedondoHibernateDAO.java | 61 + .../FechamentoParamgeralHibernateDAO.java | 63 + .../FechamentoParamptovtaHibernateDAO.java | 86 + .../dao/hibernate/FeriadoHibernateDAO.java | 86 + .../FiscalAliquotaEmpresaHibernateDAO.java | 20 + .../dao/hibernate/FiscalHibernateDAO.java | 4487 ++++++++++++ .../FiscalImpressoraEstadoHibernateDAO.java | 42 + .../FiscalImpressoraHibernateDAO.java | 245 + .../dao/hibernate/FlywayUtilHibernateDAO.java | 64 + .../FolioPreimpresoHibernateDAO.java | 43 + .../FormaPagamentoAgenciaDAOImpl.java | 79 + .../hibernate/FormaPagoDetHibernateDAO.java | 37 + .../dao/hibernate/FormaPagoHibernateDAO.java | 58 + .../hibernate/FuncionSistemaHibernateDAO.java | 40 + .../dao/hibernate/GenericHibernateDAO.java | 161 + .../hibernate/GrupoCategoriaHibernateDAO.java | 40 + .../hibernate/GrupoCortesiasHibernateDAO.java | 45 + .../dao/hibernate/GrupoRutaHibernateDAO.java | 46 + .../dao/hibernate/HibernateFix.java | 35 + .../dao/hibernate/HotelHibernateDAO.java | 39 + .../dao/hibernate/ImagemHibernateDAO.java | 55 + .../InformeCategoriaVentaDAOImpl.java | 112 + .../InformePasajeroServicioDAOImpl.java | 89 + .../InformeServicioDiarioDAOImpl.java | 85 + .../InformeVentasPuntoVentaDAOImpl.java | 90 + .../InstiFinanceiraHibernateDAO.java | 56 + .../IntegracaoDerPrHibernateDAO.java | 286 + .../hibernate/ItemAdicionalHibernateDAO.java | 52 + .../hibernate/ItemDescontoHibernateDAO.java | 54 + .../hibernate/LogAuditoriaHibernateDAO.java | 30 + .../LogDespesaReceitaDivHibernateDAO.java | 57 + .../LogHistoricoContingenciaHibernateDAO.java | 42 + .../hibernate/MarcaAutobusHibernateDAO.java | 31 + .../MarcaClaseServicioHibernateDAO.java | 74 + .../dao/hibernate/MarcaHibernateDAO.java | 116 + .../hibernate/MensagemRecusaHibernateDAO.java | 35 + .../hibernate/MensajeEmpresaHibernateDAO.java | 45 + .../dao/hibernate/MensajeHibernateDAO.java | 35 + .../MensajePuntoVentaHibernateDAO.java | 45 + .../hibernate/MensajeUsuarioHibernateDAO.java | 45 + .../MercadoCompetidoHibernateDAO.java | 65 + .../MerchantBancarioHibernateDAO.java | 26 + .../dao/hibernate/MonedaHibernateDAO.java | 47 + .../MonitoramentoCCFHibernateDAO.java | 254 + .../MonitoramentoCRZHibernateDAO.java | 244 + .../MotivoCancelVendaPacotelHibernateDAO.java | 67 + .../MotivoCancelacionHibernateDAO.java | 83 + .../MotivoDevolucaoBilheteHibernateDAO.java | 65 + .../MotivoReimpresionHibernateDAO.java | 47 + .../hibernate/MotivoViajeHibernateDAO.java | 38 + ...vocancelacionEquivalenciaHibernateDAO.java | 46 + .../dao/hibernate/NodoHibernateDAO.java | 39 + .../NotaCreditoVendaPacoteHibernateDAO.java | 92 + .../dao/hibernate/OCDHibernateDAO.java | 78 + .../dao/hibernate/OCDParamHibernateDAO.java | 65 + .../hibernate/OCDPtoVtaParamHibernateDAO.java | 51 + .../OperadorEmbarcadaHibernateDAO.java | 93 + .../OperadorEmbarcadaLinhaHibernateDAO.java | 75 + .../OperadorEmbarcadaServicoHibernateDAO.java | 826 +++ .../OrgaoCancelacionHibernateDAO.java | 56 + .../OrgaoConcedenteHibernateDAO.java | 70 + .../hibernate/OrgaoEmpParamHibernateDAO.java | 56 + .../dao/hibernate/OrgaoTramoHibernateDAO.java | 53 + .../hibernate/PacoteConvenioHibernateDAO.java | 41 + .../PacoteDescontoBilheteHibernateDAO.java | 40 + .../dao/hibernate/PacoteHibernateDAO.java | 35 + .../dao/hibernate/PacoteItemHibernateDAO.java | 55 + .../hibernate/PacoteTarifaHibernateDAO.java | 55 + .../dao/hibernate/PaisHibernateDAO.java | 47 + .../ParadaCodOrgaoConcedenteHibernateDAO.java | 20 + .../ParadaEquivalenciaHibernateDAO.java | 51 + .../dao/hibernate/ParadaHibernateDAO.java | 166 + .../ParamAcumulaMasivoHibernateDAO.java | 68 + .../ParamAcumulaPuntoHibernateDAO.java | 52 + .../hibernate/ParamArticuloHibernateDAO.java | 32 + .../ParamCanjePuntoHibernateDAO.java | 51 + .../ParamCompraPuntoHibernateDAO.java | 69 + .../hibernate/ParamConexionHibernateDAO.java | 17 + .../ParamCostoTarjetaHibernateDAO.java | 41 + .../ParamRecoleccionHibernateDAO.java | 26 + .../hibernate/PerfilFuncionHibernateDAO.java | 59 + .../dao/hibernate/PerfilHibernateDAO.java | 72 + .../PeriodoVacacionalHibernateDAO.java | 64 + .../dao/hibernate/PlazaHibernateDAO.java | 48 + .../PrecioFixoPedagioHibernateDAO.java | 93 + .../hibernate/PrecioVentajaHibernateDAO.java | 57 + .../hibernate/PrecoApanheHibernateDAO.java | 52 + .../hibernate/PricingAsientoHibernateDAO.java | 47 + .../PricingCategoriaHibernateDAO.java | 52 + .../hibernate/PricingClaseHibernateDAO.java | 52 + .../PricingClasseTarifariaHibernateDAO.java | 51 + .../hibernate/PricingCorridaHibernateDAO.java | 52 + .../hibernate/PricingCtrlHibernateDAO.java | 39 + .../dao/hibernate/PricingDiaHibernateDAO.java | 96 + .../PricingEspecificoAgenciaHibernateDAO.java | 42 + ...cingEspecificoCanalVendasHibernateDAO.java | 42 + ...ricingEspecificoCategoriaHibernateDAO.java | 40 + .../PricingEspecificoHibernateDAO.java | 132 + ...ricingEspecificoOcupacionHibernateDAO.java | 32 + .../PricingFormapagoHibernateDAO.java | 19 + .../dao/hibernate/PricingHibernateDAO.java | 159 + .../hibernate/PricingImporteHibernateDAO.java | 48 + .../hibernate/PricingMarcaHibernateDAO.java | 52 + .../hibernate/PricingMercadoHibernateDAO.java | 53 + .../PricingOcupaAntecipaHibernateDAO.java | 48 + .../PricingPuntoVentaHibernateDAO.java | 53 + .../hibernate/PricingRutaHibernateDAO.java | 52 + .../PricingTipoPtoVtaHibernateDAO.java | 52 + .../PricingTipoServicioHibernateDAO.java | 52 + .../PricingVigenciaHibernateDAO.java | 83 + .../ProdClaseServicioHibernateDAO.java | 37 + .../hibernate/ProdFormaPagoHibernateDAO.java | 37 + .../dao/hibernate/ProdMarcaHibernateDAO.java | 37 + .../hibernate/ProdMercadoHibernateDAO.java | 37 + .../dao/hibernate/ProdPrecioHibernateDAO.java | 64 + .../hibernate/ProdPuntoVentaHibernateDAO.java | 37 + .../dao/hibernate/ProdRutaHibernateDAO.java | 37 + .../hibernate/ProdTipoptovtaHibernateDAO.java | 37 + .../hibernate/ProdVigenciaHibernateDAO.java | 54 + .../ProductoServicioHibernateDAO.java | 46 + .../hibernate/PtoVtaCheckinHibernateDAO.java | 43 + .../hibernate/PtoVtaSeguroHibernateDAO.java | 43 + .../PtoVtaUsuarioBancarioHibernateDAO.java | 45 + .../hibernate/PtovtaAgenciaHibernateDAO.java | 53 + .../PtovtaAntecipacomissaoHibernateDAO.java | 47 + .../PtovtaAntifraudeHibernateDAO.java | 20 + .../hibernate/PtovtaCatIndHibernateDAO.java | 20 + .../hibernate/PtovtaComissaoHibernateDAO.java | 66 + .../hibernate/PtovtaContaMDHibernateDAO.java | 42 + .../hibernate/PtovtaDiversosHibernateDAO.java | 48 + .../PtovtaEmpresaBloqueadaHibernateDAO.java | 48 + ...tovtaEmpresaContaBancariaHibernateDAO.java | 45 + .../hibernate/PtovtaEmpresaHibernateDAO.java | 56 + .../hibernate/PtovtaEstoqueHibernateDAO.java | 48 + .../hibernate/PtovtaHorarioHibernateDAO.java | 50 + .../PtovtaTipoEstoqueHibernateDAO.java | 47 + .../hibernate/PtovtaTitularHibernateDAO.java | 49 + .../dao/hibernate/PuntoVentaHibernateDAO.java | 294 + .../hibernate/ReceitaDespesaHibernateDAO.java | 421 ++ .../hibernate/RedondeoCtrlHibernateDAO.java | 113 + .../dao/hibernate/RedondeoHibernateDAO.java | 60 + .../hibernate/RedondeoMarcaHibernateDAO.java | 56 + .../RegionMetropolitanaHibernateDAO.java | 33 + .../RelatorioAgepanHibernateDAO.java | 139 + .../RemessaCNABBancosHibernateDAO.java | 1681 +++++ .../RequisicionBoletoHibernateDAO.java | 20 + .../ReservaEspecialClienteHibernateDAO.java | 52 + .../ReservacionCategoriaHibernateDAO.java | 38 + .../ReservacionClaseHibernateDAO.java | 38 + .../ReservacionCtrlHibernateDAO.java | 90 + .../ReservacionMarcaHibernateDAO.java | 37 + .../ReservacionMercadoHibernateDAO.java | 38 + .../ReservacionPuntoVentaHibernateDAO.java | 26 + .../RestriccionPagoHibernateDAO.java | 39 + .../RhPagoConductorHibernateDAO.java | 39 + .../hibernate/RolOperativoHibernateDAO.java | 71 + .../dao/hibernate/RutaCasetaHibernateDAO.java | 24 + .../RutaCombinacionHibernateDAO.java | 1029 +++ .../RutaEmbarqueDesembarqueHibernateDAO.java | 33 + .../hibernate/RutaEmpresaHibernateDAO.java | 52 + .../dao/hibernate/RutaHibernateDAO.java | 437 ++ .../RutaIcmsExcepcionHibernateDAO.java | 19 + .../hibernate/RutaSecuenciaHibernateDAO.java | 208 + .../dao/hibernate/SapHibernateDAO.java | 147 + .../SecretariaEmpresaHibernateDAO.java | 33 + .../dao/hibernate/SecretariaHibernateDAO.java | 79 + .../dao/hibernate/SegVKMHibernateDAO.java | 111 + .../SeguradoraEmpresaHibernateDAO.java | 38 + .../dao/hibernate/SeguroKmHibernateDAO.java | 42 + .../hibernate/SeguroTarifaHibernateDAO.java | 42 + .../dao/hibernate/SisdapHibernateDAO.java | 616 ++ .../dao/hibernate/SistemaHibernateDAO.java | 39 + .../TarifaCategoriaHibernateDAO.java | 46 + .../TarifaEmbarcadaHibernateDAO.java | 215 + .../TarifaEmbarcadaHistHibernateDAO.java | 35 + .../dao/hibernate/TarifaHibernateDAO.java | 484 ++ .../dao/hibernate/TarifaHistHibernateDAO.java | 37 + .../dao/hibernate/TarifaKmHibernateDAO.java | 42 + .../hibernate/TarifaMinimaHibernateDAO.java | 297 + .../hibernate/TarifaOficialHibernateDAO.java | 522 ++ .../TarifaTipoptovtaHibernateDAO.java | 38 + .../hibernate/TarjetaCreditoHibernateDAO.java | 33 + .../TarjetaFidelidadHibernateDAO.java | 93 + .../TarjetaRecaudacionHibernateDAO.java | 39 + .../hibernate/TarjetaViajeHibernateDAO.java | 139 + .../TaxaEmbLevanteCtrlHibernateDAO.java | 19 + .../hibernate/TaxaEmbarqueKmHibernateDAO.java | 38 + .../TaxaEmbarqueParadaHibernateDAO.java | 108 + .../TipoCambioCiudadHibernateDAO.java | 37 + .../hibernate/TipoCambioCtrlHibernateDAO.java | 37 + .../hibernate/TipoConvenioHibernateDAO.java | 38 + .../dao/hibernate/TipoCorteHibernateDAO.java | 46 + .../TipoCortesiaDescuentoHibernateDAO.java | 83 + .../hibernate/TipoCortesiaHibernateDAO.java | 53 + .../hibernate/TipoDocAutobusHibernateDAO.java | 18 + .../hibernate/TipoDomicilioHibernateDAO.java | 56 + .../hibernate/TipoEmpleadoHibernateDAO.java | 42 + .../TipoEventoExtraEmpresaHibernateDAO.java | 41 + .../TipoEventoExtraHibernateDAO.java | 42 + .../TipoEventoExtraPtovtaHibernateDAO.java | 31 + .../TipoIdentificacionHibernateDAO.java | 19 + .../TipoInformativoComissaoHibernateDAO.java | 45 + .../TipoMovimentacionHibernateDAO.java | 55 + .../hibernate/TipoMovimientoHibernateDAO.java | 46 + .../hibernate/TipoOcupacionHibernateDAO.java | 56 + .../dao/hibernate/TipoParadaHibernateDAO.java | 47 + .../hibernate/TipoPuntoVentaHibernateDAO.java | 58 + .../hibernate/TipoServicioHibernateDAO.java | 59 + .../TipoTarifaPacoteHibernateDAO.java | 52 + .../dao/hibernate/TipoVentaHibernateDAO.java | 70 + .../dao/hibernate/TramoHibernateDAO.java | 288 + .../TramoKmServicioHibernateDAO.java | 44 + .../hibernate/TramoServicioHibernateDAO.java | 162 + .../hibernate/TramoTiempoHibernateDAO.java | 95 + .../dao/hibernate/TurnoHibernateDAO.java | 46 + .../UsuarioBancarioHibernateDAO.java | 37 + .../hibernate/UsuarioEmpresaHibernateDAO.java | 75 + .../dao/hibernate/UsuarioHibernateDAO.java | 253 + .../hibernate/UsuarioPerfilHibernateDAO.java | 46 + .../hibernate/UsuarioSesionHibernateDAO.java | 55 + .../UsuarioUbicacionHibernateDAO.java | 53 + .../hibernate/VendaPacoteHibernateDAO.java | 45 + .../dao/hibernate/ViaHibernateDAO.java | 48 + .../hibernate/VigenciaTarifaHibernateDAO.java | 76 + .../sqlfunction/FnArredondamentoTarifa.java | 49 + .../dao/sqlbuilder/SQLBuilder.java | 128 + .../dao/sqlbuilder/SQLFactory.java | 18 + .../dao/sqlbuilder/impl/SQLBuilderOracle.java | 1423 ++++ .../ventaboletos/dao/util/AidfGenerator.java | 33 + .../dao/util/ClaseServicioGenerator.java | 23 + .../dao/util/ClaseServicioStore.java | 54 + .../ventaboletos/dao/util/DBUtil.java | 86 + .../dao/util/FormaPagoGenerator.java | 26 + .../ventaboletos/dao/util/IdAidfStore.java | 125 + .../dao/util/IdFormaPagoStore.java | 121 + .../dao/util/IdTipoParadaStore.java | 121 + .../dao/util/TipoParadaGenerator.java | 26 + .../ventaboletos/entidad/AbastoBoleto.java | 282 + .../ventaboletos/entidad/AbastoCentral.java | 150 + .../ventaboletos/entidad/AbastoHisto.java | 189 + .../entidad/AgrupamentoParada.java | 106 + .../ventaboletos/entidad/Aidf.java | 293 + .../ventaboletos/entidad/AidfEspecie.java | 115 + .../ventaboletos/entidad/AidfTipo.java | 113 + .../entidad/AjusteEventoExtra.java | 208 + .../ventaboletos/entidad/AlertaCtrl.java | 276 + .../ventaboletos/entidad/AliasServico.java | 174 + .../entidad/AliquotaEstadoDestino.java | 123 + .../ventaboletos/entidad/Articulo.java | 164 + .../entidad/AsientoExclusivo.java | 193 + .../ventaboletos/entidad/AuditLog.java | 143 + .../ventaboletos/entidad/AuditModule.java | 54 + .../ventaboletos/entidad/AuditService.java | 64 + .../ventaboletos/entidad/Autobus.java | 330 + .../ventaboletos/entidad/AutobusDoc.java | 100 + .../ventaboletos/entidad/Autorizacion.java | 126 + .../entidad/AutorizacionPerfil.java | 130 + .../ventaboletos/entidad/Banco.java | 172 + .../ventaboletos/entidad/Boleto.java | 1252 ++++ .../ventaboletos/entidad/Caja.java | 1248 ++++ .../ventaboletos/entidad/CajaDetPago.java | 249 + .../ventaboletos/entidad/CajaDiversos.java | 432 ++ .../entidad/CajaDiversosPago.java | 136 + .../ventaboletos/entidad/CajaFormaPago.java | 136 + .../ventaboletos/entidad/CajaTarjeta.java | 260 + .../entidad/CancelacionCargo.java | 160 + .../ventaboletos/entidad/CancelacionCtrl.java | 222 + .../ventaboletos/entidad/CasetaPeaje.java | 172 + .../entidad/CasetaPeajeExcepcion.java | 203 + .../ventaboletos/entidad/Categoria.java | 292 + .../CategoriaBloqueioImpPosterior.java | 68 + .../ventaboletos/entidad/CategoriaClase.java | 135 + .../entidad/CategoriaCorrida.java | 141 + .../ventaboletos/entidad/CategoriaCtrl.java | 371 + .../entidad/CategoriaDescuento.java | 972 +++ .../ventaboletos/entidad/CategoriaMarca.java | 136 + .../entidad/CategoriaMercado.java | 147 + .../ventaboletos/entidad/CategoriaOrgao.java | 133 + .../entidad/CategoriaPeriodo.java | 157 + .../ventaboletos/entidad/CategoriaRuta.java | 162 + .../entidad/CategoriaRutaExcecao.java | 131 + .../entidad/CategoriaTipoPtoVta.java | 150 + .../ventaboletos/entidad/Ciudad.java | 204 + .../ventaboletos/entidad/ClaseServicio.java | 274 + .../entidad/ClaseservicioEquivalencia.java | 140 + .../ventaboletos/entidad/Clasificacion.java | 149 + .../entidad/ClasseIndicePeaje.java | 94 + .../ventaboletos/entidad/Cliente.java | 556 ++ .../ventaboletos/entidad/ClienteCurso.java | 93 + .../entidad/ClienteDescuento.java | 241 + .../entidad/ClienteDireccion.java | 294 + .../entidad/ClienteFidelidad.java | 129 + .../ventaboletos/entidad/ClientePacote.java | 189 + .../entidad/CobrancaAdcPuntoVenta.java | 319 + .../entidad/CobrancaAdicionalHistorico.java | 167 + .../entidad/CoeficienteTarifa.java | 118 + .../ventaboletos/entidad/Colonia.java | 163 + .../ventaboletos/entidad/ComEmpCategoria.java | 117 + .../entidad/ComEmpConferencia.java | 232 + .../ventaboletos/entidad/ComEmpFormapago.java | 117 + .../entidad/ComEmpTipoEventoExtra.java | 116 + .../entidad/ComisionistaExterno.java | 116 + .../ventaboletos/entidad/Comissao.java | 374 + .../ventaboletos/entidad/ComissaoLog.java | 195 + .../ventaboletos/entidad/ComissaoReceita.java | 401 ++ .../entidad/CompaniaBancaria.java | 180 + .../ventaboletos/entidad/Conductor.java | 172 + .../ventaboletos/entidad/Conexion.java | 205 + .../ventaboletos/entidad/ConexionConf.java | 183 + .../ventaboletos/entidad/ConexionCtrl.java | 147 + .../entidad/ConexionCtrlTemp.java | 126 + .../entidad/ConexionDescuento.java | 135 + .../entidad/ConexionExcepcion.java | 134 + .../entidad/ConexionExcepcionRuta.java | 78 + .../entidad/ConexionRutaConf.java | 136 + .../entidad/ConexionRutaCtrl.java | 177 + .../entidad/ConexionRutaExcepcionPtoVta.java | 129 + .../ConexionRutaExcepcionTipoPtoVta.java | 130 + .../entidad/ConexionRutaTramoCtrl.java | 198 + .../ventaboletos/entidad/ConexionTemp.java | 156 + .../entidad/ConfContratoPuntoVenta.java | 122 + .../entidad/ConfRestricaoCanalVenta.java | 509 ++ .../entidad/ConfRestricaoExcecao.java | 150 + .../entidad/ConfRestricaoOrgaoConcedente.java | 132 + .../entidad/ConfRestricaoPtovta.java | 157 + .../entidad/ConfRestricaoRutas.java | 132 + .../entidad/ConfRestricaoTramo.java | 274 + .../entidad/ConfRestricaoTramoOC.java | 149 + .../entidad/ConfRestricaoVendaWeb.java | 80 + .../ventaboletos/entidad/ConfTotem.java | 110 + .../ventaboletos/entidad/Conferencia.java | 289 + .../entidad/ConferenciaPendencia.java | 127 + .../entidad/ConfigRestriccionPago.java | 141 + .../ventaboletos/entidad/Constante.java | 156 + .../entidad/ContaCorrentePtoVta.java | 405 ++ .../ventaboletos/entidad/ContaMD.java | 207 + .../entidad/ControleEstoqueMigracao.java | 81 + .../ventaboletos/entidad/Convenio.java | 373 + .../ventaboletos/entidad/ConvenioDet.java | 191 + .../ventaboletos/entidad/ConvenioEmpresa.java | 106 + .../entidad/ConvenioPuntoVenta.java | 117 + .../ventaboletos/entidad/ConvenioRuta.java | 106 + .../ventaboletos/entidad/ConvenioTramo.java | 142 + .../ventaboletos/entidad/ConvenioUsuario.java | 117 + .../ventaboletos/entidad/Corrida.java | 609 ++ .../ventaboletos/entidad/CorridaCtrl.java | 170 + .../ventaboletos/entidad/CorridaTramo.java | 386 ++ .../ventaboletos/entidad/Cortesia.java | 260 + .../entidad/CortesiaBeneficiario.java | 186 + .../entidad/CortesiaDireccion.java | 177 + .../ventaboletos/entidad/Cotacao.java | 106 + .../entidad/CtrlFechamentoCaixa.java | 96 + .../ventaboletos/entidad/CtrlSerieBPe.java | 110 + .../entidad/CtrlSerieEmbarcada.java | 180 + .../ventaboletos/entidad/CuponConvenio.java | 133 + .../ventaboletos/entidad/CuponSecretaria.java | 208 + .../ventaboletos/entidad/Curso.java | 100 + .../ventaboletos/entidad/Custom.java | 167 + .../entidad/CustomIdGenerator.java | 74 + .../entidad/DepositoBancario.java | 158 + .../entidad/DescontoComissao.java | 185 + .../ventaboletos/entidad/DetAbastoBoleto.java | 191 + .../entidad/DetDiagramaAutobus.java | 219 + .../ventaboletos/entidad/DiagramaAutobus.java | 203 + .../entidad/DispositivoEmbarcada.java | 201 + .../DispositivoEmbarcadaHistorico.java | 86 + .../ventaboletos/entidad/Division.java | 155 + .../entidad/EmbarcadaDispOperador.java | 104 + .../entidad/EmbarqueCatracaRodoviaria.java | 116 + .../ventaboletos/entidad/Empleado.java | 261 + .../ventaboletos/entidad/Empresa.java | 1475 ++++ .../entidad/EmpresaContaBancaria.java | 161 + .../ventaboletos/entidad/EmpresaEmail.java | 196 + .../entidad/EmpresaEmailConfig.java | 178 + .../entidad/EmpresaEmailFlexBus.java | 232 + .../entidad/EmpresaEquivalencia.java | 140 + .../ventaboletos/entidad/EmpresaImposto.java | 822 +++ .../entidad/EmpresaSaferConfig.java | 157 + .../entidad/EmpresaTrocoSimples.java | 167 + .../ventaboletos/entidad/EnderecoApanhe.java | 221 + .../ventaboletos/entidad/Escola.java | 96 + .../entidad/EsquemaAgrupacion.java | 148 + .../ventaboletos/entidad/EsquemaAsiento.java | 214 + .../ventaboletos/entidad/EsquemaCorrida.java | 849 +++ .../EsquemaCorridaEmbarqueDesembarque.java | 210 + .../entidad/EsquemaOperacional.java | 210 + .../ventaboletos/entidad/EsquemaTramo.java | 231 + .../ventaboletos/entidad/Estacion.java | 456 ++ .../entidad/EstacionImpresora.java | 144 + .../ventaboletos/entidad/EstacionRioCard.java | 143 + .../ventaboletos/entidad/EstacionSitef.java | 209 + .../ventaboletos/entidad/Estado.java | 293 + .../ventaboletos/entidad/EventoExtra.java | 249 + .../ventaboletos/entidad/ExcepcionPeaje.java | 118 + .../entidad/ExcepcionPeajeVigencia.java | 268 + .../entidad/ExcepcionRedondo.java | 146 + .../entidad/FechamentoBoleto.java | 208 + .../entidad/FechamentoCntcorrente.java | 181 + .../entidad/FechamentoParamgeral.java | 356 + .../entidad/FechamentoParamptovta.java | 152 + .../ventaboletos/entidad/Feriado.java | 158 + .../entidad/FiscalAliquotaEmpresa.java | 126 + .../entidad/FiscalFormapagoEmpresa.java | 134 + .../entidad/FiscalImpressora.java | 228 + .../entidad/FiscalImpressoraEstado.java | 129 + .../entidad/FiscalRelgerencialEmpresa.java | 114 + .../entidad/FiscalTotnaofiscalEmpresa.java | 125 + .../ventaboletos/entidad/FolioPreimpreso.java | 181 + .../ventaboletos/entidad/FormaPago.java | 315 + .../ventaboletos/entidad/FormaPagoDet.java | 183 + .../ventaboletos/entidad/FuncionSistema.java | 151 + .../ventaboletos/entidad/GrupoCategoria.java | 102 + .../ventaboletos/entidad/GrupoCortesia.java | 129 + .../ventaboletos/entidad/GrupoRuta.java | 131 + .../entidad/HistoricoPuntoVenta.java | 110 + .../ventaboletos/entidad/Hotel.java | 199 + .../ventaboletos/entidad/Imagem.java | 122 + .../entidad/InscricaoEstadual.java | 279 + .../ventaboletos/entidad/InstiFinanceira.java | 159 + .../ventaboletos/entidad/IntegracaoTotvs.java | 134 + .../ventaboletos/entidad/ItemAdicional.java | 136 + .../ventaboletos/entidad/ItemDesconto.java | 101 + .../ventaboletos/entidad/LogAuditoria.java | 200 + .../ventaboletos/entidad/LogConferencia.java | 286 + .../entidad/LogDespesaReceitaDiversa.java | 80 + .../entidad/LogHistoricoContingencia.java | 135 + .../ventaboletos/entidad/Marca.java | 273 + .../ventaboletos/entidad/MarcaAutobus.java | 87 + .../entidad/MarcaClaseServicio.java | 94 + .../entidad/MarcaClaseServicioPK.java | 48 + .../ventaboletos/entidad/MensagemRecusa.java | 112 + .../ventaboletos/entidad/Mensaje.java | 180 + .../ventaboletos/entidad/MensajeEmpresa.java | 117 + .../entidad/MensajePuntoVenta.java | 117 + .../ventaboletos/entidad/MensajeUsuario.java | 125 + .../entidad/MercadoCompetido.java | 137 + .../entidad/MerchantBancario.java | 155 + .../ventaboletos/entidad/Moneda.java | 159 + .../entidad/MonitoramentoCCF.java | 143 + .../entidad/MonitoramentoCCFR2.java | 11 + .../entidad/MonitoramentoCRZ.java | 143 + .../entidad/MotivoCancelVendaPacote.java | 149 + .../entidad/MotivoCancelacion.java | 156 + .../entidad/MotivoDevolucaoBilhete.java | 134 + .../entidad/MotivoReimpresion.java | 122 + .../ventaboletos/entidad/MotivoViaje.java | 132 + .../MotivocancelacionEquivalencia.java | 140 + .../ventaboletos/entidad/Nodo.java | 137 + .../entidad/NotaCreditoVendaPacote.java | 220 + .../ventaboletos/entidad/OCD.java | 334 + .../entidad/OCDDatosPagamento.java | 156 + .../ventaboletos/entidad/OCDParam.java | 268 + .../ventaboletos/entidad/OCDPtoVtaParam.java | 94 + .../entidad/OperadorEmbarcada.java | 141 + .../entidad/OperadorEmbarcadaLinha.java | 73 + .../entidad/OperadorEmbarcadaServico.java | 73 + .../entidad/OrgaoCancelacion.java | 369 + .../ventaboletos/entidad/OrgaoConcedente.java | 332 + .../ventaboletos/entidad/OrgaoEmpParam.java | 167 + .../ventaboletos/entidad/OrgaoTramo.java | 191 + .../ventaboletos/entidad/Pacote.java | 219 + .../ventaboletos/entidad/PacoteConvenio.java | 88 + .../entidad/PacoteDescontoBilhete.java | 108 + .../ventaboletos/entidad/PacoteFormapago.java | 68 + .../ventaboletos/entidad/PacoteItem.java | 126 + .../ventaboletos/entidad/PacoteTarifa.java | 167 + .../ventaboletos/entidad/Pais.java | 138 + .../ventaboletos/entidad/Parada.java | 387 ++ .../entidad/ParadaCodOrgaoConcedente.java | 81 + .../entidad/ParadaEquivalencia.java | 140 + .../ventaboletos/entidad/ParadaEsquema.java | 115 + .../ventaboletos/entidad/ParadaSecuencia.java | 111 + .../ParadaSecuenciaCombinacaoLinha.java | 65 + .../entidad/ParamAcumulaMasivo.java | 159 + .../entidad/ParamAcumulaPunto.java | 226 + .../ventaboletos/entidad/ParamArticulo.java | 79 + .../ventaboletos/entidad/ParamCanjePunto.java | 181 + .../entidad/ParamCompraPunto.java | 127 + .../ventaboletos/entidad/ParamConexion.java | 133 + .../entidad/ParamCostoTarjeta.java | 128 + .../entidad/ParamRecoleccion.java | 140 + .../ventaboletos/entidad/Peaje.java | 139 + .../ventaboletos/entidad/Perfil.java | 169 + .../ventaboletos/entidad/PerfilFuncion.java | 147 + .../entidad/PeriodoVacacional.java | 128 + .../ventaboletos/entidad/Plaza.java | 116 + .../entidad/PrecioFixoPedagio.java | 180 + .../ventaboletos/entidad/PrecioVentaja.java | 212 + .../ventaboletos/entidad/PrecoApanhe.java | 146 + .../ventaboletos/entidad/Pricing.java | 574 ++ .../ventaboletos/entidad/PricingAsiento.java | 149 + .../entidad/PricingCategoria.java | 129 + .../ventaboletos/entidad/PricingClase.java | 129 + .../entidad/PricingClasseTarifaria.java | 136 + .../ventaboletos/entidad/PricingCorrida.java | 129 + .../ventaboletos/entidad/PricingCtrl.java | 97 + .../ventaboletos/entidad/PricingDia.java | 234 + .../entidad/PricingEspecifico.java | 473 ++ .../entidad/PricingEspecificoAgencia.java | 132 + .../entidad/PricingEspecificoCanalVendas.java | 141 + .../entidad/PricingEspecificoCategoria.java | 143 + .../entidad/PricingEspecificoOcupacion.java | 172 + .../entidad/PricingFormapago.java | 143 + .../ventaboletos/entidad/PricingImporte.java | 140 + .../ventaboletos/entidad/PricingMarca.java | 129 + .../ventaboletos/entidad/PricingMercado.java | 140 + .../entidad/PricingOcupaAntecipa.java | 199 + .../entidad/PricingPuntoVenta.java | 129 + .../ventaboletos/entidad/PricingRuta.java | 129 + .../entidad/PricingTipoPtoVta.java | 129 + .../entidad/PricingTipoServicio.java | 132 + .../ventaboletos/entidad/PricingVigencia.java | 162 + .../entidad/ProdClaseServicio.java | 130 + .../ventaboletos/entidad/ProdFormaPago.java | 130 + .../ventaboletos/entidad/ProdMarca.java | 131 + .../ventaboletos/entidad/ProdMercado.java | 141 + .../ventaboletos/entidad/ProdPrecio.java | 172 + .../ventaboletos/entidad/ProdPuntoVenta.java | 130 + .../ventaboletos/entidad/ProdRuta.java | 131 + .../ventaboletos/entidad/ProdTipoptovta.java | 130 + .../ventaboletos/entidad/ProdVigencia.java | 141 + .../entidad/ProductoServicio.java | 299 + .../ventaboletos/entidad/PtoVtaCheckin.java | 137 + .../ventaboletos/entidad/PtoVtaSeguro.java | 270 + .../entidad/PtoVtaUsuarioBancario.java | 149 + .../ventaboletos/entidad/PtovtaAgencia.java | 298 + .../entidad/PtovtaAntecipacomissao.java | 173 + .../entidad/PtovtaAntifraude.java | 163 + .../ventaboletos/entidad/PtovtaCatInd.java | 198 + .../ventaboletos/entidad/PtovtaComissao.java | 602 ++ .../ventaboletos/entidad/PtovtaContaMD.java | 126 + .../ventaboletos/entidad/PtovtaDiversos.java | 324 + .../ventaboletos/entidad/PtovtaEmpresa.java | 270 + .../entidad/PtovtaEmpresaBloqueada.java | 108 + .../entidad/PtovtaEmpresaContaBancaria.java | 132 + .../ventaboletos/entidad/PtovtaEstoque.java | 218 + .../ventaboletos/entidad/PtovtaHorario.java | 233 + .../entidad/PtovtaTipoEstoque.java | 121 + .../ventaboletos/entidad/PtovtaTitular.java | 198 + .../ventaboletos/entidad/PuntoVenta.java | 1203 ++++ .../ventaboletos/entidad/PuntoVentaVO.java | 29 + .../ventaboletos/entidad/Redondeo.java | 169 + .../ventaboletos/entidad/RedondeoCtrl.java | 172 + .../ventaboletos/entidad/RedondeoMarca.java | 144 + .../entidad/RegionMetropolitana.java | 120 + .../entidad/RequisicionBoleto.java | 175 + .../entidad/ReservaEspecialCliente.java | 270 + .../entidad/ReservacionCategoria.java | 140 + .../entidad/ReservacionClase.java | 140 + .../ventaboletos/entidad/ReservacionCtrl.java | 543 ++ .../entidad/ReservacionMarca.java | 140 + .../entidad/ReservacionMercado.java | 157 + .../entidad/ReservacionPuntoVenta.java | 142 + .../ventaboletos/entidad/RestriccionPago.java | 134 + .../ventaboletos/entidad/RhPagoConductor.java | 227 + .../ventaboletos/entidad/RolOperativo.java | 176 + .../ventaboletos/entidad/Ruta.java | 666 ++ .../ventaboletos/entidad/RutaCaseta.java | 85 + .../ventaboletos/entidad/RutaCombinacion.java | 169 + .../entidad/RutaEmbarqueDesembarque.java | 155 + .../ventaboletos/entidad/RutaEmpresa.java | 117 + .../entidad/RutaIcmsExcepcion.java | 168 + .../ventaboletos/entidad/RutaSecuencia.java | 217 + .../ventaboletos/entidad/Secretaria.java | 288 + .../entidad/SecretariaEmpresa.java | 108 + .../ventaboletos/entidad/SegVKM.java | 150 + .../entidad/SeguradoraEmpresa.java | 80 + .../ventaboletos/entidad/SeguroKm.java | 151 + .../ventaboletos/entidad/SeguroTarifa.java | 141 + .../ventaboletos/entidad/Sistema.java | 128 + .../ventaboletos/entidad/Tarifa.java | 436 ++ .../ventaboletos/entidad/TarifaCategoria.java | 155 + .../ventaboletos/entidad/TarifaDemanda.java | 311 + .../ventaboletos/entidad/TarifaEmbarcada.java | 323 + .../entidad/TarifaEmbarcadaHist.java | 179 + .../ventaboletos/entidad/TarifaHist.java | 183 + .../ventaboletos/entidad/TarifaKm.java | 157 + .../ventaboletos/entidad/TarifaMinima.java | 262 + .../entidad/TarifaMinimaCategoria.java | 120 + .../ventaboletos/entidad/TarifaOficial.java | 370 + .../entidad/TarifaTipoptovta.java | 156 + .../entidad/TarifaVendaPacote.java | 145 + .../ventaboletos/entidad/TarjetaCredito.java | 146 + .../entidad/TarjetaFidelidad.java | 119 + .../entidad/TarjetaFidelidadCuenta.java | 38 + .../entidad/TarjetaRecaudacion.java | 222 + .../entidad/TarjetaRecaudacionPK.java | 80 + .../ventaboletos/entidad/TarjetaViaje.java | 324 + .../ventaboletos/entidad/TaxaEmbLevante.java | 143 + .../entidad/TaxaEmbLevanteCtrl.java | 157 + .../ventaboletos/entidad/TaxaEmbarqueKm.java | 141 + .../entidad/TaxaEmbarqueParada.java | 180 + .../entidad/TipoCambioCiudad.java | 130 + .../ventaboletos/entidad/TipoCambioCtrl.java | 173 + .../ventaboletos/entidad/TipoConvenio.java | 122 + .../ventaboletos/entidad/TipoCorte.java | 116 + .../ventaboletos/entidad/TipoCortesia.java | 141 + .../entidad/TipoCortesiaDescuento.java | 134 + .../ventaboletos/entidad/TipoDocAutobus.java | 72 + .../ventaboletos/entidad/TipoDomicilio.java | 136 + .../ventaboletos/entidad/TipoEmpleado.java | 114 + .../ventaboletos/entidad/TipoEventoExtra.java | 452 ++ .../entidad/TipoEventoExtraEmpresa.java | 104 + .../entidad/TipoEventoExtraPtoVta.java | 102 + .../entidad/TipoIdentificacion.java | 103 + .../entidad/TipoInformativoComissao.java | 101 + .../entidad/TipoMovimentacion.java | 125 + .../ventaboletos/entidad/TipoMovimiento.java | 116 + .../ventaboletos/entidad/TipoOcupacion.java | 137 + .../ventaboletos/entidad/TipoOperacionCC.java | 131 + .../ventaboletos/entidad/TipoParada.java | 119 + .../ventaboletos/entidad/TipoPuntoVenta.java | 155 + .../ventaboletos/entidad/TipoServicio.java | 118 + .../entidad/TipoTarifaPacote.java | 143 + .../ventaboletos/entidad/TipoVenta.java | 116 + .../ventaboletos/entidad/Tramo.java | 344 + .../ventaboletos/entidad/TramoKm.java | 112 + .../ventaboletos/entidad/TramoKmServicio.java | 165 + .../ventaboletos/entidad/TramoServicio.java | 155 + .../ventaboletos/entidad/TramoTiempo.java | 236 + .../ventaboletos/entidad/Turno.java | 116 + .../ventaboletos/entidad/Usuario.java | 544 ++ .../ventaboletos/entidad/UsuarioBancario.java | 157 + .../ventaboletos/entidad/UsuarioEmpresa.java | 190 + .../ventaboletos/entidad/UsuarioPerfil.java | 161 + .../ventaboletos/entidad/UsuarioSesion.java | 167 + .../entidad/UsuarioUbicacion.java | 141 + .../ventaboletos/entidad/VendaPacote.java | 254 + .../ventaboletos/entidad/Via.java | 128 + .../ventaboletos/entidad/VigenciaTarifa.java | 159 + .../ventaboletos/entidad/Zona.java | 128 + .../enums/CtrlFechamentoCaixaStatus.java | 9 + .../ventaboletos/enums/CustomTipo.java | 36 + .../enums/EAmbienteContingencia.java | 32 + .../enums/EStatusContingencia.java | 32 + .../ventaboletos/enums/EnumTipoVenda.java | 93 + .../enums/FuncionSistemaEnum.java | 36 + .../enums/HorarioLiberacaoVendaPassagem.java | 8 + .../enums/IndRestricaoFormaPago.java | 33 + .../ventaboletos/enums/IndStatusBoleto.java | 74 + .../enums/LocalEnderecoApanhe.java | 40 + .../ventaboletos/enums/MDOrigem.java | 19 + .../ventaboletos/enums/MimeType.java | 22 + .../ModeloComissaoImpressaoPosterior.java | 8 + .../ventaboletos/enums/PricingOperacaoWS.java | 7 + ...elatorioMovimentacaoBilheteStatusEnum.java | 57 + ...torioVendaCartaoCashMonitorModeloEnum.java | 21 + .../ventaboletos/enums/SistemaEnum.java | 35 + .../ventaboletos/enums/SituacaoBoleto.java | 28 + .../enums/SituacaoNotaCreditoVendaPacote.java | 25 + .../enums/SituacaoVendaPacote.java | 39 + .../enums/StatusAutorizacaoRuta.java | 54 + .../ventaboletos/enums/StatusFlexBus.java | 62 + .../enums/StatusIntegracaoSap.java | 7 + .../ventaboletos/enums/TipoAntifraude.java | 7 + .../TipoBloqueioDispositivoEmbarcadaEnum.java | 42 + .../enums/TipoCarteiraDigital.java | 27 + .../enums/TipoClasseServicoBPe.java | 56 + .../ventaboletos/enums/TipoCstGratuidade.java | 9 + .../ventaboletos/enums/TipoDescontoBPe.java | 48 + .../enums/TipoDescontoMonitrip.java | 62 + .../ventaboletos/enums/TipoEnvioRest.java | 6 + .../ventaboletos/enums/TipoFormapago.java | 74 + .../enums/TipoIdentificacionDoc.java | 238 + .../ventaboletos/enums/TipoImpressora.java | 64 + .../enums/TipoImpressoraRelatorio.java | 32 + .../ventaboletos/enums/TipoIntegracaoTEF.java | 28 + .../ventaboletos/enums/TipoPassagemCores.java | 46 + .../ventaboletos/enums/TipoPessoa.java | 34 + .../ventaboletos/enums/TipoSocio.java | 26 + .../ventaboletos/enums/TypeContentEmail.java | 11 + .../ventaboletos/enums/TypeEventListener.java | 21 + .../enums/auditoria/EnumAuditAction.java | 44 + .../enums/comissao/BoletoStatusComissao.java | 16 + .../enums/comissao/CoresConferencia.java | 22 + .../enums/comissao/StatusLogConferencia.java | 34 + .../enums/comissao/TipoLogConferencia.java | 40 + .../exception/BusinessException.java | 30 + .../exception/ComissaoException.java | 35 + .../ConstanteEstacaoEmbarcadaException.java | 18 + ...ositivoEmbarcadaJaCadastradoException.java | 18 + .../exception/IntegracionException.java | 32 + .../SerieEmbarcadaNaoDisponivelException.java | 5 + .../exception/ValidacionCampoException.java | 32 + .../VendaEmbarcadaBoletoException.java | 19 + ...endaEmbarcadaBoletoFormapagoException.java | 19 + .../VendaEmbarcadaCajaException.java | 19 + .../VendaEmbarcadaCajaFormapagoException.java | 19 + .../vo/ClienteExcelVo.java | 168 + .../relatorios/MovimentoLinha.java | 82 + .../relatorios/MovimentoSecoes.java | 173 + .../ventaboletos/relatorios/PrefixoAntt.java | 84 + ...latorioFinanceiroReceitasDespesasBean.java | 208 + .../rest/ContingenciaClienteRest.java | 137 + .../ventaboletos/rest/IntegracaoSapRest.java | 130 + .../service/AbastoBoletoService.java | 6 + .../service/AbastoCentralService.java | 13 + .../service/AbastoHistoService.java | 8 + .../service/AgruparParadaService.java | 18 + .../ventaboletos/service/AidfService.java | 49 + .../service/AjusteEventoExtraService.java | 8 + .../service/AlertaCtrlService.java | 35 + .../service/AliasServicoService.java | 28 + .../service/AliquotaEstadoDestinoService.java | 14 + .../service/ArquivoRemessaCNAB.java | 26 + .../ventaboletos/service/ArticuloService.java | 17 + .../service/AsientoExclusivoService.java | 14 + .../ventaboletos/service/AuditLogService.java | 12 + .../service/AuditModuleService.java | 8 + .../service/AuditServiceService.java | 7 + .../service/AutobusDocService.java | 10 + .../ventaboletos/service/AutobusService.java | 18 + .../service/AutorizaFolioService.java | 17 + .../service/AutorizacionPerfilService.java | 19 + .../service/AutorizacionService.java | 17 + .../ventaboletos/service/BancoService.java | 19 + .../ventaboletos/service/BoletoService.java | 23 + .../ventaboletos/service/BpeService.java | 28 + .../service/CalcularPeajeService.java | 12 + .../service/CalculoComissaoService.java | 125 + .../service/CancelacionCargoService.java | 16 + .../service/CancelacionCtrlService.java | 23 + .../service/CasetaPeajeExcepcionService.java | 10 + .../service/CasetaPeajeService.java | 14 + .../CategoriaBloqueioImpPosteriorService.java | 7 + .../service/CategoriaClaseService.java | 17 + .../service/CategoriaCorridaService.java | 17 + .../service/CategoriaCtrlService.java | 27 + .../service/CategoriaDescuentoService.java | 14 + .../service/CategoriaMarcaService.java | 17 + .../service/CategoriaMercadoService.java | 17 + .../service/CategoriaOrgaoService.java | 9 + .../service/CategoriaPeriodoService.java | 20 + .../service/CategoriaService.java | 31 + .../service/CategoriaTipoPtoVtaService.java | 21 + .../ventaboletos/service/CiudadService.java | 26 + .../service/ClaseServicioService.java | 23 + .../ClaseservicioEquivalenciaService.java | 22 + .../service/ClienteCursoService.java | 11 + .../service/ClienteDescuentoService.java | 9 + .../service/ClienteDireccionService.java | 14 + .../ventaboletos/service/ClienteService.java | 21 + .../service/CobrancaAdcPuntoVentaService.java | 16 + .../service/CoeficienteTarifaService.java | 20 + .../ventaboletos/service/ColoniaService.java | 22 + .../service/ComisionistaExternoService.java | 17 + .../service/ComissaoReceitaService.java | 17 + .../ventaboletos/service/ComissaoService.java | 16 + .../service/CompaniaBancariaService.java | 17 + .../service/ConductorService.java | 16 + .../service/ConexionConfService.java | 16 + .../service/ConexionCtrlService.java | 11 + .../service/ConexionDescuentoService.java | 16 + .../service/ConexionExcepcionRutaService.java | 11 + .../service/ConexionExcepcionService.java | 11 + .../ConexionRutaCombinacionService.java | 19 + .../service/ConexionRutaConfService.java | 44 + .../service/ConexionRutaCtrlService.java | 29 + .../ConexionRutaExcepcionPtoVtaService.java | 24 + ...onexionRutaExcepcionTipoPtoVtaService.java | 26 + .../service/ConexionRutaTramoCtrlService.java | 39 + .../ventaboletos/service/ConexionService.java | 34 + .../ConfContratoPuntoVentaService.java | 11 + .../ConfRestricaoCanalVentaService.java | 14 + .../service/ConfRestricaoExcecaoService.java | 7 + .../ConfRestricaoOrgaoConcedenteService.java | 8 + .../service/ConfRestricaoPtovtaService.java | 8 + .../service/ConfRestricaoRutasService.java | 8 + .../service/ConfRestricaoTramoOCService.java | 8 + .../service/ConfRestricaoTramoService.java | 7 + .../service/ConfRestricaoVendaWebService.java | 7 + .../service/ConfTotemService.java | 12 + .../service/ConferenciaComissaoService.java | 98 + .../service/ConferenciaPendenciaService.java | 11 + .../service/ConfigRestriccionPagoService.java | 33 + .../service/ConstanteService.java | 30 + .../ventaboletos/service/ContaMDService.java | 7 + .../service/ContingenciaService.java | 16 + .../ControleSerieEmbarcadaService.java | 14 + .../service/ConvenioDetService.java | 14 + .../ventaboletos/service/ConvenioService.java | 17 + .../service/CorridaCtrlService.java | 30 + .../ventaboletos/service/CorridaService.java | 83 + .../service/CorridaTramoService.java | 10 + .../service/CortesiaBeneficiarioService.java | 18 + .../service/CortesiaDireccionService.java | 24 + .../ventaboletos/service/CortesiaService.java | 28 + .../ventaboletos/service/CotacaoService.java | 9 + .../service/CtrlFechamentoCaixaService.java | 25 + .../service/CuponConvenioService.java | 20 + .../service/CuponSecretariaService.java | 14 + .../ventaboletos/service/CursoService.java | 20 + .../ventaboletos/service/CustomService.java | 29 + .../service/DepositoBancarioService.java | 14 + .../service/DescontoComissaoService.java | 14 + .../service/DetAbastoBoletoService.java | 18 + .../service/DetDiagramaAutobusService.java | 28 + .../service/DiagramaAutobusService.java | 30 + .../DispositivoEmbarcadaHistoricoService.java | 22 + .../service/DispositivoEmbarcadaService.java | 31 + .../ventaboletos/service/DivisionService.java | 8 + .../service/EmbarcadaDispOperadorService.java | 17 + .../EmbarqueCatracaRodoviariaService.java | 13 + .../ventaboletos/service/EmpleadoService.java | 21 + .../service/EmpresaContaBancariaService.java | 9 + .../service/EmpresaEmailConfigService.java | 9 + .../service/EmpresaEmailFlexBusService.java | 10 + .../service/EmpresaEmailService.java | 10 + .../service/EmpresaEquivalenciaService.java | 21 + .../service/EmpresaImpostoService.java | 22 + .../service/EmpresaSaferConfigService.java | 9 + .../ventaboletos/service/EmpresaService.java | 67 + .../service/EmpresaTrocoSimplesService.java | 14 + .../service/EnderecoApanheService.java | 12 + .../ventaboletos/service/EscolaService.java | 21 + .../service/EsquemaAgrupacionService.java | 23 + .../service/EsquemaAsientoService.java | 49 + ...uemaCorridaEmbarqueDesembarqueService.java | 12 + .../service/EsquemaCorridaService.java | 61 + .../service/EsquemaOperacionalService.java | 21 + .../service/EsquemaTramoService.java | 22 + .../ventaboletos/service/EstacionService.java | 52 + .../service/EstacionSitefService.java | 25 + .../ventaboletos/service/EstadoService.java | 41 + .../service/EventoExtraService.java | 11 + .../service/ExcepcionPeajeService.java | 13 + .../service/ExcepcionRedondoService.java | 34 + .../service/FechamentoParamgeralService.java | 13 + .../service/FechamentoParamptovtaService.java | 17 + .../ventaboletos/service/FeriadoService.java | 15 + .../service/FiscalAliquotaEmpresaService.java | 18 + .../FiscalImpressoraEstadoService.java | 20 + .../service/FiscalImpressoraService.java | 40 + .../ventaboletos/service/FiscalService.java | 59 + .../service/FlywayUtilService.java | 6 + .../service/FolioPreimpresoService.java | 11 + .../service/FormaPagamentoAgenciaService.java | 12 + .../service/FormaPagoDetService.java | 14 + .../service/FormaPagoService.java | 25 + .../service/FuncionSistemaService.java | 14 + .../ventaboletos/service/GenericService.java | 24 + .../service/GenericServiceInforme.java | 22 + .../service/GrupoCategoriaService.java | 10 + .../service/GrupoCortesiasService.java | 17 + .../service/GrupoRutaService.java | 19 + .../ventaboletos/service/HotelService.java | 10 + .../ventaboletos/service/ImagemService.java | 17 + .../service/ImportacaoClientesService.java | 17 + .../ImportacaoClientesSrvpService.java | 17 + .../service/InformeCategoriaVentaService.java | 12 + .../InformePasajeroServicioService.java | 12 + .../service/InformeServicioDiarioService.java | 12 + .../InformeVentasPuntoVentaService.java | 12 + .../service/InstiFinanceiraService.java | 16 + .../service/IntegracaoService.java | 14 + .../service/IntegracaoTotvsService.java | 22 + .../service/ItemAdicionalService.java | 11 + .../service/ItemDescontoService.java | 10 + .../service/LogAuditoriaService.java | 19 + .../LogDespesasReceitasDivService.java | 10 + .../service/MarcaAutobusService.java | 7 + .../service/MarcaClaseServicioService.java | 27 + .../ventaboletos/service/MarcaService.java | 36 + .../service/MensagemRecusaService.java | 18 + .../service/MensajeEmpresaService.java | 21 + .../service/MensajePuntaVentaService.java | 21 + .../ventaboletos/service/MensajeService.java | 18 + .../service/MensajeUsuarioService.java | 21 + .../service/MercadoCompetidoService.java | 22 + .../service/MerchantBancarioService.java | 14 + .../MigracaoControleEstoqueService.java | 10 + .../ventaboletos/service/MonedaService.java | 20 + .../service/MonitoramentoCCFService.java | 16 + .../service/MonitoramentoCRZService.java | 10 + .../MotivoCancelVendaPacoteService.java | 25 + .../service/MotivoCancelacionService.java | 25 + .../MotivoDevolucaoBilheteService.java | 23 + .../service/MotivoReimpresionService.java | 17 + .../service/MotivoViajeService.java | 16 + .../MotivocancelacionEquivalenciaService.java | 23 + .../service/MovimentacionBilhetesService.java | 33 + .../ventaboletos/service/NodoService.java | 21 + .../NotaCreditoVendaPacoteService.java | 13 + .../ventaboletos/service/OCDParamService.java | 13 + .../service/OCDPtoVtaParamService.java | 22 + .../ventaboletos/service/OCDService.java | 14 + .../service/OperadorEmbarcadaService.java | 26 + .../service/OrgaoCancelacionService.java | 20 + .../service/OrgaoConcedenteService.java | 20 + .../service/OrgaoEmpParamService.java | 15 + .../service/OrgaoTramoService.java | 7 + .../service/PacoteConvenioService.java | 10 + .../service/PacoteDescontoBilheteService.java | 11 + .../service/PacoteItemService.java | 17 + .../ventaboletos/service/PacoteService.java | 13 + .../service/PacoteTarifaService.java | 19 + .../ventaboletos/service/PaisService.java | 17 + .../ParadaCodOrgaoConcedenteService.java | 7 + .../service/ParadaEquivalenciaService.java | 21 + .../ventaboletos/service/ParadaService.java | 46 + .../service/ParamAcumulaMasivoService.java | 21 + .../service/ParamAcumulaPuntoService.java | 19 + .../service/ParamArticuloService.java | 8 + .../service/ParamCanjePuntoService.java | 19 + .../service/ParamCompraPuntoService.java | 21 + .../service/ParamConexionService.java | 9 + .../service/ParamCostoTarjetaService.java | 17 + .../service/ParamRecoleccionService.java | 14 + .../service/PerfilFuncionService.java | 16 + .../ventaboletos/service/PerfilService.java | 33 + .../service/PeriodoVacacionalService.java | 20 + .../ventaboletos/service/PlazaService.java | 17 + .../service/PrecioFixoPedagioService.java | 27 + .../service/PrecioVentajaService.java | 20 + .../service/PrecoApanheService.java | 10 + .../service/PricingAsientoService.java | 20 + .../service/PricingCategoriaService.java | 22 + .../service/PricingClaseService.java | 23 + .../PricingClasseTarifariaService.java | 9 + .../service/PricingCorridaService.java | 23 + .../service/PricingCtrlService.java | 11 + .../service/PricingDiaService.java | 20 + .../PricingEspecificoAgenciaService.java | 8 + .../PricingEspecificoCanalVendasService.java | 8 + .../PricingEspecificoCategoriaService.java | 6 + .../PricingEspecificoOcupacionService.java | 6 + .../service/PricingEspecificoService.java | 29 + .../service/PricingFormapagoService.java | 6 + .../service/PricingImporteService.java | 18 + .../service/PricingMarcaService.java | 23 + .../service/PricingMercadoService.java | 24 + .../service/PricingOcupaAntecipaService.java | 18 + .../service/PricingPuntoVentaService.java | 23 + .../service/PricingRutaService.java | 23 + .../ventaboletos/service/PricingService.java | 43 + .../service/PricingTipoPtoVtaService.java | 22 + .../service/PricingTipoServicioService.java | 23 + .../service/PricingVigenciaService.java | 24 + .../service/ProdClaseServicioService.java | 14 + .../service/ProdFormaPagoService.java | 14 + .../service/ProdMarcaService.java | 20 + .../service/ProdMercadoService.java | 14 + .../service/ProdPrecioService.java | 27 + .../service/ProdPuntoVentaService.java | 14 + .../ventaboletos/service/ProdRutaService.java | 14 + .../service/ProdTipoptovtaService.java | 14 + .../service/ProdVigenciaService.java | 17 + .../service/ProductoServicioService.java | 19 + .../service/PtoVtaCheckinService.java | 7 + .../service/PtoVtaSeguroService.java | 7 + .../service/PtoVtaUsuarioBancarioService.java | 16 + .../service/PtovtaAgenciaService.java | 16 + .../PtovtaAntecipacomissaoService.java | 18 + .../service/PtovtaAntifraudeService.java | 7 + .../service/PtovtaCatIndService.java | 6 + .../service/PtovtaComissaoService.java | 20 + .../service/PtovtaContaMDService.java | 9 + .../service/PtovtaDiversosService.java | 20 + .../PtovtaEmpresaBloqueadaService.java | 7 + .../PtovtaEmpresaContaBancariaService.java | 15 + .../service/PtovtaEmpresaService.java | 19 + .../service/PtovtaEstoqueService.java | 20 + .../service/PtovtaHorarioService.java | 20 + .../service/PtovtaTitularService.java | 17 + .../service/PuntoVentaService.java | 51 + .../service/ReceitaDespesaService.java | 19 + .../service/RedondeoCtrlService.java | 21 + .../service/RedondeoMarcaService.java | 20 + .../ventaboletos/service/RedondeoService.java | 21 + .../service/RegionMetropolitanaService.java | 7 + .../service/RelatorioAgepanService.java | 17 + .../service/RequisicionBoletoService.java | 7 + .../ReservaEspecialClienteService.java | 18 + .../service/ReservacionCategoriaService.java | 15 + .../service/ReservacionClaseService.java | 14 + .../service/ReservacionCtrlService.java | 19 + .../service/ReservacionMarcaService.java | 14 + .../service/ReservacionMercadoService.java | 14 + .../service/ReservacionPuntoVentaService.java | 14 + .../service/RestriccionPagoService.java | 14 + .../service/RhPagoConductorService.java | 14 + .../service/RolOperativoService.java | 32 + .../service/RutaCasetaService.java | 19 + .../service/RutaCombinacionService.java | 80 + .../RutaEmbarqueDesembarqueService.java | 12 + .../service/RutaEmpresaService.java | 22 + .../service/RutaIcmsExcepcionService.java | 6 + .../service/RutaSecuenciaService.java | 45 + .../ventaboletos/service/RutaService.java | 121 + .../ventaboletos/service/SapService.java | 18 + .../service/SecretariaEmpresaService.java | 11 + .../service/SecretariaService.java | 24 + .../ventaboletos/service/SegVKMService.java | 23 + .../service/SeguradoraEmpresaService.java | 9 + .../ventaboletos/service/SeguroKmService.java | 12 + .../service/SeguroTarifaService.java | 12 + .../ventaboletos/service/SisdapService.java | 11 + .../ventaboletos/service/SistemaService.java | 14 + .../service/TarifaCategoriaService.java | 18 + .../service/TarifaEmbarcadaHistService.java | 10 + .../service/TarifaEmbarcadaService.java | 31 + .../service/TarifaHistService.java | 14 + .../ventaboletos/service/TarifaKmService.java | 12 + .../service/TarifaMinimaService.java | 50 + .../service/TarifaOficialService.java | 153 + .../ventaboletos/service/TarifaService.java | 71 + .../service/TarifaTipoptovtaService.java | 15 + .../service/TarjetaCreditoService.java | 7 + .../service/TarjetaFidelidadService.java | 21 + .../service/TarjetaRecaudacionService.java | 16 + .../service/TarjetaViajeService.java | 22 + .../service/TaxaEmbLevanteCtrlService.java | 6 + .../service/TaxaEmbarqueKmService.java | 20 + .../service/TaxaEmbarqueParadaService.java | 26 + .../service/TipoCambioCiudadService.java | 14 + .../service/TipoCambioCtrlService.java | 14 + .../service/TipoConvenioService.java | 16 + .../service/TipoCorteService.java | 17 + .../service/TipoCortesiaDescuentoService.java | 27 + .../service/TipoCortesiaService.java | 19 + .../service/TipoDocAutobusService.java | 6 + .../service/TipoDomicilioService.java | 19 + .../service/TipoEmpleadoService.java | 16 + .../TipoEventoExtraEmpresaService.java | 11 + .../service/TipoEventoExtraPtovtaService.java | 6 + .../service/TipoEventoExtraService.java | 22 + .../service/TipoIdentificacionService.java | 11 + .../TipoInformativoComissaoService.java | 8 + .../service/TipoMovimientoService.java | 17 + .../service/TipoOcupacionService.java | 19 + .../service/TipoParadaService.java | 29 + .../service/TipoPuntoVentaService.java | 29 + .../service/TipoServicioService.java | 17 + .../service/TipoTarifaPacoteService.java | 12 + .../service/TipoVentaService.java | 23 + .../service/TramoKmServicioService.java | 19 + .../service/TramoRutaService.java | 63 + .../ventaboletos/service/TramoService.java | 80 + .../service/TramoServicioService.java | 63 + .../service/TramoTiempoService.java | 25 + .../ventaboletos/service/TurnoService.java | 17 + .../service/UsuarioBancarioService.java | 14 + .../service/UsuarioEmpresaService.java | 16 + .../service/UsuarioPerfilService.java | 22 + .../ventaboletos/service/UsuarioService.java | 48 + .../service/UsuarioSesionService.java | 25 + .../service/UsuarioUbicacionService.java | 18 + .../service/VendaEmbarcadaService.java | 10 + .../ventaboletos/service/ViaService.java | 29 + .../service/VigenciaTarifaService.java | 25 + .../service/impl/AbastoBoletoServiceImpl.java | 58 + .../impl/AbastoCentralServiceImpl.java | 61 + .../service/impl/AbastoHistoServiceImpl.java | 57 + .../impl/AgruparParadaServiceImpl.java | 95 + .../service/impl/AidfServiceImpl.java | 155 + .../impl/AjusteEventoExtraServiceImpl.java | 63 + .../service/impl/AlertaCtrlServiceImpl.java | 85 + .../service/impl/AliasServicoServiceImpl.java | 99 + .../AliquotaEstadoDestinoServiceImpl.java | 37 + .../service/impl/ArquivoRemessaCNABImpl.java | 153 + .../service/impl/ArticuloServiceImpl.java | 65 + .../impl/AsientoExclusivoServiceImpl.java | 65 + .../service/impl/AuditLogServiceImpl.java | 53 + .../service/impl/AuditModuleServiceImpl.java | 46 + .../service/impl/AuditServiceServiceImpl.java | 47 + .../service/impl/AutobusDocServiceImpl.java | 62 + .../service/impl/AutobusServiceImpl.java | 68 + .../impl/AutorizaFolioServiceImpl.java | 286 + .../impl/AutorizacionPerfilServiceImpl.java | 67 + .../service/impl/AutorizacionServiceImpl.java | 65 + .../service/impl/BancoServiceImpl.java | 65 + .../service/impl/BoletoServiceImpl.java | 168 + .../service/impl/BpeServiceImpl.java | 154 + .../impl/CalcularPeajeServiceImpl.java | 36 + .../impl/CalculoComissaoServiceImpl.java | 1687 +++++ .../impl/CancelacionCargoServiceImpl.java | 57 + .../impl/CancelacionCtrlServiceImpl.java | 70 + .../impl/CasetaPeajeExcepcionServiceImpl.java | 60 + .../service/impl/CasetaPeajeServiceImpl.java | 99 + ...egoriaBloqueioImpPosteriorServiceImpl.java | 44 + .../impl/CategoriaClaseServiceImpl.java | 67 + .../impl/CategoriaCorridaServiceImpl.java | 67 + .../impl/CategoriaCtrlServiceImpl.java | 197 + .../impl/CategoriaDescuentoServiceImpl.java | 61 + .../impl/CategoriaMarcaServiceImpl.java | 66 + .../impl/CategoriaMercadoServiceImpl.java | 66 + .../impl/CategoriaOrgaoServiceImpl.java | 63 + .../impl/CategoriaPeriodoServiceImpl.java | 70 + .../service/impl/CategoriaServiceImpl.java | 114 + .../impl/CategoriaTipoPtoVtaServiceImpl.java | 70 + .../service/impl/CiudadServiceImpl.java | 103 + .../impl/ClaseServicioServiceImpl.java | 92 + .../ClaseservicioEquivalenciaServiceImpl.java | 72 + .../service/impl/ClienteCursoServiceImpl.java | 71 + .../impl/ClienteDescuentoServiceImpl.java | 52 + .../impl/ClienteDireccionServiceImpl.java | 63 + .../service/impl/ClienteServiceImpl.java | 84 + .../CobrancaAdcPuntoVentaServiceImpl.java | 68 + .../impl/CoeficienteTarifaServiceImpl.java | 72 + .../service/impl/ColoniaServiceImpl.java | 83 + .../impl/ComisionistaExternoServiceImpl.java | 65 + .../impl/ComissaoReceitaServiceImpl.java | 153 + .../service/impl/ComissaoServiceImpl.java | 88 + .../impl/CompaniaBancariaServiceImpl.java | 81 + .../service/impl/ConductorServiceImpl.java | 55 + .../service/impl/ConexionConfServiceImpl.java | 73 + .../service/impl/ConexionCtrlServiceImpl.java | 111 + .../impl/ConexionDescuentoServiceImpl.java | 52 + .../ConexionExcepcionRutaServiceImpl.java | 66 + .../impl/ConexionExcepcionServiceImpl.java | 67 + .../ConexionRutaCombinacionServiceImpl.java | 314 + .../impl/ConexionRutaConfServiceImpl.java | 292 + .../impl/ConexionRutaCtrlServiceImpl.java | 84 + ...onexionRutaExcepcionPtoVtaServiceImpl.java | 79 + .../ConexionRutaTipoPtoVtaServiceImpl.java | 86 + .../ConexionRutaTramoCtrlServiceImpl.java | 113 + .../service/impl/ConexionServiceImpl.java | 93 + .../ConfContratoPuntoVentaServiceImpl.java | 129 + .../ConfRestricaoCanalVentaServiceImpl.java | 211 + .../impl/ConfRestricaoExcecaoServiceImpl.java | 55 + ...nfRestricaoOrgaoConcedenteServiceImpl.java | 80 + .../impl/ConfRestricaoPtovtaServiceImpl.java | 79 + .../impl/ConfRestricaoRutasServiceImpl.java | 80 + .../impl/ConfRestricaoTramoOCServiceImpl.java | 78 + .../impl/ConfRestricaoTramoServiceImpl.java | 60 + .../ConfRestricaoVendaWebServiceImpl.java | 61 + .../service/impl/ConfTotemServiceImpl.java | 61 + .../impl/ConferenciaComissaoServiceImpl.java | 999 +++ .../impl/ConferenciaPendenciaServiceImpl.java | 51 + .../ConfigRestriccionPagoServiceImpl.java | 153 + .../service/impl/ConstanteServiceImpl.java | 147 + .../service/impl/ContaMDServiceImpl.java | 61 + .../service/impl/ContingenciaServiceImpl.java | 199 + .../ControleSerieEmbarcadaServiceImpl.java | 76 + .../service/impl/ConvenioDetServiceImpl.java | 61 + .../service/impl/ConvenioServiceImpl.java | 95 + .../service/impl/CorridaCtrlServiceImpl.java | 71 + .../service/impl/CorridaServiceImpl.java | 1493 ++++ .../service/impl/CorridaTramoServiceImpl.java | 47 + .../impl/CortesiaBeneficiarioServiceImpl.java | 64 + .../impl/CortesiaDireccionServiceImpl.java | 78 + .../service/impl/CortesiaServiceImpl.java | 114 + .../service/impl/CotacaoServiceImpl.java | 67 + .../impl/CtrlFechamentoCaixaServiceImpl.java | 96 + .../impl/CuponConvenioServiceImpl.java | 69 + .../impl/CuponSecretariaServiceImpl.java | 61 + .../service/impl/CursoServiceImpl.java | 62 + .../service/impl/CustomServiceImpl.java | 111 + .../impl/DepositoBancarioServiceImpl.java | 61 + .../impl/DescontoComissaoServiceImpl.java | 73 + .../impl/DetAbastoBoletoServiceImpl.java | 95 + .../impl/DetDiagramaAutobusServiceImpl.java | 68 + .../impl/DiagramaAutobusServiceImpl.java | 79 + ...positivoEmbarcadaHistoricoServiceImpl.java | 51 + .../impl/DispositivoEmbarcadaServiceImpl.java | 87 + .../service/impl/DivisionServiceImpl.java | 62 + .../EmbarcadaDispOperadorServiceImpl.java | 73 + .../EmbarqueCatracaRodoviariaServiceImpl.java | 44 + .../service/impl/EmpleadoServiceImpl.java | 124 + .../impl/EmpresaContaBancariaServiceImpl.java | 41 + .../impl/EmpresaEmailConfigServiceImpl.java | 68 + .../impl/EmpresaEmailFlexBusServiceImpl.java | 68 + .../service/impl/EmpresaEmailServiceImpl.java | 68 + .../impl/EmpresaEquivalenciaServiceImpl.java | 71 + .../impl/EmpresaImpostoServiceImpl.java | 89 + .../impl/EmpresaSaferConfigServiceImpl.java | 68 + .../service/impl/EmpresaServiceImpl.java | 224 + .../impl/EmpresaTrocoSimplesServiceImpl.java | 47 + .../impl/EnderecoApanheServiceImpl.java | 74 + .../service/impl/EscolaServiceImpl.java | 61 + .../impl/EsquemaAgrupacionServiceImpl.java | 77 + .../impl/EsquemaAsientoServiceImpl.java | 235 + ...CorridaEmbarqueDesembarqueServiceImpl.java | 54 + .../impl/EsquemaCorridaServiceImpl.java | 303 + .../impl/EsquemaOperacionalServiceImpl.java | 70 + .../service/impl/EsquemaTramoServiceImpl.java | 74 + .../service/impl/EstacionServiceImpl.java | 236 + .../impl/EstacionSitefServiceImpl.java | 66 + .../service/impl/EstadoServiceImpl.java | 115 + .../service/impl/EventoExtraServiceImpl.java | 68 + .../impl/ExcepcionPeajeServiceImpl.java | 91 + .../impl/ExcepcionRedondoServiceImpl.java | 88 + .../impl/FechamentoParamgeralServiceImpl.java | 72 + .../FechamentoParamptovtaServiceImpl.java | 87 + .../service/impl/FeriadoServiceImpl.java | 77 + .../FiscalAliquotaEmpresaServiceImpl.java | 49 + .../FiscalImpressoraEstadoServiceImpl.java | 54 + .../impl/FiscalImpressoraServiceImpl.java | 261 + .../service/impl/FiscalServiceImpl.java | 1075 +++ .../service/impl/FlywayUtilServiceImpl.java | 31 + .../impl/FolioPreimpresoServiceImpl.java | 65 + .../FormaPagamentoAgenciaServiceImpl.java | 85 + .../service/impl/FormaPagoDetServiceImpl.java | 61 + .../service/impl/FormaPagoServiceImpl.java | 71 + .../impl/FuncionSistemaServiceImpl.java | 61 + .../impl/GrupoCategoriaServiceImpl.java | 60 + .../impl/GrupoCortesiasServiceImpl.java | 66 + .../service/impl/GrupoRutaServiceImpl.java | 66 + .../service/impl/HotelServiceImpl.java | 59 + .../service/impl/ImagemServiceImpl.java | 70 + .../impl/ImportacaoClientesServiceImpl.java | 658 ++ .../ImportacaoClientesSrvpServiceImpl.java | 719 ++ .../InformeCategoriaVentaServiceImpl.java | 91 + .../InformePasajeroServicioServiceImpl.java | 90 + .../InformeServicioDiarioServiceImpl.java | 89 + .../InformeVentasPuntoVentaServiceImpl.java | 84 + .../impl/InstiFinanceiraServiceImpl.java | 75 + .../service/impl/IntegracaoServiceImpl.java | 70 + .../impl/IntegracaoTotvsServiceImpl.java | 99 + .../impl/ItemAdicionalServiceImpl.java | 66 + .../service/impl/ItemDescontoServiceImpl.java | 66 + .../service/impl/LogAuditoriaServiceImpl.java | 134 + .../LogDespesasReceitasDivServiceImpl.java | 52 + .../service/impl/MarcaAutobusServiceImpl.java | 55 + .../impl/MarcaClaseServicioServiceImpl.java | 87 + .../service/impl/MarcaServiceImpl.java | 82 + .../impl/MensagemRecusaServiceImpl.java | 47 + .../impl/MensajeEmpresaServiceImpl.java | 52 + .../impl/MensajePuntoVentaServiceImpl.java | 52 + .../service/impl/MensajeServiceImpl.java | 47 + .../impl/MensajeUsuarioServiceImpl.java | 52 + .../impl/MercadoCompetidoServiceImpl.java | 72 + .../impl/MerchantBancarioServiceImpl.java | 61 + .../MigracaoControleEstoqueServiceImpl.java | 152 + .../service/impl/MonedaServiceImpl.java | 109 + .../impl/MonitoramentoCCFServiceImpl.java | 113 + .../impl/MonitoramentoCRZServiceImpl.java | 68 + .../MotivoCancelVendaPacoteServiceImpl.java | 84 + .../impl/MotivoCancelacionServiceImpl.java | 86 + .../MotivoDevolucaoBilheteServiceImpl.java | 82 + .../impl/MotivoReimpresionServiceImpl.java | 65 + .../service/impl/MotivoViajeServiceImpl.java | 62 + ...ivocancelacionEquivalenciaServiceImpl.java | 73 + .../MovimentacionBilhetesServiceImpl.java | 199 + .../service/impl/NodoServiceImpl.java | 40 + .../NotaCreditoVendaPacoteServiceImpl.java | 25 + .../service/impl/OCDParamServiceImpl.java | 81 + .../impl/OCDPtoVtaParamServiceImpl.java | 52 + .../service/impl/OCDServiceImpl.java | 53 + .../impl/OperadorEmbarcadaServiceImpl.java | 87 + .../impl/OrgaoCancelacionServiceImpl.java | 55 + .../impl/OrgaoConcedenteServiceImpl.java | 64 + .../impl/OrgaoEmpParamServiceImpl.java | 33 + .../service/impl/OrgaoTramoServiceImpl.java | 10 + .../impl/PacoteConvenioServiceImpl.java | 59 + .../PacoteDescontoBilheteServiceImpl.java | 60 + .../service/impl/PacoteItemServiceImpl.java | 91 + .../service/impl/PacoteServiceImpl.java | 95 + .../service/impl/PacoteTarifaServiceImpl.java | 95 + .../service/impl/PaisServiceImpl.java | 65 + .../ParadaCodOrgaoConcedenteServiceImpl.java | 47 + .../impl/ParadaEquivalenciaServiceImpl.java | 72 + .../service/impl/ParadaServiceImpl.java | 177 + .../impl/ParamAcumulaMasivoServiceImpl.java | 71 + .../impl/ParamAcumulaPuntoServiceImpl.java | 67 + .../impl/ParamArticuloServiceImpl.java | 53 + .../impl/ParamCanjePuntoServiceImpl.java | 67 + .../impl/ParamCompraPuntoServiceImpl.java | 71 + .../impl/ParamConexionServiceImpl.java | 26 + .../impl/ParamCostoTarjetaServiceImpl.java | 67 + .../impl/ParamRecoleccionServiceImpl.java | 61 + .../impl/PerfilFuncionServiceImpl.java | 66 + .../service/impl/PerfilServiceImpl.java | 135 + .../impl/PeriodoVacacionalServiceImpl.java | 70 + .../service/impl/PlazaServiceImpl.java | 65 + .../impl/PrecioFixoPedagioServiceImpl.java | 115 + .../impl/PrecioVentajaServiceImpl.java | 170 + .../service/impl/PrecoApanheServiceImpl.java | 59 + .../impl/PricingAsientoServiceImpl.java | 76 + .../impl/PricingCategoriaServiceImpl.java | 77 + .../service/impl/PricingClaseServiceImpl.java | 77 + .../PricingClasseTarifariaServiceImpl.java | 62 + .../impl/PricingCorridaServiceImpl.java | 77 + .../service/impl/PricingCtrlServiceImpl.java | 73 + .../service/impl/PricingDiaServiceImpl.java | 76 + .../PricingEspecificoAgenciaServiceImpl.java | 63 + ...icingEspecificoCanalVendasServiceImpl.java | 63 + ...PricingEspecificoCategoriaServiceImpl.java | 58 + ...PricingEspecificoOcupacionServiceImpl.java | 57 + .../impl/PricingEspecificoServiceImpl.java | 199 + .../impl/PricingFormapagoServiceImpl.java | 60 + .../impl/PricingImporteServiceImpl.java | 67 + .../service/impl/PricingMarcaServiceImpl.java | 77 + .../impl/PricingMercadoServiceImpl.java | 80 + .../impl/PricingOcupaAntecipaServiceImpl.java | 134 + .../impl/PricingPuntoVentaServiceImpl.java | 77 + .../service/impl/PricingRutaServiceImpl.java | 78 + .../service/impl/PricingServiceImpl.java | 584 ++ .../impl/PricingTipoPtoVtaServiceImpl.java | 77 + .../impl/PricingTipoServicioServiceImpl.java | 78 + .../impl/PricingVigenciaServiceImpl.java | 81 + .../impl/ProdClaseServicioServiceImpl.java | 62 + .../impl/ProdFormaPagoServiceImpl.java | 61 + .../service/impl/ProdMarcaServiceImpl.java | 84 + .../service/impl/ProdMercadoServiceImpl.java | 62 + .../service/impl/ProdPrecioServiceImpl.java | 85 + .../impl/ProdPuntoVentaServiceImpl.java | 62 + .../service/impl/ProdRutaServiceImpl.java | 61 + .../impl/ProdTipoptovtaServiceImpl.java | 61 + .../service/impl/ProdVigenciaServiceImpl.java | 65 + .../impl/ProductoServicioServiceImpl.java | 124 + .../impl/PtoVtaCheckinServiceImpl.java | 52 + .../service/impl/PtoVtaSeguroServiceImpl.java | 52 + .../PtoVtaUsuarioBancarioServiceImpl.java | 65 + .../impl/PtovtaAgenciaServiceImpl.java | 75 + .../PtovtaAntecipacomissaoServiceImpl.java | 68 + .../impl/PtovtaAntifraudeServiceImpl.java | 57 + .../service/impl/PtovtaCatIndServiceImpl.java | 59 + .../impl/PtovtaComissaoServiceImpl.java | 78 + .../impl/PtovtaContaMDServiceImpl.java | 52 + .../impl/PtovtaDiversosServiceImpl.java | 68 + .../PtovtaEmpresaBloqueadaServiceImpl.java | 52 + ...PtovtaEmpresaContaBancariaServiceImpl.java | 67 + .../impl/PtovtaEmpresaServiceImpl.java | 70 + .../impl/PtovtaEstoqueServiceImpl.java | 68 + .../impl/PtovtaHorarioServiceImpl.java | 69 + .../impl/PtovtaTitularServiceImpl.java | 69 + .../service/impl/PuntoVentaServiceImpl.java | 840 +++ .../impl/ReceitaDespesaServiceImpl.java | 40 + .../service/impl/RedondeoCtrlServiceImpl.java | 87 + .../impl/RedondeoMarcaServiceImpl.java | 70 + .../service/impl/RedondeoServiceImpl.java | 71 + .../impl/RegionMetropolitanaServiceImpl.java | 57 + .../impl/RelatorioAgepanServiceImpl.java | 243 + .../impl/RequisicionBoletoServiceImpl.java | 59 + .../ReservaEspecialClienteServiceImpl.java | 78 + .../impl/ReservacionCategoriaServiceImpl.java | 61 + .../impl/ReservacionClaseServiceImpl.java | 61 + .../impl/ReservacionCtrlServiceImpl.java | 101 + .../impl/ReservacionMarcaServiceImpl.java | 61 + .../impl/ReservacionMercadoServiceImpl.java | 61 + .../ReservacionPuntoVentaServiceImpl.java | 61 + .../impl/RestriccionPagoServiceImpl.java | 68 + .../impl/RhPagoConductorServiceImpl.java | 51 + .../service/impl/RolOperativoServiceImpl.java | 81 + .../service/impl/RutaCasetaServiceImpl.java | 35 + .../impl/RutaCombinacionServiceImpl.java | 462 ++ .../RutaEmbarqueDesembarqueServiceImpl.java | 54 + .../service/impl/RutaEmpresaServiceImpl.java | 76 + .../impl/RutaIcmsExcepcionServiceImpl.java | 58 + .../impl/RutaSecuenciaServiceImpl.java | 86 + .../service/impl/RutaServiceImpl.java | 634 ++ .../service/impl/SapServiceImpl.java | 120 + .../impl/SecretariaEmpresaServiceImpl.java | 58 + .../service/impl/SecretariaServiceImpl.java | 86 + .../service/impl/SegVKMServiceImpl.java | 79 + .../impl/SeguradoraEmpresaServiceImpl.java | 56 + .../service/impl/SeguroKmServiceImpl.java | 55 + .../service/impl/SeguroTarifaServiceImpl.java | 56 + .../service/impl/SisdapServiceImpl.java | 28 + .../service/impl/SistemaServiceImpl.java | 61 + .../impl/TarifaCategoriaServiceImpl.java | 66 + .../impl/TarifaEmbarcadaHistServiceImpl.java | 59 + .../impl/TarifaEmbarcadaServiceImpl.java | 175 + .../service/impl/TarifaHistServiceImpl.java | 61 + .../service/impl/TarifaKmServiceImpl.java | 58 + .../service/impl/TarifaMinimaServiceImpl.java | 130 + .../impl/TarifaOficialServiceImpl.java | 344 + .../service/impl/TarifaServiceImpl.java | 380 ++ .../impl/TarifaTipoptovtaServiceImpl.java | 61 + .../impl/TarjetaCreditoServiceImpl.java | 55 + .../impl/TarjetaFidelidadServiceImpl.java | 74 + .../impl/TarjetaRecaudacionServiceImpl.java | 48 + .../service/impl/TarjetaViajeServiceImpl.java | 265 + .../impl/TaxaEmbLevanteCtrlServiceImpl.java | 61 + .../impl/TaxaEmbarqueKmServiceImpl.java | 62 + .../impl/TaxaEmbarqueParadaServiceImpl.java | 72 + .../impl/TipoCambioCiudadServiceImpl.java | 61 + .../impl/TipoCambioCtrlServiceImpl.java | 68 + .../service/impl/TipoConvenioServiceImpl.java | 63 + .../service/impl/TipoCorteServiceImpl.java | 65 + .../TipoCortesiaDescuentoServiceImpl.java | 94 + .../service/impl/TipoCortesiaServiceImpl.java | 69 + .../impl/TipoDocAutobusServiceImpl.java | 58 + .../impl/TipoDomicilioServiceImpl.java | 69 + .../service/impl/TipoEmpleadoServiceImpl.java | 58 + .../TipoEventoExtraEmpresaServiceImpl.java | 58 + .../TipoEventoExtraPtovtaServiceImpl.java | 53 + .../impl/TipoEventoExtraServiceImpl.java | 100 + .../impl/TipoIdentificacionServiceImpl.java | 23 + .../TipoInformativoComissaoServiceImpl.java | 61 + .../impl/TipoMovimientoServiceImpl.java | 65 + .../impl/TipoOcupacionServiceImpl.java | 69 + .../service/impl/TipoParadaServiceImpl.java | 72 + .../impl/TipoPuntoVentaServiceImpl.java | 70 + .../service/impl/TipoServicioServiceImpl.java | 65 + .../impl/TipoTarifaPacoteServiceImpl.java | 66 + .../service/impl/TipoVentaServiceImpl.java | 73 + .../impl/TramoKmServicioServiceImpl.java | 70 + .../service/impl/TramoRutaServiceImpl.java | 664 ++ .../service/impl/TramoServiceImpl.java | 297 + .../impl/TramoServicioServiceImpl.java | 128 + .../service/impl/TramoTiempoServiceImpl.java | 76 + .../service/impl/TurnoServiceImpl.java | 65 + .../impl/UsuarioBancarioServiceImpl.java | 61 + .../impl/UsuarioEmpresaServiceImpl.java | 71 + .../impl/UsuarioPerfilServiceImpl.java | 90 + .../service/impl/UsuarioServiceImpl.java | 267 + .../service/impl/UsuarioSesionImpl.java | 72 + .../impl/UsuarioUbicacionServiceImpl.java | 66 + .../impl/VendaEmbarcadaServiceImpl.java | 51 + .../service/impl/ViaServiceImpl.java | 72 + .../impl/VigenciaTarifaServiceImpl.java | 84 + .../ventaboletos/utilerias/ActivoUtil.java | 9 + .../ventaboletos/utilerias/Application.java | 17 + .../utilerias/ApplicationProperties.java | 220 + .../utilerias/BigDecimalUtil.java | 52 + .../ventaboletos/utilerias/CustomEnum.java | 173 + .../ventaboletos/utilerias/DateUtil.java | 847 +++ .../utilerias/DocumentosUtil.java | 42 + .../ventaboletos/utilerias/FeriadoCache.java | 129 + .../ventaboletos/utilerias/HoraSistema.java | 101 + .../ventaboletos/utilerias/LocaleUtil.java | 36 + .../utilerias/LocalizadorHelper.java | 156 + .../ventaboletos/utilerias/MoneyHelper.java | 226 + .../ventaboletos/utilerias/OcdUtil.java | 44 + .../utilerias/PasswordHelper.java | 52 + .../PricingConverterVOToEntidad.java | 428 ++ .../RegistroConDependenciaException.java | 23 + .../ventaboletos/utilerias/SendMail.java | 426 ++ .../ventaboletos/utilerias/StringHelper.java | 154 + .../ventaboletos/utilerias/TimeZoneUtil.java | 130 + .../ventaboletos/utilerias/TraslaparUtil.java | 70 + .../ventaboletos/utilerias/UsuarioLogado.java | 75 + .../utilerias/UtiliteriasFiscal.java | 285 + .../utilerias/ValidadorImportacaoEcf.java | 63 + .../ventaboletos/utilerias/ZipUtil.java | 53 + .../ArchivoIntegracionECF.java | 472 ++ .../ArchivoIntegracionECFManual.java | 260 + .../ArchivoIntegracionECFReducaoZ.java | 221 + .../ArchivoIntegracionNaoFiscal.java | 94 + .../ArchivoIntegracionReducaoZ.java | 190 + .../ValidaIntegracionECFRedZxls.java | 410 ++ .../utilerias/exportacao/ExportacaoBpe.java | 266 + .../exportacao/bpe/ExportacaoBPEBase.java | 776 +++ .../exportacao/bpe/ExportacaoBPETipoBPE.java | 234 + .../exportacao/bpe/ExportacaoBPETipoDPE.java | 105 + .../exportacao/bpe/ExportacaoBPETipoOBE.java | 35 + .../exportacao/bpe/ExportacaoBPETipoPRC.java | 65 + .../exportacao/bpe/ExportacaoBPEVo.java | 406 ++ .../utilerias/exportacao/bpe/xml/BPeUtil.java | 164 + .../exportacao/bpe/xml/BpeBuscaCamposXml.java | 105 + .../exportacaofiscal/ExportacaoFiscal.java | 890 +++ .../exportacaofiscal/vo/ExportacaoBPR.java | 341 + .../vo/ExportacaoBPRBase.java | 364 + .../exportacaofiscal/vo/ExportacaoECF.java | 418 ++ .../vo/ExportacaoECFBase.java | 236 + .../vo/ExportacaoECFTipoCCF.java | 177 + .../vo/ExportacaoECFTipoCFC.java | 141 + .../vo/ExportacaoECFTipoICF.java | 161 + .../vo/ExportacaoECFTipoPRC.java | 87 + .../vo/ExportacaoRMDTipoBPS.java | 159 + .../vo/ExportacaoRMDTipoDBP.java | 114 + .../vo/ExportacaoRMDTipoPAR.java | 121 + .../vo/ExportacaoRMDTipoRMD.java | 103 + .../vo/ExportacaoRMDTipoSeqBPS.java | 185 + .../vo/ExportacaoRMDTipoSeqDBP.java | 139 + .../utilerias/fiscal/vo/DetalhadoFiscal.java | 633 ++ .../fiscal/vo/FinanceiroAnalitico.java | 282 + .../fiscal/vo/FinanceiroSintetico.java | 287 + .../utilerias/fiscal/vo/FiscalRdi.java | 269 + .../utilerias/fiscal/vo/RdiValidacion.java | 85 + .../impressaormd/vo/DetalhadoRMD.java | 345 + .../utilerias/impressaormd/vo/FolioRMD.java | 144 + .../impressaormd/vo/ImpressaoRMD.java | 222 + .../utilerias/seguridad/Base64.java | 203 + .../seguridad/ContrasenaUtileria.java | 71 + .../MyAnnotationSessionFactoryBean.java | 33 + .../spring/security/MiGrantedAuthority.java | 23 + .../spring/security/MiPasswordEncoder.java | 22 + .../version/model/entidadesAdmVta.version | 1 + .../vo/OrgaoConcedente/OrgaoConcedenteVO.java | 52 + .../RelatorioGratuidadeAgepanVO.java | 204 + .../ventaboletos/vo/aidf/AidfVo.java | 143 + .../aidf/ItemRelatorioMovimentoEstoque.java | 125 + .../ventaboletos/vo/bpe/BPeVO.java | 138 + .../vo/busquedapacotes/ClientePacoteVO.java | 174 + .../vo/busquedapacotes/DadosBancarioVO.java | 50 + .../vo/busquedapacotes/EnderecoApanheVO.java | 103 + .../vo/busquedapacotes/ItemAdicionalVO.java | 41 + .../NotaCreditoVendaPacoteVO.java | 29 + .../vo/busquedapacotes/OcdPacoteVO.java | 20 + .../vo/busquedapacotes/PacoteVO.java | 315 + .../vo/busquedapacotes/PagamentoVO.java | 151 + .../vo/busquedapacotes/PassageiroVO.java | 67 + .../vo/busquedapacotes/ServicoVO.java | 78 + .../DatosClientePacoteResultTransformer.java | 80 + .../DatosDadosBancarioResultTransformer.java | 46 + .../DatosEmpresaResultTransformer.java | 52 + .../DatosEnderecoApanheResultTransformer.java | 65 + .../DatosItemAdicionalResultTransformer.java | 55 + .../DatosPagamentoResultTransformer.java | 121 + .../DatosPassageiroResultTransformer.java | 62 + .../DatosPuntoVentaResultTransformer.java | 52 + .../DatosServicoResultTransformer.java | 60 + .../DatosTicketResultTransformer.java | 97 + ...ndaCartaoCashMonitorResultTransformer.java | 53 + .../ventaboletos/vo/caja/CajaCerradoVO.java | 174 + .../ventaboletos/vo/caja/CajaDetalleVO.java | 514 ++ .../ventaboletos/vo/caja/CajaVO.java | 264 + .../vo/caja/PagamentoCartaoVO.java | 62 + .../ventaboletos/vo/caja/PagamentoVO.java | 115 + .../vo/caja/ReceitaDespesaVO.java | 24 + .../ventaboletos/vo/caja/UsuarioActivoVO.java | 37 + .../ventaboletos/vo/caja/UsuarioVO.java | 84 + .../vo/caja/VendaEmbarcadaVO.java | 292 + .../RelatorioVendaCartaoCashMonitorVO.java | 122 + .../ventaboletos/vo/clase/ClaseVO.java | 36 + .../vo/comissao/BoletoComissao.java | 1092 +++ .../vo/comissao/ComissaoDesconto.java | 56 + .../vo/comissao/ComissaoLogVO.java | 117 + .../vo/comissao/ComissaoReceita.java | 326 + .../vo/comissao/ConferenciaComissaoVO.java | 147 + .../vo/comissao/DiaConferenciaComissaoVO.java | 156 + .../vo/comissao/EmailConfigVO.java | 69 + .../vo/comissao/EtiquetaMalote.java | 78 + .../vo/comissao/EventosFinanceirosVO.java | 369 + .../ventaboletos/vo/comissao/FormapagoVO.java | 100 + .../vo/comissao/HistoricoComissao.java | 331 + .../vo/comissao/LogConferenciaVO.java | 320 + .../vo/comissao/MovimentosAtrasoVO.java | 236 + .../ventaboletos/vo/comissao/OcdVO.java | 290 + .../vo/comissao/RegistroCalculo.java | 152 + .../vo/comissao/ResumoComissao.java | 142 + .../vo/comissao/TarifaOficialVO.java | 124 + .../ventaboletos/vo/comissao/TarifaVO.java | 143 + .../vo/conexion/ConexionRutaVO.java | 152 + .../ventaboletos/vo/conexion/ConexionVO.java | 63 + .../conexion/OrdenarLocalidadesGeradas.java | 24 + .../ConfLayoutContratoVO.java | 270 + .../ConfigCoordenadas.java | 87 + .../vo/corrida/ColunasConsultaCorridaVO.java | 311 + .../ventaboletos/vo/corrida/CorridaVO.java | 273 + .../vo/corrida/TramoSequenciaVO.java | 236 + .../AutorizacaoUsoSerieEmbarcadaVO.java | 133 + .../ventaboletos/vo/embarcada/CidadeVO.java | 21 + .../vo/embarcada/DetalheCorridaVO.java | 31 + .../vo/embarcada/DispositivoEmbarcadaVO.java | 212 + .../ventaboletos/vo/embarcada/EmpresaVO.java | 82 + .../EstadoDispositivoEmbarcadaVO.java | 40 + .../vo/embarcada/FormaPagamentoVO.java | 63 + .../vo/embarcada/InscricaoEstadualVO.java | 175 + .../vo/embarcada/OperadorEmbarcadaVO.java | 115 + ...PtoVtaUsuarioUltimaVendaDispositivoVO.java | 55 + .../vo/embarcada/SeguroTaxaEmbarqueVO.java | 52 + .../vo/embarcada/SerieEmbarcada.java | 42 + .../embarcada/TiposPassagensBloqueadasVO.java | 42 + .../vo/embarcada/UsuarioEmbarcadaVO.java | 71 + .../vo/esquemaoperacional/RutaTramoVO.java | 181 + .../SecuenciaRutaTramoCoeficienteVO.java | 262 + .../SecuenciaRutaTramoVO.java | 225 + .../esquemaoperacional/TaxaEmbarqueW2i.java | 68 + .../vo/exportacao/QdmpDerCabecaVo.java | 168 + .../vo/exportacao/QdmpDerLinhaVo.java | 173 + .../vo/exportacao/QdmpDerRodapeVo.java | 126 + .../impressaofiscal/AgpImpressoraEcfVO.java | 78 + .../AgpImpressoraReducaoZVO.java | 78 + .../ImportacionFiscalReducaoZVO.java | 272 + .../impressaofiscal/ImportacionFiscalVO.java | 342 + .../ImportacionManualFiscalVO.java | 307 + .../ImportacionNaoFiscalVO.java | 51 + .../vo/impressaofiscal/ItemFiscalVO.java | 120 + .../ItemRelatorioFinanceiro.java | 44 + .../impressaofiscal/ItemRelatorioVoucher.java | 98 + .../LeitorFiscalReducaoZVO.java | 149 + .../vo/impressaofiscal/LeitorFiscalVO.java | 145 + .../impressaofiscal/LeitorManualFiscalVO.java | 129 + .../vo/impressaofiscal/LeitorNaoFiscalVO.java | 116 + .../impressaofiscal/RelatorioFinanceiro.java | 63 + .../SiglaMotivoCancelacion.java | 29 + .../impressaofiscal/SituacaoTributaria.java | 16 + .../vo/impressaofiscal/SubItens.java | 30 + .../vo/impressaofiscal/TipoPendencia.java | 5 + .../TotalRelatorioVoucher.java | 104 + .../integracao/FechamentoCntCorrenteVO.java | 155 + .../vo/layout/DiagramaPoltronas.java | 345 + .../vo/parada/ConexionCtrlVO.java | 88 + .../vo/parada/ConexionRutaConfVO.java | 34 + .../vo/parada/ConexionRutaCtrlVO.java | 76 + .../ventaboletos/vo/parada/ParadaVO.java | 98 + .../vo/parada/ParadaVOConexionRuta.java | 190 + .../ventaboletos/vo/pricing/Pricing.java | 381 ++ .../vo/pricing/PricingAsiento.java | 50 + .../vo/pricing/PricingCanalVenta.java | 37 + .../vo/pricing/PricingCategoria.java | 39 + .../vo/pricing/PricingClasse.java | 41 + .../vo/pricing/PricingCorrida.java | 29 + .../ventaboletos/vo/pricing/PricingDia.java | 121 + .../ventaboletos/vo/pricing/PricingMarca.java | 34 + .../vo/pricing/PricingMercado.java | 57 + .../vo/pricing/PricingOcupaAntecipa.java | 121 + .../vo/pricing/PricingPuntoVenta.java | 39 + .../ventaboletos/vo/pricing/PricingRuta.java | 39 + .../vo/pricing/PricingTipoCorrida.java | 41 + .../vo/pricing/PricingVigencia.java | 56 + .../ReembolsoOcdNotaCreditoVO.java | 388 ++ .../vo/roloperativo/RolOperativoVO.java | 37 + .../ventaboletos/vo/ruta/RutaVO.java | 201 + .../vo/secuencia/SecuenciaVO.java | 43 + .../vo/segurida/PerfilJerarquia.java | 49 + .../vo/tarifa/TarifaEscalaGroupVO.java | 106 + .../vo/tarifa/TarifaEscalaVO.java | 99 + .../vo/tarifa/TarifaOficialEscalaGroupVO.java | 78 + .../vo/tarifa/TarifaOficialEscalaVO.java | 135 + .../vo/tiposervicio/TipoServicioVO.java | 33 + .../ventaboletos/vo/tramo/TramoTarifaVO.java | 48 + .../ventaboletos/vo/tramo/TramoVO.java | 265 + .../ventaboletos/vo/via/ViaVO.java | 30 + .../utilerias/NamedParameterStatement.java | 357 + .../web/utilerias/spring/AppContext.java | 35 + .../spring/ApplicationContextProvider.java | 27 + .../ws/rs/BusquedaDatosClientePacoteRS.java | 36 + .../ws/rs/BusquedaDatosTicketsRS.java | 59 + .../ventaboletos/ws/rs/CajaCerradoRS.java | 65 + .../ventaboletos/ws/rs/CajaRS.java | 81 + .../ws/rs/ReembolsoOcdNotaCreditoRS.java | 52 + .../ventaboletos/ws/rs/UsuarioRS.java | 24 + .../ventaboletos/ws/rs/VendaEmbarcadaRS.java | 103 + .../w3/_2000/_09/xmldsig_/KeyInfoType.java | 104 + .../w3/_2000/_09/xmldsig_/ObjectFactory.java | 140 + .../w3/_2000/_09/xmldsig_/ReferenceType.java | 283 + .../w3/_2000/_09/xmldsig_/SignatureType.java | 160 + .../_09/xmldsig_/SignatureValueType.java | 99 + .../w3/_2000/_09/xmldsig_/SignedInfoType.java | 288 + .../w3/_2000/_09/xmldsig_/TransformType.java | 104 + .../w3/_2000/_09/xmldsig_/TransformsType.java | 76 + .../w3/_2000/_09/xmldsig_/X509DataType.java | 67 + .../w3/_2000/_09/xmldsig_/package-info.java | 9 + 2203 files changed, 229770 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/META-INF/MANIFEST.MF create mode 100644 src/br/inf/portalfiscal/bpe/EvNaoEmbBPe.java create mode 100644 src/br/inf/portalfiscal/bpe/ObjectFactory.java create mode 100644 src/br/inf/portalfiscal/bpe/TBPe.java create mode 100644 src/br/inf/portalfiscal/bpe/TConsSitBPe.java create mode 100644 src/br/inf/portalfiscal/bpe/TEndeEmi.java create mode 100644 src/br/inf/portalfiscal/bpe/TEndereco.java create mode 100644 src/br/inf/portalfiscal/bpe/TEnviBPe.java create mode 100644 src/br/inf/portalfiscal/bpe/TEvento.java create mode 100644 src/br/inf/portalfiscal/bpe/TImp.java create mode 100644 src/br/inf/portalfiscal/bpe/TProcEvento.java create mode 100644 src/br/inf/portalfiscal/bpe/TProtBPe.java create mode 100644 src/br/inf/portalfiscal/bpe/TRetBPe.java create mode 100644 src/br/inf/portalfiscal/bpe/TRetConsStatServ.java create mode 100644 src/br/inf/portalfiscal/bpe/TRetEvento.java create mode 100644 src/br/inf/portalfiscal/bpe/TUf.java create mode 100644 src/br/inf/portalfiscal/bpe/TUfSemEX.java create mode 100644 src/br/inf/portalfiscal/bpe/evento/TEvento.java create mode 100644 src/br/inf/portalfiscal/bpe/evento/TEventoMsg.java create mode 100644 src/br/inf/portalfiscal/bpe/evento/TRetEvento.java create mode 100644 src/br/inf/portalfiscal/bpe/evento/package-info.java create mode 100644 src/br/inf/portalfiscal/bpe/package-info.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/BilheteService.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/BilheteServiceService.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/Bilhetes.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/BuscarBilhetes.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/BuscarBilhetesInconsistente.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/BuscarBilhetesInconsistenteResponse.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/BuscarBilhetesResponse.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/BuscarReceitaDespesa.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/BuscarReceitaDespesaResponse.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadAgencia.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadAgenciaResponse.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadBeneficio.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadBeneficioResponse.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadBilheteiro.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadBilheteiroResponse.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadCliente.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadClienteResponse.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadEstado.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadEstadoResponse.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadFormaPagamento.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadFormaPagamentoResponse.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadLinha.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadLinhaResponse.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadLocalidade.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadLocalidadeResponse.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadReceitaDespesa.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/CadReceitaDespesaResponse.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadAgenciaWS.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadBeneficioWS.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadBilheteiroWS.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadClienteWS.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadEstadoWS.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadFormaPagamentoWS.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadLinhaWS.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadLocalidadeWS.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadReceitaDespesaWS.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoReceitaDespesaWS.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoWS.java create mode 100644 src/com/rjconsultores/hstcajservice/ws/ObjectFactory.java create mode 100644 src/com/rjconsultores/routing/DynamicDataSourceHolder.java create mode 100644 src/com/rjconsultores/routing/MultipleDataSource.java create mode 100644 src/com/rjconsultores/routing/ReadOnlyConnection.java create mode 100644 src/com/rjconsultores/routing/ReadOnlyRouteInterceptor.java create mode 100644 src/com/rjconsultores/ventaboletos/auditoria/AuditControl.java create mode 100644 src/com/rjconsultores/ventaboletos/auditoria/AuditManager.java create mode 100644 src/com/rjconsultores/ventaboletos/auditoria/interceptor/AuditInterceptor.java create mode 100644 src/com/rjconsultores/ventaboletos/constantes/Constantes.java create mode 100644 src/com/rjconsultores/ventaboletos/constantes/ConstantesFuncionSistema.java create mode 100644 src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoDesconto.java create mode 100644 src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoValidaVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/constantes/ConstantesVendaEmbarcada.java create mode 100644 src/com/rjconsultores/ventaboletos/constantes/DescricaoTipoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java create mode 100644 src/com/rjconsultores/ventaboletos/constantes/TipoSeguro.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AbastoBoletoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AbastoCentralDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AbastoHistoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AgruparParadaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AidfDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AidfEspecieDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AidfTipoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AjusteEventoExtraDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AlertaCtrlDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AliasServicoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AliquotaEstadoDestinoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ArticuloDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AsientoExclusivoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AuditLogDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AuditModuleDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AuditServiceDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AutobusDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AutobusDocDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AutorizacionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AutorizacionPerfilDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/BancoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/BoletoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/BpeDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/BusquedaDatosTicketDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CajaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CalcularPeajeDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CancelacionCargoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CancelacionCtrlDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CasetaPeajeDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CasetaPeajeExcepcionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CategoriaBloqueioImpPosteriorDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CategoriaClaseDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CategoriaCorridaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CategoriaCtrlDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CategoriaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CategoriaDescuentoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CategoriaMarcaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CategoriaMercadoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CategoriaOrgaoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CategoriaPeriodoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CategoriaTipoPtoVtaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CiudadDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ClaseservicioEquivalenciaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ClasseServicoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ClienteCursoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ClienteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ClienteDescuentoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ClienteDireccionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ClientePacoteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CobrancaAdcPuntoVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CoeficienteTarifaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ColoniaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ComisionistaExternoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ComissaoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ComissaoLogDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ComissaoReceitaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CompaniaBancariaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConductorDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConexionConfDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConexionCtrlDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConexionDescuentoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionRutaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConexionRutaConfDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConexionRutaCtrlDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConexionRutaExcepcionPtoVtaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConexionRutaExcepcionTipoPtoVtaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConfContratoPuntoVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConfRestricaoCanalVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConfRestricaoExcecaoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConfRestricaoOrgaoConcedenteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConfRestricaoPtovtaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConfRestricaoRutasDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConfRestricaoTramoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConfRestricaoTramoOCDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConfRestricaoVendaWebDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConfTotemDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConferenciaComissaoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConferenciaPendenciaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConfigRestriccionPagoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConstanteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ContaCorrenteAgenciaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ContaMDDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConvenioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConvenioDetDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CorridaCtrlDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CorridaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CorridaTramoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CortesiaBeneficiarioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CortesiaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CortesiaDireccionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CotacaoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CtrlFechamentoCaixaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CtrlSerieBPeDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CtrlSerieEmbarcadaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CuponConvenioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CuponSecretariaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CursoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/CustomDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/DepositoBancarioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/DescontoComissaoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/DetAbastoBoletoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/DetDiagramaAutobusDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/DiagramaAutobusDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/DispositivoEmbarcadaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/DispositivoEmbarcadaHistoricoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/DivisionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmbarcadaDispOperadorDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmbarqueCatracaRodoviariaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmpleadoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmpresaContaBancariaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmpresaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmpresaEmailConfigDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmpresaEmailDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmpresaEmailFlexBusDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmpresaEquivalenciaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmpresaImpostoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmpresaSaferConfigDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmpresaTrocoSimplesDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EnderecoApanheDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EscolaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EsquemaAgrupacionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EsquemaAsientoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EsquemaCorridaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EsquemaCorridaEmbarqueDesembarqueDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EsquemaOperacionalDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EsquemaTramoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EstacionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EstacionSitefDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EstadoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/EventoExtraDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ExcepcionPeajeDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ExcepcionRedondoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FechamentoParamgeralDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FechamentoParamptovtaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FeriadoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FiscalAliquotaEmpresaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FiscalDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FiscalFormapagoEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FiscalImpressoraDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FiscalImpressoraEstadoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FiscalRelgerencialEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FiscalTotnaofiscalEmpresaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FlywayUtilDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FolioPreimpresoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FormaPagamentoAgenciaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FormaPagoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FormaPagoDetDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/FuncionSistemaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/GenericDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/GenericDAOInforme.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/GrupoCategoriaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/GrupoCortesiasDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/GrupoRutaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/HotelDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ImagemDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/InformeCategoriaVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/InformePasajeroServicioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/InformeServicioDiarioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/InformeVentasPuntoVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/InstiFinanceiraDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/IntegracaoDerPrDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/IntegracaoTotvsDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/IntgeracaoTotvsHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ItemAdicionalDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ItemDescontoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/LogAuditoriaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/LogDespesaReceitaDivDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/LogHistoricoContingenciaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MarcaAutobusDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MarcaClaseServicioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MarcaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MensagemRecusaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MensajeDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MensajeEmpresaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MensajePuntoVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MensajeUsuarioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MercadoCompetidoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MerchantBancarioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MonedaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MonitoramentoCCFDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MonitoramentoCRZDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MotivoCancelVendaPacoteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MotivoCancelacionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MotivoDevolucaoBilheteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MotivoReimpresionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MotivoViajeDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/MotivocancelacionEquivalenciaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/NodoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/NotaCreditoVendaPacoteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/OCDDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/OCDParamDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/OCDPtoVtaParamDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/OperadorEmbarcadaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/OperadorEmbarcadaLinhaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/OperadorEmbarcadaServicoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/OrgaoCancelacionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/OrgaoConcedenteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/OrgaoEmpParamDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/OrgaoTramoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PacoteConvenioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PacoteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PacoteDescontoBilheteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PacoteItemDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PacoteTarifaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PaisDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ParadaCodOrgaoConcedenteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ParadaEquivalenciaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ParamAcumulaMasivoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ParamAcumulaPuntoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ParamArticuloDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ParamCanjePuntoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ParamCompraPuntoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ParamConexionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ParamCostoTarjetaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ParamRecoleccionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PerfilDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PerfilFuncionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PeriodoVacacionalDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PlazaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PrecioFixoPedagioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PrecioVentajaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PrecoApanheDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingAsientoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingCategoriaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingClaseDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingClasseTarifariaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingCorridaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingCtrlDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingDiaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingEspecificoAgenciaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingEspecificoCanalVendasDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingEspecificoCategoriaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingEspecificoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingEspecificoOcupacionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingFormapagoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingImporteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingMarcaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingMercadoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingOcupaAntecipaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingPuntoVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingRutaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingTipoPtoVtaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingTipoServicioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PricingVigenciaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ProdClaseServicioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ProdFormaPagoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ProdMarcaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ProdMercadoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ProdPrecioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ProdPuntoVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ProdRutaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ProdTipoptovtaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ProdVigenciaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ProductoServicioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtoVtaCheckinDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtoVtaSeguroDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtoVtaUsuarioBancarioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaAgenciaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaAntecipacomissaoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaAntifraudeDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaCatIndDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaComissaoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaContaMDDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaDiversosDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaBloqueadaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaContaBancariaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaEstoqueDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaHorarioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaTipoEstoqueDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaTitularDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ReceitaDespesaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RedondeoCtrlDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RedondeoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RedondeoMarcaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RegionMetropolitanaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RelatorioAgepanDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RemessaCNABBancosDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RequisicionBoletoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ReservaEspecialClienteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ReservacionCategoriaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ReservacionClaseDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ReservacionCtrlDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ReservacionMarcaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ReservacionMercadoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ReservacionPuntoVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RestriccionPagoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RhPagoConductorDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RolOperativoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RutaCasetaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RutaCombinacionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RutaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RutaEmbarqueDesembarqueDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RutaEmpresaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RutaIcmsExcepcionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/RutaSecuenciaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/SapDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/SecretariaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/SecretariaEmpresaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/SegVKMDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/SeguradoraEmpresaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/SeguroKmDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/SeguroTarifaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/SisdapDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/SistemaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TarifaCategoriaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TarifaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TarifaEmbarcadaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TarifaEmbarcadaHistDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TarifaHistDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TarifaKmDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TarifaMinimaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TarifaTipoptovtaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TarjetaCreditoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TarjetaFidelidadDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TarjetaRecaudacionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TarjetaViajeDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TaxaEmbLevanteCtrlDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueKmDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueParadaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoCambioCiudadDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoCambioCtrlDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoConvenioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoCorteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDescuentoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoDocAutobusDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoDomicilioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoEmpleadoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraEmpresaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraPtovtaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoIdentificacionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoInformativoComissaoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoMovimentacionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoMovimientoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoOcupacionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoParadaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoPuntoVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoServicioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoTarifaPacoteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TramoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TramoKmServicioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TramoServicioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TramoTiempoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TurnoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/UsuarioBancarioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/UsuarioDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/UsuarioEmpresaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/UsuarioPerfilDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/UsuarioSesionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/UsuarioUbicacionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/VendaPacoteDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/ViaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/VigenciaTarifaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoBoletoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoCentralHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoHistoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AgruparParadaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AidfEspecieHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AidfTipoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AjusteEventoExtraHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AlertaCtrlHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AliasServicoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AliquotaEstadoDestinoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ArticuloHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AsientoExclusivoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AuditLogHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AuditModuleHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AuditServiceHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusDocHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionPerfilHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/BancoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/BoletoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/BusquedaDatosTicketHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CajaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CalcularPeajeHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCargoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCtrlHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CasetaPeajeExcepcionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CasetaPeajeHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaBloqueioImpPosteriorHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaClaseHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCorridaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCtrlHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMarcaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMercadoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaOrgaoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaPeriodoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaTipoPtoVtaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CiudadHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ClaseservicioEquivalenciaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ClasseServicoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteCursoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDescuentoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDireccionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ClientePacoteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CobrancaAdcPuntoVentaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CoeficienteTarifaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ColoniaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ComisionistaExternoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoLogHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoReceitaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CompaniaBancariaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConductorHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionConfHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionCtrlHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionDescuentoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionRutaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaConfHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaCtrlHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaExcepcionTipoPtoVtaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaRestricaoPtoVtaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConfContratoPuntoVentaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoCanalVentaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoExcecaoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoOrgaoConcedenteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoPtovtaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoRutasHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoTramoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoTramoOCHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoVendaWebHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConfTotemHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaPendenciaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConfigRestriccionPagoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConstanteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ContaCorrenteAgenciaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ContaMDHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioDetHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaCtrlHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaTramoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaBeneficiarioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaDireccionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CotacaoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlFechamentoCaixaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieBPeHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieEmbarcadaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CuponConvenioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CuponSecretariaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CursoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/CustomHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/DepositoBancarioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/DescontoComissaoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/DetAbastoBoletoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/DetDiagramaAutobusHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/DiagramaAutobusHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/DispositivoEmbarcadaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/DispositivoEmbarcadaHistoricoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/DivisionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmbarcadaDispOperadorHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmbarqueCatracaRodoviariaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmpleadoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaContaBancariaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailConfigHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailFlexBusHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEquivalenciaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaImpostoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaSaferConfigHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaTrocoSimplesHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EnderecoApanheHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EscolaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAgrupacionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAsientoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaCorridaEmbarqueDesembarqueHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaCorridaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaOperacionalHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaTramoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionSitefHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EstadoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EventoExtraHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionPeajeHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionRedondoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamgeralHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamptovtaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/FeriadoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalAliquotaEmpresaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalImpressoraEstadoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalImpressoraHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/FlywayUtilHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/FolioPreimpresoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagamentoAgenciaDAOImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoDetHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/FuncionSistemaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/GenericHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCategoriaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCortesiasHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoRutaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/HibernateFix.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/HotelHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ImagemHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/InformeCategoriaVentaDAOImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/InformePasajeroServicioDAOImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/InformeServicioDiarioDAOImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/InformeVentasPuntoVentaDAOImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/InstiFinanceiraHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/IntegracaoDerPrHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ItemAdicionalHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ItemDescontoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/LogAuditoriaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/LogDespesaReceitaDivHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/LogHistoricoContingenciaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaAutobusHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaClaseServicioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MensagemRecusaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeEmpresaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MensajePuntoVentaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeUsuarioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MercadoCompetidoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MerchantBancarioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MonedaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCCFHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCRZHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoCancelVendaPacotelHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoCancelacionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoDevolucaoBilheteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoReimpresionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoViajeHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/MotivocancelacionEquivalenciaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/NodoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/NotaCreditoVendaPacoteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/OCDHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/OCDParamHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/OCDPtoVtaParamHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/OperadorEmbarcadaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/OperadorEmbarcadaLinhaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/OperadorEmbarcadaServicoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoCancelacionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoConcedenteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoEmpParamHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoTramoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteConvenioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteDescontoBilheteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteItemHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteTarifaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PaisHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaCodOrgaoConcedenteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaEquivalenciaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaMasivoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaPuntoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ParamArticuloHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCanjePuntoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCompraPuntoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ParamConexionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCostoTarjetaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ParamRecoleccionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilFuncionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PeriodoVacacionalHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PlazaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PrecioFixoPedagioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PrecioVentajaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PrecoApanheHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingAsientoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCategoriaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClaseHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClasseTarifariaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCorridaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCtrlHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingDiaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoAgenciaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoCanalVendasHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoCategoriaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoOcupacionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingFormapagoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingImporteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMarcaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMercadoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingOcupaAntecipaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingPuntoVentaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingRutaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoPtoVtaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoServicioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PricingVigenciaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ProdClaseServicioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ProdFormaPagoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMarcaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMercadoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPrecioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPuntoVentaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ProdRutaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ProdTipoptovtaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ProdVigenciaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ProductoServicioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaCheckinHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaSeguroHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaUsuarioBancarioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAgenciaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAntecipacomissaoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAntifraudeHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaCatIndHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaComissaoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaContaMDHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaDiversosHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaBloqueadaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaContaBancariaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEstoqueHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaHorarioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTipoEstoqueHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTitularHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ReceitaDespesaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoCtrlHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoMarcaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RegionMetropolitanaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RelatorioAgepanHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RequisicionBoletoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ReservaEspecialClienteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCategoriaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionClaseHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCtrlHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMarcaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMercadoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionPuntoVentaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RestriccionPagoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RhPagoConductorHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RolOperativoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCasetaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCombinacionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RutaEmbarqueDesembarqueHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RutaEmpresaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RutaIcmsExcepcionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/RutaSecuenciaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/SapHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaEmpresaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/SegVKMHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/SeguradoraEmpresaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroKmHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroTarifaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/SisdapHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/SistemaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaCategoriaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaEmbarcadaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaEmbarcadaHistHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHistHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaKmHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaMinimaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaOficialHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaTipoptovtaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaCreditoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaFidelidadHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaRecaudacionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaViajeHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbLevanteCtrlHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueKmHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueParadaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCiudadHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCtrlHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoConvenioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCorteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaDescuentoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDocAutobusHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDomicilioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEmpleadoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraEmpresaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraPtovtaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoIdentificacionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoInformativoComissaoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimentacionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimientoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoOcupacionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoParadaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoPuntoVentaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoServicioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoTarifaPacoteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoVentaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TramoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TramoKmServicioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TramoServicioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TramoTiempoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TurnoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioBancarioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioEmpresaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioPerfilHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioSesionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioUbicacionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/VendaPacoteHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ViaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/VigenciaTarifaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/sqlfunction/FnArredondamentoTarifa.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLBuilder.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLFactory.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/util/AidfGenerator.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/util/ClaseServicioGenerator.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/util/ClaseServicioStore.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/util/DBUtil.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/util/FormaPagoGenerator.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/util/IdAidfStore.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/util/IdFormaPagoStore.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/util/IdTipoParadaStore.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/util/TipoParadaGenerator.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AbastoBoleto.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AbastoCentral.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AbastoHisto.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AgrupamentoParada.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Aidf.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AidfEspecie.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AidfTipo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AjusteEventoExtra.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AlertaCtrl.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AliasServico.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AliquotaEstadoDestino.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Articulo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AsientoExclusivo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AuditLog.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AuditModule.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AuditService.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Autobus.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AutobusDoc.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Autorizacion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AutorizacionPerfil.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Banco.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Boleto.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Caja.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CajaDetPago.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CajaDiversos.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CajaDiversosPago.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CajaFormaPago.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CajaTarjeta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CancelacionCargo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CancelacionCtrl.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CasetaPeaje.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CasetaPeajeExcepcion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Categoria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CategoriaClase.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CategoriaCorrida.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CategoriaCtrl.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CategoriaDescuento.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CategoriaMarca.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CategoriaMercado.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CategoriaPeriodo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CategoriaRuta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CategoriaRutaExcecao.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CategoriaTipoPtoVta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Ciudad.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ClaseservicioEquivalencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Clasificacion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ClasseIndicePeaje.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Cliente.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ClienteCurso.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ClienteDescuento.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ClienteDireccion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ClienteFidelidad.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ClientePacote.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CobrancaAdicionalHistorico.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Colonia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ComEmpCategoria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ComEmpConferencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ComEmpFormapago.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ComEmpTipoEventoExtra.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ComisionistaExterno.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Comissao.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ComissaoLog.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ComissaoReceita.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CompaniaBancaria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Conductor.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Conexion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConexionConf.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConexionCtrl.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConexionCtrlTemp.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConexionDescuento.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcionRuta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConexionRutaConf.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConexionRutaCtrl.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionPtoVta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionTipoPtoVta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConexionRutaTramoCtrl.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConexionTemp.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConfContratoPuntoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoCanalVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoExcecao.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoOrgaoConcedente.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoPtovta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoRutas.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoTramo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoTramoOC.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoVendaWeb.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConfTotem.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Conferencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConferenciaPendencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConfigRestriccionPago.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Constante.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ContaCorrentePtoVta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ContaMD.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ControleEstoqueMigracao.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Convenio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConvenioDet.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConvenioEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConvenioPuntoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConvenioRuta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConvenioTramo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConvenioUsuario.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Corrida.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CorridaCtrl.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CorridaTramo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Cortesia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CortesiaBeneficiario.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CortesiaDireccion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Cotacao.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CtrlFechamentoCaixa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CtrlSerieBPe.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CtrlSerieEmbarcada.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CuponConvenio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CuponSecretaria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Curso.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Custom.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/CustomIdGenerator.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/DepositoBancario.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/DescontoComissao.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/DetAbastoBoleto.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/DetDiagramaAutobus.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/DiagramaAutobus.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/DispositivoEmbarcada.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/DispositivoEmbarcadaHistorico.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Division.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EmbarcadaDispOperador.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EmbarqueCatracaRodoviaria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Empleado.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Empresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EmpresaContaBancaria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EmpresaEmail.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EmpresaEmailConfig.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EmpresaEmailFlexBus.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EmpresaEquivalencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EmpresaSaferConfig.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EmpresaTrocoSimples.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EnderecoApanhe.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Escola.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EsquemaAgrupacion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EsquemaAsiento.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EsquemaCorridaEmbarqueDesembarque.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EsquemaOperacional.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EsquemaTramo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Estacion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EstacionImpresora.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EstacionRioCard.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Estado.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EventoExtra.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeaje.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeajeVigencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ExcepcionRedondo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FechamentoBoleto.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FechamentoCntcorrente.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FechamentoParamgeral.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Feriado.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FiscalAliquotaEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FiscalFormapagoEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FiscalImpressora.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FiscalImpressoraEstado.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FiscalRelgerencialEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FiscalTotnaofiscalEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FolioPreimpreso.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FormaPago.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/FuncionSistema.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/GrupoCategoria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/GrupoCortesia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/GrupoRuta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Hotel.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Imagem.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/InscricaoEstadual.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/InstiFinanceira.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/IntegracaoTotvs.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ItemAdicional.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ItemDesconto.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/LogAuditoria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/LogConferencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/LogDespesaReceitaDiversa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/LogHistoricoContingencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Marca.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MarcaAutobus.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicioPK.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MensagemRecusa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Mensaje.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MensajeEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MensajePuntoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MensajeUsuario.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MercadoCompetido.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MerchantBancario.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Moneda.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCF.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCFR2.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCRZ.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MotivoCancelVendaPacote.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MotivoCancelacion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MotivoDevolucaoBilhete.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MotivoReimpresion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MotivoViaje.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/MotivocancelacionEquivalencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Nodo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/NotaCreditoVendaPacote.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/OCD.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/OCDDatosPagamento.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/OCDParam.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/OCDPtoVtaParam.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/OperadorEmbarcada.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/OperadorEmbarcadaLinha.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/OperadorEmbarcadaServico.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/OrgaoTramo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Pacote.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PacoteConvenio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PacoteDescontoBilhete.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PacoteFormapago.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PacoteItem.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PacoteTarifa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Pais.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Parada.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ParadaCodOrgaoConcedente.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ParadaEquivalencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ParadaEsquema.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ParadaSecuencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ParadaSecuenciaCombinacaoLinha.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaMasivo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaPunto.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ParamArticulo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ParamCanjePunto.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ParamCompraPunto.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ParamConexion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ParamCostoTarjeta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Peaje.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Perfil.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PerfilFuncion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PeriodoVacacional.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Plaza.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PrecioFixoPedagio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PrecioVentaja.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PrecoApanhe.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Pricing.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingAsiento.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingCategoria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingClase.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingClasseTarifaria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingCorrida.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingCtrl.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingDia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingEspecifico.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoAgencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoCanalVendas.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoCategoria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoOcupacion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingFormapago.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingImporte.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingMarca.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingMercado.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingOcupaAntecipa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingPuntoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingRuta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingTipoPtoVta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingTipoServicio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PricingVigencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ProdClaseServicio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ProdFormaPago.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ProdMarca.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ProdMercado.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ProdPrecio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ProdPuntoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ProdRuta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ProdTipoptovta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ProdVigencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ProductoServicio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaAgencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaContaMD.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaDiversos.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaContaBancaria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaTipoEstoque.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PuntoVentaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Redondeo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RedondeoCtrl.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RedondeoMarca.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RegionMetropolitana.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RequisicionBoleto.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ReservaEspecialCliente.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ReservacionCategoria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ReservacionClase.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ReservacionCtrl.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ReservacionMarca.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ReservacionMercado.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RestriccionPago.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RhPagoConductor.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RolOperativo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Ruta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RutaCaseta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RutaCombinacion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RutaEmbarqueDesembarque.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RutaEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RutaIcmsExcepcion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RutaSecuencia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Secretaria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/SecretariaEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/SegVKM.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/SeguradoraEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/SeguroKm.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/SeguroTarifa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Sistema.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Tarifa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarifaCategoria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarifaDemanda.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarifaEmbarcada.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarifaEmbarcadaHist.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarifaHist.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarifaKm.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarifaMinima.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarifaMinimaCategoria.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarifaOficial.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarifaTipoptovta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarifaVendaPacote.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarjetaCredito.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidad.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidadCuenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacionPK.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TarjetaViaje.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevante.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevanteCtrl.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueKm.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueParada.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoCambioCiudad.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoCambioCtrl.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoConvenio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoCorte.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoCortesia.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoCortesiaDescuento.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoDocAutobus.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoDomicilio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoEmpleado.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraPtoVta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoIdentificacion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoInformativoComissao.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoMovimentacion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoMovimiento.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoOcupacion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoOperacionCC.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoParada.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoPuntoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoServicio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoTarifaPacote.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Tramo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TramoKm.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TramoKmServicio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TramoServicio.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TramoTiempo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Turno.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Usuario.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/UsuarioBancario.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/UsuarioEmpresa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/UsuarioPerfil.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/UsuarioSesion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/UsuarioUbicacion.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/VendaPacote.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Via.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/VigenciaTarifa.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Zona.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/CtrlFechamentoCaixaStatus.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/CustomTipo.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/EAmbienteContingencia.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/EStatusContingencia.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/EnumTipoVenda.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/FuncionSistemaEnum.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/HorarioLiberacaoVendaPassagem.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/IndRestricaoFormaPago.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/IndStatusBoleto.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/LocalEnderecoApanhe.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/MDOrigem.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/MimeType.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/ModeloComissaoImpressaoPosterior.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/PricingOperacaoWS.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/RelatorioMovimentacaoBilheteStatusEnum.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/RelatorioVendaCartaoCashMonitorModeloEnum.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/SistemaEnum.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/SituacaoBoleto.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/SituacaoNotaCreditoVendaPacote.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/SituacaoVendaPacote.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/StatusAutorizacaoRuta.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/StatusFlexBus.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/StatusIntegracaoSap.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoAntifraude.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoBloqueioDispositivoEmbarcadaEnum.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoCarteiraDigital.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoClasseServicoBPe.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoCstGratuidade.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoDescontoBPe.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoDescontoMonitrip.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoEnvioRest.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoIdentificacionDoc.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoImpressora.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoImpressoraRelatorio.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoIntegracaoTEF.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoPassagemCores.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoPessoa.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoSocio.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TypeContentEmail.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TypeEventListener.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/auditoria/EnumAuditAction.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/comissao/BoletoStatusComissao.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/comissao/CoresConferencia.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/comissao/StatusLogConferencia.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/comissao/TipoLogConferencia.java create mode 100644 src/com/rjconsultores/ventaboletos/exception/BusinessException.java create mode 100644 src/com/rjconsultores/ventaboletos/exception/ComissaoException.java create mode 100644 src/com/rjconsultores/ventaboletos/exception/ConstanteEstacaoEmbarcadaException.java create mode 100644 src/com/rjconsultores/ventaboletos/exception/DispositivoEmbarcadaJaCadastradoException.java create mode 100644 src/com/rjconsultores/ventaboletos/exception/IntegracionException.java create mode 100644 src/com/rjconsultores/ventaboletos/exception/SerieEmbarcadaNaoDisponivelException.java create mode 100644 src/com/rjconsultores/ventaboletos/exception/ValidacionCampoException.java create mode 100644 src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoException.java create mode 100644 src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoFormapagoException.java create mode 100644 src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaException.java create mode 100644 src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaFormapagoException.java create mode 100644 src/com/rjconsultores/ventaboletos/passageirofrequente/vo/ClienteExcelVo.java create mode 100644 src/com/rjconsultores/ventaboletos/relatorios/MovimentoLinha.java create mode 100644 src/com/rjconsultores/ventaboletos/relatorios/MovimentoSecoes.java create mode 100644 src/com/rjconsultores/ventaboletos/relatorios/PrefixoAntt.java create mode 100644 src/com/rjconsultores/ventaboletos/relatorios/receitaDespesa/RelatorioFinanceiroReceitasDespesasBean.java create mode 100644 src/com/rjconsultores/ventaboletos/rest/ContingenciaClienteRest.java create mode 100644 src/com/rjconsultores/ventaboletos/rest/IntegracaoSapRest.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AbastoBoletoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AbastoCentralService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AbastoHistoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AgruparParadaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AidfService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AjusteEventoExtraService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AlertaCtrlService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AliasServicoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AliquotaEstadoDestinoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ArquivoRemessaCNAB.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ArticuloService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AsientoExclusivoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AuditLogService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AuditModuleService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AuditServiceService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AutobusDocService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AutobusService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AutorizaFolioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AutorizacionPerfilService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AutorizacionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/BancoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/BoletoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/BpeService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CalcularPeajeService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CalculoComissaoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CancelacionCargoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CancelacionCtrlService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CasetaPeajeExcepcionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CasetaPeajeService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CategoriaBloqueioImpPosteriorService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CategoriaClaseService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CategoriaCorridaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CategoriaDescuentoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CategoriaMarcaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CategoriaMercadoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CategoriaOrgaoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CategoriaPeriodoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CategoriaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CategoriaTipoPtoVtaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CiudadService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ClaseServicioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ClaseservicioEquivalenciaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ClienteCursoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ClienteDescuentoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ClienteDireccionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ClienteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CobrancaAdcPuntoVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CoeficienteTarifaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ColoniaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ComisionistaExternoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ComissaoReceitaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ComissaoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CompaniaBancariaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConductorService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConexionConfService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConexionCtrlService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConexionDescuentoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConexionExcepcionRutaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConexionExcepcionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConexionRutaCombinacionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConexionRutaConfService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConexionRutaCtrlService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConexionRutaExcepcionPtoVtaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConexionRutaExcepcionTipoPtoVtaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConexionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConfContratoPuntoVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConfRestricaoCanalVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConfRestricaoExcecaoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConfRestricaoOrgaoConcedenteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConfRestricaoPtovtaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConfRestricaoRutasService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConfRestricaoTramoOCService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConfRestricaoTramoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConfRestricaoVendaWebService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConfTotemService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConferenciaComissaoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConferenciaPendenciaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConfigRestriccionPagoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConstanteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ContaMDService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ContingenciaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ControleSerieEmbarcadaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConvenioDetService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConvenioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CorridaCtrlService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CorridaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CorridaTramoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CortesiaBeneficiarioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CortesiaDireccionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CortesiaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CotacaoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CtrlFechamentoCaixaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CuponConvenioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CuponSecretariaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CursoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/CustomService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/DepositoBancarioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/DescontoComissaoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/DetAbastoBoletoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/DetDiagramaAutobusService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/DiagramaAutobusService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/DispositivoEmbarcadaHistoricoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/DispositivoEmbarcadaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/DivisionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmbarcadaDispOperadorService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmbarqueCatracaRodoviariaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmpleadoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmpresaContaBancariaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmpresaEmailConfigService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmpresaEmailFlexBusService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmpresaEmailService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmpresaEquivalenciaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmpresaImpostoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmpresaSaferConfigService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmpresaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmpresaTrocoSimplesService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EnderecoApanheService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EscolaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EsquemaAgrupacionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EsquemaAsientoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EsquemaCorridaEmbarqueDesembarqueService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EsquemaCorridaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EsquemaOperacionalService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EsquemaTramoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EstacionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EstacionSitefService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EstadoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EventoExtraService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ExcepcionPeajeService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ExcepcionRedondoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/FechamentoParamgeralService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/FechamentoParamptovtaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/FeriadoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/FiscalAliquotaEmpresaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/FiscalImpressoraEstadoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/FiscalImpressoraService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/FiscalService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/FlywayUtilService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/FolioPreimpresoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/FormaPagamentoAgenciaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/FormaPagoDetService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/FormaPagoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/FuncionSistemaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/GenericService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/GenericServiceInforme.java create mode 100644 src/com/rjconsultores/ventaboletos/service/GrupoCategoriaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/GrupoCortesiasService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/GrupoRutaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/HotelService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ImagemService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ImportacaoClientesService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ImportacaoClientesSrvpService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/InformeCategoriaVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/InformePasajeroServicioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/InformeServicioDiarioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/InformeVentasPuntoVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/InstiFinanceiraService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/IntegracaoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/IntegracaoTotvsService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ItemAdicionalService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ItemDescontoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/LogAuditoriaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/LogDespesasReceitasDivService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MarcaAutobusService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MarcaClaseServicioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MarcaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MensagemRecusaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MensajeEmpresaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MensajePuntaVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MensajeService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MensajeUsuarioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MercadoCompetidoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MerchantBancarioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MigracaoControleEstoqueService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MonedaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MonitoramentoCCFService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MonitoramentoCRZService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MotivoCancelVendaPacoteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MotivoCancelacionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MotivoDevolucaoBilheteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MotivoReimpresionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MotivoViajeService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MotivocancelacionEquivalenciaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MovimentacionBilhetesService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/NodoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/NotaCreditoVendaPacoteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/OCDParamService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/OCDPtoVtaParamService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/OCDService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/OperadorEmbarcadaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/OrgaoCancelacionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/OrgaoConcedenteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/OrgaoEmpParamService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/OrgaoTramoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PacoteConvenioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PacoteDescontoBilheteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PacoteItemService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PacoteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PacoteTarifaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PaisService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ParadaCodOrgaoConcedenteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ParadaEquivalenciaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ParadaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ParamAcumulaMasivoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ParamAcumulaPuntoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ParamArticuloService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ParamCanjePuntoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ParamCompraPuntoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ParamConexionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ParamCostoTarjetaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ParamRecoleccionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PerfilFuncionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PerfilService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PeriodoVacacionalService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PlazaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PrecioFixoPedagioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PrecioVentajaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PrecoApanheService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingAsientoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingCategoriaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingClaseService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingClasseTarifariaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingCorridaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingCtrlService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingDiaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingEspecificoAgenciaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingEspecificoCanalVendasService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingEspecificoCategoriaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingEspecificoOcupacionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingEspecificoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingFormapagoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingImporteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingMarcaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingMercadoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingOcupaAntecipaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingPuntoVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingRutaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingTipoPtoVtaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingTipoServicioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PricingVigenciaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ProdClaseServicioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ProdFormaPagoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ProdMarcaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ProdMercadoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ProdPrecioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ProdPuntoVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ProdRutaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ProdTipoptovtaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ProdVigenciaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ProductoServicioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtoVtaCheckinService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtoVtaSeguroService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtoVtaUsuarioBancarioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaAgenciaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaAntecipacomissaoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaAntifraudeService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaCatIndService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaComissaoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaContaMDService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaDiversosService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaBloqueadaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaContaBancariaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaEstoqueService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaHorarioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaTitularService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ReceitaDespesaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RedondeoCtrlService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RedondeoMarcaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RedondeoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RegionMetropolitanaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RelatorioAgepanService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RequisicionBoletoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ReservaEspecialClienteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ReservacionCategoriaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ReservacionClaseService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ReservacionCtrlService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ReservacionMarcaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ReservacionMercadoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ReservacionPuntoVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RestriccionPagoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RhPagoConductorService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RolOperativoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RutaCasetaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RutaCombinacionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RutaEmbarqueDesembarqueService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RutaEmpresaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RutaIcmsExcepcionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RutaSecuenciaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/RutaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/SapService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/SecretariaEmpresaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/SecretariaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/SegVKMService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/SeguradoraEmpresaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/SeguroKmService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/SeguroTarifaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/SisdapService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/SistemaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TarifaCategoriaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TarifaEmbarcadaHistService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TarifaEmbarcadaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TarifaHistService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TarifaKmService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TarifaMinimaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TarifaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TarifaTipoptovtaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TarjetaCreditoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TarjetaFidelidadService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TarjetaRecaudacionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TarjetaViajeService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TaxaEmbLevanteCtrlService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueKmService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueParadaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoCambioCiudadService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoCambioCtrlService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoConvenioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoCorteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoCortesiaDescuentoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoCortesiaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoDocAutobusService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoDomicilioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoEmpleadoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoEventoExtraEmpresaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoEventoExtraPtovtaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoEventoExtraService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoIdentificacionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoInformativoComissaoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoMovimientoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoOcupacionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoParadaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoPuntoVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoServicioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoTarifaPacoteService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TipoVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TramoKmServicioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TramoRutaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TramoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TramoServicioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TramoTiempoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/TurnoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/UsuarioBancarioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/UsuarioEmpresaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/UsuarioPerfilService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/UsuarioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/UsuarioSesionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/UsuarioUbicacionService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/VendaEmbarcadaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ViaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/VigenciaTarifaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AbastoBoletoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AbastoCentralServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AbastoHistoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AgruparParadaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AjusteEventoExtraServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AlertaCtrlServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AliasServicoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AliquotaEstadoDestinoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ArquivoRemessaCNABImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ArticuloServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AsientoExclusivoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AuditLogServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AuditModuleServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AuditServiceServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AutobusDocServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AutobusServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AutorizaFolioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AutorizacionPerfilServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AutorizacionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/BancoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/BoletoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/BpeServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CalcularPeajeServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CalculoComissaoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CancelacionCargoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CancelacionCtrlServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CasetaPeajeExcepcionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CasetaPeajeServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CategoriaBloqueioImpPosteriorServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CategoriaClaseServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CategoriaCorridaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CategoriaDescuentoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CategoriaMarcaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CategoriaMercadoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CategoriaOrgaoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CategoriaPeriodoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CategoriaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CategoriaTipoPtoVtaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CiudadServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ClaseServicioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ClaseservicioEquivalenciaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ClienteCursoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ClienteDescuentoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ClienteDireccionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ClienteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CobrancaAdcPuntoVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ColoniaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ComisionistaExternoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ComissaoReceitaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ComissaoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CompaniaBancariaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConductorServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConexionConfServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConexionCtrlServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConexionDescuentoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionRutaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaConfServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCtrlServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaExcepcionPtoVtaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTipoPtoVtaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConfContratoPuntoVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoCanalVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoExcecaoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoOrgaoConcedenteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoPtovtaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoRutasServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoTramoOCServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoTramoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoVendaWebServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConfTotemServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConferenciaPendenciaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConfigRestriccionPagoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ContaMDServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ContingenciaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ControleSerieEmbarcadaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConvenioDetServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConvenioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CorridaCtrlServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CorridaTramoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CortesiaBeneficiarioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CortesiaDireccionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CortesiaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CotacaoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CtrlFechamentoCaixaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CuponConvenioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CuponSecretariaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CursoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/CustomServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/DepositoBancarioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/DescontoComissaoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/DetAbastoBoletoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/DetDiagramaAutobusServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/DiagramaAutobusServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/DispositivoEmbarcadaHistoricoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/DispositivoEmbarcadaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/DivisionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmbarcadaDispOperadorServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmbarqueCatracaRodoviariaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmpleadoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmpresaContaBancariaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailConfigServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailFlexBusServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmpresaEquivalenciaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmpresaImpostoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmpresaSaferConfigServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmpresaTrocoSimplesServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EnderecoApanheServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EscolaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EsquemaAgrupacionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EsquemaAsientoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EsquemaCorridaEmbarqueDesembarqueServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EsquemaCorridaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EsquemaOperacionalServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EsquemaTramoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EstacionSitefServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EstadoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EventoExtraServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ExcepcionPeajeServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ExcepcionRedondoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamgeralServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/FeriadoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/FiscalAliquotaEmpresaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/FiscalImpressoraEstadoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/FiscalImpressoraServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/FiscalServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/FlywayUtilServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/FolioPreimpresoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/FormaPagamentoAgenciaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/FormaPagoDetServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/FuncionSistemaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/GrupoCategoriaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/GrupoCortesiasServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/GrupoRutaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/HotelServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ImagemServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/InformeCategoriaVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/InformePasajeroServicioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/InformeServicioDiarioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/InformeVentasPuntoVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/InstiFinanceiraServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/IntegracaoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/IntegracaoTotvsServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ItemAdicionalServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ItemDescontoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/LogAuditoriaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/LogDespesasReceitasDivServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MarcaAutobusServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MarcaClaseServicioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MarcaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MensagemRecusaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MensajeEmpresaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MensajePuntoVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MensajeServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MensajeUsuarioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MercadoCompetidoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MerchantBancarioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MigracaoControleEstoqueServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MonedaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCCFServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCRZServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MotivoCancelVendaPacoteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MotivoCancelacionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MotivoDevolucaoBilheteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MotivoReimpresionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MotivoViajeServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MotivocancelacionEquivalenciaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MovimentacionBilhetesServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/NodoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/NotaCreditoVendaPacoteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/OCDParamServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/OCDPtoVtaParamServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/OCDServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/OperadorEmbarcadaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/OrgaoCancelacionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/OrgaoEmpParamServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/OrgaoTramoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PacoteConvenioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PacoteDescontoBilheteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PacoteItemServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PacoteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PacoteTarifaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PaisServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ParadaCodOrgaoConcedenteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ParadaEquivalenciaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaMasivoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaPuntoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ParamArticuloServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ParamCanjePuntoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ParamCompraPuntoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ParamConexionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ParamCostoTarjetaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ParamRecoleccionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PerfilFuncionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PerfilServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PeriodoVacacionalServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PlazaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PrecioFixoPedagioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PrecioVentajaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PrecoApanheServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingAsientoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingCategoriaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingClaseServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingClasseTarifariaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingCorridaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingCtrlServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingDiaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoAgenciaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoCanalVendasServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoCategoriaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoOcupacionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingFormapagoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingImporteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingMarcaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingMercadoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingOcupaAntecipaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingPuntoVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingRutaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingTipoPtoVtaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingTipoServicioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PricingVigenciaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ProdClaseServicioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ProdFormaPagoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ProdMarcaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ProdMercadoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ProdPrecioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ProdPuntoVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ProdRutaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ProdTipoptovtaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ProdVigenciaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ProductoServicioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtoVtaCheckinServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtoVtaSeguroServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtoVtaUsuarioBancarioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaAgenciaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaAntecipacomissaoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaAntifraudeServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaCatIndServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaContaMDServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaDiversosServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaBloqueadaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaContaBancariaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaEstoqueServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaHorarioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ReceitaDespesaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RedondeoCtrlServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RedondeoMarcaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RedondeoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RegionMetropolitanaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RelatorioAgepanServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RequisicionBoletoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ReservaEspecialClienteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ReservacionCategoriaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ReservacionClaseServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ReservacionCtrlServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ReservacionMarcaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ReservacionMercadoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ReservacionPuntoVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RestriccionPagoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RhPagoConductorServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RolOperativoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RutaCasetaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RutaCombinacionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RutaEmbarqueDesembarqueServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RutaEmpresaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RutaIcmsExcepcionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RutaSecuenciaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/SecretariaEmpresaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/SecretariaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/SegVKMServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/SeguradoraEmpresaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/SeguroKmServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/SeguroTarifaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/SisdapServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/SistemaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TarifaCategoriaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TarifaEmbarcadaHistServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TarifaEmbarcadaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TarifaHistServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TarifaKmServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TarifaMinimaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TarifaTipoptovtaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TarjetaCreditoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TarjetaFidelidadServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TarjetaRecaudacionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TarjetaViajeServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbLevanteCtrlServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueKmServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueParadaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCiudadServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCtrlServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoConvenioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoCorteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaDescuentoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoDocAutobusServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoDomicilioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoEmpleadoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraEmpresaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraPtovtaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoIdentificacionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoInformativoComissaoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoMovimientoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoOcupacionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoParadaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoPuntoVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoServicioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoTarifaPacoteServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TipoVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TramoKmServicioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TramoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TramoServicioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TramoTiempoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/TurnoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/UsuarioBancarioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/UsuarioEmpresaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/UsuarioPerfilServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/UsuarioSesionImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/UsuarioUbicacionServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/VendaEmbarcadaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ViaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/VigenciaTarifaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/ActivoUtil.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/Application.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/ApplicationProperties.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/BigDecimalUtil.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/CustomEnum.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/DocumentosUtil.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/FeriadoCache.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/HoraSistema.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/LocaleUtil.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/LocalizadorHelper.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/MoneyHelper.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/OcdUtil.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/PasswordHelper.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/PricingConverterVOToEntidad.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/RegistroConDependenciaException.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/SendMail.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/StringHelper.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/TimeZoneUtil.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/TraslaparUtil.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/UsuarioLogado.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/UtiliteriasFiscal.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/ValidadorImportacaoEcf.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/ZipUtil.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECF.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFManual.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFReducaoZ.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionNaoFiscal.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionReducaoZ.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ValidaIntegracionECFRedZxls.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacao/ExportacaoBpe.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEBase.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoBPE.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoDPE.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoOBE.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoPRC.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEVo.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/xml/BPeUtil.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/xml/BpeBuscaCamposXml.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/ExportacaoFiscal.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoBPR.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoBPRBase.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECF.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFBase.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoCCF.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoCFC.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoICF.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoPRC.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoBPS.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoDBP.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoPAR.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoRMD.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoSeqBPS.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoSeqDBP.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/DetalhadoFiscal.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/FinanceiroAnalitico.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/FinanceiroSintetico.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/FiscalRdi.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/RdiValidacion.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/impressaormd/vo/DetalhadoRMD.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/impressaormd/vo/FolioRMD.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/impressaormd/vo/ImpressaoRMD.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/seguridad/Base64.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/seguridad/ContrasenaUtileria.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/spring/MyAnnotationSessionFactoryBean.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiGrantedAuthority.java create mode 100644 src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiPasswordEncoder.java create mode 100644 src/com/rjconsultores/ventaboletos/version/model/entidadesAdmVta.version create mode 100644 src/com/rjconsultores/ventaboletos/vo/OrgaoConcedente/OrgaoConcedenteVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/OrgaoConcedente/RelatorioGratuidadeAgepanVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/aidf/AidfVo.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/aidf/ItemRelatorioMovimentoEstoque.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/bpe/BPeVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ClientePacoteVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/DadosBancarioVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/EnderecoApanheVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ItemAdicionalVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/NotaCreditoVendaPacoteVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/OcdPacoteVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PacoteVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PagamentoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PassageiroVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ServicoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosClientePacoteResultTransformer.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosDadosBancarioResultTransformer.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosEmpresaResultTransformer.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosEnderecoApanheResultTransformer.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosItemAdicionalResultTransformer.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPagamentoResultTransformer.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPassageiroResultTransformer.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPuntoVentaResultTransformer.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosServicoResultTransformer.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosTicketResultTransformer.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/RelatorioVendaCartaoCashMonitorResultTransformer.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/caja/CajaCerradoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/caja/CajaDetalleVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/caja/CajaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/caja/PagamentoCartaoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/caja/PagamentoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/caja/ReceitaDespesaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/caja/UsuarioActivoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/caja/UsuarioVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/caja/VendaEmbarcadaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/cashmonitor/RelatorioVendaCartaoCashMonitorVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/clase/ClaseVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoDesconto.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoLogVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoReceita.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/ConferenciaComissaoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/DiaConferenciaComissaoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/EmailConfigVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/EtiquetaMalote.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/EventosFinanceirosVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/FormapagoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/HistoricoComissao.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/LogConferenciaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/MovimentosAtrasoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/OcdVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/RegistroCalculo.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/ResumoComissao.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/TarifaOficialVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/TarifaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/conexion/ConexionRutaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/conexion/OrdenarLocalidadesGeradas.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/configuracioneccomerciales/ConfLayoutContratoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/configuracioneccomerciales/ConfigCoordenadas.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/corrida/ColunasConsultaCorridaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/corrida/CorridaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/corrida/TramoSequenciaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/AutorizacaoUsoSerieEmbarcadaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/CidadeVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/DetalheCorridaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/DispositivoEmbarcadaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/EmpresaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/EstadoDispositivoEmbarcadaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/FormaPagamentoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/InscricaoEstadualVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/OperadorEmbarcadaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/PtoVtaUsuarioUltimaVendaDispositivoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/SeguroTaxaEmbarqueVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/SerieEmbarcada.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/TiposPassagensBloqueadasVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/embarcada/UsuarioEmbarcadaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/TaxaEmbarqueW2i.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/exportacao/QdmpDerCabecaVo.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/exportacao/QdmpDerLinhaVo.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/exportacao/QdmpDerRodapeVo.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraEcfVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraReducaoZVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalReducaoZVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionManualFiscalVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionNaoFiscalVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemFiscalVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioFinanceiro.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioVoucher.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalReducaoZVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorManualFiscalVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorNaoFiscalVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/RelatorioFinanceiro.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SiglaMotivoCancelacion.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SituacaoTributaria.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SubItens.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TipoPendencia.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TotalRelatorioVoucher.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/integracao/FechamentoCntCorrenteVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/layout/DiagramaPoltronas.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/parada/ConexionCtrlVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/parada/ConexionRutaConfVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/parada/ConexionRutaCtrlVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/parada/ParadaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/parada/ParadaVOConexionRuta.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/Pricing.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/PricingAsiento.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/PricingCanalVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/PricingCategoria.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/PricingClasse.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/PricingCorrida.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/PricingDia.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/PricingMarca.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/PricingMercado.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/PricingOcupaAntecipa.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/PricingPuntoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/PricingRuta.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/PricingTipoCorrida.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/pricing/PricingVigencia.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/reembolsoocdnotacredito/ReembolsoOcdNotaCreditoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/roloperativo/RolOperativoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/ruta/RutaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/secuencia/SecuenciaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/segurida/PerfilJerarquia.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaGroupVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaGroupVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/tiposervicio/TipoServicioVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/tramo/TramoTarifaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/tramo/TramoVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/via/ViaVO.java create mode 100644 src/com/rjconsultores/ventaboletos/web/utilerias/NamedParameterStatement.java create mode 100644 src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java create mode 100644 src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java create mode 100644 src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosClientePacoteRS.java create mode 100644 src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosTicketsRS.java create mode 100644 src/com/rjconsultores/ventaboletos/ws/rs/CajaCerradoRS.java create mode 100644 src/com/rjconsultores/ventaboletos/ws/rs/CajaRS.java create mode 100644 src/com/rjconsultores/ventaboletos/ws/rs/ReembolsoOcdNotaCreditoRS.java create mode 100644 src/com/rjconsultores/ventaboletos/ws/rs/UsuarioRS.java create mode 100644 src/com/rjconsultores/ventaboletos/ws/rs/VendaEmbarcadaRS.java create mode 100644 src/org/w3/_2000/_09/xmldsig_/KeyInfoType.java create mode 100644 src/org/w3/_2000/_09/xmldsig_/ObjectFactory.java create mode 100644 src/org/w3/_2000/_09/xmldsig_/ReferenceType.java create mode 100644 src/org/w3/_2000/_09/xmldsig_/SignatureType.java create mode 100644 src/org/w3/_2000/_09/xmldsig_/SignatureValueType.java create mode 100644 src/org/w3/_2000/_09/xmldsig_/SignedInfoType.java create mode 100644 src/org/w3/_2000/_09/xmldsig_/TransformType.java create mode 100644 src/org/w3/_2000/_09/xmldsig_/TransformsType.java create mode 100644 src/org/w3/_2000/_09/xmldsig_/X509DataType.java create mode 100644 src/org/w3/_2000/_09/xmldsig_/package-info.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..7bf83a321 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +/.classpath +/.project +/.settings/org.eclipse.jdt.core.prefs +/.settings/org.eclipse.jdt.ui.prefs +/.settings/org.eclipse.m2e.core.prefs +/.settings/org.eclipse.wst.common.component +/.settings/org.eclipse.wst.common.project.facet.core.xml +/.settings/org.eclipse.wst.validation.prefs +/.settings/org.hibernate.eclipse.console.prefs +/.settings/org.jboss.ide.eclipse.as.core.prefs diff --git a/pom.xml b/pom.xml new file mode 100644 index 000000000..a87f9c476 --- /dev/null +++ b/pom.xml @@ -0,0 +1,350 @@ + + 4.0.0 + br.com.rjconsultores + modelWeb + 0.0.1-SNAPSHOT + + + br.com.rjconsultores + brazilutils + 0.1.1 + + + commons-codec + commons-codec + 1.3 + + + commons-io + commons-io + 1.3.1 + + + commons-lang + commons-lang + 2.2 + + + jdbc + jdbc-stdext + 2.0 + + + log4j + log4j + 1.2.16 + + + br.com.rjconsultores + ojdbc14 + 1.0 + provided + + + org.slf4j + slf4j-api + 1.6.1 + + + org.springframework + spring-beans + 3.0.6.RELEASE + + + org.springframework + spring-context + 3.0.6.RELEASE + + + org.springframework + spring-core + 3.0.6.RELEASE + + + org.springframework + spring-jdbc + 3.0.6.RELEASE + + + org.springframework + spring-orm + 3.0.6.RELEASE + + + org.springframework + spring-transaction + 3.0.6.RELEASE + + + org.springframework + spring-web + 3.0.6.RELEASE + + + org.springframework.security + spring-security-config + 3.0.7.RELEASE + runtime + + + org.springframework.security + spring-security-core + 3.0.7.RELEASE + + + org.springframework.security + spring-security-ldap + 3.0.7.RELEASE + runtime + + + org.springframework.security + spring-security-taglibs + 3.0.7.RELEASE + runtime + + + org.springframework.security + spring-security-web + 3.0.7.RELEASE + runtime + + + org.zkoss.common + zcommon + 5.0.9 + + + org.zkoss.zk + zkplus + 5.0.9 + + + org.zkoss.zk + zul + 5.0.9 + + + com.lowagie + itext + 2.1.7 + + + net.sf.jasperreports + jasperreports + 5.1.0 + + + net.sf.jasperreports + jasperreports-javaflow + 5.1.0 + + + net.sf.jasperreports + jasperreports-fonts + 5.1.0 + + + commons-digester + commons-digester + 1.7 + + + com.google.code.maven-play-plugin.org.apache.commons + commons-javaflow + 20060411 + + + org.hibernate + hibernate-validator-legacy + 4.0.2.GA + runtime + + + + hibernate-commons-annotations + + org.hibernate + + + hibernate-core + org.hibernate + + + slf4j-api + org.slf4j + + + + + org.hibernate.javax.persistence + hibernate-jpa-2.0-api + 1.0.1.Final + + + commons-dbutils + commons-dbutils + 1.6 + + + com.google.code.gson + gson + 2.3.1 + + + + commons-collections + commons-collections + 3.2.1 + + + org.apache.poi + poi-ooxml + 3.8 + + + org.apache.poi + poi + 3.8 + + + org.json + json + 20140107 + + + org.jboss.resteasy + jaxrs-api + 2.3.1.GA + provided + + + org.codehaus.jettison + jettison + 1.0.1 + + + net.sourceforge.jexcelapi + jxl + 1.0.0 + + + com.sun.mail + javax.mail + 1.4.4 + + + br.com.rjconsultores + GeneradorBoletosCNAB + 0.0.1-SNAPSHOT + + + br.com.rjconsultores + WSTotvs + 0.0.1-SNAPSHOT + + + org.eclipse.tycho + org.eclipse.jdt.core + + + + + br.com.rjconsultores + WSAG + 0.0.1-SNAPSHOT + + + org.aspectj + aspectjweaver + 1.8.9 + + + org.jboss.spec.javax.servlet + jboss-servlet-api_3.0_spec + 1.0.0.Final + provided + + + javax.xml.bind + jaxb-api + 2.2.12 + + + javax.activation + activation + 1.1 + + + xml-apis + xml-apis + 1.0.b2 + + + org.hibernate + hibernate-core + 3.6.6.Final + + + org.apache.httpcomponents + httpclient + 4.1.2 + + + org.apache.httpcomponents + httpcore + 4.1.2 + + + stax + stax-api + 1.0.1 + + + org.jboss.logging + jboss-logging + 3.0.0.GA + + + br.com.rjconsultores + Auditador + 0.0.1-SNAPSHOT + + + commons-lang + commons-lang + + + + + org.eclipse.jdt.core.compiler + ecj + 4.3.1 + + + + src + + + src + + **/*.java + + + + + + maven-compiler-plugin + 3.3 + + 1.6 + 1.6 + Cp1252 + + + + + + + \ No newline at end of file diff --git a/src/META-INF/MANIFEST.MF b/src/META-INF/MANIFEST.MF new file mode 100644 index 000000000..b9f956e28 --- /dev/null +++ b/src/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Ant-Version: Apache Ant 1.8.3 +Created-By: 1.7.0-b147 (Oracle Corporation) \ No newline at end of file diff --git a/src/br/inf/portalfiscal/bpe/EvNaoEmbBPe.java b/src/br/inf/portalfiscal/bpe/EvNaoEmbBPe.java new file mode 100644 index 000000000..15d14b263 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/EvNaoEmbBPe.java @@ -0,0 +1,134 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.29 às 06:11:44 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType>
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="descEvento">
+ *           <simpleType>
+ *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *               <whiteSpace value="preserve"/>
+ *               <enumeration value="Não Embarque"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="nProt" type="{http://www.portalfiscal.inf.br/bpe}TProt"/>
+ *         <element name="xJust" type="{http://www.portalfiscal.inf.br/bpe}TJust"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "", propOrder = { + "descEvento", + "nProt", + "xJust" +}) +@XmlRootElement(name = "evNaoEmbBPe") +public class EvNaoEmbBPe { + + @XmlElement(required = true) + protected String descEvento; + @XmlElement(required = true) + protected String nProt; + @XmlElement(required = true) + protected String xJust; + + /** + * Obtém o valor da propriedade descEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescEvento() { + return descEvento; + } + + /** + * Define o valor da propriedade descEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescEvento(String value) { + this.descEvento = value; + } + + /** + * Obtém o valor da propriedade nProt. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNProt() { + return nProt; + } + + /** + * Define o valor da propriedade nProt. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNProt(String value) { + this.nProt = value; + } + + /** + * Obtém o valor da propriedade xJust. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXJust() { + return xJust; + } + + /** + * Define o valor da propriedade xJust. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXJust(String value) { + this.xJust = value; + } + +} diff --git a/src/br/inf/portalfiscal/bpe/ObjectFactory.java b/src/br/inf/portalfiscal/bpe/ObjectFactory.java new file mode 100644 index 000000000..303511ca3 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/ObjectFactory.java @@ -0,0 +1,316 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the br.inf.portalfiscal.bpe package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _RetBPe_QNAME = new QName("http://www.portalfiscal.inf.br/bpe", "retBPe"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: br.inf.portalfiscal.bpe + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link TImp } + * + */ + public TImp createTImp() { + return new TImp(); + } + + /** + * Create an instance of {@link TProtBPe } + * + */ + public TProtBPe createTProtBPe() { + return new TProtBPe(); + } + + /** + * Create an instance of {@link TBPe } + * + */ + public TBPe createTBPe() { + return new TBPe(); + } + + /** + * Create an instance of {@link TBPe.InfBPe } + * + */ + public TBPe.InfBPe createTBPeInfBPe() { + return new TBPe.InfBPe(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.Pag } + * + */ + public TBPe.InfBPe.Pag createTBPeInfBPePag() { + return new TBPe.InfBPe.Pag(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.Imp } + * + */ + public TBPe.InfBPe.Imp createTBPeInfBPeImp() { + return new TBPe.InfBPe.Imp(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.InfValorBPe } + * + */ + public TBPe.InfBPe.InfValorBPe createTBPeInfBPeInfValorBPe() { + return new TBPe.InfBPe.InfValorBPe(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.InfViagem } + * + */ + public TBPe.InfBPe.InfViagem createTBPeInfBPeInfViagem() { + return new TBPe.InfBPe.InfViagem(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.InfPassagem } + * + */ + public TBPe.InfBPe.InfPassagem createTBPeInfBPeInfPassagem() { + return new TBPe.InfBPe.InfPassagem(); + } + + /** + * Create an instance of {@link TRetBPe } + * + */ + public TRetBPe createTRetBPe() { + return new TRetBPe(); + } + + /** + * Create an instance of {@link TEnviBPe } + * + */ + public TEnviBPe createTEnviBPe() { + return new TEnviBPe(); + } + + /** + * Create an instance of {@link TEndereco } + * + */ + public TEndereco createTEndereco() { + return new TEndereco(); + } + + /** + * Create an instance of {@link TEndeEmi } + * + */ + public TEndeEmi createTEndeEmi() { + return new TEndeEmi(); + } + + /** + * Create an instance of {@link TImp.ICMS00 } + * + */ + public TImp.ICMS00 createTImpICMS00() { + return new TImp.ICMS00(); + } + + /** + * Create an instance of {@link TImp.ICMS20 } + * + */ + public TImp.ICMS20 createTImpICMS20() { + return new TImp.ICMS20(); + } + + /** + * Create an instance of {@link TImp.ICMS45 } + * + */ + public TImp.ICMS45 createTImpICMS45() { + return new TImp.ICMS45(); + } + + /** + * Create an instance of {@link TImp.ICMS90 } + * + */ + public TImp.ICMS90 createTImpICMS90() { + return new TImp.ICMS90(); + } + + /** + * Create an instance of {@link TImp.ICMSOutraUF } + * + */ + public TImp.ICMSOutraUF createTImpICMSOutraUF() { + return new TImp.ICMSOutraUF(); + } + + /** + * Create an instance of {@link TImp.ICMSSN } + * + */ + public TImp.ICMSSN createTImpICMSSN() { + return new TImp.ICMSSN(); + } + + /** + * Create an instance of {@link TProtBPe.InfProt } + * + */ + public TProtBPe.InfProt createTProtBPeInfProt() { + return new TProtBPe.InfProt(); + } + + /** + * Create an instance of {@link TBPe.InfBPeSupl } + * + */ + public TBPe.InfBPeSupl createTBPeInfBPeSupl() { + return new TBPe.InfBPeSupl(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.Ide } + * + */ + public TBPe.InfBPe.Ide createTBPeInfBPeIde() { + return new TBPe.InfBPe.Ide(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.Emit } + * + */ + public TBPe.InfBPe.Emit createTBPeInfBPeEmit() { + return new TBPe.InfBPe.Emit(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.Comp } + * + */ + public TBPe.InfBPe.Comp createTBPeInfBPeComp() { + return new TBPe.InfBPe.Comp(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.Agencia } + * + */ + public TBPe.InfBPe.Agencia createTBPeInfBPeAgencia() { + return new TBPe.InfBPe.Agencia(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.InfBPeSub } + * + */ + public TBPe.InfBPe.InfBPeSub createTBPeInfBPeInfBPeSub() { + return new TBPe.InfBPe.InfBPeSub(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.AutXML } + * + */ + public TBPe.InfBPe.AutXML createTBPeInfBPeAutXML() { + return new TBPe.InfBPe.AutXML(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.InfAdic } + * + */ + public TBPe.InfBPe.InfAdic createTBPeInfBPeInfAdic() { + return new TBPe.InfBPe.InfAdic(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.Pag.Card } + * + */ + public TBPe.InfBPe.Pag.Card createTBPeInfBPePagCard() { + return new TBPe.InfBPe.Pag.Card(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.Imp.ICMSUFFim } + * + */ + public TBPe.InfBPe.Imp.ICMSUFFim createTBPeInfBPeImpICMSUFFim() { + return new TBPe.InfBPe.Imp.ICMSUFFim(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.InfValorBPe.Comp } + * + */ + public TBPe.InfBPe.InfValorBPe.Comp createTBPeInfBPeInfValorBPeComp() { + return new TBPe.InfBPe.InfValorBPe.Comp(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.InfViagem.InfTravessia } + * + */ + public TBPe.InfBPe.InfViagem.InfTravessia createTBPeInfBPeInfViagemInfTravessia() { + return new TBPe.InfBPe.InfViagem.InfTravessia(); + } + + /** + * Create an instance of {@link TBPe.InfBPe.InfPassagem.InfPassageiro } + * + */ + public TBPe.InfBPe.InfPassagem.InfPassageiro createTBPeInfBPeInfPassagemInfPassageiro() { + return new TBPe.InfBPe.InfPassagem.InfPassageiro(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link TRetBPe }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://www.portalfiscal.inf.br/bpe", name = "retBPe") + public JAXBElement createRetBPe(TRetBPe value) { + return new JAXBElement(_RetBPe_QNAME, TRetBPe.class, null, value); + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TBPe.java b/src/br/inf/portalfiscal/bpe/TBPe.java new file mode 100644 index 000000000..d397915cf --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TBPe.java @@ -0,0 +1,6042 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.10.23 às 04:19:56 PM BRST +// + + +package br.inf.portalfiscal.bpe; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlID; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * Tipo Bilhete de Passagem Eletrônico + * + *

Classe Java de TBPe complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TBPe">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="infBPe">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="ide">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="cUF" type="{http://www.portalfiscal.inf.br/bpe}TCodUfIBGE"/>
+ *                             <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+ *                             <element name="mod" type="{http://www.portalfiscal.inf.br/bpe}TModBPe"/>
+ *                             <element name="serie">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TSerie">
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="nBP" type="{http://www.portalfiscal.inf.br/bpe}TNF"/>
+ *                             <element name="cBP">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <pattern value="[0-9]{8}"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="cDV">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <pattern value="[0-9]{1}"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="modal">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TModal">
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="dhEmi" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+ *                             <element name="tpEmis">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <enumeration value="1"/>
+ *                                   <enumeration value="2"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="verProc">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                   <minLength value="1"/>
+ *                                   <maxLength value="20"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="tpBPe">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TTipoBPe">
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="indPres" type="{http://www.portalfiscal.inf.br/bpe}TIndPres"/>
+ *                             <element name="UFIni" type="{http://www.portalfiscal.inf.br/bpe}TUf_sem_EX"/>
+ *                             <element name="cMunIni" type="{http://www.portalfiscal.inf.br/bpe}TCodMunIBGE"/>
+ *                             <element name="UFFim" type="{http://www.portalfiscal.inf.br/bpe}TUf"/>
+ *                             <element name="cMunFim" type="{http://www.portalfiscal.inf.br/bpe}TCodMunIBGE"/>
+ *                             <sequence minOccurs="0">
+ *                               <element name="dhCont" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+ *                               <element name="xJust">
+ *                                 <simpleType>
+ *                                   <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                     <minLength value="15"/>
+ *                                     <maxLength value="256"/>
+ *                                   </restriction>
+ *                                 </simpleType>
+ *                               </element>
+ *                             </sequence>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                   <element name="emit">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj"/>
+ *                             <element name="IE">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TIe">
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="IEST" minOccurs="0">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TIe">
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="xNome">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                   <maxLength value="60"/>
+ *                                   <minLength value="2"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="xFant" minOccurs="0">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                   <maxLength value="60"/>
+ *                                   <minLength value="1"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <sequence minOccurs="0">
+ *                               <element name="IM">
+ *                                 <simpleType>
+ *                                   <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                     <minLength value="1"/>
+ *                                     <maxLength value="15"/>
+ *                                   </restriction>
+ *                                 </simpleType>
+ *                               </element>
+ *                               <element name="CNAE">
+ *                                 <simpleType>
+ *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                     <whiteSpace value="preserve"/>
+ *                                     <pattern value="[0-9]{7}"/>
+ *                                   </restriction>
+ *                                 </simpleType>
+ *                               </element>
+ *                             </sequence>
+ *                             <element name="CRT">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <enumeration value="1"/>
+ *                                   <enumeration value="2"/>
+ *                                   <enumeration value="3"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="enderEmit" type="{http://www.portalfiscal.inf.br/bpe}TEndeEmi"/>
+ *                             <element name="TAR" minOccurs="0">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <minLength value="1"/>
+ *                                   <maxLength value="20"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                   <element name="comp" minOccurs="0">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="xNome">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                   <maxLength value="60"/>
+ *                                   <minLength value="2"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <choice>
+ *                               <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpjOpc"/>
+ *                               <element name="CPF" type="{http://www.portalfiscal.inf.br/bpe}TCpf"/>
+ *                               <element name="idEstrangeiro">
+ *                                 <simpleType>
+ *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                     <whiteSpace value="preserve"/>
+ *                                     <pattern value="([!-ÿ]{0}|[!-ÿ]{5,20})?"/>
+ *                                   </restriction>
+ *                                 </simpleType>
+ *                               </element>
+ *                             </choice>
+ *                             <element name="IE" minOccurs="0">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TIeDest">
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="enderComp" type="{http://www.portalfiscal.inf.br/bpe}TEndereco"/>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                   <element name="agencia" minOccurs="0">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="xNome">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                   <maxLength value="60"/>
+ *                                   <minLength value="2"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpjOpc"/>
+ *                             <element name="enderAgencia" type="{http://www.portalfiscal.inf.br/bpe}TEndereco"/>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                   <element name="infBPeSub" minOccurs="0">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe"/>
+ *                             <element name="tpSub" type="{http://www.portalfiscal.inf.br/bpe}TTipoSubstituicao"/>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                   <element name="infPassagem">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="cLocOrig">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <minLength value="1"/>
+ *                                   <maxLength value="7"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="xLocOrig">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                   <maxLength value="60"/>
+ *                                   <minLength value="2"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="cLocDest">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <minLength value="1"/>
+ *                                   <maxLength value="7"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="xLocDest">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                   <maxLength value="60"/>
+ *                                   <minLength value="2"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="dhEmb" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+ *                             <element name="infPassageiro" minOccurs="0">
+ *                               <complexType>
+ *                                 <complexContent>
+ *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                                     <sequence>
+ *                                       <element name="xNome">
+ *                                         <simpleType>
+ *                                           <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                             <maxLength value="60"/>
+ *                                             <minLength value="2"/>
+ *                                           </restriction>
+ *                                         </simpleType>
+ *                                       </element>
+ *                                       <element name="CPF" type="{http://www.portalfiscal.inf.br/bpe}TCpf" minOccurs="0"/>
+ *                                       <element name="tpDoc" type="{http://www.portalfiscal.inf.br/bpe}TDoc"/>
+ *                                       <element name="nDoc">
+ *                                         <simpleType>
+ *                                           <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                             <minLength value="2"/>
+ *                                             <maxLength value="20"/>
+ *                                           </restriction>
+ *                                         </simpleType>
+ *                                       </element>
+ *                                       <element name="dNasc" minOccurs="0">
+ *                                         <simpleType>
+ *                                           <restriction base="{http://www.portalfiscal.inf.br/bpe}TData">
+ *                                           </restriction>
+ *                                         </simpleType>
+ *                                       </element>
+ *                                       <element name="fone" minOccurs="0">
+ *                                         <simpleType>
+ *                                           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                             <whiteSpace value="preserve"/>
+ *                                             <pattern value="[0-9]{7,12}"/>
+ *                                           </restriction>
+ *                                         </simpleType>
+ *                                       </element>
+ *                                       <element name="email" type="{http://www.portalfiscal.inf.br/bpe}TEmail" minOccurs="0"/>
+ *                                     </sequence>
+ *                                   </restriction>
+ *                                 </complexContent>
+ *                               </complexType>
+ *                             </element>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                   <element name="infViagem" maxOccurs="unbounded">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="cPercurso">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <minLength value="1"/>
+ *                                   <maxLength value="20"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="xPercurso">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                   <maxLength value="100"/>
+ *                                   <minLength value="2"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="tpViagem">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <enumeration value="00"/>
+ *                                   <enumeration value="01"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="tpServ">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <enumeration value="1"/>
+ *                                   <enumeration value="2"/>
+ *                                   <enumeration value="3"/>
+ *                                   <enumeration value="4"/>
+ *                                   <enumeration value="5"/>
+ *                                   <enumeration value="6"/>
+ *                                   <enumeration value="7"/>
+ *                                   <enumeration value="8"/>
+ *                                   <enumeration value="9"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="tpAcomodacao">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <enumeration value="1"/>
+ *                                   <enumeration value="2"/>
+ *                                   <enumeration value="3"/>
+ *                                   <enumeration value="4"/>
+ *                                   <enumeration value="5"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="tpTrecho">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <enumeration value="1"/>
+ *                                   <enumeration value="2"/>
+ *                                   <enumeration value="3"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="dhViagem" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+ *                             <element name="dhConexao" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC" minOccurs="0"/>
+ *                             <element name="prefixo" minOccurs="0">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <minLength value="1"/>
+ *                                   <maxLength value="20"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="poltrona" minOccurs="0">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <minLength value="1"/>
+ *                                   <maxLength value="3"/>
+ *                                   <pattern value="0|[1-9]{1}[0-9]{0,2}"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="plataforma" minOccurs="0">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                   <maxLength value="10"/>
+ *                                   <minLength value="2"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="infTravessia" minOccurs="0">
+ *                               <complexType>
+ *                                 <complexContent>
+ *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                                     <sequence>
+ *                                       <element name="tpVeiculo">
+ *                                         <simpleType>
+ *                                           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                             <whiteSpace value="preserve"/>
+ *                                             <enumeration value="01"/>
+ *                                             <enumeration value="02"/>
+ *                                             <enumeration value="03"/>
+ *                                             <enumeration value="04"/>
+ *                                             <enumeration value="05"/>
+ *                                             <enumeration value="06"/>
+ *                                             <enumeration value="07"/>
+ *                                             <enumeration value="08"/>
+ *                                             <enumeration value="09"/>
+ *                                             <enumeration value="10"/>
+ *                                             <enumeration value="11"/>
+ *                                             <enumeration value="12"/>
+ *                                             <enumeration value="13"/>
+ *                                             <enumeration value="14"/>
+ *                                             <enumeration value="15"/>
+ *                                             <enumeration value="16"/>
+ *                                             <enumeration value="17"/>
+ *                                             <enumeration value="18"/>
+ *                                             <enumeration value="19"/>
+ *                                             <enumeration value="20"/>
+ *                                             <enumeration value="21"/>
+ *                                             <enumeration value="22"/>
+ *                                             <enumeration value="23"/>
+ *                                             <enumeration value="24"/>
+ *                                             <enumeration value="25"/>
+ *                                             <enumeration value="26"/>
+ *                                             <enumeration value="27"/>
+ *                                             <enumeration value="28"/>
+ *                                             <enumeration value="29"/>
+ *                                             <enumeration value="99"/>
+ *                                           </restriction>
+ *                                         </simpleType>
+ *                                       </element>
+ *                                       <element name="sitVeiculo">
+ *                                         <simpleType>
+ *                                           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                             <whiteSpace value="preserve"/>
+ *                                             <enumeration value="1"/>
+ *                                             <enumeration value="2"/>
+ *                                             <enumeration value="3"/>
+ *                                           </restriction>
+ *                                         </simpleType>
+ *                                       </element>
+ *                                     </sequence>
+ *                                   </restriction>
+ *                                 </complexContent>
+ *                               </complexType>
+ *                             </element>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                   <element name="infValorBPe">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="vBP" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                             <element name="vDesconto" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                             <element name="vPgto" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                             <element name="vTroco" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                             <element name="tpDesconto" minOccurs="0">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <enumeration value="01"/>
+ *                                   <enumeration value="02"/>
+ *                                   <enumeration value="03"/>
+ *                                   <enumeration value="04"/>
+ *                                   <enumeration value="05"/>
+ *                                   <enumeration value="06"/>
+ *                                   <enumeration value="07"/>
+ *                                   <enumeration value="08"/>
+ *                                   <enumeration value="09"/>
+ *                                   <enumeration value="10"/>
+ *                                   <enumeration value="99"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="xDesconto" minOccurs="0">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                   <maxLength value="100"/>
+ *                                   <minLength value="2"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="Comp" maxOccurs="unbounded">
+ *                               <complexType>
+ *                                 <complexContent>
+ *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                                     <sequence>
+ *                                       <element name="tpComp">
+ *                                         <simpleType>
+ *                                           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                             <whiteSpace value="preserve"/>
+ *                                             <enumeration value="01"/>
+ *                                             <enumeration value="02"/>
+ *                                             <enumeration value="03"/>
+ *                                             <enumeration value="04"/>
+ *                                             <enumeration value="05"/>
+ *                                             <enumeration value="06"/>
+ *                                             <enumeration value="99"/>
+ *                                           </restriction>
+ *                                         </simpleType>
+ *                                       </element>
+ *                                       <element name="vComp" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                                     </sequence>
+ *                                   </restriction>
+ *                                 </complexContent>
+ *                               </complexType>
+ *                             </element>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                   <element name="imp">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="ICMS" type="{http://www.portalfiscal.inf.br/bpe}TImp"/>
+ *                             <element name="vTotTrib" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302" minOccurs="0"/>
+ *                             <element name="infAdFisco" minOccurs="0">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                   <maxLength value="2000"/>
+ *                                   <minLength value="1"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="ICMSUFFim" minOccurs="0">
+ *                               <complexType>
+ *                                 <complexContent>
+ *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                                     <sequence>
+ *                                       <element name="vBCUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                                       <element name="pFCPUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+ *                                       <element name="pICMSUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+ *                                       <element name="pICMSInter" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+ *                                       <element name="pICMSInterPart" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+ *                                       <element name="vFCPUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                                       <element name="vICMSUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                                       <element name="vICMSUFIni" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                                     </sequence>
+ *                                   </restriction>
+ *                                 </complexContent>
+ *                               </complexType>
+ *                             </element>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                   <element name="pag" maxOccurs="10">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="tPag">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                   <whiteSpace value="preserve"/>
+ *                                   <enumeration value="01"/>
+ *                                   <enumeration value="02"/>
+ *                                   <enumeration value="03"/>
+ *                                   <enumeration value="04"/>
+ *                                   <enumeration value="05"/>
+ *                                   <enumeration value="99"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="vPag" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                             <element name="card" minOccurs="0">
+ *                               <complexType>
+ *                                 <complexContent>
+ *                                   <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                                     <sequence>
+ *                                       <element name="tpIntegra">
+ *                                         <simpleType>
+ *                                           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                             <whiteSpace value="preserve"/>
+ *                                             <enumeration value="1"/>
+ *                                             <enumeration value="2"/>
+ *                                           </restriction>
+ *                                         </simpleType>
+ *                                       </element>
+ *                                       <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj" minOccurs="0"/>
+ *                                       <element name="tBand" minOccurs="0">
+ *                                         <simpleType>
+ *                                           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                             <whiteSpace value="preserve"/>
+ *                                             <enumeration value="01"/>
+ *                                             <enumeration value="02"/>
+ *                                             <enumeration value="03"/>
+ *                                             <enumeration value="04"/>
+ *                                             <enumeration value="05"/>
+ *                                             <enumeration value="99"/>
+ *                                           </restriction>
+ *                                         </simpleType>
+ *                                       </element>
+ *                                       <element name="cAut" minOccurs="0">
+ *                                         <simpleType>
+ *                                           <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                             <minLength value="1"/>
+ *                                             <maxLength value="20"/>
+ *                                           </restriction>
+ *                                         </simpleType>
+ *                                       </element>
+ *                                     </sequence>
+ *                                   </restriction>
+ *                                 </complexContent>
+ *                               </complexType>
+ *                             </element>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                   <element name="autXML" maxOccurs="10" minOccurs="0">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <choice>
+ *                               <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj"/>
+ *                               <element name="CPF" type="{http://www.portalfiscal.inf.br/bpe}TCpf"/>
+ *                             </choice>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                   <element name="infAdic" minOccurs="0">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <element name="infAdFisco" minOccurs="0">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                   <maxLength value="2000"/>
+ *                                   <minLength value="1"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                             <element name="infCpl" minOccurs="0">
+ *                               <simpleType>
+ *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                                   <minLength value="1"/>
+ *                                   <maxLength value="5000"/>
+ *                                 </restriction>
+ *                               </simpleType>
+ *                             </element>
+ *                           </sequence>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                 </sequence>
+ *                 <attribute name="versao" use="required" type="{http://www.portalfiscal.inf.br/bpe}TVerBPe" />
+ *                 <attribute name="Id" use="required">
+ *                   <simpleType>
+ *                     <restriction base="{http://www.w3.org/2001/XMLSchema}ID">
+ *                       <pattern value="BPe[0-9]{44}"/>
+ *                     </restriction>
+ *                   </simpleType>
+ *                 </attribute>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element name="infBPeSupl">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="qrCodBPe">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <minLength value="50"/>
+ *                         <maxLength value="1000"/>
+ *                         <pattern value="((HTTPS?|https?)://.*\?chBPe=[0-9]{44}&tpAmb=[1-2](&sign=[!-ÿ]{1}[ -ÿ]{0,}[!-ÿ]{1}|[!-ÿ]{1})?)"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="boardPassBPe" minOccurs="0">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                         <minLength value="50"/>
+ *                         <maxLength value="1000"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element ref="{http://www.w3.org/2000/09/xmldsig#}Signature"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TBPe", propOrder = { + "infBPe", + "infBPeSupl" +// "signature" +}) +@XmlRootElement(name = "BPe") +public class TBPe { + + @XmlElement(required = true) + protected TBPe.InfBPe infBPe; + @XmlElement(required = true) + protected TBPe.InfBPeSupl infBPeSupl; +// @XmlElement(name = "Signature", namespace = "http://www.w3.org/2000/09/xmldsig#", required = true) +// protected SignatureType signature; + + /** + * Obtém o valor da propriedade infBPe. + * + * @return + * possible object is + * {@link TBPe.InfBPe } + * + */ + public TBPe.InfBPe getInfBPe() { + return infBPe; + } + + /** + * Define o valor da propriedade infBPe. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe } + * + */ + public void setInfBPe(TBPe.InfBPe value) { + this.infBPe = value; + } + + /** + * Obtém o valor da propriedade infBPeSupl. + * + * @return + * possible object is + * {@link TBPe.InfBPeSupl } + * + */ + public TBPe.InfBPeSupl getInfBPeSupl() { + return infBPeSupl; + } + + /** + * Define o valor da propriedade infBPeSupl. + * + * @param value + * allowed object is + * {@link TBPe.InfBPeSupl } + * + */ + public void setInfBPeSupl(TBPe.InfBPeSupl value) { + this.infBPeSupl = value; + } + + /** + * Obtém o valor da propriedade signature. + * + * @return + * possible object is + * {@link SignatureType } + * + */ +// public SignatureType getSignature() { +// return signature; +// } + + /** + * Define o valor da propriedade signature. + * + * @param value + * allowed object is + * {@link SignatureType } + * + */ +// public void setSignature(SignatureType value) { +// this.signature = value; +// } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="ide">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="cUF" type="{http://www.portalfiscal.inf.br/bpe}TCodUfIBGE"/>
+     *                   <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+     *                   <element name="mod" type="{http://www.portalfiscal.inf.br/bpe}TModBPe"/>
+     *                   <element name="serie">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TSerie">
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="nBP" type="{http://www.portalfiscal.inf.br/bpe}TNF"/>
+     *                   <element name="cBP">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <pattern value="[0-9]{8}"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="cDV">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <pattern value="[0-9]{1}"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="modal">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TModal">
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="dhEmi" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+     *                   <element name="tpEmis">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <enumeration value="1"/>
+     *                         <enumeration value="2"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="verProc">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                         <minLength value="1"/>
+     *                         <maxLength value="20"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="tpBPe">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TTipoBPe">
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="indPres" type="{http://www.portalfiscal.inf.br/bpe}TIndPres"/>
+     *                   <element name="UFIni" type="{http://www.portalfiscal.inf.br/bpe}TUf_sem_EX"/>
+     *                   <element name="cMunIni" type="{http://www.portalfiscal.inf.br/bpe}TCodMunIBGE"/>
+     *                   <element name="UFFim" type="{http://www.portalfiscal.inf.br/bpe}TUf"/>
+     *                   <element name="cMunFim" type="{http://www.portalfiscal.inf.br/bpe}TCodMunIBGE"/>
+     *                   <sequence minOccurs="0">
+     *                     <element name="dhCont" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+     *                     <element name="xJust">
+     *                       <simpleType>
+     *                         <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                           <minLength value="15"/>
+     *                           <maxLength value="256"/>
+     *                         </restriction>
+     *                       </simpleType>
+     *                     </element>
+     *                   </sequence>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *         <element name="emit">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj"/>
+     *                   <element name="IE">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TIe">
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="IEST" minOccurs="0">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TIe">
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="xNome">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                         <maxLength value="60"/>
+     *                         <minLength value="2"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="xFant" minOccurs="0">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                         <maxLength value="60"/>
+     *                         <minLength value="1"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <sequence minOccurs="0">
+     *                     <element name="IM">
+     *                       <simpleType>
+     *                         <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                           <minLength value="1"/>
+     *                           <maxLength value="15"/>
+     *                         </restriction>
+     *                       </simpleType>
+     *                     </element>
+     *                     <element name="CNAE">
+     *                       <simpleType>
+     *                         <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                           <whiteSpace value="preserve"/>
+     *                           <pattern value="[0-9]{7}"/>
+     *                         </restriction>
+     *                       </simpleType>
+     *                     </element>
+     *                   </sequence>
+     *                   <element name="CRT">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <enumeration value="1"/>
+     *                         <enumeration value="2"/>
+     *                         <enumeration value="3"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="enderEmit" type="{http://www.portalfiscal.inf.br/bpe}TEndeEmi"/>
+     *                   <element name="TAR" minOccurs="0">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <minLength value="1"/>
+     *                         <maxLength value="20"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *         <element name="comp" minOccurs="0">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="xNome">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                         <maxLength value="60"/>
+     *                         <minLength value="2"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <choice>
+     *                     <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpjOpc"/>
+     *                     <element name="CPF" type="{http://www.portalfiscal.inf.br/bpe}TCpf"/>
+     *                     <element name="idEstrangeiro">
+     *                       <simpleType>
+     *                         <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                           <whiteSpace value="preserve"/>
+     *                           <pattern value="([!-ÿ]{0}|[!-ÿ]{5,20})?"/>
+     *                         </restriction>
+     *                       </simpleType>
+     *                     </element>
+     *                   </choice>
+     *                   <element name="IE" minOccurs="0">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TIeDest">
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="enderComp" type="{http://www.portalfiscal.inf.br/bpe}TEndereco"/>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *         <element name="agencia" minOccurs="0">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="xNome">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                         <maxLength value="60"/>
+     *                         <minLength value="2"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpjOpc"/>
+     *                   <element name="enderAgencia" type="{http://www.portalfiscal.inf.br/bpe}TEndereco"/>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *         <element name="infBPeSub" minOccurs="0">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe"/>
+     *                   <element name="tpSub" type="{http://www.portalfiscal.inf.br/bpe}TTipoSubstituicao"/>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *         <element name="infPassagem">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="cLocOrig">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <minLength value="1"/>
+     *                         <maxLength value="7"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="xLocOrig">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                         <maxLength value="60"/>
+     *                         <minLength value="2"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="cLocDest">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <minLength value="1"/>
+     *                         <maxLength value="7"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="xLocDest">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                         <maxLength value="60"/>
+     *                         <minLength value="2"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="dhEmb" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+     *                   <element name="infPassageiro" minOccurs="0">
+     *                     <complexType>
+     *                       <complexContent>
+     *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                           <sequence>
+     *                             <element name="xNome">
+     *                               <simpleType>
+     *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                                   <maxLength value="60"/>
+     *                                   <minLength value="2"/>
+     *                                 </restriction>
+     *                               </simpleType>
+     *                             </element>
+     *                             <element name="CPF" type="{http://www.portalfiscal.inf.br/bpe}TCpf" minOccurs="0"/>
+     *                             <element name="tpDoc" type="{http://www.portalfiscal.inf.br/bpe}TDoc"/>
+     *                             <element name="nDoc">
+     *                               <simpleType>
+     *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                                   <minLength value="2"/>
+     *                                   <maxLength value="20"/>
+     *                                 </restriction>
+     *                               </simpleType>
+     *                             </element>
+     *                             <element name="dNasc" minOccurs="0">
+     *                               <simpleType>
+     *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TData">
+     *                                 </restriction>
+     *                               </simpleType>
+     *                             </element>
+     *                             <element name="fone" minOccurs="0">
+     *                               <simpleType>
+     *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                                   <whiteSpace value="preserve"/>
+     *                                   <pattern value="[0-9]{7,12}"/>
+     *                                 </restriction>
+     *                               </simpleType>
+     *                             </element>
+     *                             <element name="email" type="{http://www.portalfiscal.inf.br/bpe}TEmail" minOccurs="0"/>
+     *                           </sequence>
+     *                         </restriction>
+     *                       </complexContent>
+     *                     </complexType>
+     *                   </element>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *         <element name="infViagem" maxOccurs="unbounded">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="cPercurso">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <minLength value="1"/>
+     *                         <maxLength value="20"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="xPercurso">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                         <maxLength value="100"/>
+     *                         <minLength value="2"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="tpViagem">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <enumeration value="00"/>
+     *                         <enumeration value="01"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="tpServ">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <enumeration value="1"/>
+     *                         <enumeration value="2"/>
+     *                         <enumeration value="3"/>
+     *                         <enumeration value="4"/>
+     *                         <enumeration value="5"/>
+     *                         <enumeration value="6"/>
+     *                         <enumeration value="7"/>
+     *                         <enumeration value="8"/>
+     *                         <enumeration value="9"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="tpAcomodacao">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <enumeration value="1"/>
+     *                         <enumeration value="2"/>
+     *                         <enumeration value="3"/>
+     *                         <enumeration value="4"/>
+     *                         <enumeration value="5"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="tpTrecho">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <enumeration value="1"/>
+     *                         <enumeration value="2"/>
+     *                         <enumeration value="3"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="dhViagem" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+     *                   <element name="dhConexao" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC" minOccurs="0"/>
+     *                   <element name="prefixo" minOccurs="0">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <minLength value="1"/>
+     *                         <maxLength value="20"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="poltrona" minOccurs="0">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <minLength value="1"/>
+     *                         <maxLength value="3"/>
+     *                         <pattern value="0|[1-9]{1}[0-9]{0,2}"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="plataforma" minOccurs="0">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                         <maxLength value="10"/>
+     *                         <minLength value="2"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="infTravessia" minOccurs="0">
+     *                     <complexType>
+     *                       <complexContent>
+     *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                           <sequence>
+     *                             <element name="tpVeiculo">
+     *                               <simpleType>
+     *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                                   <whiteSpace value="preserve"/>
+     *                                   <enumeration value="01"/>
+     *                                   <enumeration value="02"/>
+     *                                   <enumeration value="03"/>
+     *                                   <enumeration value="04"/>
+     *                                   <enumeration value="05"/>
+     *                                   <enumeration value="06"/>
+     *                                   <enumeration value="07"/>
+     *                                   <enumeration value="08"/>
+     *                                   <enumeration value="09"/>
+     *                                   <enumeration value="10"/>
+     *                                   <enumeration value="11"/>
+     *                                   <enumeration value="12"/>
+     *                                   <enumeration value="13"/>
+     *                                   <enumeration value="14"/>
+     *                                   <enumeration value="15"/>
+     *                                   <enumeration value="16"/>
+     *                                   <enumeration value="17"/>
+     *                                   <enumeration value="18"/>
+     *                                   <enumeration value="19"/>
+     *                                   <enumeration value="20"/>
+     *                                   <enumeration value="21"/>
+     *                                   <enumeration value="22"/>
+     *                                   <enumeration value="23"/>
+     *                                   <enumeration value="24"/>
+     *                                   <enumeration value="25"/>
+     *                                   <enumeration value="26"/>
+     *                                   <enumeration value="27"/>
+     *                                   <enumeration value="28"/>
+     *                                   <enumeration value="29"/>
+     *                                   <enumeration value="99"/>
+     *                                 </restriction>
+     *                               </simpleType>
+     *                             </element>
+     *                             <element name="sitVeiculo">
+     *                               <simpleType>
+     *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                                   <whiteSpace value="preserve"/>
+     *                                   <enumeration value="1"/>
+     *                                   <enumeration value="2"/>
+     *                                   <enumeration value="3"/>
+     *                                 </restriction>
+     *                               </simpleType>
+     *                             </element>
+     *                           </sequence>
+     *                         </restriction>
+     *                       </complexContent>
+     *                     </complexType>
+     *                   </element>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *         <element name="infValorBPe">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="vBP" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *                   <element name="vDesconto" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *                   <element name="vPgto" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *                   <element name="vTroco" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *                   <element name="tpDesconto" minOccurs="0">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <enumeration value="01"/>
+     *                         <enumeration value="02"/>
+     *                         <enumeration value="03"/>
+     *                         <enumeration value="04"/>
+     *                         <enumeration value="05"/>
+     *                         <enumeration value="06"/>
+     *                         <enumeration value="07"/>
+     *                         <enumeration value="08"/>
+     *                         <enumeration value="09"/>
+     *                         <enumeration value="10"/>
+     *                         <enumeration value="99"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="xDesconto" minOccurs="0">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                         <maxLength value="100"/>
+     *                         <minLength value="2"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="Comp" maxOccurs="unbounded">
+     *                     <complexType>
+     *                       <complexContent>
+     *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                           <sequence>
+     *                             <element name="tpComp">
+     *                               <simpleType>
+     *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                                   <whiteSpace value="preserve"/>
+     *                                   <enumeration value="01"/>
+     *                                   <enumeration value="02"/>
+     *                                   <enumeration value="03"/>
+     *                                   <enumeration value="04"/>
+     *                                   <enumeration value="05"/>
+     *                                   <enumeration value="06"/>
+     *                                   <enumeration value="99"/>
+     *                                 </restriction>
+     *                               </simpleType>
+     *                             </element>
+     *                             <element name="vComp" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *                           </sequence>
+     *                         </restriction>
+     *                       </complexContent>
+     *                     </complexType>
+     *                   </element>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *         <element name="imp">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="ICMS" type="{http://www.portalfiscal.inf.br/bpe}TImp"/>
+     *                   <element name="vTotTrib" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302" minOccurs="0"/>
+     *                   <element name="infAdFisco" minOccurs="0">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                         <maxLength value="2000"/>
+     *                         <minLength value="1"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="ICMSUFFim" minOccurs="0">
+     *                     <complexType>
+     *                       <complexContent>
+     *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                           <sequence>
+     *                             <element name="vBCUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *                             <element name="pFCPUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+     *                             <element name="pICMSUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+     *                             <element name="pICMSInter" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+     *                             <element name="pICMSInterPart" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+     *                             <element name="vFCPUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *                             <element name="vICMSUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *                             <element name="vICMSUFIni" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *                           </sequence>
+     *                         </restriction>
+     *                       </complexContent>
+     *                     </complexType>
+     *                   </element>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *         <element name="pag" maxOccurs="10">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="tPag">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                         <whiteSpace value="preserve"/>
+     *                         <enumeration value="01"/>
+     *                         <enumeration value="02"/>
+     *                         <enumeration value="03"/>
+     *                         <enumeration value="04"/>
+     *                         <enumeration value="05"/>
+     *                         <enumeration value="99"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="vPag" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *                   <element name="card" minOccurs="0">
+     *                     <complexType>
+     *                       <complexContent>
+     *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                           <sequence>
+     *                             <element name="tpIntegra">
+     *                               <simpleType>
+     *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                                   <whiteSpace value="preserve"/>
+     *                                   <enumeration value="1"/>
+     *                                   <enumeration value="2"/>
+     *                                 </restriction>
+     *                               </simpleType>
+     *                             </element>
+     *                             <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj" minOccurs="0"/>
+     *                             <element name="tBand" minOccurs="0">
+     *                               <simpleType>
+     *                                 <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                                   <whiteSpace value="preserve"/>
+     *                                   <enumeration value="01"/>
+     *                                   <enumeration value="02"/>
+     *                                   <enumeration value="03"/>
+     *                                   <enumeration value="04"/>
+     *                                   <enumeration value="05"/>
+     *                                   <enumeration value="99"/>
+     *                                 </restriction>
+     *                               </simpleType>
+     *                             </element>
+     *                             <element name="cAut" minOccurs="0">
+     *                               <simpleType>
+     *                                 <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                                   <minLength value="1"/>
+     *                                   <maxLength value="20"/>
+     *                                 </restriction>
+     *                               </simpleType>
+     *                             </element>
+     *                           </sequence>
+     *                         </restriction>
+     *                       </complexContent>
+     *                     </complexType>
+     *                   </element>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *         <element name="autXML" maxOccurs="10" minOccurs="0">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <choice>
+     *                     <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj"/>
+     *                     <element name="CPF" type="{http://www.portalfiscal.inf.br/bpe}TCpf"/>
+     *                   </choice>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *         <element name="infAdic" minOccurs="0">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <element name="infAdFisco" minOccurs="0">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                         <maxLength value="2000"/>
+     *                         <minLength value="1"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                   <element name="infCpl" minOccurs="0">
+     *                     <simpleType>
+     *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *                         <minLength value="1"/>
+     *                         <maxLength value="5000"/>
+     *                       </restriction>
+     *                     </simpleType>
+     *                   </element>
+     *                 </sequence>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *       </sequence>
+     *       <attribute name="versao" use="required" type="{http://www.portalfiscal.inf.br/bpe}TVerBPe" />
+     *       <attribute name="Id" use="required">
+     *         <simpleType>
+     *           <restriction base="{http://www.w3.org/2001/XMLSchema}ID">
+     *             <pattern value="BPe[0-9]{44}"/>
+     *           </restriction>
+     *         </simpleType>
+     *       </attribute>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "ide", + "emit", + "comp", + "agencia", + "infBPeSub", + "infPassagem", + "infViagem", + "infValorBPe", + "imp", + "pag", + "autXML", + "infAdic" + }) + public static class InfBPe { + + @XmlElement(required = true) + protected TBPe.InfBPe.Ide ide; + @XmlElement(required = true) + protected TBPe.InfBPe.Emit emit; + protected TBPe.InfBPe.Comp comp; + protected TBPe.InfBPe.Agencia agencia; + protected TBPe.InfBPe.InfBPeSub infBPeSub; + @XmlElement(required = true) + protected TBPe.InfBPe.InfPassagem infPassagem; + @XmlElement(required = true) + protected List infViagem; + @XmlElement(required = true) + protected TBPe.InfBPe.InfValorBPe infValorBPe; + @XmlElement(required = true) + protected TBPe.InfBPe.Imp imp; + @XmlElement(required = true) + protected List pag; + protected List autXML; + protected TBPe.InfBPe.InfAdic infAdic; + @XmlAttribute(name = "versao", required = true) + protected String versao; + @XmlAttribute(name = "Id", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlID + protected String id; + + /** + * Obtém o valor da propriedade ide. + * + * @return + * possible object is + * {@link TBPe.InfBPe.Ide } + * + */ + public TBPe.InfBPe.Ide getIde() { + return ide; + } + + /** + * Define o valor da propriedade ide. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe.Ide } + * + */ + public void setIde(TBPe.InfBPe.Ide value) { + this.ide = value; + } + + /** + * Obtém o valor da propriedade emit. + * + * @return + * possible object is + * {@link TBPe.InfBPe.Emit } + * + */ + public TBPe.InfBPe.Emit getEmit() { + return emit; + } + + /** + * Define o valor da propriedade emit. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe.Emit } + * + */ + public void setEmit(TBPe.InfBPe.Emit value) { + this.emit = value; + } + + /** + * Obtém o valor da propriedade comp. + * + * @return + * possible object is + * {@link TBPe.InfBPe.Comp } + * + */ + public TBPe.InfBPe.Comp getComp() { + return comp; + } + + /** + * Define o valor da propriedade comp. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe.Comp } + * + */ + public void setComp(TBPe.InfBPe.Comp value) { + this.comp = value; + } + + /** + * Obtém o valor da propriedade agencia. + * + * @return + * possible object is + * {@link TBPe.InfBPe.Agencia } + * + */ + public TBPe.InfBPe.Agencia getAgencia() { + return agencia; + } + + /** + * Define o valor da propriedade agencia. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe.Agencia } + * + */ + public void setAgencia(TBPe.InfBPe.Agencia value) { + this.agencia = value; + } + + /** + * Obtém o valor da propriedade infBPeSub. + * + * @return + * possible object is + * {@link TBPe.InfBPe.InfBPeSub } + * + */ + public TBPe.InfBPe.InfBPeSub getInfBPeSub() { + return infBPeSub; + } + + /** + * Define o valor da propriedade infBPeSub. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe.InfBPeSub } + * + */ + public void setInfBPeSub(TBPe.InfBPe.InfBPeSub value) { + this.infBPeSub = value; + } + + /** + * Obtém o valor da propriedade infPassagem. + * + * @return + * possible object is + * {@link TBPe.InfBPe.InfPassagem } + * + */ + public TBPe.InfBPe.InfPassagem getInfPassagem() { + return infPassagem; + } + + /** + * Define o valor da propriedade infPassagem. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe.InfPassagem } + * + */ + public void setInfPassagem(TBPe.InfBPe.InfPassagem value) { + this.infPassagem = value; + } + + /** + * Gets the value of the infViagem property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the infViagem property. + * + *

+ * For example, to add a new item, do as follows: + *

+         *    getInfViagem().add(newItem);
+         * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link TBPe.InfBPe.InfViagem } + * + * + */ + public List getInfViagem() { + if (infViagem == null) { + infViagem = new ArrayList(); + } + return this.infViagem; + } + + /** + * Obtém o valor da propriedade infValorBPe. + * + * @return + * possible object is + * {@link TBPe.InfBPe.InfValorBPe } + * + */ + public TBPe.InfBPe.InfValorBPe getInfValorBPe() { + return infValorBPe; + } + + /** + * Define o valor da propriedade infValorBPe. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe.InfValorBPe } + * + */ + public void setInfValorBPe(TBPe.InfBPe.InfValorBPe value) { + this.infValorBPe = value; + } + + /** + * Obtém o valor da propriedade imp. + * + * @return + * possible object is + * {@link TBPe.InfBPe.Imp } + * + */ + public TBPe.InfBPe.Imp getImp() { + return imp; + } + + /** + * Define o valor da propriedade imp. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe.Imp } + * + */ + public void setImp(TBPe.InfBPe.Imp value) { + this.imp = value; + } + + /** + * Gets the value of the pag property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the pag property. + * + *

+ * For example, to add a new item, do as follows: + *

+         *    getPag().add(newItem);
+         * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link TBPe.InfBPe.Pag } + * + * + */ + public List getPag() { + if (pag == null) { + pag = new ArrayList(); + } + return this.pag; + } + + /** + * Gets the value of the autXML property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the autXML property. + * + *

+ * For example, to add a new item, do as follows: + *

+         *    getAutXML().add(newItem);
+         * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link TBPe.InfBPe.AutXML } + * + * + */ + public List getAutXML() { + if (autXML == null) { + autXML = new ArrayList(); + } + return this.autXML; + } + + /** + * Obtém o valor da propriedade infAdic. + * + * @return + * possible object is + * {@link TBPe.InfBPe.InfAdic } + * + */ + public TBPe.InfBPe.InfAdic getInfAdic() { + return infAdic; + } + + /** + * Define o valor da propriedade infAdic. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe.InfAdic } + * + */ + public void setInfAdic(TBPe.InfBPe.InfAdic value) { + this.infAdic = value; + } + + /** + * Obtém o valor da propriedade versao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersao() { + return versao; + } + + /** + * Define o valor da propriedade versao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersao(String value) { + this.versao = value; + } + + /** + * Obtém o valor da propriedade id. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Define o valor da propriedade id. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="xNome">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *               <maxLength value="60"/>
+         *               <minLength value="2"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpjOpc"/>
+         *         <element name="enderAgencia" type="{http://www.portalfiscal.inf.br/bpe}TEndereco"/>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "xNome", + "cnpj", + "enderAgencia" + }) + public static class Agencia { + + @XmlElement(required = true) + protected String xNome; + @XmlElement(name = "CNPJ", required = true) + protected String cnpj; + @XmlElement(required = true) + protected TEndereco enderAgencia; + + /** + * Obtém o valor da propriedade xNome. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXNome() { + return xNome; + } + + /** + * Define o valor da propriedade xNome. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXNome(String value) { + this.xNome = value; + } + + /** + * Obtém o valor da propriedade cnpj. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCNPJ() { + return cnpj; + } + + /** + * Define o valor da propriedade cnpj. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCNPJ(String value) { + this.cnpj = value; + } + + /** + * Obtém o valor da propriedade enderAgencia. + * + * @return + * possible object is + * {@link TEndereco } + * + */ + public TEndereco getEnderAgencia() { + return enderAgencia; + } + + /** + * Define o valor da propriedade enderAgencia. + * + * @param value + * allowed object is + * {@link TEndereco } + * + */ + public void setEnderAgencia(TEndereco value) { + this.enderAgencia = value; + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <choice>
+         *           <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj"/>
+         *           <element name="CPF" type="{http://www.portalfiscal.inf.br/bpe}TCpf"/>
+         *         </choice>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "cnpj", + "cpf" + }) + public static class AutXML { + + @XmlElement(name = "CNPJ") + protected String cnpj; + @XmlElement(name = "CPF") + protected String cpf; + + /** + * Obtém o valor da propriedade cnpj. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCNPJ() { + return cnpj; + } + + /** + * Define o valor da propriedade cnpj. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCNPJ(String value) { + this.cnpj = value; + } + + /** + * Obtém o valor da propriedade cpf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCPF() { + return cpf; + } + + /** + * Define o valor da propriedade cpf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCPF(String value) { + this.cpf = value; + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="xNome">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *               <maxLength value="60"/>
+         *               <minLength value="2"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <choice>
+         *           <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpjOpc"/>
+         *           <element name="CPF" type="{http://www.portalfiscal.inf.br/bpe}TCpf"/>
+         *           <element name="idEstrangeiro">
+         *             <simpleType>
+         *               <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *                 <whiteSpace value="preserve"/>
+         *                 <pattern value="([!-ÿ]{0}|[!-ÿ]{5,20})?"/>
+         *               </restriction>
+         *             </simpleType>
+         *           </element>
+         *         </choice>
+         *         <element name="IE" minOccurs="0">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TIeDest">
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="enderComp" type="{http://www.portalfiscal.inf.br/bpe}TEndereco"/>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "xNome", + "cnpj", + "cpf", + "idEstrangeiro", + "ie", + "enderComp" + }) + public static class Comp { + + @XmlElement(required = true) + protected String xNome; + @XmlElement(name = "CNPJ") + protected String cnpj; + @XmlElement(name = "CPF") + protected String cpf; + protected String idEstrangeiro; + @XmlElement(name = "IE") + protected String ie; + @XmlElement(required = true) + protected TEndereco enderComp; + + /** + * Obtém o valor da propriedade xNome. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXNome() { + return xNome; + } + + /** + * Define o valor da propriedade xNome. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXNome(String value) { + this.xNome = value; + } + + /** + * Obtém o valor da propriedade cnpj. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCNPJ() { + return cnpj; + } + + /** + * Define o valor da propriedade cnpj. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCNPJ(String value) { + this.cnpj = value; + } + + /** + * Obtém o valor da propriedade cpf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCPF() { + return cpf; + } + + /** + * Define o valor da propriedade cpf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCPF(String value) { + this.cpf = value; + } + + /** + * Obtém o valor da propriedade idEstrangeiro. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIdEstrangeiro() { + return idEstrangeiro; + } + + /** + * Define o valor da propriedade idEstrangeiro. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIdEstrangeiro(String value) { + this.idEstrangeiro = value; + } + + /** + * Obtém o valor da propriedade ie. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIE() { + return ie; + } + + /** + * Define o valor da propriedade ie. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIE(String value) { + this.ie = value; + } + + /** + * Obtém o valor da propriedade enderComp. + * + * @return + * possible object is + * {@link TEndereco } + * + */ + public TEndereco getEnderComp() { + return enderComp; + } + + /** + * Define o valor da propriedade enderComp. + * + * @param value + * allowed object is + * {@link TEndereco } + * + */ + public void setEnderComp(TEndereco value) { + this.enderComp = value; + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj"/>
+         *         <element name="IE">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TIe">
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="IEST" minOccurs="0">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TIe">
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="xNome">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *               <maxLength value="60"/>
+         *               <minLength value="2"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="xFant" minOccurs="0">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *               <maxLength value="60"/>
+         *               <minLength value="1"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <sequence minOccurs="0">
+         *           <element name="IM">
+         *             <simpleType>
+         *               <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *                 <minLength value="1"/>
+         *                 <maxLength value="15"/>
+         *               </restriction>
+         *             </simpleType>
+         *           </element>
+         *           <element name="CNAE">
+         *             <simpleType>
+         *               <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *                 <whiteSpace value="preserve"/>
+         *                 <pattern value="[0-9]{7}"/>
+         *               </restriction>
+         *             </simpleType>
+         *           </element>
+         *         </sequence>
+         *         <element name="CRT">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <enumeration value="1"/>
+         *               <enumeration value="2"/>
+         *               <enumeration value="3"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="enderEmit" type="{http://www.portalfiscal.inf.br/bpe}TEndeEmi"/>
+         *         <element name="TAR" minOccurs="0">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <minLength value="1"/>
+         *               <maxLength value="20"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "cnpj", + "ie", + "iest", + "xNome", + "xFant", + "im", + "cnae", + "crt", + "enderEmit", + "tar" + }) + public static class Emit { + + @XmlElement(name = "CNPJ", required = true) + protected String cnpj; + @XmlElement(name = "IE", required = true) + protected String ie; + @XmlElement(name = "IEST") + protected String iest; + @XmlElement(required = true) + protected String xNome; + protected String xFant; + @XmlElement(name = "IM") + protected String im; + @XmlElement(name = "CNAE") + protected String cnae; + @XmlElement(name = "CRT", required = true) + protected String crt; + @XmlElement(required = true) + protected TEndeEmi enderEmit; + @XmlElement(name = "TAR") + protected String tar; + + /** + * Obtém o valor da propriedade cnpj. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCNPJ() { + return cnpj; + } + + /** + * Define o valor da propriedade cnpj. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCNPJ(String value) { + this.cnpj = value; + } + + /** + * Obtém o valor da propriedade ie. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIE() { + return ie; + } + + /** + * Define o valor da propriedade ie. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIE(String value) { + this.ie = value; + } + + /** + * Obtém o valor da propriedade iest. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIEST() { + return iest; + } + + /** + * Define o valor da propriedade iest. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIEST(String value) { + this.iest = value; + } + + /** + * Obtém o valor da propriedade xNome. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXNome() { + return xNome; + } + + /** + * Define o valor da propriedade xNome. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXNome(String value) { + this.xNome = value; + } + + /** + * Obtém o valor da propriedade xFant. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXFant() { + return xFant; + } + + /** + * Define o valor da propriedade xFant. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXFant(String value) { + this.xFant = value; + } + + /** + * Obtém o valor da propriedade im. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIM() { + return im; + } + + /** + * Define o valor da propriedade im. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIM(String value) { + this.im = value; + } + + /** + * Obtém o valor da propriedade cnae. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCNAE() { + return cnae; + } + + /** + * Define o valor da propriedade cnae. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCNAE(String value) { + this.cnae = value; + } + + /** + * Obtém o valor da propriedade crt. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCRT() { + return crt; + } + + /** + * Define o valor da propriedade crt. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCRT(String value) { + this.crt = value; + } + + /** + * Obtém o valor da propriedade enderEmit. + * + * @return + * possible object is + * {@link TEndeEmi } + * + */ + public TEndeEmi getEnderEmit() { + return enderEmit; + } + + /** + * Define o valor da propriedade enderEmit. + * + * @param value + * allowed object is + * {@link TEndeEmi } + * + */ + public void setEnderEmit(TEndeEmi value) { + this.enderEmit = value; + } + + /** + * Obtém o valor da propriedade tar. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTAR() { + return tar; + } + + /** + * Define o valor da propriedade tar. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTAR(String value) { + this.tar = value; + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="cUF" type="{http://www.portalfiscal.inf.br/bpe}TCodUfIBGE"/>
+         *         <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+         *         <element name="mod" type="{http://www.portalfiscal.inf.br/bpe}TModBPe"/>
+         *         <element name="serie">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TSerie">
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="nBP" type="{http://www.portalfiscal.inf.br/bpe}TNF"/>
+         *         <element name="cBP">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <pattern value="[0-9]{8}"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="cDV">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <pattern value="[0-9]{1}"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="modal">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TModal">
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="dhEmi" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+         *         <element name="tpEmis">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <enumeration value="1"/>
+         *               <enumeration value="2"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="verProc">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *               <minLength value="1"/>
+         *               <maxLength value="20"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="tpBPe">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TTipoBPe">
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="indPres" type="{http://www.portalfiscal.inf.br/bpe}TIndPres"/>
+         *         <element name="UFIni" type="{http://www.portalfiscal.inf.br/bpe}TUf_sem_EX"/>
+         *         <element name="cMunIni" type="{http://www.portalfiscal.inf.br/bpe}TCodMunIBGE"/>
+         *         <element name="UFFim" type="{http://www.portalfiscal.inf.br/bpe}TUf"/>
+         *         <element name="cMunFim" type="{http://www.portalfiscal.inf.br/bpe}TCodMunIBGE"/>
+         *         <sequence minOccurs="0">
+         *           <element name="dhCont" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+         *           <element name="xJust">
+         *             <simpleType>
+         *               <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *                 <minLength value="15"/>
+         *                 <maxLength value="256"/>
+         *               </restriction>
+         *             </simpleType>
+         *           </element>
+         *         </sequence>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "cuf", + "tpAmb", + "mod", + "serie", + "nbp", + "cbp", + "cdv", + "modal", + "dhEmi", + "tpEmis", + "verProc", + "tpBPe", + "indPres", + "ufIni", + "cMunIni", + "ufFim", + "cMunFim", + "dhCont", + "xJust" + }) + public static class Ide { + + @XmlElement(name = "cUF", required = true) + protected String cuf; + @XmlElement(required = true) + protected String tpAmb; + @XmlElement(required = true) + protected String mod; + @XmlElement(required = true) + protected String serie; + @XmlElement(name = "nBP", required = true) + protected String nbp; + @XmlElement(name = "cBP", required = true) + protected String cbp; + @XmlElement(name = "cDV", required = true) + protected String cdv; + @XmlElement(required = true) + protected String modal; + @XmlElement(required = true) + protected String dhEmi; + @XmlElement(required = true) + protected String tpEmis; + @XmlElement(required = true) + protected String verProc; + @XmlElement(required = true) + protected String tpBPe; + @XmlElement(required = true) + protected String indPres; + @XmlElement(name = "UFIni", required = true) + @XmlSchemaType(name = "string") + protected TUfSemEX ufIni; + @XmlElement(required = true) + protected String cMunIni; + @XmlElement(name = "UFFim", required = true) + @XmlSchemaType(name = "string") + protected TUf ufFim; + @XmlElement(required = true) + protected String cMunFim; + protected String dhCont; + protected String xJust; + + /** + * Obtém o valor da propriedade cuf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCUF() { + return cuf; + } + + /** + * Define o valor da propriedade cuf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCUF(String value) { + this.cuf = value; + } + + /** + * Obtém o valor da propriedade tpAmb. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpAmb() { + return tpAmb; + } + + /** + * Define o valor da propriedade tpAmb. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpAmb(String value) { + this.tpAmb = value; + } + + /** + * Obtém o valor da propriedade mod. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMod() { + return mod; + } + + /** + * Define o valor da propriedade mod. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMod(String value) { + this.mod = value; + } + + /** + * Obtém o valor da propriedade serie. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSerie() { + return serie; + } + + /** + * Define o valor da propriedade serie. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSerie(String value) { + this.serie = value; + } + + /** + * Obtém o valor da propriedade nbp. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNBP() { + return nbp; + } + + /** + * Define o valor da propriedade nbp. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNBP(String value) { + this.nbp = value; + } + + /** + * Obtém o valor da propriedade cbp. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCBP() { + return cbp; + } + + /** + * Define o valor da propriedade cbp. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCBP(String value) { + this.cbp = value; + } + + /** + * Obtém o valor da propriedade cdv. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCDV() { + return cdv; + } + + /** + * Define o valor da propriedade cdv. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCDV(String value) { + this.cdv = value; + } + + /** + * Obtém o valor da propriedade modal. + * + * @return + * possible object is + * {@link String } + * + */ + public String getModal() { + return modal; + } + + /** + * Define o valor da propriedade modal. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setModal(String value) { + this.modal = value; + } + + /** + * Obtém o valor da propriedade dhEmi. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDhEmi() { + return dhEmi; + } + + /** + * Define o valor da propriedade dhEmi. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDhEmi(String value) { + this.dhEmi = value; + } + + /** + * Obtém o valor da propriedade tpEmis. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpEmis() { + return tpEmis; + } + + /** + * Define o valor da propriedade tpEmis. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpEmis(String value) { + this.tpEmis = value; + } + + /** + * Obtém o valor da propriedade verProc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVerProc() { + return verProc; + } + + /** + * Define o valor da propriedade verProc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVerProc(String value) { + this.verProc = value; + } + + /** + * Obtém o valor da propriedade tpBPe. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpBPe() { + return tpBPe; + } + + /** + * Define o valor da propriedade tpBPe. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpBPe(String value) { + this.tpBPe = value; + } + + /** + * Obtém o valor da propriedade indPres. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIndPres() { + return indPres; + } + + /** + * Define o valor da propriedade indPres. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIndPres(String value) { + this.indPres = value; + } + + /** + * Obtém o valor da propriedade ufIni. + * + * @return + * possible object is + * {@link TUfSemEX } + * + */ + public TUfSemEX getUFIni() { + return ufIni; + } + + /** + * Define o valor da propriedade ufIni. + * + * @param value + * allowed object is + * {@link TUfSemEX } + * + */ + public void setUFIni(TUfSemEX value) { + this.ufIni = value; + } + + /** + * Obtém o valor da propriedade cMunIni. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCMunIni() { + return cMunIni; + } + + /** + * Define o valor da propriedade cMunIni. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCMunIni(String value) { + this.cMunIni = value; + } + + /** + * Obtém o valor da propriedade ufFim. + * + * @return + * possible object is + * {@link TUf } + * + */ + public TUf getUFFim() { + return ufFim; + } + + /** + * Define o valor da propriedade ufFim. + * + * @param value + * allowed object is + * {@link TUf } + * + */ + public void setUFFim(TUf value) { + this.ufFim = value; + } + + /** + * Obtém o valor da propriedade cMunFim. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCMunFim() { + return cMunFim; + } + + /** + * Define o valor da propriedade cMunFim. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCMunFim(String value) { + this.cMunFim = value; + } + + /** + * Obtém o valor da propriedade dhCont. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDhCont() { + return dhCont; + } + + /** + * Define o valor da propriedade dhCont. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDhCont(String value) { + this.dhCont = value; + } + + /** + * Obtém o valor da propriedade xJust. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXJust() { + return xJust; + } + + /** + * Define o valor da propriedade xJust. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXJust(String value) { + this.xJust = value; + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="ICMS" type="{http://www.portalfiscal.inf.br/bpe}TImp"/>
+         *         <element name="vTotTrib" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302" minOccurs="0"/>
+         *         <element name="infAdFisco" minOccurs="0">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *               <maxLength value="2000"/>
+         *               <minLength value="1"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="ICMSUFFim" minOccurs="0">
+         *           <complexType>
+         *             <complexContent>
+         *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *                 <sequence>
+         *                   <element name="vBCUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+         *                   <element name="pFCPUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+         *                   <element name="pICMSUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+         *                   <element name="pICMSInter" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+         *                   <element name="pICMSInterPart" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+         *                   <element name="vFCPUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+         *                   <element name="vICMSUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+         *                   <element name="vICMSUFIni" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+         *                 </sequence>
+         *               </restriction>
+         *             </complexContent>
+         *           </complexType>
+         *         </element>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "icms", + "vTotTrib", + "infAdFisco", + "icmsufFim" + }) + public static class Imp { + + @XmlElement(name = "ICMS", required = true) + protected TImp icms; + protected String vTotTrib; + protected String infAdFisco; + @XmlElement(name = "ICMSUFFim") + protected TBPe.InfBPe.Imp.ICMSUFFim icmsufFim; + + /** + * Obtém o valor da propriedade icms. + * + * @return + * possible object is + * {@link TImp } + * + */ + public TImp getICMS() { + return icms; + } + + /** + * Define o valor da propriedade icms. + * + * @param value + * allowed object is + * {@link TImp } + * + */ + public void setICMS(TImp value) { + this.icms = value; + } + + /** + * Obtém o valor da propriedade vTotTrib. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVTotTrib() { + return vTotTrib; + } + + /** + * Define o valor da propriedade vTotTrib. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVTotTrib(String value) { + this.vTotTrib = value; + } + + /** + * Obtém o valor da propriedade infAdFisco. + * + * @return + * possible object is + * {@link String } + * + */ + public String getInfAdFisco() { + return infAdFisco; + } + + /** + * Define o valor da propriedade infAdFisco. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setInfAdFisco(String value) { + this.infAdFisco = value; + } + + /** + * Obtém o valor da propriedade icmsufFim. + * + * @return + * possible object is + * {@link TBPe.InfBPe.Imp.ICMSUFFim } + * + */ + public TBPe.InfBPe.Imp.ICMSUFFim getICMSUFFim() { + return icmsufFim; + } + + /** + * Define o valor da propriedade icmsufFim. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe.Imp.ICMSUFFim } + * + */ + public void setICMSUFFim(TBPe.InfBPe.Imp.ICMSUFFim value) { + this.icmsufFim = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+             * <complexType>
+             *   <complexContent>
+             *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+             *       <sequence>
+             *         <element name="vBCUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+             *         <element name="pFCPUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+             *         <element name="pICMSUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+             *         <element name="pICMSInter" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+             *         <element name="pICMSInterPart" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+             *         <element name="vFCPUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+             *         <element name="vICMSUFFim" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+             *         <element name="vICMSUFIni" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+             *       </sequence>
+             *     </restriction>
+             *   </complexContent>
+             * </complexType>
+             * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "vbcufFim", + "pfcpufFim", + "picmsufFim", + "picmsInter", + "picmsInterPart", + "vfcpufFim", + "vicmsufFim", + "vicmsufIni" + }) + public static class ICMSUFFim { + + @XmlElement(name = "vBCUFFim", required = true) + protected String vbcufFim; + @XmlElement(name = "pFCPUFFim", required = true) + protected String pfcpufFim; + @XmlElement(name = "pICMSUFFim", required = true) + protected String picmsufFim; + @XmlElement(name = "pICMSInter", required = true) + protected String picmsInter; + @XmlElement(name = "pICMSInterPart", required = true) + protected String picmsInterPart; + @XmlElement(name = "vFCPUFFim", required = true) + protected String vfcpufFim; + @XmlElement(name = "vICMSUFFim", required = true) + protected String vicmsufFim; + @XmlElement(name = "vICMSUFIni", required = true) + protected String vicmsufIni; + + /** + * Obtém o valor da propriedade vbcufFim. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVBCUFFim() { + return vbcufFim; + } + + /** + * Define o valor da propriedade vbcufFim. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVBCUFFim(String value) { + this.vbcufFim = value; + } + + /** + * Obtém o valor da propriedade pfcpufFim. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPFCPUFFim() { + return pfcpufFim; + } + + /** + * Define o valor da propriedade pfcpufFim. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPFCPUFFim(String value) { + this.pfcpufFim = value; + } + + /** + * Obtém o valor da propriedade picmsufFim. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPICMSUFFim() { + return picmsufFim; + } + + /** + * Define o valor da propriedade picmsufFim. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPICMSUFFim(String value) { + this.picmsufFim = value; + } + + /** + * Obtém o valor da propriedade picmsInter. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPICMSInter() { + return picmsInter; + } + + /** + * Define o valor da propriedade picmsInter. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPICMSInter(String value) { + this.picmsInter = value; + } + + /** + * Obtém o valor da propriedade picmsInterPart. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPICMSInterPart() { + return picmsInterPart; + } + + /** + * Define o valor da propriedade picmsInterPart. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPICMSInterPart(String value) { + this.picmsInterPart = value; + } + + /** + * Obtém o valor da propriedade vfcpufFim. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVFCPUFFim() { + return vfcpufFim; + } + + /** + * Define o valor da propriedade vfcpufFim. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVFCPUFFim(String value) { + this.vfcpufFim = value; + } + + /** + * Obtém o valor da propriedade vicmsufFim. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVICMSUFFim() { + return vicmsufFim; + } + + /** + * Define o valor da propriedade vicmsufFim. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVICMSUFFim(String value) { + this.vicmsufFim = value; + } + + /** + * Obtém o valor da propriedade vicmsufIni. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVICMSUFIni() { + return vicmsufIni; + } + + /** + * Define o valor da propriedade vicmsufIni. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVICMSUFIni(String value) { + this.vicmsufIni = value; + } + + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="infAdFisco" minOccurs="0">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *               <maxLength value="2000"/>
+         *               <minLength value="1"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="infCpl" minOccurs="0">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *               <minLength value="1"/>
+         *               <maxLength value="5000"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "infAdFisco", + "infCpl" + }) + public static class InfAdic { + + protected String infAdFisco; + protected String infCpl; + + /** + * Obtém o valor da propriedade infAdFisco. + * + * @return + * possible object is + * {@link String } + * + */ + public String getInfAdFisco() { + return infAdFisco; + } + + /** + * Define o valor da propriedade infAdFisco. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setInfAdFisco(String value) { + this.infAdFisco = value; + } + + /** + * Obtém o valor da propriedade infCpl. + * + * @return + * possible object is + * {@link String } + * + */ + public String getInfCpl() { + return infCpl; + } + + /** + * Define o valor da propriedade infCpl. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setInfCpl(String value) { + this.infCpl = value; + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe"/>
+         *         <element name="tpSub" type="{http://www.portalfiscal.inf.br/bpe}TTipoSubstituicao"/>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "chBPe", + "tpSub" + }) + public static class InfBPeSub { + + @XmlElement(required = true) + protected String chBPe; + @XmlElement(required = true) + protected String tpSub; + + /** + * Obtém o valor da propriedade chBPe. + * + * @return + * possible object is + * {@link String } + * + */ + public String getChBPe() { + return chBPe; + } + + /** + * Define o valor da propriedade chBPe. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setChBPe(String value) { + this.chBPe = value; + } + + /** + * Obtém o valor da propriedade tpSub. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpSub() { + return tpSub; + } + + /** + * Define o valor da propriedade tpSub. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpSub(String value) { + this.tpSub = value; + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="cLocOrig">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <minLength value="1"/>
+         *               <maxLength value="7"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="xLocOrig">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *               <maxLength value="60"/>
+         *               <minLength value="2"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="cLocDest">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <minLength value="1"/>
+         *               <maxLength value="7"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="xLocDest">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *               <maxLength value="60"/>
+         *               <minLength value="2"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="dhEmb" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+         *         <element name="infPassageiro" minOccurs="0">
+         *           <complexType>
+         *             <complexContent>
+         *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *                 <sequence>
+         *                   <element name="xNome">
+         *                     <simpleType>
+         *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *                         <maxLength value="60"/>
+         *                         <minLength value="2"/>
+         *                       </restriction>
+         *                     </simpleType>
+         *                   </element>
+         *                   <element name="CPF" type="{http://www.portalfiscal.inf.br/bpe}TCpf" minOccurs="0"/>
+         *                   <element name="tpDoc" type="{http://www.portalfiscal.inf.br/bpe}TDoc"/>
+         *                   <element name="nDoc">
+         *                     <simpleType>
+         *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *                         <minLength value="2"/>
+         *                         <maxLength value="20"/>
+         *                       </restriction>
+         *                     </simpleType>
+         *                   </element>
+         *                   <element name="dNasc" minOccurs="0">
+         *                     <simpleType>
+         *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TData">
+         *                       </restriction>
+         *                     </simpleType>
+         *                   </element>
+         *                   <element name="fone" minOccurs="0">
+         *                     <simpleType>
+         *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *                         <whiteSpace value="preserve"/>
+         *                         <pattern value="[0-9]{7,12}"/>
+         *                       </restriction>
+         *                     </simpleType>
+         *                   </element>
+         *                   <element name="email" type="{http://www.portalfiscal.inf.br/bpe}TEmail" minOccurs="0"/>
+         *                 </sequence>
+         *               </restriction>
+         *             </complexContent>
+         *           </complexType>
+         *         </element>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "cLocOrig", + "xLocOrig", + "cLocDest", + "xLocDest", + "dhEmb", + "dhValidade", + "infPassageiro" + }) + public static class InfPassagem { + + @XmlElement(required = true) + protected String cLocOrig; + @XmlElement(required = true) + protected String xLocOrig; + @XmlElement(required = true) + protected String cLocDest; + @XmlElement(required = true) + protected String xLocDest; + @XmlElement(required = true) + protected String dhEmb; + protected String dhValidade; + protected TBPe.InfBPe.InfPassagem.InfPassageiro infPassageiro; + + /** + * Obtém o valor da propriedade cLocOrig. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCLocOrig() { + return cLocOrig; + } + + /** + * Define o valor da propriedade cLocOrig. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCLocOrig(String value) { + this.cLocOrig = value; + } + + /** + * Obtém o valor da propriedade xLocOrig. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXLocOrig() { + return xLocOrig; + } + + /** + * Define o valor da propriedade xLocOrig. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXLocOrig(String value) { + this.xLocOrig = value; + } + + /** + * Obtém o valor da propriedade cLocDest. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCLocDest() { + return cLocDest; + } + + /** + * Define o valor da propriedade cLocDest. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCLocDest(String value) { + this.cLocDest = value; + } + + /** + * Obtém o valor da propriedade xLocDest. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXLocDest() { + return xLocDest; + } + + /** + * Define o valor da propriedade xLocDest. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXLocDest(String value) { + this.xLocDest = value; + } + + /** + * Obtém o valor da propriedade dhEmb. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDhEmb() { + return dhEmb; + } + + /** + * Define o valor da propriedade dhEmb. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDhEmb(String value) { + this.dhEmb = value; + } + + /** + * Obtém o valor da propriedade dhValidade. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDhValidade() { + return dhValidade; + } + + /** + * Define o valor da propriedade dhValidade. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDhValidade(String value) { + this.dhValidade = value; + } + + /** + * Obtém o valor da propriedade infPassageiro. + * + * @return + * possible object is + * {@link TBPe.InfBPe.InfPassagem.InfPassageiro } + * + */ + public TBPe.InfBPe.InfPassagem.InfPassageiro getInfPassageiro() { + return infPassageiro; + } + + /** + * Define o valor da propriedade infPassageiro. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe.InfPassagem.InfPassageiro } + * + */ + public void setInfPassageiro(TBPe.InfBPe.InfPassagem.InfPassageiro value) { + this.infPassageiro = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+             * <complexType>
+             *   <complexContent>
+             *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+             *       <sequence>
+             *         <element name="xNome">
+             *           <simpleType>
+             *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+             *               <maxLength value="60"/>
+             *               <minLength value="2"/>
+             *             </restriction>
+             *           </simpleType>
+             *         </element>
+             *         <element name="CPF" type="{http://www.portalfiscal.inf.br/bpe}TCpf" minOccurs="0"/>
+             *         <element name="tpDoc" type="{http://www.portalfiscal.inf.br/bpe}TDoc"/>
+             *         <element name="nDoc">
+             *           <simpleType>
+             *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+             *               <minLength value="2"/>
+             *               <maxLength value="20"/>
+             *             </restriction>
+             *           </simpleType>
+             *         </element>
+             *         <element name="dNasc" minOccurs="0">
+             *           <simpleType>
+             *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TData">
+             *             </restriction>
+             *           </simpleType>
+             *         </element>
+             *         <element name="fone" minOccurs="0">
+             *           <simpleType>
+             *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+             *               <whiteSpace value="preserve"/>
+             *               <pattern value="[0-9]{7,12}"/>
+             *             </restriction>
+             *           </simpleType>
+             *         </element>
+             *         <element name="email" type="{http://www.portalfiscal.inf.br/bpe}TEmail" minOccurs="0"/>
+             *       </sequence>
+             *     </restriction>
+             *   </complexContent>
+             * </complexType>
+             * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "xNome", + "cpf", + "tpDoc", + "nDoc", + "dNasc", + "fone", + "email" + }) + public static class InfPassageiro { + + @XmlElement(required = true) + protected String xNome; + @XmlElement(name = "CPF") + protected String cpf; + @XmlElement(required = true) + protected String tpDoc; + @XmlElement(required = true) + protected String nDoc; + protected String dNasc; + protected String fone; + protected String email; + + /** + * Obtém o valor da propriedade xNome. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXNome() { + return xNome; + } + + /** + * Define o valor da propriedade xNome. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXNome(String value) { + this.xNome = value; + } + + /** + * Obtém o valor da propriedade cpf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCPF() { + return cpf; + } + + /** + * Define o valor da propriedade cpf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCPF(String value) { + this.cpf = value; + } + + /** + * Obtém o valor da propriedade tpDoc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpDoc() { + return tpDoc; + } + + /** + * Define o valor da propriedade tpDoc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpDoc(String value) { + this.tpDoc = value; + } + + /** + * Obtém o valor da propriedade nDoc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNDoc() { + return nDoc; + } + + /** + * Define o valor da propriedade nDoc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNDoc(String value) { + this.nDoc = value; + } + + /** + * Obtém o valor da propriedade dNasc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDNasc() { + return dNasc; + } + + /** + * Define o valor da propriedade dNasc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDNasc(String value) { + this.dNasc = value; + } + + /** + * Obtém o valor da propriedade fone. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFone() { + return fone; + } + + /** + * Define o valor da propriedade fone. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFone(String value) { + this.fone = value; + } + + /** + * Obtém o valor da propriedade email. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEmail() { + return email; + } + + /** + * Define o valor da propriedade email. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEmail(String value) { + this.email = value; + } + + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="vBP" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+         *         <element name="vDesconto" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+         *         <element name="vPgto" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+         *         <element name="vTroco" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+         *         <element name="tpDesconto" minOccurs="0">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <enumeration value="01"/>
+         *               <enumeration value="02"/>
+         *               <enumeration value="03"/>
+         *               <enumeration value="04"/>
+         *               <enumeration value="05"/>
+         *               <enumeration value="06"/>
+         *               <enumeration value="07"/>
+         *               <enumeration value="08"/>
+         *               <enumeration value="09"/>
+         *               <enumeration value="10"/>
+         *               <enumeration value="99"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="xDesconto" minOccurs="0">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *               <maxLength value="100"/>
+         *               <minLength value="2"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="Comp" maxOccurs="unbounded">
+         *           <complexType>
+         *             <complexContent>
+         *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *                 <sequence>
+         *                   <element name="tpComp">
+         *                     <simpleType>
+         *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *                         <whiteSpace value="preserve"/>
+         *                         <enumeration value="01"/>
+         *                         <enumeration value="02"/>
+         *                         <enumeration value="03"/>
+         *                         <enumeration value="04"/>
+         *                         <enumeration value="05"/>
+         *                         <enumeration value="06"/>
+         *                         <enumeration value="99"/>
+         *                       </restriction>
+         *                     </simpleType>
+         *                   </element>
+         *                   <element name="vComp" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+         *                 </sequence>
+         *               </restriction>
+         *             </complexContent>
+         *           </complexType>
+         *         </element>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "vbp", + "vDesconto", + "vPgto", + "vTroco", + "tpDesconto", + "xDesconto", + "comp" + }) + public static class InfValorBPe { + + @XmlElement(name = "vBP", required = true) + protected String vbp; + @XmlElement(required = true) + protected String vDesconto; + @XmlElement(required = true) + protected String vPgto; + @XmlElement(required = true) + protected String vTroco; + protected String tpDesconto; + protected String xDesconto; + @XmlElement(name = "Comp", required = true) + protected List comp; + + /** + * Obtém o valor da propriedade vbp. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVBP() { + return vbp; + } + + /** + * Define o valor da propriedade vbp. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVBP(String value) { + this.vbp = value; + } + + /** + * Obtém o valor da propriedade vDesconto. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVDesconto() { + return vDesconto; + } + + /** + * Define o valor da propriedade vDesconto. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVDesconto(String value) { + this.vDesconto = value; + } + + /** + * Obtém o valor da propriedade vPgto. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVPgto() { + return vPgto; + } + + /** + * Define o valor da propriedade vPgto. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVPgto(String value) { + this.vPgto = value; + } + + /** + * Obtém o valor da propriedade vTroco. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVTroco() { + return vTroco; + } + + /** + * Define o valor da propriedade vTroco. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVTroco(String value) { + this.vTroco = value; + } + + /** + * Obtém o valor da propriedade tpDesconto. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpDesconto() { + return tpDesconto; + } + + /** + * Define o valor da propriedade tpDesconto. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpDesconto(String value) { + this.tpDesconto = value; + } + + /** + * Obtém o valor da propriedade xDesconto. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXDesconto() { + return xDesconto; + } + + /** + * Define o valor da propriedade xDesconto. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXDesconto(String value) { + this.xDesconto = value; + } + + /** + * Gets the value of the comp property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the comp property. + * + *

+ * For example, to add a new item, do as follows: + *

+             *    getComp().add(newItem);
+             * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link TBPe.InfBPe.InfValorBPe.Comp } + * + * + */ + public List getComp() { + if (comp == null) { + comp = new ArrayList(); + } + return this.comp; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+             * <complexType>
+             *   <complexContent>
+             *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+             *       <sequence>
+             *         <element name="tpComp">
+             *           <simpleType>
+             *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+             *               <whiteSpace value="preserve"/>
+             *               <enumeration value="01"/>
+             *               <enumeration value="02"/>
+             *               <enumeration value="03"/>
+             *               <enumeration value="04"/>
+             *               <enumeration value="05"/>
+             *               <enumeration value="06"/>
+             *               <enumeration value="99"/>
+             *             </restriction>
+             *           </simpleType>
+             *         </element>
+             *         <element name="vComp" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+             *       </sequence>
+             *     </restriction>
+             *   </complexContent>
+             * </complexType>
+             * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "tpComp", + "vComp" + }) + public static class Comp { + + @XmlElement(required = true) + protected String tpComp; + @XmlElement(required = true) + protected String vComp; + + /** + * Obtém o valor da propriedade tpComp. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpComp() { + return tpComp; + } + + /** + * Define o valor da propriedade tpComp. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpComp(String value) { + this.tpComp = value; + } + + /** + * Obtém o valor da propriedade vComp. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVComp() { + return vComp; + } + + /** + * Define o valor da propriedade vComp. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVComp(String value) { + this.vComp = value; + } + + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="cPercurso">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <minLength value="1"/>
+         *               <maxLength value="20"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="xPercurso">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *               <maxLength value="100"/>
+         *               <minLength value="2"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="tpViagem">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <enumeration value="00"/>
+         *               <enumeration value="01"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="tpServ">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <enumeration value="1"/>
+         *               <enumeration value="2"/>
+         *               <enumeration value="3"/>
+         *               <enumeration value="4"/>
+         *               <enumeration value="5"/>
+         *               <enumeration value="6"/>
+         *               <enumeration value="7"/>
+         *               <enumeration value="8"/>
+         *               <enumeration value="9"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="tpAcomodacao">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <enumeration value="1"/>
+         *               <enumeration value="2"/>
+         *               <enumeration value="3"/>
+         *               <enumeration value="4"/>
+         *               <enumeration value="5"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="tpTrecho">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <enumeration value="1"/>
+         *               <enumeration value="2"/>
+         *               <enumeration value="3"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="dhViagem" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+         *         <element name="dhConexao" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC" minOccurs="0"/>
+         *         <element name="prefixo" minOccurs="0">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <minLength value="1"/>
+         *               <maxLength value="20"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="poltrona" minOccurs="0">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <minLength value="1"/>
+         *               <maxLength value="3"/>
+         *               <pattern value="0|[1-9]{1}[0-9]{0,2}"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="plataforma" minOccurs="0">
+         *           <simpleType>
+         *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *               <maxLength value="10"/>
+         *               <minLength value="2"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="infTravessia" minOccurs="0">
+         *           <complexType>
+         *             <complexContent>
+         *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *                 <sequence>
+         *                   <element name="tpVeiculo">
+         *                     <simpleType>
+         *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *                         <whiteSpace value="preserve"/>
+         *                         <enumeration value="01"/>
+         *                         <enumeration value="02"/>
+         *                         <enumeration value="03"/>
+         *                         <enumeration value="04"/>
+         *                         <enumeration value="05"/>
+         *                         <enumeration value="06"/>
+         *                         <enumeration value="07"/>
+         *                         <enumeration value="08"/>
+         *                         <enumeration value="09"/>
+         *                         <enumeration value="10"/>
+         *                         <enumeration value="11"/>
+         *                         <enumeration value="12"/>
+         *                         <enumeration value="13"/>
+         *                         <enumeration value="14"/>
+         *                         <enumeration value="15"/>
+         *                         <enumeration value="16"/>
+         *                         <enumeration value="17"/>
+         *                         <enumeration value="18"/>
+         *                         <enumeration value="19"/>
+         *                         <enumeration value="20"/>
+         *                         <enumeration value="21"/>
+         *                         <enumeration value="22"/>
+         *                         <enumeration value="23"/>
+         *                         <enumeration value="24"/>
+         *                         <enumeration value="25"/>
+         *                         <enumeration value="26"/>
+         *                         <enumeration value="27"/>
+         *                         <enumeration value="28"/>
+         *                         <enumeration value="29"/>
+         *                         <enumeration value="99"/>
+         *                       </restriction>
+         *                     </simpleType>
+         *                   </element>
+         *                   <element name="sitVeiculo">
+         *                     <simpleType>
+         *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *                         <whiteSpace value="preserve"/>
+         *                         <enumeration value="1"/>
+         *                         <enumeration value="2"/>
+         *                         <enumeration value="3"/>
+         *                       </restriction>
+         *                     </simpleType>
+         *                   </element>
+         *                 </sequence>
+         *               </restriction>
+         *             </complexContent>
+         *           </complexType>
+         *         </element>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "cPercurso", + "xPercurso", + "tpViagem", + "tpServ", + "tpAcomodacao", + "tpTrecho", + "dhViagem", + "dhConexao", + "prefixo", + "poltrona", + "plataforma", + "infTravessia" + }) + public static class InfViagem { + + @XmlElement(required = true) + protected String cPercurso; + @XmlElement(required = true) + protected String xPercurso; + @XmlElement(required = true) + protected String tpViagem; + @XmlElement(required = true) + protected String tpServ; + @XmlElement(required = true) + protected String tpAcomodacao; + @XmlElement(required = true) + protected String tpTrecho; + @XmlElement(required = true) + protected String dhViagem; + protected String dhConexao; + protected String prefixo; + protected String poltrona; + protected String plataforma; + protected TBPe.InfBPe.InfViagem.InfTravessia infTravessia; + + /** + * Obtém o valor da propriedade cPercurso. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCPercurso() { + return cPercurso; + } + + /** + * Define o valor da propriedade cPercurso. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCPercurso(String value) { + this.cPercurso = value; + } + + /** + * Obtém o valor da propriedade xPercurso. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXPercurso() { + return xPercurso; + } + + /** + * Define o valor da propriedade xPercurso. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXPercurso(String value) { + this.xPercurso = value; + } + + /** + * Obtém o valor da propriedade tpViagem. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpViagem() { + return tpViagem; + } + + /** + * Define o valor da propriedade tpViagem. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpViagem(String value) { + this.tpViagem = value; + } + + /** + * Obtém o valor da propriedade tpServ. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpServ() { + return tpServ; + } + + /** + * Define o valor da propriedade tpServ. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpServ(String value) { + this.tpServ = value; + } + + /** + * Obtém o valor da propriedade tpAcomodacao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpAcomodacao() { + return tpAcomodacao; + } + + /** + * Define o valor da propriedade tpAcomodacao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpAcomodacao(String value) { + this.tpAcomodacao = value; + } + + /** + * Obtém o valor da propriedade tpTrecho. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpTrecho() { + return tpTrecho; + } + + /** + * Define o valor da propriedade tpTrecho. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpTrecho(String value) { + this.tpTrecho = value; + } + + /** + * Obtém o valor da propriedade dhViagem. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDhViagem() { + return dhViagem; + } + + /** + * Define o valor da propriedade dhViagem. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDhViagem(String value) { + this.dhViagem = value; + } + + /** + * Obtém o valor da propriedade dhConexao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDhConexao() { + return dhConexao; + } + + /** + * Define o valor da propriedade dhConexao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDhConexao(String value) { + this.dhConexao = value; + } + + /** + * Obtém o valor da propriedade prefixo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPrefixo() { + return prefixo; + } + + /** + * Define o valor da propriedade prefixo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPrefixo(String value) { + this.prefixo = value; + } + + /** + * Obtém o valor da propriedade poltrona. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPoltrona() { + return poltrona; + } + + /** + * Define o valor da propriedade poltrona. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPoltrona(String value) { + this.poltrona = value; + } + + /** + * Obtém o valor da propriedade plataforma. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPlataforma() { + return plataforma; + } + + /** + * Define o valor da propriedade plataforma. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPlataforma(String value) { + this.plataforma = value; + } + + /** + * Obtém o valor da propriedade infTravessia. + * + * @return + * possible object is + * {@link TBPe.InfBPe.InfViagem.InfTravessia } + * + */ + public TBPe.InfBPe.InfViagem.InfTravessia getInfTravessia() { + return infTravessia; + } + + /** + * Define o valor da propriedade infTravessia. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe.InfViagem.InfTravessia } + * + */ + public void setInfTravessia(TBPe.InfBPe.InfViagem.InfTravessia value) { + this.infTravessia = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+             * <complexType>
+             *   <complexContent>
+             *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+             *       <sequence>
+             *         <element name="tpVeiculo">
+             *           <simpleType>
+             *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+             *               <whiteSpace value="preserve"/>
+             *               <enumeration value="01"/>
+             *               <enumeration value="02"/>
+             *               <enumeration value="03"/>
+             *               <enumeration value="04"/>
+             *               <enumeration value="05"/>
+             *               <enumeration value="06"/>
+             *               <enumeration value="07"/>
+             *               <enumeration value="08"/>
+             *               <enumeration value="09"/>
+             *               <enumeration value="10"/>
+             *               <enumeration value="11"/>
+             *               <enumeration value="12"/>
+             *               <enumeration value="13"/>
+             *               <enumeration value="14"/>
+             *               <enumeration value="15"/>
+             *               <enumeration value="16"/>
+             *               <enumeration value="17"/>
+             *               <enumeration value="18"/>
+             *               <enumeration value="19"/>
+             *               <enumeration value="20"/>
+             *               <enumeration value="21"/>
+             *               <enumeration value="22"/>
+             *               <enumeration value="23"/>
+             *               <enumeration value="24"/>
+             *               <enumeration value="25"/>
+             *               <enumeration value="26"/>
+             *               <enumeration value="27"/>
+             *               <enumeration value="28"/>
+             *               <enumeration value="29"/>
+             *               <enumeration value="99"/>
+             *             </restriction>
+             *           </simpleType>
+             *         </element>
+             *         <element name="sitVeiculo">
+             *           <simpleType>
+             *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+             *               <whiteSpace value="preserve"/>
+             *               <enumeration value="1"/>
+             *               <enumeration value="2"/>
+             *               <enumeration value="3"/>
+             *             </restriction>
+             *           </simpleType>
+             *         </element>
+             *       </sequence>
+             *     </restriction>
+             *   </complexContent>
+             * </complexType>
+             * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "tpVeiculo", + "sitVeiculo" + }) + public static class InfTravessia { + + @XmlElement(required = true) + protected String tpVeiculo; + @XmlElement(required = true) + protected String sitVeiculo; + + /** + * Obtém o valor da propriedade tpVeiculo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpVeiculo() { + return tpVeiculo; + } + + /** + * Define o valor da propriedade tpVeiculo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpVeiculo(String value) { + this.tpVeiculo = value; + } + + /** + * Obtém o valor da propriedade sitVeiculo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSitVeiculo() { + return sitVeiculo; + } + + /** + * Define o valor da propriedade sitVeiculo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSitVeiculo(String value) { + this.sitVeiculo = value; + } + + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <element name="tPag">
+         *           <simpleType>
+         *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *               <whiteSpace value="preserve"/>
+         *               <enumeration value="01"/>
+         *               <enumeration value="02"/>
+         *               <enumeration value="03"/>
+         *               <enumeration value="04"/>
+         *               <enumeration value="05"/>
+         *               <enumeration value="99"/>
+         *             </restriction>
+         *           </simpleType>
+         *         </element>
+         *         <element name="vPag" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+         *         <element name="card" minOccurs="0">
+         *           <complexType>
+         *             <complexContent>
+         *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *                 <sequence>
+         *                   <element name="tpIntegra">
+         *                     <simpleType>
+         *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *                         <whiteSpace value="preserve"/>
+         *                         <enumeration value="1"/>
+         *                         <enumeration value="2"/>
+         *                       </restriction>
+         *                     </simpleType>
+         *                   </element>
+         *                   <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj" minOccurs="0"/>
+         *                   <element name="tBand" minOccurs="0">
+         *                     <simpleType>
+         *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *                         <whiteSpace value="preserve"/>
+         *                         <enumeration value="01"/>
+         *                         <enumeration value="02"/>
+         *                         <enumeration value="03"/>
+         *                         <enumeration value="04"/>
+         *                         <enumeration value="05"/>
+         *                         <enumeration value="99"/>
+         *                       </restriction>
+         *                     </simpleType>
+         *                   </element>
+         *                   <element name="cAut" minOccurs="0">
+         *                     <simpleType>
+         *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+         *                         <minLength value="1"/>
+         *                         <maxLength value="20"/>
+         *                       </restriction>
+         *                     </simpleType>
+         *                   </element>
+         *                 </sequence>
+         *               </restriction>
+         *             </complexContent>
+         *           </complexType>
+         *         </element>
+         *       </sequence>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "tPag", + "vPag", + "card", + "xPag" + }) + public static class Pag { + + @XmlElement(required = true) + protected String tPag; + @XmlElement(required = true) + protected String vPag; + protected String xPag; + protected TBPe.InfBPe.Pag.Card card; + + /** + * Obtém o valor da propriedade tPag. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTPag() { + return tPag; + } + + /** + * Define o valor da propriedade tPag. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTPag(String value) { + this.tPag = value; + } + + /** + * Obtém o valor da propriedade vPag. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVPag() { + return vPag; + } + + /** + * Define o valor da propriedade vPag. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVPag(String value) { + this.vPag = value; + } + + /** + * Obtém o valor da propriedade xPag. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXPag() { + return xPag; + } + + /** + * Define o valor da propriedade xPag. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXPag(String value) { + this.xPag = value; + } + + /** + * Obtém o valor da propriedade card. + * + * @return + * possible object is + * {@link TBPe.InfBPe.Pag.Card } + * + */ + public TBPe.InfBPe.Pag.Card getCard() { + return card; + } + + /** + * Define o valor da propriedade card. + * + * @param value + * allowed object is + * {@link TBPe.InfBPe.Pag.Card } + * + */ + public void setCard(TBPe.InfBPe.Pag.Card value) { + this.card = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+             * <complexType>
+             *   <complexContent>
+             *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+             *       <sequence>
+             *         <element name="tpIntegra">
+             *           <simpleType>
+             *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+             *               <whiteSpace value="preserve"/>
+             *               <enumeration value="1"/>
+             *               <enumeration value="2"/>
+             *             </restriction>
+             *           </simpleType>
+             *         </element>
+             *         <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj" minOccurs="0"/>
+             *         <element name="tBand" minOccurs="0">
+             *           <simpleType>
+             *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+             *               <whiteSpace value="preserve"/>
+             *               <enumeration value="01"/>
+             *               <enumeration value="02"/>
+             *               <enumeration value="03"/>
+             *               <enumeration value="04"/>
+             *               <enumeration value="05"/>
+             *               <enumeration value="99"/>
+             *             </restriction>
+             *           </simpleType>
+             *         </element>
+             *         <element name="cAut" minOccurs="0">
+             *           <simpleType>
+             *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+             *               <minLength value="1"/>
+             *               <maxLength value="20"/>
+             *             </restriction>
+             *           </simpleType>
+             *         </element>
+             *       </sequence>
+             *     </restriction>
+             *   </complexContent>
+             * </complexType>
+             * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "tpIntegra", + "cnpj", + "tBand", + "cAut", + "xBand", + "nsuTrans", + "nsuHost", + "nParcelas" + }) + public static class Card { + + @XmlElement(required = true) + protected String tpIntegra; + @XmlElement(name = "CNPJ") + protected String cnpj; + protected String tBand; + protected String cAut; + protected String xBand; + protected String nsuTrans; + protected String nsuHost; + protected String nParcelas; + + /** + * Obtém o valor da propriedade tpIntegra. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpIntegra() { + return tpIntegra; + } + + /** + * Define o valor da propriedade tpIntegra. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpIntegra(String value) { + this.tpIntegra = value; + } + + /** + * Obtém o valor da propriedade cnpj. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCNPJ() { + return cnpj; + } + + /** + * Define o valor da propriedade cnpj. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCNPJ(String value) { + this.cnpj = value; + } + + /** + * Obtém o valor da propriedade tBand. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTBand() { + return tBand; + } + + /** + * Define o valor da propriedade tBand. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTBand(String value) { + this.tBand = value; + } + + /** + * Obtém o valor da propriedade xBand. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXBand() { + return xBand; + } + + /** + * Define o valor da propriedade xBand. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXBand(String value) { + this.xBand = value; + } + + /** + * Obtém o valor da propriedade nsuTrans. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNsuTrans() { + return nsuTrans; + } + + /** + * Define o valor da propriedade nsuTrans. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNsuTrans(String value) { + this.xBand = value; + } + + /** + * Obtém o valor da propriedade nsuHost. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNsuHost() { + return nsuHost; + } + + /** + * Define o valor da propriedade nsuHost. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNsuHost(String value) { + this.nsuHost = value; + } + + /** + * Obtém o valor da propriedade nParcelas. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNParcelas() { + return nParcelas; + } + + /** + * Define o valor da propriedade nParcelas. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNParcelas(String value) { + this.nParcelas = value; + } + + /** + * Obtém o valor da propriedade cAut. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCAut() { + return cAut; + } + + /** + * Define o valor da propriedade cAut. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCAut(String value) { + this.cAut = value; + } + + } + + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="qrCodBPe">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <minLength value="50"/>
+     *               <maxLength value="1000"/>
+     *               <pattern value="((HTTPS?|https?)://.*\?chBPe=[0-9]{44}&tpAmb=[1-2](&sign=[!-ÿ]{1}[ -ÿ]{0,}[!-ÿ]{1}|[!-ÿ]{1})?)"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="boardPassBPe" minOccurs="0">
+     *           <simpleType>
+     *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *               <minLength value="50"/>
+     *               <maxLength value="1000"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "qrCodBPe", + "boardPassBPe" + }) + public static class InfBPeSupl { + + @XmlElement(required = true) + protected String qrCodBPe; + protected String boardPassBPe; + + /** + * Obtém o valor da propriedade qrCodBPe. + * + * @return + * possible object is + * {@link String } + * + */ + public String getQrCodBPe() { + return qrCodBPe; + } + + /** + * Define o valor da propriedade qrCodBPe. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setQrCodBPe(String value) { + this.qrCodBPe = value; + } + + /** + * Obtém o valor da propriedade boardPassBPe. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBoardPassBPe() { + return boardPassBPe; + } + + /** + * Define o valor da propriedade boardPassBPe. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBoardPassBPe(String value) { + this.boardPassBPe = value; + } + + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TConsSitBPe.java b/src/br/inf/portalfiscal/bpe/TConsSitBPe.java new file mode 100644 index 000000000..f5d3d70c4 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TConsSitBPe.java @@ -0,0 +1,155 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.10.24 às 07:38:45 PM BRST +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * Tipo Pedido de Consulta da Situação Atual do Bilhete de Passagem Eletrônico + * + *

Classe Java de TConsSitBPe complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TConsSitBPe">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+ *         <element name="xServ" type="{http://www.portalfiscal.inf.br/bpe}TServ"/>
+ *         <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe"/>
+ *       </sequence>
+ *       <attribute name="versao" use="required" type="{http://www.portalfiscal.inf.br/bpe}TVerConsSitBPe" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TConsSitBPe", propOrder = { + "tpAmb", + "xServ", + "chBPe" +}) +public class TConsSitBPe { + + @XmlElement(required = true) + protected String tpAmb; + @XmlElement(required = true) + protected String xServ; + @XmlElement(required = true) + protected String chBPe; + @XmlAttribute(name = "versao", required = true) + protected String versao; + + /** + * Obtém o valor da propriedade tpAmb. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpAmb() { + return tpAmb; + } + + /** + * Define o valor da propriedade tpAmb. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpAmb(String value) { + this.tpAmb = value; + } + + /** + * Obtém o valor da propriedade xServ. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXServ() { + return xServ; + } + + /** + * Define o valor da propriedade xServ. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXServ(String value) { + this.xServ = value; + } + + /** + * Obtém o valor da propriedade chBPe. + * + * @return + * possible object is + * {@link String } + * + */ + public String getChBPe() { + return chBPe; + } + + /** + * Define o valor da propriedade chBPe. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setChBPe(String value) { + this.chBPe = value; + } + + /** + * Obtém o valor da propriedade versao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersao() { + return versao; + } + + /** + * Define o valor da propriedade versao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersao(String value) { + this.versao = value; + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TEndeEmi.java b/src/br/inf/portalfiscal/bpe/TEndeEmi.java new file mode 100644 index 000000000..9c37b4283 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TEndeEmi.java @@ -0,0 +1,371 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; + + +/** + * Tipo Dados do Endereço + * + *

Classe Java de TEndeEmi complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TEndeEmi">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="xLgr">
+ *           <simpleType>
+ *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *               <maxLength value="60"/>
+ *               <minLength value="2"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="nro">
+ *           <simpleType>
+ *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *               <maxLength value="60"/>
+ *               <minLength value="1"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="xCpl" minOccurs="0">
+ *           <simpleType>
+ *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *               <maxLength value="60"/>
+ *               <minLength value="1"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="xBairro">
+ *           <simpleType>
+ *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *               <maxLength value="60"/>
+ *               <minLength value="2"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="cMun" type="{http://www.portalfiscal.inf.br/bpe}TCodMunIBGE"/>
+ *         <element name="xMun">
+ *           <simpleType>
+ *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *               <maxLength value="60"/>
+ *               <minLength value="2"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="CEP" minOccurs="0">
+ *           <simpleType>
+ *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *               <whiteSpace value="preserve"/>
+ *               <pattern value="[0-9]{8}"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="UF" type="{http://www.portalfiscal.inf.br/bpe}TUf_sem_EX"/>
+ *         <element name="fone" minOccurs="0">
+ *           <simpleType>
+ *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *               <whiteSpace value="preserve"/>
+ *               <pattern value="[0-9]{7,12}"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="email" type="{http://www.portalfiscal.inf.br/bpe}TEmail" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TEndeEmi", propOrder = { + "xLgr", + "nro", + "xCpl", + "xBairro", + "cMun", + "xMun", + "cep", + "uf", + "fone", + "email" +}) +public class TEndeEmi { + + @XmlElement(required = true) + protected String xLgr; + @XmlElement(required = true) + protected String nro; + protected String xCpl; + @XmlElement(required = true) + protected String xBairro; + @XmlElement(required = true) + protected String cMun; + @XmlElement(required = true) + protected String xMun; + @XmlElement(name = "CEP") + protected String cep; + @XmlElement(name = "UF", required = true) + @XmlSchemaType(name = "string") + protected TUfSemEX uf; + protected String fone; + protected String email; + + /** + * Obtém o valor da propriedade xLgr. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXLgr() { + return xLgr; + } + + /** + * Define o valor da propriedade xLgr. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXLgr(String value) { + this.xLgr = value; + } + + /** + * Obtém o valor da propriedade nro. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNro() { + return nro; + } + + /** + * Define o valor da propriedade nro. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNro(String value) { + this.nro = value; + } + + /** + * Obtém o valor da propriedade xCpl. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXCpl() { + return xCpl; + } + + /** + * Define o valor da propriedade xCpl. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXCpl(String value) { + this.xCpl = value; + } + + /** + * Obtém o valor da propriedade xBairro. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXBairro() { + return xBairro; + } + + /** + * Define o valor da propriedade xBairro. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXBairro(String value) { + this.xBairro = value; + } + + /** + * Obtém o valor da propriedade cMun. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCMun() { + return cMun; + } + + /** + * Define o valor da propriedade cMun. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCMun(String value) { + this.cMun = value; + } + + /** + * Obtém o valor da propriedade xMun. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXMun() { + return xMun; + } + + /** + * Define o valor da propriedade xMun. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXMun(String value) { + this.xMun = value; + } + + /** + * Obtém o valor da propriedade cep. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCEP() { + return cep; + } + + /** + * Define o valor da propriedade cep. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCEP(String value) { + this.cep = value; + } + + /** + * Obtém o valor da propriedade uf. + * + * @return + * possible object is + * {@link TUfSemEX } + * + */ + public TUfSemEX getUF() { + return uf; + } + + /** + * Define o valor da propriedade uf. + * + * @param value + * allowed object is + * {@link TUfSemEX } + * + */ + public void setUF(TUfSemEX value) { + this.uf = value; + } + + /** + * Obtém o valor da propriedade fone. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFone() { + return fone; + } + + /** + * Define o valor da propriedade fone. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFone(String value) { + this.fone = value; + } + + /** + * Obtém o valor da propriedade email. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEmail() { + return email; + } + + /** + * Define o valor da propriedade email. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEmail(String value) { + this.email = value; + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TEndereco.java b/src/br/inf/portalfiscal/bpe/TEndereco.java new file mode 100644 index 000000000..8ae2c240b --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TEndereco.java @@ -0,0 +1,439 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; + + +/** + * Tipo Dados do Endereço + * + *

Classe Java de TEndereco complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TEndereco">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="xLgr">
+ *           <simpleType>
+ *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *               <maxLength value="255"/>
+ *               <minLength value="1"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="nro">
+ *           <simpleType>
+ *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *               <maxLength value="60"/>
+ *               <minLength value="1"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="xCpl" minOccurs="0">
+ *           <simpleType>
+ *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *               <maxLength value="60"/>
+ *               <minLength value="1"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="xBairro">
+ *           <simpleType>
+ *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *               <maxLength value="60"/>
+ *               <minLength value="1"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="cMun" type="{http://www.portalfiscal.inf.br/bpe}TCodMunIBGE"/>
+ *         <element name="xMun">
+ *           <simpleType>
+ *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *               <maxLength value="60"/>
+ *               <minLength value="1"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="CEP" minOccurs="0">
+ *           <simpleType>
+ *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *               <whiteSpace value="preserve"/>
+ *               <pattern value="[0-9]{8}"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="UF" type="{http://www.portalfiscal.inf.br/bpe}TUf"/>
+ *         <element name="cPais" minOccurs="0">
+ *           <simpleType>
+ *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *               <whiteSpace value="preserve"/>
+ *               <pattern value="[0-9]{1,4}"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="xPais" minOccurs="0">
+ *           <simpleType>
+ *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *               <maxLength value="60"/>
+ *               <minLength value="1"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="fone" minOccurs="0">
+ *           <simpleType>
+ *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *               <whiteSpace value="preserve"/>
+ *               <pattern value="[0-9]{7,12}"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="email" type="{http://www.portalfiscal.inf.br/bpe}TEmail" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TEndereco", propOrder = { + "xLgr", + "nro", + "xCpl", + "xBairro", + "cMun", + "xMun", + "cep", + "uf", + "cPais", + "xPais", + "fone", + "email" +}) +public class TEndereco { + + @XmlElement(required = true) + protected String xLgr; + @XmlElement(required = true) + protected String nro; + protected String xCpl; + @XmlElement(required = true) + protected String xBairro; + @XmlElement(required = true) + protected String cMun; + @XmlElement(required = true) + protected String xMun; + @XmlElement(name = "CEP") + protected String cep; + @XmlElement(name = "UF", required = true) + @XmlSchemaType(name = "string") + protected TUf uf; + protected String cPais; + protected String xPais; + protected String fone; + protected String email; + + /** + * Obtém o valor da propriedade xLgr. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXLgr() { + return xLgr; + } + + /** + * Define o valor da propriedade xLgr. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXLgr(String value) { + this.xLgr = value; + } + + /** + * Obtém o valor da propriedade nro. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNro() { + return nro; + } + + /** + * Define o valor da propriedade nro. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNro(String value) { + this.nro = value; + } + + /** + * Obtém o valor da propriedade xCpl. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXCpl() { + return xCpl; + } + + /** + * Define o valor da propriedade xCpl. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXCpl(String value) { + this.xCpl = value; + } + + /** + * Obtém o valor da propriedade xBairro. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXBairro() { + return xBairro; + } + + /** + * Define o valor da propriedade xBairro. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXBairro(String value) { + this.xBairro = value; + } + + /** + * Obtém o valor da propriedade cMun. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCMun() { + return cMun; + } + + /** + * Define o valor da propriedade cMun. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCMun(String value) { + this.cMun = value; + } + + /** + * Obtém o valor da propriedade xMun. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXMun() { + return xMun; + } + + /** + * Define o valor da propriedade xMun. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXMun(String value) { + this.xMun = value; + } + + /** + * Obtém o valor da propriedade cep. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCEP() { + return cep; + } + + /** + * Define o valor da propriedade cep. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCEP(String value) { + this.cep = value; + } + + /** + * Obtém o valor da propriedade uf. + * + * @return + * possible object is + * {@link TUf } + * + */ + public TUf getUF() { + return uf; + } + + /** + * Define o valor da propriedade uf. + * + * @param value + * allowed object is + * {@link TUf } + * + */ + public void setUF(TUf value) { + this.uf = value; + } + + /** + * Obtém o valor da propriedade cPais. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCPais() { + return cPais; + } + + /** + * Define o valor da propriedade cPais. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCPais(String value) { + this.cPais = value; + } + + /** + * Obtém o valor da propriedade xPais. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXPais() { + return xPais; + } + + /** + * Define o valor da propriedade xPais. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXPais(String value) { + this.xPais = value; + } + + /** + * Obtém o valor da propriedade fone. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFone() { + return fone; + } + + /** + * Define o valor da propriedade fone. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFone(String value) { + this.fone = value; + } + + /** + * Obtém o valor da propriedade email. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEmail() { + return email; + } + + /** + * Define o valor da propriedade email. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEmail(String value) { + this.email = value; + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TEnviBPe.java b/src/br/inf/portalfiscal/bpe/TEnviBPe.java new file mode 100644 index 000000000..8554f3a66 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TEnviBPe.java @@ -0,0 +1,127 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * Tipo Pedido de Concessão de Autorização de BP-e + * + *

Classe Java de TEnviBPe complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TEnviBPe">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="idLote" type="{http://www.portalfiscal.inf.br/bpe}TIdLote"/>
+ *         <element name="BPe" type="{http://www.portalfiscal.inf.br/bpe}TBPe"/>
+ *       </sequence>
+ *       <attribute name="versao" use="required" type="{http://www.portalfiscal.inf.br/bpe}TVerBPe" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TEnviBPe", propOrder = { + "idLote", + "bPe" +}) +public class TEnviBPe { + + @XmlElement(required = true) + protected String idLote; + @XmlElement(name = "BPe", required = true) + protected TBPe bPe; + @XmlAttribute(name = "versao", required = true) + protected String versao; + + /** + * Obtém o valor da propriedade idLote. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIdLote() { + return idLote; + } + + /** + * Define o valor da propriedade idLote. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIdLote(String value) { + this.idLote = value; + } + + /** + * Obtém o valor da propriedade bPe. + * + * @return + * possible object is + * {@link TBPe } + * + */ + public TBPe getBPe() { + return bPe; + } + + /** + * Define o valor da propriedade bPe. + * + * @param value + * allowed object is + * {@link TBPe } + * + */ + public void setBPe(TBPe value) { + this.bPe = value; + } + + /** + * Obtém o valor da propriedade versao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersao() { + return versao; + } + + /** + * Define o valor da propriedade versao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersao(String value) { + this.versao = value; + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TEvento.java b/src/br/inf/portalfiscal/bpe/TEvento.java new file mode 100644 index 000000000..ff8d1412c --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TEvento.java @@ -0,0 +1,599 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.29 às 06:11:44 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlID; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +import org.w3c.dom.Element; + + +/** + * Tipo Evento + * + *

Classe Java de TEvento complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TEvento">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="infEvento">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="cOrgao" type="{http://www.portalfiscal.inf.br/bpe}TCOrgaoIBGE"/>
+ *                   <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+ *                   <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj"/>
+ *                   <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe"/>
+ *                   <element name="dhEvento" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+ *                   <element name="tpEvento">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <pattern value="[0-9]{6}"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="nSeqEvento">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <pattern value="[1-9][0-9]|0?[1-9]"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="detEvento">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <any processContents='skip'/>
+ *                           </sequence>
+ *                           <attribute name="versaoEvento" use="required">
+ *                             <simpleType>
+ *                               <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                 <whiteSpace value="preserve"/>
+ *                                 <pattern value="1\.(0[0-9]|[1-9][0-9])"/>
+ *                               </restriction>
+ *                             </simpleType>
+ *                           </attribute>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                 </sequence>
+ *                 <attribute name="Id" use="required">
+ *                   <simpleType>
+ *                     <restriction base="{http://www.w3.org/2001/XMLSchema}ID">
+ *                       <pattern value="ID[0-9]{52}"/>
+ *                     </restriction>
+ *                   </simpleType>
+ *                 </attribute>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element ref="{http://www.w3.org/2000/09/xmldsig#}Signature"/>
+ *       </sequence>
+ *       <attribute name="versao" use="required" type="{http://www.portalfiscal.inf.br/bpe}TVerEvento" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TEvento", propOrder = { + "infEvento", +// "signature" +}) +@XmlRootElement(name = "eventoBPe") +public class TEvento { + + @XmlElement(required = true) + protected TEvento.InfEvento infEvento; +// @XmlElement(name = "Signature" required = true) +// protected SignatureType signature; + @XmlAttribute(name = "versao", required = true) + protected String versao; + + /** + * Obtém o valor da propriedade infEvento. + * + * @return + * possible object is + * {@link TEvento.InfEvento } + * + */ + public TEvento.InfEvento getInfEvento() { + return infEvento; + } + + /** + * Define o valor da propriedade infEvento. + * + * @param value + * allowed object is + * {@link TEvento.InfEvento } + * + */ + public void setInfEvento(TEvento.InfEvento value) { + this.infEvento = value; + } + + /** + * Obtém o valor da propriedade signature. + * + * @return + * possible object is + * {@link SignatureType } + * + */ +// public SignatureType getSignature() { +// return signature; +// } + + /** + * Define o valor da propriedade signature. + * + * @param value + * allowed object is + * {@link SignatureType } + * + */ +// public void setSignature(SignatureType value) { +// this.signature = value; +// } + + /** + * Obtém o valor da propriedade versao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersao() { + return versao; + } + + /** + * Define o valor da propriedade versao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersao(String value) { + this.versao = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="cOrgao" type="{http://www.portalfiscal.inf.br/bpe}TCOrgaoIBGE"/>
+     *         <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+     *         <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj"/>
+     *         <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe"/>
+     *         <element name="dhEvento" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+     *         <element name="tpEvento">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <pattern value="[0-9]{6}"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="nSeqEvento">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <pattern value="[1-9][0-9]|0?[1-9]"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="detEvento">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <any processContents='skip'/>
+     *                 </sequence>
+     *                 <attribute name="versaoEvento" use="required">
+     *                   <simpleType>
+     *                     <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                       <whiteSpace value="preserve"/>
+     *                       <pattern value="1\.(0[0-9]|[1-9][0-9])"/>
+     *                     </restriction>
+     *                   </simpleType>
+     *                 </attribute>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *       </sequence>
+     *       <attribute name="Id" use="required">
+     *         <simpleType>
+     *           <restriction base="{http://www.w3.org/2001/XMLSchema}ID">
+     *             <pattern value="ID[0-9]{52}"/>
+     *           </restriction>
+     *         </simpleType>
+     *       </attribute>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "cOrgao", + "tpAmb", + "cnpj", + "chBPe", + "dhEvento", + "tpEvento", + "nSeqEvento", + "detEvento" + }) + public static class InfEvento { + + @XmlElement(required = true) + protected String cOrgao; + @XmlElement(required = true) + protected String tpAmb; + @XmlElement(name = "CNPJ", required = true) + protected String cnpj; + @XmlElement(required = true) + protected String chBPe; + @XmlElement(required = true) + protected String dhEvento; + @XmlElement(required = true) + protected String tpEvento; + @XmlElement(required = true) + protected String nSeqEvento; + @XmlElement(required = true) + protected TEvento.InfEvento.DetEvento detEvento; + @XmlAttribute(name = "Id", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlID + protected String id; + + /** + * Obtém o valor da propriedade cOrgao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCOrgao() { + return cOrgao; + } + + /** + * Define o valor da propriedade cOrgao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCOrgao(String value) { + this.cOrgao = value; + } + + /** + * Obtém o valor da propriedade tpAmb. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpAmb() { + return tpAmb; + } + + /** + * Define o valor da propriedade tpAmb. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpAmb(String value) { + this.tpAmb = value; + } + + /** + * Obtém o valor da propriedade cnpj. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCNPJ() { + return cnpj; + } + + /** + * Define o valor da propriedade cnpj. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCNPJ(String value) { + this.cnpj = value; + } + + /** + * Obtém o valor da propriedade chBPe. + * + * @return + * possible object is + * {@link String } + * + */ + public String getChBPe() { + return chBPe; + } + + /** + * Define o valor da propriedade chBPe. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setChBPe(String value) { + this.chBPe = value; + } + + /** + * Obtém o valor da propriedade dhEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDhEvento() { + return dhEvento; + } + + /** + * Define o valor da propriedade dhEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDhEvento(String value) { + this.dhEvento = value; + } + + /** + * Obtém o valor da propriedade tpEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpEvento() { + return tpEvento; + } + + /** + * Define o valor da propriedade tpEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpEvento(String value) { + this.tpEvento = value; + } + + /** + * Obtém o valor da propriedade nSeqEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNSeqEvento() { + return nSeqEvento; + } + + /** + * Define o valor da propriedade nSeqEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNSeqEvento(String value) { + this.nSeqEvento = value; + } + + /** + * Obtém o valor da propriedade detEvento. + * + * @return + * possible object is + * {@link TEvento.InfEvento.DetEvento } + * + */ + public TEvento.InfEvento.DetEvento getDetEvento() { + return detEvento; + } + + /** + * Define o valor da propriedade detEvento. + * + * @param value + * allowed object is + * {@link TEvento.InfEvento.DetEvento } + * + */ + public void setDetEvento(TEvento.InfEvento.DetEvento value) { + this.detEvento = value; + } + + /** + * Obtém o valor da propriedade id. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Define o valor da propriedade id. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <any processContents='skip'/>
+         *       </sequence>
+         *       <attribute name="versaoEvento" use="required">
+         *         <simpleType>
+         *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *             <whiteSpace value="preserve"/>
+         *             <pattern value="1\.(0[0-9]|[1-9][0-9])"/>
+         *           </restriction>
+         *         </simpleType>
+         *       </attribute>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "any" + }) + public static class DetEvento { + + @XmlAnyElement + protected Element any; + @XmlAttribute(name = "versaoEvento", required = true) + protected String versaoEvento; + + + /** + * Obtém o valor da propriedade any. + * + * @return + * possible object is + * {@link Element } + * + */ + public Element getAny() { + return any; + } + + /** + * Define o valor da propriedade any. + * + * @param value + * allowed object is + * {@link Element } + * + */ + public void setAny(Element value) { + this.any = value; + } + + /** + * Obtém o valor da propriedade versaoEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersaoEvento() { + return versaoEvento; + } + + /** + * Define o valor da propriedade versaoEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersaoEvento(String value) { + this.versaoEvento = value; + } + + } + + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TImp.java b/src/br/inf/portalfiscal/bpe/TImp.java new file mode 100644 index 000000000..2b6a855cf --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TImp.java @@ -0,0 +1,1193 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * Tipo Dados do Imposto BP-e + * + *

Classe Java de TImp complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TImp">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <choice>
+ *         <element name="ICMS00">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="CST">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <enumeration value="00"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="vBC" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                   <element name="pICMS" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+ *                   <element name="vICMS" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element name="ICMS20">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="CST">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <enumeration value="20"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="pRedBC" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302Opc"/>
+ *                   <element name="vBC" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                   <element name="pICMS" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+ *                   <element name="vICMS" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element name="ICMS45">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="CST">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <enumeration value="40"/>
+ *                         <enumeration value="41"/>
+ *                         <enumeration value="51"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element name="ICMS90">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="CST">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <enumeration value="90"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="pRedBC" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302Opc" minOccurs="0"/>
+ *                   <element name="vBC" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                   <element name="pICMS" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+ *                   <element name="vICMS" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                   <element name="vCred" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302" minOccurs="0"/>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element name="ICMSOutraUF">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="CST">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <enumeration value="90"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="pRedBCOutraUF" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302Opc" minOccurs="0"/>
+ *                   <element name="vBCOutraUF" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                   <element name="pICMSOutraUF" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+ *                   <element name="vICMSOutraUF" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element name="ICMSSN">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="CST">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <enumeration value="90"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="indSN">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <enumeration value="1"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                 </sequence>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *       </choice>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TImp", propOrder = { + "icms00", + "icms20", + "icms45", + "icms90", + "icmsOutraUF", + "icmssn" +}) +public class TImp { + + @XmlElement(name = "ICMS00") + protected TImp.ICMS00 icms00; + @XmlElement(name = "ICMS20") + protected TImp.ICMS20 icms20; + @XmlElement(name = "ICMS45") + protected TImp.ICMS45 icms45; + @XmlElement(name = "ICMS90") + protected TImp.ICMS90 icms90; + @XmlElement(name = "ICMSOutraUF") + protected TImp.ICMSOutraUF icmsOutraUF; + @XmlElement(name = "ICMSSN") + protected TImp.ICMSSN icmssn; + + /** + * Obtém o valor da propriedade icms00. + * + * @return + * possible object is + * {@link TImp.ICMS00 } + * + */ + public TImp.ICMS00 getICMS00() { + return icms00; + } + + /** + * Define o valor da propriedade icms00. + * + * @param value + * allowed object is + * {@link TImp.ICMS00 } + * + */ + public void setICMS00(TImp.ICMS00 value) { + this.icms00 = value; + } + + /** + * Obtém o valor da propriedade icms20. + * + * @return + * possible object is + * {@link TImp.ICMS20 } + * + */ + public TImp.ICMS20 getICMS20() { + return icms20; + } + + /** + * Define o valor da propriedade icms20. + * + * @param value + * allowed object is + * {@link TImp.ICMS20 } + * + */ + public void setICMS20(TImp.ICMS20 value) { + this.icms20 = value; + } + + /** + * Obtém o valor da propriedade icms45. + * + * @return + * possible object is + * {@link TImp.ICMS45 } + * + */ + public TImp.ICMS45 getICMS45() { + return icms45; + } + + /** + * Define o valor da propriedade icms45. + * + * @param value + * allowed object is + * {@link TImp.ICMS45 } + * + */ + public void setICMS45(TImp.ICMS45 value) { + this.icms45 = value; + } + + /** + * Obtém o valor da propriedade icms90. + * + * @return + * possible object is + * {@link TImp.ICMS90 } + * + */ + public TImp.ICMS90 getICMS90() { + return icms90; + } + + /** + * Define o valor da propriedade icms90. + * + * @param value + * allowed object is + * {@link TImp.ICMS90 } + * + */ + public void setICMS90(TImp.ICMS90 value) { + this.icms90 = value; + } + + /** + * Obtém o valor da propriedade icmsOutraUF. + * + * @return + * possible object is + * {@link TImp.ICMSOutraUF } + * + */ + public TImp.ICMSOutraUF getICMSOutraUF() { + return icmsOutraUF; + } + + /** + * Define o valor da propriedade icmsOutraUF. + * + * @param value + * allowed object is + * {@link TImp.ICMSOutraUF } + * + */ + public void setICMSOutraUF(TImp.ICMSOutraUF value) { + this.icmsOutraUF = value; + } + + /** + * Obtém o valor da propriedade icmssn. + * + * @return + * possible object is + * {@link TImp.ICMSSN } + * + */ + public TImp.ICMSSN getICMSSN() { + return icmssn; + } + + /** + * Define o valor da propriedade icmssn. + * + * @param value + * allowed object is + * {@link TImp.ICMSSN } + * + */ + public void setICMSSN(TImp.ICMSSN value) { + this.icmssn = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="CST">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <enumeration value="00"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="vBC" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *         <element name="pICMS" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+     *         <element name="vICMS" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "cst", + "vbc", + "picms", + "vicms" + }) + public static class ICMS00 { + + @XmlElement(name = "CST", required = true) + protected String cst; + @XmlElement(name = "vBC", required = true) + protected String vbc; + @XmlElement(name = "pICMS", required = true) + protected String picms; + @XmlElement(name = "vICMS", required = true) + protected String vicms; + + /** + * Obtém o valor da propriedade cst. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCST() { + return cst; + } + + /** + * Define o valor da propriedade cst. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCST(String value) { + this.cst = value; + } + + /** + * Obtém o valor da propriedade vbc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVBC() { + return vbc; + } + + /** + * Define o valor da propriedade vbc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVBC(String value) { + this.vbc = value; + } + + /** + * Obtém o valor da propriedade picms. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPICMS() { + return picms; + } + + /** + * Define o valor da propriedade picms. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPICMS(String value) { + this.picms = value; + } + + /** + * Obtém o valor da propriedade vicms. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVICMS() { + return vicms; + } + + /** + * Define o valor da propriedade vicms. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVICMS(String value) { + this.vicms = value; + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="CST">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <enumeration value="20"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="pRedBC" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302Opc"/>
+     *         <element name="vBC" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *         <element name="pICMS" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+     *         <element name="vICMS" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "cst", + "pRedBC", + "vbc", + "picms", + "vicms" + }) + public static class ICMS20 { + + @XmlElement(name = "CST", required = true) + protected String cst; + @XmlElement(required = true) + protected String pRedBC; + @XmlElement(name = "vBC", required = true) + protected String vbc; + @XmlElement(name = "pICMS", required = true) + protected String picms; + @XmlElement(name = "vICMS", required = true) + protected String vicms; + + /** + * Obtém o valor da propriedade cst. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCST() { + return cst; + } + + /** + * Define o valor da propriedade cst. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCST(String value) { + this.cst = value; + } + + /** + * Obtém o valor da propriedade pRedBC. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPRedBC() { + return pRedBC; + } + + /** + * Define o valor da propriedade pRedBC. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPRedBC(String value) { + this.pRedBC = value; + } + + /** + * Obtém o valor da propriedade vbc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVBC() { + return vbc; + } + + /** + * Define o valor da propriedade vbc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVBC(String value) { + this.vbc = value; + } + + /** + * Obtém o valor da propriedade picms. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPICMS() { + return picms; + } + + /** + * Define o valor da propriedade picms. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPICMS(String value) { + this.picms = value; + } + + /** + * Obtém o valor da propriedade vicms. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVICMS() { + return vicms; + } + + /** + * Define o valor da propriedade vicms. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVICMS(String value) { + this.vicms = value; + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="CST">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <enumeration value="40"/>
+     *               <enumeration value="41"/>
+     *               <enumeration value="51"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "cst" + }) + public static class ICMS45 { + + @XmlElement(name = "CST", required = true) + protected String cst; + + /** + * Obtém o valor da propriedade cst. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCST() { + return cst; + } + + /** + * Define o valor da propriedade cst. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCST(String value) { + this.cst = value; + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="CST">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <enumeration value="90"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="pRedBC" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302Opc" minOccurs="0"/>
+     *         <element name="vBC" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *         <element name="pICMS" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+     *         <element name="vICMS" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *         <element name="vCred" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302" minOccurs="0"/>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "cst", + "pRedBC", + "vbc", + "picms", + "vicms", + "vCred" + }) + public static class ICMS90 { + + @XmlElement(name = "CST", required = true) + protected String cst; + protected String pRedBC; + @XmlElement(name = "vBC", required = true) + protected String vbc; + @XmlElement(name = "pICMS", required = true) + protected String picms; + @XmlElement(name = "vICMS", required = true) + protected String vicms; + protected String vCred; + + /** + * Obtém o valor da propriedade cst. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCST() { + return cst; + } + + /** + * Define o valor da propriedade cst. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCST(String value) { + this.cst = value; + } + + /** + * Obtém o valor da propriedade pRedBC. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPRedBC() { + return pRedBC; + } + + /** + * Define o valor da propriedade pRedBC. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPRedBC(String value) { + this.pRedBC = value; + } + + /** + * Obtém o valor da propriedade vbc. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVBC() { + return vbc; + } + + /** + * Define o valor da propriedade vbc. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVBC(String value) { + this.vbc = value; + } + + /** + * Obtém o valor da propriedade picms. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPICMS() { + return picms; + } + + /** + * Define o valor da propriedade picms. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPICMS(String value) { + this.picms = value; + } + + /** + * Obtém o valor da propriedade vicms. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVICMS() { + return vicms; + } + + /** + * Define o valor da propriedade vicms. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVICMS(String value) { + this.vicms = value; + } + + /** + * Obtém o valor da propriedade vCred. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVCred() { + return vCred; + } + + /** + * Define o valor da propriedade vCred. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVCred(String value) { + this.vCred = value; + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="CST">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <enumeration value="90"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="pRedBCOutraUF" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302Opc" minOccurs="0"/>
+     *         <element name="vBCOutraUF" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *         <element name="pICMSOutraUF" type="{http://www.portalfiscal.inf.br/bpe}TDec_0302"/>
+     *         <element name="vICMSOutraUF" type="{http://www.portalfiscal.inf.br/bpe}TDec_1302"/>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "cst", + "pRedBCOutraUF", + "vbcOutraUF", + "picmsOutraUF", + "vicmsOutraUF" + }) + public static class ICMSOutraUF { + + @XmlElement(name = "CST", required = true) + protected String cst; + protected String pRedBCOutraUF; + @XmlElement(name = "vBCOutraUF", required = true) + protected String vbcOutraUF; + @XmlElement(name = "pICMSOutraUF", required = true) + protected String picmsOutraUF; + @XmlElement(name = "vICMSOutraUF", required = true) + protected String vicmsOutraUF; + + /** + * Obtém o valor da propriedade cst. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCST() { + return cst; + } + + /** + * Define o valor da propriedade cst. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCST(String value) { + this.cst = value; + } + + /** + * Obtém o valor da propriedade pRedBCOutraUF. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPRedBCOutraUF() { + return pRedBCOutraUF; + } + + /** + * Define o valor da propriedade pRedBCOutraUF. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPRedBCOutraUF(String value) { + this.pRedBCOutraUF = value; + } + + /** + * Obtém o valor da propriedade vbcOutraUF. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVBCOutraUF() { + return vbcOutraUF; + } + + /** + * Define o valor da propriedade vbcOutraUF. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVBCOutraUF(String value) { + this.vbcOutraUF = value; + } + + /** + * Obtém o valor da propriedade picmsOutraUF. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPICMSOutraUF() { + return picmsOutraUF; + } + + /** + * Define o valor da propriedade picmsOutraUF. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPICMSOutraUF(String value) { + this.picmsOutraUF = value; + } + + /** + * Obtém o valor da propriedade vicmsOutraUF. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVICMSOutraUF() { + return vicmsOutraUF; + } + + /** + * Define o valor da propriedade vicmsOutraUF. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVICMSOutraUF(String value) { + this.vicmsOutraUF = value; + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="CST">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <enumeration value="90"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="indSN">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <enumeration value="1"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *       </sequence>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "cst", + "indSN" + }) + public static class ICMSSN { + + @XmlElement(name = "CST", required = true) + protected String cst; + @XmlElement(required = true) + protected String indSN; + + /** + * Obtém o valor da propriedade cst. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCST() { + return cst; + } + + /** + * Define o valor da propriedade cst. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCST(String value) { + this.cst = value; + } + + /** + * Obtém o valor da propriedade indSN. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIndSN() { + return indSN; + } + + /** + * Define o valor da propriedade indSN. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIndSN(String value) { + this.indSN = value; + } + + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TProcEvento.java b/src/br/inf/portalfiscal/bpe/TProcEvento.java new file mode 100644 index 000000000..ddc9ac0c3 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TProcEvento.java @@ -0,0 +1,154 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.29 às 06:11:44 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * Tipo procEvento + * + *

Classe Java de TProcEvento complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TProcEvento">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="eventoBPe" type="{http://www.portalfiscal.inf.br/bpe}TEvento"/>
+ *         <element name="retEventoBPe" type="{http://www.portalfiscal.inf.br/bpe}TRetEvento"/>
+ *       </sequence>
+ *       <attribute name="versao" use="required" type="{http://www.portalfiscal.inf.br/bpe}TVerEvento" />
+ *       <attribute name="ipTransmissor" type="{http://www.portalfiscal.inf.br/bpe}TIPv4" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TProcEvento", propOrder = { + "eventoBPe", + "retEventoBPe" +}) +public class TProcEvento { + + @XmlElement(required = true) + protected TEvento eventoBPe; + @XmlElement(required = true) + protected TRetEvento retEventoBPe; + @XmlAttribute(name = "versao", required = true) + protected String versao; + @XmlAttribute(name = "ipTransmissor") + protected String ipTransmissor; + + /** + * Obtém o valor da propriedade eventoBPe. + * + * @return + * possible object is + * {@link TEvento } + * + */ + public TEvento getEventoBPe() { + return eventoBPe; + } + + /** + * Define o valor da propriedade eventoBPe. + * + * @param value + * allowed object is + * {@link TEvento } + * + */ + public void setEventoBPe(TEvento value) { + this.eventoBPe = value; + } + + /** + * Obtém o valor da propriedade retEventoBPe. + * + * @return + * possible object is + * {@link TRetEvento } + * + */ + public TRetEvento getRetEventoBPe() { + return retEventoBPe; + } + + /** + * Define o valor da propriedade retEventoBPe. + * + * @param value + * allowed object is + * {@link TRetEvento } + * + */ + public void setRetEventoBPe(TRetEvento value) { + this.retEventoBPe = value; + } + + /** + * Obtém o valor da propriedade versao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersao() { + return versao; + } + + /** + * Define o valor da propriedade versao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersao(String value) { + this.versao = value; + } + + /** + * Obtém o valor da propriedade ipTransmissor. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIpTransmissor() { + return ipTransmissor; + } + + /** + * Define o valor da propriedade ipTransmissor. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIpTransmissor(String value) { + this.ipTransmissor = value; + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TProtBPe.java b/src/br/inf/portalfiscal/bpe/TProtBPe.java new file mode 100644 index 000000000..e1e44d2f2 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TProtBPe.java @@ -0,0 +1,436 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlID; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * Tipo Protocolo de status resultado do processamento do BP-e (Modelo 63) + * + *

Classe Java de TProtBPe complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TProtBPe">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="infProt">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+ *                   <element name="verAplic" type="{http://www.portalfiscal.inf.br/bpe}TVerAplic"/>
+ *                   <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe"/>
+ *                   <element name="dhRecbto" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+ *                   <element name="nProt" type="{http://www.portalfiscal.inf.br/bpe}TProt" minOccurs="0"/>
+ *                   <element name="digVal" type="{http://www.w3.org/2000/09/xmldsig#}DigestValueType" minOccurs="0"/>
+ *                   <element name="cStat">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TStat">
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="xMotivo" type="{http://www.portalfiscal.inf.br/bpe}TMotivo"/>
+ *                 </sequence>
+ *                 <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" />
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element ref="{http://www.w3.org/2000/09/xmldsig#}Signature" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="versao" use="required" type="{http://www.portalfiscal.inf.br/bpe}TVerBPe" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TProtBPe", propOrder = { + "infProt", +// "signature" +}) +public class TProtBPe { + + @XmlElement(required = true) + protected TProtBPe.InfProt infProt; +// @XmlElement(name = "Signature", namespace = "http://www.w3.org/2000/09/xmldsig#") +// protected SignatureType signature; + @XmlAttribute(name = "versao", required = true) + protected String versao; + + /** + * Obtém o valor da propriedade infProt. + * + * @return + * possible object is + * {@link TProtBPe.InfProt } + * + */ + public TProtBPe.InfProt getInfProt() { + return infProt; + } + + /** + * Define o valor da propriedade infProt. + * + * @param value + * allowed object is + * {@link TProtBPe.InfProt } + * + */ + public void setInfProt(TProtBPe.InfProt value) { + this.infProt = value; + } + + /** + * Obtém o valor da propriedade signature. + * + * @return + * possible object is + * {@link SignatureType } + * + */ +// public SignatureType getSignature() { +// return signature; +// } + + /** + * Define o valor da propriedade signature. + * + * @param value + * allowed object is + * {@link SignatureType } + * +// */ +// public void setSignature(SignatureType value) { +// this.signature = value; +// } + + /** + * Obtém o valor da propriedade versao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersao() { + return versao; + } + + /** + * Define o valor da propriedade versao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersao(String value) { + this.versao = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+     *         <element name="verAplic" type="{http://www.portalfiscal.inf.br/bpe}TVerAplic"/>
+     *         <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe"/>
+     *         <element name="dhRecbto" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+     *         <element name="nProt" type="{http://www.portalfiscal.inf.br/bpe}TProt" minOccurs="0"/>
+     *         <element name="digVal" type="{http://www.w3.org/2000/09/xmldsig#}DigestValueType" minOccurs="0"/>
+     *         <element name="cStat">
+     *           <simpleType>
+     *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TStat">
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="xMotivo" type="{http://www.portalfiscal.inf.br/bpe}TMotivo"/>
+     *       </sequence>
+     *       <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" />
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "tpAmb", + "verAplic", + "chBPe", + "dhRecbto", + "nProt", + /*"digVal",*/ + "cStat", + "xMotivo" + }) + public static class InfProt { + + @XmlElement(required = true) + protected String tpAmb; + @XmlElement(required = true) + protected String verAplic; + @XmlElement(required = true) + protected String chBPe; + @XmlElement(required = true) + protected String dhRecbto; + protected String nProt; +// protected byte[] digVal; + @XmlElement(required = true) + protected String cStat; + @XmlElement(required = true) + protected String xMotivo; + @XmlAttribute(name = "Id") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlID + @XmlSchemaType(name = "ID") + protected String id; + + /** + * Obtém o valor da propriedade tpAmb. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpAmb() { + return tpAmb; + } + + /** + * Define o valor da propriedade tpAmb. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpAmb(String value) { + this.tpAmb = value; + } + + /** + * Obtém o valor da propriedade verAplic. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVerAplic() { + return verAplic; + } + + /** + * Define o valor da propriedade verAplic. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVerAplic(String value) { + this.verAplic = value; + } + + /** + * Obtém o valor da propriedade chBPe. + * + * @return + * possible object is + * {@link String } + * + */ + public String getChBPe() { + return chBPe; + } + + /** + * Define o valor da propriedade chBPe. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setChBPe(String value) { + this.chBPe = value; + } + + /** + * Obtém o valor da propriedade dhRecbto. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDhRecbto() { + return dhRecbto; + } + + /** + * Define o valor da propriedade dhRecbto. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDhRecbto(String value) { + this.dhRecbto = value; + } + + /** + * Obtém o valor da propriedade nProt. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNProt() { + return nProt; + } + + /** + * Define o valor da propriedade nProt. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNProt(String value) { + this.nProt = value; + } + +// /** +// * Obtém o valor da propriedade digVal. +// * +// * @return +// * possible object is +// * byte[] +// */ +// public byte[] getDigVal() { +// return digVal; +// } +// +// /** +// * Define o valor da propriedade digVal. +// * +// * @param value +// * allowed object is +// * byte[] +// */ +// public void setDigVal(byte[] value) { +// this.digVal = value; +// } + + /** + * Obtém o valor da propriedade cStat. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCStat() { + return cStat; + } + + /** + * Define o valor da propriedade cStat. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCStat(String value) { + this.cStat = value; + } + + /** + * Obtém o valor da propriedade xMotivo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXMotivo() { + return xMotivo; + } + + /** + * Define o valor da propriedade xMotivo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXMotivo(String value) { + this.xMotivo = value; + } + + /** + * Obtém o valor da propriedade id. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Define o valor da propriedade id. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TRetBPe.java b/src/br/inf/portalfiscal/bpe/TRetBPe.java new file mode 100644 index 000000000..75944763b --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TRetBPe.java @@ -0,0 +1,240 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * Tipo Retorno do Pedido de Autorização de BP-e (Modelo 63) + * + *

Classe Java de TRetBPe complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TRetBPe">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+ *         <element name="cUF" type="{http://www.portalfiscal.inf.br/bpe}TCodUfIBGE"/>
+ *         <element name="verAplic" type="{http://www.portalfiscal.inf.br/bpe}TVerAplic"/>
+ *         <element name="cStat" type="{http://www.portalfiscal.inf.br/bpe}TStat"/>
+ *         <element name="xMotivo" type="{http://www.portalfiscal.inf.br/bpe}TMotivo"/>
+ *         <element name="protBPe" type="{http://www.portalfiscal.inf.br/bpe}TProtBPe" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="versao" use="required" type="{http://www.portalfiscal.inf.br/bpe}TVerBPe" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlRootElement(name = "retBPe") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "retBPe", propOrder = { + "tpAmb", + "cuf", + "verAplic", + "cStat", + "xMotivo", + "protBPe" +}) +public class TRetBPe { + + @XmlElement(required = true) + protected String tpAmb; + @XmlElement(name = "cUF", required = true) + protected String cuf; + @XmlElement(required = true) + protected String verAplic; + @XmlElement(required = true) + protected String cStat; + @XmlElement(required = true) + protected String xMotivo; + protected TProtBPe protBPe; + @XmlAttribute(name = "versao", required = true) + protected String versao; + + /** + * Obtém o valor da propriedade tpAmb. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpAmb() { + return tpAmb; + } + + /** + * Define o valor da propriedade tpAmb. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpAmb(String value) { + this.tpAmb = value; + } + + /** + * Obtém o valor da propriedade cuf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCUF() { + return cuf; + } + + /** + * Define o valor da propriedade cuf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCUF(String value) { + this.cuf = value; + } + + /** + * Obtém o valor da propriedade verAplic. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVerAplic() { + return verAplic; + } + + /** + * Define o valor da propriedade verAplic. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVerAplic(String value) { + this.verAplic = value; + } + + /** + * Obtém o valor da propriedade cStat. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCStat() { + return cStat; + } + + /** + * Define o valor da propriedade cStat. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCStat(String value) { + this.cStat = value; + } + + /** + * Obtém o valor da propriedade xMotivo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXMotivo() { + return xMotivo; + } + + /** + * Define o valor da propriedade xMotivo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXMotivo(String value) { + this.xMotivo = value; + } + + /** + * Obtém o valor da propriedade protBPe. + * + * @return + * possible object is + * {@link TProtBPe } + * + */ + public TProtBPe getProtBPe() { + return protBPe; + } + + /** + * Define o valor da propriedade protBPe. + * + * @param value + * allowed object is + * {@link TProtBPe } + * + */ + public void setProtBPe(TProtBPe value) { + this.protBPe = value; + } + + /** + * Obtém o valor da propriedade versao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersao() { + return versao; + } + + /** + * Define o valor da propriedade versao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersao(String value) { + this.versao = value; + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TRetConsStatServ.java b/src/br/inf/portalfiscal/bpe/TRetConsStatServ.java new file mode 100644 index 000000000..e1ee6df33 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TRetConsStatServ.java @@ -0,0 +1,343 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.07 às 09:45:52 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import java.math.BigInteger; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * Tipo Resultado da Consulta do Status do Serviço BP-e + * + *

Classe Java de TRetConsStatServ complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TRetConsStatServ">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+ *         <element name="verAplic">
+ *           <simpleType>
+ *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TVerAplic">
+ *               <whiteSpace value="collapse"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="cStat" type="{http://www.portalfiscal.inf.br/bpe}TStat"/>
+ *         <element name="xMotivo" type="{http://www.portalfiscal.inf.br/bpe}TMotivo"/>
+ *         <element name="cUF" type="{http://www.portalfiscal.inf.br/bpe}TCodUfIBGE"/>
+ *         <element name="dhRecbto" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+ *         <element name="tMed" minOccurs="0">
+ *           <simpleType>
+ *             <restriction base="{http://www.w3.org/2001/XMLSchema}integer">
+ *               <pattern value="[0-9]{1,4}"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *         <element name="dhRetorno" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC" minOccurs="0"/>
+ *         <element name="xObs" minOccurs="0">
+ *           <simpleType>
+ *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *               <minLength value="1"/>
+ *               <maxLength value="255"/>
+ *               <whiteSpace value="collapse"/>
+ *             </restriction>
+ *           </simpleType>
+ *         </element>
+ *       </sequence>
+ *       <attribute name="versao" use="required" type="{http://www.portalfiscal.inf.br/bpe}TVerConsStat" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlRootElement(name = "retConsStatServBPe") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "retConsStatServBPe", propOrder = { + "tpAmb", + "verAplic", + "cStat", + "xMotivo", + "cuf", + "dhRecbto", + "tMed", + "dhRetorno", + "xObs" +}) +public class TRetConsStatServ { + + @XmlElement(required = true) + protected String tpAmb; + @XmlElement(required = true) + protected String verAplic; + @XmlElement(required = true) + protected String cStat; + @XmlElement(required = true) + protected String xMotivo; + @XmlElement(name = "cUF", required = true) + protected String cuf; + @XmlElement(required = true) + protected String dhRecbto; + protected BigInteger tMed; + protected String dhRetorno; + protected String xObs; + @XmlAttribute(name = "versao", required = true) + protected String versao; + + /** + * Obtém o valor da propriedade tpAmb. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpAmb() { + return tpAmb; + } + + /** + * Define o valor da propriedade tpAmb. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpAmb(String value) { + this.tpAmb = value; + } + + /** + * Obtém o valor da propriedade verAplic. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVerAplic() { + return verAplic; + } + + /** + * Define o valor da propriedade verAplic. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVerAplic(String value) { + this.verAplic = value; + } + + /** + * Obtém o valor da propriedade cStat. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCStat() { + return cStat; + } + + /** + * Define o valor da propriedade cStat. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCStat(String value) { + this.cStat = value; + } + + /** + * Obtém o valor da propriedade xMotivo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXMotivo() { + return xMotivo; + } + + /** + * Define o valor da propriedade xMotivo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXMotivo(String value) { + this.xMotivo = value; + } + + /** + * Obtém o valor da propriedade cuf. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCUF() { + return cuf; + } + + /** + * Define o valor da propriedade cuf. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCUF(String value) { + this.cuf = value; + } + + /** + * Obtém o valor da propriedade dhRecbto. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDhRecbto() { + return dhRecbto; + } + + /** + * Define o valor da propriedade dhRecbto. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDhRecbto(String value) { + this.dhRecbto = value; + } + + /** + * Obtém o valor da propriedade tMed. + * + * @return + * possible object is + * {@link BigInteger } + * + */ + public BigInteger getTMed() { + return tMed; + } + + /** + * Define o valor da propriedade tMed. + * + * @param value + * allowed object is + * {@link BigInteger } + * + */ + public void setTMed(BigInteger value) { + this.tMed = value; + } + + /** + * Obtém o valor da propriedade dhRetorno. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDhRetorno() { + return dhRetorno; + } + + /** + * Define o valor da propriedade dhRetorno. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDhRetorno(String value) { + this.dhRetorno = value; + } + + /** + * Obtém o valor da propriedade xObs. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXObs() { + return xObs; + } + + /** + * Define o valor da propriedade xObs. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXObs(String value) { + this.xObs = value; + } + + /** + * Obtém o valor da propriedade versao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersao() { + return versao; + } + + /** + * Define o valor da propriedade versao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersao(String value) { + this.versao = value; + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TRetEvento.java b/src/br/inf/portalfiscal/bpe/TRetEvento.java new file mode 100644 index 000000000..dd543906b --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TRetEvento.java @@ -0,0 +1,571 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.29 às 06:11:44 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlID; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.w3._2000._09.xmldsig_.SignatureType; + + +/** + * Tipo retorno do Evento + * + *

Classe Java de TRetEvento complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TRetEvento">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="infEvento">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+ *                   <element name="verAplic" type="{http://www.portalfiscal.inf.br/bpe}TVerAplic"/>
+ *                   <element name="cOrgao" type="{http://www.portalfiscal.inf.br/bpe}TCOrgaoIBGE"/>
+ *                   <element name="cStat" type="{http://www.portalfiscal.inf.br/bpe}TStat"/>
+ *                   <element name="xMotivo" type="{http://www.portalfiscal.inf.br/bpe}TMotivo"/>
+ *                   <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe" minOccurs="0"/>
+ *                   <element name="tpEvento" minOccurs="0">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <pattern value="[0-9]{6}"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="xEvento" minOccurs="0">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                         <minLength value="4"/>
+ *                         <maxLength value="60"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="nSeqEvento" minOccurs="0">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <pattern value="[1-9][0-9]|0?[1-9]"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="dhRegEvento" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC" minOccurs="0"/>
+ *                   <element name="nProt" type="{http://www.portalfiscal.inf.br/bpe}TProt" minOccurs="0"/>
+ *                 </sequence>
+ *                 <attribute name="Id">
+ *                   <simpleType>
+ *                     <restriction base="{http://www.w3.org/2001/XMLSchema}ID">
+ *                       <pattern value="ID[0-9]{15}"/>
+ *                     </restriction>
+ *                   </simpleType>
+ *                 </attribute>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element ref="{http://www.w3.org/2000/09/xmldsig#}Signature" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="versao" use="required">
+ *         <simpleType>
+ *           <restriction base="{http://www.portalfiscal.inf.br/bpe}TVerEvento">
+ *           </restriction>
+ *         </simpleType>
+ *       </attribute>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlRootElement(name = "retEventoBPe") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "retEventoBPe", propOrder = { + "infEvento", +// "signature" +}) +public class TRetEvento { + + @XmlElement(required = true) + protected TRetEvento.InfEvento infEvento; +// @XmlElement(name = "Signature", namespace = "http://www.w3.org/2000/09/xmldsig#") +// protected SignatureType signature; + @XmlAttribute(name = "versao", required = true) + protected String versao; + + /** + * Obtém o valor da propriedade infEvento. + * + * @return + * possible object is + * {@link TRetEvento.InfEvento } + * + */ + public TRetEvento.InfEvento getInfEvento() { + return infEvento; + } + + /** + * Define o valor da propriedade infEvento. + * + * @param value + * allowed object is + * {@link TRetEvento.InfEvento } + * + */ + public void setInfEvento(TRetEvento.InfEvento value) { + this.infEvento = value; + } + + /** + * Obtém o valor da propriedade signature. + * + * @return + * possible object is + * {@link SignatureType } + * + */ +// public SignatureType getSignature() { +// return signature; +// } + + /** + * Define o valor da propriedade signature. + * + * @param value + * allowed object is + * {@link SignatureType } + * + */ +// public void setSignature(SignatureType value) { +// this.signature = value; +// } + + /** + * Obtém o valor da propriedade versao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersao() { + return versao; + } + + /** + * Define o valor da propriedade versao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersao(String value) { + this.versao = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+     *         <element name="verAplic" type="{http://www.portalfiscal.inf.br/bpe}TVerAplic"/>
+     *         <element name="cOrgao" type="{http://www.portalfiscal.inf.br/bpe}TCOrgaoIBGE"/>
+     *         <element name="cStat" type="{http://www.portalfiscal.inf.br/bpe}TStat"/>
+     *         <element name="xMotivo" type="{http://www.portalfiscal.inf.br/bpe}TMotivo"/>
+     *         <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe" minOccurs="0"/>
+     *         <element name="tpEvento" minOccurs="0">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <pattern value="[0-9]{6}"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="xEvento" minOccurs="0">
+     *           <simpleType>
+     *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *               <minLength value="4"/>
+     *               <maxLength value="60"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="nSeqEvento" minOccurs="0">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <pattern value="[1-9][0-9]|0?[1-9]"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="dhRegEvento" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC" minOccurs="0"/>
+     *         <element name="nProt" type="{http://www.portalfiscal.inf.br/bpe}TProt" minOccurs="0"/>
+     *       </sequence>
+     *       <attribute name="Id">
+     *         <simpleType>
+     *           <restriction base="{http://www.w3.org/2001/XMLSchema}ID">
+     *             <pattern value="ID[0-9]{15}"/>
+     *           </restriction>
+     *         </simpleType>
+     *       </attribute>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "tpAmb", + "verAplic", + "cOrgao", + "cStat", + "xMotivo", + "chBPe", + "tpEvento", + "xEvento", + "nSeqEvento", + "dhRegEvento", + "nProt" + }) + public static class InfEvento { + + @XmlElement(required = true) + protected String tpAmb; + @XmlElement(required = true) + protected String verAplic; + @XmlElement(required = true) + protected String cOrgao; + @XmlElement(required = true) + protected String cStat; + @XmlElement(required = true) + protected String xMotivo; + protected String chBPe; + protected String tpEvento; + protected String xEvento; + protected String nSeqEvento; + protected String dhRegEvento; + protected String nProt; + @XmlAttribute(name = "Id") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlID + protected String id; + + /** + * Obtém o valor da propriedade tpAmb. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpAmb() { + return tpAmb; + } + + /** + * Define o valor da propriedade tpAmb. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpAmb(String value) { + this.tpAmb = value; + } + + /** + * Obtém o valor da propriedade verAplic. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVerAplic() { + return verAplic; + } + + /** + * Define o valor da propriedade verAplic. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVerAplic(String value) { + this.verAplic = value; + } + + /** + * Obtém o valor da propriedade cOrgao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCOrgao() { + return cOrgao; + } + + /** + * Define o valor da propriedade cOrgao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCOrgao(String value) { + this.cOrgao = value; + } + + /** + * Obtém o valor da propriedade cStat. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCStat() { + return cStat; + } + + /** + * Define o valor da propriedade cStat. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCStat(String value) { + this.cStat = value; + } + + /** + * Obtém o valor da propriedade xMotivo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXMotivo() { + return xMotivo; + } + + /** + * Define o valor da propriedade xMotivo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXMotivo(String value) { + this.xMotivo = value; + } + + /** + * Obtém o valor da propriedade chBPe. + * + * @return + * possible object is + * {@link String } + * + */ + public String getChBPe() { + return chBPe; + } + + /** + * Define o valor da propriedade chBPe. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setChBPe(String value) { + this.chBPe = value; + } + + /** + * Obtém o valor da propriedade tpEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpEvento() { + return tpEvento; + } + + /** + * Define o valor da propriedade tpEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpEvento(String value) { + this.tpEvento = value; + } + + /** + * Obtém o valor da propriedade xEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXEvento() { + return xEvento; + } + + /** + * Define o valor da propriedade xEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXEvento(String value) { + this.xEvento = value; + } + + /** + * Obtém o valor da propriedade nSeqEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNSeqEvento() { + return nSeqEvento; + } + + /** + * Define o valor da propriedade nSeqEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNSeqEvento(String value) { + this.nSeqEvento = value; + } + + /** + * Obtém o valor da propriedade dhRegEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDhRegEvento() { + return dhRegEvento; + } + + /** + * Define o valor da propriedade dhRegEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDhRegEvento(String value) { + this.dhRegEvento = value; + } + + /** + * Obtém o valor da propriedade nProt. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNProt() { + return nProt; + } + + /** + * Define o valor da propriedade nProt. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNProt(String value) { + this.nProt = value; + } + + /** + * Obtém o valor da propriedade id. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Define o valor da propriedade id. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TUf.java b/src/br/inf/portalfiscal/bpe/TUf.java new file mode 100644 index 000000000..e79b861f7 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TUf.java @@ -0,0 +1,98 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Classe Java de TUf. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + *

+ *

+ * <simpleType name="TUf">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <whiteSpace value="preserve"/>
+ *     <enumeration value="AC"/>
+ *     <enumeration value="AL"/>
+ *     <enumeration value="AM"/>
+ *     <enumeration value="AP"/>
+ *     <enumeration value="BA"/>
+ *     <enumeration value="CE"/>
+ *     <enumeration value="DF"/>
+ *     <enumeration value="ES"/>
+ *     <enumeration value="GO"/>
+ *     <enumeration value="MA"/>
+ *     <enumeration value="MG"/>
+ *     <enumeration value="MS"/>
+ *     <enumeration value="MT"/>
+ *     <enumeration value="PA"/>
+ *     <enumeration value="PB"/>
+ *     <enumeration value="PE"/>
+ *     <enumeration value="PI"/>
+ *     <enumeration value="PR"/>
+ *     <enumeration value="RJ"/>
+ *     <enumeration value="RN"/>
+ *     <enumeration value="RO"/>
+ *     <enumeration value="RR"/>
+ *     <enumeration value="RS"/>
+ *     <enumeration value="SC"/>
+ *     <enumeration value="SE"/>
+ *     <enumeration value="SP"/>
+ *     <enumeration value="TO"/>
+ *     <enumeration value="EX"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "TUf") +@XmlEnum +public enum TUf { + + AC, + AL, + AM, + AP, + BA, + CE, + DF, + ES, + GO, + MA, + MG, + MS, + MT, + PA, + PB, + PE, + PI, + PR, + RJ, + RN, + RO, + RR, + RS, + SC, + SE, + SP, + TO, + EX; + + public String value() { + return name(); + } + + public static TUf fromValue(String v) { + return valueOf(v); + } + +} diff --git a/src/br/inf/portalfiscal/bpe/TUfSemEX.java b/src/br/inf/portalfiscal/bpe/TUfSemEX.java new file mode 100644 index 000000000..49bef6e55 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/TUfSemEX.java @@ -0,0 +1,96 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Classe Java de TUf_sem_EX. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + *

+ *

+ * <simpleType name="TUf_sem_EX">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <whiteSpace value="preserve"/>
+ *     <enumeration value="AC"/>
+ *     <enumeration value="AL"/>
+ *     <enumeration value="AM"/>
+ *     <enumeration value="AP"/>
+ *     <enumeration value="BA"/>
+ *     <enumeration value="CE"/>
+ *     <enumeration value="DF"/>
+ *     <enumeration value="ES"/>
+ *     <enumeration value="GO"/>
+ *     <enumeration value="MA"/>
+ *     <enumeration value="MG"/>
+ *     <enumeration value="MS"/>
+ *     <enumeration value="MT"/>
+ *     <enumeration value="PA"/>
+ *     <enumeration value="PB"/>
+ *     <enumeration value="PE"/>
+ *     <enumeration value="PI"/>
+ *     <enumeration value="PR"/>
+ *     <enumeration value="RJ"/>
+ *     <enumeration value="RN"/>
+ *     <enumeration value="RO"/>
+ *     <enumeration value="RR"/>
+ *     <enumeration value="RS"/>
+ *     <enumeration value="SC"/>
+ *     <enumeration value="SE"/>
+ *     <enumeration value="SP"/>
+ *     <enumeration value="TO"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "TUf_sem_EX") +@XmlEnum +public enum TUfSemEX { + + AC, + AL, + AM, + AP, + BA, + CE, + DF, + ES, + GO, + MA, + MG, + MS, + MT, + PA, + PB, + PE, + PI, + PR, + RJ, + RN, + RO, + RR, + RS, + SC, + SE, + SP, + TO; + + public String value() { + return name(); + } + + public static TUfSemEX fromValue(String v) { + return valueOf(v); + } + +} diff --git a/src/br/inf/portalfiscal/bpe/evento/TEvento.java b/src/br/inf/portalfiscal/bpe/evento/TEvento.java new file mode 100644 index 000000000..af5f35625 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/evento/TEvento.java @@ -0,0 +1,599 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.29 às 06:11:44 PM BRT +// + + +package br.inf.portalfiscal.bpe.evento; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAnyElement; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlID; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +import org.w3c.dom.Element; + + +/** + * Tipo Evento + * + *

Classe Java de TEvento complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TEvento">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="infEvento">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="cOrgao" type="{http://www.portalfiscal.inf.br/bpe}TCOrgaoIBGE"/>
+ *                   <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+ *                   <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj"/>
+ *                   <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe"/>
+ *                   <element name="dhEvento" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+ *                   <element name="tpEvento">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <pattern value="[0-9]{6}"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="nSeqEvento">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <pattern value="[1-9][0-9]|0?[1-9]"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="detEvento">
+ *                     <complexType>
+ *                       <complexContent>
+ *                         <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                           <sequence>
+ *                             <any processContents='skip'/>
+ *                           </sequence>
+ *                           <attribute name="versaoEvento" use="required">
+ *                             <simpleType>
+ *                               <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                                 <whiteSpace value="preserve"/>
+ *                                 <pattern value="1\.(0[0-9]|[1-9][0-9])"/>
+ *                               </restriction>
+ *                             </simpleType>
+ *                           </attribute>
+ *                         </restriction>
+ *                       </complexContent>
+ *                     </complexType>
+ *                   </element>
+ *                 </sequence>
+ *                 <attribute name="Id" use="required">
+ *                   <simpleType>
+ *                     <restriction base="{http://www.w3.org/2001/XMLSchema}ID">
+ *                       <pattern value="ID[0-9]{52}"/>
+ *                     </restriction>
+ *                   </simpleType>
+ *                 </attribute>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element ref="{http://www.w3.org/2000/09/xmldsig#}Signature"/>
+ *       </sequence>
+ *       <attribute name="versao" use="required" type="{http://www.portalfiscal.inf.br/bpe}TVerEvento" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TEvento", propOrder = { + "infEvento", +// "signature" +}) +@XmlRootElement(name = "eventoBPe") +public class TEvento { + + @XmlElement(required = true) + protected TEvento.InfEvento infEvento; +// @XmlElement(name = "Signature" required = true) +// protected SignatureType signature; + @XmlAttribute(name = "versao", required = true) + protected String versao; + + /** + * Obtém o valor da propriedade infEvento. + * + * @return + * possible object is + * {@link TEvento.InfEvento } + * + */ + public TEvento.InfEvento getInfEvento() { + return infEvento; + } + + /** + * Define o valor da propriedade infEvento. + * + * @param value + * allowed object is + * {@link TEvento.InfEvento } + * + */ + public void setInfEvento(TEvento.InfEvento value) { + this.infEvento = value; + } + + /** + * Obtém o valor da propriedade signature. + * + * @return + * possible object is + * {@link SignatureType } + * + */ +// public SignatureType getSignature() { +// return signature; +// } + + /** + * Define o valor da propriedade signature. + * + * @param value + * allowed object is + * {@link SignatureType } + * + */ +// public void setSignature(SignatureType value) { +// this.signature = value; +// } + + /** + * Obtém o valor da propriedade versao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersao() { + return versao; + } + + /** + * Define o valor da propriedade versao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersao(String value) { + this.versao = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="cOrgao" type="{http://www.portalfiscal.inf.br/bpe}TCOrgaoIBGE"/>
+     *         <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+     *         <element name="CNPJ" type="{http://www.portalfiscal.inf.br/bpe}TCnpj"/>
+     *         <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe"/>
+     *         <element name="dhEvento" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC"/>
+     *         <element name="tpEvento">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <pattern value="[0-9]{6}"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="nSeqEvento">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <pattern value="[1-9][0-9]|0?[1-9]"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="detEvento">
+     *           <complexType>
+     *             <complexContent>
+     *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *                 <sequence>
+     *                   <any processContents='skip'/>
+     *                 </sequence>
+     *                 <attribute name="versaoEvento" use="required">
+     *                   <simpleType>
+     *                     <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *                       <whiteSpace value="preserve"/>
+     *                       <pattern value="1\.(0[0-9]|[1-9][0-9])"/>
+     *                     </restriction>
+     *                   </simpleType>
+     *                 </attribute>
+     *               </restriction>
+     *             </complexContent>
+     *           </complexType>
+     *         </element>
+     *       </sequence>
+     *       <attribute name="Id" use="required">
+     *         <simpleType>
+     *           <restriction base="{http://www.w3.org/2001/XMLSchema}ID">
+     *             <pattern value="ID[0-9]{52}"/>
+     *           </restriction>
+     *         </simpleType>
+     *       </attribute>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "cOrgao", + "tpAmb", + "cnpj", + "chBPe", + "dhEvento", + "tpEvento", + "nSeqEvento", + "detEvento" + }) + public static class InfEvento { + + @XmlElement(required = true) + protected String cOrgao; + @XmlElement(required = true) + protected String tpAmb; + @XmlElement(name = "CNPJ", required = true) + protected String cnpj; + @XmlElement(required = true) + protected String chBPe; + @XmlElement(required = true) + protected String dhEvento; + @XmlElement(required = true) + protected String tpEvento; + @XmlElement(required = true) + protected String nSeqEvento; + @XmlElement(required = true) + protected TEvento.InfEvento.DetEvento detEvento; + @XmlAttribute(name = "Id", required = true) + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlID + protected String id; + + /** + * Obtém o valor da propriedade cOrgao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCOrgao() { + return cOrgao; + } + + /** + * Define o valor da propriedade cOrgao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCOrgao(String value) { + this.cOrgao = value; + } + + /** + * Obtém o valor da propriedade tpAmb. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpAmb() { + return tpAmb; + } + + /** + * Define o valor da propriedade tpAmb. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpAmb(String value) { + this.tpAmb = value; + } + + /** + * Obtém o valor da propriedade cnpj. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCNPJ() { + return cnpj; + } + + /** + * Define o valor da propriedade cnpj. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCNPJ(String value) { + this.cnpj = value; + } + + /** + * Obtém o valor da propriedade chBPe. + * + * @return + * possible object is + * {@link String } + * + */ + public String getChBPe() { + return chBPe; + } + + /** + * Define o valor da propriedade chBPe. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setChBPe(String value) { + this.chBPe = value; + } + + /** + * Obtém o valor da propriedade dhEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDhEvento() { + return dhEvento; + } + + /** + * Define o valor da propriedade dhEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDhEvento(String value) { + this.dhEvento = value; + } + + /** + * Obtém o valor da propriedade tpEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpEvento() { + return tpEvento; + } + + /** + * Define o valor da propriedade tpEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpEvento(String value) { + this.tpEvento = value; + } + + /** + * Obtém o valor da propriedade nSeqEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNSeqEvento() { + return nSeqEvento; + } + + /** + * Define o valor da propriedade nSeqEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNSeqEvento(String value) { + this.nSeqEvento = value; + } + + /** + * Obtém o valor da propriedade detEvento. + * + * @return + * possible object is + * {@link TEvento.InfEvento.DetEvento } + * + */ + public TEvento.InfEvento.DetEvento getDetEvento() { + return detEvento; + } + + /** + * Define o valor da propriedade detEvento. + * + * @param value + * allowed object is + * {@link TEvento.InfEvento.DetEvento } + * + */ + public void setDetEvento(TEvento.InfEvento.DetEvento value) { + this.detEvento = value; + } + + /** + * Obtém o valor da propriedade id. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Define o valor da propriedade id. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+         * <complexType>
+         *   <complexContent>
+         *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+         *       <sequence>
+         *         <any processContents='skip'/>
+         *       </sequence>
+         *       <attribute name="versaoEvento" use="required">
+         *         <simpleType>
+         *           <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+         *             <whiteSpace value="preserve"/>
+         *             <pattern value="1\.(0[0-9]|[1-9][0-9])"/>
+         *           </restriction>
+         *         </simpleType>
+         *       </attribute>
+         *     </restriction>
+         *   </complexContent>
+         * </complexType>
+         * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "", propOrder = { + "any" + }) + public static class DetEvento { + + @XmlAnyElement + protected Element any; + @XmlAttribute(name = "versaoEvento", required = true) + protected String versaoEvento; + + + /** + * Obtém o valor da propriedade any. + * + * @return + * possible object is + * {@link Element } + * + */ + public Element getAny() { + return any; + } + + /** + * Define o valor da propriedade any. + * + * @param value + * allowed object is + * {@link Element } + * + */ + public void setAny(Element value) { + this.any = value; + } + + /** + * Obtém o valor da propriedade versaoEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersaoEvento() { + return versaoEvento; + } + + /** + * Define o valor da propriedade versaoEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersaoEvento(String value) { + this.versaoEvento = value; + } + + } + + } + +} diff --git a/src/br/inf/portalfiscal/bpe/evento/TEventoMsg.java b/src/br/inf/portalfiscal/bpe/evento/TEventoMsg.java new file mode 100644 index 000000000..ef789d388 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/evento/TEventoMsg.java @@ -0,0 +1,47 @@ +package br.inf.portalfiscal.bpe.evento; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TEventoMsg", propOrder = { + "eventoBPe", + "xmlns" +}) +@XmlRootElement(name = "bpeDadosMsg") +public class TEventoMsg { + @XmlElement(required = true) + protected TEvento eventoBPe; + + @XmlAttribute(name = "xmlns", required = true) + protected String xmlns; + + public TEventoMsg() { + super(); + } + + public TEventoMsg(TEvento eventoBPe) { + super(); + this.eventoBPe = eventoBPe; + } + + public TEvento getEventoBPe() { + return eventoBPe; + } + + public void setEventoBPe(TEvento eventoBPe) { + this.eventoBPe = eventoBPe; + } + + public String getXmlns() { + return xmlns; + } + + public void setXmlns(String xmlns) { + this.xmlns = xmlns; + } +} diff --git a/src/br/inf/portalfiscal/bpe/evento/TRetEvento.java b/src/br/inf/portalfiscal/bpe/evento/TRetEvento.java new file mode 100644 index 000000000..4a1ae326a --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/evento/TRetEvento.java @@ -0,0 +1,568 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.29 às 06:11:44 PM BRT +// + + +package br.inf.portalfiscal.bpe.evento; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlID; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + * Tipo retorno do Evento + * + *

Classe Java de TRetEvento complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TRetEvento">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="infEvento">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <sequence>
+ *                   <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+ *                   <element name="verAplic" type="{http://www.portalfiscal.inf.br/bpe}TVerAplic"/>
+ *                   <element name="cOrgao" type="{http://www.portalfiscal.inf.br/bpe}TCOrgaoIBGE"/>
+ *                   <element name="cStat" type="{http://www.portalfiscal.inf.br/bpe}TStat"/>
+ *                   <element name="xMotivo" type="{http://www.portalfiscal.inf.br/bpe}TMotivo"/>
+ *                   <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe" minOccurs="0"/>
+ *                   <element name="tpEvento" minOccurs="0">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <pattern value="[0-9]{6}"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="xEvento" minOccurs="0">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+ *                         <minLength value="4"/>
+ *                         <maxLength value="60"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="nSeqEvento" minOccurs="0">
+ *                     <simpleType>
+ *                       <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *                         <whiteSpace value="preserve"/>
+ *                         <pattern value="[1-9][0-9]|0?[1-9]"/>
+ *                       </restriction>
+ *                     </simpleType>
+ *                   </element>
+ *                   <element name="dhRegEvento" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC" minOccurs="0"/>
+ *                   <element name="nProt" type="{http://www.portalfiscal.inf.br/bpe}TProt" minOccurs="0"/>
+ *                 </sequence>
+ *                 <attribute name="Id">
+ *                   <simpleType>
+ *                     <restriction base="{http://www.w3.org/2001/XMLSchema}ID">
+ *                       <pattern value="ID[0-9]{15}"/>
+ *                     </restriction>
+ *                   </simpleType>
+ *                 </attribute>
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element ref="{http://www.w3.org/2000/09/xmldsig#}Signature" minOccurs="0"/>
+ *       </sequence>
+ *       <attribute name="versao" use="required">
+ *         <simpleType>
+ *           <restriction base="{http://www.portalfiscal.inf.br/bpe}TVerEvento">
+ *           </restriction>
+ *         </simpleType>
+ *       </attribute>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TRetEvento", propOrder = { + "infEvento", +// "signature" +}) +public class TRetEvento { + + @XmlElement(name = "infEvento", required = true) + protected TRetEvento.InfEvento infEvento; +// @XmlElement(name = "Signature", namespace = "http://www.w3.org/2000/09/xmldsig#") +// protected SignatureType signature; + @XmlAttribute(name = "versao", required = true) + protected String versao; + + /** + * Obtém o valor da propriedade infEvento. + * + * @return + * possible object is + * {@link TRetEvento.InfEvento } + * + */ + public TRetEvento.InfEvento getInfEvento() { + return infEvento; + } + + /** + * Define o valor da propriedade infEvento. + * + * @param value + * allowed object is + * {@link TRetEvento.InfEvento } + * + */ + public void setInfEvento(TRetEvento.InfEvento value) { + this.infEvento = value; + } + + /** + * Obtém o valor da propriedade signature. + * + * @return + * possible object is + * {@link SignatureType } + * + */ +// public SignatureType getSignature() { +// return signature; +// } + + /** + * Define o valor da propriedade signature. + * + * @param value + * allowed object is + * {@link SignatureType } + * + */ +// public void setSignature(SignatureType value) { +// this.signature = value; +// } + + /** + * Obtém o valor da propriedade versao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVersao() { + return versao; + } + + /** + * Define o valor da propriedade versao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVersao(String value) { + this.versao = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <sequence>
+     *         <element name="tpAmb" type="{http://www.portalfiscal.inf.br/bpe}TAmb"/>
+     *         <element name="verAplic" type="{http://www.portalfiscal.inf.br/bpe}TVerAplic"/>
+     *         <element name="cOrgao" type="{http://www.portalfiscal.inf.br/bpe}TCOrgaoIBGE"/>
+     *         <element name="cStat" type="{http://www.portalfiscal.inf.br/bpe}TStat"/>
+     *         <element name="xMotivo" type="{http://www.portalfiscal.inf.br/bpe}TMotivo"/>
+     *         <element name="chBPe" type="{http://www.portalfiscal.inf.br/bpe}TChDFe" minOccurs="0"/>
+     *         <element name="tpEvento" minOccurs="0">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <pattern value="[0-9]{6}"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="xEvento" minOccurs="0">
+     *           <simpleType>
+     *             <restriction base="{http://www.portalfiscal.inf.br/bpe}TString">
+     *               <minLength value="4"/>
+     *               <maxLength value="60"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="nSeqEvento" minOccurs="0">
+     *           <simpleType>
+     *             <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+     *               <whiteSpace value="preserve"/>
+     *               <pattern value="[1-9][0-9]|0?[1-9]"/>
+     *             </restriction>
+     *           </simpleType>
+     *         </element>
+     *         <element name="dhRegEvento" type="{http://www.portalfiscal.inf.br/bpe}TDateTimeUTC" minOccurs="0"/>
+     *         <element name="nProt" type="{http://www.portalfiscal.inf.br/bpe}TProt" minOccurs="0"/>
+     *       </sequence>
+     *       <attribute name="Id">
+     *         <simpleType>
+     *           <restriction base="{http://www.w3.org/2001/XMLSchema}ID">
+     *             <pattern value="ID[0-9]{15}"/>
+     *           </restriction>
+     *         </simpleType>
+     *       </attribute>
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "InfEvento", propOrder = { + "tpAmb", + "verAplic", + "cOrgao", + "cStat", + "xMotivo", + "chBPe", + "tpEvento", + "xEvento", + "nSeqEvento", + "dhRegEvento", + "nProt" + }) + public static class InfEvento { + + @XmlElement(name = "tpAmb", required = true) + protected String tpAmb; + @XmlElement(required = true) + protected String verAplic; + @XmlElement(required = true) + protected String cOrgao; + @XmlElement(name = "cStat", required = true) + protected String cStat; + @XmlElement(name = "xMotivo", required = true) + protected String xMotivo; + protected String chBPe; + protected String tpEvento; + protected String xEvento; + protected String nSeqEvento; + protected String dhRegEvento; + protected String nProt; + @XmlAttribute(name = "Id") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlID + protected String id; + + /** + * Obtém o valor da propriedade tpAmb. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpAmb() { + return tpAmb; + } + + /** + * Define o valor da propriedade tpAmb. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpAmb(String value) { + this.tpAmb = value; + } + + /** + * Obtém o valor da propriedade verAplic. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVerAplic() { + return verAplic; + } + + /** + * Define o valor da propriedade verAplic. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVerAplic(String value) { + this.verAplic = value; + } + + /** + * Obtém o valor da propriedade cOrgao. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCOrgao() { + return cOrgao; + } + + /** + * Define o valor da propriedade cOrgao. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCOrgao(String value) { + this.cOrgao = value; + } + + /** + * Obtém o valor da propriedade cStat. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCStat() { + return cStat; + } + + /** + * Define o valor da propriedade cStat. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCStat(String value) { + this.cStat = value; + } + + /** + * Obtém o valor da propriedade xMotivo. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXMotivo() { + return xMotivo; + } + + /** + * Define o valor da propriedade xMotivo. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXMotivo(String value) { + this.xMotivo = value; + } + + /** + * Obtém o valor da propriedade chBPe. + * + * @return + * possible object is + * {@link String } + * + */ + public String getChBPe() { + return chBPe; + } + + /** + * Define o valor da propriedade chBPe. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setChBPe(String value) { + this.chBPe = value; + } + + /** + * Obtém o valor da propriedade tpEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTpEvento() { + return tpEvento; + } + + /** + * Define o valor da propriedade tpEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTpEvento(String value) { + this.tpEvento = value; + } + + /** + * Obtém o valor da propriedade xEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getXEvento() { + return xEvento; + } + + /** + * Define o valor da propriedade xEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setXEvento(String value) { + this.xEvento = value; + } + + /** + * Obtém o valor da propriedade nSeqEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNSeqEvento() { + return nSeqEvento; + } + + /** + * Define o valor da propriedade nSeqEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNSeqEvento(String value) { + this.nSeqEvento = value; + } + + /** + * Obtém o valor da propriedade dhRegEvento. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDhRegEvento() { + return dhRegEvento; + } + + /** + * Define o valor da propriedade dhRegEvento. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDhRegEvento(String value) { + this.dhRegEvento = value; + } + + /** + * Obtém o valor da propriedade nProt. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNProt() { + return nProt; + } + + /** + * Define o valor da propriedade nProt. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNProt(String value) { + this.nProt = value; + } + + /** + * Obtém o valor da propriedade id. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Define o valor da propriedade id. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + } + +} diff --git a/src/br/inf/portalfiscal/bpe/evento/package-info.java b/src/br/inf/portalfiscal/bpe/evento/package-info.java new file mode 100644 index 000000000..8c592cce1 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/evento/package-info.java @@ -0,0 +1 @@ +package br.inf.portalfiscal.bpe.evento; diff --git a/src/br/inf/portalfiscal/bpe/package-info.java b/src/br/inf/portalfiscal/bpe/package-info.java new file mode 100644 index 000000000..fd01387e1 --- /dev/null +++ b/src/br/inf/portalfiscal/bpe/package-info.java @@ -0,0 +1,23 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.23 às 03:05:57 PM BRT +// +//@XmlSchema( +// namespace="", +// // If qualified namespace will be added to all elements +// elementFormDefault = XmlNsForm.QUALIFIED, +// // If qualifies namespace will be added to all attributes +// attributeFormDefault = XmlNsForm.UNQUALIFIED, +// xmlns = { +// @XmlNs(prefix = "bpe", namespaceURI = "http://www.portalfiscal.inf.br/bpe"), +//// @XmlNs(prefix = "xsi", namespaceURI = "http://www.portalfiscal.inf.br/bpe"), +// } +//) +@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.portalfiscal.inf.br/bpe", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package br.inf.portalfiscal.bpe; + +import javax.xml.bind.annotation.XmlNs; +import javax.xml.bind.annotation.XmlNsForm; +import javax.xml.bind.annotation.XmlSchema; diff --git a/src/com/rjconsultores/hstcajservice/ws/BilheteService.java b/src/com/rjconsultores/hstcajservice/ws/BilheteService.java new file mode 100644 index 000000000..88534c411 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/BilheteService.java @@ -0,0 +1,261 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.util.List; +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebResult; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlSeeAlso; +import javax.xml.ws.RequestWrapper; +import javax.xml.ws.ResponseWrapper; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.6 in JDK 6 + * Generated source version: 2.1 + * + */ +@WebService(name = "BilheteService", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/") +@XmlSeeAlso({ + ObjectFactory.class +}) +public interface BilheteService { + + + /** + * + * @param dataFim + * @param codEmpresaGrupo + * @param agenciaInicio + * @param fiscal + * @param dataInicio + * @param codEmpresa + * @param agenciaFim + * @return + * returns java.util.List + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "buscarBilhetes", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.BuscarBilhetes") + @ResponseWrapper(localName = "buscarBilhetesResponse", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.BuscarBilhetesResponse") + public List buscarBilhetes( + @WebParam(name = "dataInicio", targetNamespace = "") + String dataInicio, + @WebParam(name = "dataFim", targetNamespace = "") + String dataFim, + @WebParam(name = "agenciaInicio", targetNamespace = "") + String agenciaInicio, + @WebParam(name = "agenciaFim", targetNamespace = "") + String agenciaFim, + @WebParam(name = "codEmpresaGrupo", targetNamespace = "") + Integer codEmpresaGrupo, + @WebParam(name = "codEmpresa", targetNamespace = "") + String codEmpresa, + @WebParam(name = "fiscal", targetNamespace = "") + String fiscal); + + /** + * + * @param dataFim + * @param codEmpresaGrupo + * @param agenciaInicio + * @param fiscal + * @param dataInicio + * @param codEmpresa + * @param agenciaFim + * @return + * returns java.util.List + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "buscarBilhetesInconsistente", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.BuscarBilhetesInconsistente") + @ResponseWrapper(localName = "buscarBilhetesInconsistenteResponse", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.BuscarBilhetesInconsistenteResponse") + public List buscarBilhetesInconsistente( + @WebParam(name = "dataInicio", targetNamespace = "") + String dataInicio, + @WebParam(name = "dataFim", targetNamespace = "") + String dataFim, + @WebParam(name = "agenciaInicio", targetNamespace = "") + String agenciaInicio, + @WebParam(name = "agenciaFim", targetNamespace = "") + String agenciaFim, + @WebParam(name = "codEmpresaGrupo", targetNamespace = "") + Integer codEmpresaGrupo, + @WebParam(name = "codEmpresa", targetNamespace = "") + String codEmpresa, + @WebParam(name = "fiscal", targetNamespace = "") + String fiscal); + + /** + * + * @param codEmpresaGrupo + * @param agenciaInicio + * @param codEmpresa + * @param agenciaFim + * @return + * returns java.util.List + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "cadBilheteiro", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadBilheteiro") + @ResponseWrapper(localName = "cadBilheteiroResponse", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadBilheteiroResponse") + public List cadBilheteiro( + @WebParam(name = "agenciaInicio", targetNamespace = "") + String agenciaInicio, + @WebParam(name = "agenciaFim", targetNamespace = "") + String agenciaFim, + @WebParam(name = "codEmpresaGrupo", targetNamespace = "") + Integer codEmpresaGrupo, + @WebParam(name = "codEmpresa", targetNamespace = "") + String codEmpresa); + + /** + * + * @param codEmpresaGrupo + * @return + * returns java.util.List + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "cadEstado", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadEstado") + @ResponseWrapper(localName = "cadEstadoResponse", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadEstadoResponse") + public List cadEstado( + @WebParam(name = "codEmpresaGrupo", targetNamespace = "") + Integer codEmpresaGrupo); + + /** + * + * @param codEmpresaGrupo + * @return + * returns java.util.List + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "cadCliente", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadCliente") + @ResponseWrapper(localName = "cadClienteResponse", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadClienteResponse") + public List cadCliente( + @WebParam(name = "codEmpresaGrupo", targetNamespace = "") + Integer codEmpresaGrupo); + + /** + * + * @param codEmpresaGrupo + * @return + * returns java.util.List + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "cadLocalidade", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadLocalidade") + @ResponseWrapper(localName = "cadLocalidadeResponse", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadLocalidadeResponse") + public List cadLocalidade( + @WebParam(name = "codEmpresaGrupo", targetNamespace = "") + Integer codEmpresaGrupo); + + /** + * + * @param codEmpresaGrupo + * @return + * returns java.util.List + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "cadFormaPagamento", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadFormaPagamento") + @ResponseWrapper(localName = "cadFormaPagamentoResponse", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadFormaPagamentoResponse") + public List cadFormaPagamento( + @WebParam(name = "codEmpresaGrupo", targetNamespace = "") + Integer codEmpresaGrupo); + + /** + * + * @param codEmpresaGrupo + * @param codEmpresa + * @return + * returns java.util.List + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "cadLinha", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadLinha") + @ResponseWrapper(localName = "cadLinhaResponse", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadLinhaResponse") + public List cadLinha( + @WebParam(name = "codEmpresaGrupo", targetNamespace = "") + Integer codEmpresaGrupo, + @WebParam(name = "codEmpresa", targetNamespace = "") + String codEmpresa); + + /** + * + * @param codEmpresaGrupo + * @param codEmpresa + * @return + * returns java.util.List + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "cadBeneficio", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadBeneficio") + @ResponseWrapper(localName = "cadBeneficioResponse", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadBeneficioResponse") + public List cadBeneficio( + @WebParam(name = "codEmpresaGrupo", targetNamespace = "") + Integer codEmpresaGrupo, + @WebParam(name = "codEmpresa", targetNamespace = "") + String codEmpresa); + + /** + * + * @param codEmpresaGrupo + * @return + * returns java.util.List + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "cadReceitaDespesa", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadReceitaDespesa") + @ResponseWrapper(localName = "cadReceitaDespesaResponse", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadReceitaDespesaResponse") + public List cadReceitaDespesa( + @WebParam(name = "codEmpresaGrupo", targetNamespace = "") + Integer codEmpresaGrupo); + + /** + * + * @param codEmpresaGrupo + * @return + * returns java.util.List + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "cadAgencia", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadAgencia") + @ResponseWrapper(localName = "cadAgenciaResponse", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.CadAgenciaResponse") + public List cadAgencia( + @WebParam(name = "codEmpresaGrupo", targetNamespace = "") + Integer codEmpresaGrupo); + + /** + * + * @param dataFim + * @param codEmpresaGrupo + * @param agenciaInicio + * @param dataInicio + * @param codEmpresa + * @param agenciaFim + * @return + * returns java.util.List + */ + @WebMethod + @WebResult(targetNamespace = "") + @RequestWrapper(localName = "buscarReceitaDespesa", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.BuscarReceitaDespesa") + @ResponseWrapper(localName = "buscarReceitaDespesaResponse", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", className = "com.rjconsultores.hstcajservice.ws.BuscarReceitaDespesaResponse") + public List buscarReceitaDespesa( + @WebParam(name = "dataInicio", targetNamespace = "") + String dataInicio, + @WebParam(name = "dataFim", targetNamespace = "") + String dataFim, + @WebParam(name = "agenciaInicio", targetNamespace = "") + String agenciaInicio, + @WebParam(name = "agenciaFim", targetNamespace = "") + String agenciaFim, + @WebParam(name = "codEmpresaGrupo", targetNamespace = "") + Integer codEmpresaGrupo, + @WebParam(name = "codEmpresa", targetNamespace = "") + String codEmpresa); + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/BilheteServiceService.java b/src/com/rjconsultores/hstcajservice/ws/BilheteServiceService.java new file mode 100644 index 000000000..64208db32 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/BilheteServiceService.java @@ -0,0 +1,55 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.net.URL; +import java.util.logging.Logger; + +import javax.xml.namespace.QName; +import javax.xml.ws.Service; +import javax.xml.ws.WebEndpoint; +import javax.xml.ws.WebServiceClient; +import javax.xml.ws.WebServiceFeature; + + +/** + * This class was generated by the JAX-WS RI. + * JAX-WS RI 2.1.6 in JDK 6 + * Generated source version: 2.1 + * + */ +@WebServiceClient(name = "BilheteServiceService", targetNamespace = "http://ws.hstcajservice.rjconsultores.com/", wsdlLocation = "http://52.72.4.158:8280/WSIntegracao/BilheteService?wsdl") +public class BilheteServiceService + extends Service +{ + + + private final static Logger logger = Logger.getLogger(com.rjconsultores.hstcajservice.ws.BilheteServiceService.class.getName()); + + + public BilheteServiceService(URL wsdlLocation, QName serviceName) { + super(wsdlLocation, serviceName); + } + + /** + * + * @return + * returns BilheteService + */ + @WebEndpoint(name = "BilheteServicePort") + public BilheteService getBilheteServicePort() { + return super.getPort(new QName("http://ws.hstcajservice.rjconsultores.com/", "BilheteServicePort"), BilheteService.class); + } + + /** + * + * @param features + * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the features parameter will have their default values. + * @return + * returns BilheteService + */ + @WebEndpoint(name = "BilheteServicePort") + public BilheteService getBilheteServicePort(WebServiceFeature... features) { + return super.getPort(new QName("http://ws.hstcajservice.rjconsultores.com/", "BilheteServicePort"), BilheteService.class, features); + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/Bilhetes.java b/src/com/rjconsultores/hstcajservice/ws/Bilhetes.java new file mode 100644 index 000000000..49a57ed71 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/Bilhetes.java @@ -0,0 +1,25 @@ +package com.rjconsultores.hstcajservice.ws; + +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import com.rjconsultores.hstcajservice.ws.ExportaIntegracaoWS; +@XmlRootElement(name = "bilhetes") +@XmlAccessorType (XmlAccessType.FIELD) +public class Bilhetes { + @XmlElement(name = "bilhete") + private List bilhetes = null; + + public List getBilhete() { + return bilhetes; + } + + public void setBilhetes(List bilhete) { + this.bilhetes = bilhete; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/BuscarBilhetes.java b/src/com/rjconsultores/hstcajservice/ws/BuscarBilhetes.java new file mode 100644 index 000000000..b27aabff2 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/BuscarBilhetes.java @@ -0,0 +1,222 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for buscarBilhetes complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="buscarBilhetes">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="dataInicio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="dataFim" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="agenciaInicio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="agenciaFim" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codEmpresaGrupo" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="codEmpresa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fiscal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "buscarBilhetes", propOrder = { + "dataInicio", + "dataFim", + "agenciaInicio", + "agenciaFim", + "codEmpresaGrupo", + "codEmpresa", + "fiscal" +}) +public class BuscarBilhetes { + + protected String dataInicio; + protected String dataFim; + protected String agenciaInicio; + protected String agenciaFim; + protected Integer codEmpresaGrupo; + protected String codEmpresa; + protected String fiscal; + + /** + * Gets the value of the dataInicio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDataInicio() { + return dataInicio; + } + + /** + * Sets the value of the dataInicio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDataInicio(String value) { + this.dataInicio = value; + } + + /** + * Gets the value of the dataFim property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDataFim() { + return dataFim; + } + + /** + * Sets the value of the dataFim property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDataFim(String value) { + this.dataFim = value; + } + + /** + * Gets the value of the agenciaInicio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaInicio() { + return agenciaInicio; + } + + /** + * Sets the value of the agenciaInicio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaInicio(String value) { + this.agenciaInicio = value; + } + + /** + * Gets the value of the agenciaFim property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaFim() { + return agenciaFim; + } + + /** + * Sets the value of the agenciaFim property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaFim(String value) { + this.agenciaFim = value; + } + + /** + * Gets the value of the codEmpresaGrupo property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getCodEmpresaGrupo() { + return codEmpresaGrupo; + } + + /** + * Sets the value of the codEmpresaGrupo property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setCodEmpresaGrupo(Integer value) { + this.codEmpresaGrupo = value; + } + + /** + * Gets the value of the codEmpresa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEmpresa() { + return codEmpresa; + } + + /** + * Sets the value of the codEmpresa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEmpresa(String value) { + this.codEmpresa = value; + } + + /** + * Gets the value of the fiscal property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFiscal() { + return fiscal; + } + + /** + * Sets the value of the fiscal property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFiscal(String value) { + this.fiscal = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/BuscarBilhetesInconsistente.java b/src/com/rjconsultores/hstcajservice/ws/BuscarBilhetesInconsistente.java new file mode 100644 index 000000000..f89d7073d --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/BuscarBilhetesInconsistente.java @@ -0,0 +1,222 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for buscarBilhetesInconsistente complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="buscarBilhetesInconsistente">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="dataInicio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="dataFim" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="agenciaInicio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="agenciaFim" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codEmpresaGrupo" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="codEmpresa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="fiscal" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "buscarBilhetesInconsistente", propOrder = { + "dataInicio", + "dataFim", + "agenciaInicio", + "agenciaFim", + "codEmpresaGrupo", + "codEmpresa", + "fiscal" +}) +public class BuscarBilhetesInconsistente { + + protected String dataInicio; + protected String dataFim; + protected String agenciaInicio; + protected String agenciaFim; + protected Integer codEmpresaGrupo; + protected String codEmpresa; + protected String fiscal; + + /** + * Gets the value of the dataInicio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDataInicio() { + return dataInicio; + } + + /** + * Sets the value of the dataInicio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDataInicio(String value) { + this.dataInicio = value; + } + + /** + * Gets the value of the dataFim property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDataFim() { + return dataFim; + } + + /** + * Sets the value of the dataFim property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDataFim(String value) { + this.dataFim = value; + } + + /** + * Gets the value of the agenciaInicio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaInicio() { + return agenciaInicio; + } + + /** + * Sets the value of the agenciaInicio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaInicio(String value) { + this.agenciaInicio = value; + } + + /** + * Gets the value of the agenciaFim property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaFim() { + return agenciaFim; + } + + /** + * Sets the value of the agenciaFim property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaFim(String value) { + this.agenciaFim = value; + } + + /** + * Gets the value of the codEmpresaGrupo property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getCodEmpresaGrupo() { + return codEmpresaGrupo; + } + + /** + * Sets the value of the codEmpresaGrupo property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setCodEmpresaGrupo(Integer value) { + this.codEmpresaGrupo = value; + } + + /** + * Gets the value of the codEmpresa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEmpresa() { + return codEmpresa; + } + + /** + * Sets the value of the codEmpresa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEmpresa(String value) { + this.codEmpresa = value; + } + + /** + * Gets the value of the fiscal property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFiscal() { + return fiscal; + } + + /** + * Sets the value of the fiscal property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFiscal(String value) { + this.fiscal = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/BuscarBilhetesInconsistenteResponse.java b/src/com/rjconsultores/hstcajservice/ws/BuscarBilhetesInconsistenteResponse.java new file mode 100644 index 000000000..21a76c475 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/BuscarBilhetesInconsistenteResponse.java @@ -0,0 +1,69 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for buscarBilhetesInconsistenteResponse complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="buscarBilhetesInconsistenteResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://ws.hstcajservice.rjconsultores.com/}exportaIntegracaoWS" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "buscarBilhetesInconsistenteResponse", propOrder = { + "_return" +}) +public class BuscarBilhetesInconsistenteResponse { + + @XmlElement(name = "return") + protected List _return; + + /** + * Gets the value of the return property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the return property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getReturn().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ExportaIntegracaoWS } + * + * + */ + public List getReturn() { + if (_return == null) { + _return = new ArrayList(); + } + return this._return; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/BuscarBilhetesResponse.java b/src/com/rjconsultores/hstcajservice/ws/BuscarBilhetesResponse.java new file mode 100644 index 000000000..043ade7e9 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/BuscarBilhetesResponse.java @@ -0,0 +1,69 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for buscarBilhetesResponse complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="buscarBilhetesResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://ws.hstcajservice.rjconsultores.com/}exportaIntegracaoWS" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "buscarBilhetesResponse", propOrder = { + "_return" +}) +public class BuscarBilhetesResponse { + + @XmlElement(name = "return") + protected List _return; + + /** + * Gets the value of the return property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the return property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getReturn().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ExportaIntegracaoWS } + * + * + */ + public List getReturn() { + if (_return == null) { + _return = new ArrayList(); + } + return this._return; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/BuscarReceitaDespesa.java b/src/com/rjconsultores/hstcajservice/ws/BuscarReceitaDespesa.java new file mode 100644 index 000000000..abc07ce07 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/BuscarReceitaDespesa.java @@ -0,0 +1,195 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for buscarReceitaDespesa complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="buscarReceitaDespesa">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="dataInicio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="dataFim" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="agenciaInicio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="agenciaFim" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codEmpresaGrupo" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="codEmpresa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "buscarReceitaDespesa", propOrder = { + "dataInicio", + "dataFim", + "agenciaInicio", + "agenciaFim", + "codEmpresaGrupo", + "codEmpresa" +}) +public class BuscarReceitaDespesa { + + protected String dataInicio; + protected String dataFim; + protected String agenciaInicio; + protected String agenciaFim; + protected Integer codEmpresaGrupo; + protected String codEmpresa; + + /** + * Gets the value of the dataInicio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDataInicio() { + return dataInicio; + } + + /** + * Sets the value of the dataInicio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDataInicio(String value) { + this.dataInicio = value; + } + + /** + * Gets the value of the dataFim property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDataFim() { + return dataFim; + } + + /** + * Sets the value of the dataFim property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDataFim(String value) { + this.dataFim = value; + } + + /** + * Gets the value of the agenciaInicio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaInicio() { + return agenciaInicio; + } + + /** + * Sets the value of the agenciaInicio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaInicio(String value) { + this.agenciaInicio = value; + } + + /** + * Gets the value of the agenciaFim property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaFim() { + return agenciaFim; + } + + /** + * Sets the value of the agenciaFim property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaFim(String value) { + this.agenciaFim = value; + } + + /** + * Gets the value of the codEmpresaGrupo property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getCodEmpresaGrupo() { + return codEmpresaGrupo; + } + + /** + * Sets the value of the codEmpresaGrupo property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setCodEmpresaGrupo(Integer value) { + this.codEmpresaGrupo = value; + } + + /** + * Gets the value of the codEmpresa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEmpresa() { + return codEmpresa; + } + + /** + * Sets the value of the codEmpresa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEmpresa(String value) { + this.codEmpresa = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/BuscarReceitaDespesaResponse.java b/src/com/rjconsultores/hstcajservice/ws/BuscarReceitaDespesaResponse.java new file mode 100644 index 000000000..e3c401f7c --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/BuscarReceitaDespesaResponse.java @@ -0,0 +1,69 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for buscarReceitaDespesaResponse complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="buscarReceitaDespesaResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://ws.hstcajservice.rjconsultores.com/}exportaIntegracaoReceitaDespesaWS" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "buscarReceitaDespesaResponse", propOrder = { + "_return" +}) +public class BuscarReceitaDespesaResponse { + + @XmlElement(name = "return") + protected List _return; + + /** + * Gets the value of the return property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the return property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getReturn().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ExportaIntegracaoReceitaDespesaWS } + * + * + */ + public List getReturn() { + if (_return == null) { + _return = new ArrayList(); + } + return this._return; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadAgencia.java b/src/com/rjconsultores/hstcajservice/ws/CadAgencia.java new file mode 100644 index 000000000..da374c214 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadAgencia.java @@ -0,0 +1,60 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadAgencia complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadAgencia">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codEmpresaGrupo" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadAgencia", propOrder = { + "codEmpresaGrupo" +}) +public class CadAgencia { + + protected Integer codEmpresaGrupo; + + /** + * Gets the value of the codEmpresaGrupo property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getCodEmpresaGrupo() { + return codEmpresaGrupo; + } + + /** + * Sets the value of the codEmpresaGrupo property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setCodEmpresaGrupo(Integer value) { + this.codEmpresaGrupo = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadAgenciaResponse.java b/src/com/rjconsultores/hstcajservice/ws/CadAgenciaResponse.java new file mode 100644 index 000000000..f540ab136 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadAgenciaResponse.java @@ -0,0 +1,69 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadAgenciaResponse complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadAgenciaResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://ws.hstcajservice.rjconsultores.com/}exportaIntegracaoCadAgenciaWS" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadAgenciaResponse", propOrder = { + "_return" +}) +public class CadAgenciaResponse { + + @XmlElement(name = "return") + protected List _return; + + /** + * Gets the value of the return property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the return property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getReturn().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ExportaIntegracaoCadAgenciaWS } + * + * + */ + public List getReturn() { + if (_return == null) { + _return = new ArrayList(); + } + return this._return; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadBeneficio.java b/src/com/rjconsultores/hstcajservice/ws/CadBeneficio.java new file mode 100644 index 000000000..8249ff8fb --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadBeneficio.java @@ -0,0 +1,87 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadBeneficio complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadBeneficio">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codEmpresaGrupo" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="codEmpresa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadBeneficio", propOrder = { + "codEmpresaGrupo", + "codEmpresa" +}) +public class CadBeneficio { + + protected Integer codEmpresaGrupo; + protected String codEmpresa; + + /** + * Gets the value of the codEmpresaGrupo property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getCodEmpresaGrupo() { + return codEmpresaGrupo; + } + + /** + * Sets the value of the codEmpresaGrupo property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setCodEmpresaGrupo(Integer value) { + this.codEmpresaGrupo = value; + } + + /** + * Gets the value of the codEmpresa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEmpresa() { + return codEmpresa; + } + + /** + * Sets the value of the codEmpresa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEmpresa(String value) { + this.codEmpresa = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadBeneficioResponse.java b/src/com/rjconsultores/hstcajservice/ws/CadBeneficioResponse.java new file mode 100644 index 000000000..61eb19388 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadBeneficioResponse.java @@ -0,0 +1,69 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadBeneficioResponse complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadBeneficioResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://ws.hstcajservice.rjconsultores.com/}exportaIntegracaoCadBeneficioWS" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadBeneficioResponse", propOrder = { + "_return" +}) +public class CadBeneficioResponse { + + @XmlElement(name = "return") + protected List _return; + + /** + * Gets the value of the return property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the return property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getReturn().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ExportaIntegracaoCadBeneficioWS } + * + * + */ + public List getReturn() { + if (_return == null) { + _return = new ArrayList(); + } + return this._return; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadBilheteiro.java b/src/com/rjconsultores/hstcajservice/ws/CadBilheteiro.java new file mode 100644 index 000000000..b140b20a8 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadBilheteiro.java @@ -0,0 +1,141 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadBilheteiro complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadBilheteiro">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="agenciaInicio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="agenciaFim" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codEmpresaGrupo" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="codEmpresa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadBilheteiro", propOrder = { + "agenciaInicio", + "agenciaFim", + "codEmpresaGrupo", + "codEmpresa" +}) +public class CadBilheteiro { + + protected String agenciaInicio; + protected String agenciaFim; + protected Integer codEmpresaGrupo; + protected String codEmpresa; + + /** + * Gets the value of the agenciaInicio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaInicio() { + return agenciaInicio; + } + + /** + * Sets the value of the agenciaInicio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaInicio(String value) { + this.agenciaInicio = value; + } + + /** + * Gets the value of the agenciaFim property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaFim() { + return agenciaFim; + } + + /** + * Sets the value of the agenciaFim property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaFim(String value) { + this.agenciaFim = value; + } + + /** + * Gets the value of the codEmpresaGrupo property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getCodEmpresaGrupo() { + return codEmpresaGrupo; + } + + /** + * Sets the value of the codEmpresaGrupo property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setCodEmpresaGrupo(Integer value) { + this.codEmpresaGrupo = value; + } + + /** + * Gets the value of the codEmpresa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEmpresa() { + return codEmpresa; + } + + /** + * Sets the value of the codEmpresa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEmpresa(String value) { + this.codEmpresa = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadBilheteiroResponse.java b/src/com/rjconsultores/hstcajservice/ws/CadBilheteiroResponse.java new file mode 100644 index 000000000..31935d78e --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadBilheteiroResponse.java @@ -0,0 +1,69 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadBilheteiroResponse complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadBilheteiroResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://ws.hstcajservice.rjconsultores.com/}exportaIntegracaoCadBilheteiroWS" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadBilheteiroResponse", propOrder = { + "_return" +}) +public class CadBilheteiroResponse { + + @XmlElement(name = "return") + protected List _return; + + /** + * Gets the value of the return property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the return property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getReturn().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ExportaIntegracaoCadBilheteiroWS } + * + * + */ + public List getReturn() { + if (_return == null) { + _return = new ArrayList(); + } + return this._return; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadCliente.java b/src/com/rjconsultores/hstcajservice/ws/CadCliente.java new file mode 100644 index 000000000..fea3fa7e0 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadCliente.java @@ -0,0 +1,60 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadCliente complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadCliente">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codEmpresaGrupo" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadCliente", propOrder = { + "codEmpresaGrupo" +}) +public class CadCliente { + + protected Integer codEmpresaGrupo; + + /** + * Gets the value of the codEmpresaGrupo property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getCodEmpresaGrupo() { + return codEmpresaGrupo; + } + + /** + * Sets the value of the codEmpresaGrupo property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setCodEmpresaGrupo(Integer value) { + this.codEmpresaGrupo = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadClienteResponse.java b/src/com/rjconsultores/hstcajservice/ws/CadClienteResponse.java new file mode 100644 index 000000000..d46d1adb6 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadClienteResponse.java @@ -0,0 +1,69 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadClienteResponse complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadClienteResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://ws.hstcajservice.rjconsultores.com/}exportaIntegracaoCadClienteWS" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadClienteResponse", propOrder = { + "_return" +}) +public class CadClienteResponse { + + @XmlElement(name = "return") + protected List _return; + + /** + * Gets the value of the return property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the return property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getReturn().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ExportaIntegracaoCadClienteWS } + * + * + */ + public List getReturn() { + if (_return == null) { + _return = new ArrayList(); + } + return this._return; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadEstado.java b/src/com/rjconsultores/hstcajservice/ws/CadEstado.java new file mode 100644 index 000000000..9712ec7c2 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadEstado.java @@ -0,0 +1,60 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadEstado complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadEstado">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codEmpresaGrupo" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadEstado", propOrder = { + "codEmpresaGrupo" +}) +public class CadEstado { + + protected Integer codEmpresaGrupo; + + /** + * Gets the value of the codEmpresaGrupo property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getCodEmpresaGrupo() { + return codEmpresaGrupo; + } + + /** + * Sets the value of the codEmpresaGrupo property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setCodEmpresaGrupo(Integer value) { + this.codEmpresaGrupo = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadEstadoResponse.java b/src/com/rjconsultores/hstcajservice/ws/CadEstadoResponse.java new file mode 100644 index 000000000..7371c9327 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadEstadoResponse.java @@ -0,0 +1,69 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadEstadoResponse complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadEstadoResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://ws.hstcajservice.rjconsultores.com/}exportaIntegracaoCadEstadoWS" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadEstadoResponse", propOrder = { + "_return" +}) +public class CadEstadoResponse { + + @XmlElement(name = "return") + protected List _return; + + /** + * Gets the value of the return property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the return property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getReturn().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ExportaIntegracaoCadEstadoWS } + * + * + */ + public List getReturn() { + if (_return == null) { + _return = new ArrayList(); + } + return this._return; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadFormaPagamento.java b/src/com/rjconsultores/hstcajservice/ws/CadFormaPagamento.java new file mode 100644 index 000000000..b013d259d --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadFormaPagamento.java @@ -0,0 +1,60 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadFormaPagamento complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadFormaPagamento">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codEmpresaGrupo" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadFormaPagamento", propOrder = { + "codEmpresaGrupo" +}) +public class CadFormaPagamento { + + protected Integer codEmpresaGrupo; + + /** + * Gets the value of the codEmpresaGrupo property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getCodEmpresaGrupo() { + return codEmpresaGrupo; + } + + /** + * Sets the value of the codEmpresaGrupo property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setCodEmpresaGrupo(Integer value) { + this.codEmpresaGrupo = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadFormaPagamentoResponse.java b/src/com/rjconsultores/hstcajservice/ws/CadFormaPagamentoResponse.java new file mode 100644 index 000000000..54a19a645 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadFormaPagamentoResponse.java @@ -0,0 +1,69 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadFormaPagamentoResponse complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadFormaPagamentoResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://ws.hstcajservice.rjconsultores.com/}exportaIntegracaoCadFormaPagamentoWS" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadFormaPagamentoResponse", propOrder = { + "_return" +}) +public class CadFormaPagamentoResponse { + + @XmlElement(name = "return") + protected List _return; + + /** + * Gets the value of the return property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the return property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getReturn().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ExportaIntegracaoCadFormaPagamentoWS } + * + * + */ + public List getReturn() { + if (_return == null) { + _return = new ArrayList(); + } + return this._return; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadLinha.java b/src/com/rjconsultores/hstcajservice/ws/CadLinha.java new file mode 100644 index 000000000..e1c91d6fd --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadLinha.java @@ -0,0 +1,87 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadLinha complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadLinha">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codEmpresaGrupo" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="codEmpresa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadLinha", propOrder = { + "codEmpresaGrupo", + "codEmpresa" +}) +public class CadLinha { + + protected Integer codEmpresaGrupo; + protected String codEmpresa; + + /** + * Gets the value of the codEmpresaGrupo property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getCodEmpresaGrupo() { + return codEmpresaGrupo; + } + + /** + * Sets the value of the codEmpresaGrupo property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setCodEmpresaGrupo(Integer value) { + this.codEmpresaGrupo = value; + } + + /** + * Gets the value of the codEmpresa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEmpresa() { + return codEmpresa; + } + + /** + * Sets the value of the codEmpresa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEmpresa(String value) { + this.codEmpresa = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadLinhaResponse.java b/src/com/rjconsultores/hstcajservice/ws/CadLinhaResponse.java new file mode 100644 index 000000000..9a182542f --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadLinhaResponse.java @@ -0,0 +1,69 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadLinhaResponse complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadLinhaResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://ws.hstcajservice.rjconsultores.com/}exportaIntegracaoCadLinhaWS" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadLinhaResponse", propOrder = { + "_return" +}) +public class CadLinhaResponse { + + @XmlElement(name = "return") + protected List _return; + + /** + * Gets the value of the return property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the return property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getReturn().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ExportaIntegracaoCadLinhaWS } + * + * + */ + public List getReturn() { + if (_return == null) { + _return = new ArrayList(); + } + return this._return; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadLocalidade.java b/src/com/rjconsultores/hstcajservice/ws/CadLocalidade.java new file mode 100644 index 000000000..298c27b6e --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadLocalidade.java @@ -0,0 +1,60 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadLocalidade complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadLocalidade">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codEmpresaGrupo" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadLocalidade", propOrder = { + "codEmpresaGrupo" +}) +public class CadLocalidade { + + protected Integer codEmpresaGrupo; + + /** + * Gets the value of the codEmpresaGrupo property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getCodEmpresaGrupo() { + return codEmpresaGrupo; + } + + /** + * Sets the value of the codEmpresaGrupo property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setCodEmpresaGrupo(Integer value) { + this.codEmpresaGrupo = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadLocalidadeResponse.java b/src/com/rjconsultores/hstcajservice/ws/CadLocalidadeResponse.java new file mode 100644 index 000000000..783ee8e11 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadLocalidadeResponse.java @@ -0,0 +1,69 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadLocalidadeResponse complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadLocalidadeResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://ws.hstcajservice.rjconsultores.com/}exportaIntegracaoCadLocalidadeWS" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadLocalidadeResponse", propOrder = { + "_return" +}) +public class CadLocalidadeResponse { + + @XmlElement(name = "return") + protected List _return; + + /** + * Gets the value of the return property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the return property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getReturn().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ExportaIntegracaoCadLocalidadeWS } + * + * + */ + public List getReturn() { + if (_return == null) { + _return = new ArrayList(); + } + return this._return; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadReceitaDespesa.java b/src/com/rjconsultores/hstcajservice/ws/CadReceitaDespesa.java new file mode 100644 index 000000000..5224c6b96 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadReceitaDespesa.java @@ -0,0 +1,60 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadReceitaDespesa complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadReceitaDespesa">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codEmpresaGrupo" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadReceitaDespesa", propOrder = { + "codEmpresaGrupo" +}) +public class CadReceitaDespesa { + + protected Integer codEmpresaGrupo; + + /** + * Gets the value of the codEmpresaGrupo property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getCodEmpresaGrupo() { + return codEmpresaGrupo; + } + + /** + * Sets the value of the codEmpresaGrupo property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setCodEmpresaGrupo(Integer value) { + this.codEmpresaGrupo = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/CadReceitaDespesaResponse.java b/src/com/rjconsultores/hstcajservice/ws/CadReceitaDespesaResponse.java new file mode 100644 index 000000000..f59514450 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/CadReceitaDespesaResponse.java @@ -0,0 +1,69 @@ + +package com.rjconsultores.hstcajservice.ws; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for cadReceitaDespesaResponse complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="cadReceitaDespesaResponse">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="return" type="{http://ws.hstcajservice.rjconsultores.com/}exportaIntegracaoCadReceitaDespesaWS" maxOccurs="unbounded" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "cadReceitaDespesaResponse", propOrder = { + "_return" +}) +public class CadReceitaDespesaResponse { + + @XmlElement(name = "return") + protected List _return; + + /** + * Gets the value of the return property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the return property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getReturn().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link ExportaIntegracaoCadReceitaDespesaWS } + * + * + */ + public List getReturn() { + if (_return == null) { + _return = new ArrayList(); + } + return this._return; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadAgenciaWS.java b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadAgenciaWS.java new file mode 100644 index 000000000..9a0db7df2 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadAgenciaWS.java @@ -0,0 +1,114 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for exportaIntegracaoCadAgenciaWS complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="exportaIntegracaoCadAgenciaWS">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="ativo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codAgencia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="descAgencia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "exportaIntegracaoCadAgenciaWS", propOrder = { + "ativo", + "codAgencia", + "descAgencia" +}) +public class ExportaIntegracaoCadAgenciaWS { + + protected String ativo; + protected String codAgencia; + protected String descAgencia; + + /** + * Gets the value of the ativo property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAtivo() { + return ativo; + } + + /** + * Sets the value of the ativo property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAtivo(String value) { + this.ativo = value; + } + + /** + * Gets the value of the codAgencia property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodAgencia() { + return codAgencia; + } + + /** + * Sets the value of the codAgencia property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodAgencia(String value) { + this.codAgencia = value; + } + + /** + * Gets the value of the descAgencia property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescAgencia() { + return descAgencia; + } + + /** + * Sets the value of the descAgencia property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescAgencia(String value) { + this.descAgencia = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadBeneficioWS.java b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadBeneficioWS.java new file mode 100644 index 000000000..1011c2d0a --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadBeneficioWS.java @@ -0,0 +1,276 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for exportaIntegracaoCadBeneficioWS complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="exportaIntegracaoCadBeneficioWS">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="classeBeneficio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codBeneficio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="descontoBeneficio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="descricaoBeneficio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="empresaBeneficio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="linhaBeneficio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="orgConcedLinha" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="temTaxaEmbarque" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="temTaxaSeguro" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "exportaIntegracaoCadBeneficioWS", propOrder = { + "classeBeneficio", + "codBeneficio", + "descontoBeneficio", + "descricaoBeneficio", + "empresaBeneficio", + "linhaBeneficio", + "orgConcedLinha", + "temTaxaEmbarque", + "temTaxaSeguro" +}) +public class ExportaIntegracaoCadBeneficioWS { + + protected String classeBeneficio; + protected String codBeneficio; + protected String descontoBeneficio; + protected String descricaoBeneficio; + protected String empresaBeneficio; + protected String linhaBeneficio; + protected String orgConcedLinha; + protected String temTaxaEmbarque; + protected String temTaxaSeguro; + + /** + * Gets the value of the classeBeneficio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getClasseBeneficio() { + return classeBeneficio; + } + + /** + * Sets the value of the classeBeneficio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setClasseBeneficio(String value) { + this.classeBeneficio = value; + } + + /** + * Gets the value of the codBeneficio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodBeneficio() { + return codBeneficio; + } + + /** + * Sets the value of the codBeneficio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodBeneficio(String value) { + this.codBeneficio = value; + } + + /** + * Gets the value of the descontoBeneficio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescontoBeneficio() { + return descontoBeneficio; + } + + /** + * Sets the value of the descontoBeneficio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescontoBeneficio(String value) { + this.descontoBeneficio = value; + } + + /** + * Gets the value of the descricaoBeneficio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescricaoBeneficio() { + return descricaoBeneficio; + } + + /** + * Sets the value of the descricaoBeneficio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescricaoBeneficio(String value) { + this.descricaoBeneficio = value; + } + + /** + * Gets the value of the empresaBeneficio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEmpresaBeneficio() { + return empresaBeneficio; + } + + /** + * Sets the value of the empresaBeneficio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEmpresaBeneficio(String value) { + this.empresaBeneficio = value; + } + + /** + * Gets the value of the linhaBeneficio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLinhaBeneficio() { + return linhaBeneficio; + } + + /** + * Sets the value of the linhaBeneficio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLinhaBeneficio(String value) { + this.linhaBeneficio = value; + } + + /** + * Gets the value of the orgConcedLinha property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getOrgConcedLinha() { + return orgConcedLinha; + } + + /** + * Sets the value of the orgConcedLinha property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setOrgConcedLinha(String value) { + this.orgConcedLinha = value; + } + + /** + * Gets the value of the temTaxaEmbarque property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTemTaxaEmbarque() { + return temTaxaEmbarque; + } + + /** + * Sets the value of the temTaxaEmbarque property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTemTaxaEmbarque(String value) { + this.temTaxaEmbarque = value; + } + + /** + * Gets the value of the temTaxaSeguro property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTemTaxaSeguro() { + return temTaxaSeguro; + } + + /** + * Sets the value of the temTaxaSeguro property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTemTaxaSeguro(String value) { + this.temTaxaSeguro = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadBilheteiroWS.java b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadBilheteiroWS.java new file mode 100644 index 000000000..36ddf22ae --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadBilheteiroWS.java @@ -0,0 +1,168 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for exportaIntegracaoCadBilheteiroWS complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="exportaIntegracaoCadBilheteiroWS">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="agenciaBilheteiro" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ativo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codBilheteiro" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="documentoBilheteiro" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nomeBilheteiro" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "exportaIntegracaoCadBilheteiroWS", propOrder = { + "agenciaBilheteiro", + "ativo", + "codBilheteiro", + "documentoBilheteiro", + "nomeBilheteiro" +}) +public class ExportaIntegracaoCadBilheteiroWS { + + protected String agenciaBilheteiro; + protected String ativo; + protected String codBilheteiro; + protected String documentoBilheteiro; + protected String nomeBilheteiro; + + /** + * Gets the value of the agenciaBilheteiro property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaBilheteiro() { + return agenciaBilheteiro; + } + + /** + * Sets the value of the agenciaBilheteiro property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaBilheteiro(String value) { + this.agenciaBilheteiro = value; + } + + /** + * Gets the value of the ativo property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAtivo() { + return ativo; + } + + /** + * Sets the value of the ativo property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAtivo(String value) { + this.ativo = value; + } + + /** + * Gets the value of the codBilheteiro property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodBilheteiro() { + return codBilheteiro; + } + + /** + * Sets the value of the codBilheteiro property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodBilheteiro(String value) { + this.codBilheteiro = value; + } + + /** + * Gets the value of the documentoBilheteiro property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDocumentoBilheteiro() { + return documentoBilheteiro; + } + + /** + * Sets the value of the documentoBilheteiro property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDocumentoBilheteiro(String value) { + this.documentoBilheteiro = value; + } + + /** + * Gets the value of the nomeBilheteiro property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNomeBilheteiro() { + return nomeBilheteiro; + } + + /** + * Sets the value of the nomeBilheteiro property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNomeBilheteiro(String value) { + this.nomeBilheteiro = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadClienteWS.java b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadClienteWS.java new file mode 100644 index 000000000..4bd76f953 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadClienteWS.java @@ -0,0 +1,330 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for exportaIntegracaoCadClienteWS complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="exportaIntegracaoCadClienteWS">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="bairroCli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="cepCli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codCli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="dataNascCli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="emailCli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nacioCli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nomeCli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numDocCli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="ruaCli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="telCli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoDocCli" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "exportaIntegracaoCadClienteWS", propOrder = { + "bairroCli", + "cepCli", + "codCli", + "dataNascCli", + "emailCli", + "nacioCli", + "nomeCli", + "numDocCli", + "ruaCli", + "telCli", + "tipoDocCli" +}) +public class ExportaIntegracaoCadClienteWS { + + protected String bairroCli; + protected String cepCli; + protected String codCli; + protected String dataNascCli; + protected String emailCli; + protected String nacioCli; + protected String nomeCli; + protected String numDocCli; + protected String ruaCli; + protected String telCli; + protected String tipoDocCli; + + /** + * Gets the value of the bairroCli property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBairroCli() { + return bairroCli; + } + + /** + * Sets the value of the bairroCli property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBairroCli(String value) { + this.bairroCli = value; + } + + /** + * Gets the value of the cepCli property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCepCli() { + return cepCli; + } + + /** + * Sets the value of the cepCli property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCepCli(String value) { + this.cepCli = value; + } + + /** + * Gets the value of the codCli property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodCli() { + return codCli; + } + + /** + * Sets the value of the codCli property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodCli(String value) { + this.codCli = value; + } + + /** + * Gets the value of the dataNascCli property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDataNascCli() { + return dataNascCli; + } + + /** + * Sets the value of the dataNascCli property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDataNascCli(String value) { + this.dataNascCli = value; + } + + /** + * Gets the value of the emailCli property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEmailCli() { + return emailCli; + } + + /** + * Sets the value of the emailCli property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEmailCli(String value) { + this.emailCli = value; + } + + /** + * Gets the value of the nacioCli property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNacioCli() { + return nacioCli; + } + + /** + * Sets the value of the nacioCli property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNacioCli(String value) { + this.nacioCli = value; + } + + /** + * Gets the value of the nomeCli property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNomeCli() { + return nomeCli; + } + + /** + * Sets the value of the nomeCli property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNomeCli(String value) { + this.nomeCli = value; + } + + /** + * Gets the value of the numDocCli property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumDocCli() { + return numDocCli; + } + + /** + * Sets the value of the numDocCli property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumDocCli(String value) { + this.numDocCli = value; + } + + /** + * Gets the value of the ruaCli property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getRuaCli() { + return ruaCli; + } + + /** + * Sets the value of the ruaCli property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setRuaCli(String value) { + this.ruaCli = value; + } + + /** + * Gets the value of the telCli property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTelCli() { + return telCli; + } + + /** + * Sets the value of the telCli property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTelCli(String value) { + this.telCli = value; + } + + /** + * Gets the value of the tipoDocCli property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTipoDocCli() { + return tipoDocCli; + } + + /** + * Sets the value of the tipoDocCli property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTipoDocCli(String value) { + this.tipoDocCli = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadEstadoWS.java b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadEstadoWS.java new file mode 100644 index 000000000..961f8c18b --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadEstadoWS.java @@ -0,0 +1,195 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for exportaIntegracaoCadEstadoWS complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="exportaIntegracaoCadEstadoWS">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codServidorEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="descEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="siglaEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="taxaEmbarqueEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="valorICMSEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "exportaIntegracaoCadEstadoWS", propOrder = { + "codEstado", + "codServidorEstado", + "descEstado", + "siglaEstado", + "taxaEmbarqueEstado", + "valorICMSEstado" +}) +public class ExportaIntegracaoCadEstadoWS { + + protected String codEstado; + protected String codServidorEstado; + protected String descEstado; + protected String siglaEstado; + protected String taxaEmbarqueEstado; + protected String valorICMSEstado; + + /** + * Gets the value of the codEstado property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEstado() { + return codEstado; + } + + /** + * Sets the value of the codEstado property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEstado(String value) { + this.codEstado = value; + } + + /** + * Gets the value of the codServidorEstado property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodServidorEstado() { + return codServidorEstado; + } + + /** + * Sets the value of the codServidorEstado property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodServidorEstado(String value) { + this.codServidorEstado = value; + } + + /** + * Gets the value of the descEstado property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescEstado() { + return descEstado; + } + + /** + * Sets the value of the descEstado property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescEstado(String value) { + this.descEstado = value; + } + + /** + * Gets the value of the siglaEstado property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSiglaEstado() { + return siglaEstado; + } + + /** + * Sets the value of the siglaEstado property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSiglaEstado(String value) { + this.siglaEstado = value; + } + + /** + * Gets the value of the taxaEmbarqueEstado property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTaxaEmbarqueEstado() { + return taxaEmbarqueEstado; + } + + /** + * Sets the value of the taxaEmbarqueEstado property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTaxaEmbarqueEstado(String value) { + this.taxaEmbarqueEstado = value; + } + + /** + * Gets the value of the valorICMSEstado property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValorICMSEstado() { + return valorICMSEstado; + } + + /** + * Sets the value of the valorICMSEstado property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValorICMSEstado(String value) { + this.valorICMSEstado = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadFormaPagamentoWS.java b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadFormaPagamentoWS.java new file mode 100644 index 000000000..59fe8aa23 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadFormaPagamentoWS.java @@ -0,0 +1,87 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for exportaIntegracaoCadFormaPagamentoWS complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="exportaIntegracaoCadFormaPagamentoWS">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codFormaPag" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="descFormaPag" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "exportaIntegracaoCadFormaPagamentoWS", propOrder = { + "codFormaPag", + "descFormaPag" +}) +public class ExportaIntegracaoCadFormaPagamentoWS { + + protected String codFormaPag; + protected String descFormaPag; + + /** + * Gets the value of the codFormaPag property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodFormaPag() { + return codFormaPag; + } + + /** + * Sets the value of the codFormaPag property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodFormaPag(String value) { + this.codFormaPag = value; + } + + /** + * Gets the value of the descFormaPag property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescFormaPag() { + return descFormaPag; + } + + /** + * Sets the value of the descFormaPag property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescFormaPag(String value) { + this.descFormaPag = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadLinhaWS.java b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadLinhaWS.java new file mode 100644 index 000000000..ea467d34f --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadLinhaWS.java @@ -0,0 +1,222 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for exportaIntegracaoCadLinhaWS complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="exportaIntegracaoCadLinhaWS">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="classeLinha" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codEmpresaLinha" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codLinha" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="descLinha" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="detalheLinha" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="orgConcedLinha" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="prefixoLinha" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "exportaIntegracaoCadLinhaWS", propOrder = { + "classeLinha", + "codEmpresaLinha", + "codLinha", + "descLinha", + "detalheLinha", + "orgConcedLinha", + "prefixoLinha" +}) +public class ExportaIntegracaoCadLinhaWS { + + protected String classeLinha; + protected String codEmpresaLinha; + protected String codLinha; + protected String descLinha; + protected String detalheLinha; + protected String orgConcedLinha; + protected String prefixoLinha; + + /** + * Gets the value of the classeLinha property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getClasseLinha() { + return classeLinha; + } + + /** + * Sets the value of the classeLinha property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setClasseLinha(String value) { + this.classeLinha = value; + } + + /** + * Gets the value of the codEmpresaLinha property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEmpresaLinha() { + return codEmpresaLinha; + } + + /** + * Sets the value of the codEmpresaLinha property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEmpresaLinha(String value) { + this.codEmpresaLinha = value; + } + + /** + * Gets the value of the codLinha property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodLinha() { + return codLinha; + } + + /** + * Sets the value of the codLinha property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodLinha(String value) { + this.codLinha = value; + } + + /** + * Gets the value of the descLinha property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescLinha() { + return descLinha; + } + + /** + * Sets the value of the descLinha property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescLinha(String value) { + this.descLinha = value; + } + + /** + * Gets the value of the detalheLinha property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDetalheLinha() { + return detalheLinha; + } + + /** + * Sets the value of the detalheLinha property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDetalheLinha(String value) { + this.detalheLinha = value; + } + + /** + * Gets the value of the orgConcedLinha property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getOrgConcedLinha() { + return orgConcedLinha; + } + + /** + * Sets the value of the orgConcedLinha property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setOrgConcedLinha(String value) { + this.orgConcedLinha = value; + } + + /** + * Gets the value of the prefixoLinha property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPrefixoLinha() { + return prefixoLinha; + } + + /** + * Sets the value of the prefixoLinha property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPrefixoLinha(String value) { + this.prefixoLinha = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadLocalidadeWS.java b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadLocalidadeWS.java new file mode 100644 index 000000000..3a81786a0 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadLocalidadeWS.java @@ -0,0 +1,168 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for exportaIntegracaoCadLocalidadeWS complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="exportaIntegracaoCadLocalidadeWS">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codEstadoLocalidade" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codLocalidade" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="descLocalidade" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="siglaLocalidade" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="taxaRodoviariaLocalidade" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "exportaIntegracaoCadLocalidadeWS", propOrder = { + "codEstadoLocalidade", + "codLocalidade", + "descLocalidade", + "siglaLocalidade", + "taxaRodoviariaLocalidade" +}) +public class ExportaIntegracaoCadLocalidadeWS { + + protected String codEstadoLocalidade; + protected String codLocalidade; + protected String descLocalidade; + protected String siglaLocalidade; + protected String taxaRodoviariaLocalidade; + + /** + * Gets the value of the codEstadoLocalidade property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEstadoLocalidade() { + return codEstadoLocalidade; + } + + /** + * Sets the value of the codEstadoLocalidade property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEstadoLocalidade(String value) { + this.codEstadoLocalidade = value; + } + + /** + * Gets the value of the codLocalidade property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodLocalidade() { + return codLocalidade; + } + + /** + * Sets the value of the codLocalidade property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodLocalidade(String value) { + this.codLocalidade = value; + } + + /** + * Gets the value of the descLocalidade property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescLocalidade() { + return descLocalidade; + } + + /** + * Sets the value of the descLocalidade property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescLocalidade(String value) { + this.descLocalidade = value; + } + + /** + * Gets the value of the siglaLocalidade property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSiglaLocalidade() { + return siglaLocalidade; + } + + /** + * Sets the value of the siglaLocalidade property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSiglaLocalidade(String value) { + this.siglaLocalidade = value; + } + + /** + * Gets the value of the taxaRodoviariaLocalidade property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTaxaRodoviariaLocalidade() { + return taxaRodoviariaLocalidade; + } + + /** + * Sets the value of the taxaRodoviariaLocalidade property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTaxaRodoviariaLocalidade(String value) { + this.taxaRodoviariaLocalidade = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadReceitaDespesaWS.java b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadReceitaDespesaWS.java new file mode 100644 index 000000000..cb1645865 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoCadReceitaDespesaWS.java @@ -0,0 +1,195 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for exportaIntegracaoCadReceitaDespesaWS complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="exportaIntegracaoCadReceitaDespesaWS">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="codAgenciaReceitaDespesa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codEmpresaReceitaDespesa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codReceitaDespesa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="credDebitoReceitaDespesa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="descReceitaDespesa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="formaPagReceitaDespesa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "exportaIntegracaoCadReceitaDespesaWS", propOrder = { + "codAgenciaReceitaDespesa", + "codEmpresaReceitaDespesa", + "codReceitaDespesa", + "credDebitoReceitaDespesa", + "descReceitaDespesa", + "formaPagReceitaDespesa" +}) +public class ExportaIntegracaoCadReceitaDespesaWS { + + protected String codAgenciaReceitaDespesa; + protected String codEmpresaReceitaDespesa; + protected String codReceitaDespesa; + protected String credDebitoReceitaDespesa; + protected String descReceitaDespesa; + protected String formaPagReceitaDespesa; + + /** + * Gets the value of the codAgenciaReceitaDespesa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodAgenciaReceitaDespesa() { + return codAgenciaReceitaDespesa; + } + + /** + * Sets the value of the codAgenciaReceitaDespesa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodAgenciaReceitaDespesa(String value) { + this.codAgenciaReceitaDespesa = value; + } + + /** + * Gets the value of the codEmpresaReceitaDespesa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEmpresaReceitaDespesa() { + return codEmpresaReceitaDespesa; + } + + /** + * Sets the value of the codEmpresaReceitaDespesa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEmpresaReceitaDespesa(String value) { + this.codEmpresaReceitaDespesa = value; + } + + /** + * Gets the value of the codReceitaDespesa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodReceitaDespesa() { + return codReceitaDespesa; + } + + /** + * Sets the value of the codReceitaDespesa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodReceitaDespesa(String value) { + this.codReceitaDespesa = value; + } + + /** + * Gets the value of the credDebitoReceitaDespesa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCredDebitoReceitaDespesa() { + return credDebitoReceitaDespesa; + } + + /** + * Sets the value of the credDebitoReceitaDespesa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCredDebitoReceitaDespesa(String value) { + this.credDebitoReceitaDespesa = value; + } + + /** + * Gets the value of the descReceitaDespesa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescReceitaDespesa() { + return descReceitaDespesa; + } + + /** + * Sets the value of the descReceitaDespesa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescReceitaDespesa(String value) { + this.descReceitaDespesa = value; + } + + /** + * Gets the value of the formaPagReceitaDespesa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFormaPagReceitaDespesa() { + return formaPagReceitaDespesa; + } + + /** + * Sets the value of the formaPagReceitaDespesa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFormaPagReceitaDespesa(String value) { + this.formaPagReceitaDespesa = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoReceitaDespesaWS.java b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoReceitaDespesaWS.java new file mode 100644 index 000000000..04705e5de --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoReceitaDespesaWS.java @@ -0,0 +1,303 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for exportaIntegracaoReceitaDespesaWS complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="exportaIntegracaoReceitaDespesaWS">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="agencia" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codEmpresa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codFilial" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codReceitaDespesa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="dataLancamento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="dataMovimento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="idReceitaDespesa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="turno" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="usuario" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="valorLancamento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "exportaIntegracaoReceitaDespesaWS", propOrder = { + "agencia", + "codEmpresa", + "codFilial", + "codReceitaDespesa", + "dataLancamento", + "dataMovimento", + "idReceitaDespesa", + "turno", + "usuario", + "valorLancamento" +}) +public class ExportaIntegracaoReceitaDespesaWS { + + protected String agencia; + protected String codEmpresa; + protected String codFilial; + protected String codReceitaDespesa; + protected String dataLancamento; + protected String dataMovimento; + protected String idReceitaDespesa; + protected String turno; + protected String usuario; + protected String valorLancamento; + + /** + * Gets the value of the agencia property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgencia() { + return agencia; + } + + /** + * Sets the value of the agencia property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgencia(String value) { + this.agencia = value; + } + + /** + * Gets the value of the codEmpresa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodEmpresa() { + return codEmpresa; + } + + /** + * Sets the value of the codEmpresa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodEmpresa(String value) { + this.codEmpresa = value; + } + + /** + * Gets the value of the codFilial property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodFilial() { + return codFilial; + } + + /** + * Sets the value of the codFilial property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodFilial(String value) { + this.codFilial = value; + } + + /** + * Gets the value of the codReceitaDespesa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodReceitaDespesa() { + return codReceitaDespesa; + } + + /** + * Sets the value of the codReceitaDespesa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodReceitaDespesa(String value) { + this.codReceitaDespesa = value; + } + + /** + * Gets the value of the dataLancamento property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDataLancamento() { + return dataLancamento; + } + + /** + * Sets the value of the dataLancamento property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDataLancamento(String value) { + this.dataLancamento = value; + } + + /** + * Gets the value of the dataMovimento property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDataMovimento() { + return dataMovimento; + } + + /** + * Sets the value of the dataMovimento property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDataMovimento(String value) { + this.dataMovimento = value; + } + + /** + * Gets the value of the idReceitaDespesa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIdReceitaDespesa() { + return idReceitaDespesa; + } + + /** + * Sets the value of the idReceitaDespesa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIdReceitaDespesa(String value) { + this.idReceitaDespesa = value; + } + + /** + * Gets the value of the turno property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTurno() { + return turno; + } + + /** + * Sets the value of the turno property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTurno(String value) { + this.turno = value; + } + + /** + * Gets the value of the usuario property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getUsuario() { + return usuario; + } + + /** + * Sets the value of the usuario property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setUsuario(String value) { + this.usuario = value; + } + + /** + * Gets the value of the valorLancamento property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValorLancamento() { + return valorLancamento; + } + + /** + * Sets the value of the valorLancamento property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValorLancamento(String value) { + this.valorLancamento = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoWS.java b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoWS.java new file mode 100644 index 000000000..240470a51 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/ExportaIntegracaoWS.java @@ -0,0 +1,2747 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for exportaIntegracaoWS complex type. + * + *

The following schema fragment specifies the expected content contained within this class. + * + *

+ * <complexType name="exportaIntegracaoWS">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="AIDF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="acrescimoICMSECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="agenciaDesembarque" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="agenciaEmbarque" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="agenciaEmissaoCupomFiscalECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="agenciaMovimentacaoPassagen" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="agenciaPrestacaoConta" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="agenciaTMRRS" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="autorizacao0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="autorizacao1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="autorizacao2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="bilheteiro" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="boletoId" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
+ *         <element name="COOFinalECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="COOInicialECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="CROECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="CRZECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="cancelamentoICMSECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codigoAnulacao" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codigoClienteRequisicao" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="codigoVenda" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="dataReducaoECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="dataServico" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="dataVenda" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="dataViagem" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="desconto" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="descontoICMSECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="destino" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="devolucaoCupomFiscalECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="espaco1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="espaco2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="espaco3" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="espaco4" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="espaco5" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="estabelecimento0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="estabelecimento1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="estabelecimento2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="estado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="exclusivoBilheteriaGlobus" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="formaPagto0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="formaPagto1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="formaPagto2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="horaServico" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="horaVenda" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="horaViagem" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="isentoICMSECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="linha" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="modalidadeIPosterior" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="modeloBilheteFiscalECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="motorista1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="motorista2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NSU0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NSU1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NSU2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NSUHostTID0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NSUHostTID1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="NSUHostTID2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="naoIncidenciaICMSECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="nomePassageiroRequisicao" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroCaixaFiscalECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroCupomFiscalECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroDVPRS" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroLojaFiscalECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroPreImpresso" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroRequisicao" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroSerieImpressoraECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroSistemaEstado" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="numeroVT" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="origem" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="outros" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="pedagio" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="poltrona" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="porcentagemFormaPagto0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="porcentagemFormaPagto1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="porcentagemFormaPagto2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="prefixoLinha" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="qtdeParcela0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="qtdeParcela1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="qtdeParcela2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="qtdePassageiros" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="quantidadeCanceladoECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="registros" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/>
+ *         <element name="SVIRS" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="seguro" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="seriePassagens" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="servico" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="statusSVIRS" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="subseriePassagens" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="substituicaoTributariaICMSECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="TMRRS" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tarifa" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="taxaEmbarque" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="tipoPassagem" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="valorGrandeTotalECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="valorMultaCancelamento" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="valorVendaBrutaECF" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="veiculo" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="vlrFormaPagto0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="vlrFormaPagto1" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *         <element name="vlrFormaPagto2" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "exportaIntegracaoWS", propOrder = { + "aidf", + "acrescimoICMSECF", + "agenciaDesembarque", + "agenciaEmbarque", + "agenciaEmissaoCupomFiscalECF", + "agenciaMovimentacaoPassagen", + "agenciaPrestacaoConta", + "agenciaTMRRS", + "autorizacao0", + "autorizacao1", + "autorizacao2", + "bilheteiro", + "boletoId", + "cooFinalECF", + "cooInicialECF", + "croecf", + "crzecf", + "cancelamentoICMSECF", + "codigoAnulacao", + "codigoClienteRequisicao", + "codigoVenda", + "dataReducaoECF", + "dataServico", + "dataVenda", + "dataViagem", + "desconto", + "descontoICMSECF", + "destino", + "devolucaoCupomFiscalECF", + "espaco1", + "espaco2", + "espaco3", + "espaco4", + "espaco5", + "estabelecimento0", + "estabelecimento1", + "estabelecimento2", + "estado", + "exclusivoBilheteriaGlobus", + "formaPagto0", + "formaPagto1", + "formaPagto2", + "horaServico", + "horaVenda", + "horaViagem", + "isentoICMSECF", + "linha", + "modalidadeIPosterior", + "modeloBilheteFiscalECF", + "motorista1", + "motorista2", + "nsu0", + "nsu1", + "nsu2", + "nsuHostTID0", + "nsuHostTID1", + "nsuHostTID2", + "naoIncidenciaICMSECF", + "nomePassageiroRequisicao", + "numeroCaixaFiscalECF", + "numeroCupomFiscalECF", + "numeroDVPRS", + "numeroLojaFiscalECF", + "numeroPreImpresso", + "numeroRequisicao", + "numeroSerieImpressoraECF", + "numeroSistemaEstado", + "numeroVT", + "origem", + "outros", + "pedagio", + "poltrona", + "porcentagemFormaPagto0", + "porcentagemFormaPagto1", + "porcentagemFormaPagto2", + "prefixoLinha", + "qtdeParcela0", + "qtdeParcela1", + "qtdeParcela2", + "qtdePassageiros", + "quantidadeCanceladoECF", + "registros", + "svirs", + "seguro", + "seriePassagens", + "servico", + "statusSVIRS", + "subseriePassagens", + "substituicaoTributariaICMSECF", + "tmrrs", + "tarifa", + "taxaEmbarque", + "tipoPassagem", + "valorGrandeTotalECF", + "valorMultaCancelamento", + "valorVendaBrutaECF", + "veiculo", + "vlrFormaPagto0", + "vlrFormaPagto1", + "vlrFormaPagto2" +}) +public class ExportaIntegracaoWS { + + @XmlElement(name = "AIDF") + protected String aidf; + protected String acrescimoICMSECF; + protected String agenciaDesembarque; + protected String agenciaEmbarque; + protected String agenciaEmissaoCupomFiscalECF; + protected String agenciaMovimentacaoPassagen; + protected String agenciaPrestacaoConta; + protected String agenciaTMRRS; + protected String autorizacao0; + protected String autorizacao1; + protected String autorizacao2; + protected String bilheteiro; + protected Long boletoId; + @XmlElement(name = "COOFinalECF") + protected String cooFinalECF; + @XmlElement(name = "COOInicialECF") + protected String cooInicialECF; + @XmlElement(name = "CROECF") + protected String croecf; + @XmlElement(name = "CRZECF") + protected String crzecf; + protected String cancelamentoICMSECF; + protected String codigoAnulacao; + protected String codigoClienteRequisicao; + protected String codigoVenda; + protected String dataReducaoECF; + protected String dataServico; + protected String dataVenda; + protected String dataViagem; + protected String desconto; + protected String descontoICMSECF; + protected String destino; + protected String devolucaoCupomFiscalECF; + protected String espaco1; + protected String espaco2; + protected String espaco3; + protected String espaco4; + protected String espaco5; + protected String estabelecimento0; + protected String estabelecimento1; + protected String estabelecimento2; + protected String estado; + protected String exclusivoBilheteriaGlobus; + protected String formaPagto0; + protected String formaPagto1; + protected String formaPagto2; + protected String horaServico; + protected String horaVenda; + protected String horaViagem; + protected String isentoICMSECF; + protected String linha; + protected String modalidadeIPosterior; + protected String modeloBilheteFiscalECF; + protected String motorista1; + protected String motorista2; + @XmlElement(name = "NSU0") + protected String nsu0; + @XmlElement(name = "NSU1") + protected String nsu1; + @XmlElement(name = "NSU2") + protected String nsu2; + @XmlElement(name = "NSUHostTID0") + protected String nsuHostTID0; + @XmlElement(name = "NSUHostTID1") + protected String nsuHostTID1; + @XmlElement(name = "NSUHostTID2") + protected String nsuHostTID2; + protected String naoIncidenciaICMSECF; + protected String nomePassageiroRequisicao; + protected String numeroCaixaFiscalECF; + protected String numeroCupomFiscalECF; + protected String numeroDVPRS; + protected String numeroLojaFiscalECF; + protected String numeroPreImpresso; + protected String numeroRequisicao; + protected String numeroSerieImpressoraECF; + protected String numeroSistemaEstado; + protected String numeroVT; + protected String origem; + protected String outros; + protected String pedagio; + protected String poltrona; + protected String porcentagemFormaPagto0; + protected String porcentagemFormaPagto1; + protected String porcentagemFormaPagto2; + protected String prefixoLinha; + protected String qtdeParcela0; + protected String qtdeParcela1; + protected String qtdeParcela2; + protected String qtdePassageiros; + protected String quantidadeCanceladoECF; + protected Integer registros; + @XmlElement(name = "SVIRS") + protected String svirs; + protected String seguro; + protected String seriePassagens; + protected String servico; + protected String statusSVIRS; + protected String subseriePassagens; + protected String substituicaoTributariaICMSECF; + @XmlElement(name = "TMRRS") + protected String tmrrs; + protected String tarifa; + protected String taxaEmbarque; + protected String tipoPassagem; + protected String valorGrandeTotalECF; + protected String valorMultaCancelamento; + protected String valorVendaBrutaECF; + protected String veiculo; + protected String vlrFormaPagto0; + protected String vlrFormaPagto1; + protected String vlrFormaPagto2; + + /** + * Gets the value of the aidf property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAIDF() { + return aidf; + } + + /** + * Sets the value of the aidf property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAIDF(String value) { + this.aidf = value; + } + + /** + * Gets the value of the acrescimoICMSECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAcrescimoICMSECF() { + return acrescimoICMSECF; + } + + /** + * Sets the value of the acrescimoICMSECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAcrescimoICMSECF(String value) { + this.acrescimoICMSECF = value; + } + + /** + * Gets the value of the agenciaDesembarque property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaDesembarque() { + return agenciaDesembarque; + } + + /** + * Sets the value of the agenciaDesembarque property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaDesembarque(String value) { + this.agenciaDesembarque = value; + } + + /** + * Gets the value of the agenciaEmbarque property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaEmbarque() { + return agenciaEmbarque; + } + + /** + * Sets the value of the agenciaEmbarque property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaEmbarque(String value) { + this.agenciaEmbarque = value; + } + + /** + * Gets the value of the agenciaEmissaoCupomFiscalECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaEmissaoCupomFiscalECF() { + return agenciaEmissaoCupomFiscalECF; + } + + /** + * Sets the value of the agenciaEmissaoCupomFiscalECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaEmissaoCupomFiscalECF(String value) { + this.agenciaEmissaoCupomFiscalECF = value; + } + + /** + * Gets the value of the agenciaMovimentacaoPassagen property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaMovimentacaoPassagen() { + return agenciaMovimentacaoPassagen; + } + + /** + * Sets the value of the agenciaMovimentacaoPassagen property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaMovimentacaoPassagen(String value) { + this.agenciaMovimentacaoPassagen = value; + } + + /** + * Gets the value of the agenciaPrestacaoConta property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaPrestacaoConta() { + return agenciaPrestacaoConta; + } + + /** + * Sets the value of the agenciaPrestacaoConta property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaPrestacaoConta(String value) { + this.agenciaPrestacaoConta = value; + } + + /** + * Gets the value of the agenciaTMRRS property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAgenciaTMRRS() { + return agenciaTMRRS; + } + + /** + * Sets the value of the agenciaTMRRS property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAgenciaTMRRS(String value) { + this.agenciaTMRRS = value; + } + + /** + * Gets the value of the autorizacao0 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAutorizacao0() { + return autorizacao0; + } + + /** + * Sets the value of the autorizacao0 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAutorizacao0(String value) { + this.autorizacao0 = value; + } + + /** + * Gets the value of the autorizacao1 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAutorizacao1() { + return autorizacao1; + } + + /** + * Sets the value of the autorizacao1 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAutorizacao1(String value) { + this.autorizacao1 = value; + } + + /** + * Gets the value of the autorizacao2 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAutorizacao2() { + return autorizacao2; + } + + /** + * Sets the value of the autorizacao2 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAutorizacao2(String value) { + this.autorizacao2 = value; + } + + /** + * Gets the value of the bilheteiro property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getBilheteiro() { + return bilheteiro; + } + + /** + * Sets the value of the bilheteiro property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setBilheteiro(String value) { + this.bilheteiro = value; + } + + /** + * Gets the value of the boletoId property. + * + * @return + * possible object is + * {@link Long } + * + */ + public Long getBoletoId() { + return boletoId; + } + + /** + * Sets the value of the boletoId property. + * + * @param value + * allowed object is + * {@link Long } + * + */ + public void setBoletoId(Long value) { + this.boletoId = value; + } + + /** + * Gets the value of the cooFinalECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCOOFinalECF() { + return cooFinalECF; + } + + /** + * Sets the value of the cooFinalECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCOOFinalECF(String value) { + this.cooFinalECF = value; + } + + /** + * Gets the value of the cooInicialECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCOOInicialECF() { + return cooInicialECF; + } + + /** + * Sets the value of the cooInicialECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCOOInicialECF(String value) { + this.cooInicialECF = value; + } + + /** + * Gets the value of the croecf property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCROECF() { + return croecf; + } + + /** + * Sets the value of the croecf property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCROECF(String value) { + this.croecf = value; + } + + /** + * Gets the value of the crzecf property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCRZECF() { + return crzecf; + } + + /** + * Sets the value of the crzecf property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCRZECF(String value) { + this.crzecf = value; + } + + /** + * Gets the value of the cancelamentoICMSECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCancelamentoICMSECF() { + return cancelamentoICMSECF; + } + + /** + * Sets the value of the cancelamentoICMSECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCancelamentoICMSECF(String value) { + this.cancelamentoICMSECF = value; + } + + /** + * Gets the value of the codigoAnulacao property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoAnulacao() { + return codigoAnulacao; + } + + /** + * Sets the value of the codigoAnulacao property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoAnulacao(String value) { + this.codigoAnulacao = value; + } + + /** + * Gets the value of the codigoClienteRequisicao property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoClienteRequisicao() { + return codigoClienteRequisicao; + } + + /** + * Sets the value of the codigoClienteRequisicao property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoClienteRequisicao(String value) { + this.codigoClienteRequisicao = value; + } + + /** + * Gets the value of the codigoVenda property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getCodigoVenda() { + return codigoVenda; + } + + /** + * Sets the value of the codigoVenda property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setCodigoVenda(String value) { + this.codigoVenda = value; + } + + /** + * Gets the value of the dataReducaoECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDataReducaoECF() { + return dataReducaoECF; + } + + /** + * Sets the value of the dataReducaoECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDataReducaoECF(String value) { + this.dataReducaoECF = value; + } + + /** + * Gets the value of the dataServico property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDataServico() { + return dataServico; + } + + /** + * Sets the value of the dataServico property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDataServico(String value) { + this.dataServico = value; + } + + /** + * Gets the value of the dataVenda property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDataVenda() { + return dataVenda; + } + + /** + * Sets the value of the dataVenda property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDataVenda(String value) { + this.dataVenda = value; + } + + /** + * Gets the value of the dataViagem property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDataViagem() { + return dataViagem; + } + + /** + * Sets the value of the dataViagem property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDataViagem(String value) { + this.dataViagem = value; + } + + /** + * Gets the value of the desconto property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDesconto() { + return desconto; + } + + /** + * Sets the value of the desconto property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDesconto(String value) { + this.desconto = value; + } + + /** + * Gets the value of the descontoICMSECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDescontoICMSECF() { + return descontoICMSECF; + } + + /** + * Sets the value of the descontoICMSECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDescontoICMSECF(String value) { + this.descontoICMSECF = value; + } + + /** + * Gets the value of the destino property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDestino() { + return destino; + } + + /** + * Sets the value of the destino property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDestino(String value) { + this.destino = value; + } + + /** + * Gets the value of the devolucaoCupomFiscalECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getDevolucaoCupomFiscalECF() { + return devolucaoCupomFiscalECF; + } + + /** + * Sets the value of the devolucaoCupomFiscalECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setDevolucaoCupomFiscalECF(String value) { + this.devolucaoCupomFiscalECF = value; + } + + /** + * Gets the value of the espaco1 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEspaco1() { + return espaco1; + } + + /** + * Sets the value of the espaco1 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEspaco1(String value) { + this.espaco1 = value; + } + + /** + * Gets the value of the espaco2 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEspaco2() { + return espaco2; + } + + /** + * Sets the value of the espaco2 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEspaco2(String value) { + this.espaco2 = value; + } + + /** + * Gets the value of the espaco3 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEspaco3() { + return espaco3; + } + + /** + * Sets the value of the espaco3 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEspaco3(String value) { + this.espaco3 = value; + } + + /** + * Gets the value of the espaco4 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEspaco4() { + return espaco4; + } + + /** + * Sets the value of the espaco4 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEspaco4(String value) { + this.espaco4 = value; + } + + /** + * Gets the value of the espaco5 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEspaco5() { + return espaco5; + } + + /** + * Sets the value of the espaco5 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEspaco5(String value) { + this.espaco5 = value; + } + + /** + * Gets the value of the estabelecimento0 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstabelecimento0() { + return estabelecimento0; + } + + /** + * Sets the value of the estabelecimento0 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstabelecimento0(String value) { + this.estabelecimento0 = value; + } + + /** + * Gets the value of the estabelecimento1 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstabelecimento1() { + return estabelecimento1; + } + + /** + * Sets the value of the estabelecimento1 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstabelecimento1(String value) { + this.estabelecimento1 = value; + } + + /** + * Gets the value of the estabelecimento2 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstabelecimento2() { + return estabelecimento2; + } + + /** + * Sets the value of the estabelecimento2 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstabelecimento2(String value) { + this.estabelecimento2 = value; + } + + /** + * Gets the value of the estado property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getEstado() { + return estado; + } + + /** + * Sets the value of the estado property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setEstado(String value) { + this.estado = value; + } + + /** + * Gets the value of the exclusivoBilheteriaGlobus property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getExclusivoBilheteriaGlobus() { + return exclusivoBilheteriaGlobus; + } + + /** + * Sets the value of the exclusivoBilheteriaGlobus property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setExclusivoBilheteriaGlobus(String value) { + this.exclusivoBilheteriaGlobus = value; + } + + /** + * Gets the value of the formaPagto0 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFormaPagto0() { + return formaPagto0; + } + + /** + * Sets the value of the formaPagto0 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFormaPagto0(String value) { + this.formaPagto0 = value; + } + + /** + * Gets the value of the formaPagto1 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFormaPagto1() { + return formaPagto1; + } + + /** + * Sets the value of the formaPagto1 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFormaPagto1(String value) { + this.formaPagto1 = value; + } + + /** + * Gets the value of the formaPagto2 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getFormaPagto2() { + return formaPagto2; + } + + /** + * Sets the value of the formaPagto2 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setFormaPagto2(String value) { + this.formaPagto2 = value; + } + + /** + * Gets the value of the horaServico property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getHoraServico() { + return horaServico; + } + + /** + * Sets the value of the horaServico property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setHoraServico(String value) { + this.horaServico = value; + } + + /** + * Gets the value of the horaVenda property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getHoraVenda() { + return horaVenda; + } + + /** + * Sets the value of the horaVenda property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setHoraVenda(String value) { + this.horaVenda = value; + } + + /** + * Gets the value of the horaViagem property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getHoraViagem() { + return horaViagem; + } + + /** + * Sets the value of the horaViagem property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setHoraViagem(String value) { + this.horaViagem = value; + } + + /** + * Gets the value of the isentoICMSECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getIsentoICMSECF() { + return isentoICMSECF; + } + + /** + * Sets the value of the isentoICMSECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setIsentoICMSECF(String value) { + this.isentoICMSECF = value; + } + + /** + * Gets the value of the linha property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getLinha() { + return linha; + } + + /** + * Sets the value of the linha property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setLinha(String value) { + this.linha = value; + } + + /** + * Gets the value of the modalidadeIPosterior property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getModalidadeIPosterior() { + return modalidadeIPosterior; + } + + /** + * Sets the value of the modalidadeIPosterior property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setModalidadeIPosterior(String value) { + this.modalidadeIPosterior = value; + } + + /** + * Gets the value of the modeloBilheteFiscalECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getModeloBilheteFiscalECF() { + return modeloBilheteFiscalECF; + } + + /** + * Sets the value of the modeloBilheteFiscalECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setModeloBilheteFiscalECF(String value) { + this.modeloBilheteFiscalECF = value; + } + + /** + * Gets the value of the motorista1 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMotorista1() { + return motorista1; + } + + /** + * Sets the value of the motorista1 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMotorista1(String value) { + this.motorista1 = value; + } + + /** + * Gets the value of the motorista2 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getMotorista2() { + return motorista2; + } + + /** + * Sets the value of the motorista2 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setMotorista2(String value) { + this.motorista2 = value; + } + + /** + * Gets the value of the nsu0 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNSU0() { + return nsu0; + } + + /** + * Sets the value of the nsu0 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNSU0(String value) { + this.nsu0 = value; + } + + /** + * Gets the value of the nsu1 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNSU1() { + return nsu1; + } + + /** + * Sets the value of the nsu1 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNSU1(String value) { + this.nsu1 = value; + } + + /** + * Gets the value of the nsu2 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNSU2() { + return nsu2; + } + + /** + * Sets the value of the nsu2 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNSU2(String value) { + this.nsu2 = value; + } + + /** + * Gets the value of the nsuHostTID0 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNSUHostTID0() { + return nsuHostTID0; + } + + /** + * Sets the value of the nsuHostTID0 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNSUHostTID0(String value) { + this.nsuHostTID0 = value; + } + + /** + * Gets the value of the nsuHostTID1 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNSUHostTID1() { + return nsuHostTID1; + } + + /** + * Sets the value of the nsuHostTID1 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNSUHostTID1(String value) { + this.nsuHostTID1 = value; + } + + /** + * Gets the value of the nsuHostTID2 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNSUHostTID2() { + return nsuHostTID2; + } + + /** + * Sets the value of the nsuHostTID2 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNSUHostTID2(String value) { + this.nsuHostTID2 = value; + } + + /** + * Gets the value of the naoIncidenciaICMSECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNaoIncidenciaICMSECF() { + return naoIncidenciaICMSECF; + } + + /** + * Sets the value of the naoIncidenciaICMSECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNaoIncidenciaICMSECF(String value) { + this.naoIncidenciaICMSECF = value; + } + + /** + * Gets the value of the nomePassageiroRequisicao property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNomePassageiroRequisicao() { + return nomePassageiroRequisicao; + } + + /** + * Sets the value of the nomePassageiroRequisicao property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNomePassageiroRequisicao(String value) { + this.nomePassageiroRequisicao = value; + } + + /** + * Gets the value of the numeroCaixaFiscalECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroCaixaFiscalECF() { + return numeroCaixaFiscalECF; + } + + /** + * Sets the value of the numeroCaixaFiscalECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroCaixaFiscalECF(String value) { + this.numeroCaixaFiscalECF = value; + } + + /** + * Gets the value of the numeroCupomFiscalECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroCupomFiscalECF() { + return numeroCupomFiscalECF; + } + + /** + * Sets the value of the numeroCupomFiscalECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroCupomFiscalECF(String value) { + this.numeroCupomFiscalECF = value; + } + + /** + * Gets the value of the numeroDVPRS property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroDVPRS() { + return numeroDVPRS; + } + + /** + * Sets the value of the numeroDVPRS property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroDVPRS(String value) { + this.numeroDVPRS = value; + } + + /** + * Gets the value of the numeroLojaFiscalECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroLojaFiscalECF() { + return numeroLojaFiscalECF; + } + + /** + * Sets the value of the numeroLojaFiscalECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroLojaFiscalECF(String value) { + this.numeroLojaFiscalECF = value; + } + + /** + * Gets the value of the numeroPreImpresso property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroPreImpresso() { + return numeroPreImpresso; + } + + /** + * Sets the value of the numeroPreImpresso property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroPreImpresso(String value) { + this.numeroPreImpresso = value; + } + + /** + * Gets the value of the numeroRequisicao property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroRequisicao() { + return numeroRequisicao; + } + + /** + * Sets the value of the numeroRequisicao property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroRequisicao(String value) { + this.numeroRequisicao = value; + } + + /** + * Gets the value of the numeroSerieImpressoraECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroSerieImpressoraECF() { + return numeroSerieImpressoraECF; + } + + /** + * Sets the value of the numeroSerieImpressoraECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroSerieImpressoraECF(String value) { + this.numeroSerieImpressoraECF = value; + } + + /** + * Gets the value of the numeroSistemaEstado property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroSistemaEstado() { + return numeroSistemaEstado; + } + + /** + * Sets the value of the numeroSistemaEstado property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroSistemaEstado(String value) { + this.numeroSistemaEstado = value; + } + + /** + * Gets the value of the numeroVT property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getNumeroVT() { + return numeroVT; + } + + /** + * Sets the value of the numeroVT property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setNumeroVT(String value) { + this.numeroVT = value; + } + + /** + * Gets the value of the origem property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getOrigem() { + return origem; + } + + /** + * Sets the value of the origem property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setOrigem(String value) { + this.origem = value; + } + + /** + * Gets the value of the outros property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getOutros() { + return outros; + } + + /** + * Sets the value of the outros property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setOutros(String value) { + this.outros = value; + } + + /** + * Gets the value of the pedagio property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPedagio() { + return pedagio; + } + + /** + * Sets the value of the pedagio property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPedagio(String value) { + this.pedagio = value; + } + + /** + * Gets the value of the poltrona property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPoltrona() { + return poltrona; + } + + /** + * Sets the value of the poltrona property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPoltrona(String value) { + this.poltrona = value; + } + + /** + * Gets the value of the porcentagemFormaPagto0 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPorcentagemFormaPagto0() { + return porcentagemFormaPagto0; + } + + /** + * Sets the value of the porcentagemFormaPagto0 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPorcentagemFormaPagto0(String value) { + this.porcentagemFormaPagto0 = value; + } + + /** + * Gets the value of the porcentagemFormaPagto1 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPorcentagemFormaPagto1() { + return porcentagemFormaPagto1; + } + + /** + * Sets the value of the porcentagemFormaPagto1 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPorcentagemFormaPagto1(String value) { + this.porcentagemFormaPagto1 = value; + } + + /** + * Gets the value of the porcentagemFormaPagto2 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPorcentagemFormaPagto2() { + return porcentagemFormaPagto2; + } + + /** + * Sets the value of the porcentagemFormaPagto2 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPorcentagemFormaPagto2(String value) { + this.porcentagemFormaPagto2 = value; + } + + /** + * Gets the value of the prefixoLinha property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getPrefixoLinha() { + return prefixoLinha; + } + + /** + * Sets the value of the prefixoLinha property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setPrefixoLinha(String value) { + this.prefixoLinha = value; + } + + /** + * Gets the value of the qtdeParcela0 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getQtdeParcela0() { + return qtdeParcela0; + } + + /** + * Sets the value of the qtdeParcela0 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setQtdeParcela0(String value) { + this.qtdeParcela0 = value; + } + + /** + * Gets the value of the qtdeParcela1 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getQtdeParcela1() { + return qtdeParcela1; + } + + /** + * Sets the value of the qtdeParcela1 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setQtdeParcela1(String value) { + this.qtdeParcela1 = value; + } + + /** + * Gets the value of the qtdeParcela2 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getQtdeParcela2() { + return qtdeParcela2; + } + + /** + * Sets the value of the qtdeParcela2 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setQtdeParcela2(String value) { + this.qtdeParcela2 = value; + } + + /** + * Gets the value of the qtdePassageiros property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getQtdePassageiros() { + return qtdePassageiros; + } + + /** + * Sets the value of the qtdePassageiros property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setQtdePassageiros(String value) { + this.qtdePassageiros = value; + } + + /** + * Gets the value of the quantidadeCanceladoECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getQuantidadeCanceladoECF() { + return quantidadeCanceladoECF; + } + + /** + * Sets the value of the quantidadeCanceladoECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setQuantidadeCanceladoECF(String value) { + this.quantidadeCanceladoECF = value; + } + + /** + * Gets the value of the registros property. + * + * @return + * possible object is + * {@link Integer } + * + */ + public Integer getRegistros() { + return registros; + } + + /** + * Sets the value of the registros property. + * + * @param value + * allowed object is + * {@link Integer } + * + */ + public void setRegistros(Integer value) { + this.registros = value; + } + + /** + * Gets the value of the svirs property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSVIRS() { + return svirs; + } + + /** + * Sets the value of the svirs property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSVIRS(String value) { + this.svirs = value; + } + + /** + * Gets the value of the seguro property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSeguro() { + return seguro; + } + + /** + * Sets the value of the seguro property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSeguro(String value) { + this.seguro = value; + } + + /** + * Gets the value of the seriePassagens property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSeriePassagens() { + return seriePassagens; + } + + /** + * Sets the value of the seriePassagens property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSeriePassagens(String value) { + this.seriePassagens = value; + } + + /** + * Gets the value of the servico property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getServico() { + return servico; + } + + /** + * Sets the value of the servico property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setServico(String value) { + this.servico = value; + } + + /** + * Gets the value of the statusSVIRS property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getStatusSVIRS() { + return statusSVIRS; + } + + /** + * Sets the value of the statusSVIRS property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setStatusSVIRS(String value) { + this.statusSVIRS = value; + } + + /** + * Gets the value of the subseriePassagens property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSubseriePassagens() { + return subseriePassagens; + } + + /** + * Sets the value of the subseriePassagens property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSubseriePassagens(String value) { + this.subseriePassagens = value; + } + + /** + * Gets the value of the substituicaoTributariaICMSECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getSubstituicaoTributariaICMSECF() { + return substituicaoTributariaICMSECF; + } + + /** + * Sets the value of the substituicaoTributariaICMSECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setSubstituicaoTributariaICMSECF(String value) { + this.substituicaoTributariaICMSECF = value; + } + + /** + * Gets the value of the tmrrs property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTMRRS() { + return tmrrs; + } + + /** + * Sets the value of the tmrrs property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTMRRS(String value) { + this.tmrrs = value; + } + + /** + * Gets the value of the tarifa property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTarifa() { + return tarifa; + } + + /** + * Sets the value of the tarifa property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTarifa(String value) { + this.tarifa = value; + } + + /** + * Gets the value of the taxaEmbarque property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTaxaEmbarque() { + return taxaEmbarque; + } + + /** + * Sets the value of the taxaEmbarque property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTaxaEmbarque(String value) { + this.taxaEmbarque = value; + } + + /** + * Gets the value of the tipoPassagem property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getTipoPassagem() { + return tipoPassagem; + } + + /** + * Sets the value of the tipoPassagem property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setTipoPassagem(String value) { + this.tipoPassagem = value; + } + + /** + * Gets the value of the valorGrandeTotalECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValorGrandeTotalECF() { + return valorGrandeTotalECF; + } + + /** + * Sets the value of the valorGrandeTotalECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValorGrandeTotalECF(String value) { + this.valorGrandeTotalECF = value; + } + + /** + * Gets the value of the valorMultaCancelamento property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValorMultaCancelamento() { + return valorMultaCancelamento; + } + + /** + * Sets the value of the valorMultaCancelamento property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValorMultaCancelamento(String value) { + this.valorMultaCancelamento = value; + } + + /** + * Gets the value of the valorVendaBrutaECF property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getValorVendaBrutaECF() { + return valorVendaBrutaECF; + } + + /** + * Sets the value of the valorVendaBrutaECF property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setValorVendaBrutaECF(String value) { + this.valorVendaBrutaECF = value; + } + + /** + * Gets the value of the veiculo property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVeiculo() { + return veiculo; + } + + /** + * Sets the value of the veiculo property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVeiculo(String value) { + this.veiculo = value; + } + + /** + * Gets the value of the vlrFormaPagto0 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVlrFormaPagto0() { + return vlrFormaPagto0; + } + + /** + * Sets the value of the vlrFormaPagto0 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVlrFormaPagto0(String value) { + this.vlrFormaPagto0 = value; + } + + /** + * Gets the value of the vlrFormaPagto1 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVlrFormaPagto1() { + return vlrFormaPagto1; + } + + /** + * Sets the value of the vlrFormaPagto1 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVlrFormaPagto1(String value) { + this.vlrFormaPagto1 = value; + } + + /** + * Gets the value of the vlrFormaPagto2 property. + * + * @return + * possible object is + * {@link String } + * + */ + public String getVlrFormaPagto2() { + return vlrFormaPagto2; + } + + /** + * Sets the value of the vlrFormaPagto2 property. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setVlrFormaPagto2(String value) { + this.vlrFormaPagto2 = value; + } + +} diff --git a/src/com/rjconsultores/hstcajservice/ws/ObjectFactory.java b/src/com/rjconsultores/hstcajservice/ws/ObjectFactory.java new file mode 100644 index 000000000..87a0c6006 --- /dev/null +++ b/src/com/rjconsultores/hstcajservice/ws/ObjectFactory.java @@ -0,0 +1,555 @@ + +package com.rjconsultores.hstcajservice.ws; + +import javax.xml.bind.JAXBElement; +import javax.xml.bind.annotation.XmlElementDecl; +import javax.xml.bind.annotation.XmlRegistry; +import javax.xml.namespace.QName; + + +/** + * This object contains factory methods for each + * Java content interface and Java element interface + * generated in the com.rjconsultores.hstcajservice.ws package. + *

An ObjectFactory allows you to programatically + * construct new instances of the Java representation + * for XML content. The Java representation of XML + * content can consist of schema derived interfaces + * and classes representing the binding of schema + * type definitions, element declarations and model + * groups. Factory methods for each of these are + * provided in this class. + * + */ +@XmlRegistry +public class ObjectFactory { + + private final static QName _CadReceitaDespesa_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadReceitaDespesa"); + private final static QName _BuscarReceitaDespesaResponse_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "buscarReceitaDespesaResponse"); + private final static QName _CadEstadoResponse_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadEstadoResponse"); + private final static QName _CadLocalidadeResponse_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadLocalidadeResponse"); + private final static QName _CadCliente_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadCliente"); + private final static QName _CadEstado_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadEstado"); + private final static QName _BuscarBilhetes_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "buscarBilhetes"); + private final static QName _CadLinha_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadLinha"); + private final static QName _CadBeneficioResponse_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadBeneficioResponse"); + private final static QName _CadAgenciaResponse_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadAgenciaResponse"); + private final static QName _CadLinhaResponse_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadLinhaResponse"); + private final static QName _BuscarBilhetesInconsistente_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "buscarBilhetesInconsistente"); + private final static QName _CadReceitaDespesaResponse_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadReceitaDespesaResponse"); + private final static QName _CadBilheteiroResponse_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadBilheteiroResponse"); + private final static QName _CadFormaPagamento_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadFormaPagamento"); + private final static QName _CadFormaPagamentoResponse_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadFormaPagamentoResponse"); + private final static QName _CadClienteResponse_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadClienteResponse"); + private final static QName _BuscarBilhetesInconsistenteResponse_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "buscarBilhetesInconsistenteResponse"); + private final static QName _BuscarBilhetesResponse_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "buscarBilhetesResponse"); + private final static QName _BuscarReceitaDespesa_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "buscarReceitaDespesa"); + private final static QName _CadBilheteiro_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadBilheteiro"); + private final static QName _CadBeneficio_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadBeneficio"); + private final static QName _CadLocalidade_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadLocalidade"); + private final static QName _CadAgencia_QNAME = new QName("http://ws.hstcajservice.rjconsultores.com/", "cadAgencia"); + + /** + * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.rjconsultores.hstcajservice.ws + * + */ + public ObjectFactory() { + } + + /** + * Create an instance of {@link CadBilheteiro } + * + */ + public CadBilheteiro createCadBilheteiro() { + return new CadBilheteiro(); + } + + /** + * Create an instance of {@link ExportaIntegracaoCadClienteWS } + * + */ + public ExportaIntegracaoCadClienteWS createExportaIntegracaoCadClienteWS() { + return new ExportaIntegracaoCadClienteWS(); + } + + /** + * Create an instance of {@link CadBilheteiroResponse } + * + */ + public CadBilheteiroResponse createCadBilheteiroResponse() { + return new CadBilheteiroResponse(); + } + + /** + * Create an instance of {@link CadCliente } + * + */ + public CadCliente createCadCliente() { + return new CadCliente(); + } + + /** + * Create an instance of {@link ExportaIntegracaoCadFormaPagamentoWS } + * + */ + public ExportaIntegracaoCadFormaPagamentoWS createExportaIntegracaoCadFormaPagamentoWS() { + return new ExportaIntegracaoCadFormaPagamentoWS(); + } + + /** + * Create an instance of {@link ExportaIntegracaoCadBilheteiroWS } + * + */ + public ExportaIntegracaoCadBilheteiroWS createExportaIntegracaoCadBilheteiroWS() { + return new ExportaIntegracaoCadBilheteiroWS(); + } + + /** + * Create an instance of {@link CadLocalidade } + * + */ + public CadLocalidade createCadLocalidade() { + return new CadLocalidade(); + } + + /** + * Create an instance of {@link ExportaIntegracaoWS } + * + */ + public ExportaIntegracaoWS createExportaIntegracaoWS() { + return new ExportaIntegracaoWS(); + } + + /** + * Create an instance of {@link BuscarBilhetesInconsistente } + * + */ + public BuscarBilhetesInconsistente createBuscarBilhetesInconsistente() { + return new BuscarBilhetesInconsistente(); + } + + /** + * Create an instance of {@link CadReceitaDespesaResponse } + * + */ + public CadReceitaDespesaResponse createCadReceitaDespesaResponse() { + return new CadReceitaDespesaResponse(); + } + + /** + * Create an instance of {@link CadEstadoResponse } + * + */ + public CadEstadoResponse createCadEstadoResponse() { + return new CadEstadoResponse(); + } + + /** + * Create an instance of {@link ExportaIntegracaoCadLocalidadeWS } + * + */ + public ExportaIntegracaoCadLocalidadeWS createExportaIntegracaoCadLocalidadeWS() { + return new ExportaIntegracaoCadLocalidadeWS(); + } + + /** + * Create an instance of {@link ExportaIntegracaoCadAgenciaWS } + * + */ + public ExportaIntegracaoCadAgenciaWS createExportaIntegracaoCadAgenciaWS() { + return new ExportaIntegracaoCadAgenciaWS(); + } + + /** + * Create an instance of {@link CadLinha } + * + */ + public CadLinha createCadLinha() { + return new CadLinha(); + } + + /** + * Create an instance of {@link ExportaIntegracaoCadLinhaWS } + * + */ + public ExportaIntegracaoCadLinhaWS createExportaIntegracaoCadLinhaWS() { + return new ExportaIntegracaoCadLinhaWS(); + } + + /** + * Create an instance of {@link CadAgencia } + * + */ + public CadAgencia createCadAgencia() { + return new CadAgencia(); + } + + /** + * Create an instance of {@link CadReceitaDespesa } + * + */ + public CadReceitaDespesa createCadReceitaDespesa() { + return new CadReceitaDespesa(); + } + + /** + * Create an instance of {@link BuscarBilhetes } + * + */ + public BuscarBilhetes createBuscarBilhetes() { + return new BuscarBilhetes(); + } + + /** + * Create an instance of {@link BuscarBilhetesResponse } + * + */ + public BuscarBilhetesResponse createBuscarBilhetesResponse() { + return new BuscarBilhetesResponse(); + } + + /** + * Create an instance of {@link CadFormaPagamentoResponse } + * + */ + public CadFormaPagamentoResponse createCadFormaPagamentoResponse() { + return new CadFormaPagamentoResponse(); + } + + /** + * Create an instance of {@link CadFormaPagamento } + * + */ + public CadFormaPagamento createCadFormaPagamento() { + return new CadFormaPagamento(); + } + + /** + * Create an instance of {@link CadBeneficioResponse } + * + */ + public CadBeneficioResponse createCadBeneficioResponse() { + return new CadBeneficioResponse(); + } + + /** + * Create an instance of {@link CadEstado } + * + */ + public CadEstado createCadEstado() { + return new CadEstado(); + } + + /** + * Create an instance of {@link CadBeneficio } + * + */ + public CadBeneficio createCadBeneficio() { + return new CadBeneficio(); + } + + /** + * Create an instance of {@link BuscarReceitaDespesa } + * + */ + public BuscarReceitaDespesa createBuscarReceitaDespesa() { + return new BuscarReceitaDespesa(); + } + + /** + * Create an instance of {@link ExportaIntegracaoReceitaDespesaWS } + * + */ + public ExportaIntegracaoReceitaDespesaWS createExportaIntegracaoReceitaDespesaWS() { + return new ExportaIntegracaoReceitaDespesaWS(); + } + + /** + * Create an instance of {@link ExportaIntegracaoCadBeneficioWS } + * + */ + public ExportaIntegracaoCadBeneficioWS createExportaIntegracaoCadBeneficioWS() { + return new ExportaIntegracaoCadBeneficioWS(); + } + + /** + * Create an instance of {@link ExportaIntegracaoCadReceitaDespesaWS } + * + */ + public ExportaIntegracaoCadReceitaDespesaWS createExportaIntegracaoCadReceitaDespesaWS() { + return new ExportaIntegracaoCadReceitaDespesaWS(); + } + + /** + * Create an instance of {@link CadLocalidadeResponse } + * + */ + public CadLocalidadeResponse createCadLocalidadeResponse() { + return new CadLocalidadeResponse(); + } + + /** + * Create an instance of {@link BuscarReceitaDespesaResponse } + * + */ + public BuscarReceitaDespesaResponse createBuscarReceitaDespesaResponse() { + return new BuscarReceitaDespesaResponse(); + } + + /** + * Create an instance of {@link ExportaIntegracaoCadEstadoWS } + * + */ + public ExportaIntegracaoCadEstadoWS createExportaIntegracaoCadEstadoWS() { + return new ExportaIntegracaoCadEstadoWS(); + } + + /** + * Create an instance of {@link CadAgenciaResponse } + * + */ + public CadAgenciaResponse createCadAgenciaResponse() { + return new CadAgenciaResponse(); + } + + /** + * Create an instance of {@link BuscarBilhetesInconsistenteResponse } + * + */ + public BuscarBilhetesInconsistenteResponse createBuscarBilhetesInconsistenteResponse() { + return new BuscarBilhetesInconsistenteResponse(); + } + + /** + * Create an instance of {@link CadClienteResponse } + * + */ + public CadClienteResponse createCadClienteResponse() { + return new CadClienteResponse(); + } + + /** + * Create an instance of {@link CadLinhaResponse } + * + */ + public CadLinhaResponse createCadLinhaResponse() { + return new CadLinhaResponse(); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadReceitaDespesa }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadReceitaDespesa") + public JAXBElement createCadReceitaDespesa(CadReceitaDespesa value) { + return new JAXBElement(_CadReceitaDespesa_QNAME, CadReceitaDespesa.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BuscarReceitaDespesaResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "buscarReceitaDespesaResponse") + public JAXBElement createBuscarReceitaDespesaResponse(BuscarReceitaDespesaResponse value) { + return new JAXBElement(_BuscarReceitaDespesaResponse_QNAME, BuscarReceitaDespesaResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadEstadoResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadEstadoResponse") + public JAXBElement createCadEstadoResponse(CadEstadoResponse value) { + return new JAXBElement(_CadEstadoResponse_QNAME, CadEstadoResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadLocalidadeResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadLocalidadeResponse") + public JAXBElement createCadLocalidadeResponse(CadLocalidadeResponse value) { + return new JAXBElement(_CadLocalidadeResponse_QNAME, CadLocalidadeResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadCliente }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadCliente") + public JAXBElement createCadCliente(CadCliente value) { + return new JAXBElement(_CadCliente_QNAME, CadCliente.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadEstado }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadEstado") + public JAXBElement createCadEstado(CadEstado value) { + return new JAXBElement(_CadEstado_QNAME, CadEstado.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BuscarBilhetes }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "buscarBilhetes") + public JAXBElement createBuscarBilhetes(BuscarBilhetes value) { + return new JAXBElement(_BuscarBilhetes_QNAME, BuscarBilhetes.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadLinha }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadLinha") + public JAXBElement createCadLinha(CadLinha value) { + return new JAXBElement(_CadLinha_QNAME, CadLinha.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadBeneficioResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadBeneficioResponse") + public JAXBElement createCadBeneficioResponse(CadBeneficioResponse value) { + return new JAXBElement(_CadBeneficioResponse_QNAME, CadBeneficioResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadAgenciaResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadAgenciaResponse") + public JAXBElement createCadAgenciaResponse(CadAgenciaResponse value) { + return new JAXBElement(_CadAgenciaResponse_QNAME, CadAgenciaResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadLinhaResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadLinhaResponse") + public JAXBElement createCadLinhaResponse(CadLinhaResponse value) { + return new JAXBElement(_CadLinhaResponse_QNAME, CadLinhaResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BuscarBilhetesInconsistente }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "buscarBilhetesInconsistente") + public JAXBElement createBuscarBilhetesInconsistente(BuscarBilhetesInconsistente value) { + return new JAXBElement(_BuscarBilhetesInconsistente_QNAME, BuscarBilhetesInconsistente.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadReceitaDespesaResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadReceitaDespesaResponse") + public JAXBElement createCadReceitaDespesaResponse(CadReceitaDespesaResponse value) { + return new JAXBElement(_CadReceitaDespesaResponse_QNAME, CadReceitaDespesaResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadBilheteiroResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadBilheteiroResponse") + public JAXBElement createCadBilheteiroResponse(CadBilheteiroResponse value) { + return new JAXBElement(_CadBilheteiroResponse_QNAME, CadBilheteiroResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadFormaPagamento }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadFormaPagamento") + public JAXBElement createCadFormaPagamento(CadFormaPagamento value) { + return new JAXBElement(_CadFormaPagamento_QNAME, CadFormaPagamento.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadFormaPagamentoResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadFormaPagamentoResponse") + public JAXBElement createCadFormaPagamentoResponse(CadFormaPagamentoResponse value) { + return new JAXBElement(_CadFormaPagamentoResponse_QNAME, CadFormaPagamentoResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadClienteResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadClienteResponse") + public JAXBElement createCadClienteResponse(CadClienteResponse value) { + return new JAXBElement(_CadClienteResponse_QNAME, CadClienteResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BuscarBilhetesInconsistenteResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "buscarBilhetesInconsistenteResponse") + public JAXBElement createBuscarBilhetesInconsistenteResponse(BuscarBilhetesInconsistenteResponse value) { + return new JAXBElement(_BuscarBilhetesInconsistenteResponse_QNAME, BuscarBilhetesInconsistenteResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BuscarBilhetesResponse }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "buscarBilhetesResponse") + public JAXBElement createBuscarBilhetesResponse(BuscarBilhetesResponse value) { + return new JAXBElement(_BuscarBilhetesResponse_QNAME, BuscarBilhetesResponse.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link BuscarReceitaDespesa }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "buscarReceitaDespesa") + public JAXBElement createBuscarReceitaDespesa(BuscarReceitaDespesa value) { + return new JAXBElement(_BuscarReceitaDespesa_QNAME, BuscarReceitaDespesa.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadBilheteiro }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadBilheteiro") + public JAXBElement createCadBilheteiro(CadBilheteiro value) { + return new JAXBElement(_CadBilheteiro_QNAME, CadBilheteiro.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadBeneficio }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadBeneficio") + public JAXBElement createCadBeneficio(CadBeneficio value) { + return new JAXBElement(_CadBeneficio_QNAME, CadBeneficio.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadLocalidade }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadLocalidade") + public JAXBElement createCadLocalidade(CadLocalidade value) { + return new JAXBElement(_CadLocalidade_QNAME, CadLocalidade.class, null, value); + } + + /** + * Create an instance of {@link JAXBElement }{@code <}{@link CadAgencia }{@code >}} + * + */ + @XmlElementDecl(namespace = "http://ws.hstcajservice.rjconsultores.com/", name = "cadAgencia") + public JAXBElement createCadAgencia(CadAgencia value) { + return new JAXBElement(_CadAgencia_QNAME, CadAgencia.class, null, value); + } + +} diff --git a/src/com/rjconsultores/routing/DynamicDataSourceHolder.java b/src/com/rjconsultores/routing/DynamicDataSourceHolder.java new file mode 100644 index 000000000..94df3d94c --- /dev/null +++ b/src/com/rjconsultores/routing/DynamicDataSourceHolder.java @@ -0,0 +1,18 @@ +package com.rjconsultores.routing; + +public class DynamicDataSourceHolder { + private static ThreadLocal routeKey = new ThreadLocal(); + + public static String getRouteKey() { + String key = routeKey.get(); + return key; + } + + public static void setRouteKey(String key) { + routeKey.set(key); + } + + public static void removeRouteKey() { + routeKey.remove(); + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/routing/MultipleDataSource.java b/src/com/rjconsultores/routing/MultipleDataSource.java new file mode 100644 index 000000000..4c7e4f016 --- /dev/null +++ b/src/com/rjconsultores/routing/MultipleDataSource.java @@ -0,0 +1,10 @@ +package com.rjconsultores.routing; + +import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; + +public class MultipleDataSource extends AbstractRoutingDataSource { + @Override + protected Object determineCurrentLookupKey() { + return DynamicDataSourceHolder.getRouteKey(); + } +} diff --git a/src/com/rjconsultores/routing/ReadOnlyConnection.java b/src/com/rjconsultores/routing/ReadOnlyConnection.java new file mode 100644 index 000000000..779b364cd --- /dev/null +++ b/src/com/rjconsultores/routing/ReadOnlyConnection.java @@ -0,0 +1,12 @@ +package com.rjconsultores.routing; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ReadOnlyConnection { + +} \ No newline at end of file diff --git a/src/com/rjconsultores/routing/ReadOnlyRouteInterceptor.java b/src/com/rjconsultores/routing/ReadOnlyRouteInterceptor.java new file mode 100644 index 000000000..ea42ccc7d --- /dev/null +++ b/src/com/rjconsultores/routing/ReadOnlyRouteInterceptor.java @@ -0,0 +1,39 @@ +package com.rjconsultores.routing; + +import org.apache.log4j.Logger; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; + +@Aspect +@Component +@Order(0) +public class ReadOnlyRouteInterceptor { + private static Logger log = Logger.getLogger(ReadOnlyRouteInterceptor.class); + + @Around("@annotation(readOnlyConnection)") + public Object proceed(ProceedingJoinPoint proceedingJoinPoint, ReadOnlyConnection readOnlyConnection) throws Throwable { + if (ApplicationProperties.getInstance().getReadOnlyConnection()) { + try { + String className = proceedingJoinPoint.getSignature().getDeclaringTypeName(); + String methodName = proceedingJoinPoint.getSignature().getName(); + + log.debug("*** READ *** [" + className + "." + methodName + "()"); + } catch (Exception e) {} + + try { + DynamicDataSourceHolder.setRouteKey("dataSourceRead"); + + return proceedingJoinPoint.proceed(); + } finally { + DynamicDataSourceHolder.removeRouteKey(); + } + } else { + return proceedingJoinPoint.proceed(); + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/auditoria/AuditControl.java b/src/com/rjconsultores/ventaboletos/auditoria/AuditControl.java new file mode 100644 index 000000000..101e6a869 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/auditoria/AuditControl.java @@ -0,0 +1,233 @@ +package com.rjconsultores.ventaboletos.auditoria; + +import java.lang.reflect.Field; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; +import com.rjconsultores.ventaboletos.entidad.AuditService; + +public class AuditControl { + private String currentActionService; + private Boolean checkModuleAudit; + private AuditService currentService; + private Boolean auditar; + + private static Gson gson; + private static SimpleDateFormat sdf; + + AuditControl(String currentActionService) { + this.currentActionService = currentActionService; + } + + public static String toJson(Object object) throws IllegalArgumentException, IllegalAccessException, ParseException { + SimpleDateFormat sdf = new SimpleDateFormat(); + sdf.applyPattern("dd/MM/yyyy hh:mm:ss"); + + StringBuilder json = new StringBuilder(); + json.append("{"); + + List lsClazz = new ArrayList(); + List lsFieldName = new ArrayList(); + + if (object != null){ + for (Field field : object.getClass().getDeclaredFields()) { + if ((!field.isAnnotationPresent(Column.class) && !field.isAnnotationPresent(Id.class) && + !field.isAnnotationPresent(ManyToOne.class)) || field.getType().getSimpleName().equalsIgnoreCase("byte[]")) { + continue; + } + + if (!field.isAnnotationPresent(ManyToOne.class)) { + if (json.length() > 1) { + json.append(","); + } + + json.append("\"".concat(field.getName().concat("\":"))); + } else { + lsFieldName.add("\"".concat(field.getName().concat("\":"))); + } + + field.setAccessible(true); + + if (field.getType().getName().contains("String") || field.getType().getName().contains("Date")) { + json.append("\""); + + Date date = null; + + if (field.getType().getName().equals("java.util.Date")) { + date = (java.util.Date) field.get(object); + json.append(date == null ? "null" : sdf.format(date)); + } else if (field.getType().getName().equals("java.sql.Date")) { + date = (Date) field.get(object); + json.append(date == null ? "null" : sdf.format(date)); + } else if (field.getType().getName().contains("String")) { + json.append((String) field.get(object)); + } + + json.append("\""); + + continue; + } + + if (field.isAnnotationPresent(ManyToOne.class)) { + lsClazz.add(field.get(object)); + continue; + } + + json.append(field.get(object) == null ? "null" : field.get(object).toString()); + } + } + + for (int i = 0; i < lsClazz.size(); i++) { + json.append(","); + + json.append(lsFieldName.get(i)); + json.append(AuditControl.toJson(lsClazz.get(i))); + } + + json.append("}"); + + return json.toString(); + } + + public static Gson getGson() { + if (AuditControl.gson == null) { + GsonBuilder gsonBuilder = new GsonBuilder(); + gsonBuilder.registerTypeAdapter(Date.class, new JsonDeserializer() { + DateFormat df = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); + + public Date deserialize(final JsonElement json, final Type typeOfT, final JsonDeserializationContext context) + throws JsonParseException { + try { + return df.parse(json.getAsString()); + } catch (ParseException e) { + return null; + } + } + }); + gson = gsonBuilder.create(); + } + + return gson; + } + + public static String formatJson(Object clazz, boolean mainClass) throws IllegalArgumentException, IllegalAccessException { + String init = "{"; + String fim = "}"; + String tab = "\t"; + String ql = "\r"; + + String ret = init.concat(ql).concat(tab); + + List lsClazz = new ArrayList(); + List lsNameFd = new ArrayList(); + + if (clazz != null){ + for (Field field : clazz.getClass().getDeclaredFields()) { + if (!field.isAnnotationPresent(Column.class) && !field.isAnnotationPresent(Id.class) && + !field.isAnnotationPresent(ManyToOne.class)) { + continue; + } + + field.setAccessible(true); + + if (field.isAnnotationPresent(ManyToOne.class) && field.get(clazz) != null) { + lsNameFd.add(field.getName()); + lsClazz.add(field.get(clazz)); + continue; + } + + + if (!mainClass) { + ret += tab; + } + + ret += field.getName().concat(":"); + + String fieldValue = null; + + if (field.getType().getSimpleName().equalsIgnoreCase("date") && field.get(clazz) != null) { + fieldValue = AuditControl.convertDateObjectToString(field.get(clazz)); + } else { + fieldValue = (field.get(clazz) == null ? "null" : field.get(clazz)).toString(); + } + + ret += fieldValue; + ret += ql.concat(tab); + } + + for (int i = 0; i < lsClazz.size(); i++) { + ret += lsNameFd.get(i).concat(tab.concat(":").concat(tab)); + ret += formatJson(lsClazz.get(i), false); + } + + if (mainClass) { + ret += ql.concat(fim); + } else { + ret += ql.concat(tab.concat(fim).concat(",").concat(ql).concat(tab)); + } + } + return ret; + } + + public static String convertDateObjectToString(Object dateObject) throws RuntimeException { + if (sdf == null) { + sdf = new SimpleDateFormat(); + sdf.applyPattern("dd/MM/yyyy hh:mm:ss"); + } + + if (dateObject.getClass().getName().contains("util")) { + Date date = (Date) dateObject; + return sdf.format(date); + } + + if (dateObject.getClass().getName().contains("sql")) { + java.sql.Date date = (java.sql.Date) dateObject; + return sdf.format(new Date(date.getTime())); + } + + throw new RuntimeException("Não foi possível realizar a conversão de data.\rClass: " + AuditControl.class.getName()); + } + + public String getCurrentActionService() { + return currentActionService; + } + + public AuditService getCurrentService() { + return currentService; + } + + public void setCurrentService(AuditService currentService) { + this.currentService = currentService; + } + + public Boolean getCheckModuleAudit() { + return checkModuleAudit; + } + + public void setCheckModuleAudit(Boolean checkModuleAudit) { + this.checkModuleAudit = checkModuleAudit; + } + + public Boolean getAuditar() { + return auditar; + } + + public void setAuditar(Boolean auditar) { + this.auditar = auditar; + } +} diff --git a/src/com/rjconsultores/ventaboletos/auditoria/AuditManager.java b/src/com/rjconsultores/ventaboletos/auditoria/AuditManager.java new file mode 100644 index 000000000..4a8a2ecd3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/auditoria/AuditManager.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.auditoria; + +public class AuditManager { + private static AuditControl INSTANCE; + + public static AuditControl getINSTANCE(String currentActionService) { + INSTANCE = new AuditControl(currentActionService); + return INSTANCE; + } + + public static AuditControl getINSTANCE() { + return INSTANCE; + } +} diff --git a/src/com/rjconsultores/ventaboletos/auditoria/interceptor/AuditInterceptor.java b/src/com/rjconsultores/ventaboletos/auditoria/interceptor/AuditInterceptor.java new file mode 100644 index 000000000..4ac0cea86 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/auditoria/interceptor/AuditInterceptor.java @@ -0,0 +1,184 @@ +package com.rjconsultores.ventaboletos.auditoria.interceptor; + +import java.io.Serializable; +import java.sql.Date; + +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.EmptyInterceptor; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.hibernate.type.Type; + +import com.rjconsultores.ventaboletos.auditoria.AuditControl; +import com.rjconsultores.ventaboletos.auditoria.AuditManager; +import com.rjconsultores.ventaboletos.dao.util.DBUtil; +import com.rjconsultores.ventaboletos.entidad.AuditLog; +import com.rjconsultores.ventaboletos.entidad.AuditService; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.FuncionSistema; +import com.rjconsultores.ventaboletos.entidad.Sistema; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.enums.auditoria.EnumAuditAction; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +public class AuditInterceptor extends EmptyInterceptor { + private static final long serialVersionUID = 1L; + + private static Logger log = Logger.getLogger(AuditInterceptor.class); + + // Considera que o ADM sempre tenha o ID igual a 1 + private Integer SISTEMA_ID = 1; + + @Override + public boolean onSave(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { + final SessionFactory sessionFactory = DBUtil.getInstance().getSessionFactory(); + final Session session = sessionFactory.openSession(); + + try { + genAudit(session, entity, EnumAuditAction.CRIACAO); + } catch (Exception exception) { + log.error(exception.getMessage(), exception); + } + + if (session != null) { + session.close(); + } + + return super.onSave(entity, id, state, propertyNames, types); + } + + @Override + public boolean onFlushDirty(Object entity, Serializable id, Object[] currentState, Object[] previousState, String[] propertyNames, Type[] types) { + final SessionFactory sessionFactory = DBUtil.getInstance().getSessionFactory(); + final Session session = sessionFactory.openSession(); + + try { + genAudit(session, entity, EnumAuditAction.ALTERACAO); + } catch (Exception exception) { + log.error(exception.getMessage(), exception); + } + + if (session != null) { + session.close(); + } + + return super.onFlushDirty(entity, id, currentState, previousState, propertyNames, types); + } + + @Override + public void onDelete(Object entity, Serializable id, Object[] state, String[] propertyNames, Type[] types) { + final SessionFactory sessionFactory = DBUtil.getInstance().getSessionFactory(); + final Session session = sessionFactory.openSession(); + + try { + genAudit(session, entity, EnumAuditAction.EXCLUSAO); + } catch (Exception exception) { + log.error(exception.getMessage(), exception); + } + + if (session != null) { + session.close(); + } + + super.onDelete(entity, id, state, propertyNames, types); + } + + private void genAudit(final Session session, Object entity, EnumAuditAction action) { + if (!getAuditModuleService(session)) { + return; + } + + try { + /** + * Ignorado caso a entidade for de auditoria e se não for encontrado o módulo no banco + */ + if (!(entity instanceof AuditLog)) { + AuditService service = AuditManager.getINSTANCE().getCurrentService(); + + if (!(entity instanceof AuditLog) && service != null && service.getModule() != null) { + /** + * A auditoria não será realizada nos seguintes cenários: 1) Não for encontrado o serviço no banco de dados 2) O serviço for encontrado, porém não está habilitado para auditoria + */ + if (service.getModule().getIndAuditable()) { + AuditLog audit = new AuditLog(); + audit.setCreatedDate(new Date(System.currentTimeMillis())); + audit.setEntityName(entity.getClass().getSimpleName()); + audit.setService(service); + audit.setEntityDetail(AuditControl.toJson(entity)); + + Sistema sistema = new Sistema(); + sistema.setSistemaId(SISTEMA_ID); + audit.setSistema(sistema); + + audit.setAction(action.getId()); + audit.setUsuario(UsuarioLogado.getUsuarioLogado() != null ? UsuarioLogado.getUsuarioLogado() : new Usuario(1)); + + session.persist(audit); + session.flush(); + } + } + } + + } catch (Exception exception) { + log.error(exception.getMessage(), exception); + + } + } + + private boolean getAuditModuleService(final Session session) { + if (AuditManager.getINSTANCE() != null && AuditManager.getINSTANCE().getAuditar() == null) { + Criteria criteriaAuditar = session.createCriteria(Constante.class); + criteriaAuditar.add(Restrictions.eq("nombconstante", "AUDITAR_SISTEMA")); + criteriaAuditar.add(Restrictions.eq("activo", Boolean.TRUE)); + Constante constante = (Constante) criteriaAuditar.uniqueResult(); + + Boolean auditar = Boolean.FALSE; + + if (constante != null) { + try { + auditar = Boolean.valueOf(constante.getValorconstante()); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + + AuditManager.getINSTANCE().setAuditar(auditar); + } + + if (AuditManager.getINSTANCE() == null || AuditManager.getINSTANCE().getAuditar() == null || !AuditManager.getINSTANCE().getAuditar()) { + return false; + } + + if (!AuditManager.getINSTANCE().getCheckModuleAudit()) { + return AuditManager.getINSTANCE().getCurrentService() != null ? true : false; + } + + AuditService auditService = null; + + Criteria criteriaFuncionSistema = session.createCriteria(FuncionSistema.class); + criteriaFuncionSistema.add(Restrictions.eq("descruta", AuditManager.getINSTANCE().getCurrentActionService())); + FuncionSistema funcionSistema = (FuncionSistema) criteriaFuncionSistema.uniqueResult(); + + if (funcionSistema == null) { + log.info("Função sistema " + funcionSistema + " não encontrada na base de dados."); + AuditManager.getINSTANCE().setCurrentService(auditService); + + return false; + } + + Criteria criteriaService = session.createCriteria(AuditService.class); + criteriaService.add(Restrictions.eq("funcionSistema", funcionSistema)); + auditService = (AuditService) criteriaService.uniqueResult(); + + if (auditService == null) { + return false; + } + + AuditManager.getINSTANCE().setCurrentService(auditService); + AuditManager.getINSTANCE().setCheckModuleAudit(Boolean.FALSE); + + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/constantes/Constantes.java b/src/com/rjconsultores/ventaboletos/constantes/Constantes.java new file mode 100644 index 000000000..3873da0b4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/constantes/Constantes.java @@ -0,0 +1,138 @@ +package com.rjconsultores.ventaboletos.constantes; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + + +public class Constantes { + + public static final Long FORMA_PAGO_DINHEIRO = new Long(1); + public static final Long FORMA_PAGO_RESERVA = new Long(94); + public static final Long FORMA_PAGO_NOTA_CREDITO = new Long(93); + public static final Long FORMA_PAGO_CREDITO = new Long(2); + public static final Long FORMA_PAGO_DEBITO = new Long(3); + public static final Long FORMA_PAGO_GERACAO_OCD = new Long(35); + public static final Long FORMA_PAGO_TROCA_PASSAGEM = new Long(10); + public static final Long FORMA_PAGO_ORDEN_SERVICIO = new Long(11); + + public static final Long MVO_CANCEL_CANCELACION = new Long(31); + public static final Long MVO_CANCEL_DEVOLUCAO = new Long(32); + public static final Long MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_50 = new Long(36); + public static final Long MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_100 = new Long(37); + public static final Long MVO_CANCEL_TROCA = new Long(10); + public static final Long MVO_CANCEL_CHECKIN = new Long(27); + public static final Long MVO_CANCEL_TRANSFERENCIA = new Long(23); + public static final Long MVO_CANCEL_BOLETO_ENTREGADO = new Long(16); + public static final Long MVO_CANCEL_BOLETO_AGRUPAMENTO = new Long(17); + public static final Long MVO_CANCEL_GERACAO_OCD = new Long(99); + public static final Long MVO_CANCEL_QUITACAO_OCD = new Long(35); + public static final Long MVO_CANCEL_VENDA_PACOTE = new Long(33); + public static final Long ORGAO_CONCEDENTE_ID_AGERBA = new Long(27); + + public static Long TPV_DIRECTO_NORMAL = new Long(1); + public static Long TPV_MANUAL = new Long(3); + public static Long TPV_CALL_CENTER = new Long(5); + public static Long TPV_BOLETO_REMOTO = new Long(18); + public static Long TPV_TRANSFERENCIAS = new Long(8); // é a troca de passagens + public static Long TPV_CAMBIO_VIAJE = new Long(81); // é a transferência de passagens + public static Long TPV_CHECKIN_VIAGEM = new Long(41); // chekin boletos + public static Long TPV_BOLETO_ABIERTO = new Long(9); + public static Long TPV_CONFIRMA_ABIERTO = new Long(82); + public static Long TPV_VENDA_BOLETO_ABERTO_MANUAL = new Long(39); + + public static Long TPV_RESERVACION_POR_INTERNET = new Long(16); + public static Long TPV_POR_INTERNET = new Long(12); + public static Long TPV_AGENCIA_WEB = new Long(19); + + public static final Integer TIPO_OPERACION_CC_LQ = new Integer(1); + public static final Integer TIPO_OPERACION_CC_PAGO = new Integer(2); + + public static Short TURNO_AUTOMATICO = new Short("99"); + + public static final String IMAGEM_EMPRESA = "EMPRESA_BACKGROUND"; + public static final String IMAGEM_EMPRESA_GENERICA = "EMPRESA_BACKGROUND_GENERICA"; + + public static final String ORGAO_CONCEDENTE_STRING_AGERBA = "AGERBA"; + + public static List ORGAOS_CONCEDENTES_CALCULO_ARTESP = new ArrayList(Arrays.asList(new Integer[]{21})) ; + /* + 3 ANTT + 4 AGEPAN + 2 DER/PR + 6 DER/MG + 9 DER/RJ + 15 DER/SC + 16 DER/GO + 22 DETRO/RJ + 10 DER/ES + 25 Pref de Ibatiba + 26 Pref de João Neiva + 27 AGERBA + 28 DER/RO + 30 DETER + */ + public static List ORGAOS_CONCEDENTES_CALCULO_ANTT = new ArrayList(Arrays.asList(new Integer[]{2,3,4,6,9,15,16,22,10,25,26,27,28,29,30})); + + /* + * 5 - DER/MT + * 23 - Pref.Marilia + * + */ + public static List ORGAOS_CONCEDENTES_CALCULO_AGER = new ArrayList(Arrays.asList(new Integer[]{5,23})); + + public static final String UTF_8 = "UTF-8"; + public static final String CHARSET_UTF8 = ";charset=utf-8"; + + public static final int INTERVALO_FECHAMENTO_DIARIO = 1; + public static final int INTERVALO_FECHAMENTO_SEMANAL = 7; + public static final int INTERVALO_FECHAMENTO_DECENDIAL = 10; + public static final int INTERVALO_FECHAMENTO_QUINZENAL = 15; + public static final int INTERVALO_FECHAMENTO_MENSAL = 30; + public static final int LIMITE_EVENTO_EXTRA_EDITAVEL = 99000;//TipoEventoExtra com id >= 99000 não são editáveis. + + public static final String DESCONTO_COMPONENTE_PRECO = "DESCONTO_COMPONENTE_PRECO"; + + public static final String TEMPO_LIMITE_PEN_PARAM_OCD = "TEMPO_LIMITE_PEN_PARAM_OCD"; + + public static final String CVESISTEMA_MOTIVO_CANCELAMENTO_ECF = "CANCELAMENTO_ECF"; + + public static final String QTDE_MAX_DIAS_RETENCAO_DIARIA_COMISSAO = "QTDE_MAX_DIAS_RETENCAO_DIARIA_COMISSAO"; + + public static final String RETER_COMISSAO_ADM_FECHAMENTO_CAIXA = "RETER_COMISSAO_ADM_FECHAMENTO_CAIXA"; + + public static enum FiltroEnviadosSefaz { SIM, NAO, TODOS }; + + public static final String CVESISTEMA_MOTIVO_CANCELAMENTO_ALTERACAO_POLTRONA = "ALTERACAO_POLTRONA"; + + public static final String BPE_ALTERACAO_POLTRONA = "110116"; + + public static final String ESTACAO_EMBARCADA = "ESTACAO_EMBARCADA"; + + public static final Integer CATEGORIA_NORMAL = 1; + + public static final String BPE_AMBIENTE = "BPE_AMBIENTE"; + + public static final String BPE_URL = "BPE_URL"; + + public static final String BPE_URL_CONTIG = "BPE_URL_CONTIG_"; + + public static final String RELATORIO_BPE_OTIMIZADO = "RELATORIO_BPE_OTIMIZADO"; + + public static final String URL_PAINEL_EMBARCADA = "URL_PAINEL_EMBARCADA"; + + public static final String EXIGE_EMAIL_OU_TEL_CAD_CLIENTE = "EXIGE_EMAIL_OU_TEL_CAD_CLIENTE"; + + public static final String SMTP_COMISSAO_EMAIL = "SMTP_COMISSAO_EMAIL"; + + public static final String SMTP_COMISSAO_HOST = "SMTP_COMISSAO_HOST"; + + public static final String SMTP_COMISSAO_AUTENTICACAO = "SMTP_COMISSAO_AUTENTICACAO"; + + public static final String SMTP_COMISSAO_PASS = "SMTP_COMISSAO_PASS"; + + public static final String SMTP_COMISSAO_PORT = "SMTP_COMISSAO_PORT"; + + public static final String SMTP_COMISSAO_USER = "SMTP_COMISSAO_USER"; + +} diff --git a/src/com/rjconsultores/ventaboletos/constantes/ConstantesFuncionSistema.java b/src/com/rjconsultores/ventaboletos/constantes/ConstantesFuncionSistema.java new file mode 100644 index 000000000..af0de3f64 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/constantes/ConstantesFuncionSistema.java @@ -0,0 +1,37 @@ +package com.rjconsultores.ventaboletos.constantes; + +public class ConstantesFuncionSistema { + + private ConstantesFuncionSistema() { + } + + public static final String CLAVE_EDITAR_USUARIO = "COM.RJCONSULTORES.ADMINISTRACION.GUI.SEGURIDAD.MENU.USUARIO"; + public static final String CLAVE_EDITAR_COMISSAO = "COM.RJCONSULTORES.ADMINISTRACION.PUNTOVENTA.EDITARCOMISSAO"; + public static final String CLAVE_EXIBIR_TAB_COMISSAO_CONTA = "COM.RJCONSULTORES.ADMINISTRACION.PUNTOVENTA.EDITARPORCENTAGEMCONTA"; + public static final String CLAVE_REABRIR_MOVIMENTODIARIO = "COM.RJCONSULTORES.ADMINISTRACION.GUI.COMISSAO.MENU.CONFERENCIACOMISSAO.REABRIRMOVIMENTODIARIO"; + public static final String CLAVE_ENCERRAR_MOVIMENTODIARIO = "COM.RJCONSULTORES.ADMINISTRACION.GUI.COMISSAO.MENU.CONFERENCIACOMISSAO.ENCERRARMOVIMENTODIARIO"; + public static final String CLAVE_GENERA_FOLIOSISTEMA_VTA_INT_IMP_POSTERIOR = "COM.RJCONSULTORES.ADMINISTRACION.GUI.CATALOGO.MENU.EMPRESA.GENERAFOLIOSISTEMAVTAINTIMPPOSTERIOR"; + public static final String CLAVE_EDITAR_VENDA_SEM_REDUCAO_Z = "COM.RJCONSULTORES.ADMINISTRACION.GUI.CATALOGO.MENU.EMPRESA.RESTRIGEVENDAREDUCAOZ"; + public static final String CLAVE_EDITAR_ALTERA_EXIBECANCEL = "COM.RJCONSULTORES.ADMINISTRACION.GUI.CONFIGURACIONECCOMERCIALES.MOTIVOCANCELACION.ALTERAEXIBECANCEL"; + public static final String CLAVE_CALCULODIARIOCOMISSAO_AUTORIZACAOCALCULOTODASAGENCIAS = "COM.RJCONSULTORES.ADM.CALCULODIARIOCOMISSAO.AUTORIZACAOCALCULOTODASAGENCIAS"; + public static final String CLAVE_HISTORICO_COMPRAS = "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOHISTORICOCOMPRAS"; + public static final String CLAVE_EXPORTACAO_SGTI = "COM.RJCONSULTORES.ADMINISTRACION.GUI.ANALITICO.SGTI"; + public static final String CLAVE_POSICAO_VENDA_BILHETE_IDOSO = "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOPOSICAOVENDABILHETEIDOSO"; + public static final String CLAVE_INTEGRACAO_ANTI_FRAUDE = "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOINTEGRACAOANTIFRAUDE"; + public static final String CLAVE_TARIFAS_DESABILITAR_BOTAO_EXCLUIR_TODOS = "COM.RJCONSULTORES.VENTABOLETOS.GUI.ADM.PRECO.EXCLUIR.TODAS.PESQUISA"; + public static final String CLAVE_CONFIGURACAO_VENDA_EMBARCADA = "COM.RJCONSULTORES.ADMINISTRACION.GUI.ESQUEMAOPERACIONAL.MENU.CONFVENDAEMBARCADA"; + public static final String CLAVE_RELATORIO_VENDA_EMBARCADA = "COM.RJCONSULTORES.ADMINISTRACION.GUI.RELATORIOS.MENU.RELATORIOVENDAEMBARCADA"; + public static final String CLAVE_CONTINGENCIA = "COM.RJCONSULTORES.ADMINISTRACION.GUI.SEGURIDAD.MENU.CONTINGENCIA"; + public static final String CLAVE_TROCO_SIMPLES = "COM.RJCONSULTORES.ADMINISTRACION.GUI.ESQUEMAOPERACIONAL.MENU.TROCOSIMPLES"; + public static final String CLAVE_RELATORIO_TROCO_SIMPLES = "COM.RJCONSULTORES.ADMINISTRACION.GUI.ESQUEMAOPERACIONAL.MENU.RELATORIOTROCOSIMPLES"; + public static final String CLAVE_RELATORIO_ESTORNO_TROCO_SIMPLES = "COM.RJCONSULTORES.ADMINISTRACION.GUI.ESQUEMAOPERACIONAL.MENU.RELATORIOESTORNOTROCOSIMPLES"; + public static final String CLAVE_CONFIG_EMITE_SOMENTE_CUPOM_EMBARQUE = "COM.RJCONSULTORES.ADMINISTRACION.GUI.CONFIGURACIONECCOMERCIALES.CONFIGTIPOPASSAGEM.EMITESOMENTECPEMB"; + public static final String CLAVE_ADM_PRICING_MODIFICACAOMASSIVAWS = "COM.RJCONSULTORES.ADMINISTRACION.GUI.PRICING.MODIFICACAOMASSIVAWS"; + public static final String CLAVE_ESTOQUE_W2I = "COM.RJCONSULTORES.ADMINISTRACION.GUI.ESQUEMAOPERACIONAL.ESTOQUEW2I"; + public static final String CLAVE_UPLOAD_ARQUIVO_CONFIGURACAO = "COM.RJCONSULTORES.ADMINISTRACION.GUI.SEGURIDAD.CUSTOMSISTEMA.UPLOADARQUIVOCONFIGURACAO"; + public static final String CLAVE_OPERADORES_DISPOSITIVO_VENDA_EMBARCADA = "COM.RJCONSULTORES.ADMINISTRACION.GUI.ESQUEMAOPERACIONAL.MENU.CONFVENDAEMBARCADA.OPERADORESDISP"; + public static final String CLAVE_MANUTENCAO_FLEXBUS = "COM.RJCONSULTORES.ADMINISTRACION.GUI.ESQUEMAOPERACIONAL.MENU.FLEXBUS"; + public static final String CLAVE_RELATORIO_PRICING_ESPECIFICO = "COM.RJCONSULTORES.ADMINISTRACION.GUI.PRICING.MENU.RELATORIOPRICINGESPECIFICO"; + public static final String CLAVE_MODIFICACAO_EMBARCADA = "COM.RJCONSULTORES.ADMINISTRACION.GUI.TARIFAS.MENU.MODIFICACIONMASIVAEMBARCADA"; + public static final String CLAVE_AUTORIZACAO_RUTA = "COM.RJCONSULTORES.ADMINISTRACION.GUI.ESQUEMAOPERACIONAL.MENU.AUTORIZACAORUTA"; +} diff --git a/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoDesconto.java b/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoDesconto.java new file mode 100644 index 000000000..070b7c495 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoDesconto.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.constantes; + +public interface ConstantesTipoDesconto { + int DESCONTO_POR_NUMERO_DOCUMENTO = 1, + DESCONTO_POR_QUANTIDADE = 2, + TIPO_DESCONTO_NAO_INFORMADO = 0; +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoValidaVenta.java b/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoValidaVenta.java new file mode 100644 index 000000000..7265f3fc0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/constantes/ConstantesTipoValidaVenta.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.constantes; + +public interface ConstantesTipoValidaVenta { + String COD_AGENCIA = "A"; + String COD_MOTORISTA = "M"; + String AGENCIA = "AGENCIA"; + String MOTORISTA = "MOTORISTA"; +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/constantes/ConstantesVendaEmbarcada.java b/src/com/rjconsultores/ventaboletos/constantes/ConstantesVendaEmbarcada.java new file mode 100644 index 000000000..db046d57c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/constantes/ConstantesVendaEmbarcada.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.constantes; + +public class ConstantesVendaEmbarcada { + + public static final int VENDA_GERADA = 0; + public static final int VENDA_BOLETO_ERROR = 1; + public static final int VENDA_BOLETO_FORMAPAGO_ERROR = 2; + public static final int VENDA_CAJA_ERROR = 3; + public static final int VENDA_CAJA_FORMAPAGO_ERROR = 4; + +} diff --git a/src/com/rjconsultores/ventaboletos/constantes/DescricaoTipoVenta.java b/src/com/rjconsultores/ventaboletos/constantes/DescricaoTipoVenta.java new file mode 100644 index 000000000..585511b4b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/constantes/DescricaoTipoVenta.java @@ -0,0 +1,24 @@ +package com.rjconsultores.ventaboletos.constantes; + +public class DescricaoTipoVenta { + + public static String getDescricaoTipoVenta(Integer tipoVentaId) { + if(Constantes.TPV_DIRECTO_NORMAL.intValue() == tipoVentaId) { + return "NORMAL"; + } else if(Constantes.TPV_MANUAL.intValue() == tipoVentaId) { + return "MANUAL"; + } else if(Constantes.TPV_BOLETO_REMOTO.intValue() == tipoVentaId) { + return "GAP"; + } else if(Constantes.TPV_TRANSFERENCIAS.intValue() == tipoVentaId) { + return "TRANSFERENCIA"; + } else if(Constantes.TPV_CAMBIO_VIAJE.intValue() == tipoVentaId) { + return "TROCA PASSAGEM"; + } else if(Constantes.TPV_CHECKIN_VIAGEM.intValue() == tipoVentaId) { + return "CHECKIN VIAGEM"; + } else if(Constantes.TPV_BOLETO_ABIERTO.intValue() == tipoVentaId) { + return "BOLETO ABERTO"; + } + return ""; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java b/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java new file mode 100644 index 000000000..3915ce346 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java @@ -0,0 +1,95 @@ +package com.rjconsultores.ventaboletos.constantes; + +public enum TipoEventoExtra { + NAO_ESPECIFICADO{ + public String toString() { + return " "; + } + }, + OUTRO{ + public String toString() { + return "OUTRO"; + } + }, + SEGURO_OPCIONAL{ + public String toString() { + return "SEGURO_OPCIONAL"; + } + }, + EXCESSO_BAGAGEM{ + public String toString() { + return "EXCESSO_BAGAGEM"; + } + }, + TAXA_EMBARQUE{ + public String toString() { + return "TAXA_EMBARQUE"; + } + }, + SEGURO_RESSARCIMENTO{ + public String toString() { + return "SEGURO_RESSARCIMENTO"; + } + }, + TAXA_EMBARQUE_RESSARCIMENTO{ + public String toString() { + return "TAXA_EMBARQUE_RESSARCIMENTO"; + } + }, + MULTA{ + public String toString() { + return "MULTA"; + } + }, + DIF_MAIOR{ + public String toString() { + return "DIF_MAIOR"; + } + }, + DIF_MENOR{ + public String toString() { + return "DIF_MENOR"; + } + }, + SUPRIMENTO{ + public String toString() { + return "SUPRIMENTO"; + } + }, + SANGRIA{ + public String toString() { + return "SANGRIA"; + } + }, + RECARGA_CELULAR{ + public String toString() { + return "RECARGA_CELULAR"; + } + }, + RECARGA_TV{ + public String toString() { + return "RECARGA_TV"; + } + }, + RECARGA_PIN{ + public String toString() { + return "RECARGA_PIN"; + } + }, + PACOTE{ + public String toString() { + return "PACOTE"; + } + }, + SMART_CARD{ + public String toString() { + return "SMART_CARD"; + } + }, + TAXA_CONVENIENCIA_SVI{ + public String toString() { + return "TAXA_CONVENIENCIA_SVI"; + } + }; + +} diff --git a/src/com/rjconsultores/ventaboletos/constantes/TipoSeguro.java b/src/com/rjconsultores/ventaboletos/constantes/TipoSeguro.java new file mode 100644 index 000000000..87233a957 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/constantes/TipoSeguro.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.constantes; + +public enum TipoSeguro { + + SEGURO, + TPP; + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AbastoBoletoDAO.java b/src/com/rjconsultores/ventaboletos/dao/AbastoBoletoDAO.java new file mode 100644 index 000000000..4af6f5cf1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AbastoBoletoDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface AbastoBoletoDAO extends GenericDAO { + + public List buscaAbastoBoletoPorPuntoVenta(PuntoVenta puntoVenta); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AbastoCentralDAO.java b/src/com/rjconsultores/ventaboletos/dao/AbastoCentralDAO.java new file mode 100644 index 000000000..f4ca04b9a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AbastoCentralDAO.java @@ -0,0 +1,34 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface AbastoCentralDAO extends GenericDAO { + + + public List obtenerBilhetes(Aidf aidf, PuntoVenta origem); + public List obtenerBilhetes(Aidf aidf, String formInicial, String formFinal, PuntoVenta origem); + + public List obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes); + public List obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes, Estacion origem); + public List obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes); + public List obtenerBilhetesPorPuntoVenta(String numSerie, String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes, Estacion origem); + + public void actualizaBilhetes(List bilhetes, PuntoVenta destino); + public void actualizaBilhetes(List bilhetes, Estacion destino); + public void suscribirBilhetes(List bilhetes); + public List buscaBilhetesPorAidf(Aidf aidf); + + public void gravaControleEstoqueMigracao(PuntoVenta puntoVenta, Date fecmodif, Integer usuarioId); + + public List buscarSeriesBilhetesPorEstacion(Estacion estacion); + + public void borrarLosQueTienenAIDF(Aidf aidf); + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AbastoHistoDAO.java b/src/com/rjconsultores/ventaboletos/dao/AbastoHistoDAO.java new file mode 100644 index 000000000..101375f6a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AbastoHistoDAO.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +public interface AbastoHistoDAO extends GenericDAO { + + public void grabaHistoricoBilhetes(List bilhetes, TipoMovimentacion tipoMovimentacion); + + public void borrarLosQueTienenAIDF(Aidf aidf); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AgruparParadaDAO.java b/src/com/rjconsultores/ventaboletos/dao/AgruparParadaDAO.java new file mode 100644 index 000000000..cff4227d3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AgruparParadaDAO.java @@ -0,0 +1,21 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AgrupamentoParada; + +public interface AgruparParadaDAO { + + public AgrupamentoParada obtenerID(Integer id); + + public AgrupamentoParada suscribir(AgrupamentoParada entidad); + + public AgrupamentoParada actualizacion(AgrupamentoParada entidad); + + public List obtenerTodos(); + + public List buscar(String descAgrupamentoParada); + + public List buscarCVE(String cveAgrupamentoParada); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AidfDAO.java b/src/com/rjconsultores/ventaboletos/dao/AidfDAO.java new file mode 100644 index 000000000..1073d938e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AidfDAO.java @@ -0,0 +1,27 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.sql.Connection; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.vo.aidf.AidfVo; + +public interface AidfDAO extends GenericDAO { + + public List buscaAidfsPorEmpresas(List empresas); + + public List obtenerAidfFromSerieDocfiscal(String serie, String docfiscal, Connection conn); + + public Boolean existeAidfComCodFiscalEEstado(Long idAidf, Integer especieId, String docFiscal, Estado estado); + + public List buscaAidfEstadoEmpresa(Integer empresaId, Integer estadoId,Boolean isRMD); + + public String buscaUltimoAidfRMDUtilizado(Long idAidf, Integer empresaId, Integer estadoId); + + public boolean vaidaRMDUtilizado(Long idAidf, Integer empresaId, Integer estadoId, String folio); + + public Boolean validarDocFiscalPorEstadoAgencia(Long idAidf, Integer especieId, String docFiscal, String formInicial, String formFinal, Estado estado, PuntoVenta agencia); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AidfEspecieDAO.java b/src/com/rjconsultores/ventaboletos/dao/AidfEspecieDAO.java new file mode 100644 index 000000000..26018b005 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AidfEspecieDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AidfEspecie; + +public interface AidfEspecieDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AidfTipoDAO.java b/src/com/rjconsultores/ventaboletos/dao/AidfTipoDAO.java new file mode 100644 index 000000000..bd3d4a7e8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AidfTipoDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AidfTipo; + +public interface AidfTipoDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AjusteEventoExtraDAO.java b/src/com/rjconsultores/ventaboletos/dao/AjusteEventoExtraDAO.java new file mode 100644 index 000000000..2c9203f31 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AjusteEventoExtraDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AjusteEventoExtra; + +public interface AjusteEventoExtraDAO extends GenericDAO{ + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AlertaCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/AlertaCtrlDAO.java new file mode 100644 index 000000000..d82d6a5e7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AlertaCtrlDAO.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AlertaCtrl; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AlertaCtrlDAO extends GenericDAO { + + public List buscar(Parada origem, Parada destino, Ruta ruta, ClaseServicio claseServicio, Integer tiempoAlta, Integer tiempoBaja, BigDecimal percAlta, BigDecimal percBaja); + + public List buscarCorrida(Corrida corrida); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AliasServicoDAO.java b/src/com/rjconsultores/ventaboletos/dao/AliasServicoDAO.java new file mode 100644 index 000000000..787d46bea --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AliasServicoDAO.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.ArrayList; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AliasServico; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +public interface AliasServicoDAO extends GenericDAO{ + + /** + * Realiza a buscar com os filtros informados e restringindo o corridaId para is null + * + * @param origenId + * @param destinoId + * @param rutaId + * @return + */ + public List buscarAliasSemCorrida(Integer origenId,Integer destinoId,Integer rutaId); + + /** + * Realiza a busca com os filtro informados. + * @param origenId + * @param destinoId + * @param rutaId + * @param corridaId + * @return + */ + public List buscar(Integer origenId,Integer destinoId,Integer rutaId,Integer corridaId); + + + /** + * Realiza a busca com os filtro informados. + * @param linas + * @param empresas + * @param tiposClasses + * @param orgaos + * @param prefixo + * @return + */ + public List buscarPorLinhaEmpresa(List linhas, List empresas, List tiposClasses, List orgaos, String prefixo); + + + /** + * Realiza a busca com os filtro informados. + * @param origem + * @param destino + * @param linha + * @param idCorrida + * @return + */ + public AliasServico existe(Parada origem, Parada destino, Ruta linha, Integer idCorrida); + + List buscarPorRuta(Integer rutaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AliquotaEstadoDestinoDAO.java b/src/com/rjconsultores/ventaboletos/dao/AliquotaEstadoDestinoDAO.java new file mode 100644 index 000000000..0c63c86ce --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AliquotaEstadoDestinoDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AliquotaEstadoDestino; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; + +public interface AliquotaEstadoDestinoDAO extends GenericDAO { + + public List getChildrens(EmpresaImposto parent); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ArticuloDAO.java b/src/com/rjconsultores/ventaboletos/dao/ArticuloDAO.java new file mode 100644 index 000000000..c087197db --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ArticuloDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Articulo; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ArticuloDAO extends GenericDAO { + + public List buscar(String descarticulo); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AsientoExclusivoDAO.java b/src/com/rjconsultores/ventaboletos/dao/AsientoExclusivoDAO.java new file mode 100644 index 000000000..062d691cf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AsientoExclusivoDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo; + +/** + * + * @author rodrigo + */ +public interface AsientoExclusivoDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AuditLogDAO.java b/src/com/rjconsultores/ventaboletos/dao/AuditLogDAO.java new file mode 100644 index 000000000..b404a35fb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AuditLogDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AuditLog; +import com.rjconsultores.ventaboletos.entidad.AuditModule; + +public interface AuditLogDAO extends GenericDAO { + public List carregarLog(AuditModule modulo); + + public List filtrarLog(AuditLog log); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AuditModuleDAO.java b/src/com/rjconsultores/ventaboletos/dao/AuditModuleDAO.java new file mode 100644 index 000000000..5278e9183 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AuditModuleDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AuditModule; + +public interface AuditModuleDAO extends GenericDAO{ + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AuditServiceDAO.java b/src/com/rjconsultores/ventaboletos/dao/AuditServiceDAO.java new file mode 100644 index 000000000..dfb2fde22 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AuditServiceDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AuditService; + +public interface AuditServiceDAO extends GenericDAO { + public AuditService carregarService(AuditService auditService); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AutobusDAO.java b/src/com/rjconsultores/ventaboletos/dao/AutobusDAO.java new file mode 100644 index 000000000..40f48aeb4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AutobusDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AutobusDAO extends GenericDAO { + + public List buscar(String numautobus, DiagramaAutobus diagramaAutobus); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AutobusDocDAO.java b/src/com/rjconsultores/ventaboletos/dao/AutobusDocDAO.java new file mode 100644 index 000000000..ca2c89e99 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AutobusDocDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.AutobusDoc; + +public interface AutobusDocDAO extends GenericDAO { + public List obtenerPorAutobus(Autobus autobus); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AutorizacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/AutorizacionDAO.java new file mode 100644 index 000000000..1ef21c4b4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AutorizacionDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AutorizacionDAO extends GenericDAO { + + public List buscar(String nombautorizacion, String descautorizacion); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AutorizacionPerfilDAO.java b/src/com/rjconsultores/ventaboletos/dao/AutorizacionPerfilDAO.java new file mode 100644 index 000000000..c3c48e8d9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AutorizacionPerfilDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import com.rjconsultores.ventaboletos.entidad.AutorizacionPerfil; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AutorizacionPerfilDAO extends GenericDAO { + + public List buscar(Autorizacion autorizacion, Perfil perfil); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/BancoDAO.java b/src/com/rjconsultores/ventaboletos/dao/BancoDAO.java new file mode 100644 index 000000000..9fae21447 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/BancoDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Banco; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface BancoDAO extends GenericDAO { + + public List buscar(Banco nombbanco); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/BoletoDAO.java b/src/com/rjconsultores/ventaboletos/dao/BoletoDAO.java new file mode 100644 index 000000000..d686a73f4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/BoletoDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Boleto; +import com.rjconsultores.ventaboletos.vo.embarcada.PtoVtaUsuarioUltimaVendaDispositivoVO; + +/** + * + * @author Fabricio + */ + +public interface BoletoDAO extends GenericDAO { + public Boleto buscarPeloImeiDoDispositivo(String imei); + public List buscarUltimaVendaDosDispositivosEmbarcada(); + @Override + Boleto suscribir(Boleto boleto); + public String getSequenciaBoletoId(); + public String getSequenciaNumOperacion(); + public String getSequenciaNumReservacion(); + void insertBoletoRserva(Boleto miBoletoTemporal); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/BpeDAO.java b/src/com/rjconsultores/ventaboletos/dao/BpeDAO.java new file mode 100644 index 000000000..25c241ff5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/BpeDAO.java @@ -0,0 +1,26 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.sql.Connection; +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.ExportacaoBPEVo; +import com.rjconsultores.ventaboletos.utilerias.fiscal.vo.FiscalRdi; +import com.rjconsultores.ventaboletos.vo.bpe.BPeVO; + +public interface BpeDAO { + + public List buscarBpeRDI(Connection connection, Date inicio, Date fim, Integer empresaId, List estados, boolean isReceitaTerceiros, boolean consultaOtimizada); + + public ExportacaoBPEVo buscarRegistroExportacaoBpe(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado, boolean consultaOtimizada, String codContPrevidencia); + + public String buscarXmlBPE(Connection connection, String chBpe); + + public List buscarBPeRejeitadosContingencia(Integer empresaId, String numBpe, String chbpe, Date dtVendaInicio, Date dtVendaFim, List estados, List codigosRejeicoes); + + public void definirBPeRejeitadoSefazReenvio(Integer bpeId, String codstat) throws BusinessException; + + public List buscarBPeVendaEEventosAutorizados(Integer empresaId, Date dtVendaInicio, Date dtVendaFim, Integer estadoId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/BusquedaDatosTicketDAO.java b/src/com/rjconsultores/ventaboletos/dao/BusquedaDatosTicketDAO.java new file mode 100644 index 000000000..abce13a87 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/BusquedaDatosTicketDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PacoteVO; + +public interface BusquedaDatosTicketDAO { + + public List buscaDatosTickets(Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal, Date fecAlteracaoInicial, Date fecAlteracaoFinal); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CajaDAO.java b/src/com/rjconsultores/ventaboletos/dao/CajaDAO.java new file mode 100644 index 000000000..a68e91df5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CajaDAO.java @@ -0,0 +1,39 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.entidad.Caja; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoFormapagoException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaFormapagoException; +import com.rjconsultores.ventaboletos.vo.caja.CajaDetalleVO; +import com.rjconsultores.ventaboletos.vo.caja.CajaVO; +import com.rjconsultores.ventaboletos.vo.caja.UsuarioVO; +import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO; +import com.rjconsultores.ventaboletos.vo.cashmonitor.RelatorioVendaCartaoCashMonitorVO; + +public interface CajaDAO { + public List buscarCajaFecha(boolean yaCerrado, Date fechaDesde, Date fechaHasta); + + public List buscarCajaCerrado(Date fecha, String cveusuario, String turnoid); + + List buscarUsuarioCerrado(Date fecha); + + public void gerarVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaBoletoException, VendaEmbarcadaBoletoFormapagoException, VendaEmbarcadaCajaException, VendaEmbarcadaCajaFormapagoException; + + public List buscarDetalleCaja(Date fechaDesde, Date fechaHasta, Boolean sembilhetesPacote); + + Map> buscarCajaYTarjeta(String... numoperacion); + + public Integer atualizaCajasIntegracaoTotvs(Marca marca, Date dataIncial, Date dataFinal, PuntoVenta puntoVenta) throws BusinessException; + + public List buscarVendaCartaoCashMonitor(Date dataIncial, Date dataFinal, Empresa empresa, PuntoVenta puntoVenta); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CalcularPeajeDAO.java b/src/com/rjconsultores/ventaboletos/dao/CalcularPeajeDAO.java new file mode 100644 index 000000000..b545ca863 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CalcularPeajeDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +public interface CalcularPeajeDAO { + public List buscarCasetasPeajeWithinTramo(Ruta ruta); + + public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao, boolean usaICMS) throws Exception; + + public List buscarRutaWithCasetaPeajeFromOrgao(OrgaoConcedente oc); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CancelacionCargoDAO.java b/src/com/rjconsultores/ventaboletos/dao/CancelacionCargoDAO.java new file mode 100644 index 000000000..8a25a04f7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CancelacionCargoDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CancelacionCargo; + +/** + * + * @author Rafius + */ +public interface CancelacionCargoDAO extends GenericDAO{ +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CancelacionCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/CancelacionCtrlDAO.java new file mode 100644 index 000000000..e2804acde --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CancelacionCtrlDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CancelacionCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface CancelacionCtrlDAO extends GenericDAO { + + public List buscar(Date tiempoprevsalida, PuntoVenta puntoVenta, Parada paradaOrigem, Parada paradaDestino, Marca marca); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CasetaPeajeDAO.java b/src/com/rjconsultores/ventaboletos/dao/CasetaPeajeDAO.java new file mode 100644 index 000000000..32e9d9a1b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CasetaPeajeDAO.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; +import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion; + +public interface CasetaPeajeDAO extends GenericDAO { + + List buscar(String casetaPeajeDesc); + List buscarTodosOrdenadoPorDescricao(); + void deletarVigencias(List cpes); +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/CasetaPeajeExcepcionDAO.java b/src/com/rjconsultores/ventaboletos/dao/CasetaPeajeExcepcionDAO.java new file mode 100644 index 000000000..1544273f5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CasetaPeajeExcepcionDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; +import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion; + +public interface CasetaPeajeExcepcionDAO extends GenericDAO { + public List obtenerPorCasetaPeaje(CasetaPeaje caseta); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CategoriaBloqueioImpPosteriorDAO.java b/src/com/rjconsultores/ventaboletos/dao/CategoriaBloqueioImpPosteriorDAO.java new file mode 100644 index 000000000..99ad16cd5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CategoriaBloqueioImpPosteriorDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaBloqueioImpPosterior; + +public interface CategoriaBloqueioImpPosteriorDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CategoriaClaseDAO.java b/src/com/rjconsultores/ventaboletos/dao/CategoriaClaseDAO.java new file mode 100644 index 000000000..27378f2cf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CategoriaClaseDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaClase; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; + +/** + * + * @author Administrador + */ +public interface CategoriaClaseDAO extends GenericDAO { + + public CategoriaClase busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CategoriaCorridaDAO.java b/src/com/rjconsultores/ventaboletos/dao/CategoriaCorridaDAO.java new file mode 100644 index 000000000..7bdac568f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CategoriaCorridaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCorrida; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; + +/** + * + * @author Administrador + */ +public interface CategoriaCorridaDAO extends GenericDAO { + + public CategoriaCorrida busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CategoriaCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/CategoriaCtrlDAO.java new file mode 100644 index 000000000..8f6a6ef8b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CategoriaCtrlDAO.java @@ -0,0 +1,15 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; + +/** + * + * @author Administrador + */ +public interface CategoriaCtrlDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CategoriaDAO.java b/src/com/rjconsultores/ventaboletos/dao/CategoriaDAO.java new file mode 100644 index 000000000..9d8592848 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CategoriaDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface CategoriaDAO extends GenericDAO { + + public List buscar(String desccategoria); + + public List buscarCategoriaPesquisada(String desccategoria); + + public List buscarCategoriaOrgaoConcedente(String orgaoConcedente); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CategoriaDescuentoDAO.java b/src/com/rjconsultores/ventaboletos/dao/CategoriaDescuentoDAO.java new file mode 100644 index 000000000..f4cec46ab --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CategoriaDescuentoDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; + +/** + * + * @author Administrador + */ +public interface CategoriaDescuentoDAO extends GenericDAO { + + public CategoriaDescuento pesquisarPorCategoriaEmpresa(Integer categoriaId, Integer empresaId); + + public boolean isAplicaTarifaMinima(Integer categoriaId, Integer empresaId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CategoriaMarcaDAO.java b/src/com/rjconsultores/ventaboletos/dao/CategoriaMarcaDAO.java new file mode 100644 index 000000000..c91e9f833 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CategoriaMarcaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMarca; + +/** + * + * @author Administrador + */ +public interface CategoriaMarcaDAO extends GenericDAO { + + public CategoriaMarca busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CategoriaMercadoDAO.java b/src/com/rjconsultores/ventaboletos/dao/CategoriaMercadoDAO.java new file mode 100644 index 000000000..984c55ea4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CategoriaMercadoDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMercado; + +/** + * + * @author Administrador + */ +public interface CategoriaMercadoDAO extends GenericDAO { + + public CategoriaMercado busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CategoriaOrgaoDAO.java b/src/com/rjconsultores/ventaboletos/dao/CategoriaOrgaoDAO.java new file mode 100644 index 000000000..3fd871cad --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CategoriaOrgaoDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaOrgao; + +public interface CategoriaOrgaoDAO extends GenericDAO { + + public CategoriaOrgao busquedaPorCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/CategoriaPeriodoDAO.java b/src/com/rjconsultores/ventaboletos/dao/CategoriaPeriodoDAO.java new file mode 100644 index 000000000..f0d04d6b8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CategoriaPeriodoDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface CategoriaPeriodoDAO extends GenericDAO { + + public List buscarPeriodoIntervalo(CategoriaPeriodo cPeriodo); + + public List obtenerPorCategoriaDescuento(CategoriaDescuento categoriaDescuento); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CategoriaTipoPtoVtaDAO.java b/src/com/rjconsultores/ventaboletos/dao/CategoriaTipoPtoVtaDAO.java new file mode 100644 index 000000000..ab1ec784b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CategoriaTipoPtoVtaDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CategoriaTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface CategoriaTipoPtoVtaDAO extends GenericDAO { + + public List buscarPorPuntoVenta(TipoPuntoVenta tipoPuntoVenta); + + public void borrarFisico(CategoriaTipoPtoVta cd); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CiudadDAO.java b/src/com/rjconsultores/ventaboletos/dao/CiudadDAO.java new file mode 100644 index 000000000..5a430ce60 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CiudadDAO.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import java.util.List; + +/** + * + * @author MCosso + */ +public interface CiudadDAO extends GenericDAO { + + public List buscar(String nombciudad, Estado estado, Plaza plaza); + + public List buscaLike(String strCiudad); + + public List buscaCodMun(Integer codMun, Estado estado); + + public List buscarPorEstado(Estado estado); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ClaseservicioEquivalenciaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ClaseservicioEquivalenciaDAO.java new file mode 100644 index 000000000..7b981f37e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ClaseservicioEquivalenciaDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.ClaseservicioEquivalencia; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ClaseservicioEquivalenciaDAO + extends GenericDAO { + + public List buscar(ClaseServicio ClaseServicio, ComisionistaExterno comisionistaExterno); + + public List buscarEquivalencia(ClaseservicioEquivalencia claseServicioEquivalencia); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ClasseServicoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ClasseServicoDAO.java new file mode 100644 index 000000000..cffb5c109 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ClasseServicoDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ClasseServicoDAO extends GenericDAO { + + public List buscarPorNome(Integer idClaseServicio, String nomeClaseServicio); + + public List buscarTodosExceto(Integer ... idClase); + + public List buscarPorEmpresasDoUsuario (String idEmpresasUsuario); + + public List buscarListaPorIds(List claseIds); +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/ClienteCursoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ClienteCursoDAO.java new file mode 100644 index 000000000..67686f5e1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ClienteCursoDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteCurso; +import com.rjconsultores.ventaboletos.entidad.Curso; + +public interface ClienteCursoDAO extends GenericDAO { + + public ClienteCurso buscarClienteCurso(Cliente cliente, Curso curso); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ClienteDAO.java b/src/com/rjconsultores/ventaboletos/dao/ClienteDAO.java new file mode 100644 index 000000000..04e0778b7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ClienteDAO.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +public interface ClienteDAO extends GenericDAO { + + public List buscar(String nombCliente); + + public Cliente buscarPorNumeroFidelidade(String numeroFidelidade, Empresa empresa); + + public List buscarPorDocumento(String documento); + + public Cliente buscarPorNumeroFidelidade(String numeroFidelidade); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ClienteDescuentoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ClienteDescuentoDAO.java new file mode 100644 index 000000000..8e65e2f3f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ClienteDescuentoDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteDescuento; + +public interface ClienteDescuentoDAO extends GenericDAO{ + + public List buscar(Cliente cliente); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ClienteDireccionDAO.java b/src/com/rjconsultores/ventaboletos/dao/ClienteDireccionDAO.java new file mode 100644 index 000000000..442226c64 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ClienteDireccionDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteDireccion; + + + + + +public interface ClienteDireccionDAO extends GenericDAO { + + public List buscar(Integer clienteId); + + public List buscar(Cliente cliente); + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ClientePacoteDAO.java b/src/com/rjconsultores/ventaboletos/dao/ClientePacoteDAO.java new file mode 100644 index 000000000..f0fe46e3a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ClientePacoteDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClientePacote; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO; + +public interface ClientePacoteDAO extends GenericDAO { + + public List busquedaDatosClientePacote(String cpfCnpj); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CobrancaAdcPuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/CobrancaAdcPuntoVentaDAO.java new file mode 100644 index 000000000..5c69b8c7a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CobrancaAdcPuntoVentaDAO.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CobrancaAdcPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.CobrancaAdicionalHistorico; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface CobrancaAdcPuntoVentaDAO extends GenericDAO { + + List buscaHistoricoCobranca(CobrancaAdcPuntoVenta cobranca, Date dataInicial, Date dataFinal); + + List buscarTodasAsCobrancas(PuntoVenta puntoVenta); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CoeficienteTarifaDAO.java b/src/com/rjconsultores/ventaboletos/dao/CoeficienteTarifaDAO.java new file mode 100644 index 000000000..cffdfe74d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CoeficienteTarifaDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; + +public interface CoeficienteTarifaDAO extends GenericDAO { + + public List buscar(String nomb); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ColoniaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ColoniaDAO.java new file mode 100644 index 000000000..b6d858a1f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ColoniaDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Colonia; + +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ColoniaDAO extends GenericDAO { + + public List buscar(String desccolonia); + public List buscarPorCiudad(Ciudad ciudad); + public List buscaLike(String desccolonia); + public List buscarPorCodMun(Ciudad ciudad, String desccolonia); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ComisionistaExternoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ComisionistaExternoDAO.java new file mode 100644 index 000000000..481d7f0fc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ComisionistaExternoDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ComisionistaExternoDAO extends GenericDAO { + + public List buscar(String desccomisionista); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ComissaoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ComissaoDAO.java new file mode 100644 index 000000000..2889cb890 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ComissaoDAO.java @@ -0,0 +1,24 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.entidad.Comissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao; + +public interface ComissaoDAO extends GenericDAO { + + public List buscarReceitasComissoes(Integer puntoVentaId, Integer empresaId, Date periodo); + + public Comissao buscaComissaoVigencia(Integer puntoVentaId, Integer empresaId, String competencia); + + public List buscaHistoricoComissao(Map parametros); + + public List buscaPuntoVentasEmpresaComComissaoParametrizada(Integer empresaId); + + public Comissao buscaComissaoVigencia(Integer puntoVentaId, Integer empresaId, Date dataInicial, Date dataFinal); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ComissaoLogDAO.java b/src/com/rjconsultores/ventaboletos/dao/ComissaoLogDAO.java new file mode 100644 index 000000000..1caf03f05 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ComissaoLogDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ComissaoLog; +import com.rjconsultores.ventaboletos.vo.comissao.ComissaoLogVO; + +public interface ComissaoLogDAO extends GenericDAO { + + public void limparComissaoLog(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal); + + public void suscribirTodos(List lsComissaoLogVO); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ComissaoReceitaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ComissaoReceitaDAO.java new file mode 100644 index 000000000..02bb70d7b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ComissaoReceitaDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ComissaoReceita; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface ComissaoReceitaDAO extends GenericDAO { + + public List recuperarComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal); + + public void limparComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) throws BusinessException; + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CompaniaBancariaDAO.java b/src/com/rjconsultores/ventaboletos/dao/CompaniaBancariaDAO.java new file mode 100644 index 000000000..45f77be0d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CompaniaBancariaDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CompaniaBancaria; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface CompaniaBancariaDAO extends GenericDAO { + + public List buscar(CompaniaBancaria companiaBancaria); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConductorDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConductorDAO.java new file mode 100644 index 000000000..356c29f7d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConductorDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Conductor; + +/** + * + * @author Administrador + */ +public interface ConductorDAO extends GenericDAO { + + public Conductor buscar(String claveConductor, String contraSenha); + public Conductor buscarPorEmpleado(int empleadoId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionConfDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionConfDAO.java new file mode 100644 index 000000000..0433345a5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionConfDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionConf; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; + +public interface ConexionConfDAO extends GenericDAO { + + public ConexionConf buscar(Long conexionCtrlId, Integer numgrupo); + + public List buscarPorConexionCtrl(ConexionCtrl conexionCtrl); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionCtrlDAO.java new file mode 100644 index 000000000..c6f6fba87 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionCtrlDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; + +public interface ConexionCtrlDAO extends GenericDAO { + + public List buscarConexionesCtrl(Integer origenId, Integer destinoId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java new file mode 100644 index 000000000..46ad72543 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java @@ -0,0 +1,24 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Conexion; +import com.rjconsultores.ventaboletos.vo.conexion.ConexionVO; + +public interface ConexionDAO extends GenericDAO { + + /** + * Apaga os dados temporários das tabelas de conexion_temp e conexion_ctrl_temp + * + * @param usuarioId + */ + public void generarConexiones(Integer usuarioId); + + public List buscarConexiones(Integer origenId, Integer destinoId); + + public List buscarPorConexionCtrl(Long conexcionCtrlId); + + public List buscarConexionesValidas(); + + public Conexion buscarPorConexionRutaTramoCtrl(Integer conexionRutaTramoId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionDescuentoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionDescuentoDAO.java new file mode 100644 index 000000000..ac9c25418 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionDescuentoDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionDescuento; + +public interface ConexionDescuentoDAO extends GenericDAO { + public List bucarPorConexion(Long conexionId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionDAO.java new file mode 100644 index 000000000..e551cf8f9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcion; + +public interface ConexionExcepcionDAO extends GenericDAO { + + public List obtenerConexionExcepcionsActivo(Long conexionctrlId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionRutaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionRutaDAO.java new file mode 100644 index 000000000..73c063c2f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionExcepcionRutaDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta; + +public interface ConexionExcepcionRutaDAO extends GenericDAO { + + public List obtenerConexionExcepcionsActivo(Long conexionctrlId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaConfDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaConfDAO.java new file mode 100644 index 000000000..516d94f30 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaConfDAO.java @@ -0,0 +1,25 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.vo.parada.ConexionRutaConfVO; + +public interface ConexionRutaConfDAO extends GenericDAO { + + List buscarPorDescricao(String descricao); + + List obtenerTodosActivo(); + + public void excluirConfiguracao(ConexionRutaConf conexion, Integer usuarioId, boolean excluirConexionRutaConf, boolean isConexionGerada); + + public ConexionRutaConfVO carregarConexoesCadastradas(Integer conexionrutaconfId); + + public List> buscarRutasPorConexionConf(Integer conexionRutaConfId); + + public void atualizarTempoMinimoEMaximo(ConexionRutaConf conexionRutaConf); + + public ConexionRutaConf getByIdActivo(Integer conexionRutaConf); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaCtrlDAO.java new file mode 100644 index 000000000..8cb78edee --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaCtrlDAO.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; +import com.rjconsultores.ventaboletos.vo.conexion.ConexionRutaVO; + +public interface ConexionRutaCtrlDAO extends GenericDAO { + + List buscarConexionesValidas(); + + List buscarConexionesValidas(Integer rutaOrigemId, Integer rutaDestinoId); + + List buscarPorConexionConf(ConexionRutaConf conexionRutaConf); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaExcepcionPtoVtaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaExcepcionPtoVtaDAO.java new file mode 100644 index 000000000..7898c0507 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaExcepcionPtoVtaDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaExcepcionPtoVta; + +public interface ConexionRutaExcepcionPtoVtaDAO extends GenericDAO { + + public List buscarPorConexionConf(ConexionRutaConf conexionRutaConf); + + public void update(ConexionRutaExcepcionPtoVta entidad); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaExcepcionTipoPtoVtaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaExcepcionTipoPtoVtaDAO.java new file mode 100644 index 000000000..609737456 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaExcepcionTipoPtoVtaDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaExcepcionTipoPtoVta; + +public interface ConexionRutaExcepcionTipoPtoVtaDAO extends GenericDAO { + + public List buscarPorConexionConf(ConexionRutaConf conexionRutaCtrl); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java new file mode 100644 index 000000000..beb70298b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java @@ -0,0 +1,23 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaTramoCtrl; +import com.rjconsultores.ventaboletos.entidad.Parada; + +public interface ConexionRutaTramoCtrlDAO extends GenericDAO { + + boolean validarConexioneRutasExistentes(Integer rutaOrigenId, Integer rutaDestinoId, Integer paradaOrigenId, Integer paradaDestinoId, Integer origemTrechoId, Integer destinoTrechoId, Integer destinoTrechoId2); + + List buscarPorConexionRutaCtrl(ConexionRutaCtrl conexionRutaCtrl, Integer rutaId); + + public List buscarTodasLocalidadesOrigem(Integer conexionRutaConfId); + + public List buscarTodasLocalidadesDestino(Integer conexionRutaConfId); + + public List buscarTodasLocalidadesDestinoC(Integer conexionRutaConfId); + + public List buscarPorConexionRutaConf(Integer conexionRutaConfId, char tipo); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfContratoPuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfContratoPuntoVentaDAO.java new file mode 100644 index 000000000..580a65166 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfContratoPuntoVentaDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConfContratoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.vo.configuracioneccomerciales.ConfLayoutContratoVO; + +public interface ConfContratoPuntoVentaDAO extends GenericDAO { + + public List buscarConfContratoPorPuntoVenta(PuntoVenta puntoVenta); + + public ConfLayoutContratoVO buscarInformacoesPontoVendaparaGerarContratos(Integer puntoVentaId, Integer empresaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoCanalVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoCanalVentaDAO.java new file mode 100644 index 000000000..ea64a5793 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoCanalVentaDAO.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoCanalVenta; + +public interface ConfRestricaoCanalVentaDAO{ + + public ConfRestricaoCanalVenta obtenerID(Long id); + + public ConfRestricaoCanalVenta suscribir(ConfRestricaoCanalVenta entidad); + + public ConfRestricaoCanalVenta actualizacion(ConfRestricaoCanalVenta entidad); + + public void borrar(ConfRestricaoCanalVenta entidad); + + public Long count(String campo, Object o); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoExcecaoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoExcecaoDAO.java new file mode 100644 index 000000000..6b8f2dadb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoExcecaoDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoExcecao; + +public interface ConfRestricaoExcecaoDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoOrgaoConcedenteDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoOrgaoConcedenteDAO.java new file mode 100644 index 000000000..37c9a00ac --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoOrgaoConcedenteDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoOrgaoConcedente; + +public interface ConfRestricaoOrgaoConcedenteDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoPtovtaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoPtovtaDAO.java new file mode 100644 index 000000000..73b138827 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoPtovtaDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoPtovta; + +public interface ConfRestricaoPtovtaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoRutasDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoRutasDAO.java new file mode 100644 index 000000000..da35b1d99 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoRutasDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoRutas; + +public interface ConfRestricaoRutasDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoTramoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoTramoDAO.java new file mode 100644 index 000000000..0bfeb9533 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoTramoDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoTramo; + +public interface ConfRestricaoTramoDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoTramoOCDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoTramoOCDAO.java new file mode 100644 index 000000000..c731b981d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoTramoOCDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoTramoOC; + +public interface ConfRestricaoTramoOCDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoVendaWebDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoVendaWebDAO.java new file mode 100644 index 000000000..d39139fca --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoVendaWebDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb; + +public interface ConfRestricaoVendaWebDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfTotemDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfTotemDAO.java new file mode 100644 index 000000000..ef269f423 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfTotemDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfTotem; + +/** + * + * @author Wallace + */ +public interface ConfTotemDAO extends GenericDAO { + + public ConfTotem buscar(String chave); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConferenciaComissaoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConferenciaComissaoDAO.java new file mode 100644 index 000000000..96c0c2512 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConferenciaComissaoDAO.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.LogConferencia; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.DiaConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO; +import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO; +import com.rjconsultores.ventaboletos.vo.comissao.OcdVO; + +public interface ConferenciaComissaoDAO extends GenericDAO { + + public Conferencia suscribirOrActualizacion(Conferencia entidad); + + public List carregarConferenciaComissao(String competencia, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, boolean isDesconsideraPtVendaFechados ) throws BusinessException; + + public List carregarConferenciaComissao(Date dataInicial, Date dataFinal, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, boolean isDesconsideraPtVendaFechados) throws BusinessException; + + public Conferencia confirmarChegadaMalote(Conferencia conferencia) throws BusinessException; + + public Conferencia encerrarMovimentoDiario(Conferencia conferencia) throws BusinessException; + + public List carregarEventosFinanceiros(Conferencia conferencia) throws BusinessException; + + public List carregarLogConferencia(Conferencia conferencia) throws BusinessException; + + public LogConferencia suscribirLogConferencia(LogConferencia logConferencia) throws BusinessException; + + public void borrarLogConferencia(LogConferencia logConferencia) throws BusinessException; + + public LogConferencia obtenerLogConferenciaID(Long logconferenciaId); + + public List carregarBilhetesComissao(Conferencia conferencia, boolean isCalculoComissao, boolean ehConsultaComissao) throws BusinessException; + + public List carregarOcds(Conferencia conferencia) throws BusinessException; + + public Conferencia reabrirMovimentoDiario(Conferencia conferencia) throws BusinessException; + + public Conferencia obtenerConferenciaDataMovimento(Date datamovimento, Integer puntoventaId, Integer empresaId) throws BusinessException; + + public List carregarLogConferencia(Long conferenciaId) throws BusinessException; + + public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta, boolean isDesconsideraPtVendaFechados) throws BusinessException; + + public BigDecimal carregarValorDepositoContaCorrente(Integer empresaId, Integer puntoventaId, Date datamovimento); + + public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException; + + public Conferencia cancelarChegadaMalote(Conferencia conferencia); + + public boolean isConferidoVenta(BoletoComissao boletoComissao); + + public void borrarLogConferenciaTransacaoId(Long transacaoId) throws BusinessException; + + public boolean isConferenciaCompetenciaEncerrada(Date dataInicial, Date dataFinal, Empresa empresa, PuntoVenta puntoVenta, boolean isDesconsideraPtVendaFechados) throws BusinessException; + + public boolean isConfMovFPTrocaVlrDeposito(Empresa empresa); + + public BigDecimal getComissaoPuntoVenta(Integer puntoventaId, Integer empresaId, Date dataInicial, Date dataFinal) throws BusinessException; +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConferenciaPendenciaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConferenciaPendenciaDAO.java new file mode 100644 index 000000000..aaaecb1e5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConferenciaPendenciaDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConferenciaPendencia; + +/** + * + * @author Wilian + */ +public interface ConferenciaPendenciaDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfigRestriccionPagoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfigRestriccionPagoDAO.java new file mode 100644 index 000000000..67d5749b1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfigRestriccionPagoDAO.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; +import java.util.List; +import java.util.Map; + +/** + * + * @author Administrador + */ +public interface ConfigRestriccionPagoDAO extends GenericDAO { + + public List buscar(FormaPago formaPago, + RestriccionPago restriccionPago, Empresa empresa); + + public Map buscar(FormaPago formaPago); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConstanteDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConstanteDAO.java new file mode 100644 index 000000000..6252e0835 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConstanteDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Constante; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ConstanteDAO extends GenericDAO { + + public Constante buscarPorNomeConstante(String nomeConstante); + + public List buscar(String nombconstante); + + public List buscarPorNomeConstanteLike(String nombconstante); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ContaCorrenteAgenciaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ContaCorrenteAgenciaDAO.java new file mode 100644 index 000000000..494ab3326 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ContaCorrenteAgenciaDAO.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.math.BigDecimal; +import java.util.Date; + +import com.rjconsultores.ventaboletos.entidad.ContaCorrentePtoVta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface ContaCorrenteAgenciaDAO extends GenericDAO { + + public ContaCorrentePtoVta gravarContaCorrente(Integer itemPuntoVentaId, String descOperacion, Date fecCorte, Integer usuarioId, Integer tipoOperacionCCId, + Integer empresaId, short turnoId, BigDecimal importeTotalTarifa, BigDecimal importeTotalPedagio, BigDecimal importeTotalTasaAbordaje, + BigDecimal importeTotalSeguro, BigDecimal importeTotalIngreso, BigDecimal importeTotalEgreso, BigDecimal importeTotalDevolucion, + BigDecimal importeTotalTransferencia, BigDecimal importeFinal, boolean corteAutomatico, + BigDecimal totalVentaSegOpcional, BigDecimal totalCancSegOpcional, BigDecimal importeTotalEfectivo ) throws BusinessException; + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ContaMDDAO.java b/src/com/rjconsultores/ventaboletos/dao/ContaMDDAO.java new file mode 100644 index 000000000..3dc08ee65 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ContaMDDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ContaMD; + +public interface ContaMDDAO extends GenericDAO { + Boolean existeConta(ContaMD conta); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConvenioDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConvenioDAO.java new file mode 100644 index 000000000..8558b37ed --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConvenioDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Convenio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ConvenioDAO extends GenericDAO { + + public List buscar(String descconvenio, String cveconvenio); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ConvenioDetDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConvenioDetDAO.java new file mode 100644 index 000000000..d95a1649b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConvenioDetDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ConvenioDet; + +/** + * + * @author Administrador + */ +public interface ConvenioDetDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CorridaCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/CorridaCtrlDAO.java new file mode 100644 index 000000000..00236d4d2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CorridaCtrlDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.util.Date; + +/** + * + * @author Administrador + */ +public interface CorridaCtrlDAO extends GenericDAO { + + public CorridaCtrl buscar(Ruta ruta, ClaseServicio claseServicio, Marca marca, Date horario, boolean pisoExtra); + + public CorridaCtrl buscar(Integer corridaId, Parada origem, Parada destino, ClaseServicio claseServicio, Marca marca); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CorridaDAO.java b/src/com/rjconsultores/ventaboletos/dao/CorridaDAO.java new file mode 100644 index 000000000..25be661e5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CorridaDAO.java @@ -0,0 +1,109 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Corrida.Id; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.corrida.CorridaVO; + +/** + * + * @author rodrigo + */ +public interface CorridaDAO extends GenericDAO { + + /** + * Indica si existe una corrida de acuerdo el id + * + * No lleva en consideración el campo activo + * + * @param id + * @param dataGeracao + * @return + */ + public Boolean existe(Id id); + + public List buscarPorAutobusCorridasFuturas(DiagramaAutobus diagramaAutobus); + + public List buscarPorRolOperativoCorridasFuturas(DiagramaAutobus diagramaAutobus); + + public List buscarPorFecCorrida(Date value); + + public Corrida buscarPorId(Id id); + + public Long count(Ruta ruta); + + public List verificarCorridaId(Integer corridaId); + + public List buscarPorId(Integer idCorrida); + + public List buscarFiltro(Parada ori, Parada des, Date hora, ClaseServicio cs); + + /** + * Hace la b�squeda de corridas con distinct para: origen, destino, claseServicio,hora + * + * @param ori + * @param des + * @param horaSalidaInicio + * @param horaSalidaFin + * @param cs + * @param corridaId + * @return + */ + public List buscarDistinct(Parada ori, Parada des, Date horaSalidaInicio, + Date horaSalidaFin, ClaseServicio cs, Integer corridaId); + + public boolean existe(Ruta ruta, Date dataGeracao, Date horario, ClaseServicio claseServicio, + Marca marca, boolean pisoExtra); + + public boolean count(Parada origem, Parada destino, Date feccorrida, ClaseServicio claseServicio, + boolean pisoExtra); + + /** + * Regresa la cantidad de corridas que fue generada hoy. + * + * @return + */ + public Long cantCorridaGeneradasHoy(); + + public List buscarGroupCorrridaId(Integer corridaId, Date dateInicio, Date dateFin); + + public List buscarGroupCorrridaId(Integer corridaId, Integer origem, Integer destino, + Integer ruta, Integer numRuta, Date dateInicio, Date dateFin); + + public void actualizaFecHusoFecVerano(Corrida corrida); + + public void actualizaFecHusoFecVerano(List corridas); + + Boolean editarCorridaPorOutraCorrida(List corridas, Corrida corrida); + + public List buscarPorEstado(Estado estado, Date dataInicial); + + List buscarPorEstado(Estado estado, Date dataInicial, Integer corridaId); + + public Corrida buscaCorrridaFutura(Ruta ruta, Date fecInicio); + + List buscarCorridaRelAproveitamento(Parada origem, Parada destino, Date feccorrida, Integer corridaId); + + public Boolean existeCorrida(Long id); + + public Integer atualizaCorridasIntegracaoTotvs(Marca marca, Date dataIncial, Date dataFinal, Integer corridaId) throws BusinessException; + + public List buscarListaPorIds(List corridaIds); + + public CorridaVO buscarVOPorId(Id corridaId); + + public Integer buscarOcupacaoCorrida(Corrida corrida); +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/CorridaTramoDAO.java b/src/com/rjconsultores/ventaboletos/dao/CorridaTramoDAO.java new file mode 100644 index 000000000..5ca8c5a6d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CorridaTramoDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.math.BigDecimal; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; + +public interface CorridaTramoDAO extends GenericDAO { + + public List obtenerTramoTarjetaEmitida(); + + public List buscarTarjetaMesmaCorrida(CorridaTramo ct); + + List buscarCorridaTramoPorCorrida(Corrida corrida); + + public BigDecimal buscarSumTarjetaMesmaCorrida(CorridaTramo ct); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CortesiaBeneficiarioDAO.java b/src/com/rjconsultores/ventaboletos/dao/CortesiaBeneficiarioDAO.java new file mode 100644 index 000000000..70c9f6a23 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CortesiaBeneficiarioDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CortesiaBeneficiario; + +/** + * + * @author Shiro + */ +public interface CortesiaBeneficiarioDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CortesiaDAO.java b/src/com/rjconsultores/ventaboletos/dao/CortesiaDAO.java new file mode 100644 index 000000000..05a2492da --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CortesiaDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Cortesia; +import com.rjconsultores.ventaboletos.entidad.Empleado; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface CortesiaDAO extends GenericDAO { + + public List pesquisar(Empleado empleado); + + + public Cortesia buscar(Cortesia cortesia); + + public List buscarDplicidad(Cortesia cortesia); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CortesiaDireccionDAO.java b/src/com/rjconsultores/ventaboletos/dao/CortesiaDireccionDAO.java new file mode 100644 index 000000000..45ceca2c3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CortesiaDireccionDAO.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CortesiaDireccion; +import com.rjconsultores.ventaboletos.entidad.Marca; +import java.util.Date; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface CortesiaDireccionDAO extends GenericDAO { + + public List pesquisar(Marca marca, ClaseServicio claseServicio, Date fecInicio, Date fecFinal); + + public List buscar(CortesiaDireccion cortesiaDireccion); + + public List buscarFolio(CortesiaDireccion cortesiaDireccion); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CotacaoDAO.java b/src/com/rjconsultores/ventaboletos/dao/CotacaoDAO.java new file mode 100644 index 000000000..a966c6134 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CotacaoDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Cotacao; +import com.rjconsultores.ventaboletos.entidad.Moneda; + +public interface CotacaoDAO extends GenericDAO { + + void inativarCotacoesAntigas(Moneda moneda); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CtrlFechamentoCaixaDAO.java b/src/com/rjconsultores/ventaboletos/dao/CtrlFechamentoCaixaDAO.java new file mode 100644 index 000000000..1c33818e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CtrlFechamentoCaixaDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; + +import com.rjconsultores.ventaboletos.entidad.CtrlFechamentoCaixa; + +public interface CtrlFechamentoCaixaDAO extends GenericDAO { + + public CtrlFechamentoCaixa obtenerFeccorte(Date feccorte); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CtrlSerieBPeDAO.java b/src/com/rjconsultores/ventaboletos/dao/CtrlSerieBPeDAO.java new file mode 100644 index 000000000..4000f461e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CtrlSerieBPeDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CtrlSerieBPe; + +public interface CtrlSerieBPeDAO extends GenericDAO { + + public Boolean gerarSeqSerieBPe(Integer empresaId, String estado, Integer minvalue) throws RuntimeException; + public Integer buscarSequencia(Integer empresaId, String estado); + + public CtrlSerieBPe buscarPorEmpresaEstado(Integer empresaId, Integer estadoId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CtrlSerieEmbarcadaDAO.java b/src/com/rjconsultores/ventaboletos/dao/CtrlSerieEmbarcadaDAO.java new file mode 100644 index 000000000..7722830a5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CtrlSerieEmbarcadaDAO.java @@ -0,0 +1,25 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CtrlSerieEmbarcada; +import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcada; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.exception.SerieEmbarcadaNaoDisponivelException; +import com.rjconsultores.ventaboletos.vo.embarcada.SerieEmbarcada; + +public interface CtrlSerieEmbarcadaDAO extends GenericDAO { + + public CtrlSerieEmbarcada suscribir(CtrlSerieEmbarcada entity); + public CtrlSerieEmbarcada actualizacion(CtrlSerieEmbarcada entity); + public void borrar(CtrlSerieEmbarcada entity); + + public Boolean validaDispositivoEmpresaEstadoCadastrado(DispositivoEmbarcada dispositivo, Empresa empresa, Estado estado); + public List buscarSeriesEmbarcadaDisponivel(final Integer empresaId, final Integer estadoId); + public SerieEmbarcada buscarSerieEmbarcadaDisponivel(final Integer empresaId, final Integer estadoId) throws SerieEmbarcadaNaoDisponivelException; + public CtrlSerieEmbarcada buscarCtrlSerieEmbarcada(final Long ctrlSerieEmbarcadaId) throws SerieEmbarcadaNaoDisponivelException; + + public Boolean validaPossuiDispositivo(Integer empresaId, Integer estadoId, String serie); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CuponConvenioDAO.java b/src/com/rjconsultores/ventaboletos/dao/CuponConvenioDAO.java new file mode 100644 index 000000000..3dacfcb51 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CuponConvenioDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CuponConvenio; +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface CuponConvenioDAO extends GenericDAO{ + + public List pesquisar(TipoConvenio tipoConvenio); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CuponSecretariaDAO.java b/src/com/rjconsultores/ventaboletos/dao/CuponSecretariaDAO.java new file mode 100644 index 000000000..f6ab3ca39 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CuponSecretariaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CuponSecretaria; + +/** + * + * @author Administrador + */ +public interface CuponSecretariaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/CursoDAO.java b/src/com/rjconsultores/ventaboletos/dao/CursoDAO.java new file mode 100644 index 000000000..2855f29f9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CursoDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Curso; + +public interface CursoDAO extends GenericDAO { + public List buscar(String nomcurso); +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/CustomDAO.java b/src/com/rjconsultores/ventaboletos/dao/CustomDAO.java new file mode 100644 index 000000000..0d8242303 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/CustomDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Custom; + +/** + * + * @author Lucas + */ +public interface CustomDAO extends GenericDAO { + + public Custom buscar(String chave); + + public Custom buscar(Integer sistema, String chave); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/DepositoBancarioDAO.java b/src/com/rjconsultores/ventaboletos/dao/DepositoBancarioDAO.java new file mode 100644 index 000000000..0edafef1b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/DepositoBancarioDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.DepositoBancario; + +/** + * + * @author Rafius + */ +public interface DepositoBancarioDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/DescontoComissaoDAO.java b/src/com/rjconsultores/ventaboletos/dao/DescontoComissaoDAO.java new file mode 100644 index 000000000..780b596c1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/DescontoComissaoDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DescontoComissao; + +public interface DescontoComissaoDAO extends GenericDAO { + + public List buscaDescontoComissao(Integer puntoVentaId, Integer empresaId, Date inicioPeriodo, Date fimPeriodo); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/DetAbastoBoletoDAO.java b/src/com/rjconsultores/ventaboletos/dao/DetAbastoBoletoDAO.java new file mode 100644 index 000000000..272228952 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/DetAbastoBoletoDAO.java @@ -0,0 +1,23 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Estacion; + +public interface DetAbastoBoletoDAO extends GenericDAO { + + public Long getSecuencia(); + + public List buscaDetAbastoBoletos(AbastoBoleto abastoBoleto); + + public List buscaDetAbastoBoletos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa); + + public void desativaDetAbastos(List detAbastoBoletos); + + public List buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa); + + public List buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(com.rjconsultores.ventaboletos.entidad.Aidf aidf); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/DetDiagramaAutobusDAO.java b/src/com/rjconsultores/ventaboletos/dao/DetDiagramaAutobusDAO.java new file mode 100644 index 000000000..e2a792690 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/DetDiagramaAutobusDAO.java @@ -0,0 +1,30 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; + +/** + * + * @author Administrador + */ +public interface DetDiagramaAutobusDAO { + + public List obtenerTodos(); + + public DetDiagramaAutobus obtenerID(Short id); + + public DetDiagramaAutobus suscribir(DetDiagramaAutobus entidad); + + public DetDiagramaAutobus actualizacion(DetDiagramaAutobus entidad); + + public void borrar(DetDiagramaAutobus entidad); + + public Long count(String campo, Object o); + + public DetDiagramaAutobus obtenerPorDiagramaAutobusAsiento(Integer diagramaAutobusId, String numAsiento); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/DiagramaAutobusDAO.java b/src/com/rjconsultores/ventaboletos/dao/DiagramaAutobusDAO.java new file mode 100644 index 000000000..798a3e622 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/DiagramaAutobusDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface DiagramaAutobusDAO extends GenericDAO { + + public List buscar(String descDiagrama, Short maxparados, + Short cantasientos); + + public List buscar(String descDiagrama); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/DispositivoEmbarcadaDAO.java b/src/com/rjconsultores/ventaboletos/dao/DispositivoEmbarcadaDAO.java new file mode 100644 index 000000000..64d3f24d1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/DispositivoEmbarcadaDAO.java @@ -0,0 +1,28 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcada; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; +import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro; +import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface DispositivoEmbarcadaDAO extends GenericDAO { + + public DispositivoEmbarcada buscarVersaoUltimaSinc(String versaoUltimaSinc); + public DispositivoEmbarcada buscarDispositivoPorId(DispositivoEmbarcada dispositivoEmbarcada); + public DispositivoEmbarcada suscribirActualizar(DispositivoEmbarcada dispositivoEmbarcada); + public DispositivoEmbarcada buscarImei(String imei); + public DispositivoEmbarcada buscarImeiDuplicado(String imei); + public List buscarPorEmpresaPuntoVenta(Empresa empresa, PuntoVenta puntoventa); + + public List buscarTodos(); + public List buscarAllVersaoUltimaSinc(); + + public List getListaFormaPago(Integer puntoventaId); + public List getListaSeguroTaxaEmbarque(Integer puntoventaId); + public List getListaTiposPassagensBloqueadas(Integer puntoventaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/DispositivoEmbarcadaHistoricoDAO.java b/src/com/rjconsultores/ventaboletos/dao/DispositivoEmbarcadaHistoricoDAO.java new file mode 100644 index 000000000..5c5904f64 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/DispositivoEmbarcadaHistoricoDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcadaHistorico; + +public interface DispositivoEmbarcadaHistoricoDAO extends GenericDAO { + + public List buscarHistoricoDispositivoPorId(Long dispositivoId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/DivisionDAO.java b/src/com/rjconsultores/ventaboletos/dao/DivisionDAO.java new file mode 100644 index 000000000..f3e430ee8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/DivisionDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Division; + +public interface DivisionDAO extends GenericDAO { + + public List obtenerTodos(); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EmbarcadaDispOperadorDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmbarcadaDispOperadorDAO.java new file mode 100644 index 000000000..a4220a0fe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmbarcadaDispOperadorDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EmbarcadaDispOperador; + +public interface EmbarcadaDispOperadorDAO extends GenericDAO { + + public List buscarEmbarcadaDispOperadorPorPuntoVenta(Long puntoVentaId); + + public boolean removerListEmbarcadaDispOperador(List embarcadaDisOperadorList); + + public List buscarEmbarcadaDispOperadorPorDispositivo(Long dispositivoEmbarcadaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EmbarqueCatracaRodoviariaDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmbarqueCatracaRodoviariaDAO.java new file mode 100644 index 000000000..31d871203 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmbarqueCatracaRodoviariaDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EmbarqueCatracaRodoviaria; + +public interface EmbarqueCatracaRodoviariaDAO extends GenericDAO { + + @Override + List obtenerTodos(); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpleadoDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpleadoDAO.java new file mode 100644 index 000000000..53c8e9f05 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpleadoDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empleado; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface EmpleadoDAO extends GenericDAO{ + + public List pesquisaClave(String empleadoClave); + + public List pesquisaEmpresa(Integer empresaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaContaBancariaDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaContaBancariaDAO.java new file mode 100644 index 000000000..59417c6db --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaContaBancariaDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; + +public interface EmpresaContaBancariaDAO { + + public EmpresaContaBancaria suscribir(EmpresaContaBancaria entidad); + + public EmpresaContaBancaria actualizacion(EmpresaContaBancaria entidad); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaDAO.java new file mode 100644 index 000000000..f81b99488 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaDAO.java @@ -0,0 +1,77 @@ +/* +// * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ComEmpCategoria; +import com.rjconsultores.ventaboletos.entidad.ComEmpConferencia; +import com.rjconsultores.ventaboletos.entidad.ComEmpFormapago; +import com.rjconsultores.ventaboletos.entidad.ComEmpTipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +/** + * + * @author Administrador + */ +public interface EmpresaDAO { + + public List obtenerTodos(); + + public Empresa obtenerID(Integer id); + + public Empresa suscribir(Empresa entidad); + + public Empresa actualizacion(Empresa entidad); + + public Long count(String campo,Object o); + + public List buscarTodosExceto(List empresa,Integer... idEmpresa); + + public List obtenerIndExternoFalse(); + + public List buscar(String nombempresa, Boolean indExterna, Short indTipo); + + public List obtenerIndTipo2(); + + public List buscarNotInPuntoVtaComissao(PuntoVenta puntoVenta); + + public List buscaInscricoesEstaduais(Empresa empresa); + + public void actualizaInscEstadual(InscricaoEstadual inscricaoEstadual); + + public List buscaLike(String nombempresa); + + public List obtenerTodosIncluindoEmpresaTodas(); + + public ComEmpCategoria adicionarComissaoCategoria(ComEmpCategoria comEmpCategoria); + + public void removerComissaoCategoria(ComEmpCategoria comEmpCategoria); + + public ComEmpFormapago adicionarComissaoFormapago(ComEmpFormapago comEmpFormapago); + + public void removerComissaoFormapago(ComEmpFormapago comEmpFormapago); + + public ComEmpTipoEventoExtra adicionarComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra); + + public void removerComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra); + + public ComEmpConferencia suscribir(ComEmpConferencia comEmpConferencia); + + public ComEmpConferencia actualizacion(ComEmpConferencia comEmpConferencia); + + /** + * Gera o folio sistema do estado e empresa + * @param idEmpresa + * @param cveEstado + * @throws RuntimeException + */ + public void gerarSeqNumFolioSistema(Integer idEmpresa, String cveEstado) throws RuntimeException; + + public List buscarEmpresaPtoVtaComissao(); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaEmailConfigDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaEmailConfigDAO.java new file mode 100644 index 000000000..1c1517040 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaEmailConfigDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailConfig; + +public interface EmpresaEmailConfigDAO extends GenericDAO { + + public List obtenerTodos(); + + public EmpresaEmailConfig buscarPorEmpresa(Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaEmailDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaEmailDAO.java new file mode 100644 index 000000000..18e767ca0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaEmailDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmail; + +public interface EmpresaEmailDAO extends GenericDAO { + + public List obtenerTodos(); + + public EmpresaEmail buscarPorEmpresa(Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaEmailFlexBusDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaEmailFlexBusDAO.java new file mode 100644 index 000000000..c3ac0cd39 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaEmailFlexBusDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailFlexBus; + +public interface EmpresaEmailFlexBusDAO extends GenericDAO { + + public List obtenerTodos(); + + public EmpresaEmailFlexBus buscarPorEmpresa(Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaEquivalenciaDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaEquivalenciaDAO.java new file mode 100644 index 000000000..9723bbc93 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaEquivalenciaDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEquivalencia; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface EmpresaEquivalenciaDAO extends GenericDAO { + + public List buscar(Empresa empresa, ComisionistaExterno comisionistaExterno); + + public List buscar(EmpresaEquivalencia empresaEquivalencia); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaImpostoDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaImpostoDAO.java new file mode 100644 index 000000000..075617ee9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaImpostoDAO.java @@ -0,0 +1,22 @@ +/* +// * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +public interface EmpresaImpostoDAO extends GenericDAO { + + public List buscarByEmpresa(Empresa empresa); + + public List buscarEmpresaImposto(Integer empresaId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaSaferConfigDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaSaferConfigDAO.java new file mode 100644 index 000000000..8ba992059 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaSaferConfigDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaSaferConfig; + +public interface EmpresaSaferConfigDAO extends GenericDAO { + + public List obtenerTodos(); + + public EmpresaSaferConfig buscarPorEmpresa(Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaTrocoSimplesDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaTrocoSimplesDAO.java new file mode 100644 index 000000000..eb9e8ca3b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaTrocoSimplesDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.EmpresaTrocoSimples; + +public interface EmpresaTrocoSimplesDAO extends GenericDAO { + + public EmpresaTrocoSimples buscarPorEmpresaId(Integer empresaId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EnderecoApanheDAO.java b/src/com/rjconsultores/ventaboletos/dao/EnderecoApanheDAO.java new file mode 100644 index 000000000..5e1d40fac --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EnderecoApanheDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EnderecoApanhe; + +public interface EnderecoApanheDAO extends GenericDAO{ + + public List buscar(Date datapacote, String numoperacion); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EscolaDAO.java b/src/com/rjconsultores/ventaboletos/dao/EscolaDAO.java new file mode 100644 index 000000000..162088fc4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EscolaDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Escola; + +public interface EscolaDAO extends GenericDAO { + public List buscar(String nombescola, Ciudad ciudad); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EsquemaAgrupacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/EsquemaAgrupacionDAO.java new file mode 100644 index 000000000..bb06b2b1c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EsquemaAgrupacionDAO.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EsquemaAgrupacion; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; + +/** + * + * @author RJ Consultores + */ +public interface EsquemaAgrupacionDAO extends GenericDAO { + + public List buscar(EsquemaAgrupacion esquemaAgrupacion); + + public EsquemaAgrupacion obtenerByEsquemaAgrupacion(Integer numAgrupacion); + + public boolean buscarNumAgrupacion(Integer numAgrupacion); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EsquemaAsientoDAO.java b/src/com/rjconsultores/ventaboletos/dao/EsquemaAsientoDAO.java new file mode 100644 index 000000000..a33bce20d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EsquemaAsientoDAO.java @@ -0,0 +1,21 @@ + +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.EsquemaAsiento; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface EsquemaAsientoDAO extends GenericDAO { + + public List obtenerPorCorrida(EsquemaCorrida esquemaCorrida); + + public EsquemaAsiento obtenerPorCorridaeAsiento(EsquemaCorrida esquemaCorrida, String asiento); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EsquemaCorridaDAO.java b/src/com/rjconsultores/ventaboletos/dao/EsquemaCorridaDAO.java new file mode 100644 index 000000000..757901132 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EsquemaCorridaDAO.java @@ -0,0 +1,85 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +/** + * + * @author Rafius + */ +public interface EsquemaCorridaDAO extends GenericDAO { + + public List buscarPorEsquemaOperacional(EsquemaOperacional eo); + + public List buscarPorEmpresaCorrida(Empresa empresa); + + public List buscar(Marca marca, RolOperativo rolOperativo, Ruta ruta, ClaseServicio claseServicio); + + public boolean buscarNumCorrida(Integer numCorrida, Integer numCorridaPisoExtra, boolean isDoublePiso); + + public EsquemaCorrida buscaEsquemaPorRuta(Ruta ruta); + + EsquemaCorrida buscaEsquemaPorRutaSemVigencia(Integer rutaId, Integer numCorrida); + + public List buscarPorRuta(Ruta ruta); + + /** + * Indica se el esquema corrida es hijo de un esquemCorrida. + * + * @param esquemaCorrida + * @return + */ + public boolean esHijoRebote(EsquemaCorrida esquemaCorrida); + + /** + * Busca los esquema corrida que tiene esquema operacional en la fecha indicada + * + * @param dataGeracao + * @return + */ + public List buscaDentroVigencia(Date dataGeracao); + + public boolean buscarEsquemaCorridaExisteTramo(Tramo tramo); + + /** + * Indica cuál son los Id's de EsquemaCorrida que tienen la paradaId en su secuencia + * + * @param ruta + * @param paradaId + * @return - El Id de EsquemaCorrida + */ + public List existe(Ruta ruta, Integer paradaId); + + public EsquemaCorrida obtenerByEsquemaCorrida(Integer numCorrida); + + public List buscaDentroVigenciaQtdeDiasNull(Date dataGeracao); + + public List buscaDentroVigenciaQtdeDiasNotNull(Date dataDe); + + /** + * Indica se o esquema é o indicado como segundo piso nas configuações de doble piso + * + * @param esquemaCorrida + * @return + */ + public boolean esSegundoPiso(EsquemaCorrida esquemaCorrida); + + EsquemaCorrida buscarPeloNumCorrida(Integer numCorrida); + + public Integer atualizaServicoIntegracaoTotvs(Marca marca, Integer corridaId) throws BusinessException; + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EsquemaCorridaEmbarqueDesembarqueDAO.java b/src/com/rjconsultores/ventaboletos/dao/EsquemaCorridaEmbarqueDesembarqueDAO.java new file mode 100644 index 000000000..83fb621ce --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EsquemaCorridaEmbarqueDesembarqueDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorridaEmbarqueDesembarque; + +public interface EsquemaCorridaEmbarqueDesembarqueDAO extends GenericDAO { + + List obtenerPorEsquemaCorrida(EsquemaCorrida esquemaCorrida); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EsquemaOperacionalDAO.java b/src/com/rjconsultores/ventaboletos/dao/EsquemaOperacionalDAO.java new file mode 100644 index 000000000..5adb543a7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EsquemaOperacionalDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface EsquemaOperacionalDAO extends GenericDAO { + + public List dentroVigenciaEsquemaOperacional(Date dataGeracao); + + public List dentroVigenciaEsquemaOperacional(Date dataDe, Date dataAte); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EsquemaTramoDAO.java b/src/com/rjconsultores/ventaboletos/dao/EsquemaTramoDAO.java new file mode 100644 index 000000000..477b3dff6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EsquemaTramoDAO.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaTramo; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface EsquemaTramoDAO extends GenericDAO { + + public List obtenerPorEsquemaCorrida(EsquemaCorrida ec); + + public List obtenerPorEsquemaCorridaOrderNumSec(EsquemaCorrida ec); + + public List obtenerAtivosDesativosPorEsquemaCorrida(EsquemaCorrida esquemaCorrida); + + Boolean verificarDuplicidadeEsquemaTramo(EsquemaTramo esquemaTramo); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EstacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/EstacionDAO.java new file mode 100644 index 000000000..641aff86a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EstacionDAO.java @@ -0,0 +1,54 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; + +/** + * + * @author Administrador + */ +public interface EstacionDAO extends GenericDAO { + + public List buscar(String descEstacion, String descMac, + Long nunCaja, PuntoVenta pv); + + public List buscar(String descMac); + + public Estacion buscarPorIMEI(String imei); + + /** + * Hace la búsqueda de las estciones ativas por el numCaja y puntoVenta + * + * @param numCaja + * @param puntoVenta + * @return + */ + public List buscar(Long numCaja, PuntoVenta puntoVenta); + + public List buscarEstaciones(PuntoVenta puntoVenta); + + public List buscarEstaciones(List lsPuntoVenta); + + public List buscarPuntosVentaEstacionPorUsuario(Usuario usuario); + + public Boolean temEstoque(PuntoVenta puntoVenta, Estacion estacion); + + public List buscarEstacionesStockCentral(PuntoVenta puntoVenta); + + /** + * Retorna a estação duplicada pelo MAC + * @param descMac + * @param estacionId + * @return + */ + public Estacion buscarEstacionDuplicadaPorMAC(String descMac, Integer estacionId); + + public Estacion buscarEstacionDuplicadaPorIMEI(String imei, Integer estacionId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EstacionSitefDAO.java b/src/com/rjconsultores/ventaboletos/dao/EstacionSitefDAO.java new file mode 100644 index 000000000..ad770e70c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EstacionSitefDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EstacionSitef; +import com.rjconsultores.ventaboletos.enums.TipoIntegracaoTEF; + +/** + * + * @author Lucas + * + */ +public interface EstacionSitefDAO extends GenericDAO { + + EstacionSitef buscar(Empresa empresa, Integer numempresa, Integer numfilial, String numpdv); + + public EstacionSitef buscar(Empresa empresa, TipoIntegracaoTEF tipoIntegracaoTEF, String numpdv, Integer numfilial); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EstadoDAO.java b/src/com/rjconsultores/ventaboletos/dao/EstadoDAO.java new file mode 100644 index 000000000..b4ca771bc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EstadoDAO.java @@ -0,0 +1,30 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Pais; + +/** + * + * @author MCosso + */ +public interface EstadoDAO extends GenericDAO { + + public List buscar(String nombestado, Pais pais); + + public List buscarNotInEmpresaImposto(Empresa empresa); + + public List buscarCveEstado(String cveEstado); + + public Map getConfiguracoesFusoVeraoParada(Integer paradaId, Date data); + + public Map getConfiguracoesFusoVeraoPuntoventa(Integer puntoventaId, Date data); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EventoExtraDAO.java b/src/com/rjconsultores/ventaboletos/dao/EventoExtraDAO.java new file mode 100644 index 000000000..a4db573c6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EventoExtraDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; + +public interface EventoExtraDAO extends GenericDAO{ + public List obtenerPorTipo(TipoEventoExtra tipoEventoExtra); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ExcepcionPeajeDAO.java b/src/com/rjconsultores/ventaboletos/dao/ExcepcionPeajeDAO.java new file mode 100644 index 000000000..8b9151c23 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ExcepcionPeajeDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje; +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeajeVigencia; + +public interface ExcepcionPeajeDAO extends GenericDAO { + public List buscar(String descconvenio, String cveconvenio); + + public void deletarVigencias(List epv); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ExcepcionRedondoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ExcepcionRedondoDAO.java new file mode 100644 index 000000000..77826835c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ExcepcionRedondoDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ExcepcionRedondo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ExcepcionRedondoDAO extends GenericDAO { + + public List buscar(String indTipo, Parada origem, Parada destino); + + /** + * Hace la búsqueda de las excepcion activas por origen y destino. + * @param origem + * @param destino + * @return + */ + public List buscar(Parada origem, Parada destino); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FechamentoParamgeralDAO.java b/src/com/rjconsultores/ventaboletos/dao/FechamentoParamgeralDAO.java new file mode 100644 index 000000000..56f08faff --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FechamentoParamgeralDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral; + +public interface FechamentoParamgeralDAO extends GenericDAO { + + public List buscaParametrosPorEmpresas(List empresasId); + public List buscaParametrosPorEmpresa(Integer empresasId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FechamentoParamptovtaDAO.java b/src/com/rjconsultores/ventaboletos/dao/FechamentoParamptovtaDAO.java new file mode 100644 index 000000000..bf1d08faf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FechamentoParamptovtaDAO.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface FechamentoParamptovtaDAO extends GenericDAO { + + public List buscaParametrosPorEmpresas(List empresasId); + public List buscaParametrosPorEmpresa(Integer empresasId); + public List buscaParametrosPorPuntoventa(PuntoVenta puntoventa); + public FechamentoParamptovta buscaParametrosPorPuntoventa(PuntoVenta puntoventa, Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FeriadoDAO.java b/src/com/rjconsultores/ventaboletos/dao/FeriadoDAO.java new file mode 100644 index 000000000..7a4e3dc96 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FeriadoDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.sql.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Feriado; + + +public interface FeriadoDAO extends GenericDAO { + + public List buscar(Date fecferiado); + + public boolean ehFeriado(Date fecFeriado, Empresa empresa, Estado estadoOrigem); + + public List buscarDataEmpresaEstado(Date data, Empresa empresa, Estado estado); +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/FiscalAliquotaEmpresaDAO.java b/src/com/rjconsultores/ventaboletos/dao/FiscalAliquotaEmpresaDAO.java new file mode 100644 index 000000000..4b75189c1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FiscalAliquotaEmpresaDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.FiscalAliquotaEmpresa; + +public interface FiscalAliquotaEmpresaDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FiscalDAO.java b/src/com/rjconsultores/ventaboletos/dao/FiscalDAO.java new file mode 100644 index 000000000..a4e934bf2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FiscalDAO.java @@ -0,0 +1,75 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECF; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoCCF; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoCFC; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoICF; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoPRC; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoBPR; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoBPS; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoDBP; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoPAR; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoRMD; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoSeqBPS; +import com.rjconsultores.ventaboletos.utilerias.fiscal.vo.FiscalRdi; +import com.rjconsultores.ventaboletos.utilerias.impressaormd.vo.ImpressaoRMD; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionNaoFiscalVO; + +public interface FiscalDAO { + + public int gerarRegistroP2_F2(List lsEsquemaCorrida, Date dataDe, Date dataAte) throws SQLException; + + public List buscaDatosFiscaisECF(Date inicio, Date fim, Integer empresaId, Integer estadoId, boolean isNormal, boolean isCancelados, boolean isPendencias, Connection connection, boolean isBoletoHist) throws SQLException; + + public List buscaDatosFiscaisReducaoZ(Date inicio, Date fim, Integer empresaId, Integer estadoId, boolean isPendencias, Connection connection) throws SQLException; + + public List buscaDatosFiscaisECFManual(Date inicio, Date fim, Integer empresaId, Integer estadoId, Connection connection, boolean isBoletoHist) throws SQLException; + + public List buscaDatosNaoFiscais(Date inicio, Date fim, Integer empresaId, Integer estadoId, Connection connection) throws SQLException; + + public ExportacaoECF buscarRegistroECF(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado); + + public List buscarRegistroECFTipoCFC(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado); + + public List buscarRegistroECFTipoCCF(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado); + + public List buscarRegistroECFTipoICF(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado); + + public List buscarRegistroECFTipoPRC(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado); + + public ExportacaoBPR buscarRegistroBPR(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado); + + public List buscarRegistroRMDTipoPAR(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado); + + public List buscarRegistroRMDTipoRMD(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado); + + public List buscarRegistroRMDTipoBPS(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado); + + public List buscarRegistroRMDTipoDBP(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado); + + public List buscarRegistroRMDSeqTipoBPS(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado); + + public List getRegistroImpressaoRMDTipoBPR(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado, String rmd, String folio); + + public List getRegistroImpressaoRMDTipoECF(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado, String rmd, String folio); + + public void gravarRMDBoleto(Connection connection, List rmds, Aidf aidf, String folio, Integer empresaId, Integer estadoId, boolean isECF, boolean isBPR); + + public void cancelarRMDBoleto(Connection connection, Date inicio, Date fim, Integer empresaId, Estado estado, Aidf aidf, String folioInicial, String folioFinal, boolean isCancela, boolean isInativa, boolean isECF, boolean isBPR); + + public List buscarRelatorioRDI(Connection connection, Date inicio, Date fim, Integer empresaId, List estados, boolean isReceitaTerceiros); + + public void limparCache(Connection connection); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FiscalFormapagoEmpresa.java b/src/com/rjconsultores/ventaboletos/dao/FiscalFormapagoEmpresa.java new file mode 100644 index 000000000..08b23d834 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FiscalFormapagoEmpresa.java @@ -0,0 +1,5 @@ +package com.rjconsultores.ventaboletos.dao; + +public interface FiscalFormapagoEmpresa extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FiscalImpressoraDAO.java b/src/com/rjconsultores/ventaboletos/dao/FiscalImpressoraDAO.java new file mode 100644 index 000000000..56177c3cb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FiscalImpressoraDAO.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FiscalFormapagoEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.FiscalRelgerencialEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalTotnaofiscalEmpresa; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; + +public interface FiscalImpressoraDAO { + + public List obtenerTodos(); + public FiscalImpressora obtenerID(Integer id); + public FiscalImpressora suscribir(FiscalImpressora entidad); + public FiscalImpressora actualizacion(FiscalImpressora entidad); + public void borrar(FiscalImpressora entidad); + public Long count(String campo,Object o); + + + public List buscarTotsNaoFiscaisEmpresa(Integer empresaEcfId); + public List obtenerTodosTotnaofiscalEmpresa(); + public FiscalTotnaofiscalEmpresa obtenerIDTotnaofiscalEmpresa(Long id); + public FiscalTotnaofiscalEmpresa suscribirTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad); + public FiscalTotnaofiscalEmpresa actualizarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad); + public void borrarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad); + + public List buscarFormaPagoEmpresa(Integer empresaEcfId); + public List obtenerTodosFormapagoEmpresa(); + public FiscalFormapagoEmpresa obtenerIDFormapagoEmpresa(Long id); + public FiscalFormapagoEmpresa suscribirFormapagoEmpresa(FiscalFormapagoEmpresa entidad); + public FiscalFormapagoEmpresa actualizacionFormapagoEmpresa(FiscalFormapagoEmpresa entidad); + + public List buscarItensRelgerencialEmpresa(Integer empresaEcfId); + public List obtenerTodosRelgerencialEmpresa(); + public FiscalRelgerencialEmpresa obtenerIDRelgerencialEmpresa(Long id); + public FiscalRelgerencialEmpresa suscribirRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad); + public FiscalRelgerencialEmpresa actualizacionRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad); + public FiscalTotnaofiscalEmpresa buscarTotNaoFiscal(Empresa empresa, String tipoTotalizador); + public FiscalTotnaofiscalEmpresa buscarTotNaoFiscal(Empresa empresa, String tipoTotalizador,String descEcf); + public FiscalFormapagoEmpresa buscarFormaPago(Empresa empresa, String tipoformapago); + FiscalFormapagoEmpresa buscarFormaPago(Empresa empresa, String tipoformapago, String descEcf); + FiscalRelgerencialEmpresa buscarRelGerencial(Empresa empresa, String tipoRelGerencial ); + FiscalTotnaofiscalEmpresa buscarTotNaoFiscal(Empresa empresa, String tipoTotalizador, String descEcf, TipoEventoExtra tipoeventoextra); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FiscalImpressoraEstadoDAO.java b/src/com/rjconsultores/ventaboletos/dao/FiscalImpressoraEstadoDAO.java new file mode 100644 index 000000000..8a99372c3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FiscalImpressoraEstadoDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressoraEstado; + +public interface FiscalImpressoraEstadoDAO { + + public List obtenerTodos(); + public FiscalImpressoraEstado obtenerID(Integer id); + public FiscalImpressoraEstado suscribir(FiscalImpressoraEstado entidad); + public FiscalImpressoraEstado actualizacion(FiscalImpressoraEstado entidad); + public void borrar(FiscalImpressoraEstado entidad); + public Long count(String campo,Object o); + + public List retornaEstadosFiscalImpressora(FiscalImpressora fiscalImpressora) ; + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FiscalRelgerencialEmpresa.java b/src/com/rjconsultores/ventaboletos/dao/FiscalRelgerencialEmpresa.java new file mode 100644 index 000000000..7c3cff179 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FiscalRelgerencialEmpresa.java @@ -0,0 +1,5 @@ +package com.rjconsultores.ventaboletos.dao; + +public interface FiscalRelgerencialEmpresa extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FiscalTotnaofiscalEmpresaDAO.java b/src/com/rjconsultores/ventaboletos/dao/FiscalTotnaofiscalEmpresaDAO.java new file mode 100644 index 000000000..2eb7adbc3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FiscalTotnaofiscalEmpresaDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.FiscalTotnaofiscalEmpresa; + +public interface FiscalTotnaofiscalEmpresaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FlywayUtilDAO.java b/src/com/rjconsultores/ventaboletos/dao/FlywayUtilDAO.java new file mode 100644 index 000000000..0448a9c8c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FlywayUtilDAO.java @@ -0,0 +1,5 @@ +package com.rjconsultores.ventaboletos.dao; + +public interface FlywayUtilDAO { + public boolean existeErroExecucaoScript(); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FolioPreimpresoDAO.java b/src/com/rjconsultores/ventaboletos/dao/FolioPreimpresoDAO.java new file mode 100644 index 000000000..59b947a28 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FolioPreimpresoDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.FolioPreimpreso; + +public interface FolioPreimpresoDAO extends GenericDAO { + + public FolioPreimpreso buscaFolioPreImpressoEstacionImpresora(Estacion estacion, Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FormaPagamentoAgenciaDAO.java b/src/com/rjconsultores/ventaboletos/dao/FormaPagamentoAgenciaDAO.java new file mode 100644 index 000000000..d197f466b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FormaPagamentoAgenciaDAO.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +/** + * + * @author Administrador + */ +public interface FormaPagamentoAgenciaDAO extends GenericDAOInforme { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FormaPagoDAO.java b/src/com/rjconsultores/ventaboletos/dao/FormaPagoDAO.java new file mode 100644 index 000000000..5958f90c0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FormaPagoDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface FormaPagoDAO extends GenericDAO { + + public List buscarPorDescricao(String descpago); + + public List buscarTodosExceto(Integer... idFormaPago); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FormaPagoDetDAO.java b/src/com/rjconsultores/ventaboletos/dao/FormaPagoDetDAO.java new file mode 100644 index 000000000..4c10fbf5b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FormaPagoDetDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; + +/** + * + * @author Administrador + */ +public interface FormaPagoDetDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/FuncionSistemaDAO.java b/src/com/rjconsultores/ventaboletos/dao/FuncionSistemaDAO.java new file mode 100644 index 000000000..5583a0b74 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/FuncionSistemaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.FuncionSistema; + +/** + * + * @author rodrigo + */ +public interface FuncionSistemaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/GenericDAO.java b/src/com/rjconsultores/ventaboletos/dao/GenericDAO.java new file mode 100644 index 000000000..e6d526eb7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/GenericDAO.java @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Collection; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface GenericDAO { + + public List obtenerTodos(); + + public T obtenerID(ID id); + + public T suscribir(T entidad); + + public T actualizacion(T entidad); + + public void borrar(T entidad); + + public Long count(String campo, Object o); + + public void suscribirTodos(Collection entidades); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/GenericDAOInforme.java b/src/com/rjconsultores/ventaboletos/dao/GenericDAOInforme.java new file mode 100644 index 000000000..a62c51b95 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/GenericDAOInforme.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.util.Map; + +/** + * + * @author Administrador + */ +public interface GenericDAOInforme { + + @SuppressWarnings("rawtypes") + public ResultSet executarSQL(Connection conn, Map parameters); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/GrupoCategoriaDAO.java b/src/com/rjconsultores/ventaboletos/dao/GrupoCategoriaDAO.java new file mode 100644 index 000000000..efa191daa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/GrupoCategoriaDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.GrupoCategoria; + +public interface GrupoCategoriaDAO extends GenericDAO { + + public List buscar(String descricao); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/GrupoCortesiasDAO.java b/src/com/rjconsultores/ventaboletos/dao/GrupoCortesiasDAO.java new file mode 100644 index 000000000..68ce34a84 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/GrupoCortesiasDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; +import com.rjconsultores.ventaboletos.entidad.GrupoCortesia; +import java.util.List; + + +/** + * + * @author Shiro + */ +public interface GrupoCortesiasDAO extends GenericDAO{ + + public List buscar(String descgrupo); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/GrupoRutaDAO.java b/src/com/rjconsultores/ventaboletos/dao/GrupoRutaDAO.java new file mode 100644 index 000000000..6449cc76e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/GrupoRutaDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.GrupoRuta; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +public interface GrupoRutaDAO extends GenericDAO { + + public List buscarPorNome(String descgrupo); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/HotelDAO.java b/src/com/rjconsultores/ventaboletos/dao/HotelDAO.java new file mode 100644 index 000000000..749daeb3d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/HotelDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Hotel; + +public interface HotelDAO extends GenericDAO { + + public List buscar(String deschotel); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ImagemDAO.java b/src/com/rjconsultores/ventaboletos/dao/ImagemDAO.java new file mode 100644 index 000000000..82a83f96f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ImagemDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Imagem; + +public interface ImagemDAO extends GenericDAO { + + public Imagem buscarPorNomeImagem(String nomeImagem); + + public List buscar(String nombimagem); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/InformeCategoriaVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/InformeCategoriaVentaDAO.java new file mode 100644 index 000000000..75d15cf53 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/InformeCategoriaVentaDAO.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +/** + * + * @author Administrador + */ +public interface InformeCategoriaVentaDAO extends GenericDAOInforme { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/InformePasajeroServicioDAO.java b/src/com/rjconsultores/ventaboletos/dao/InformePasajeroServicioDAO.java new file mode 100644 index 000000000..ae412d27e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/InformePasajeroServicioDAO.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +/** + * + * @author Administrador + */ +public interface InformePasajeroServicioDAO extends GenericDAOInforme { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/InformeServicioDiarioDAO.java b/src/com/rjconsultores/ventaboletos/dao/InformeServicioDiarioDAO.java new file mode 100644 index 000000000..a8f1e6812 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/InformeServicioDiarioDAO.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +/** + * + * @author Administrador + */ +public interface InformeServicioDiarioDAO extends GenericDAOInforme { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/InformeVentasPuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/InformeVentasPuntoVentaDAO.java new file mode 100644 index 000000000..65c3365ed --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/InformeVentasPuntoVentaDAO.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +/** + * + * @author Administrador + */ +public interface InformeVentasPuntoVentaDAO extends GenericDAOInforme { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/InstiFinanceiraDAO.java b/src/com/rjconsultores/ventaboletos/dao/InstiFinanceiraDAO.java new file mode 100644 index 000000000..6e295f0bd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/InstiFinanceiraDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + + + +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; +import com.rjconsultores.ventaboletos.entidad.InstiFinanceira; + +public interface InstiFinanceiraDAO extends GenericDAO { + + public List buscar(String nome); + public List buscarContasBancariasPorIdEmpresa(Integer empresaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/IntegracaoDerPrDAO.java b/src/com/rjconsultores/ventaboletos/dao/IntegracaoDerPrDAO.java new file mode 100644 index 000000000..e0f148254 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/IntegracaoDerPrDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.vo.exportacao.QdmpDerLinhaVo; + +public interface IntegracaoDerPrDAO extends GenericDAO { + + public String buscarDadosImportacaoCabeca(Date inicio, Date fim, Empresa empresa, Integer linhaId); + public List buscarDadosImportacaoLinha(Date inicio, Date fim, Empresa empresa, Integer linhaId); + public String buscarDadosImportacaoRodape(Date inicio, Date fim, Empresa empresa, Integer linhaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/IntegracaoTotvsDAO.java b/src/com/rjconsultores/ventaboletos/dao/IntegracaoTotvsDAO.java new file mode 100644 index 000000000..42333db1c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/IntegracaoTotvsDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.IntegracaoTotvs; + +public interface IntegracaoTotvsDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/IntgeracaoTotvsHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/IntgeracaoTotvsHibernateDAO.java new file mode 100644 index 000000000..4733b496c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/IntgeracaoTotvsHibernateDAO.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.dao; + +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.hibernate.GenericHibernateDAO; +import com.rjconsultores.ventaboletos.entidad.IntegracaoTotvs; + +@Repository("IntgeracaoTotvsDAO") +public class IntgeracaoTotvsHibernateDAO extends GenericHibernateDAO + implements IntegracaoTotvsDAO { + + @Autowired + public IntgeracaoTotvsHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ItemAdicionalDAO.java b/src/com/rjconsultores/ventaboletos/dao/ItemAdicionalDAO.java new file mode 100644 index 000000000..75d3b22bc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ItemAdicionalDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; + +public interface ItemAdicionalDAO extends GenericDAO { + + public List buscaItemAdicionalPacote(Pacote pacote); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ItemDescontoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ItemDescontoDAO.java new file mode 100644 index 000000000..b75ffc5b9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ItemDescontoDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ItemDesconto; + +public interface ItemDescontoDAO extends GenericDAO { + + public List buscarPorNome(String nomitemdesconto); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/LogAuditoriaDAO.java b/src/com/rjconsultores/ventaboletos/dao/LogAuditoriaDAO.java new file mode 100644 index 000000000..9bbef24a5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/LogAuditoriaDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.LogAuditoria; + +public interface LogAuditoriaDAO extends GenericDAO { + + public List listarTodasAsTelas(); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/LogDespesaReceitaDivDAO.java b/src/com/rjconsultores/ventaboletos/dao/LogDespesaReceitaDivDAO.java new file mode 100644 index 000000000..c1da959e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/LogDespesaReceitaDivDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.LogDespesaReceitaDiversa; + +public interface LogDespesaReceitaDivDAO extends GenericDAO { + List obterPorPeriodo(Date inicio, Date fim); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/LogHistoricoContingenciaDAO.java b/src/com/rjconsultores/ventaboletos/dao/LogHistoricoContingenciaDAO.java new file mode 100644 index 000000000..288fc67ee --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/LogHistoricoContingenciaDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.LogHistoricoContingencia; + +/** + * @author vjcor + * + */ +public interface LogHistoricoContingenciaDAO extends GenericDAO { + + public List buscarHistorico(Integer empresaID, Integer estadoID); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MarcaAutobusDAO.java b/src/com/rjconsultores/ventaboletos/dao/MarcaAutobusDAO.java new file mode 100644 index 000000000..f5ad0cd8e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MarcaAutobusDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.MarcaAutobus; + + +public interface MarcaAutobusDAO extends GenericDAO { + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MarcaClaseServicioDAO.java b/src/com/rjconsultores/ventaboletos/dao/MarcaClaseServicioDAO.java new file mode 100644 index 000000000..efb45eb0c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MarcaClaseServicioDAO.java @@ -0,0 +1,28 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicioPK; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface MarcaClaseServicioDAO + extends GenericDAO { + + /** + * Regresa las Marcas activas vinculadas a la clase de servicio informada + * @param clase + * @return + */ + public List buscar(ClaseServicio clase); + + public List buscarPorEmpresasPermitidas(ClaseServicio clase, List idsEmpresa); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MarcaDAO.java b/src/com/rjconsultores/ventaboletos/dao/MarcaDAO.java new file mode 100644 index 000000000..ffabe72ea --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MarcaDAO.java @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Usuario; + +/** + * + * @author Administrador + */ +public interface MarcaDAO extends GenericDAO { + + public List buscarPorNome(String nomeMarca); + + public List buscarTodosExceto(Usuario usuario, Integer... idMarca); + + public List buscarDescricaoIdMarca(); + + public List buscarMarcaPorEmpresa(List empresa); + + public Marca buscarMarcaPorEmpresa(Empresa empresa); + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/MensagemRecusaDAO.java b/src/com/rjconsultores/ventaboletos/dao/MensagemRecusaDAO.java new file mode 100644 index 000000000..da4923c65 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MensagemRecusaDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.MensagemRecusa; + +public interface MensagemRecusaDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MensajeDAO.java b/src/com/rjconsultores/ventaboletos/dao/MensajeDAO.java new file mode 100644 index 000000000..783c9966a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MensajeDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; + +public interface MensajeDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MensajeEmpresaDAO.java b/src/com/rjconsultores/ventaboletos/dao/MensajeEmpresaDAO.java new file mode 100644 index 000000000..9a67f252f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MensajeEmpresaDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeEmpresa; + +public interface MensajeEmpresaDAO extends GenericDAO { + + public List obtenerPorMensaje(Mensaje mensaje); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MensajePuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/MensajePuntoVentaDAO.java new file mode 100644 index 000000000..283b2dc5a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MensajePuntoVentaDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajePuntoVenta; + +public interface MensajePuntoVentaDAO extends GenericDAO { + + public List obtenerPorMensaje(Mensaje mensaje); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MensajeUsuarioDAO.java b/src/com/rjconsultores/ventaboletos/dao/MensajeUsuarioDAO.java new file mode 100644 index 000000000..d4ea40c5e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MensajeUsuarioDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeUsuario; + +public interface MensajeUsuarioDAO extends GenericDAO { + + public List obtenerPorMensaje(Mensaje mensaje); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MercadoCompetidoDAO.java b/src/com/rjconsultores/ventaboletos/dao/MercadoCompetidoDAO.java new file mode 100644 index 000000000..6a1f58af4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MercadoCompetidoDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MercadoCompetido; +import com.rjconsultores.ventaboletos.entidad.Parada; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface MercadoCompetidoDAO extends GenericDAO { + + public boolean existe(ClaseServicio claseServicio, Parada origem, + Parada destino); + + public List buscar(Parada origem, Parada destino); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MerchantBancarioDAO.java b/src/com/rjconsultores/ventaboletos/dao/MerchantBancarioDAO.java new file mode 100644 index 000000000..06e212c56 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MerchantBancarioDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.MerchantBancario; + +/** + * + * @author Rafius + */ +public interface MerchantBancarioDAO extends GenericDAO { + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MonedaDAO.java b/src/com/rjconsultores/ventaboletos/dao/MonedaDAO.java new file mode 100644 index 000000000..c6215e10f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MonedaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Moneda; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface MonedaDAO extends GenericDAO { + + public List buscar(String descmoneda); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MonitoramentoCCFDAO.java b/src/com/rjconsultores/ventaboletos/dao/MonitoramentoCCFDAO.java new file mode 100644 index 000000000..43322287c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MonitoramentoCCFDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.sql.Connection; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCCF; + +public interface MonitoramentoCCFDAO extends GenericDAO { + public List buscaQuebraCCF(final String numserie, final Date data, final Integer ccfInicial); + public List obtenerTodos(); + public void setConnection(Connection con); + public Map obterImpressorasComCCFInicial(Date data); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MonitoramentoCRZDAO.java b/src/com/rjconsultores/ventaboletos/dao/MonitoramentoCRZDAO.java new file mode 100644 index 000000000..76072abbe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MonitoramentoCRZDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCRZ; + +public interface MonitoramentoCRZDAO extends GenericDAO { + public List buscaQuebraCRZ(Date data); + public List obtenerTodos(); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MotivoCancelVendaPacoteDAO.java b/src/com/rjconsultores/ventaboletos/dao/MotivoCancelVendaPacoteDAO.java new file mode 100644 index 000000000..64a4d2c39 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MotivoCancelVendaPacoteDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.MotivoCancelVendaPacote; + +/** + * + * @author Bruno + */ +public interface MotivoCancelVendaPacoteDAO extends GenericDAO { + + public List buscar(String descmotivocancel, String tipomotivocancel); + + public List obtenerTodosTipoMotivoCancel(); + + public List obtenerTodosEspecificos(Integer[] motivos); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MotivoCancelacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/MotivoCancelacionDAO.java new file mode 100644 index 000000000..eae5d5bf9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MotivoCancelacionDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface MotivoCancelacionDAO extends GenericDAO { + + public List buscar(String descmotivo, String tipomotivo); + + public List obtenerTodosTipoMotivoB(); + + public List obtenerTodosEspecificos(Integer[] motivos); + + public MotivoCancelacion findByCveSistema(String cveSistema) ; +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MotivoDevolucaoBilheteDAO.java b/src/com/rjconsultores/ventaboletos/dao/MotivoDevolucaoBilheteDAO.java new file mode 100644 index 000000000..41a6d20d1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MotivoDevolucaoBilheteDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.MotivoDevolucaoBilhete; +import java.util.List; + +/** + * + * @author Bruno Neves + */ +public interface MotivoDevolucaoBilheteDAO extends GenericDAO { + + public List buscar(String descmotivo, String tipomotivo); + + public List obtenerTodosTipoMotivoB(); + + public List obtenerTodosEspecificos(Integer[] motivos); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MotivoReimpresionDAO.java b/src/com/rjconsultores/ventaboletos/dao/MotivoReimpresionDAO.java new file mode 100644 index 000000000..3d1fb3302 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MotivoReimpresionDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.MotivoReimpresion; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface MotivoReimpresionDAO extends GenericDAO { + + public List buscar(String descmotivo); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MotivoViajeDAO.java b/src/com/rjconsultores/ventaboletos/dao/MotivoViajeDAO.java new file mode 100644 index 000000000..6fd76ba4e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MotivoViajeDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.MotivoViaje; + +/** + * + * @author Shiro + */ +public interface MotivoViajeDAO extends GenericDAO{ + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/MotivocancelacionEquivalenciaDAO.java b/src/com/rjconsultores/ventaboletos/dao/MotivocancelacionEquivalenciaDAO.java new file mode 100644 index 000000000..1ccee5ea0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/MotivocancelacionEquivalenciaDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import com.rjconsultores.ventaboletos.entidad.MotivocancelacionEquivalencia; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface MotivocancelacionEquivalenciaDAO + extends GenericDAO { + + public List buscar(ComisionistaExterno comisionistaExterno, + MotivoCancelacion motivoCancelacion); + + public List buscarEquivalencia(MotivocancelacionEquivalencia motivoCancelacionEquivalencia); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/NodoDAO.java b/src/com/rjconsultores/ventaboletos/dao/NodoDAO.java new file mode 100644 index 000000000..129d7f3f8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/NodoDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Nodo; + +/** + * + * @author Administrador + */ +public interface NodoDAO extends GenericDAO { + + public List obtenerTodos(); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/NotaCreditoVendaPacoteDAO.java b/src/com/rjconsultores/ventaboletos/dao/NotaCreditoVendaPacoteDAO.java new file mode 100644 index 000000000..ca4d4b352 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/NotaCreditoVendaPacoteDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.NotaCreditoVendaPacote; +import com.rjconsultores.ventaboletos.vo.reembolsoocdnotacredito.ReembolsoOcdNotaCreditoVO; + +public interface NotaCreditoVendaPacoteDAO extends GenericDAO { + + List busquedaDatosReembolsoOcdNotaCreditoRS(Date fecInicial, Date fecFinal, + Date fecPagamentoInicial, Date fecPagamentoFinal, Boolean indPago); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/OCDDAO.java b/src/com/rjconsultores/ventaboletos/dao/OCDDAO.java new file mode 100644 index 000000000..9e8727242 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/OCDDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OCD; +import com.rjconsultores.ventaboletos.vo.reembolsoocdnotacredito.ReembolsoOcdNotaCreditoVO; + +public interface OCDDAO extends GenericDAO { + + List busquedaDatosReembolsoOcdNotaCreditoRS(Date fecInicial, Date fecFinal, + Date fecPagamentoInicial, Date fecPagamentoFinal, Boolean indPago); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/OCDParamDAO.java b/src/com/rjconsultores/ventaboletos/dao/OCDParamDAO.java new file mode 100644 index 000000000..14f08bc83 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/OCDParamDAO.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OCDParam; + +public interface OCDParamDAO extends GenericDAO { + + public OCDParam suscribirActualizar(OCDParam entidad); + public OCDParam buscaOCDParamPorEmpresa(Empresa empresa); + public List buscaOCDParams(Empresa empresa); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/OCDPtoVtaParamDAO.java b/src/com/rjconsultores/ventaboletos/dao/OCDPtoVtaParamDAO.java new file mode 100644 index 000000000..0b5bb3d20 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/OCDPtoVtaParamDAO.java @@ -0,0 +1,14 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.OCDPtoVtaParam; + +/** + * @author Thiago + * + */ +public interface OCDPtoVtaParamDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/OperadorEmbarcadaDAO.java b/src/com/rjconsultores/ventaboletos/dao/OperadorEmbarcadaDAO.java new file mode 100644 index 000000000..824d3253e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/OperadorEmbarcadaDAO.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcada; +import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO; + +public interface OperadorEmbarcadaDAO extends GenericDAO { + + public List buscarTodosOperadores(); + + public OperadorEmbarcada burcarOperadorPorId(Long operadorEmbarcadaID); + + public OperadorEmbarcada buscarOperadorEmbarcadaPorUsuario(Integer idUsuario); + + public PuntoVentaVO getPuntoVentaVO(Integer operador); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/OperadorEmbarcadaLinhaDAO.java b/src/com/rjconsultores/ventaboletos/dao/OperadorEmbarcadaLinhaDAO.java new file mode 100644 index 000000000..c23e38ae1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/OperadorEmbarcadaLinhaDAO.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcada; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcadaLinha; +import com.rjconsultores.ventaboletos.vo.ruta.RutaVO; + +public interface OperadorEmbarcadaLinhaDAO extends GenericDAO { + + public List buscarPorOperador(OperadorEmbarcada operador); + + public List getListaRutaVO(Integer operador); + + public List getListaResumidaRutaVO(Integer operador); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/OperadorEmbarcadaServicoDAO.java b/src/com/rjconsultores/ventaboletos/dao/OperadorEmbarcadaServicoDAO.java new file mode 100644 index 000000000..037cc4ce8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/OperadorEmbarcadaServicoDAO.java @@ -0,0 +1,25 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcada; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcadaServico; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.vo.corrida.CorridaVO; + +@SuppressWarnings("rawtypes") +public interface OperadorEmbarcadaServicoDAO extends GenericDAO { + + public List buscarPorOperador(OperadorEmbarcada operador); +// public OperadorEmbarcada buscarOperadorEmbarcadaPorUsuario(Integer idUsuario); + + public List getListaCorridaVO(Integer operador, Empresa empresa, Date dtIni, Date dtFim, PuntoVenta puntoVenta); + + public List getListaResumidaCorridaVO(Integer operador, Empresa empresa, Date dtIni, Date dtFim, PuntoVenta puntoVenta, Boolean retornaTramos) throws Exception ; + + public List getListaCorridaProxyVO(Integer operador, Empresa empresa, Date dtIni, Date dtFim); + + public void preencherCorrida(CorridaVO corrida, PuntoVenta puntoVenta, Empresa empresa); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/OrgaoCancelacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/OrgaoCancelacionDAO.java new file mode 100644 index 000000000..74293286d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/OrgaoCancelacionDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoCancelacion; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +public interface OrgaoCancelacionDAO extends GenericDAO { + + public List buscarPorOrgao(OrgaoConcedente orgaoConcedente); + + public List obtenerTodos(); + + public List obtenerTodosIds() ; +} diff --git a/src/com/rjconsultores/ventaboletos/dao/OrgaoConcedenteDAO.java b/src/com/rjconsultores/ventaboletos/dao/OrgaoConcedenteDAO.java new file mode 100644 index 000000000..ed869ae96 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/OrgaoConcedenteDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +public interface OrgaoConcedenteDAO extends GenericDAO { + + public List buscar(String desc); + + public List obtenerTodos(); + + public List obtenerTodosIds() ; + + public List obtenerTodosExceto(Integer... id); + + public List buscarListaPorIds(List claseIds); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/OrgaoEmpParamDAO.java b/src/com/rjconsultores/ventaboletos/dao/OrgaoEmpParamDAO.java new file mode 100644 index 000000000..add75a2c0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/OrgaoEmpParamDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoEmpParam; + +public interface OrgaoEmpParamDAO extends GenericDAO { + + public List obterPorOrgao(Integer orgaoConcedenteId); + + public List obterPorEmpresa(Integer empresaId); + + public OrgaoEmpParam obterPorOrgaoEmpresa(Integer orgaoConcedenteId, Integer empresaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/OrgaoTramoDAO.java b/src/com/rjconsultores/ventaboletos/dao/OrgaoTramoDAO.java new file mode 100644 index 000000000..fba3d9cbf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/OrgaoTramoDAO.java @@ -0,0 +1,28 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.OrgaoTramo; + +public interface OrgaoTramoDAO { + + /** + * Hace la busqueda de la configuracion del coeficiente por tramo
+ * + * @param origenId + * @param destinoId + * @param viaId + * @param orgaoConcedenteId + * @param claseServicioId + * @return + */ + public OrgaoTramo buscar(Integer origenId, Integer destinoId, Integer viaId, Integer orgaoConcedenteId, Integer claseServicioId); + + /** + * Graba el registro en la base de datos + * @param orgaoTramo + * @return + */ + public OrgaoTramo suscribir(OrgaoTramo orgaoTramo); + + public Long count(String campo, Object o); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PacoteConvenioDAO.java b/src/com/rjconsultores/ventaboletos/dao/PacoteConvenioDAO.java new file mode 100644 index 000000000..746702cb1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PacoteConvenioDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PacoteConvenio; + +public interface PacoteConvenioDAO extends GenericDAO { + + public List buscar(String nomconvenio); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PacoteDAO.java b/src/com/rjconsultores/ventaboletos/dao/PacoteDAO.java new file mode 100644 index 000000000..cbe2df3f0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PacoteDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pacote; + +public interface PacoteDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PacoteDescontoBilheteDAO.java b/src/com/rjconsultores/ventaboletos/dao/PacoteDescontoBilheteDAO.java new file mode 100644 index 000000000..5ac9f5f74 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PacoteDescontoBilheteDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PacoteDescontoBilhete; + +public interface PacoteDescontoBilheteDAO extends GenericDAO { + + public List obtenerTodos(Integer pacoteId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PacoteItemDAO.java b/src/com/rjconsultores/ventaboletos/dao/PacoteItemDAO.java new file mode 100644 index 000000000..6d3da5937 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PacoteItemDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteItem; + +public interface PacoteItemDAO extends GenericDAO { + + public PacoteItem buscaPacoteItem(Pacote pacote, ItemAdicional item); + + public List buscaItensPacote(Pacote pacote); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PacoteTarifaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PacoteTarifaDAO.java new file mode 100644 index 000000000..aeee175d2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PacoteTarifaDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteTarifa; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +public interface PacoteTarifaDAO extends GenericDAO { + + public PacoteTarifa buscaPacoteTarifa(Pacote pacote, TipoTarifaPacote tipoTarifaPacote); + + public List buscaTarifasPacote(Pacote pacote); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PaisDAO.java b/src/com/rjconsultores/ventaboletos/dao/PaisDAO.java new file mode 100644 index 000000000..a058a920c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PaisDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pais; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PaisDAO extends GenericDAO { + + public List buscar(String nombpais); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ParadaCodOrgaoConcedenteDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParadaCodOrgaoConcedenteDAO.java new file mode 100644 index 000000000..cc781c04d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ParadaCodOrgaoConcedenteDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ParadaCodOrgaoConcedente; + +public interface ParadaCodOrgaoConcedenteDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java new file mode 100644 index 000000000..fd0dfc5ed --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java @@ -0,0 +1,59 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Nodo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.RegionMetropolitana; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TipoParada; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ParadaDAO { + + public Parada obtenerID(Integer id); + + public Parada suscribir(Parada entidad); + + public Parada actualizacion(Parada entidad); + + public Long count(String campo, Object o); + + public List buscar(String descparada, String cveparada, Ciudad ciudad,TipoParada tipoParada, Nodo nodo); + + /** + * Busca as paradas que tenham o codAntt informado + * + * @param codAntt + * @return + */ + public List buscar(Integer codAntt); + + public List buscar(String descparada); + + public List buscarCVE(String cveparada); + + public List buscaLike(String descparada); + + public Long count(TipoParada tipoParada); + + public List obtenerOrigenPorRuta(Ruta ruta); + + public List obtenerTodos(); + + public List obterPossiveisDestinos(Parada origem); + + public List buscaParadaRegionMetropolitana(RegionMetropolitana regionMetropolitana); + + public List buscarListaPorIds(List paradaIds); + + public Parada buscarPorId(Integer paradaId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ParadaEquivalenciaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParadaEquivalenciaDAO.java new file mode 100644 index 000000000..c8c680d8a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ParadaEquivalenciaDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaEquivalencia; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ParadaEquivalenciaDAO extends GenericDAO { + + public List buscar(Parada parada, ComisionistaExterno comisionistaExterno, String equivalencia); + + public List buscarEquivalencia(String equivalencia); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ParamAcumulaMasivoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParamAcumulaMasivoDAO.java new file mode 100644 index 000000000..acec450b2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ParamAcumulaMasivoDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaMasivo; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamAcumulaMasivoDAO extends GenericDAO { + + + public List buscar(ParamAcumulaMasivo paramAcumulaMasivo); + + public List buscar(Empresa emp, Integer min, Integer max, Date fecIni, Date fecFim); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ParamAcumulaPuntoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParamAcumulaPuntoDAO.java new file mode 100644 index 000000000..830523460 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ParamAcumulaPuntoDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaPunto; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamAcumulaPuntoDAO extends GenericDAO { + + public List buscar(Parada origem, Parada destino, Date ini, Date fim); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ParamArticuloDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParamArticuloDAO.java new file mode 100644 index 000000000..7874a7f3b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ParamArticuloDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ParamArticulo; + +public interface ParamArticuloDAO extends GenericDAO{ + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ParamCanjePuntoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParamCanjePuntoDAO.java new file mode 100644 index 000000000..99391fe5b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ParamCanjePuntoDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamCanjePunto; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamCanjePuntoDAO extends GenericDAO { + + public List buscar(Parada origem, Parada destino, Date ini, Date fim); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ParamCompraPuntoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParamCompraPuntoDAO.java new file mode 100644 index 000000000..bad3c9212 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ParamCompraPuntoDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ParamCompraPunto; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamCompraPuntoDAO extends GenericDAO { + + public List buscar(Date ini, Date fim); + + public List buscar(Date ini, Date fim, Integer cantPuntos, BigDecimal costoPunto); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ParamConexionDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParamConexionDAO.java new file mode 100644 index 000000000..8c0722762 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ParamConexionDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ParamConexion; + +public interface ParamConexionDAO { + + public ParamConexion actualizacion(ParamConexion paramConexion) ; +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ParamCostoTarjetaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParamCostoTarjetaDAO.java new file mode 100644 index 000000000..1b007a02b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ParamCostoTarjetaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ParamCostoTarjeta; + +/** + * + * @author Rafius + */ +public interface ParamCostoTarjetaDAO extends GenericDAO { + + public List buscar(ParamCostoTarjeta paramCostoTarjeta); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ParamRecoleccionDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParamRecoleccionDAO.java new file mode 100644 index 000000000..43f4cbac8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ParamRecoleccionDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ParamRecoleccion; + +/** + * + * @author Desenvolvimento + */ +public interface ParamRecoleccionDAO extends GenericDAO{ + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PerfilDAO.java b/src/com/rjconsultores/ventaboletos/dao/PerfilDAO.java new file mode 100644 index 000000000..1800edd47 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PerfilDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Perfil; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface PerfilDAO extends GenericDAO { + + public List buscar(String dscPerfil); + + public List buscaPerfilJerarquia(Perfil perfilUsuario); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PerfilFuncionDAO.java b/src/com/rjconsultores/ventaboletos/dao/PerfilFuncionDAO.java new file mode 100644 index 000000000..f0c35d81b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PerfilFuncionDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PerfilFuncion; + +/** + * + * @author rodrigo + */ +public interface PerfilFuncionDAO extends GenericDAO { + + public boolean usuarioPossuiPermissaoFuncionalidade(Integer usuarioId, String descRuta); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PeriodoVacacionalDAO.java b/src/com/rjconsultores/ventaboletos/dao/PeriodoVacacionalDAO.java new file mode 100644 index 000000000..281e9247b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PeriodoVacacionalDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PeriodoVacacional; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PeriodoVacacionalDAO extends GenericDAO { + + public List buscar(Date dataInicio, Date dataFim); + + public List buscarFechaTraslapa(PeriodoVacacional periodoVacacional); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PlazaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PlazaDAO.java new file mode 100644 index 000000000..f2d5dc9f6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PlazaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Plaza; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface PlazaDAO extends GenericDAO { + + public List buscar(String nombplaza); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PrecioFixoPedagioDAO.java b/src/com/rjconsultores/ventaboletos/dao/PrecioFixoPedagioDAO.java new file mode 100644 index 000000000..6298a53fc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PrecioFixoPedagioDAO.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PrecioFixoPedagio; + +/** + * + * @author Administrador + */ +public interface PrecioFixoPedagioDAO extends GenericDAO { + + public List buscarPorNome(String nomeClaseServicio); + + public List buscarTodosExceto(Integer ... idClase); + + public List buscarPorEmpresasDoUsuario (String idEmpresasUsuario); + + public List buscarPrecioFixoPedagio(PrecioFixoPedagio obj); +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/PrecioVentajaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PrecioVentajaDAO.java new file mode 100644 index 000000000..5cf6b14a3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PrecioVentajaDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; +import com.rjconsultores.ventaboletos.entidad.PrecioVentaja; + +/** + * + * @author Igor + */ +public interface PrecioVentajaDAO extends GenericDAO { + + public List buscarPrecioVentaja(Integer origenId, Integer destinoId, Integer rutaId, Integer corridaId); + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PrecoApanheDAO.java b/src/com/rjconsultores/ventaboletos/dao/PrecoApanheDAO.java new file mode 100644 index 000000000..e545a2fbc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PrecoApanheDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PrecoApanhe; + +public interface PrecoApanheDAO extends GenericDAO { + + public List buscar(String deschotel, String desccolonia, String nombciudad); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingAsientoDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingAsientoDAO.java new file mode 100644 index 000000000..7dffd65dc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingAsientoDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingAsiento; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingAsientoDAO extends GenericDAO { + + public List obtenerPricingCategoria(Pricing pricing, Integer asiento); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingCategoriaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingCategoriaDAO.java new file mode 100644 index 000000000..7884de6c2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingCategoriaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCategoria; + +/** + * + * @author Rafius + */ +public interface PricingCategoriaDAO extends GenericDAO { + + public Boolean obtenerPricingCategoria(Pricing pricing, Categoria categoria); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingClaseDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingClaseDAO.java new file mode 100644 index 000000000..7d9c43069 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingClaseDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingClase; + +/** + * + * @author Rafius + */ +public interface PricingClaseDAO extends GenericDAO { + + public Boolean obtenerPricingClase(Pricing pricing, ClaseServicio claseServicio); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingClasseTarifariaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingClasseTarifariaDAO.java new file mode 100644 index 000000000..110550cf1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingClasseTarifariaDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PricingClasseTarifaria; + +public interface PricingClasseTarifariaDAO extends GenericDAO { + + public Boolean validacionSigla(String sigla); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingCorridaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingCorridaDAO.java new file mode 100644 index 000000000..68de7ba48 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingCorridaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCorrida; + +/** + * + * @author Rafius + */ +public interface PricingCorridaDAO extends GenericDAO { + + public Boolean obtenerPricingCorrida(Pricing pricing, CorridaCtrl corrida); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingCtrlDAO.java new file mode 100644 index 000000000..9f47866c3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingCtrlDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PricingCtrl; + +/** + * + * @author wilian + */ +public interface PricingCtrlDAO extends GenericDAO { + + public PricingCtrl obtenerPricingCtrl(); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingDAO.java new file mode 100644 index 000000000..ca73f041f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingDAO.java @@ -0,0 +1,33 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingDAO extends GenericDAO { + + public List buscar(String nombPricing, Empresa empresa, + Short cantboleto, Integer cantdiasanticipacion, + BigDecimal descuentoporcentaje, BigDecimal descuentoporcredondo); + + public List buscarPorNombre(String nombPricing); + + public List buscar(Integer pricingId, String nomepricing, Integer empresaId, Date dataViagemInicio, Date dataViagemFim, Integer origemId, Integer destinoId); + + /** + * Recupera os pricings com vigencia fim da viagem acima ou igual aos dias informados. + * @param diasFimViagem + * @return + */ + public List buscar(Integer diasFimViagem); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingDiaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingDiaDAO.java new file mode 100644 index 000000000..0cb9b89e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingDiaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PricingDia; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingDiaDAO extends GenericDAO { + + public List buscarTraslapa(PricingDia pricingDia); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoAgenciaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoAgenciaDAO.java new file mode 100644 index 000000000..837939a1e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoAgenciaDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoAgencia; + +public interface PricingEspecificoAgenciaDAO extends GenericDAO { + + Boolean isDuplicado(PricingEspecificoAgencia entidad); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoCanalVendasDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoCanalVendasDAO.java new file mode 100644 index 000000000..a9e6fe692 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoCanalVendasDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCanalVendas; + +public interface PricingEspecificoCanalVendasDAO extends GenericDAO { + + Boolean isDuplicado(PricingEspecificoCanalVendas entidad); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoCategoriaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoCategoriaDAO.java new file mode 100644 index 000000000..125ef3e8f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoCategoriaDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCategoria; + +public interface PricingEspecificoCategoriaDAO extends GenericDAO { + + Boolean isDuplicado(PricingEspecificoCategoria entidad); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoDAO.java new file mode 100644 index 000000000..c7e7da09d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PricingEspecifico; + +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingEspecificoDAO extends GenericDAO { + + public List buscarPorNome(PricingEspecifico pricingEspecifico); + + public List buscarPorNome(String nome); + + public List buscar(List empresas, List tipoClasses, List origens, List destinos, Date vigenciaInicial, Date vigenciaFinal); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoOcupacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoOcupacionDAO.java new file mode 100644 index 000000000..3e7c3e5eb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingEspecificoOcupacionDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoOcupacion; + +public interface PricingEspecificoOcupacionDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingFormapagoDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingFormapagoDAO.java new file mode 100644 index 000000000..b2d385588 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingFormapagoDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PricingFormapago; + +public interface PricingFormapagoDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingImporteDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingImporteDAO.java new file mode 100644 index 000000000..ff0de3546 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingImporteDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.PricingImporte; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingImporteDAO extends GenericDAO { + + public List buscarMoneda(PricingImporte pricingImporte, Moneda moneda); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingMarcaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingMarcaDAO.java new file mode 100644 index 000000000..3e2f3ea7c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingMarcaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMarca; + +/** + * + * @author Rafius + */ +public interface PricingMarcaDAO extends GenericDAO { + + public Boolean obtenerPricingMarca(Pricing pricing, Marca marca); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingMercadoDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingMercadoDAO.java new file mode 100644 index 000000000..b0508d1f2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingMercadoDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMercado; + +/** + * + * @author Rafius + */ +public interface PricingMercadoDAO extends GenericDAO { + + public Boolean obtenerPricingMercado(Pricing pricing, Parada origen, Parada destino); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingOcupaAntecipaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingOcupaAntecipaDAO.java new file mode 100644 index 000000000..5da8a37c4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingOcupaAntecipaDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; + +/** + * + * @author Rafius + */ +public interface PricingOcupaAntecipaDAO extends GenericDAO { + + + public List buscarOcupaAntecipaPricing(Integer pricingId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingPuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingPuntoVentaDAO.java new file mode 100644 index 000000000..15f172d0a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingPuntoVentaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +/** + * + * @author Rafius + */ +public interface PricingPuntoVentaDAO extends GenericDAO { + + public Boolean obtenerPricingPuntoVenta(Pricing pricing, PuntoVenta puntoVenta); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingRutaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingRutaDAO.java new file mode 100644 index 000000000..44cce2268 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingRutaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingRuta; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +/** + * + * @author Rafius + */ +public interface PricingRutaDAO extends GenericDAO { + + public Boolean obtenerPricingRuta(Pricing pricing, Ruta ruta); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingTipoPtoVtaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingTipoPtoVtaDAO.java new file mode 100644 index 000000000..b76bea53e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingTipoPtoVtaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; + +/** + * + * @author Rafius + */ +public interface PricingTipoPtoVtaDAO extends GenericDAO { + + public Boolean obtenerPricingTipoPuntoVenta(Pricing pricing, TipoPuntoVenta tipoPuntoVenta); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingTipoServicioDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingTipoServicioDAO.java new file mode 100644 index 000000000..e249fa52c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingTipoServicioDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; +import com.rjconsultores.ventaboletos.entidad.TipoServicio; + +/** + * + * @author Desenvolvimento + */ +public interface PricingTipoServicioDAO extends GenericDAO { + + public Boolean obtenerPricingTipoServicio(Pricing pricing, TipoServicio tipoServicio); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PricingVigenciaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PricingVigenciaDAO.java new file mode 100644 index 000000000..e4c98391e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PricingVigenciaDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingVigencia; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingVigenciaDAO extends GenericDAO { + + public List buscarPorVigencias(PricingVigencia pv); + + public Boolean podeSalvar(Pricing pricing, PricingVigencia pricingVigencia, + Date inicio, Date fim); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ProdClaseServicioDAO.java b/src/com/rjconsultores/ventaboletos/dao/ProdClaseServicioDAO.java new file mode 100644 index 000000000..914fd82c9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ProdClaseServicioDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdClaseServicio; + +/** + * + * @author Rafius + */ +public interface ProdClaseServicioDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ProdFormaPagoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ProdFormaPagoDAO.java new file mode 100644 index 000000000..abce37883 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ProdFormaPagoDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdFormaPago; + +/** + * + * @author Rafius + */ +public interface ProdFormaPagoDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ProdMarcaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ProdMarcaDAO.java new file mode 100644 index 000000000..cb77755bc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ProdMarcaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdMarca; + +/** + * + * @author Rafius + */ +public interface ProdMarcaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ProdMercadoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ProdMercadoDAO.java new file mode 100644 index 000000000..4eb36295d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ProdMercadoDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdMercado; + +/** + * + * @author Rafius + */ +public interface ProdMercadoDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ProdPrecioDAO.java b/src/com/rjconsultores/ventaboletos/dao/ProdPrecioDAO.java new file mode 100644 index 000000000..fbfda688f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ProdPrecioDAO.java @@ -0,0 +1,33 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.ProdPrecio; +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ProdPrecioDAO extends GenericDAO { + + /** + * Hace una busqueda en los prodPrecio que estan ativos y con los filtros indicados + * @param marca + * @param productoservicio + * @return + */ + public List buscar(Marca marca, ProductoServicio productoservicio); + + /** + * Hace una busqueda en los prodPrecio que estan ativos y con los filtros indicados + * @param marca + * @return + */ + public List buscar(Marca marca); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ProdPuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ProdPuntoVentaDAO.java new file mode 100644 index 000000000..727bf9618 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ProdPuntoVentaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdPuntoVenta; + +/** + * + * @author Rafius + */ +public interface ProdPuntoVentaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ProdRutaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ProdRutaDAO.java new file mode 100644 index 000000000..62377f84e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ProdRutaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdRuta; + +/** + * + * @author Rafius + */ +public interface ProdRutaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ProdTipoptovtaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ProdTipoptovtaDAO.java new file mode 100644 index 000000000..8cdd95127 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ProdTipoptovtaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdTipoptovta; + +/** + * + * @author Rafius + */ +public interface ProdTipoptovtaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ProdVigenciaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ProdVigenciaDAO.java new file mode 100644 index 000000000..4978f84e4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ProdVigenciaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProdVigencia; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ProdVigenciaDAO extends GenericDAO { + + public List buscarTraslapa(ProdVigencia prodVigencia); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ProductoServicioDAO.java b/src/com/rjconsultores/ventaboletos/dao/ProductoServicioDAO.java new file mode 100644 index 000000000..cd4ae3e34 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ProductoServicioDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface ProductoServicioDAO extends GenericDAO{ + + public List obtener(ProductoServicio ps); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PtoVtaCheckinDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtoVtaCheckinDAO.java new file mode 100644 index 000000000..15744316d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtoVtaCheckinDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtoVtaCheckin; + +public interface PtoVtaCheckinDAO extends GenericDAO { + + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/PtoVtaSeguroDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtoVtaSeguroDAO.java new file mode 100644 index 000000000..e12071885 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtoVtaSeguroDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro; + +public interface PtoVtaSeguroDAO extends GenericDAO { + + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/PtoVtaUsuarioBancarioDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtoVtaUsuarioBancarioDAO.java new file mode 100644 index 000000000..2da71abbe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtoVtaUsuarioBancarioDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtoVtaUsuarioBancario; + +/** + * + * @author Desenvolvimento + */ +public interface PtoVtaUsuarioBancarioDAO extends GenericDAO { + + public void borrarFisico(PtoVtaUsuarioBancario pto2); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaAgenciaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaAgenciaDAO.java new file mode 100644 index 000000000..184eedf90 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaAgenciaDAO.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaAgencia; + + +public interface PtovtaAgenciaDAO extends GenericDAO { + + public List buscar(String numagencia); + public void borrarFisico(PtovtaAgencia pto); + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaAntecipacomissaoDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaAntecipacomissaoDAO.java new file mode 100644 index 000000000..fa83d565d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaAntecipacomissaoDAO.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + + +import com.rjconsultores.ventaboletos.entidad.PtovtaAntecipacomissao; + +public interface PtovtaAntecipacomissaoDAO extends GenericDAO { + + public List buscar(int id); + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaAntifraudeDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaAntifraudeDAO.java new file mode 100644 index 000000000..60ccf8a71 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaAntifraudeDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaAntifraude; + +public interface PtovtaAntifraudeDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaCatIndDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaCatIndDAO.java new file mode 100644 index 000000000..0043e2b51 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaCatIndDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd; + +public interface PtovtaCatIndDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaComissaoDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaComissaoDAO.java new file mode 100644 index 000000000..f76e8a525 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaComissaoDAO.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaComissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface PtovtaComissaoDAO extends GenericDAO { + + public List buscar(int id); + + public List buscarByPuntaVenta(PuntoVenta puntaVenta); + + public PtovtaComissao buscarPuntaVentaEmpresa(Integer puntaVentaId, Integer empresaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaContaMDDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaContaMDDAO.java new file mode 100644 index 000000000..43c4b3e2e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaContaMDDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaContaMD; + +public interface PtovtaContaMDDAO extends GenericDAO { + + boolean contemItem(PtovtaContaMD ptovtaContaMD); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaDiversosDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaDiversosDAO.java new file mode 100644 index 000000000..44a5aba95 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaDiversosDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaDiversos; + + + + +public interface PtovtaDiversosDAO extends GenericDAO { + + public List buscar(int id); + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaBloqueadaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaBloqueadaDAO.java new file mode 100644 index 000000000..31057b9a1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaBloqueadaDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaBloqueada; + +public interface PtovtaEmpresaBloqueadaDAO extends GenericDAO { + + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaContaBancariaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaContaBancariaDAO.java new file mode 100644 index 000000000..59f97ec6a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaContaBancariaDAO.java @@ -0,0 +1,15 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaContaBancaria; + +/** + * + * @author Desenvolvimento + */ +public interface PtovtaEmpresaContaBancariaDAO extends GenericDAO { + public void borrarFisico(PtovtaEmpresaContaBancaria pto); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaDAO.java new file mode 100644 index 000000000..f2411b97e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaEmpresaDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface PtovtaEmpresaDAO extends GenericDAO { + + public List buscar(PtovtaEmpresa ptovtaEmpresa); + + public void borrarFisico(PtovtaEmpresa pto); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaEstoqueDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaEstoqueDAO.java new file mode 100644 index 000000000..da40c1061 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaEstoqueDAO.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEstoque; + + + + + + +public interface PtovtaEstoqueDAO extends GenericDAO { + + public List buscar(int id); + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaHorarioDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaHorarioDAO.java new file mode 100644 index 000000000..7d60b479e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaHorarioDAO.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaHorario; + + + + + + + +public interface PtovtaHorarioDAO extends GenericDAO { + + public List buscar(int id); + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaTipoEstoqueDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaTipoEstoqueDAO.java new file mode 100644 index 000000000..4d709a79e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaTipoEstoqueDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; + +public interface PtovtaTipoEstoqueDAO extends GenericDAO { + + public PtovtaTipoEstoque buscarTipoSuprimento(); + public PtovtaTipoEstoque buscarTipoContabilidade(); + public PtovtaTipoEstoque buscarTipoNormal(); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaTitularDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaTitularDAO.java new file mode 100644 index 000000000..deb27dd45 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaTitularDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaTitular; + + + +public interface PtovtaTitularDAO extends GenericDAO { + + public List buscar(int id); + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java new file mode 100644 index 000000000..5c3ea7a51 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java @@ -0,0 +1,44 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO; + +/** + * + * @author Administrador + */ +public interface PuntoVentaDAO extends GenericDAO { + + public List buscaLike(String strEstacion, boolean sinTodos); + + public List busca(String nomPuntoVenta, String numPuntoVenta); + + public List buscaPuntoVenta(String numPuntoVenta); + + public List buscaPuntoVentaParada(Parada parada); + + public List buscaPuntoVentaEmpresaSemECF(Empresa empresa); + + public List buscarPuntoVentaSubordinados(PuntoVenta puntoVenta); + + public List buscarPuntosVentaMovimentacionBilhetes(List empresas); + + public List buscarPuntoVentaPorTipoEstoque(PtovtaTipoEstoque tipoEstoque); + + public List quantidadeECFPorPuntoVenta(Conferencia conferencia); + + public List buscarPuntoVentaPtoVtaComissao(List empresas); + + public List buscaPuntoVentaEmpresa(Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ReceitaDespesaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ReceitaDespesaDAO.java new file mode 100644 index 000000000..d0ddf6eb3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ReceitaDespesaDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.relatorios.receitaDespesa.RelatorioFinanceiroReceitasDespesasBean; + +public interface ReceitaDespesaDAO { + + public List getRelatorioDetalhado(Map parametros) throws BusinessException; + + public List getRelatorioSintetico(Map parametros) throws BusinessException; + + public List getRelatorioAgencia(Map parametros) throws BusinessException; + + public List getRelatorioEvento(Map parametros) throws BusinessException; + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RedondeoCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/RedondeoCtrlDAO.java new file mode 100644 index 000000000..b917e593f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RedondeoCtrlDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.RedondeoCtrl; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface RedondeoCtrlDAO extends GenericDAO { + + public List buscar(RedondeoCtrl redondeoCtrl); + + public List buscarTraslapa(Short[] iDMarcas, BigDecimal valorinicial, BigDecimal valorfinal, Boolean indaplicadescuento, + Boolean indaplicapricing, Boolean indaplicaAtersp); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RedondeoDAO.java b/src/com/rjconsultores/ventaboletos/dao/RedondeoDAO.java new file mode 100644 index 000000000..f425af0f8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RedondeoDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Redondeo; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface RedondeoDAO extends GenericDAO { + + public List buscar(BigDecimal valorInicial, BigDecimal valorFinal, + BigDecimal valorRedondeo); + + public List buscar(BigDecimal valorInicial, BigDecimal valorFinal); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RedondeoMarcaDAO.java b/src/com/rjconsultores/ventaboletos/dao/RedondeoMarcaDAO.java new file mode 100644 index 000000000..8abbaaacd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RedondeoMarcaDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.RedondeoMarca; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface RedondeoMarcaDAO extends GenericDAO { + + public List buscar(Marca marca); + + public List obtenerTodasMarcas(Short[] iDMarcas); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RegionMetropolitanaDAO.java b/src/com/rjconsultores/ventaboletos/dao/RegionMetropolitanaDAO.java new file mode 100644 index 000000000..2152622a5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RegionMetropolitanaDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.RegionMetropolitana; + +public interface RegionMetropolitanaDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RelatorioAgepanDAO.java b/src/com/rjconsultores/ventaboletos/dao/RelatorioAgepanDAO.java new file mode 100644 index 000000000..32c6a2f06 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RelatorioAgepanDAO.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.OrgaoConcedente.RelatorioGratuidadeAgepanVO; + +public interface RelatorioAgepanDAO { + + public List listar(Map parametros) throws BusinessException; + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RemessaCNABBancosDAO.java b/src/com/rjconsultores/ventaboletos/dao/RemessaCNABBancosDAO.java new file mode 100644 index 000000000..6f63ac944 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RemessaCNABBancosDAO.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.ArquivoRemessa; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoBoleto; + +public interface RemessaCNABBancosDAO extends GenericDAO{ + + public String findBanco(Empresa empresa); + + public ArquivoRemessa remessaBradesco(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception; + + public ArquivoRemessa remessaSantander(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception; + + public ArquivoRemessa remessaSicoob(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception; + + public ArquivoRemessa remessaCaixa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception; + + public ArquivoRemessa remessaMercantil(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception; + + public ArquivoRemessa remessaItau(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception; + + public ArquivoRemessa remessaBancoBrasil(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception; + + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar); + + public List getEmpresas(); + + public Boolean atualizaRemessa(Empresa empresa, ArquivoRemessa arquivoRemessa) throws Exception; +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RequisicionBoletoDAO.java b/src/com/rjconsultores/ventaboletos/dao/RequisicionBoletoDAO.java new file mode 100644 index 000000000..a39c1444b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RequisicionBoletoDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.RequisicionBoleto; + +public interface RequisicionBoletoDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ReservaEspecialClienteDAO.java b/src/com/rjconsultores/ventaboletos/dao/ReservaEspecialClienteDAO.java new file mode 100644 index 000000000..092f7e670 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ReservaEspecialClienteDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ReservaEspecialCliente; + +public interface ReservaEspecialClienteDAO extends GenericDAO { + + public List bucarReservaEspecialByClienteId(Long clienteId) ; + public List bucarReservaEspecialByCorridaId(Long corridaId) ; +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ReservacionCategoriaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ReservacionCategoriaDAO.java new file mode 100644 index 000000000..ff664873d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ReservacionCategoriaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ReservacionCategoria; + +/** + * + * @author Administrador + */ +public interface ReservacionCategoriaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ReservacionClaseDAO.java b/src/com/rjconsultores/ventaboletos/dao/ReservacionClaseDAO.java new file mode 100644 index 000000000..449b882ce --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ReservacionClaseDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ReservacionClase; + +/** + * + * @author Administrador + */ +public interface ReservacionClaseDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ReservacionCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/ReservacionCtrlDAO.java new file mode 100644 index 000000000..304fdf798 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ReservacionCtrlDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ReservacionCtrl; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ReservacionCtrlDAO extends GenericDAO { + + public List buscar(ReservacionCtrl reservacionCtrl); + + public List buscarFechaTraslapa(ReservacionCtrl reservacionCtrl); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ReservacionMarcaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ReservacionMarcaDAO.java new file mode 100644 index 000000000..42ea81d08 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ReservacionMarcaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ReservacionMarca; + +/** + * + * @author Administrador + */ +public interface ReservacionMarcaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ReservacionMercadoDAO.java b/src/com/rjconsultores/ventaboletos/dao/ReservacionMercadoDAO.java new file mode 100644 index 000000000..83eea9c18 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ReservacionMercadoDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ReservacionMercado; + +/** + * + * @author Administrador + */ +public interface ReservacionMercadoDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ReservacionPuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ReservacionPuntoVentaDAO.java new file mode 100644 index 000000000..f0c3b2732 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ReservacionPuntoVentaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ReservacionPuntoVenta; + +/** + * + * @author Rafius + */ +public interface ReservacionPuntoVentaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RestriccionPagoDAO.java b/src/com/rjconsultores/ventaboletos/dao/RestriccionPagoDAO.java new file mode 100644 index 000000000..9a547682f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RestriccionPagoDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; + +/** + * + * @author Administrador + */ +public interface RestriccionPagoDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RhPagoConductorDAO.java b/src/com/rjconsultores/ventaboletos/dao/RhPagoConductorDAO.java new file mode 100644 index 000000000..088478e73 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RhPagoConductorDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.RhPagoConductor; + +/** + * + * @author Desenvolvimento + */ +public interface RhPagoConductorDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RolOperativoDAO.java b/src/com/rjconsultores/ventaboletos/dao/RolOperativoDAO.java new file mode 100644 index 000000000..e6ade6793 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RolOperativoDAO.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface RolOperativoDAO extends GenericDAO{ + + public List pesquisar(DiagramaAutobus diagrama,String rol); + + public List buscar(String descroloperativo); + + public List buscarListaPorIds(List roloperativoIds); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RutaCasetaDAO.java b/src/com/rjconsultores/ventaboletos/dao/RutaCasetaDAO.java new file mode 100644 index 000000000..1befafef5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RutaCasetaDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + + + +import com.rjconsultores.ventaboletos.entidad.RutaCaseta; + +public interface RutaCasetaDAO extends GenericDAO { + +// public RutaCaseta suscribir(RutaCaseta entidad); + public void deletarRutaCasetasFromRutaSecuenciaId(Integer id); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RutaCombinacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/RutaCombinacionDAO.java new file mode 100644 index 000000000..4becdc35e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RutaCombinacionDAO.java @@ -0,0 +1,92 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaGroupVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaOficialEscalaGroupVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaOficialEscalaVO; + +import java.util.List; +import java.util.Set; + +/** + * + * @author Rafius + */ +public interface RutaCombinacionDAO extends GenericDAO { + + public boolean busquedaRutaTramo(Ruta ruta, Tramo tramo, Boolean ativo); + + public RutaCombinacion busquedaTramoRutaTramo(Ruta ruta, Tramo trBuscaOrigemDestino); + + /** + * Regreso el tramo de la entidade RutaCobinacion donde el tramo tines el origen-destino igual y la Rua sea la misma de RutaCombinacion + * + * @param ruta + * @param origen + * @param destino + * @return + */ + public Tramo busqueda(Ruta ruta, Parada origen, Parada destino); + + public RutaCombinacion busquedaTramoRutaOrigemDestino(Ruta ruta, Parada origem, Parada destino); + + public RutaCombinacion busquedaTramoRutaOrigemDestino(Integer ruta, Integer origem, Integer destino); + + public List obtenerPorRuta(Ruta ruta); + + public boolean buscarRutaCombinacionExisteTramo(Tramo tramo); + + /** + * Hace una b�squena en los tramos faltantes en la combinacion de la ruta informada + * @param rutaId + * @return + */ + List tramosFaltantes(Integer rutaId); + + public int borrarCombinaciones(Ruta ruta); + + public void activar(Ruta ruta, Tramo trBuscaOrigemDestino); + + public List pesquisaTarifaObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvCategoria, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa, List lsAddRmvOrgaoConcedente); + + public List pesquisaTarifaEmbObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvCategoria, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa, List lsAddRmvOrgaoConcedente); + + public List pesquisaTarifaEscalaObj(String rutaId, String monedaId, String vigenciaId, String marcaId); + + public List pesquisaTarifaGroupObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvCategoria, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa); + + public List pesquisaTarifaOficialEscalaObj(String rutaId, String monedaId, String vigenciaId, String marcaId); + + public List pesquisaTarifaOficialGroupObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvVigenciaTarifa); + + public List pesquisaTarifaOficialObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvVigenciaTarifa); + + /** + * Indica se existe alguma combinação ativa com o tramo informado + * @param tramo + * @return + */ + public boolean existeTramo(Tramo tramo); + + public boolean existeTramo(Tramo tramo, ClaseServicio claseServicio); + + boolean isRutaCombinacionVenda(Integer rutaId, Integer origenId, Integer destinoId); + + public Set rutasCombinacionVenda(List rutas); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java b/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java new file mode 100644 index 000000000..fc27cc587 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.vo.ruta.RutaVO; + +/** + * + * @author Rafius + */ +public interface RutaDAO extends GenericDAO { + + public List buscarPorTramo(Tramo tramo); + + public List buscarPorClaseServicio(ClaseServicio claseServicio); + + public List buscarPorClaseServicioEmpresa(ClaseServicio claseServicio, Empresa empresa); + + public List buscar(String nomeRuta, ClaseServicio claseServicio,Boolean nomeObrigatorio); + + public List obtenerPorEmpresa(Empresa empresa); + + public List buscarTodosExceto(Integer... idRuta); + + public List buscarTodosEstos(Integer[] idRutas); + + public List buscarNumRuta(String numRuta); + + /** + * Regresa la origen de la ruta + * + * @param ruta + * @return + */ + public Parada buscarOrigen(Ruta ruta); + + /** + * Regresa el destino de la ruta + * + * @param ruta + * @return + */ + public Parada buscarDestino(Ruta ruta); + + public List buscaRutaPorNumeroSemDadoRepetido(String palavraPesquisaRuta); + + public List buscaRuta(String palavraPesquisaRuta); + + public List buscaRuta(String palavraPesquisaRuta, OrgaoConcedente orgao); + + public List buscaRutasFromOrgao(OrgaoConcedente orgao); + + public List buscaSomenteRutasFromOrgao(OrgaoConcedente orgao); + + public List buscarPorRutaPorEmpresas(List lsEmpresas); + + public List buscarRutasPorEmpresaOrgaoConcedente(Empresa empresa, OrgaoConcedente orgao); + + public void updateAsientosVendibles(Ruta ruta, Tramo viejoTramo, Tramo nuevoTramo); + + public List buscarRutasVendaEmbarcada(List empresasIds, Integer rutaId, String numeroLinha, String descRuta, ClaseServicio classe); + + public List buscaLikeComboBox(String stringConsulta); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RutaEmbarqueDesembarqueDAO.java b/src/com/rjconsultores/ventaboletos/dao/RutaEmbarqueDesembarqueDAO.java new file mode 100644 index 000000000..7e2d33ac3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RutaEmbarqueDesembarqueDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaEmbarqueDesembarque; + +public interface RutaEmbarqueDesembarqueDAO extends GenericDAO { + + List obtenerPorRuta(Ruta ruta); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RutaEmpresaDAO.java b/src/com/rjconsultores/ventaboletos/dao/RutaEmpresaDAO.java new file mode 100644 index 000000000..d47cd61da --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RutaEmpresaDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; + +/** + * + * @author Administrador + */ +public interface RutaEmpresaDAO extends GenericDAO { + + public List obtenerPorEmpresa(Empresa empresa); + + public List obtenerPorRuta(Ruta ruta); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RutaIcmsExcepcionDAO.java b/src/com/rjconsultores/ventaboletos/dao/RutaIcmsExcepcionDAO.java new file mode 100644 index 000000000..21d5b1f6b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RutaIcmsExcepcionDAO.java @@ -0,0 +1,15 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.RutaIcmsExcepcion; + +/** + * + * @author Administrador + */ +public interface RutaIcmsExcepcionDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RutaSecuenciaDAO.java b/src/com/rjconsultores/ventaboletos/dao/RutaSecuenciaDAO.java new file mode 100644 index 000000000..8d4355870 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/RutaSecuenciaDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; + +/** + * + * @author Rafius + */ +public interface RutaSecuenciaDAO extends GenericDAO { + + public List buscarSecuenciaOrdenado(Ruta ruta); + + public int borrarSecuencias(Ruta ruta); + + /** + * Hace la validación de la origen y destino dentro de la secuencia de la ruta.
+ * + * La parada de origen no puede tener el numero de secuencia mayor o igual a la parada de destino
+ * @param ruta + * @param origen + * @param destino + * @return + */ + public boolean paradaSecuenciaValida(Ruta ruta, Parada origen,Parada destino); + + /** + * Devolver los números de secuencia de ruta en la raza, el origen y el destino. + * + * @param esquemaCorrida + * @param origem + * @param destino + * @return secuencia de pares -> 3, 6 + */ + List obtenerNumRutaSecuenciaPorCorridaOrigemDestino(EsquemaCorrida esquemaCorrida, Parada origem, Parada destino); + + public List obtenerNumRutaSecuenciaPorCorridaOrigemDestinoId(EsquemaCorrida esquemaCorrida, Integer origemId, Integer destinoId); + + /** + * Devolver los números de secuencia ocupada de ruta en la raza, el origen y el destino. + * + * @param esquemaCorrida + * @param asiento + * @return todas las secuencias ocupados ordenadas -> 3, 4, 5, 7 + */ + List obtenerNumRutaSecuenciaOcupadaPorCorridaAsiento(EsquemaCorrida esquemaCorrida, String asiento); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/SapDAO.java b/src/com/rjconsultores/ventaboletos/dao/SapDAO.java new file mode 100644 index 000000000..d9f4c8454 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/SapDAO.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente; +import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO; + +public interface SapDAO extends GenericDAO { + + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar); + + public boolean atualizaFechamento(Long fechamentocntcorrenteId) throws Exception; + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/SecretariaDAO.java b/src/com/rjconsultores/ventaboletos/dao/SecretariaDAO.java new file mode 100644 index 000000000..61ca7a966 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/SecretariaDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface SecretariaDAO extends GenericDAO { + + public List buscar(String descsecretaria, String cvesecretaria); + + public List buscar(String descsecretaria); + + public Secretaria buscarSecretariaVoucherRod(Short formaPagoId); + + public List buscaLike(String descsecretaria); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/SecretariaEmpresaDAO.java b/src/com/rjconsultores/ventaboletos/dao/SecretariaEmpresaDAO.java new file mode 100644 index 000000000..e420bda3c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/SecretariaEmpresaDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import com.rjconsultores.ventaboletos.entidad.SecretariaEmpresa; + +public interface SecretariaEmpresaDAO extends GenericDAO { + + public List buscarPorSecretaria(Secretaria secretaria); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/SegVKMDAO.java b/src/com/rjconsultores/ventaboletos/dao/SegVKMDAO.java new file mode 100644 index 000000000..2d572e349 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/SegVKMDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.math.BigDecimal; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.SegVKM; + +/** + * + * @author RJ + */ +public interface SegVKMDAO extends GenericDAO { + + public List buscar(String segVKm); + + public String seriePorEmpresa(Integer empresaId); + + public BigDecimal buscarSeguroPorKm(Long km, String serie, Integer orgaoConcedenteId); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/SeguradoraEmpresaDAO.java b/src/com/rjconsultores/ventaboletos/dao/SeguradoraEmpresaDAO.java new file mode 100644 index 000000000..64a9b35cd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/SeguradoraEmpresaDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa; + +public interface SeguradoraEmpresaDAO extends GenericDAO { + public boolean existe(Empresa empresa, String serie); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/SeguroKmDAO.java b/src/com/rjconsultores/ventaboletos/dao/SeguroKmDAO.java new file mode 100644 index 000000000..6aa29964b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/SeguroKmDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroKm; +import java.util.List; + +public interface SeguroKmDAO extends GenericDAO { + + /** + * Indica se existe seguroKm para o orgaoConcedenteId informado + * + * @param orgaoConcedenteId + * @return + */ + public boolean existe(Integer orgaoConcedenteId); + + public List buscarPorOrgao(OrgaoConcedente orgao); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/SeguroTarifaDAO.java b/src/com/rjconsultores/ventaboletos/dao/SeguroTarifaDAO.java new file mode 100644 index 000000000..9391f0b5b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/SeguroTarifaDAO.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroTarifa; +import java.util.List; + +public interface SeguroTarifaDAO extends GenericDAO { + + /** + * Indica se existe seguroTarifa para o orgaoConcedenteId informado + * + * @param orgaoConcedenteId + * @return + */ + public boolean existe(Integer orgaoConcedenteId); + + public List buscarPorOrgao(OrgaoConcedente orgao); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/SisdapDAO.java b/src/com/rjconsultores/ventaboletos/dao/SisdapDAO.java new file mode 100644 index 000000000..5e55006c9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/SisdapDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +public interface SisdapDAO { + public List getMovimentoLinhas(Date fecInicio, Date fecFinal, Integer empresaId); + public List getMovimentoSecoes(Date fecInicio, Date fecFinal, Integer empresaId, List pesquisaGratuidade, List pesquisaDescontoIdoso, List pesquisaGratuidadeIdoso, List pesquisaDescontoJovem, List pesquisaGratuidadeJovem); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/SistemaDAO.java b/src/com/rjconsultores/ventaboletos/dao/SistemaDAO.java new file mode 100644 index 000000000..2bc5ce1a7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/SistemaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Sistema; + +/** + * + * @author rodrigo + */ +public interface SistemaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TarifaCategoriaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarifaCategoriaDAO.java new file mode 100644 index 000000000..8db0b1cb9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TarifaCategoriaDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.TarifaCategoria; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface TarifaCategoriaDAO extends GenericDAO { + + public List buscarPorCategoria(Categoria categoria); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TarifaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarifaDAO.java new file mode 100644 index 000000000..a9be378d0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TarifaDAO.java @@ -0,0 +1,82 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.TarifaService; +import com.rjconsultores.ventaboletos.vo.comissao.TarifaVO; + +/** + * + * @author rodrigo + */ +public interface TarifaDAO extends GenericDAO { + + public List pesquisar(Marca marca, Parada origem, Parada destino, Moneda moneda,ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa,Categoria categoria, TipoPuntoVenta tipoPuntoVenta); + + /** + * {@link TarifaService#existe(Marca, Tramo, Moneda, ClaseServicio, VigenciaTarifa, Ruta, OrgaoConcedente)} + * + * @param marca + * @param tramo + * @param moneda + * @param claseServicio + * @param vigenciaTarifa + * @param ruta + * @param orgaoConcedente + * @return + */ + public boolean existe(Marca marca, Tramo tramo, Moneda moneda, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Ruta ruta, OrgaoConcedente orgaoConcedente); + + public Tarifa buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio,VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta); + + /** + * Lista as tarifas que tem a vigencia informada.
+ * + * As tarifas listadas podem estar ativas ou inativas
+ * + * @param vigencia + * @return + */ + public List buscarTarifasAtivasInativasPorVigencia(VigenciaTarifa vigencia,Empresa empresa); + + /** + * Lista as tarifas que tem a vigencia informada.
+ * + * Só é listado as tarifas ativas
+ * + * @param vigenciaTarifa + * @return + */ + public List buscarTarifasAtivasPorVigencia(VigenciaTarifa vigenciaTarifa); + + public boolean buscarTarifaExisteTramo(Tramo tramo) ; + + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException; + + public boolean existeTarifas(VigenciaTarifa vigenciaTarifa); + + public void excluirTodasTarifas(Moneda moneda, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Parada origem, + Parada destino, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via, Boolean vende, Integer usuarioModifId); + + public List obterTarifaOficialPorFiltroVO(Moneda moneda, Marca marca,ListlsMarcas, Parada origem, Parada destino, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa,Categoria categoria,TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via,Boolean vende); + + public void updateTarifa(Tarifa t); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TarifaEmbarcadaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarifaEmbarcadaDAO.java new file mode 100644 index 000000000..f66a2fbf6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TarifaEmbarcadaDAO.java @@ -0,0 +1,30 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.entidad.TarifaEmbarcada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface TarifaEmbarcadaDAO extends GenericDAO { + + public void excluirTodasTarifas(Moneda moneda, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Parada origem, + Parada destino, Ruta ruta, Via via, Boolean vende); + + public void updateTarifa(TarifaEmbarcada t); + + public TarifaEmbarcada buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio,VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta); + + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException; +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/TarifaEmbarcadaHistDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarifaEmbarcadaHistDAO.java new file mode 100644 index 000000000..1a162d60f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TarifaEmbarcadaHistDAO.java @@ -0,0 +1,10 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TarifaEmbarcadaHist; + +public interface TarifaEmbarcadaHistDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TarifaHistDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarifaHistDAO.java new file mode 100644 index 000000000..8849438a5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TarifaHistDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TarifaHist; + +/** + * + * @author rodrigo + */ +public interface TarifaHistDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TarifaKmDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarifaKmDAO.java new file mode 100644 index 000000000..0d86d85e4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TarifaKmDAO.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TarifaKm; + +public interface TarifaKmDAO extends GenericDAO{ + + public List buscarPorOrgaoAndClasse(OrgaoConcedente orgaoconcedenteId, ClaseServicio claseId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TarifaMinimaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarifaMinimaDAO.java new file mode 100644 index 000000000..452a99607 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TarifaMinimaDAO.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.math.BigDecimal; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.TarifaMinima; +import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria; + +/** + * + * @author rodrigo + */ +public interface TarifaMinimaDAO extends GenericDAO { + + public List pesquisarPlaza(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Plaza plaza); + + public List pesquisar(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Moneda moneda); + + public List pesquisar( TarifaMinima tarifaMinima); + + public List buscarPorPlaza(Plaza plaza); + + public List buscarPorPlazaMoneda(Plaza plaza, Moneda moneda); + + public List pesquisar(BigDecimal valor, Moneda moneda, + Plaza plaza, Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio); + + public List pesquisarOrigemDestinoTodos(Marca marca, Parada origem,Parada destino,ClaseServicio claseServicio, Moneda moneda); + + public List buscarPorMarcaMoneda(Marca marca, Moneda moneda); + + public List buscarPorClaseServicioMoneda(ClaseServicio claseServicio, + Moneda moneda); + + public TarifaMinimaCategoria adicionarTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria); + + public void removerTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria); + + public BigDecimal obtenerTarifaMinima(Integer claseServicioId, Integer marcaId, Integer origenConsultaId, Integer destinoConsultaId, Integer plazaId, Integer monedaId, Integer rutaId, Integer categoriaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java new file mode 100644 index 000000000..ef4058074 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java @@ -0,0 +1,101 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.constantes.TipoSeguro; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TarifaOficial; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.service.TarifaOficialService; +import com.rjconsultores.ventaboletos.vo.comissao.TarifaOficialVO; + +public interface TarifaOficialDAO extends GenericDAO { + /** + * See {@link TarifaOficialService#gerarTarifaPorCoeficiente(Integer, Integer)} + * @param ruta + * @param usuarioId TODO + * @param orgaoConcedenteId TODO + * @return TODO + */ + public Integer gerarTarifaPorCoeficiente(Integer ruta, Integer usuarioId, OrgaoConcedente orgaoConcedente, List idsEmpresas); + + public Integer gerarTarifaArtesp(Integer ruta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + public Integer gerarTabelaZerada(Integer ruta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + /** + * See {@link TarifaOficialService#atualizarTarifaPorCoeficiente(Integer, Integer)} + * @param rutaId + * @param usuarioId TODO + * @param orgaoConcedenteId + * @return TODO + */ + public Integer atualizarTarifaCoeficiente(Integer rutaId, Integer usuarioId, OrgaoConcedente orgaoConcedenteId); + + /** + * See {@link TarifaOficialService#copiarParaTarifa(VigenciaTarifa)} + * @param vigenciaTarifa + * @param usuarioId TODO + * @param calculaPegagio Boolean + * @param calculaTarifa Boolean + * @param calculaTaxaEmbarque Boolean + * @param empresa Empresa + * @param orgaoConcedente OrgaoConcedente + */ + public void copiarParaTarifa(VigenciaTarifa vigenciaTarifa, Integer usuarioId, Boolean calculaPegagio, Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP, Boolean calculaEmbarcada, Empresa empresa, OrgaoConcedente orgaoConcedente); + + /** + * See {@link TarifaOficialService#atualizarTaxaEmbarque(Integer, Integer)} + * @param rutaId + * @param usuarioId TODO + * @param orgaoConcedenteId TODO + * @param empresaId TODO + */ + public void atualizarTaxaEmbarque(List lsRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + /** + * See {@link TarifaOficialService#atualizarSeguroPorKm(Integer, Integer, Integer)} + * @param rutaId + * @param orgaoId + * @param usuarioId + */ + public void atualizarSeguroPorKm(Integer rutaId, Integer orgaoId, Integer usuarioId, TipoSeguro tipoSeguro); + + /** + * See {@link TarifaOficialService#atualizarSeguroPorTarifa(Integer, Integer, Integer)} + * @param rutaId + * @param orgaoId + * @param usuarioId + */ + public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId, Integer usuarioId); + + /** + * Aplica a regra de arredondamento para as tarifas do �rg�o concedente informado.
+ * + * + * Ap�s somar todos os componentes (precio,importetaxaembarque,importeseguro,importeoutros e importepedagio) obtem-se o PRECO final.
+ * + * Baseado nesse valor, s�o aplicados as regras de arredondamento onde o componente precio pode sofrer um acr�scimo os descr�scimo de pre�o para que o arredondamento
+ * fique certo + * + * @param orgaoConcedenteId + * @param usuarioId TODO + */ + public void aplicarArredondamentoTarifa(Integer orgaoConcedenteId, Integer usuarioId, Boolean taxaEmbarque); + + public void limparTarifasOficiais(List lsEmpresaSelected); + + public void atualizarPedagio(); + + public void atualizarPrecioPorTPP(Integer rutaId, Integer orgaoId, Integer usuarioId, TipoSeguro tipoSeguro); + + public long obtenerCount(List lsEmpresaSelected); + + public List obterTarifaOficialPorFiltroVO(Moneda moneda, Marca marca,List lsMarcas,Parada origem, Parada destino, ClaseServicio claseServicio, Ruta ruta, String numRuta, Boolean vende); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TarifaTipoptovtaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarifaTipoptovtaDAO.java new file mode 100644 index 000000000..38e282681 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TarifaTipoptovtaDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TarifaTipoptovta; + +/** + * + * @author rodrigo + */ +public interface TarifaTipoptovtaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TarjetaCreditoDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarjetaCreditoDAO.java new file mode 100644 index 000000000..0d816f686 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TarjetaCreditoDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TarjetaCredito; + +public interface TarjetaCreditoDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TarjetaFidelidadDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarjetaFidelidadDAO.java new file mode 100644 index 000000000..22aecc32b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TarjetaFidelidadDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidadCuenta; + +import java.util.List; + +/** + * + * @author Shiro + */ +public interface TarjetaFidelidadDAO extends GenericDAO{ + + public List obtenerCantDesc(); + public TarjetaFidelidad obtenerNumTarjeta(Integer numTarjeta); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TarjetaRecaudacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarjetaRecaudacionDAO.java new file mode 100644 index 000000000..a41efa37f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TarjetaRecaudacionDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacion; +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacionPK; + +/** + * + * @author Administrador + */ +public interface TarjetaRecaudacionDAO extends + GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TarjetaViajeDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarjetaViajeDAO.java new file mode 100644 index 000000000..b2b7852a6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TarjetaViajeDAO.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import org.zkoss.zul.Comboitem; + +import com.rjconsultores.ventaboletos.entidad.TarjetaViaje; + +public interface TarjetaViajeDAO extends GenericDAO { + + public List buscarTarjetaPorFiltros(Integer autoIni, Integer autoFin, Date dataIni, Date dataFin, Comboitem empresa); + + public List buscarTarjetasParaEnvioNomina(Date fecIni, Date fecFin); + + public List buscarTarjetaPorFiltros(TarjetaViaje tarjeta); + + public boolean buscarTarjetaExisteVolta(TarjetaViaje t); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TaxaEmbLevanteCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/TaxaEmbLevanteCtrlDAO.java new file mode 100644 index 000000000..951da4372 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TaxaEmbLevanteCtrlDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TaxaEmbLevanteCtrl; + +public interface TaxaEmbLevanteCtrlDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueKmDAO.java b/src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueKmDAO.java new file mode 100644 index 000000000..ff049efba --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueKmDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueKm; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface TaxaEmbarqueKmDAO extends GenericDAO{ + + public List buscarPorOrgao(OrgaoConcedente orgaoconcedenteId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueParadaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueParadaDAO.java new file mode 100644 index 000000000..5464a57fa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TaxaEmbarqueParadaDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.TaxaEmbarqueW2i; + +import java.sql.SQLException; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface TaxaEmbarqueParadaDAO extends GenericDAO { + + public List buscarPorLocalidade(Parada parada); + + public List buscarEstoqueTaxaEmbarque(Parada origem, Empresa empresa, String txtKm, OrgaoConcedente orgao, Categoria categoria) throws SQLException; +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoCambioCiudadDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoCambioCiudadDAO.java new file mode 100644 index 000000000..b2b06ee59 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoCambioCiudadDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoCambioCiudad; + +/** + * + * @author Administrador + */ +public interface TipoCambioCiudadDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoCambioCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoCambioCtrlDAO.java new file mode 100644 index 000000000..d28a610aa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoCambioCtrlDAO.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoCambioCtrl; + +/** + * + * @author Administrador + */ +public interface TipoCambioCtrlDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoConvenioDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoConvenioDAO.java new file mode 100644 index 000000000..dbc5b2025 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoConvenioDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; + +/** + * + * @author Shiro + */ +public interface TipoConvenioDAO extends GenericDAO{ + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoCorteDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoCorteDAO.java new file mode 100644 index 000000000..b99886b5f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoCorteDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoCorte; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoCorteDAO extends GenericDAO { + + public List buscar(String desctipo); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDAO.java new file mode 100644 index 000000000..914c05d5f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface TipoCortesiaDAO extends GenericDAO { + + public List buscar(String descTipo); + + public List obtenerGrupoCortesia(int i); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDescuentoDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDescuentoDAO.java new file mode 100644 index 000000000..a9338beb1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoCortesiaDescuentoDAO.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import com.rjconsultores.ventaboletos.entidad.TipoCortesiaDescuento; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface TipoCortesiaDescuentoDAO extends + GenericDAO { + + public List pesquisar(TipoCortesia tipoCortesia); + + public List buscar(BigDecimal porcentaje, + TipoCortesia tipoCortesia); + + public List Onchangue(TipoCortesia Tcselec); + + public List obtenerTipoCortesia(int i); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoDocAutobusDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoDocAutobusDAO.java new file mode 100644 index 000000000..7343bf03b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoDocAutobusDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoDocAutobus; + +public interface TipoDocAutobusDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoDomicilioDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoDomicilioDAO.java new file mode 100644 index 000000000..97d7057f1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoDomicilioDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoDomicilio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoDomicilioDAO extends GenericDAO { + + public List buscar(String desctipo, String cvetipodomicilio); + + public List buscarClave(String cvetipodomicilio); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoEmpleadoDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoEmpleadoDAO.java new file mode 100644 index 000000000..9020424c0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoEmpleadoDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoEmpleado; + +/** + * + * @author Shiro + */ +public interface TipoEmpleadoDAO extends GenericDAO{ + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraDAO.java new file mode 100644 index 000000000..d98ff8d4f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; + +public interface TipoEventoExtraDAO extends + GenericDAO { + + public List buscar(String descingreso); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraEmpresaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraEmpresaDAO.java new file mode 100644 index 000000000..605aa2bf3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraEmpresaDAO.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraEmpresa; + +public interface TipoEventoExtraEmpresaDAO extends GenericDAO { + public List buscarPorTipoEventoExtra(TipoEventoExtra tipoeventoextra); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraPtovtaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraPtovtaDAO.java new file mode 100644 index 000000000..2c0d495bc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoEventoExtraPtovtaDAO.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraPtoVta; + +public interface TipoEventoExtraPtovtaDAO extends GenericDAO { +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoIdentificacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoIdentificacionDAO.java new file mode 100644 index 000000000..5fb3d2040 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoIdentificacionDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion; + +public interface TipoIdentificacionDAO extends GenericDAO { + + public List obtenerTodos(); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoInformativoComissaoDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoInformativoComissaoDAO.java new file mode 100644 index 000000000..fb00117d7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoInformativoComissaoDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoInformativoComissao; + +public interface TipoInformativoComissaoDAO extends GenericDAO { + + Boolean existeTipoInformativo(TipoInformativoComissao tipo); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoMovimentacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoMovimentacionDAO.java new file mode 100644 index 000000000..9ee0416fb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoMovimentacionDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +public interface TipoMovimentacionDAO extends GenericDAO { + + public TipoMovimentacion buscarTipoMovimentacio(int tipoMovimentacion); + public List obtenerTiposMovimetacionPuntoVenta(); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoMovimientoDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoMovimientoDAO.java new file mode 100644 index 000000000..cbb5c3927 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoMovimientoDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoMovimiento; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoMovimientoDAO extends GenericDAO { + + public List buscar(String descmovimiento); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoOcupacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoOcupacionDAO.java new file mode 100644 index 000000000..4ad29afe7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoOcupacionDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoOcupacion; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoOcupacionDAO extends GenericDAO { + + public List buscar(String desctipo, String cvetipoocupacion); + + public List buscarClave(String cvetipoocupacion); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoParadaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoParadaDAO.java new file mode 100644 index 000000000..c27b1184c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoParadaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoParada; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoParadaDAO extends GenericDAO { + + public List buscar(String desctipo); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoPuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoPuntoVentaDAO.java new file mode 100644 index 000000000..520771540 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoPuntoVentaDAO.java @@ -0,0 +1,32 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoPuntoVentaDAO { + + public List obtenerTodos(); + + public TipoPuntoVenta obtenerID(Short id); + + public TipoPuntoVenta suscribir(TipoPuntoVenta entidad); + + public TipoPuntoVenta actualizacion(TipoPuntoVenta entidad); + + public void borrar(TipoPuntoVenta entidad); + + public Long count(String campo, Object o); + + public List buscar(String desctipo); + + public List obtenerTodosExceto(Short... id); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoServicioDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoServicioDAO.java new file mode 100644 index 000000000..058c923e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoServicioDAO.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoServicio; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface TipoServicioDAO extends GenericDAO { + + public List buscar(String descservicio); + + public List buscarListaPorIds(List tiposervicioIds); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoTarifaPacoteDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoTarifaPacoteDAO.java new file mode 100644 index 000000000..864b8c249 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoTarifaPacoteDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +public interface TipoTarifaPacoteDAO extends GenericDAO { + + public List buscaTipoTarifaPacote(Pacote pacote); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoVentaDAO.java new file mode 100644 index 000000000..607133f97 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoVentaDAO.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TipoVenta; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface TipoVentaDAO extends GenericDAO{ + + public List buscar(String desctipoventa); + + public TipoVenta obtenerID(Short tipoventaId); + + public List obterTiposVentaIntegracao(); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TramoDAO.java b/src/com/rjconsultores/ventaboletos/dao/TramoDAO.java new file mode 100644 index 000000000..d68639b2a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TramoDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.OrgaoTramo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.vo.tramo.TramoVO; + +/** + * + * @author Administrador + */ +public interface TramoDAO extends GenericDAO { + + public Tramo obtenerPorOrigemDestino(Parada origem, Parada destino); + + public List obtenerListPorOrigemDestino(Parada origem, Parada destino); + + public Tramo obtenerTramotPorOrigemDestinoVia(Parada origem, Parada destino, Via via); + + public Tramo busca(Parada origem, Parada destino, Via via); + + public List getLsOrgaoTramo(Tramo tramo); + + + /** + * Hace la búsqueda del tramo que tiene origen - destino - via - clase servicio. + * + * @param origem + * @param destino + * @param via + * @param claseServicio + * @return + */ + public Tramo obtenerTramoUnicoRuta(Parada origem, Parada destino, Via via, ClaseServicio claseServicio); + + public List buscarCveParada(String origen, String destino, String via); + + public Long count(Via via); + public List obtenerViasOrigemDestino(Parada origem, Parada destino); + public List obtenerPorOrigemDestinoFetchLazy(Parada origem, Parada destino) ; + public List obtenerTramosServiciosPorTramo(Tramo t); + + public List buscarListaPorIds(List tramoIds); + + public List buscarListaPorIds(List tramoIds, String chaveCorrida, boolean tarifaEmbarcada) throws Exception; + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TramoKmServicioDAO.java b/src/com/rjconsultores/ventaboletos/dao/TramoKmServicioDAO.java new file mode 100644 index 000000000..55f2f1b69 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TramoKmServicioDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.TramoKmServicio; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface TramoKmServicioDAO extends GenericDAO { + + public List buscar(TramoKmServicio tramoKmServicio); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TramoServicioDAO.java b/src/com/rjconsultores/ventaboletos/dao/TramoServicioDAO.java new file mode 100644 index 000000000..b0abee51b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TramoServicioDAO.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.Via; + +/** + * + * @author Rafius + */ +public interface TramoServicioDAO extends GenericDAO { + + public List buscarPorTramo(Tramo tramo); + + public List buscarPorTramo(Tramo tramo, ClaseServicio clase); + + /** + * Hace la búsqueda del tramo tiempo activo de acuerdo los parametros. + * + * El filtrado tambien se el tramo asociado es activo + * + * @param origen + * @param destino + * @param via + * @param clase + * @return + */ + public TramoServicio buscar(Parada origen,Parada destino,Via via,ClaseServicio clase); + + /** + * Indica si existen tiempos para los trechos del esquemaCorrida. O sea, debe de haber para cada tramo del esquema un tramoServicio válido + * + * @param esquemaCorridaId + * @return + */ + public boolean existenTiemposTramosEsquema(Integer esquemaCorridaId); + + /* + * Rotina que corrige inconsistencias nos tramos + */ + public void limparInconsistenciasTramo(); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TramoTiempoDAO.java b/src/com/rjconsultores/ventaboletos/dao/TramoTiempoDAO.java new file mode 100644 index 000000000..5ff47c45e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TramoTiempoDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoTiempo; + +/** + * + * @author Administrador + */ +public interface TramoTiempoDAO extends GenericDAO { + + public List buscarPorTramo(Tramo tramo); + + public List buscarPorTramo(Tramo tramo, ClaseServicio clase); + + /** + * Hace una búsqueda por los tramoTiempo activos, con la clase informado y + * donde traslapa feIni y fecFin con horainicio y horafin. + * + * @param tramo + * @param clase + * @param fecIni + * - Es la hora de inicio + * @param fecFin + * - Es la hora de fin + * @return + */ + public List buscar(Tramo tramo, ClaseServicio clase, Date fecIni, Date fecFin); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TurnoDAO.java b/src/com/rjconsultores/ventaboletos/dao/TurnoDAO.java new file mode 100644 index 000000000..bce02d5be --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TurnoDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Turno; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TurnoDAO extends GenericDAO { + + public List buscar(String descturno); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/UsuarioBancarioDAO.java b/src/com/rjconsultores/ventaboletos/dao/UsuarioBancarioDAO.java new file mode 100644 index 000000000..389ca14b4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/UsuarioBancarioDAO.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.UsuarioBancario; + +/** + * + * @author Rafius + */ +public interface UsuarioBancarioDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/UsuarioDAO.java b/src/com/rjconsultores/ventaboletos/dao/UsuarioDAO.java new file mode 100644 index 000000000..f9edd996c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/UsuarioDAO.java @@ -0,0 +1,44 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.vo.caja.UsuarioActivoVO; +import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO; + +/** + * + * @author rodrigo + */ +public interface UsuarioDAO extends GenericDAO { + + public List buscarPeloNome(String nome); + + public Usuario buscarPeloNomeSenha(String stUsuario, String senha); + + public List buscarPorEmpleado(Empleado empleado); + + public List buscarPelaCveUsuario(String cveUsuario); + + public List buscarUsuariosActivo(); + + public List buscarPeloNomeLike(String nome); + + public Usuario buscarPeloId(Integer usuarioId); + + public List buscarPorFuncionSistema(Long funcionSistemaId); + + public List buscarUsuarioPorPontoVenda(Long puntoVentaId); + + public List buscarUsuarioPorDispositivo(Long dispositivoId); + + public List buscarUsuarioEmbarcadaPorUsuariosIds(List usuariosIdList); + + public List buscaUsuariosDoPuntoVenta(Long puntoventaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/UsuarioEmpresaDAO.java b/src/com/rjconsultores/ventaboletos/dao/UsuarioEmpresaDAO.java new file mode 100644 index 000000000..7bd3d7816 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/UsuarioEmpresaDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa; + +public interface UsuarioEmpresaDAO extends GenericDAO { + + public List obtenerPorUsuario(Usuario usuario); + public List obtenerEmpresa(Usuario usuario) ; + public Boolean obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/UsuarioPerfilDAO.java b/src/com/rjconsultores/ventaboletos/dao/UsuarioPerfilDAO.java new file mode 100644 index 000000000..9778fd053 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/UsuarioPerfilDAO.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface UsuarioPerfilDAO extends GenericDAO { + + public List obtenerPorUsuario(Usuario usuario); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/UsuarioSesionDAO.java b/src/com/rjconsultores/ventaboletos/dao/UsuarioSesionDAO.java new file mode 100644 index 000000000..8dfe62963 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/UsuarioSesionDAO.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioSesion; + +/** + * + * @author RJ Consultores + */ +public interface UsuarioSesionDAO extends GenericDAO { + + public List buscar(Usuario usuario); + + void liberarUsuario(Usuario usuario); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/UsuarioUbicacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/UsuarioUbicacionDAO.java new file mode 100644 index 000000000..69d259a1d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/UsuarioUbicacionDAO.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion; + +/** + * + * @author rodrigo + */ +public interface UsuarioUbicacionDAO extends GenericDAO { + + public List buscarPorUsuario(Usuario usuario); + public List buscarPuntoVentaPorUsuario(Usuario usuario); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/VendaPacoteDAO.java b/src/com/rjconsultores/ventaboletos/dao/VendaPacoteDAO.java new file mode 100644 index 000000000..498e14285 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/VendaPacoteDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.VendaPacote; + +public interface VendaPacoteDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ViaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ViaDAO.java new file mode 100644 index 000000000..467eda04f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ViaDAO.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Via; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ViaDAO extends GenericDAO { + + public List buscar(String nombvia); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/VigenciaTarifaDAO.java b/src/com/rjconsultores/ventaboletos/dao/VigenciaTarifaDAO.java new file mode 100644 index 000000000..ec697ea5e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/VigenciaTarifaDAO.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import java.util.Date; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface VigenciaTarifaDAO extends GenericDAO { + + public List pesquisar(Date inicio, Date fim); + + + + /** + * Regresa las vigencia que traslapa + * @param vigenciaTarifa + * @return + */ + public List buscarVigenciasIntervalo(VigenciaTarifa vigenciaTarifa); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoBoletoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoBoletoHibernateDAO.java new file mode 100644 index 000000000..32e1b7729 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoBoletoHibernateDAO.java @@ -0,0 +1,30 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AbastoBoletoDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +@Repository("abastoBoletoDAO") +public class AbastoBoletoHibernateDAO extends GenericHibernateDAO + implements AbastoBoletoDAO { + + @Autowired + public AbastoBoletoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscaAbastoBoletoPorPuntoVenta(PuntoVenta puntoVenta) { + + List abastos = findByCriteria(Restrictions.eq("puntoventa", puntoVenta), Restrictions.eq("activo", Boolean.TRUE)); + return abastos; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoCentralHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoCentralHibernateDAO.java new file mode 100644 index 000000000..4419734b3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoCentralHibernateDAO.java @@ -0,0 +1,216 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Property; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.ControleEstoqueMigracao; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +@Repository("abastoCentralDAO") +public class AbastoCentralHibernateDAO extends GenericHibernateDAO implements AbastoCentralDAO { + + @Autowired + public AbastoCentralHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + + public List obtenerBilhetes(Aidf aidf, PuntoVenta origem) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("aidf", aidf)); + c.add(Restrictions.eq("puntoventa", origem)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + + public List obtenerBilhetes(Aidf aidf, String formInicial, String formFinal, PuntoVenta origem) { + + String queryStr = "from AbastoCentral act where act.aidf = :aidf and act.puntoventa = :puntoventa and act.activo = true and act.numfoliopreimpreso between :folioinicial and :foliofinal"; + + Query query = getSession().createQuery(queryStr); + + query.setLong("aidf", aidf.getAidfId()); + query.setInteger("puntoventa", origem.getPuntoventaId()); + query.setLong("folioinicial", Long.valueOf(formInicial)); + query.setLong("foliofinal", Long.valueOf(formFinal)); + + return (List)query.list(); + } + + @Transactional + public void actualizaBilhetes(List bilhetes, PuntoVenta destino) { + + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for(AbastoCentral bilhete : bilhetes){ + bilhete.setPuntoventa(destino); + session.update(bilhete); + + if(++count % 20 == 0){ + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + } + + @Transactional(readOnly=true) + public void suscribirBilhetes(List bilhetes) { + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for(AbastoCentral bilhete : bilhetes){ + + session.save(bilhete); + + if(++count % 50 == 0){ + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + } + + public List buscaBilhetesPorAidf(Aidf aidf) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("aidf", aidf)); + + return (List)c.list(); + } + + public List obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("puntoventa", puntoVentaBilhetes)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + public List obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes) { + + String queryStr = "from AbastoCentral act where act.puntoventa = :puntoventa and act.activo = true and act.numfoliopreimpreso between :folioinicial and :foliofinal"; + + Query query = getSession().createQuery(queryStr); + + query.setInteger("puntoventa", puntoVentaBilhetes.getPuntoventaId()); + query.setLong("folioinicial", Long.valueOf(formInicial)); + query.setLong("foliofinal", Long.valueOf(formFinal)); + + return (List)query.list(); + } + + public List obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes, Estacion origem) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("puntoventa", puntoVentaBilhetes)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("estacion", origem)); + c.addOrder(Order.asc("numfoliopreimpreso")); + + return (List)c.list(); + } + + public List obtenerBilhetesPorPuntoVenta(String numSerie, String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes, Estacion origem) { + + String queryStr = "from AbastoCentral act where act.puntoventa = :puntoventa and act.numseriepreimpresa = :numseriepreimpresa and act.activo = true and act.numfoliopreimpreso between :folioinicial and :foliofinal"; + + if(origem != null) + queryStr += " and act.estacion = :estacion"; + + Query query = getSession().createQuery(queryStr); + + query.setInteger("puntoventa", puntoVentaBilhetes.getPuntoventaId()); + query.setString("numseriepreimpresa", numSerie); + query.setLong("folioinicial", Long.valueOf(formInicial)); + query.setLong("foliofinal", Long.valueOf(formFinal)); + + if(origem != null) + query.setInteger("estacion", origem.getEstacionId()); + + return (List)query.list(); + } + + @Transactional + public void actualizaBilhetes(List bilhetes, Estacion destino) { + + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for(AbastoCentral bilhete : bilhetes){ + bilhete.setEstacion(destino); + session.update(bilhete); + + if(++count % 20 == 0){ + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + } + + @Override + public void gravaControleEstoqueMigracao(PuntoVenta puntoVenta, Date fecmodif, Integer usuarioId) { + Session session = getSessionFactory().getCurrentSession(); + ControleEstoqueMigracao ctrlMigracao = new ControleEstoqueMigracao(puntoVenta, fecmodif, usuarioId); + session.save(ctrlMigracao); + session.flush(); + session.clear(); + } + + @Override + public List buscarSeriesBilhetesPorEstacion(Estacion estacion) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.setProjection(Projections.distinct(Property.forName("numseriepreimpresa"))); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("estacion", estacion)); + c.addOrder(Order.asc("numseriepreimpresa")); + + return (List)c.list(); + } + + @Override + public void borrarLosQueTienenAIDF(Aidf aidf){ + String hql = " delete from AbastoCentral where aidf.aidfId = " + aidf.getAidfId(); + Query sq = getSession().createQuery(hql); + sq.executeUpdate(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoHistoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoHistoHibernateDAO.java new file mode 100644 index 000000000..14b276622 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoHistoHibernateDAO.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AbastoHistoDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Repository("abastoHistoDAO") +public class AbastoHistoHibernateDAO extends GenericHibernateDAO implements AbastoHistoDAO { + + @Autowired + public AbastoHistoHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + @Override + public void borrarLosQueTienenAIDF(Aidf aidf){ + String hql = " delete from AbastoHisto where aidf.aidfId = " + aidf.getAidfId(); + Query sq = getSession().createQuery(hql); + sq.executeUpdate(); + } + + public void grabaHistoricoBilhetes(List bilhetes, TipoMovimentacion tipoMovimentacion) { + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for(AbastoCentral bilhete : bilhetes){ + + Date dataActual = Calendar.getInstance().getTime(); + AbastoHisto nuevoHistorico = new AbastoHisto(bilhete, tipoMovimentacion, dataActual, true, dataActual, UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + session.save(nuevoHistorico); + + if(++count % 20 == 0){ + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AgruparParadaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AgruparParadaHibernateDAO.java new file mode 100644 index 000000000..699063098 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AgruparParadaHibernateDAO.java @@ -0,0 +1,48 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AgruparParadaDAO; +import com.rjconsultores.ventaboletos.entidad.AgrupamentoParada; + +@Repository("agruparParadaDAO") +public class AgruparParadaHibernateDAO extends GenericHibernateDAO implements AgruparParadaDAO { + + @Autowired + public AgruparParadaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descAgrupamentoParada")); + return c.list(); + } + + @Override + public List buscar(String descparada) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descAgrupamentoParada", descparada)); + return c.list(); + } + + @Override + public List buscarCVE(String cveAgrupamentoParada) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("cveAgrupamentoParada", cveAgrupamentoParada)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfEspecieHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfEspecieHibernateDAO.java new file mode 100644 index 000000000..8de4d5eb0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfEspecieHibernateDAO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AidfEspecieDAO; +import com.rjconsultores.ventaboletos.entidad.AidfEspecie; + +@Repository("aidfEspecieDAO") +public class AidfEspecieHibernateDAO extends GenericHibernateDAO implements AidfEspecieDAO{ + + @Autowired + public AidfEspecieHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java new file mode 100644 index 000000000..07a80fbe4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java @@ -0,0 +1,223 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AidfDAO; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.vo.aidf.AidfVo; + +@Repository("aidfDAO") +public class AidfHibernateDAO extends GenericHibernateDAO implements AidfDAO { + + private static Logger log = Logger.getLogger(AidfHibernateDAO.class); + + @Autowired + public AidfHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List) c.list(); + } + + @Override + public List obtenerAidfFromSerieDocfiscal(String serie, String docfiscal, Connection conn) { + + PreparedStatement pstmt = null; + ResultSet rs = null; + + StringBuilder sb = new StringBuilder(); + sb.append(" select x.AIDF_ID, "); + sb.append(" x.ESTADO_ID, "); + sb.append(" REGEXP_REPLACE( x.docfiscal ,'[^[:alnum:]'' '']', NULL) , "); + sb.append(" x.ACFISCAL, "); + sb.append(" x.SERIE, "); + sb.append(" x.FORMINICIAL, "); + sb.append(" x.FORMFINAL, "); + sb.append(" x.FECADQUISICION, "); + sb.append(" x.FECVENCIMIENTO, "); + sb.append(" x.INSCESTADUAL, "); + sb.append(" x.EMPRESA_ID, "); + sb.append(" x.AIDFESP_ID, "); + sb.append(" x.AIDFTIPO_ID, "); + sb.append(" x.ACTIVO, "); + sb.append(" x.FECMODIF, "); + sb.append(" x.USUARIO_ID, "); + sb.append(" x.SUBSERIE, "); + sb.append(" x.CNPJ, "); + sb.append(" x.TIPOVALIDAVENTA "); + sb.append(" from AIDF x where x.SERIE like '" + serie + "' "); + sb.append(" and REGEXP_REPLACE( x.docfiscal ,'[^[:alnum:]'' '']', NULL) like '" + docfiscal + "' "); + sb.append(" and x.activo = 1 "); + + List ls = new ArrayList(); + + try { + pstmt = conn.prepareStatement(sb.toString()); + + rs = pstmt.executeQuery(); + while (rs.next()) { + AidfVo a = new AidfVo(); + a.setAidfId(rs.getLong(1)); + a.setDocfiscal(rs.getString(3)); + a.setSerie(rs.getString(5)); + a.setForminicial(rs.getString(6)); + a.setFormfinal(rs.getString(7)); + ls.add(a); + } + } catch (Exception e) { + log.error("", e); + } finally { + try { + rs.close(); + } catch (Exception ignore) { + log.error("", ignore); + } + try { + pstmt.close(); + } catch (Exception ignore) { + log.error("", ignore); + } + try { + conn.close(); + } catch (Exception ignore) { + log.error("", ignore); + } + + } + return ls; + }; + + @Override + public List buscaAidfsPorEmpresas(List empresas) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.in("empresa", empresas)); + + return (List) c.list(); + } + + public Boolean existeAidfComCodFiscalEEstado(Long idAidf, Integer especieId, String docFiscal, Estado estado) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("estado", estado)); + c.add(Restrictions.eq("docfiscal", docFiscal)); + + if (idAidf != null) { + c.add(Restrictions.ne("aidfId", idAidf)); + } + + if (especieId != null) { + c.add(Restrictions.eq("aidfEspecie.aidfespId", especieId)); + } + + return c.list().isEmpty(); + } + + @Override + public List buscaAidfEstadoEmpresa(Integer empresaId, Integer estadoId, Boolean isRMD) { + + StringBuilder sb = new StringBuilder(); + sb.append(" from Aidf "); + sb.append(" where activo = :activo "); + sb.append(" and estado.estadoId = :estadoId "); + sb.append(" and empresa.empresaId = :empresaId "); + if(isRMD){ + sb.append(" and aidfEspecie.decespecie = 'RMD' "); + } + + Query query = getSession().createQuery(sb.toString()); + + query.setBoolean("activo", Boolean.TRUE); + query.setInteger("estadoId", estadoId); + query.setInteger("empresaId", empresaId); + + return (List) query.list(); + } + + public String buscaUltimoAidfRMDUtilizado(Long idAidf, Integer empresaId, Integer estadoId) { + StringBuilder sb = new StringBuilder(); + sb.append(" select max(to_number(folio)) as ultimo "); + sb.append(" from folio_consumo_rmd "); + sb.append(" where activo = 1 "); + sb.append(" and (indimpresso = 1 or indcancelacion = 1) "); + sb.append(" and rmd_id = :rmdId "); + sb.append(" and empresa_id = :empresaId "); + sb.append(" and estado_id = :estadoId "); + + Query query = getSession().createSQLQuery(sb.toString()); + query.setLong("rmdId", idAidf); + query.setInteger("empresaId", empresaId); + query.setInteger("estadoId", estadoId); + + Object resp = query.uniqueResult(); + + Integer aux = resp == null ? null : Integer.parseInt(resp.toString()); + if (aux != null) + aux++; + return aux == null ? null : aux.toString(); + } + + @Override + public boolean vaidaRMDUtilizado(Long idAidf, Integer empresaId, Integer estadoId, String folio) { + StringBuilder sb = new StringBuilder(); + sb.append(" select max(to_number(folio)) as ultimo "); + sb.append(" from folio_consumo_rmd "); + sb.append(" where activo = 1 "); + sb.append(" and (indimpresso = 1 or indcancelacion = 1) "); + sb.append(" and rmd_id = :rmdId "); + sb.append(" and empresa_id = :empresaId "); + sb.append(" and estado_id = :estadoId "); + sb.append(" and folio = :folio "); + + Query query = getSession().createSQLQuery(sb.toString()); + query.setLong("rmdId", idAidf); + query.setInteger("empresaId", empresaId); + query.setInteger("estadoId", estadoId); + query.setString("folio", folio); + + Object resp = query.uniqueResult(); + return resp == null ? true : false; + } + + @Override + public Boolean validarDocFiscalPorEstadoAgencia(Long idAidf, Integer especieId, String docFiscal, String formInicial, String formFinal, Estado estado, PuntoVenta puntoVenta) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("estado", estado)); + c.add(Restrictions.eq("puntoVenta", puntoVenta)); + c.add(Restrictions.eq("docfiscal", docFiscal)); + c.add(Restrictions.eq("forminicial", formInicial)); + c.add(Restrictions.eq("formfinal", formFinal)); + + if (idAidf != null) { + c.add(Restrictions.ne("aidfId", idAidf)); + } + + if (especieId != null) { + c.add(Restrictions.eq("aidfEspecie.aidfespId", especieId)); + } + return c.list().isEmpty(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfTipoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfTipoHibernateDAO.java new file mode 100644 index 000000000..3b429fe08 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfTipoHibernateDAO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AidfTipoDAO; +import com.rjconsultores.ventaboletos.entidad.AidfTipo; + +@Repository("aidfTipoDAO") +public class AidfTipoHibernateDAO extends GenericHibernateDAO implements AidfTipoDAO { + + @Autowired + public AidfTipoHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AjusteEventoExtraHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AjusteEventoExtraHibernateDAO.java new file mode 100644 index 000000000..2238397dc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AjusteEventoExtraHibernateDAO.java @@ -0,0 +1,34 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AjusteEventoExtraDAO; +import com.rjconsultores.ventaboletos.entidad.AjusteEventoExtra; + +@Repository("ajusteEventoExtraDAO") +public class AjusteEventoExtraHibernateDAO extends + GenericHibernateDAO implements + AjusteEventoExtraDAO { + + @Autowired + public AjusteEventoExtraHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AlertaCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AlertaCtrlHibernateDAO.java new file mode 100644 index 000000000..6cc0a4c9f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AlertaCtrlHibernateDAO.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.AlertaCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.AlertaCtrl; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.math.BigDecimal; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("alertaCtrlDAO") +public class AlertaCtrlHibernateDAO extends GenericHibernateDAO + implements AlertaCtrlDAO { + + @Autowired + public AlertaCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(Parada origem, Parada destino, Ruta ruta, + ClaseServicio claseServicio, Integer tiempoAlta, + Integer tiempoBaja, BigDecimal percAlta, BigDecimal percBaja) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + + return c.list(); + } + + public List buscarCorrida(Corrida corrida) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("corrida", corrida)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AliasServicoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AliasServicoHibernateDAO.java new file mode 100644 index 000000000..998dc934a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AliasServicoHibernateDAO.java @@ -0,0 +1,142 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AliasServicoDAO; +import com.rjconsultores.ventaboletos.entidad.AliasServico; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +@Repository("aliasServicoDAO") +@SuppressWarnings("unchecked") +public class AliasServicoHibernateDAO extends GenericHibernateDAO + implements AliasServicoDAO { + + @Autowired + public AliasServicoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarAliasSemCorrida(Integer origenId, Integer destinoId, Integer rutaId) { + + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("origen.paradaId",origenId)); + c.add(Restrictions.eq("destino.paradaId",destinoId)); + c.add(Restrictions.eq("ruta.rutaId",rutaId)); + c.add(Restrictions.isNull("corridaId")); + + return c.list(); + } + + @Override + public List buscar(Integer origenId, Integer destinoId, Integer rutaId, Integer corridaId) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("origen.paradaId",origenId)); + c.add(Restrictions.eq("destino.paradaId",destinoId)); + c.add(Restrictions.eq("ruta.rutaId",rutaId)); + c.add(Restrictions.eq("corridaId",corridaId)); + + return c.list(); + } + + @Override + public List buscarPorRuta(Integer rutaId) { + + StringBuilder hql = new StringBuilder(); + hql.append("SELECT DISTINCT alias "); + hql.append("FROM AliasServico alias "); + hql.append(" WHERE alias.activo = 1 "); + hql.append(" AND alias.ruta.rutaId = :rutaId" ); + + Query query = getSession().createQuery(hql.toString()); + query.setInteger("rutaId", rutaId); + + return query.list(); + } + + @Override + public List buscarPorLinhaEmpresa(List linhas, List empresas, List tiposClasses, List orgaos, String prefixo) { + + StringBuilder hql = new StringBuilder(); + hql.append("SELECT DISTINCT alias "); + hql.append("FROM AliasServico alias "); + hql.append("INNER JOIN alias.ruta.lsRutaEmpresa as re "); + hql.append(" WHERE alias.activo = 1 "); + + if (!linhas.isEmpty()) { + hql.append(" AND alias.ruta.rutaId IN ("); + for (Ruta r : linhas) { + hql.append(r.getRutaId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if (!empresas.isEmpty()) { + hql.append(" AND re.empresa.empresaId IN ("); + for (Empresa e : empresas) { + hql.append(e.getEmpresaId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if(!tiposClasses.isEmpty()){ + hql.append(" AND alias.ruta.claseServicio.claseservicioId IN ("); + for (ClaseServicio c : tiposClasses) { + hql.append(c.getClaseservicioId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if(!orgaos.isEmpty()){ + hql.append(" AND alias.ruta.orgaoConcedente.orgaoConcedenteId IN ("); + for (OrgaoConcedente o : orgaos) { + hql.append(o.getOrgaoConcedenteId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if(prefixo != null && !prefixo.isEmpty()){ + hql.append(" AND alias.ruta.prefixo = '" + prefixo +"'" ); + } + + Query query = getSession().createQuery(hql.toString()); + + return query.list(); + } + + @Override + public AliasServico existe(Parada origem, Parada destino, Ruta linha, Integer idCorrida) { + Criteria c = makeCriteria(); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("origen.paradaId", origem.getParadaId())); + c.add(Restrictions.eq("destino.paradaId", destino.getParadaId())); + c.add(Restrictions.eq("ruta.rutaId", linha.getRutaId())); + if (idCorrida != null) { + c.add(Restrictions.eq("corridaId", idCorrida)); + } else { + c.add(Restrictions.isNull("corridaId")); + } + return (AliasServico) c.uniqueResult(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AliquotaEstadoDestinoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AliquotaEstadoDestinoHibernateDAO.java new file mode 100644 index 000000000..feaf1777b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AliquotaEstadoDestinoHibernateDAO.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +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.AliquotaEstadoDestinoDAO; +import com.rjconsultores.ventaboletos.entidad.AliquotaEstadoDestino; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; + +@Repository("aliquotaEstadoDestinoDAO") +public class AliquotaEstadoDestinoHibernateDAO extends GenericHibernateDAO +implements AliquotaEstadoDestinoDAO{ + + @Autowired + public AliquotaEstadoDestinoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List getChildrens(EmpresaImposto parent){ + + StringBuilder sb = new StringBuilder(); + + sb.append(" select als from AliquotaEstadoDestino als "); + sb.append(" where als.activo = 1 "); + sb.append(" and als.empresaImposto.empresaImpostoId =:empresaImpostoId "); + sb.append(" order by als.aliquotaEstadoDestinoId "); + + Query query = getSession().createQuery(sb.toString()); + query.setParameter("empresaImpostoId", parent.getEmpresaImpostoId()); + + List lsAliquotaEstadoDestino = query.list(); + + return lsAliquotaEstadoDestino; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ArticuloHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ArticuloHibernateDAO.java new file mode 100644 index 000000000..3503b3210 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ArticuloHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ArticuloDAO; +import com.rjconsultores.ventaboletos.entidad.Articulo; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("articuloDAO") +public class ArticuloHibernateDAO extends GenericHibernateDAO + implements ArticuloDAO { + + @Autowired + public ArticuloHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String descarticulo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descarticulo", descarticulo)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AsientoExclusivoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AsientoExclusivoHibernateDAO.java new file mode 100644 index 000000000..e62e7b0d7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AsientoExclusivoHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.AsientoExclusivoDAO; +import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("asientoExclusivoDAO") +public class AsientoExclusivoHibernateDAO extends GenericHibernateDAO + implements AsientoExclusivoDAO { + + @Autowired + public AsientoExclusivoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AuditLogHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AuditLogHibernateDAO.java new file mode 100644 index 000000000..8740f05cb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AuditLogHibernateDAO.java @@ -0,0 +1,84 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AuditLogDAO; +import com.rjconsultores.ventaboletos.entidad.AuditLog; +import com.rjconsultores.ventaboletos.entidad.AuditModule; +import com.rjconsultores.ventaboletos.entidad.AuditService; + +@Repository("auditLogDAO") +public class AuditLogHibernateDAO extends GenericHibernateDAO + implements AuditLogDAO { + + @Autowired + public AuditLogHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List carregarLog(AuditModule modulo) { + + List services = recuperarServices(modulo); + + List ids = new ArrayList(); + + for (AuditService service : services) { + ids.add(service.getAuditServiceId()); + } + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.in("service.auditServiceId", ids)); + + return c.list(); + } + + private List recuperarServices(AuditModule module) { + Criteria c = getSession().createCriteria(AuditService.class); + c.add(Restrictions.eq("module", module)); + + return c.list(); + } + + @Override + public List filtrarLog(AuditLog log) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + if (log.getSistema() != null) { + c.add(Restrictions.eq("sistema", log.getSistema())); + } + + if (log.getAction() != null) { + c.add(Restrictions.eq("action", log.getAction())); + } + + if (log.getEntityDetail() != null) { + c.add(Restrictions.like("entityDetail", log.getEntityDetail(), MatchMode.ANYWHERE)); + } + + if (log.getUsuario() != null) { + c.add(Restrictions.eq("usuario", log.getUsuario())); + } + + if (log.getService() != null && log.getService().getModule() != null) { + c.add(Restrictions.eq("service.module", log.getService().getModule())); + } + + if (log.getDataInicio() != null && log.getDataFim() != null) { + c.add(Restrictions.between("createdDate", log.getDataInicio(), log.getDataFim())); + } + + return c.list(); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AuditModuleHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AuditModuleHibernateDAO.java new file mode 100644 index 000000000..3b01faf96 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AuditModuleHibernateDAO.java @@ -0,0 +1,28 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +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.AuditModuleDAO; +import com.rjconsultores.ventaboletos.entidad.AuditModule; + +@Repository("auditModuleDAO") +public class AuditModuleHibernateDAO extends GenericHibernateDAO + implements AuditModuleDAO { + + @Autowired + public AuditModuleHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + return c.list(); + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AuditServiceHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AuditServiceHibernateDAO.java new file mode 100644 index 000000000..0ab9b3a4a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AuditServiceHibernateDAO.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AuditServiceDAO; +import com.rjconsultores.ventaboletos.entidad.AuditService; + +@Repository("auditServiceDAO") +public class AuditServiceHibernateDAO extends GenericHibernateDAO + implements AuditServiceDAO { + + @Autowired + public AuditServiceHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public AuditService carregarService(AuditService auditService) { + AuditService service = null; + + Criteria criteriaService = getSession().createCriteria(AuditService.class); + + if (auditService.getFuncionSistema() != null && auditService.getFuncionSistema().getDescruta() != null) { + criteriaService.add(Restrictions.eq("funcionSistema", auditService.getFuncionSistema().getDescruta())); + service = (AuditService) criteriaService.uniqueResult(); + } + + return service; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusDocHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusDocHibernateDAO.java new file mode 100644 index 000000000..f5caaf4e5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusDocHibernateDAO.java @@ -0,0 +1,43 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AutobusDocDAO; +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.AutobusDoc; + +@Repository("autobusDocDAO") +public class AutobusDocHibernateDAO extends GenericHibernateDAO +implements AutobusDocDAO { + + @Autowired + public AutobusDocHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List obtenerPorAutobus(Autobus autobus) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("autobus", autobus)); + + return c.list(); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusHibernateDAO.java new file mode 100644 index 000000000..5127bd095 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AutobusHibernateDAO.java @@ -0,0 +1,49 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.AutobusDAO; +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("autobusDAO") +public class AutobusHibernateDAO extends GenericHibernateDAO + implements AutobusDAO { + + @Autowired + public AutobusHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("numautobus")); + + return c.list(); + } + + public List buscar(String numautobus, DiagramaAutobus diagramaAutobus) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numautobus", numautobus)); + c.add(Restrictions.eq("diagramaAutobus", diagramaAutobus)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionHibernateDAO.java new file mode 100644 index 000000000..98dd66b85 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionHibernateDAO.java @@ -0,0 +1,49 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AutorizacionDAO; +import com.rjconsultores.ventaboletos.entidad.Autorizacion; + +/** + * + * @author Administrador + */ +@Repository("autorizacionDAO") +public class AutorizacionHibernateDAO extends GenericHibernateDAO + implements AutorizacionDAO { + + @Autowired + public AutorizacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombautorizacion")); + + return c.list(); + } + + public List buscar(String nombautorizacion, String descautorizacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("nombautorizacion", nombautorizacion)); + c.add(Restrictions.eq("descautorizacion", descautorizacion)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionPerfilHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionPerfilHibernateDAO.java new file mode 100644 index 000000000..3ff50cfdd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AutorizacionPerfilHibernateDAO.java @@ -0,0 +1,40 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.AutorizacionPerfilDAO; +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import com.rjconsultores.ventaboletos.entidad.AutorizacionPerfil; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("autorizacionPerfilDAO") +public class AutorizacionPerfilHibernateDAO extends GenericHibernateDAO + implements AutorizacionPerfilDAO { + + @Autowired + public AutorizacionPerfilHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Autorizacion autorizacion, Perfil perfil) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("autorizacion", autorizacion)); + c.add(Restrictions.eq("perfil", perfil)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/BancoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/BancoHibernateDAO.java new file mode 100644 index 000000000..9ee11427c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/BancoHibernateDAO.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.BancoDAO; +import com.rjconsultores.ventaboletos.entidad.Banco; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("bancoDAO") +public class BancoHibernateDAO extends GenericHibernateDAO + implements BancoDAO { + + @Autowired + public BancoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscar(Banco banco) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("puntoVenta", banco.getPuntoVenta())); + c.add(Restrictions.eq("empresa", banco.getEmpresa())); + c.add(Restrictions.eq("moneda", banco.getMoneda())); + c.add(Restrictions.eq("nombbanco", banco.getNombbanco().trim())); + c.add(Restrictions.eq("refcontrato", banco.getRefcontrato().trim())); + c.add(Restrictions.eq("numcuenta", banco.getNumcuenta())); + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/BoletoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/BoletoHibernateDAO.java new file mode 100644 index 000000000..f50637606 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/BoletoHibernateDAO.java @@ -0,0 +1,352 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.LongType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.BoletoDAO; +import com.rjconsultores.ventaboletos.entidad.Boleto; +import com.rjconsultores.ventaboletos.vo.embarcada.PtoVtaUsuarioUltimaVendaDispositivoVO; + +/** + * + * @author Fabricio + */ +@Repository("boletoDAO") +public class BoletoHibernateDAO extends GenericHibernateDAO implements BoletoDAO { + + @Autowired + public BoletoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarUltimaVendaDosDispositivosEmbarcada(){ + StringBuilder sb = new StringBuilder(); + sb.append("select p.puntoventa_id as puntoventaId, u.usuario_id as usuarioId, u.nombusuario as nombusuario, p.nombpuntoventa as nombpuntoventa, d.imei as imei "); + sb.append("from "); + sb.append(" ctrl_serie_embarcada c "); + sb.append(" left join usuario u on u.usuario_id = c.usuario_id "); + sb.append(" left join punto_venta p on p.puntoventa_id = c.puntoventa_id "); + sb.append(" left join dispositivo_embarcada d on d.dispositivoembarcada_id = c.dispositivoembarcada_id "); + + + SQLQuery qry = getSession().createSQLQuery(sb.toString()) + .addScalar("puntoventaId", LongType.INSTANCE) + .addScalar("usuarioId", LongType.INSTANCE) + .addScalar("nombusuario", StringType.INSTANCE) + .addScalar("nombpuntoventa", StringType.INSTANCE) + .addScalar("imei", StringType.INSTANCE); + qry.setResultTransformer(new AliasToBeanResultTransformer(PtoVtaUsuarioUltimaVendaDispositivoVO.class)); + return qry.list(); + } + + public Boleto buscarPeloImeiDoDispositivo(String imei) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("imeiDispositivoEmbarcada", imei)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.desc("fechorventa")); + c.setFirstResult(0); + c.setMaxResults(1); + + return (Boleto) c.uniqueResult(); + } + + public String getSequenciaBoletoId(){ + String sql = "SELECT BOLETO_SEQ.nextval FROM DUAL"; + Object o = this.getSession().createSQLQuery(sql).uniqueResult(); + return o.toString(); + } + + public String getSequenciaNumOperacion(){ + String sql = "SELECT NUMEOPERACION_SEQ.nextval FROM DUAL"; + Object o = this.getSession().createSQLQuery(sql).uniqueResult(); + return o.toString(); + } + + public String getSequenciaNumReservacion(){ + String sql = "SELECT NUMERESERVACION_SEQ.nextval FROM DUAL"; + Object o = this.getSession().createSQLQuery(sql).uniqueResult(); + return o.toString(); + } + + @Override + public void insertBoletoRserva(Boleto miBoletoTemporal){ + SQLQuery query = getSession().createSQLQuery(getSqlInsertBoletoRserva()); + + query.setLong("boletoId", miBoletoTemporal.getBoletoId()); + query.setLong("boletooriginalId", miBoletoTemporal.getBoletooriginalId()); + query.setInteger("categoriaId", miBoletoTemporal.getCategoriaId()); + query.setInteger("clienteId", miBoletoTemporal.getClienteId()); + query.setInteger("claseservicioId", miBoletoTemporal.getClaseservicioId()); + query.setInteger("corridaId", miBoletoTemporal.getCorridaId()); + query.setInteger("destinoId", miBoletoTemporal.getDestinoId()); + query.setString("desctipodoc", miBoletoTemporal.getDesctipodoc()); + query.setString("descnumdoc", miBoletoTemporal.getDescnumdoc()); + query.setInteger("empresacorridaId", miBoletoTemporal.getEmpresacorridaId()); + query.setInteger("empresapuntoventaId", miBoletoTemporal.getEmpresapuntoventaId()); + query.setInteger("estacionId", miBoletoTemporal.getEstacionId()); + query.setDate("feccreacion", miBoletoTemporal.getFeccreacion()); + query.setDate("fecmodif", miBoletoTemporal.getFecmodif()); + query.setDate("fechorventa", miBoletoTemporal.getFechorventa()); + query.setDate("fechorventaH", miBoletoTemporal.getFechorventaH()); + query.setDate("fechorviaje", miBoletoTemporal.getFechorviaje()); + query.setDate("feccorrida", miBoletoTemporal.getFeccorrida()); + query.setInteger("corridaId", miBoletoTemporal.getCorridaId()); + query.setInteger("indcancelacion", Boolean.TRUE.equals(miBoletoTemporal.getIndcancelacion()) ? 1 :0 ); + query.setInteger("indreimpresion", Boolean.TRUE.equals(miBoletoTemporal.getIndreimpresion()) ? 1 :0 ); + query.setInteger("indextraviado", Boolean.TRUE.equals(miBoletoTemporal.getIndextraviado()) ? 1 :0 ); + query.setString("indstatusoperacion", miBoletoTemporal.getIndstatusoperacion() ); + query.setInteger("indreplica", Boolean.TRUE.equals(miBoletoTemporal.getIndreplica()) ? 1 :0 ); + query.setString("indstatusboleto", miBoletoTemporal.getIndstatusboleto()); + query.setInteger("indviajeredondo", Boolean.TRUE.equals(miBoletoTemporal.getIndviajeredondo()) ? 1 :0 ); + query.setBigDecimal("importetaxaembarque", miBoletoTemporal.getImportetaxaembarque()); + query.setBigDecimal("importeseguro", miBoletoTemporal.getImporteseguro()); + query.setBigDecimal("importepedagio", miBoletoTemporal.getImportepedagio()); + query.setBigDecimal("importeoutros", miBoletoTemporal.getImporteoutros()); + query.setInteger("marcaId", miBoletoTemporal.getMarcaId()); + query.setInteger("monedaId", miBoletoTemporal.getMonedaId()); + query.setInteger("nodoId", miBoletoTemporal.getNodoId()); + query.setBigDecimal("numkmviaje", miBoletoTemporal.getNumkmviaje()); + query.setString("nombpasajero", miBoletoTemporal.getNombpasajero()); + query.setString("numasiento", miBoletoTemporal.getNumasiento()); + query.setString("numfidelidad", miBoletoTemporal.getNumfidelidad()); + query.setString("numoperacion", miBoletoTemporal.getNumoperacion()); + query.setString("numreservacion", miBoletoTemporal.getNumreservacion()); + query.setInteger("origenId", miBoletoTemporal.getOrigenId()); + query.setBigDecimal("preciopagado", miBoletoTemporal.getPreciopagado()); + query.setBigDecimal("preciobase", miBoletoTemporal.getPreciobase()); + query.setInteger("ptovtaventaId", miBoletoTemporal.getPtovtaventaId()); + query.setInteger("puntoventaId", miBoletoTemporal.getPuntoVenta().getPuntoventaId()); + query.setInteger("rutaId", miBoletoTemporal.getRutaId()); + query.setInteger("temporeservafidelidade", miBoletoTemporal.getTemporeservafidelidade()); + query.setInteger("tipoventaId", miBoletoTemporal.getTipoventaId()); + query.setInteger("usuarioautorizacionId", miBoletoTemporal.getUsuarioautorizacionId()); + query.setInteger("usuarioId", miBoletoTemporal.getUsuario().getUsuarioId()); + query.setInteger("activo", Boolean.TRUE.equals(miBoletoTemporal.getActivo()) ? 1: 0); + query.executeUpdate(); + + } + + + private String getSqlInsertBoletoRserva() { + StringBuilder sql = new StringBuilder(); + sql.append(" INSERT INTO boleto ( "); + sql.append(" activo,"); //1 + sql.append(" aidf_id,"); //2 - null + sql.append(" boletoanterior_id,");//3 - null + sql.append(" boletooriginal_id,"); //4 + sql.append(" cantpuntos,"); //5 - null + sql.append(" canttransferencia,"); //6 - null + sql.append(" categoria_id,"); //7 + sql.append(" ccf,"); //8 - null + sql.append(" claseservicio_id,"); //9 + sql.append(" cliente_id,"); //10 + sql.append(" clientefidelidad_id,"); //11 - null + sql.append(" conveniodet_id,"); //12 - null + sql.append(" corrida_id,"); //13 + sql.append(" desccorreo,"); //14 - null + sql.append(" descnumdoc,"); //15 + sql.append(" descnumdoc2,"); //16 - null + sql.append(" descorgaodoc,"); //17 - null + sql.append(" desctelefono,"); //18 - null + sql.append(" desctipodoc,"); //19 + sql.append(" desctipodoc2,"); //20 + sql.append(" descuentoamparado,"); //21 + sql.append(" destino_id,"); //22 + sql.append(" dispositivoembarcada,"); //23 + sql.append(" empresacorrida_id,"); //24 + sql.append(" empresapuntoventa_id,"); //25 + sql.append(" entregaboleto_id,"); //26 + sql.append(" estacion_id,"); //27 + sql.append(" estadocivil_id,"); //28 + sql.append(" estadofolio_id,"); //29 + sql.append(" feccorrida,"); //30 + sql.append(" feccreacion,"); //31 + sql.append(" fechorventa,"); //32 + sql.append(" fechorventa_h,"); //33 + sql.append(" fechorviaje,"); //34 + sql.append(" fecmodif,"); //35 + sql.append(" fecnacimiento,"); //36 + sql.append(" imei_dispositivo_embarcada,"); //37 + sql.append(" importecategoria,"); //38 + sql.append(" importeoutros,"); //39 + sql.append(" importepedagio,"); //40 + sql.append(" importeseguro,"); //41 + sql.append(" importetaxaembarque,"); //42 + sql.append(" indcancelacion,"); //43 + sql.append(" indconexion,"); //44 + sql.append(" indextraviado,"); //45 + sql.append(" indreimpresion,"); // 46 + sql.append(" indreplica,"); //47 + sql.append(" indsegundaviaimpressa,"); //48 + sql.append(" indstatusboleto,"); //49 + sql.append(" indstatusoperacion,"); //50 + sql.append(" indviajeredondo,"); //51 + sql.append(" infopasajero,"); //52 + sql.append(" levante_id,"); //53 + sql.append(" marca_id,"); //54 + sql.append(" moneda_id,"); //55 + sql.append(" motivocancelacion_id,"); //56 + sql.append(" motivoreimpresion_id,"); //57 + sql.append(" nacionalidad,"); //58 + sql.append(" nodo_id,"); //59 + sql.append(" nombpasajero,"); //60 + sql.append(" numasiento,"); //61 + sql.append(" numasientovinculado,"); //62 + sql.append(" numdocdescuento,"); //63 + sql.append(" numerobilheteembarcada,"); //64 + sql.append(" numfidelidad,"); //65 + sql.append(" numfoliopreimpreso,"); //66 + sql.append(" numfoliosistema,"); //67 + sql.append(" numidentificacion,"); //68 + sql.append(" numkmviaje,"); //69 + sql.append(" numoperacion,"); //70 + sql.append(" numreservacion,"); //71 + sql.append(" numseriepreimpresa,"); //72 + sql.append(" opcional1,"); // 73 + sql.append(" opcional2,"); // 74 + sql.append(" opcional3,"); // 75 + sql.append(" origen_id,"); // 76 + sql.append(" paridad,"); // 77 + sql.append(" porccategoria,"); // 78 + sql.append(" preciobase,"); //79 + sql.append(" preciocargoextra,"); // 80 + sql.append(" preciopagado,"); //81 + sql.append(" preciopricing,"); // 82 + sql.append(" ptovtaventa_id,"); //83 + sql.append(" puntoventa_id,"); //84 + sql.append(" puntoventaremoto_id,"); // 85 + sql.append(" rmd_id,"); //86 + sql.append(" ruta_id,"); //87 + sql.append(" serieimpfiscal,"); //88 + sql.append(" serieimpfiscaloriginal,"); // 89 + sql.append(" sexo,"); //90 + sql.append(" temporeservafidelidade,"); //91 + sql.append(" tipoidentificacion_id,"); // 92 + sql.append(" tipoidentificaciondoc_id,"); //93 + sql.append(" tipoventa_id,"); //94 + sql.append(" turno_id,"); //95 + sql.append(" usuario_id,"); //96 + sql.append(" usuarioautorizacion_id,"); //97 + sql.append(" usuarioremoto_id,"); // 98 + sql.append(" boleto_id"); //99 + // Values + sql.append(" ) VALUES ( "); + sql.append(" :activo,"); //1 + sql.append(" null,"); //2 + sql.append(" null,"); //3 + sql.append(" :boletooriginalId,");//4 + sql.append(" null,");//5 + sql.append(" null,");//6 + sql.append(" :categoriaId,");//7 + sql.append(" null,");//8 + sql.append(" :claseservicioId,"); //9 + sql.append(" :clienteId,"); //10 + sql.append(" null,");//11 + sql.append(" null,");//12 + sql.append(" :corridaId,");//13 + sql.append(" null,"); //14 + sql.append(" :descnumdoc,"); //15 + sql.append(" null,"); //16 + sql.append(" null,"); //17 + sql.append(" null,"); //18 + sql.append(" :desctipodoc,"); //19 + sql.append(" null,"); //20 + sql.append(" null,"); //21 + sql.append(" :destinoId,"); //22 + sql.append(" null,"); //23 + sql.append(" :empresacorridaId,"); //24 + sql.append(" :empresapuntoventaId,"); //25 + sql.append(" null,"); //26 + sql.append(" :estacionId,"); //27 + sql.append(" null,"); //28 + sql.append(" null,"); //29 + sql.append(" :feccorrida,");//30 + sql.append(" :feccreacion,");//31 + sql.append(" :fechorventa,"); //32 + sql.append(" :fechorventaH,"); //33 + sql.append(" :fechorviaje,"); //34 + sql.append(" :fecmodif,"); //35 + sql.append(" null,"); //36 + sql.append(" null,"); //37 + sql.append(" null,"); //38 + sql.append(" :importeoutros,"); //39 + sql.append(" :importepedagio,"); //40 + sql.append(" :importeseguro,"); //41 + sql.append(" :importetaxaembarque,"); //42 + sql.append(" :indcancelacion,"); //43 + sql.append(" null,"); //44 + sql.append(" :indextraviado,"); //45 + sql.append(" :indreimpresion,"); //46 + sql.append(" :indreplica,"); //47 + sql.append(" null,"); //48 + sql.append(" :indstatusboleto,"); //49 + sql.append(" :indstatusoperacion,"); //50 + sql.append(" :indviajeredondo,"); //51 + sql.append(" null,");//52 + sql.append(" null,");//53 + sql.append(" :marcaId,"); //54 + sql.append(" :monedaId,"); //55 + sql.append(" null,"); //56 + sql.append(" null,"); //57 + sql.append(" null,"); //58 + sql.append(" :nodoId,");//59 + sql.append(" :nombpasajero,"); //60 + sql.append(" :numasiento,"); //61 + sql.append(" null,"); //62 + sql.append(" null,"); //63 + sql.append(" null,"); //64 + sql.append(" :numfidelidad,"); //65 + sql.append(" null,"); //66 + sql.append(" null,"); //67 + sql.append(" null,"); //68 + sql.append(" :numkmviaje,"); //69 + sql.append(" :numoperacion,"); //70 + sql.append(" :numreservacion,"); //71 + sql.append(" null,"); //72 + sql.append(" null,"); //73 + sql.append(" null,"); //74 + sql.append(" null,"); //75 + sql.append(" :origenId,"); //76 + sql.append(" null,"); //77 + sql.append(" null,"); //78 + sql.append(" :preciobase,"); //79 + sql.append(" null,"); //80 + sql.append(" :preciopagado,"); //81 + sql.append(" null,"); //82 + sql.append(" :ptovtaventaId,"); //83 + sql.append(" :puntoventaId,"); //84 + sql.append(" null,"); //85 + sql.append(" null,"); //86 + sql.append(" :rutaId,"); //87 + sql.append(" null,"); //88 + sql.append(" null,"); //89 + sql.append(" null,"); //90 + sql.append(" :temporeservafidelidade,"); //91 + sql.append(" null,"); //92 + sql.append(" null,"); //93 + sql.append(" :tipoventaId,"); //94 + sql.append(" null,"); //95 + sql.append(" :usuarioId,"); //96 + sql.append(" :usuarioautorizacionId,"); //97 + sql.append(" null,"); //98 + sql.append(" :boletoId"); //99 + sql.append(" )"); + + return sql.toString(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java new file mode 100644 index 000000000..de657ee62 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/BpeHibernateDAO.java @@ -0,0 +1,1711 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.hibernate.type.TimestampType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.BpeDAO; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.ExportacaoBPEBase; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.ExportacaoBPEVo; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.ExportacaoBPEVo.TipoComp; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.xml.BPeUtil; +import com.rjconsultores.ventaboletos.utilerias.fiscal.vo.DetalhadoFiscal; +import com.rjconsultores.ventaboletos.utilerias.fiscal.vo.FiscalRdi; +import com.rjconsultores.ventaboletos.utilerias.fiscal.vo.RdiValidacion; +import com.rjconsultores.ventaboletos.vo.bpe.BPeVO; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +import br.inf.portalfiscal.bpe.TBPe; + +@Repository("bpeDAO") +public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO { + private static Logger log = Logger.getLogger(BpeHibernateDAO.class); + + private static final String DATE_FORMAT_DMY = "dd/MM/yyyy"; + + @Autowired + public BpeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("deprecation") + @Override + public ExportacaoBPEVo buscarRegistroExportacaoBpe(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado, boolean consultaOtimizada, String codContPrevidencia) { + + log.info("Inicio da consulta buscarRegistroExportacaoBpe: " + new Date()); + + boolean isNoXml = isNoXml() && consultaOtimizada; + List registros = consultaRegistroExportacaoBpe(connection, inicio, fim, empresaId, cveestado, isNoXml); + + /* + * Bilhetes emitidos dentro do mes for cancelados apenas informar o cancelamento; Bilhetes emitidos em um mês e cancelados em outro mês, este deve ir apenas no relatório de devolução; + */ + LinkedHashMap mapAux = new LinkedHashMap(); + for (ExportacaoBPEBase expBPe : registros) { + expBPe.setIndContribuicaoPrevidenciaria(codContPrevidencia); + if (mapAux.containsKey(expBPe.getChbpe())) { + if (ExportacaoBPEVo.isBpeCancelado(expBPe.getCodstatus()) && !ExportacaoBPEVo.validaBPeCorridaAgrupada(expBPe)) + mapAux.put(expBPe.getChbpe(), expBPe); + } else { + if (!ExportacaoBPEVo.isBpeCancelado(expBPe.getCodstatus()) && !ExportacaoBPEVo.validaBPeCorridaAgrupada(expBPe)) + mapAux.put(expBPe.getChbpe(), expBPe); + } + } + + List listaRegistroBaseBPE = new ArrayList(); + + for (Map.Entry pair : mapAux.entrySet()) { + + if (isNoXml) { + listaRegistroBaseBPE.add(ExportacaoBPEVo.gerarListas(pair.getValue())); + } else { + listaRegistroBaseBPE.add(ExportacaoBPEVo.gerarListasXML(pair.getValue())); + } + } + + ExportacaoBPEVo resp = new ExportacaoBPEVo(); + resp.setListaRegistroBaseBPE(listaRegistroBaseBPE); + + log.info(" !!!! --- Fim preocesso da ExportacaoBpe: " + new Date()); + + return resp; + } + + private List consultaRegistroExportacaoBpe(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado, boolean isNoXml) { + List registros = new ArrayList(); + + String sql = null; + if (isNoXml) { + sql = queryNoXml(); + } else { + sql = queryXml(); + } + + try { + log.info("Consulta Exportacao Bpe: " + sql); + + PreparedStatement ps = connection.prepareStatement(sql); + ps.setString(1, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00"); + ps.setString(2, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); + ps.setLong(3, Long.valueOf(empresaId)); + ps.setString(4, cveestado); + + ps.setFetchSize(999); + ResultSet rs = ps.executeQuery(); + + while (rs.next()) { + BigDecimal valortributado = BigDecimal.ZERO; + BigDecimal valortotal = BigDecimal.ZERO; + + if (rs.getBigDecimal("valortributado") != null) { + valortributado = rs.getBigDecimal("valortributado"); + } + + if (rs.getBigDecimal("valortotal") != null) { + valortotal = rs.getBigDecimal("valortotal"); + } + + ExportacaoBPEBase registro = new ExportacaoBPEBase(); + registro.setBoletoId(rs.getLong("boleto_id")); + registro.setNumfoliosistema(rs.getString("numfoliosistema")); + registro.setvDesconto(rs.getBigDecimal("v_desconto")); + registro.setChbpe(rs.getString("chbpe")); + registro.setChbpeSub(rs.getString("chbpe_sub")); + registro.setDhrecbto(rs.getString("dhrecbto")); + registro.setDhEmisao(rs.getString("dh_emisao")); + registro.setTpBpe(rs.getString("tp_bpe")); + registro.setRetorno(rs.getString("retorno")); + registro.setNprot(rs.getString("nprot")); + registro.setNumBpe(rs.getString("num_bpe")); + registro.setNumSerieBpe(rs.getString("numserie_bpe")); + registro.setCodEstabelecimento(rs.getString("cod_estabelecimento")); + registro.setRedBaseCalcEstadual(rs.getBigDecimal("red_base_calc_estadual")); + registro.setRedBaseCalcMunicipal(rs.getBigDecimal("red_base_calc_municipal")); + registro.setPorcRedMunicipal(rs.getBigDecimal("porc_red_municipal")); + registro.setPorcRedEstadual(rs.getBigDecimal("porc_red_estadual")); + registro.setTributacaoImportacao(rs.getBigDecimal("tributacao_importacao")); + registro.setCodstatus(rs.getString("codstatus")); + registro.setTipoevento(rs.getString("tipoevento")); + registro.setCodigoContabilEstadual(rs.getString("codigocontabil_estadual")); + registro.setCodigocontabilMunicipal(rs.getString("codigocontabil_municipal")); + registro.setCrt(rs.getInt("crt")); + registro.setIndPedagioMunicipal(rs.getInt("indpedagiomunicipal") == 1); + registro.setIndSeguroMunicipal(rs.getInt("indseguromunicipal") == 1); + registro.setIndTarifaMunicipal(rs.getInt("indtarifamunicipal") == 1); + registro.setIndTxEmbarqueMunicipal(rs.getInt("indtxembarquemunicipal") == 1); + registro.setIndPedadioEstdual(rs.getInt("indpedagioestdual") == 1); + registro.setIndSeguroEstadual(rs.getInt("indseguroestadual") == 1); + registro.setIndTarifaEstadual(rs.getInt("indtarifaestadual") == 1); + registro.setIndTxEmbarqueEstadual(rs.getInt("indtxembarqueestadual") == 1); + registro.setDhrecbtoBPe(rs.getString("dhrecbto_bpe")); + registro.setActivoBPe(rs.getInt("activo_bpe") == 1); + registro.setMotivoCancelacionId(rs.getInt("motivocancelacion_id")); + registro.setValortributado(valortributado); + registro.setValortotal(valortotal); + + if (isNoXml) { + registro.setCmunini(rs.getString("cmunini")); + registro.setCmunfim(rs.getString("cmunfim")); + registro.setUfini(rs.getString("ufini")); + registro.setUffim(rs.getString("uffim")); + registro.setNbp(rs.getString("nbp")); + registro.setDhemb(rs.getString("dhemb")); + registro.setCst00(rs.getString("cst00")); + registro.setCst20(rs.getString("cst20")); + registro.setCst45(rs.getString("cst45")); + registro.setCst90(rs.getString("cst90")); + registro.setCstoutrauf(rs.getString("cstoutrauf")); + registro.setCstsn(rs.getString("cstsn")); + registro.setVbc00(rs.getString("vbc00")); + registro.setPicms00(rs.getString("picms00")); + registro.setVicms00(rs.getString("vicms00")); + registro.setVbc20(rs.getString("vbc20")); + registro.setPicms20(rs.getString("picms20")); + registro.setVicms20(rs.getString("vicms20")); + registro.setVbp(rs.getString("vbp")); + registro.setVdesconto(rs.getString("vdesconto")); + registro.setVpgto(rs.getString("vpgto")); + registro.setTpcomp01(rs.getString("tpcomp01")); + registro.setTpcomp02(rs.getString("tpcomp02")); + registro.setTpcomp03(rs.getString("tpcomp03")); + registro.setTpcomp04(rs.getString("tpcomp04")); + registro.setTpcomp05(rs.getString("tpcomp05")); + registro.setTpcomp06(rs.getString("tpcomp06")); + registro.setTpcomp99(rs.getString("tpcomp99")); + registro.setVcomp01(rs.getString("vcomp01")); + registro.setVcomp02(rs.getString("vcomp02")); + registro.setVcomp03(rs.getString("vcomp03")); + registro.setVcomp04(rs.getString("vcomp04")); + registro.setVcomp05(rs.getString("vcomp05")); + registro.setVcomp06(rs.getString("vcomp06")); + registro.setVcomp99(rs.getString("vcomp99")); + registro.setpRedBC(rs.getString("pRedBC")); + } else { + String xml_bpe = rs.getNString("xml_bpe"); + String xml_bpe_2 = rs.getNString("xml_bpe_2"); + String xml_bpe_3 = rs.getNString("xml_bpe_3"); + registro.setXml(StringUtils.join(new String[] { xml_bpe, xml_bpe_2, xml_bpe_3 })); + + } + + registros.add(registro); + } + + rs.close(); + ps.close(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return registros; + } + + private boolean isNoXml() { + ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService"); + Constante contante = constanteService.buscarPorNomeConstante("IMPORT_BPE_NOXML"); + String valorConstante = contante == null ? null : contante.getValorconstante(); + + if (StringUtils.isBlank(valorConstante)) + return false; + else + return true; + } + + /** + * Pega aquery da exportação do BPe + * + * Para utilizar este modelo o cliente deve estar com a versão que contemple o mantis 15032 + * + * Deve ser inserido a constante IMPORT_BPE_NOXML, o file .sql esta no mantis 15005 + * + * @return nova query da exportação do BPe. + */ + private String queryNoXml() { + StringBuilder sql = new StringBuilder(); + sql.append("select /*+INDEX(BPE IDX__BPE_BOLETO)*/ "); + sql.append(" c.boleto_id, "); + sql.append(" coalesce(c.num_bpe, c.numfoliosistema) as num_bpe, "); + sql.append(" c.numfoliosistema as numfoliosistema, "); + sql.append(" coalesce(c.preciopagado,0) + coalesce(c.importetaxaembarque,0) + coalesce(c.importeseguro,0) + coalesce(c.importepedagio,0) + coalesce(c.importeoutros,0) as valortotal, "); + sql.append(" bpe.codstat as codstatus, "); + sql.append(" bpe.tipoevento as tipoevento, "); + sql.append(" bpe.desconto as v_desconto, "); + sql.append(" bpe.chbpe, "); + sql.append(" coalesce(bpe.chbpe_substituicao, ' ') as chbpe_sub, "); + sql.append(" to_char(to_date(substr(bpe.dhrecbto,0,10), 'YYYY-MM-DD'), 'yyyymmdd') as dhrecbto_bpe, "); + sql.append(" to_char(c.feccreacion, 'yyyymmdd') as dh_emisao, "); + sql.append(" to_char(c.fechorviaje, 'yyyymmdd') as dhrecbto, "); + sql.append(" coalesce(bpe.tiposubstituicao, '0') as tp_bpe, "); + sql.append(" bpe.retorno_id as retorno, "); + sql.append(" bpe.nprot, "); + sql.append(" coalesce(c.numserie_bpe, '1') as numserie_bpe, "); + sql.append(" c.categoria_id, "); + /** + * Mantis 18267 + */ + sql.append(" ei.codestabelecimento as cod_estabelecimento, "); + sql.append(" ep.crtbpe as crt, "); + sql.append(" ((case when coalesce(r.indtribtarifa,0) = 1 then c.preciopagado else 0 end) + (case when coalesce(r.indtribtaxaembarque,0) = 1 then c.importetaxaembarque else 0 end) + (case when coalesce(r.indtribpedagio,0) = 1 then c.importepedagio else 0 end)) as valortributado, "); + sql.append(" ei.porcredbaseicms as red_base_calc_estadual, "); + sql.append(" ei.porcredbaseicmsim as red_base_calc_municipal, "); + sql.append(" ei.porcredmunicipal as porc_red_municipal, "); + sql.append(" ei.porcredestadual as porc_red_estadual, "); + sql.append(" ei.tributacaoimportacao as tributacao_importacao, "); + sql.append(" ei.codigocontabilestadual as codigocontabil_estadual, "); + sql.append(" ei.codigocontabilmunicipal as codigocontabil_municipal, "); + sql.append(" coalesce(ei.indtarifamunicipal,0) as indtarifamunicipal, "); + sql.append(" coalesce(ei.indseguromunicipal,0) as indseguromunicipal, "); + sql.append(" coalesce(ei.indtxembarquemunicipal,0) as indtxembarquemunicipal, "); + sql.append(" coalesce(ei.indpedagiomunicipal,0) as indpedagiomunicipal, "); + sql.append(" coalesce(ei.indtarifaestadual,0) as indtarifaestadual,"); + sql.append(" coalesce(ei.indseguroestadual,0) as indseguroestadual, "); + sql.append(" coalesce(ei.indtxembarqueestadual,0) as indtxembarqueestadual, "); + sql.append(" coalesce(ei.indpedagioestdual,0) as indpedagioestdual, "); + sql.append(" bpe.cmunini, "); + sql.append(" bpe.cmunfim, "); + sql.append(" bpe.ufini, "); + sql.append(" bpe.uffim, "); + sql.append(" bpe.nbp, "); + sql.append(" bpe.dhemb, "); + sql.append(" bpe.cst00, "); + sql.append(" bpe.cst20, "); + sql.append(" bpe.cst45, "); + sql.append(" bpe.cst90, "); + sql.append(" bpe.cstoutrauf, "); + sql.append(" bpe.cstsn, "); + sql.append(" bpe.vbc00, "); + sql.append(" bpe.picms00, "); + sql.append(" bpe.vicms00, "); + sql.append(" bpe.vbc20, "); + sql.append(" bpe.picms20, "); + sql.append(" bpe.vicms20, "); + sql.append(" bpe.vbp, "); + sql.append(" bpe.vdesconto, "); + sql.append(" bpe.vpgto, "); + sql.append(" bpe.tpcomp01, "); + sql.append(" bpe.tpcomp02, "); + sql.append(" bpe.tpcomp03, "); + sql.append(" bpe.tpcomp04, "); + sql.append(" bpe.tpcomp05, "); + sql.append(" bpe.tpcomp06, "); + sql.append(" bpe.tpcomp99, "); + sql.append(" bpe.vcomp01, "); + sql.append(" bpe.vcomp02, "); + sql.append(" bpe.vcomp03, "); + sql.append(" bpe.vcomp04, "); + sql.append(" bpe.vcomp05, "); + sql.append(" bpe.vcomp06, "); + sql.append(" bpe.vcomp99, "); + sql.append(" bpe.pRedBC, "); + sql.append(" bpe.activo as activo_bpe, "); + sql.append(" c.motivocancelacion_id "); + sql.append("from boleto c "); + sql.append(" join bpe bpe on c.boleto_id = bpe.boleto_id "); + sql.append(" join estado e on e.codibge = bpe.uf "); + sql.append(" join marca ma on c.marca_id = ma.marca_id "); + sql.append(" join empresa ep on ma.empresa_id = ep.empresa_id "); + sql.append(" join ruta r on r.ruta_id = c.ruta_id "); + sql.append(" inner join empresa_imposto ei on ei.empresa_id = ep.empresa_id and ei.estado_id = e.estado_id "); + sql.append("where c.activo = 1 and e.activo = 1 and ei.activo = 1 "); + sql.append(" and bpe.tipoamb = 1 and ep.activo = 1 "); + sql.append(" and bpe.codstat in ('-1','100','101','102','135','150') "); + sql.append(" and (bpe.tipoevento not in ('110115','110116') or bpe.tipoevento is null) "); + sql.append(" and c.feccreacion >= to_date(?,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and c.feccreacion <= to_date(?,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and ep.empresa_id = ? "); + sql.append(" and e.cveestado = ? "); + // sql.append(" and (bpe.xmlregular is not null or bpe.xmlcontingencia is not null) "); + sql.append("order by to_number(c.numfoliosistema), to_number(num_bpe), dh_emisao, tipoevento desc "); + return sql.toString(); + } + + /** + * Este modelo de consulta que faz a busca do xml da tabela BPe deve ser evitado, por motivos de queda na performance da consulta e do processamento da converção do xml. + * + * Porem so devera ser utlizado novo modelo de exportação apos o cliente esta com a versão que contemple o mantis 15032 + * + * @deprecated use {@link queryNoXml()} instead. + */ + @Deprecated + private String queryXml() { + StringBuilder sql = new StringBuilder(); + sql.append("select "); + sql.append(" c.boleto_id, "); + sql.append(" coalesce(c.num_bpe, c.numfoliosistema) as num_bpe, "); + sql.append(" c.numfoliosistema as numfoliosistema, "); + sql.append(" coalesce(c.preciopagado,0) + coalesce(c.importetaxaembarque,0) + coalesce(c.importeseguro,0) + coalesce(c.importepedagio,0) + coalesce(c.importeoutros,0) as valortotal, "); + sql.append(" bpe.codstat as codstatus, "); + sql.append(" DBMS_LOB.substr(coalesce(bpe.xmlregular, bpe.xmlcontingencia), 3000) as xml_bpe, "); + sql.append(" DBMS_LOB.substr(coalesce(bpe.xmlregular, bpe.xmlcontingencia), 3000, 3001) as xml_bpe_2, "); + sql.append(" DBMS_LOB.substr(coalesce(bpe.xmlregular, bpe.xmlcontingencia), 3000, 6001) as xml_bpe_3, "); + sql.append(" bpe.tipoevento as tipoevento, "); + sql.append(" bpe.desconto as v_desconto, "); + sql.append(" bpe.chbpe, "); + sql.append(" coalesce(bpe.chbpe_substituicao, ' ') as chbpe_sub, "); + sql.append(" to_char(to_date(substr(bpe.dhrecbto,0,10), 'YYYY-MM-DD'), 'yyyymmdd') as dhrecbto_bpe, "); + sql.append(" to_char(c.feccreacion, 'yyyymmdd') as dh_emisao, "); + sql.append(" to_char(c.fechorviaje, 'yyyymmdd') as dhrecbto, "); + sql.append(" coalesce(bpe.tiposubstituicao, '0') as tp_bpe, "); + sql.append(" bpe.retorno_id as retorno, "); + sql.append(" bpe.nprot, "); + sql.append(" coalesce(c.numserie_bpe, '1') as numserie_bpe, "); + sql.append(" c.categoria_id, "); + /** + * Mantis 18267 + */ + sql.append(" ei.codestabelecimento as cod_estabelecimento, "); + sql.append(" ep.crtbpe as crt, "); + sql.append(" ((case when coalesce(r.indtribtarifa,0) = 1 then c.preciopagado else 0 end) + (case when coalesce(r.indtribtaxaembarque,0) = 1 then c.importetaxaembarque else 0 end) + (case when coalesce(r.indtribpedagio,0) = 1 then c.importepedagio else 0 end)) as valortributado, "); + sql.append(" ei.porcredbaseicms as red_base_calc_estadual, "); + sql.append(" ei.porcredbaseicmsim as red_base_calc_municipal, "); + sql.append(" ei.porcredmunicipal as porc_red_municipal, "); + sql.append(" ei.porcredestadual as porc_red_estadual, "); + sql.append(" ei.tributacaoimportacao as tributacao_importacao, "); + sql.append(" ei.codigocontabilestadual as codigocontabil_estadual, "); + sql.append(" ei.codigocontabilmunicipal as codigocontabil_municipal, "); + sql.append(" coalesce(ei.indtarifamunicipal,0) as indtarifamunicipal, "); + sql.append(" coalesce(ei.indseguromunicipal,0) as indseguromunicipal, "); + sql.append(" coalesce(ei.indtxembarquemunicipal,0) as indtxembarquemunicipal, "); + sql.append(" coalesce(ei.indpedagiomunicipal,0) as indpedagiomunicipal, "); + sql.append(" coalesce(ei.indtarifaestadual,0) as indtarifaestadual,"); + sql.append(" coalesce(ei.indseguroestadual,0) as indseguroestadual, "); + sql.append(" coalesce(ei.indtxembarqueestadual,0) as indtxembarqueestadual, "); + sql.append(" coalesce(ei.indpedagioestdual,0) as indpedagioestdual, "); + sql.append(" bpe.activo as activo_bpe, "); + sql.append(" c.motivocancelacion_id "); + sql.append("from boleto c "); + sql.append(" join bpe bpe on c.boleto_id = bpe.boleto_id "); + sql.append(" join estado e on e.codibge = bpe.uf "); + sql.append(" join marca ma on c.marca_id = ma.marca_id "); + sql.append(" join empresa ep on ma.empresa_id = ep.empresa_id "); + sql.append(" join ruta r on r.ruta_id = c.ruta_id "); + sql.append(" left join empresa_imposto ei on ei.empresa_id = ep.empresa_id and ei.estado_id = e.estado_id "); + sql.append("where c.activo = 1 and e.activo = 1 and ei.activo = 1 "); + sql.append(" and bpe.tipoamb = 1 and ep.activo = 1 "); + sql.append(" and bpe.codstat in ('-1','100','101','102','135','150') "); + sql.append(" and (bpe.tipoevento not in ('110115','110116') or bpe.tipoevento is null) "); + sql.append(" and c.feccreacion >= to_date(?,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and c.feccreacion <= to_date(?,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and ep.empresa_id = ? "); + sql.append(" and e.cveestado = ? "); + sql.append(" and (bpe.xmlregular is not null or bpe.xmlcontingencia is not null) "); + sql.append("order by to_number(c.numfoliosistema), to_number(num_bpe), dh_emisao, tipoevento desc "); + return sql.toString(); + } + + @Override + public String buscarXmlBPE(Connection connection, String chBpe) { + + String xmlBpe = null; + StringBuilder sql = new StringBuilder(); + sql.append(" select distinct "); + sql.append(" DBMS_LOB.substr(bpe.xmlregular, 3000) as xml_bpe, "); + sql.append(" DBMS_LOB.substr(bpe.xmlregular, 3000, 3001) as xml_bpe_2, "); + sql.append(" DBMS_LOB.substr(bpe.xmlregular, 3000, 6001) as xml_bpe_3 "); + sql.append(" from bpe bpe "); + sql.append(" where bpe.activo = 1 "); + sql.append(" and bpe.tipoamb = 1 "); + sql.append(" and bpe.codstat in ('100','150') "); + sql.append(" and bpe.chbpe = ? "); + + try { + PreparedStatement ps = connection.prepareStatement(sql.toString()); + ps.setString(1, chBpe); + + ResultSet rs = ps.executeQuery(); + + while (rs.next()) { + String xml_bpe = rs.getNString("xml_bpe"); + String xml_bpe_2 = rs.getNString("xml_bpe_2"); + String xml_bpe_3 = rs.getNString("xml_bpe_3"); + xmlBpe = StringUtils.join(new String[] { xml_bpe, xml_bpe_2, xml_bpe_3 }); + } + + rs.close(); + ps.close(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return xmlBpe; + } + + @Override + public List buscarBpeRDI(Connection connection, Date inicio, Date fim, Integer empresaId, List estados, boolean isReceitaTerceiros, boolean consultaOtimizada) { + + String ufs = null; + for (Estado estado : estados) { + if (ufs == null) + ufs = "'" + estado.getCveestado() + "'"; + else + ufs = ufs + ",'" + estado.getCveestado() + "'"; + } + + List rdis = new ArrayList(); + + boolean isNoXML = isNoXml() && consultaOtimizada; + + if (isNoXML) { + StringBuilder sqlVendidos = new StringBuilder(); + sqlVendidos.append(sqlRelatorioRDIVendidosNoXML(ufs)); + + List listVendidos = montaRelatorioRDINoXML(connection, inicio, fim, empresaId, ufs, sqlVendidos.toString()); + List rdiVendidos = calcularRelatorioRDINoXML(listVendidos, isReceitaTerceiros); + rdis.addAll(rdiVendidos); + + StringBuilder sql = new StringBuilder(); + sql.append(sqlRelatorioRDICanceladosSubstituidosNoXML(ufs)); + sql.append(" UNION ALL "); + sql.append(sqlRelatorioRDICanceladosNoXML(ufs)); + + List listCancelados = montaRelatorioRDINoXML(connection, inicio, fim, empresaId, ufs, sql.toString()); + List rdiCancelados = calcularRelatorioRDINoXML(listCancelados, isReceitaTerceiros); + rdis.addAll(rdiCancelados); + + Collections.sort(rdis, new Comparator() { + @Override + public int compare(FiscalRdi m1, FiscalRdi m2) { + return m1.getEstado().compareTo(m2.getEstado()); + } + }); + } else { + + StringBuilder sql = new StringBuilder(); + sql.append(sqlRelatorioRDIVendidosXML(ufs)); + sql.append(" union all "); + sql.append(sqlRelatorioRDICanceladosXML(ufs)); + + List list = montaRelatorioRDIXML(connection, inicio, fim, empresaId, ufs, sql.toString()); + rdis.addAll(calcularRelatorioRDIXML(list, isReceitaTerceiros)); + } + + return agrupaRdi(rdis); + } + + private List agrupaRdi(List list) { + List aux = new ArrayList(); + + FiscalRdi rdi = null; + for (FiscalRdi detail : list) { + + FiscalRdi atual = new FiscalRdi(detail.getEstado(), detail.getTipoViagem(), detail.getTipoReceita()); + if (!aux.contains(atual)) { + rdi = new FiscalRdi(detail.getEstado(), detail.getTipoViagem(), detail.getTipoReceita()); + aux.add(rdi); + } + + int index = aux.indexOf(atual); + FiscalRdi agr = aux.get(index); + montarParametros(agr, detail); + aux.set(index, agr); + } + + List validacion = new ArrayList(); + for (FiscalRdi detail : aux) { + + RdiValidacion rv = new RdiValidacion(detail.getEstado()); + if (!validacion.contains(rv)) { + rv = new RdiValidacion(detail.getEstado()); + validacion.add(rv); + } + + int indice = validacion.indexOf(rv); + RdiValidacion rvAux = validacion.get(indice); + + if (detail.getTipoReceita().equals("REC") && detail.getTipoViagem().equals("IM")) + rvAux.setTemIMRec(true); + + if (detail.getTipoReceita().equals("DEV") && detail.getTipoViagem().equals("IM")) + rvAux.setTemIMDev(true); + + if (detail.getTipoReceita().equals("REC") && detail.getTipoViagem().equals("IE")) + rvAux.setTemIERec(true); + + if (detail.getTipoReceita().equals("DEV") && detail.getTipoViagem().equals("IE")) + rvAux.setTemIEDev(true); + + validacion.set(indice, rvAux); + } + + for (RdiValidacion val : validacion) { + + if (!val.isTemIMRec()) { + FiscalRdi rdiAux = new FiscalRdi(val.getEstado(), "IM", "REC"); + aux.add(montarParametros(rdiAux, new FiscalRdi())); + } + + if (!val.isTemIMDev()) { + FiscalRdi rdiAux = new FiscalRdi(val.getEstado(), "IM", "DEV"); + aux.add(montarParametros(rdiAux, new FiscalRdi())); + } + + if (!val.isTemIERec()) { + FiscalRdi rdiAux = new FiscalRdi(val.getEstado(), "IE", "REC"); + aux.add(montarParametros(rdiAux, new FiscalRdi())); + } + + if (!val.isTemIEDev()) { + FiscalRdi rdiAux = new FiscalRdi(val.getEstado(), "IE", "DEV"); + aux.add(montarParametros(rdiAux, new FiscalRdi())); + } + } + + Collections.sort(aux); + return aux; + } + + private FiscalRdi montarParametros(FiscalRdi agr, FiscalRdi detail) { + agr.setQuantBilhetes(MoneyHelper.somar(agr.getQuantBilhetes(), detail.getTarifa() == null ? BigDecimal.ZERO : BigDecimal.ONE)); + agr.setTarifa(agr.getTarifa().add(detail.getTarifa() == null ? BigDecimal.ZERO : detail.getTarifa())); + agr.setSeguro(MoneyHelper.somar(agr.getSeguro(), detail.getSeguro())); + agr.setTxEmbarque(MoneyHelper.somar(agr.getTxEmbarque(), detail.getTxEmbarque())); + agr.setPedagio(MoneyHelper.somar(agr.getPedagio(), detail.getPedagio())); + agr.setPassagem(MoneyHelper.somar(agr.getPassagem(), detail.getPassagem())); + agr.setIsentos(MoneyHelper.somar(agr.getIsentos(), detail.getIsentos())); + agr.setOutros(MoneyHelper.somar(agr.getOutros(), detail.getOutros())); + agr.setRbc(detail.getRbc() == null ? BigDecimal.ZERO : detail.getRbc()); + agr.setBaseCalculo(MoneyHelper.somar(agr.getBaseCalculo(), detail.getBaseCalculo())); + agr.setAliquota(detail.getAliquota() == null ? BigDecimal.ZERO : detail.getAliquota()); + agr.setIcms(MoneyHelper.somar(agr.getIcms(), detail.getIcms())); + agr.setCp(detail.getCp() == null ? BigDecimal.ZERO : detail.getCp()); + + BigDecimal credPres = agr.getIcms().multiply(agr.getCp()).divide(new BigDecimal("100")); + BigDecimal icmsRec = agr.getIcms().subtract(credPres); + + agr.setCredPres(credPres); + agr.setIcmsRec(icmsRec); + + return agr; + } + + private List calcularRelatorioRDINoXML(List list, boolean isReceitaTerceiros) { + + List rdis = new ArrayList(); + + /* + * Bilhetes emitidos dentro do mes for cancelados apenas informar o cancelamento; Bilhetes emitidos em um mês e cancelados em outro mês, este deve ir apenas no relatório de devolução; + */ + LinkedHashMap mapAux = new LinkedHashMap(); + for (DetalhadoFiscal det : list) { + if ("REC".equals(det.getTipoReceita())) { + if (mapAux.containsKey(det.getChbpe())) { + if (ExportacaoBPEVo.isBpeCancelado(det.getCodstatus())) { + // det.setTipoReceita("DEV"); + // mapAux.put(det.getChbpe(), det); + mapAux.remove(det.getChbpe()); + } + } else { + if (!ExportacaoBPEVo.isBpeCancelado(det.getCodstatus())) { + det.setTipoReceita("REC"); + mapAux.put(det.getChbpe(), det); + } + } + } else { + mapAux.put(det.getChbpe(), det); + } + } + + BigDecimal aliquotaAnt = null; + for (Map.Entry pair : mapAux.entrySet()) { + DetalhadoFiscal det = pair.getValue(); + + boolean isEstadual = det.isInterEstadual(); + String tipoViagem = isEstadual ? "IE" : "IM"; + + String vBC = null; + String pICMS = null; + String vICMS = null; + String pRedBC = null; + + if (StringUtils.isNotBlank(det.getPicms00())) { + vBC = det.getVbc00(); + pICMS = det.getPicms00(); + vICMS = det.getVicms00(); + } else if (StringUtils.isNotBlank(det.getPicms20())) { + vBC = det.getVbc20(); + pICMS = det.getPicms20(); + vICMS = det.getVicms20(); + pRedBC = det.getpRedBC(); + } + + String vDesconto = det.getVdesconto(); + String vPgto = det.getVpgto(); + BigDecimal passagem = new BigDecimal(vPgto == null ? "0.0" : vPgto); + + BigDecimal tarifa = new BigDecimal(det.getVcomp01() == null ? "0.0" : det.getVcomp01()); + tarifa = MoneyHelper.subtrair(tarifa, new BigDecimal(vDesconto == null ? "0.0" : vDesconto)); + + BigDecimal isentos = BigDecimal.ZERO; + + BigDecimal pedagio = isReceitaTerceiros ? new BigDecimal(det.getVcomp02() == null ? "0.0" : det.getVcomp02()) : BigDecimal.ZERO; + BigDecimal pedagioIsento = isEstadual && !det.getIndPedagioEstdual() ? pedagio : BigDecimal.ZERO; + if (pedagioIsento.compareTo(BigDecimal.ZERO) == 0) + pedagioIsento = !isEstadual && !det.getIndPedagioMunicipal() ? pedagio : BigDecimal.ZERO; + + BigDecimal taxaEmbarque = isReceitaTerceiros ? new BigDecimal(det.getVcomp03() == null ? "0.0" : det.getVcomp03()) : BigDecimal.ZERO; + BigDecimal taxaEmbarqueIsento = isEstadual && !det.getIndTxembarqueEstadual() ? taxaEmbarque : BigDecimal.ZERO; + if (taxaEmbarqueIsento.compareTo(BigDecimal.ZERO) == 0) + taxaEmbarqueIsento = !isEstadual && !det.getIndTxembarqueMunicipal() ? taxaEmbarque : BigDecimal.ZERO; + + BigDecimal seguro = isReceitaTerceiros ? new BigDecimal(det.getVcomp04() == null ? "0.0" : det.getVcomp04()) : BigDecimal.ZERO; + BigDecimal seguroIsento = isEstadual && !det.getIndSeguroEstadual() ? seguro : BigDecimal.ZERO; + if (seguroIsento.compareTo(BigDecimal.ZERO) == 0) + seguroIsento = isEstadual && !det.getIndSeguroEstadual() ? seguro : BigDecimal.ZERO; + + isentos = MoneyHelper.somar(isentos, pedagioIsento, taxaEmbarqueIsento, seguroIsento); + + BigDecimal aliquota = new BigDecimal(pICMS == null ? "0.0" : pICMS); + + aliquota = (aliquota.intValue() == 0 ? (aliquotaAnt == null ? aliquota : aliquotaAnt) : aliquota); + if (aliquota != null && aliquota.intValue() > 0) + aliquotaAnt = aliquota; + + BigDecimal icms = new BigDecimal(vICMS == null ? "0.0" : vICMS); + + BigDecimal cp = null; + if (isEstadual) { + cp = det.getPorcRedEstadual() == null ? BigDecimal.ZERO : det.getPorcRedEstadual(); + } else { + cp = det.getPorcRedMunicipal() == null ? BigDecimal.ZERO : det.getPorcRedMunicipal(); + } + + BigDecimal credPres = MoneyHelper.dividir(MoneyHelper.multiplicar(icms, cp), new BigDecimal("100")); + BigDecimal icmsRec = MoneyHelper.subtrair(icms, credPres); + BigDecimal vRedBC = new BigDecimal(pRedBC == null ? "0.0" : pRedBC); + + BigDecimal baseCalculo = new BigDecimal(vBC == null ? "0.0" : vBC); + BigDecimal outros = isentos.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : MoneyHelper.subtrair(passagem, MoneyHelper.subtrair(isentos, baseCalculo)); + if (pRedBC != null) { + outros = MoneyHelper.subtrair(passagem, baseCalculo); + outros = MoneyHelper.subtrair(outros, isentos); + } + + rdis.add(new FiscalRdi(det.getEstadoOrigem(), tipoViagem, det.getTipoReceita(), tarifa, + seguro, taxaEmbarque, pedagio, passagem, isentos, outros, vRedBC, + baseCalculo, aliquota, icms, cp, credPres, icmsRec)); + } + + return rdis; + } + + private List montaRelatorioRDINoXML(Connection connection, Date inicio, Date fim, Integer empresaId, String ufs, String sql) { + + log.info("Inicio da consulta busca RelatorioRDI BPe: " + new Date()); + + List list = new ArrayList(); + try { + + log.info("Consulta RDI Bpe: " + sql); + + NamedParameterStatement ps = new NamedParameterStatement(connection, sql); + ps.setLong("EMPRESA_ID", Long.valueOf(empresaId)); + + ps.setString("DATE_INICIO", DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00"); + ps.setString("DATE_FIM", DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); + ps.getStatement().setFetchSize(99999); + + ResultSet rs = ps.executeQuery(); + while (rs.next()) { + + DetalhadoFiscal df = new DetalhadoFiscal(); + + df.setCajaId(rs.getLong("cajaId")); + df.setTipoReceita(rs.getString("tipoReceita")); + df.setNumoperacion(rs.getString("numoperacion")); + df.setEstadoId(rs.getInt("estadoId")); + df.setFechorVenta(rs.getDate("fechorVenta")); + df.setIcmsInterestadual(rs.getBigDecimal("icmsInterestadual")); + df.setIcmsIntermunicipal(rs.getBigDecimal("icmsIntermunicipal")); + df.setIcmsInterestadual(rs.getBigDecimal("icmsInterestadual")); + df.setRedBaseCalcIcms(rs.getBigDecimal("redBaseCalcIcms")); + df.setPorcRedMunicipal(rs.getBigDecimal("porcRedMunicipal")); + df.setPorcRedEstadual(rs.getBigDecimal("porcRedEstadual")); + df.setTributacaoImportacao(rs.getBigDecimal("tributacaoImportacao")); + df.setIndTarifaMunicipal(rs.getBoolean("indtarifamunicipal")); + df.setIndSeguroMunicipal(rs.getBoolean("indseguromunicipal")); + df.setIndTxembarqueMunicipal(rs.getBoolean("indtxembarquemunicipal")); + df.setIndPedagioMunicipal(rs.getBoolean("indpedagiomunicipal")); + df.setIndTarifaEstadual(rs.getBoolean("indtarifaestadual")); + df.setIndSeguroEstadual(rs.getBoolean("indseguroestadual")); + df.setIndTxembarqueEstadual(rs.getBoolean("indtxembarqueestadual")); + df.setIndPedagioEstdual(rs.getBoolean("indpedagioestdual")); + df.setIsenta(rs.getBoolean("isenta")); + df.setTarifa(rs.getBigDecimal("tarifa")); + df.setTaxaEmbarque(rs.getBigDecimal("taxaEmbarque")); + df.setPedagio(rs.getBigDecimal("pedagio")); + df.setSeguro(rs.getBigDecimal("seguro")); + df.setOutros(rs.getBigDecimal("outros")); + df.setDatamov(rs.getString("datamov")); + df.setChbpe(rs.getString("chbpe")); + df.setCodstatus(rs.getString("codstatus")); + df.setCmunini(rs.getString("cmunini")); + df.setCmunfim(rs.getString("cmunfim")); + df.setUfini(rs.getString("ufini")); + df.setUffim(rs.getString("uffim")); + df.setNbp(rs.getString("nbp")); + df.setDhemb(rs.getString("dhemb")); + df.setCst00(rs.getString("cst00")); + df.setCst20(rs.getString("cst20")); + df.setCst45(rs.getString("cst45")); + df.setCst90(rs.getString("cst90")); + df.setCstoutrauf(rs.getString("cstoutrauf")); + df.setCstsn(rs.getString("cstsn")); + df.setVbc00(rs.getString("vbc00")); + df.setPicms00(rs.getString("picms00")); + df.setVicms00(rs.getString("vicms00")); + df.setVbc20(rs.getString("vbc20")); + df.setPicms20(rs.getString("picms20")); + df.setVicms20(rs.getString("vicms20")); + df.setVbp(rs.getString("vbp")); + df.setVdesconto(rs.getString("vdesconto")); + df.setVpgto(rs.getString("vpgto")); + df.setTpcomp01(rs.getString("tpcomp01")); + df.setTpcomp02(rs.getString("tpcomp02")); + df.setTpcomp03(rs.getString("tpcomp03")); + df.setTpcomp04(rs.getString("tpcomp04")); + df.setTpcomp05(rs.getString("tpcomp05")); + df.setTpcomp06(rs.getString("tpcomp06")); + df.setTpcomp99(rs.getString("tpcomp99")); + df.setVcomp01(rs.getString("vcomp01")); + df.setVcomp02(rs.getString("vcomp02")); + df.setVcomp03(rs.getString("vcomp03")); + df.setVcomp04(rs.getString("vcomp04")); + df.setVcomp05(rs.getString("vcomp05")); + df.setVcomp06(rs.getString("vcomp06")); + df.setVcomp99(rs.getString("vcomp99")); + df.setpRedBC(rs.getString("pRedBC")); + + String municipioOrigem = df.getCmunini(); + String estadoOrigem = (StringUtils.isNotBlank(df.getUfini()) ? df.getUfini() : rs.getString("estadoOrigem")); + String estadoDestino = df.getUffim(); + + boolean isInterEstadual = !estadoOrigem.equals(estadoDestino); + df.setEstadoOrigem(estadoOrigem); + df.setEstadoDestino(estadoDestino); + df.setMunicipioOrigem(municipioOrigem); + df.setInterEstadual(isInterEstadual); + + list.add(df); + } + + rs.close(); + ps.close(); + + } catch (SQLException e) { + log.error("", e); + } + + log.info("Fim da consulta busca RelatorioRDI BPe: " + new Date()); + + return list; + } + + private String sqlRelatorioRDIVendidosNoXML(String ufs) { + + StringBuilder sql = new StringBuilder(); + sql.append("select /*+INDEX(BPE IDX__BPE_BOLETO)*/ "); + sql.append(" c.boleto_id as cajaId, "); + sql.append(" 'REC' as tipoReceita, "); + sql.append(" to_number(c.num_bpe) as num_bpe, "); + sql.append(" to_number(c.numfoliosistema) as numfoliosistema, "); + sql.append(" c.numoperacion as numoperacion, "); + sql.append(" trunc(c.feccreacion) as fechorVenta, "); + sql.append(" e.estado_id as estadoId, "); + sql.append(" e.cveestado as estadoOrigem, "); + sql.append(" ei.icms as icmsInterestadual, "); + sql.append(" ei.icmsim as icmsIntermunicipal, "); + sql.append(" 0 as isenta, "); + sql.append(" ei.porcredbaseicms as redBaseCalcIcms, "); + sql.append(" ei.porcredmunicipal as porcRedMunicipal, "); + sql.append(" ei.porcredestadual as porcRedEstadual, "); + sql.append(" ei.indtarifamunicipal as indtarifamunicipal, "); + sql.append(" ei.indseguromunicipal as indseguromunicipal, "); + sql.append(" ei.indtxembarquemunicipal as indtxembarquemunicipal, "); + sql.append(" ei.indpedagiomunicipal as indpedagiomunicipal, "); + sql.append(" ei.indtarifaestadual as indtarifaestadual, "); + sql.append(" ei.indseguroestadual as indseguroestadual, "); + sql.append(" ei.indtxembarqueestadual as indtxembarqueestadual, "); + sql.append(" ei.indpedagioestdual as indpedagioestdual, "); + sql.append(" ei.tributacaoImportacao as tributacaoImportacao, "); + sql.append(" coalesce(c.preciopagado, 0) as tarifa, "); + sql.append(" coalesce(c.importetaxaembarque, 0) as taxaEmbarque, "); + sql.append(" coalesce(c.importepedagio, 0) as pedagio, "); + sql.append(" coalesce(c.importeseguro, 0) as seguro, "); + sql.append(" coalesce(c.importeoutros, 0) as outros, "); + sql.append(" to_char(trunc(c.feccreacion), 'yyyymmdd') as datamov, "); + sql.append(" bpe.chbpe, "); + sql.append(" bpe.codstat as codstatus, "); + sql.append(" bpe.tipoevento, "); + sql.append(" bpe.cmunini, "); + sql.append(" bpe.cmunfim, "); + sql.append(" bpe.ufini, "); + sql.append(" bpe.uffim, "); + sql.append(" bpe.nbp, "); + sql.append(" bpe.dhemb, "); + sql.append(" bpe.cst00, "); + sql.append(" bpe.cst20, "); + sql.append(" bpe.cst45, "); + sql.append(" bpe.cst90, "); + sql.append(" bpe.cstoutrauf, "); + sql.append(" bpe.cstsn, "); + sql.append(" bpe.vbc00, "); + sql.append(" bpe.picms00, "); + sql.append(" bpe.vicms00, "); + sql.append(" bpe.vbc20, "); + sql.append(" bpe.picms20, "); + sql.append(" bpe.vicms20, "); + sql.append(" bpe.vbp, "); + sql.append(" bpe.vdesconto, "); + sql.append(" bpe.vpgto, "); + sql.append(" bpe.tpcomp01, "); + sql.append(" bpe.tpcomp02, "); + sql.append(" bpe.tpcomp03, "); + sql.append(" bpe.tpcomp04, "); + sql.append(" bpe.tpcomp05, "); + sql.append(" bpe.tpcomp06, "); + sql.append(" bpe.tpcomp99, "); + sql.append(" bpe.vcomp01, "); + sql.append(" bpe.vcomp02, "); + sql.append(" bpe.vcomp03, "); + sql.append(" bpe.vcomp04, "); + sql.append(" bpe.vcomp05, "); + sql.append(" bpe.vcomp06, "); + sql.append(" bpe.vcomp99, "); + sql.append(" bpe.pRedBC "); + sql.append("from boleto c "); + sql.append(" join bpe bpe on c.boleto_id = bpe.boleto_id "); + sql.append(" and bpe.activo = (case when TO_CHAR(c.feccreacion, 'yyyymmdd') <> "); + sql.append(" to_char(to_date(substr(bpe.dhrecbto,0,10), 'YYYY-MM-DD'), 'yyyymmdd') then 0 else 1 end) "); + sql.append(" join estado e on e.codibge = bpe.uf "); + sql.append(" join marca ma on c.marca_id = ma.marca_id "); + sql.append(" join empresa ep on ma.empresa_id = ep.empresa_id "); + sql.append(" join ruta r on r.ruta_id = c.ruta_id "); + sql.append(" left join empresa_imposto ei on ei.empresa_id = ep.empresa_id and ei.estado_id = e.estado_id and ei.activo = 1 "); + sql.append("where c.activo = 1 and e.activo = 1 and ei.activo = 1 "); + sql.append(" and bpe.tipoamb = 1 and ep.activo = 1 "); + sql.append(" and bpe.codstat in ('-1','100','101','102','135','150') "); + sql.append(" and (bpe.tipoevento not in ('110115','110116') or bpe.tipoevento is null) "); + sql.append(" and c.feccreacion >= to_date(:DATE_INICIO,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and c.feccreacion <= to_date(:DATE_FIM,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and ep.empresa_id = :EMPRESA_ID "); + sql.append(" and e.cveestado in ( ").append(ufs).append(" ) "); + sql.append(" and (bpe.xmlregular is not null or bpe.xmlcontingencia is not null) "); + sql.append("order by numfoliosistema, num_bpe, datamov, tipoevento desc "); + return sql.toString(); + + } + + private String sqlRelatorioRDICanceladosSubstituidosNoXML(String ufs) { + + StringBuilder sql = new StringBuilder(); + sql.append("select /*+INDEX(BPE IDX__BPE_BOLETO)*/ "); + sql.append(" bori.boleto_id as cajaId, "); + sql.append(" 'DEV' as tipoReceita, "); + sql.append(" to_number(bori.num_bpe) as num_bpe, "); + sql.append(" to_number(bori.numfoliosistema) as numfoliosistema, "); + sql.append(" bori.numoperacion as numoperacion, "); + sql.append(" trunc(bori.feccreacion) as fechorVenta, "); + sql.append(" est_bpe.estado_id as estadoId, "); + sql.append(" est_bpe.cveestado as estadoOrigem, "); + sql.append(" ei.icms as icmsInterestadual, "); + sql.append(" ei.icmsim as icmsIntermunicipal, "); + sql.append(" 0 as isenta, "); + sql.append(" ei.porcredbaseicms as redBaseCalcIcms, "); + sql.append(" ei.porcredmunicipal as porcRedMunicipal, "); + sql.append(" ei.porcredestadual as porcRedEstadual, "); + sql.append(" ei.indtarifamunicipal as indtarifamunicipal, "); + sql.append(" ei.indseguromunicipal as indseguromunicipal, "); + sql.append(" ei.indtxembarquemunicipal as indtxembarquemunicipal, "); + sql.append(" ei.indpedagiomunicipal as indpedagiomunicipal, "); + sql.append(" ei.indtarifaestadual as indtarifaestadual, "); + sql.append(" ei.indseguroestadual as indseguroestadual, "); + sql.append(" ei.indtxembarqueestadual as indtxembarqueestadual, "); + sql.append(" ei.indpedagioestdual as indpedagioestdual, "); + sql.append(" ei.tributacaoImportacao as tributacaoImportacao, "); + sql.append(" coalesce(bori.preciopagado, 0) as tarifa, "); + sql.append(" coalesce(bori.importetaxaembarque, 0) as taxaEmbarque, "); + sql.append(" coalesce(bori.importepedagio, 0) as pedagio, "); + sql.append(" coalesce(bori.importeseguro, 0) as seguro, "); + sql.append(" coalesce(bori.importeoutros, 0) as outros, "); + sql.append(" to_char(trunc(bori.feccreacion), 'yyyymmdd') as datamov, "); + sql.append(" bpeori.chbpe, "); + sql.append(" bpe.codstat as codstatus, "); + sql.append(" case when bpe.ufini is not null then bpe.cmunini else bpeori.cmunini end as cmunini, "); + sql.append(" case when bpe.ufini is not null then bpe.cmunfim else bpeori.cmunfim end as cmunfim, "); + sql.append(" case when bpe.ufini is not null then bpe.ufini else bpeori.ufini end as ufini, "); + sql.append(" case when bpe.ufini is not null then bpe.uffim else bpeori.uffim end as uffim, "); + sql.append(" case when bpe.ufini is not null then bpe.nbp else bpeori.nbp end as nbp, "); + sql.append(" case when bpe.ufini is not null then bpe.dhemb else bpeori.dhemb end as dhemb, "); + sql.append(" case when bpe.ufini is not null then bpe.cst00 else bpeori.cst00 end as cst00, "); + sql.append(" case when bpe.ufini is not null then bpe.cst20 else bpeori.cst20 end as cst20, "); + sql.append(" case when bpe.ufini is not null then bpe.cst45 else bpeori.cst45 end as cst45, "); + sql.append(" case when bpe.ufini is not null then bpe.cst90 else bpeori.cst90 end as cst90, "); + sql.append(" case when bpe.ufini is not null then bpe.cstoutrauf else bpeori.cstoutrauf end as cstoutrauf, "); + sql.append(" case when bpe.ufini is not null then bpe.cstsn else bpeori.cstsn end as cstsn, "); + sql.append(" case when bpe.ufini is not null then bpe.vbc00 else bpeori.vbc00 end as vbc00, "); + sql.append(" case when bpe.ufini is not null then bpe.picms00 else bpeori.picms00 end as picms00, "); + sql.append(" case when bpe.ufini is not null then bpe.vicms00 else bpeori.vicms00 end as vicms00, "); + sql.append(" case when bpe.ufini is not null then bpe.vbc20 else bpeori.vbc20 end as vbc20, "); + sql.append(" case when bpe.ufini is not null then bpe.picms20 else bpeori.picms20 end as picms20, "); + sql.append(" case when bpe.ufini is not null then bpe.vicms20 else bpeori.vicms20 end as vicms20, "); + sql.append(" case when bpe.ufini is not null then bpe.vbp else bpeori.vbp end as vbp, "); + sql.append(" case when bpe.ufini is not null then bpe.vdesconto else bpeori.vdesconto end as vdesconto, "); + sql.append(" case when bpe.ufini is not null then bpe.vpgto else bpeori.vpgto end as vpgto, "); + sql.append(" case when bpe.ufini is not null then bpe.tpcomp01 else bpeori.tpcomp01 end as tpcomp01, "); + sql.append(" case when bpe.ufini is not null then bpe.tpcomp02 else bpeori.tpcomp02 end as tpcomp02, "); + sql.append(" case when bpe.ufini is not null then bpe.tpcomp03 else bpeori.tpcomp03 end as tpcomp03, "); + sql.append(" case when bpe.ufini is not null then bpe.tpcomp04 else bpeori.tpcomp04 end as tpcomp04, "); + sql.append(" case when bpe.ufini is not null then bpe.tpcomp05 else bpeori.tpcomp05 end as tpcomp05, "); + sql.append(" case when bpe.ufini is not null then bpe.tpcomp06 else bpeori.tpcomp06 end as tpcomp06, "); + sql.append(" case when bpe.ufini is not null then bpe.tpcomp99 else bpeori.tpcomp99 end as tpcomp99, "); + sql.append(" case when bpe.ufini is not null then bpe.vcomp01 else bpeori.vcomp01 end as vcomp01, "); + sql.append(" case when bpe.ufini is not null then bpe.vcomp02 else bpeori.vcomp02 end as vcomp02, "); + sql.append(" case when bpe.ufini is not null then bpe.vcomp03 else bpeori.vcomp03 end as vcomp03, "); + sql.append(" case when bpe.ufini is not null then bpe.vcomp04 else bpeori.vcomp04 end as vcomp04, "); + sql.append(" case when bpe.ufini is not null then bpe.vcomp05 else bpeori.vcomp05 end as vcomp05, "); + sql.append(" case when bpe.ufini is not null then bpe.vcomp06 else bpeori.vcomp06 end as vcomp06, "); + sql.append(" case when bpe.ufini is not null then bpe.vcomp99 else bpeori.vcomp99 end as vcomp99, "); + sql.append(" case when bpe.ufini is not null then bpe.predbc else bpeori.predbc end as predbc "); + sql.append("from boleto bori "); + sql.append(" inner join marca m on m.marca_id = bori.marca_id and m.activo = 1 "); + sql.append(" inner join empresa e on e.empresa_id = m.empresa_id "); + sql.append(" inner join bpe bpe on bpe.boleto_id = bori.boleto_id "); + sql.append(" and bpe.activo = (case when TO_CHAR(bori.feccreacion, 'yyyymmdd') <> "); + sql.append(" to_char(to_date(substr(bpe.dhrecbto,0,10), 'YYYY-MM-DD'), 'yyyymmdd') then 0 else 1 end) "); + sql.append(" inner join estado est_bpe on bpe.uf = est_bpe.codibge "); + sql.append(" left join bpe bpeori on bpeori.chbpe = bpe.chbpe_substituicao and bpeori.activo = 1 "); + sql.append(" left join boleto b on b.boleto_id = bpeori.boleto_id "); + sql.append(" inner join punto_venta ptv on ptv.puntoventa_id = b.puntoventa_id "); + sql.append(" join inscricao_estadual ie on e.empresa_id = ie.empresa_id and ie.estado_id = est_bpe.estado_id and ie.activo = 1 "); + sql.append(" join empresa_imposto ei on ei.empresa_id = e.empresa_id and ei.estado_id = est_bpe.estado_id and ei.activo = 1 "); + sql.append(" left join aidf aidf on aidf.aidf_id = b.aidf_id and b.tipoventa_id = 3 "); + sql.append(" left join estado esaidf on esaidf.estado_id = aidf.estado_id "); + sql.append(" left join boleto bant on bant.boleto_id = (case when bpeori.tipoevento is not null then coalesce(b.boletoanterior_id, b.boletooriginal_id) else null end) "); + sql.append(" left join bpe bpeant on bpeant.boleto_id = bant.boleto_id and bpeant.activo = 1 "); + sql.append(" left join punto_venta ptvo on ptvo.puntoventa_id = coalesce(bant.puntoventa_id, bori.puntoventa_id,b.ptovtaventa_id) "); + sql.append("where ( (bpe.codstat in ('-1','100','101','102','135','150') and bpe.chbpe_substituicao is not null) "); + sql.append(" or (bpe.codstat in ('101','135') and to_char(b.feccreacion, 'mm/yyyy') < to_char(bori.feccreacion, 'mm/yyyy')) ) "); + sql.append(" and (bpe.codstat in ('-1','100','101','102','135','150') and bpe.tipoevento not in ('110115','110116') or bpe.tipoevento is null) "); + sql.append(" and (bpeori.codstat in ('-1','100','101','102','135','150') and bpeori.tipoevento not in ('110115','110116') or bpeori.tipoevento is null) "); + sql.append(" and bori.feccreacion >= to_date(:DATE_INICIO,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and bori.feccreacion <= to_date(:DATE_FIM,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and est_bpe.cveestado in ( ").append(ufs).append(" ) "); + sql.append(" and e.empresa_id = :EMPRESA_ID "); + sql.append(" and (bpe.xmlregular is not null or bpe.xmlcontingencia is not null) "); + return sql.toString(); + + } + + private String sqlRelatorioRDICanceladosNoXML(String ufs) { + + StringBuilder sql = new StringBuilder(); + sql.append("select /*+INDEX(BPE IDX__BPE_BOLETO)*/ "); + sql.append(" b.boleto_id as cajaId, "); + sql.append(" 'DEV' as tipoReceita, "); + sql.append(" to_number(b.num_bpe) as num_bpe, "); + sql.append(" to_number(b.numfoliosistema) as numfoliosistema, "); + sql.append(" b.numoperacion as numoperacion, "); + sql.append(" trunc(bori.feccreacion) as fechorVenta, "); + sql.append(" est_bpe.estado_id as estadoId, "); + sql.append(" est_bpe.cveestado as estadoOrigem, "); + sql.append(" ei.icms as icmsInterestadual, "); + sql.append(" ei.icmsim as icmsIntermunicipal, "); + sql.append(" 0 as isenta, "); + sql.append(" ei.porcredbaseicms as redBaseCalcIcms, "); + sql.append(" ei.porcredmunicipal as porcRedMunicipal, "); + sql.append(" ei.porcredestadual as porcRedEstadual, "); + sql.append(" ei.indtarifamunicipal as indtarifamunicipal, "); + sql.append(" ei.indseguromunicipal as indseguromunicipal, "); + sql.append(" ei.indtxembarquemunicipal as indtxembarquemunicipal, "); + sql.append(" ei.indpedagiomunicipal as indpedagiomunicipal, "); + sql.append(" ei.indtarifaestadual as indtarifaestadual, "); + sql.append(" ei.indseguroestadual as indseguroestadual, "); + sql.append(" ei.indtxembarqueestadual as indtxembarqueestadual, "); + sql.append(" ei.indpedagioestdual as indpedagioestdual, "); + sql.append(" ei.tributacaoImportacao as tributacaoImportacao, "); + sql.append(" coalesce(b.preciopagado, 0) as tarifa, "); + sql.append(" coalesce(b.importetaxaembarque, 0) as taxaEmbarque, "); + sql.append(" coalesce(b.importepedagio, 0) as pedagio, "); + sql.append(" coalesce(b.importeseguro, 0) as seguro, "); + sql.append(" coalesce(b.importeoutros, 0) as outros, "); + sql.append(" to_char(trunc(bori.feccreacion), 'yyyymmdd') as datamov, "); + sql.append(" bpe.chbpe, "); + sql.append(" bpe.codstat as codstatus, "); + sql.append(" case when bpeori.ufini is not null then bpeori.cmunini else bpe.cmunini end as cmunini, "); + sql.append(" case when bpeori.ufini is not null then bpeori.cmunfim else bpe.cmunfim end as cmunfim, "); + sql.append(" case when bpeori.ufini is not null then bpeori.ufini else bpe.ufini end as ufini, "); + sql.append(" case when bpeori.ufini is not null then bpeori.uffim else bpe.uffim end as uffim, "); + sql.append(" case when bpeori.ufini is not null then bpeori.nbp else bpe.nbp end as nbp, "); + sql.append(" case when bpeori.ufini is not null then bpeori.dhemb else bpe.dhemb end as dhemb, "); + sql.append(" case when bpeori.ufini is not null then bpeori.cst00 else bpe.cst00 end as cst00, "); + sql.append(" case when bpeori.ufini is not null then bpeori.cst20 else bpe.cst20 end as cst20, "); + sql.append(" case when bpeori.ufini is not null then bpeori.cst45 else bpe.cst45 end as cst45, "); + sql.append(" case when bpeori.ufini is not null then bpeori.cst90 else bpe.cst90 end as cst90, "); + sql.append(" case when bpeori.ufini is not null then bpeori.cstoutrauf else bpe.cstoutrauf end as cstoutrauf, "); + sql.append(" case when bpeori.ufini is not null then bpeori.cstsn else bpe.cstsn end as cstsn, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vbc00 else bpe.vbc00 end as vbc00, "); + sql.append(" case when bpeori.ufini is not null then bpeori.picms00 else bpe.picms00 end as picms00, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vicms00 else bpe.vicms00 end as vicms00, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vbc20 else bpe.vbc20 end as vbc20, "); + sql.append(" case when bpeori.ufini is not null then bpeori.picms20 else bpe.picms20 end as picms20, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vicms20 else bpe.vicms20 end as vicms20, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vbp else bpe.vbp end as vbp, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vdesconto else bpe.vdesconto end as vdesconto, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vpgto else bpe.vpgto end as vpgto, "); + sql.append(" case when bpeori.ufini is not null then bpeori.tpcomp01 else bpe.tpcomp01 end as tpcomp01, "); + sql.append(" case when bpeori.ufini is not null then bpeori.tpcomp02 else bpe.tpcomp02 end as tpcomp02, "); + sql.append(" case when bpeori.ufini is not null then bpeori.tpcomp03 else bpe.tpcomp03 end as tpcomp03, "); + sql.append(" case when bpeori.ufini is not null then bpeori.tpcomp04 else bpe.tpcomp04 end as tpcomp04, "); + sql.append(" case when bpeori.ufini is not null then bpeori.tpcomp05 else bpe.tpcomp05 end as tpcomp05, "); + sql.append(" case when bpeori.ufini is not null then bpeori.tpcomp06 else bpe.tpcomp06 end as tpcomp06, "); + sql.append(" case when bpeori.ufini is not null then bpeori.tpcomp99 else bpe.tpcomp99 end as tpcomp99, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vcomp01 else bpe.vcomp01 end as vcomp01, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vcomp02 else bpe.vcomp02 end as vcomp02, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vcomp03 else bpe.vcomp03 end as vcomp03, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vcomp04 else bpe.vcomp04 end as vcomp04, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vcomp05 else bpe.vcomp05 end as vcomp05, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vcomp06 else bpe.vcomp06 end as vcomp06, "); + sql.append(" case when bpeori.ufini is not null then bpeori.vcomp99 else bpe.vcomp99 end as vcomp99, "); + sql.append(" case when bpeori.ufini is not null then bpeori.predbc else bpe.predbc end as predbc "); + sql.append("from boleto bori "); + sql.append(" inner join marca m on m.marca_id = bori.marca_id and m.activo = 1 "); + sql.append(" inner join empresa e on e.empresa_id = m.empresa_id "); + sql.append(" inner join bpe bpe on bpe.boleto_id = bori.boleto_id "); + sql.append(" and bpe.activo = (case when TO_CHAR(bori.feccreacion, 'yyyymmdd') <> "); + sql.append(" to_char(to_date(substr(bpe.dhrecbto,0,10), 'YYYY-MM-DD'), 'yyyymmdd') then 0 else 1 end) "); + sql.append(" inner join estado est_bpe on bpe.uf = est_bpe.codibge "); + sql.append(" left join boleto b on b.boleto_id = coalesce(bori.boletoanterior_id, bori.boletooriginal_id) "); + sql.append(" left join bpe bpeori on b.boleto_id = bpeori.boleto_id and bpeori.activo = 1 "); + sql.append(" inner join punto_venta ptv on ptv.puntoventa_id = bori.puntoventa_id "); + sql.append("join inscricao_estadual ie on e.empresa_id = ie.empresa_id and ie.estado_id = est_bpe.estado_id and ie.activo = 1 "); + sql.append("join empresa_imposto ei on ei.empresa_id = e.empresa_id and ei.estado_id = est_bpe.estado_id and ei.activo = 1 "); + sql.append("left join aidf aidf on aidf.aidf_id = b.aidf_id and b.tipoventa_id = 3 "); + sql.append("left join estado esaidf on esaidf.estado_id = aidf.estado_id "); + sql.append("left join punto_venta ptvo on ptvo.puntoventa_id = coalesce(b.ptovtaventa_id, bori.puntoventa_id) "); + sql.append("where "); + sql.append(" (bpe.codstat in ('101','135') and to_char(b.feccreacion, 'mm/yyyy') < to_char(bori.feccreacion, 'mm/yyyy')) "); + sql.append(" and (bpe.codstat in ('-1','100','101','102','135','150') and bpe.tipoevento not in ('110115','110116') or bpe.tipoevento is null) "); + sql.append(" and (bpeori.codstat in ('-1','100','101','102','135','150') and bpeori.tipoevento not in ('110115','110116') or bpeori.tipoevento is null) "); + sql.append(" and bori.feccreacion >= to_date(:DATE_INICIO,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and bori.feccreacion <= to_date(:DATE_FIM,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and est_bpe.cveestado in ( ").append(ufs).append(" ) "); + sql.append(" and e.empresa_id = :EMPRESA_ID "); + sql.append(" and (bpe.xmlregular is not null or bpe.xmlcontingencia is not null) "); + + sql.append("order by numfoliosistema, num_bpe, datamov "); + + System.out.println(sql.toString()); + return sql.toString(); + } + + @Deprecated + private List calcularRelatorioRDIXML(List list, boolean isReceitaTerceiros) { + + List rdis = new ArrayList(); + + BigDecimal aliquotaAnt = null; + for (DetalhadoFiscal det : list) { + + String xml = det.getXml(); + + BigDecimal tarifa = BigDecimal.ZERO; + BigDecimal taxaEmbarque = BigDecimal.ZERO; + BigDecimal pedagio = BigDecimal.ZERO; + BigDecimal seguro = BigDecimal.ZERO; + BigDecimal passagem = BigDecimal.ZERO; + BigDecimal isentos = BigDecimal.ZERO; + + boolean isEstadual = det.isInterEstadual(); + String tipoViagem = isEstadual ? "IE" : "IM"; + + TBPe tbpe = null; + if (StringUtils.isNotBlank(xml)) + tbpe = BPeUtil.convertXmlToBpe(xml); + + String vBC = null; + String pICMS = null; + String vICMS = null; + String pRedBC = null; + + if (StringUtils.isNotBlank(xml)) { + if (tbpe.getInfBPe().getImp().getICMS().getICMS00() != null) { + vBC = tbpe.getInfBPe().getImp().getICMS().getICMS00().getVBC(); + pICMS = tbpe.getInfBPe().getImp().getICMS().getICMS00().getPICMS(); + vICMS = tbpe.getInfBPe().getImp().getICMS().getICMS00().getVICMS(); + } else if (tbpe.getInfBPe().getImp().getICMS().getICMS20() != null) { + vBC = tbpe.getInfBPe().getImp().getICMS().getICMS20().getVBC(); + pICMS = tbpe.getInfBPe().getImp().getICMS().getICMS20().getPICMS(); + vICMS = tbpe.getInfBPe().getImp().getICMS().getICMS20().getVICMS(); + pRedBC = tbpe.getInfBPe().getImp().getICMS().getICMS20().getPRedBC(); + } + + if (tbpe.getInfBPe().getInfValorBPe() != null) { + + String vPgto = tbpe.getInfBPe().getInfValorBPe().getVPgto(); + passagem = new BigDecimal(vPgto == null ? "0.0" : vPgto); + + for (TBPe.InfBPe.InfValorBPe.Comp comp : tbpe.getInfBPe().getInfValorBPe().getComp()) { + if (comp.getTpComp().equals(TipoComp.TARIFA)) { + String vDesconto = tbpe.getInfBPe().getInfValorBPe().getVDesconto(); + tarifa = new BigDecimal(comp.getVComp() == null ? "0.0" : comp.getVComp()); + tarifa = tarifa.subtract(new BigDecimal(vDesconto == null ? "0.0" : vDesconto)); + } + + if (comp.getTpComp().equals(TipoComp.PEDAGIO)) { + pedagio = isReceitaTerceiros ? new BigDecimal(det.getVcomp02() == null ? "0.0" : det.getVcomp02()) : BigDecimal.ZERO; + BigDecimal pedagioIsento = isEstadual && !det.getIndPedagioEstdual() ? pedagio : BigDecimal.ZERO; + if (pedagioIsento.compareTo(BigDecimal.ZERO) == 0) + pedagioIsento = !isEstadual && !det.getIndPedagioMunicipal() ? pedagio : BigDecimal.ZERO; + + isentos = isentos.add(pedagioIsento); + } + + if (comp.getTpComp().equals(TipoComp.TAXA_EMBARQUE)) { + taxaEmbarque = isReceitaTerceiros ? new BigDecimal(det.getVcomp03() == null ? "0.0" : det.getVcomp03()) : BigDecimal.ZERO; + BigDecimal taxaEmbarqueIsento = isEstadual && !det.getIndTxembarqueEstadual() ? taxaEmbarque : BigDecimal.ZERO; + if (taxaEmbarqueIsento.compareTo(BigDecimal.ZERO) == 0) + taxaEmbarqueIsento = !isEstadual && !det.getIndTxembarqueMunicipal() ? taxaEmbarque : BigDecimal.ZERO; + + isentos = isentos.add(taxaEmbarqueIsento); + } + + if (comp.getTpComp().equals(TipoComp.SEGURO)) { + seguro = isReceitaTerceiros ? new BigDecimal(det.getVcomp04() == null ? "0.0" : det.getVcomp04()) : BigDecimal.ZERO; + BigDecimal seguroIsento = isEstadual && !det.getIndSeguroEstadual() ? seguro : BigDecimal.ZERO; + if (seguroIsento.compareTo(BigDecimal.ZERO) == 0) + seguroIsento = isEstadual && !det.getIndSeguroEstadual() ? seguro : BigDecimal.ZERO; + + isentos = isentos.add(seguroIsento); + } + } + } + } + + BigDecimal baseCalculo = new BigDecimal(vBC == null ? "0.0" : vBC); + + BigDecimal aliquota = new BigDecimal(pICMS == null ? "0.0" : pICMS); + aliquota = (aliquota.intValue() == 0 ? (aliquotaAnt == null ? aliquota : aliquotaAnt) : aliquota); + if (aliquota != null && aliquota.intValue() > 0) + aliquotaAnt = aliquota; + + BigDecimal icms = new BigDecimal(vICMS == null ? "0.0" : vICMS); + + BigDecimal cp = null; + if (isEstadual) { + cp = det.getPorcRedEstadual() == null ? BigDecimal.ZERO : det.getPorcRedEstadual(); + } else { + cp = det.getPorcRedMunicipal() == null ? BigDecimal.ZERO : det.getPorcRedMunicipal(); + } + + BigDecimal credPres = icms.multiply(cp.divide(BigDecimal.TEN.multiply(BigDecimal.TEN))); + BigDecimal icmsRec = icms.subtract(credPres); + BigDecimal vRedBC = det.getRedBaseCalcIcms(); + + BigDecimal outros = isentos.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : passagem.subtract(isentos).subtract(baseCalculo); + if (pRedBC != null) { + outros = passagem.subtract(baseCalculo); + outros = outros.subtract(isentos); + } + + rdis.add(new FiscalRdi(det.getEstadoOrigem(), tipoViagem, det.getTipoReceita(), tarifa, + seguro, taxaEmbarque, pedagio, passagem, isentos, outros, vRedBC, + baseCalculo, aliquota, icms, cp, credPres, icmsRec)); + } + + return rdis; + } + + @Deprecated + private List montaRelatorioRDIXML(Connection connection, Date inicio, Date fim, Integer empresaId, String ufs, String sql) { + + List list = new ArrayList(); + try { + + NamedParameterStatement ps = new NamedParameterStatement(connection, sql); + ps.setLong("EMPRESA_ID", Long.valueOf(empresaId)); + + ps.setTimestamp("DATE_INICIO", new java.sql.Timestamp(DateUtil.inicioFecha(inicio).getTime())); + ps.setTimestamp("DATE_FIM", new java.sql.Timestamp(DateUtil.fimFecha(fim).getTime())); + + ResultSet rs = ps.executeQuery(); + while (rs.next()) { + + String xml_bpe = rs.getNString("xml_bpe"); + String xml_bpe_2 = rs.getNString("xml_bpe_2"); + String xml_bpe_3 = rs.getNString("xml_bpe_3"); + String xml = StringUtils.join(new String[] { xml_bpe, xml_bpe_2, xml_bpe_3 }); + + TBPe tbpe = null; + if (StringUtils.isNotBlank(xml)) + tbpe = BPeUtil.convertXmlToBpe(xml); + + DetalhadoFiscal df = new DetalhadoFiscal(); + df.setXml(xml); + + String municipioOrigem = StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getCMunIni() : rs.getString("municipioOrigem"); + String estadoOrigem = (StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getUFIni().value() : rs.getString("estadoOrigem")); + String estadoDestino = (StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getUFFim().value() : rs.getString("estadoDestino")); + + boolean isInterEstadual = !estadoOrigem.equals(estadoDestino); + df.setEstadoOrigem(estadoOrigem); + df.setEstadoDestino(estadoDestino); + df.setMunicipioOrigem(municipioOrigem); + df.setInterEstadual(isInterEstadual); + df.setCajaId(rs.getLong("cajaId")); + df.setTipoReceita(rs.getString("tipoReceita")); + df.setNumoperacion(rs.getString("numoperacion")); + df.setEstadoId(rs.getInt("estadoId")); + df.setFechorVenta(rs.getDate("fechorVenta")); + df.setIcmsInterestadual(rs.getBigDecimal("icmsInterestadual")); + df.setIcmsIntermunicipal(rs.getBigDecimal("icmsIntermunicipal")); + df.setIcmsInterestadual(rs.getBigDecimal("icmsInterestadual")); + df.setRedBaseCalcIcms(rs.getBigDecimal("redBaseCalcIcms")); + df.setPorcRedMunicipal(rs.getBigDecimal("porcRedMunicipal")); + df.setPorcRedEstadual(rs.getBigDecimal("porcRedEstadual")); + df.setTributacaoImportacao(rs.getBigDecimal("tributacaoImportacao")); + df.setIndTarifaMunicipal(rs.getBoolean("indtarifamunicipal")); + df.setIndSeguroMunicipal(rs.getBoolean("indseguromunicipal")); + df.setIndTxembarqueMunicipal(rs.getBoolean("indtxembarquemunicipal")); + df.setIndPedagioMunicipal(rs.getBoolean("indpedagiomunicipal")); + df.setIndTarifaEstadual(rs.getBoolean("indtarifaestadual")); + df.setIndSeguroEstadual(rs.getBoolean("indseguroestadual")); + df.setIndTxembarqueEstadual(rs.getBoolean("indtxembarqueestadual")); + df.setIndPedagioEstdual(rs.getBoolean("indpedagioestdual")); + df.setIsenta(rs.getBoolean("isenta")); + df.setTarifa(rs.getBigDecimal("tarifa")); + df.setTaxaEmbarque(rs.getBigDecimal("taxaEmbarque")); + df.setPedagio(rs.getBigDecimal("pedagio")); + df.setSeguro(rs.getBigDecimal("seguro")); + df.setOutros(rs.getBigDecimal("outros")); + df.setDatamov(rs.getString("datamov")); + list.add(df); + } + + rs.close(); + ps.close(); + + } catch (SQLException e) { + log.error("", e); + } + + return list; + } + + @Deprecated + private String sqlRelatorioRDIVendidosXML(String ufs) { + + StringBuilder sql = new StringBuilder(); + sql.append("select "); + sql.append(" c.boleto_id as cajaId, "); + sql.append(" 'REC' as tipoReceita, "); + sql.append(" c.numoperacion as numoperacion, "); + sql.append(" trunc(c.feccreacion) as fechorVenta, "); + sql.append(" e.estado_id as estadoId, "); + sql.append(" ei.icms as icmsInterestadual, "); + sql.append(" ei.icmsim as icmsIntermunicipal, "); + sql.append(" e.cveestado as estadoOrigem, "); + sql.append(" ed.cveestado as estadoDestino, "); + sql.append(" co.codibge as municipioOrigem, "); + sql.append(" case when (e.cveestado = ed.cveestado) then 0 else 1 end as isInterEstadual, "); + sql.append(" 0 as isenta, "); + sql.append(" ei.porcredbaseicms as redBaseCalcIcms, "); + sql.append(" ei.porcredmunicipal as porcRedMunicipal, "); + sql.append(" ei.porcredestadual as porcRedEstadual, "); + sql.append(" ei.indtarifamunicipal as indtarifamunicipal, "); + sql.append(" ei.indseguromunicipal as indseguromunicipal, "); + sql.append(" ei.indtxembarquemunicipal as indtxembarquemunicipal, "); + sql.append(" ei.indpedagiomunicipal as indpedagiomunicipal, "); + sql.append(" ei.indtarifaestadual as indtarifaestadual, "); + sql.append(" ei.indseguroestadual as indseguroestadual, "); + sql.append(" ei.indtxembarqueestadual as indtxembarqueestadual, "); + sql.append(" ei.indpedagioestdual as indpedagioestdual, "); + sql.append(" ei.tributacaoImportacao as tributacaoImportacao, "); + sql.append(" coalesce(c.preciopagado, 0) as tarifa, "); + sql.append(" coalesce(c.importetaxaembarque, 0) as taxaEmbarque, "); + sql.append(" coalesce(c.importepedagio, 0) as pedagio, "); + sql.append(" coalesce(c.importeseguro, 0) as seguro, "); + sql.append(" coalesce(c.importeoutros, 0) as outros, "); + sql.append(" to_char(trunc(c.feccreacion), 'yyyymmdd') as datamov, "); + sql.append(" DBMS_LOB.substr(coalesce(bpe.xmlregular, bpe.xmlcontingencia), 3000) as xml_bpe, "); + sql.append(" DBMS_LOB.substr(coalesce(bpe.xmlregular, bpe.xmlcontingencia), 3000, 3001) as xml_bpe_2, "); + sql.append(" DBMS_LOB.substr(coalesce(bpe.xmlregular, bpe.xmlcontingencia), 3000, 6001) as xml_bpe_3 "); + sql.append("from boleto c "); + sql.append(" join bpe bpe on c.boleto_id = bpe.boleto_id "); + sql.append(" and bpe.activo = (case when c.motivocancelacion_id = 17 and c.boletooriginal_id is null then 0 else 1 end) "); + sql.append(" left join bpe bpecan on bpecan.chbpe = bpe.chbpe and bpecan.codstat in ('101','135') and bpe.codstat = '100' "); + sql.append(" and (bpecan.tipoevento = '110111' or bpecan.tipoevento is null) and bpecan.activo = 1 "); + sql.append(" join estado e on e.codibge = bpe.uf "); + sql.append(" join marca ma on c.marca_id = ma.marca_id "); + sql.append(" join empresa ep on ma.empresa_id = ep.empresa_id "); + sql.append(" join ruta r on r.ruta_id = c.ruta_id "); + sql.append(" left join alias_servico ase on ase.origen_id = c.origen_id "); + sql.append(" and ase.destino_id = c.destino_id and ase.ruta_id = c.ruta_id and ase.activo = 1 and ase.corrida_id is null and ase.activo = 1 "); + sql.append(" inner join parada o on coalesce(ase.aliasorigen_id, c.origen_id) = o.parada_id "); + sql.append(" inner join ciudad co on o.ciudad_id = co.ciudad_id "); + sql.append(" inner join estado eo on eo.estado_id = co.estado_id "); + sql.append(" inner join parada d on coalesce(ase.aliasdestino_id, c.destino_id) = d.parada_id "); + sql.append(" inner join ciudad cd on d.ciudad_id = cd.ciudad_id "); + sql.append(" inner join estado ed on ed.estado_id = cd.estado_id "); + sql.append(" left join empresa_imposto ei on ei.empresa_id = ep.empresa_id and ei.estado_id = e.estado_id and ei.activo = 1 "); + sql.append("where c.activo = 1 and bpe.tipoamb = 1 and bpe.codstat in ('-1','100','102','150') "); + sql.append(" and (bpe.fecmodif < (case when (to_char(bpe.fecmodif, 'mm/yyyy') <> to_char(bpecan.fecmodif, 'mm/yyyy') ) "); + sql.append(" then bpecan.fecmodif else bpe.fecmodif end) or bpecan.fecmodif is null) "); + sql.append(" and c.feccreacion >= :DATE_INICIO "); + sql.append(" and c.feccreacion <= :DATE_FIM "); + sql.append(" and ep.empresa_id = :EMPRESA_ID "); + sql.append(" and (bpe.xmlregular is not null or bpe.xmlcontingencia is not null) "); + sql.append(" and e.cveestado in ( ").append(ufs).append(" ) "); + + return sql.toString(); + } + + @Deprecated + private String sqlRelatorioRDICanceladosXML(String ufs) { + + StringBuilder sql = new StringBuilder(); + sql.append("select "); + sql.append(" b.boleto_id as cajaId, "); + sql.append(" 'DEV' as tipoReceita, "); + sql.append(" b.numoperacion as numoperacion, "); + sql.append(" trunc(bori.feccreacion) as fechorVenta, "); + sql.append(" est_bpe.estado_id as estadoId, "); + sql.append(" ei.icms as icmsInterestadual, "); + sql.append(" ei.icmsim as icmsIntermunicipal, "); + sql.append(" est_bpe.cveestado as estadoOrigem, "); + sql.append(" eds.cveestado as estadoDestino, "); + sql.append(" co.codibge as municipioOrigem, "); + sql.append(" case when (est_bpe.cveestado = eds.cveestado) then 0 else 1 end as isInterEstadual, "); + sql.append(" 0 as isenta, "); + sql.append(" ei.porcredbaseicms as redBaseCalcIcms, "); + sql.append(" ei.porcredmunicipal as porcRedMunicipal, "); + sql.append(" ei.porcredestadual as porcRedEstadual, "); + sql.append(" ei.indtarifamunicipal as indtarifamunicipal, "); + sql.append(" ei.indseguromunicipal as indseguromunicipal, "); + sql.append(" ei.indtxembarquemunicipal as indtxembarquemunicipal, "); + sql.append(" ei.indpedagiomunicipal as indpedagiomunicipal, "); + sql.append(" ei.indtarifaestadual as indtarifaestadual, "); + sql.append(" ei.indseguroestadual as indseguroestadual, "); + sql.append(" ei.indtxembarqueestadual as indtxembarqueestadual, "); + sql.append(" ei.indpedagioestdual as indpedagioestdual, "); + sql.append(" ei.tributacaoImportacao as tributacaoImportacao, "); + sql.append(" coalesce(b.preciopagado, 0) as tarifa, "); + sql.append(" coalesce(b.importetaxaembarque, 0) as taxaEmbarque, "); + sql.append(" coalesce(b.importepedagio, 0) as pedagio, "); + sql.append(" coalesce(b.importeseguro, 0) as seguro, "); + sql.append(" coalesce(b.importeoutros, 0) as outros, "); + sql.append(" to_char(trunc(bori.feccreacion), 'yyyymmdd') as datamov, "); + sql.append(" dbms_lob.substr((case when bpeori.tipoevento is not null then bpeant.xmlregular else bpeori.xmlregular end), 3000) as xml_bpe, "); + sql.append(" dbms_lob.substr((case when bpeori.tipoevento is not null then bpeant.xmlregular else bpeori.xmlregular end), 3000, 3001) as xml_bpe_2, "); + sql.append(" dbms_lob.substr((case when bpeori.tipoevento is not null then bpeant.xmlregular else bpeori.xmlregular end), 3000, 6001) as xml_bpe_3 "); + sql.append("from boleto bori "); + sql.append(" inner join marca m on m.marca_id = bori.marca_id and m.activo = 1 "); + sql.append(" inner join empresa e on e.empresa_id = m.empresa_id "); + sql.append(" inner join bpe bpe on bpe.boleto_id = bori.boleto_id "); + sql.append(" and bpe.activo = (case when bori.motivocancelacion_id = 17 and bori.boletooriginal_id is null then 0 else 1 end) "); + sql.append(" inner join estado est_bpe on bpe.uf = est_bpe.codibge "); + sql.append(" left join bpe bpeori on bpeori.chbpe = bpe.chbpe_substituicao "); + sql.append(" and bpeori.activo = (case when bori.motivocancelacion_id = 17 and bori.boletooriginal_id is null then 0 else 1 end) "); + sql.append(" left join boleto b on b.boleto_id = bpeori.boleto_id "); + sql.append(" inner join punto_venta ptv on ptv.puntoventa_id = b.puntoventa_id "); + sql.append(" inner join parada ori on (b.origen_id = ori.parada_id ) "); + sql.append(" inner join parada des on (b.destino_id = des.parada_id ) "); + sql.append(" inner join ciudad co on (co.ciudad_id = ori.ciudad_id ) "); + sql.append(" inner join ciudad cd on (cd.ciudad_id = des.ciudad_id ) "); + sql.append(" inner join estado est on est.estado_id = co.estado_id "); + sql.append(" left join alias_servico s on s.origen_id = b.origen_id "); + sql.append(" and s.destino_id = b.destino_id and (s.corrida_id = b.corrida_id or s.corrida_id is null) "); + sql.append(" and s.ruta_id = b.ruta_id "); + sql.append(" left join parada pos on pos.parada_id = s.aliasorigen_id "); + sql.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id "); + sql.append(" left join estado eos on eos.estado_id = cos.estado_id "); + sql.append(" left join parada pds on pds.parada_id = s.aliasdestino_id "); + sql.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id "); + sql.append(" left join estado eds on eds.estado_id = cds.estado_id "); + sql.append(" join inscricao_estadual ie on e.empresa_id = ie.empresa_id "); + sql.append(" and ie.estado_id = coalesce(eos.estado_id, est.estado_id) and ie.activo = 1 "); + sql.append(" join empresa_imposto ei on ei.empresa_id = e.empresa_id "); + sql.append(" and ei.estado_id = coalesce(eos.estado_id, est.estado_id) and ei.activo = 1 "); + sql.append(" left join aidf aidf on aidf.aidf_id = b.aidf_id and b.tipoventa_id = 3 "); + sql.append(" left join estado esaidf on esaidf.estado_id = aidf.estado_id "); + sql.append(" left join boleto bant on bant.boleto_id = (case when bpeori.tipoevento is not null then coalesce(b.boletoanterior_id, b.boletooriginal_id) else null end) "); + sql.append(" left join bpe bpeant on bpeant.boleto_id = bant.boleto_id "); + sql.append(" left join punto_venta ptvo on ptvo.puntoventa_id = coalesce(bant.puntoventa_id, bori.puntoventa_id,b.ptovtaventa_id) "); + sql.append("where ( (bpe.codstat in ('-1','100','101','102','135','150') and bpe.chbpe_substituicao is not null) "); + sql.append(" or (bpe.codstat in ('101','135') and to_char(b.feccreacion, 'mm/yyyy') < to_char(bori.feccreacion, 'mm/yyyy')) ) "); + sql.append(" and (bpe.codstat in ('-1','100','101','102','135','150') and bpe.tipoevento <> '110115' or bpe.tipoevento is null) "); + sql.append(" and (bpeori.codstat in ('-1','100','101','102','135','150') and bpeori.tipoevento <> '110115' or bpeori.tipoevento is null) "); + sql.append(" and bori.feccreacion >= :DATE_INICIO "); + sql.append(" and bori.feccreacion <= :DATE_FIM "); + sql.append(" and est_bpe.cveestado in ( ").append(ufs).append(" ) "); + sql.append(" and e.empresa_id = :EMPRESA_ID "); + sql.append(" "); + sql.append(" union all "); + sql.append(" "); + sql.append("select "); + sql.append(" b.boleto_id as cajaId, "); + sql.append(" 'DEV' as tipoReceita, "); + sql.append(" b.numoperacion as numoperacion, "); + sql.append(" trunc(bori.feccreacion) as fechorVenta, "); + sql.append(" est_bpe.estado_id as estadoId, "); + sql.append(" ei.icms as icmsInterestadual, "); + sql.append(" ei.icmsim as icmsIntermunicipal, "); + sql.append(" est_bpe.cveestado as estadoOrigem, "); + sql.append(" eds.cveestado as estadoDestino, "); + sql.append(" co.codibge as municipioOrigem, "); + sql.append(" case when (est_bpe.cveestado = eds.cveestado) then 0 else 1 end as isInterEstadual, "); + sql.append(" 0 as isenta, "); + sql.append(" ei.porcredbaseicms as redBaseCalcIcms, "); + sql.append(" ei.porcredmunicipal as porcRedMunicipal, "); + sql.append(" ei.porcredestadual as porcRedEstadual, "); + sql.append(" ei.indtarifamunicipal as indtarifamunicipal, "); + sql.append(" ei.indseguromunicipal as indseguromunicipal, "); + sql.append(" ei.indtxembarquemunicipal as indtxembarquemunicipal, "); + sql.append(" ei.indpedagiomunicipal as indpedagiomunicipal, "); + sql.append(" ei.indtarifaestadual as indtarifaestadual, "); + sql.append(" ei.indseguroestadual as indseguroestadual, "); + sql.append(" ei.indtxembarqueestadual as indtxembarqueestadual, "); + sql.append(" ei.indpedagioestdual as indpedagioestdual, "); + sql.append(" ei.tributacaoImportacao as tributacaoImportacao, "); + sql.append(" coalesce(b.preciopagado, 0) as tarifa, "); + sql.append(" coalesce(b.importetaxaembarque, 0) as taxaEmbarque, "); + sql.append(" coalesce(b.importepedagio, 0) as pedagio, "); + sql.append(" coalesce(b.importeseguro, 0) as seguro, "); + sql.append(" coalesce(b.importeoutros, 0) as outros, "); + sql.append(" to_char(trunc(bori.feccreacion), 'yyyymmdd') as datamov, "); + sql.append(" dbms_lob.substr((case when bpeori.tipoevento is not null then bpeant.xmlregular else bpeori.xmlregular end), 3000) as xml_bpe, "); + sql.append(" dbms_lob.substr((case when bpeori.tipoevento is not null then bpeant.xmlregular else bpeori.xmlregular end), 3000, 3001) as xml_bpe_2, "); + sql.append(" dbms_lob.substr((case when bpeori.tipoevento is not null then bpeant.xmlregular else bpeori.xmlregular end), 3000, 6001) as xml_bpe_3 "); + sql.append("from boleto bori "); + sql.append(" inner join marca m on m.marca_id = bori.marca_id and m.activo = 1 "); + sql.append(" inner join empresa e on e.empresa_id = m.empresa_id "); + sql.append(" inner join bpe bpe on bpe.boleto_id = bori.boleto_id "); + sql.append(" and bpe.activo = (case when bori.motivocancelacion_id = 17 and bori.boletooriginal_id is null then 0 else 1 end) "); + sql.append(" inner join estado est_bpe on bpe.uf = est_bpe.codibge "); + sql.append(" left join boleto b on b.boleto_id = (case when bori.motivocancelacion_id = 99 then bori.boletoanterior_id else bori.boletooriginal_id end) "); + sql.append(" left join bpe bpeori on b.boleto_id = bpeori.boleto_id "); + sql.append(" and bpeori.activo = (case when bori.motivocancelacion_id = 17 and bori.boletooriginal_id is null then 0 else 1 end) "); + sql.append(" inner join punto_venta ptv on ptv.puntoventa_id = bori.puntoventa_id "); + sql.append(" inner join parada ori on (b.origen_id = ori.parada_id ) "); + sql.append(" inner join parada des on (b.destino_id = des.parada_id ) "); + sql.append(" inner join ciudad co on (co.ciudad_id = ori.ciudad_id ) "); + sql.append(" inner join ciudad cd on (cd.ciudad_id = des.ciudad_id ) "); + sql.append(" inner join estado est on est.estado_id = co.estado_id "); + sql.append("left join alias_servico s on s.origen_id = b.origen_id "); + sql.append(" and s.destino_id = b.destino_id and (s.corrida_id = b.corrida_id or s.corrida_id is null) "); + sql.append(" and s.ruta_id = b.ruta_id and s.activo = 1 "); + sql.append("left join parada pos on pos.parada_id = s.aliasorigen_id "); + sql.append("left join ciudad cos on cos.ciudad_id = pos.ciudad_id "); + sql.append("left join estado eos on eos.estado_id = cos.estado_id "); + sql.append("left join parada pds on pds.parada_id = s.aliasdestino_id "); + sql.append("left join ciudad cds on cds.ciudad_id = pds.ciudad_id "); + sql.append("left join estado eds on eds.estado_id = cds.estado_id "); + sql.append("join inscricao_estadual ie on e.empresa_id = ie.empresa_id "); + sql.append(" and ie.estado_id = coalesce(eos.estado_id, est.estado_id) and ie.activo = 1 "); + sql.append("join empresa_imposto ei on ei.empresa_id = e.empresa_id "); + sql.append(" and ei.estado_id = coalesce(eos.estado_id, est.estado_id) and ei.activo = 1 "); + sql.append("left join aidf aidf on aidf.aidf_id = b.aidf_id and b.tipoventa_id = 3 "); + sql.append("left join estado esaidf on esaidf.estado_id = aidf.estado_id "); + sql.append("left join boleto bant on bant.boleto_id = (case when bpeori.tipoevento is not null then coalesce(b.boletoanterior_id, b.boletooriginal_id) else null end) "); + sql.append("left join bpe bpeant on bpeant.boleto_id = bant.boleto_id "); + sql.append(" and bpeant.activo = (case when bori.motivocancelacion_id = 17 and bori.boletooriginal_id is null then 0 else 1 end) "); + sql.append("left join punto_venta ptvo on ptvo.puntoventa_id = coalesce(bant.puntoventa_id, bori.puntoventa_id,b.ptovtaventa_id) "); + sql.append("where "); + sql.append(" (bpe.codstat in ('101','135') and to_char(b.feccreacion, 'mm/yyyy') < to_char(bori.feccreacion, 'mm/yyyy')) "); + sql.append(" and (bpe.codstat in ('-1','100','101','102','135','150') and bpe.tipoevento <> '110115' or bpe.tipoevento is null) "); + sql.append(" and (bpeori.codstat in ('-1','100','101','102','135','150') and bpeori.tipoevento <> '110115' or bpeori.tipoevento is null) "); + sql.append(" and bori.feccreacion >= :DATE_INICIO "); + sql.append(" and bori.feccreacion <= :DATE_FIM "); + sql.append(" and est_bpe.cveestado in ( ").append(ufs).append(" ) "); + sql.append(" and e.empresa_id = :EMPRESA_ID "); + + sql.append("order by estadoId, isInterEstadual "); + + return sql.toString(); + } + + @Override + public List buscarBPeRejeitadosContingencia(Integer empresaId, String numBpe, String chbpe, Date dtVendaInicio, Date dtVendaFim, List estados, List codigosRejeicoes) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("select bpe.bpe_id bpeId, bpe.codstat, bpe.chbpe, b.num_bpe numBpe, b.numserie_bpe numserieBpe, e.cveestado uf, bpe.motivo, ") + .append("bpe.errocontingencia, b.fechorventa, em.nombempresa ") + .append("from bpe bpe ") + .append("join boleto b on b.boleto_id = bpe.boleto_id ") + .append("join marca m on m.marca_id = b.marca_id ") + .append("left join estado e on e.codibge = bpe.uf ") + .append("join empresa em on em.empresa_id = m.empresa_id ") + .append("where bpe.activo = 1 ") + .append("and b.activo = 1 ") + .append("and bpe.codstat in ('-10','-20') "); + + if(empresaId != null) { + sQuery.append("and m.empresa_id = :empresaId "); + } + if(StringUtils.isNotBlank(numBpe)) { + sQuery.append("and b.num_bpe = :numBpe "); + } + if(StringUtils.isNotBlank(chbpe)) { + sQuery.append("and bpe.chbpe = :chbpe "); + } + if(dtVendaInicio != null && dtVendaFim != null) { + sQuery.append("and b.fechorventa between to_date(:dtVendaInicio,'dd/mm/yyyy hh24:mi') and to_date(:dtVendaFim,'dd/mm/yyyy hh24:mi') "); + } + if(estados != null && !estados.isEmpty()) { + sQuery.append("and e.estado_id in (:estados) "); + } + if(codigosRejeicoes != null && !codigosRejeicoes.isEmpty()) { + sQuery.append("and substr(bpe.errocontingencia,1,3) in (:codigosRejeicoes) "); + } + + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("bpeId", IntegerType.INSTANCE) + .addScalar("codstat", StringType.INSTANCE) + .addScalar("chbpe", StringType.INSTANCE) + .addScalar("numBpe", StringType.INSTANCE) + .addScalar("numserieBpe", StringType.INSTANCE) + .addScalar("uf", StringType.INSTANCE) + .addScalar("motivo", StringType.INSTANCE) + .addScalar("errocontingencia", StringType.INSTANCE) + .addScalar("fechorventa", TimestampType.INSTANCE) + .addScalar("nombempresa", StringType.INSTANCE) + .setResultTransformer(new AliasToBeanResultTransformer(BPeVO.class)); + if(empresaId != null) { + qr.setParameter("empresaId", empresaId); + } + if(StringUtils.isNotBlank(numBpe)) { + qr.setParameter("numBpe", numBpe); + } + if(StringUtils.isNotBlank(chbpe)) { + qr.setParameter("chbpe", chbpe); + } + if(dtVendaInicio != null && dtVendaFim != null) { + qr.setParameter("dtVendaInicio", DateUtil.getStringDate(DateUtil.inicioFecha(dtVendaInicio), "dd/MM/yyyy HH:mm")); + qr.setParameter("dtVendaFim", DateUtil.getStringDate(DateUtil.fimFecha(dtVendaFim), "dd/MM/yyyy HH:mm")); + } + if(estados != null && !estados.isEmpty()) { + qr.setParameterList("estados", estados); + } + if(codigosRejeicoes != null && !codigosRejeicoes.isEmpty()) { + qr.setParameterList("codigosRejeicoes", codigosRejeicoes); + } + + return qr.list(); + } + + @Override + public void definirBPeRejeitadoSefazReenvio(Integer bpeId, String codstat) throws BusinessException { + String codstatUpdate = null; + if("-10".equals(codstat)) { + codstatUpdate = "-1"; + } else if("-20".equals(codstat)) { + codstatUpdate = "-2"; + } + + if(codstatUpdate == null || bpeId == null) { + throw new BusinessException("Não foi possível atualizar o BPe selecionado"); + } + + try { + Query qr = getSession().createSQLQuery("update bpe set codstat = :codstatUpdate, xmlregular = null, fecmodif = :dataAtual, usuario_id = :usuarioId where bpe_id = :bpeId"); + qr.setParameter("codstatUpdate", codstatUpdate); + qr.setParameter("bpeId", bpeId); + qr.setParameter("dataAtual", new Date()); + qr.setParameter("usuarioId", UsuarioLogado.getUsuarioLogado().getUsuarioId()); + qr.executeUpdate(); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public List buscarBPeVendaEEventosAutorizados(Integer empresaId, Date dtVendaInicio, Date dtVendaFim, Integer estadoId) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("select bpe.chbpe, bpe.tipoevento, b.num_bpe numBpe, b.numserie_bpe numserieBpe, b.fechorventa, ") + .append("case when bpe.xmlcontingencia is not null and bpe.indcontingencia = 1 then bpe.xmlcontingencia else bpe.xmlregular end xmlEnvio, ") + .append("bpe.xmlresposta xmlResposta ") + .append("from bpe bpe ") + .append("join boleto b on b.boleto_id = bpe.boleto_id ") + .append("join marca m on m.marca_id = b.marca_id ") + .append("left join estado e on e.codibge = bpe.uf ") + .append("where bpe.activo = 1 ") + .append("and bpe.tipoamb = :tipoamb ") + .append("and bpe.codstat in ('100','101','102','135','150') "); + + if(empresaId != null) { + sQuery.append("and m.empresa_id = :empresaId "); + } + if(dtVendaInicio != null && dtVendaFim != null) { + sQuery.append("and b.fechorventa between to_date(:dtVendaInicio,'dd/mm/yyyy hh24:mi') and to_date(:dtVendaFim,'dd/mm/yyyy hh24:mi') "); + } + if(estadoId != null) { + sQuery.append("and e.estado_id = :estadoId "); + } + + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("chbpe", StringType.INSTANCE) + .addScalar("tipoevento", StringType.INSTANCE) + .addScalar("chbpe", StringType.INSTANCE) + .addScalar("numBpe", StringType.INSTANCE) + .addScalar("numserieBpe", StringType.INSTANCE) + .addScalar("xmlEnvio", StringType.INSTANCE) + .addScalar("xmlResposta", StringType.INSTANCE) + .addScalar("fechorventa", TimestampType.INSTANCE) + .setResultTransformer(new AliasToBeanResultTransformer(BPeVO.class)); + + qr.setParameter("tipoamb", getAmbiente()); + if(empresaId != null) { + qr.setParameter("empresaId", empresaId); + } + if(dtVendaInicio != null && dtVendaFim != null) { + qr.setParameter("dtVendaInicio", DateUtil.getStringDate(DateUtil.inicioFecha(dtVendaInicio), "dd/MM/yyyy HH:mm")); + qr.setParameter("dtVendaFim", DateUtil.getStringDate(DateUtil.fimFecha(dtVendaFim), "dd/MM/yyyy HH:mm")); + } + if(estadoId != null) { + qr.setParameter("estadoId", estadoId); + } + + return qr.list(); + } + + public String getAmbiente() { + ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService"); + Constante contante = constanteService.buscarPorNomeConstante("BPE_AMBIENTE"); + String valorConstante = contante == null ? null : contante.getValorconstante(); + if(valorConstante != null) { + return valorConstante; + } + return "1"; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/BusquedaDatosTicketHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/BusquedaDatosTicketHibernateDAO.java new file mode 100644 index 000000000..371672ce7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/BusquedaDatosTicketHibernateDAO.java @@ -0,0 +1,645 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.transform.Transformers; +import org.hibernate.type.BigDecimalType; +import org.hibernate.type.BooleanType; +import org.hibernate.type.DateType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.LongType; +import org.hibernate.type.StringType; +import org.hibernate.type.TimestampType; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.BusquedaDatosTicketDAO; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.enums.SituacaoVendaPacote; +import com.rjconsultores.ventaboletos.enums.TipoFormapago; +import com.rjconsultores.ventaboletos.utilerias.OcdUtil; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.DadosBancarioVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.EnderecoApanheVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ItemAdicionalVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.NotaCreditoVendaPacoteVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.OcdPacoteVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PacoteVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PagamentoVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PassageiroVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ServicoVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosClientePacoteResultTransformer; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosDadosBancarioResultTransformer; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosEnderecoApanheResultTransformer; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosItemAdicionalResultTransformer; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosPassageiroResultTransformer; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosServicoResultTransformer; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosTicketResultTransformer; +import com.rjconsultores.ventaboletos.vo.caja.PagamentoCartaoVO; + +@Repository("busquedaDatosTicketDAO") +public class BusquedaDatosTicketHibernateDAO extends GenericHibernateDAO implements BusquedaDatosTicketDAO { + + private static Logger log = org.slf4j.LoggerFactory.getLogger(BusquedaDatosTicketHibernateDAO.class); + + @Autowired + public BusquedaDatosTicketHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscaDatosTickets(Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal, Date fecAlteracaoInicial, Date fecAlteracaoFinal) { + List pacotes = new ArrayList(); + + try { + pacotes = carregarDadosPacotes(fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + if (!pacotes.isEmpty()) { + carregarDadosPagamento(pacotes, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + carregarDadosServico(pacotes, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + carregarDadosPassageiros(pacotes, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + carregarDadosCliente(pacotes, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + carregarDadosEnderecoApanhe(pacotes, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + carregarDadosItemPacotes(pacotes, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + } + + } catch (Exception e) { + log.error(e.getMessage(), e); + pacotes.clear(); + } + + return getPacotesFiltradosReserva(pacotes); + } + + private List getPacotesFiltradosReserva(List pacotes) { + List retorno = new ArrayList(); + for (PacoteVO p : pacotes) { + if (p.getFormaspagamento() != null && !p.getFormaspagamento().isEmpty()) { + retorno.add(p); + } + } + return retorno; + } + + @SuppressWarnings("unchecked") + private List carregarDadosPacotes(Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal, Date fecAlteracaoInicial, Date fecAlteracaoFinal) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT VP.VENDAPACOTE_ID, VP.DATAPACOTE, VP.DATAVENDA, VP.SUBTOTAL, VP.TOTAL, VP.DESCONTO, VP.NUMOPERACION, P.PACOTE_ID, ") + .append("P.NOMPACOTE, P.DESCPACOTE, E.NOMBEMPRESA, VP.SITUACAO, PV.NOMBPUNTOVENTA, VP.USUARIO_ID, VP.FECMODIF, VP.DATACANCELAMENTO, ") + .append("COUNT(TVP.TARIFAVENDAPACOTE_ID) AS QTDEPASSAGEIRO, E.EMPRESA_ID, ") + .append("SUM(B.PRECIOPAGADO) AS TOTALTARIFA, ") + .append("SUM(B.IMPORTETAXAEMBARQUE) AS TOTALTAXAEMBARQUE, ") + .append("SUM(B.IMPORTEPEDAGIO) AS TOTALPEDAGIO, ") + .append("SUM(B.IMPORTEOUTROS) AS TOTALOUTROS, ") + .append("SUM(B.IMPORTESEGURO) AS TOTALSEGURO, ") + .append("VP.INDENCARGOVENTA, ") + .append("(SELECT COUNT(DISTINCT PFP.PACOTEFORMAPAGO_ID) FROM PACOTE_FORMAPAGO PFP WHERE PFP.VENDAPACOTE_ID = VP.VENDAPACOTE_ID) AS QTDEPACOTEFORMAPAGO ") + .append("FROM VENDA_PACOTE VP ") + .append("JOIN PACOTE P ON P.PACOTE_ID = VP.PACOTE_ID ") + .append("JOIN EMPRESA E ON E.EMPRESA_ID = P.EMPRESA_ID ") + .append("LEFT JOIN PUNTO_VENTA PV ON PV.PUNTOVENTA_ID = VP.PUNTOVENTA_ID ") + .append("LEFT JOIN TARIFA_VENDA_PACOTE TVP ON TVP.VENDAPACOTE_ID = VP.VENDAPACOTE_ID ") + .append("LEFT JOIN BOLETO B ON B.BOLETO_ID = TVP.BOLETO_ID ") + .append("WHERE (B.BOLETO_ID IS NULL OR B.INDSTATUSBOLETO = 'V') "); + + adicionarFiltros(sQuery, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + sQuery.append("GROUP BY VP.VENDAPACOTE_ID, VP.DATAPACOTE, VP.DATAVENDA, VP.SUBTOTAL, VP.TOTAL, ") + .append("VP.DESCONTO, VP.NUMOPERACION, P.PACOTE_ID, P.NOMPACOTE, P.DESCPACOTE, E.NOMBEMPRESA, ") + .append("VP.SITUACAO, PV.NOMBPUNTOVENTA, VP.USUARIO_ID, VP.FECMODIF, VP.DATACANCELAMENTO, E.EMPRESA_ID, VP.INDENCARGOVENTA "); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("DATAPACOTE", DateType.INSTANCE) + .addScalar("DATAVENDA", TimestampType.INSTANCE) + .addScalar("SUBTOTAL", BigDecimalType.INSTANCE) + .addScalar("TOTAL", BigDecimalType.INSTANCE) + .addScalar("DESCONTO", BigDecimalType.INSTANCE) + .addScalar("NUMOPERACION", StringType.INSTANCE) + .addScalar("PACOTE_ID", LongType.INSTANCE) + .addScalar("NOMPACOTE", StringType.INSTANCE) + .addScalar("DESCPACOTE", StringType.INSTANCE) + .addScalar("NOMBEMPRESA", StringType.INSTANCE) + .addScalar("SITUACAO", IntegerType.INSTANCE) + .addScalar("NOMBPUNTOVENTA", StringType.INSTANCE) + .addScalar("USUARIO_ID", IntegerType.INSTANCE) + .addScalar("QTDEPASSAGEIRO", IntegerType.INSTANCE) + .addScalar("TOTALTARIFA", BigDecimalType.INSTANCE) + .addScalar("TOTALTAXAEMBARQUE", BigDecimalType.INSTANCE) + .addScalar("TOTALPEDAGIO", BigDecimalType.INSTANCE) + .addScalar("TOTALOUTROS", BigDecimalType.INSTANCE) + .addScalar("TOTALSEGURO", BigDecimalType.INSTANCE) + .addScalar("QTDEPACOTEFORMAPAGO", IntegerType.INSTANCE) + .addScalar("FECMODIF", TimestampType.INSTANCE) + .addScalar("DATACANCELAMENTO", TimestampType.INSTANCE) + .addScalar("EMPRESA_ID", IntegerType.INSTANCE) + .addScalar("INDENCARGOVENTA", BooleanType.INSTANCE); + + query.setResultTransformer(new DatosTicketResultTransformer()); + adicionarFiltros(query, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + return query.list(); + } + + @SuppressWarnings("unchecked") + private void carregarDadosPagamento(List pacotes, Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal, Date fecAlteracaoInicial, Date fecAlteracaoFinal) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT "); + sQuery.append("PFP.PACOTEFORMAPAGO_ID,"); + sQuery.append("PFP.VALOR,"); + sQuery.append("PFP.VENDAPACOTE_ID,"); + sQuery.append("FP.FORMAPAGO_ID,"); + sQuery.append("FP.DESCPAGO,"); + sQuery.append("NC.NOTACREDITOVENDAPACOTE_ID,"); + sQuery.append("VPC.NUMOPERACION AS NUMOPERACAOPACOTECANCELAMENTO,"); + sQuery.append("FP.TIPO_PAGO,"); + sQuery.append("OCD.OCD_ID,"); + sQuery.append("OCD.NUMOPERACION AS NUMOPERACION_OCD,"); + sQuery.append("CD.CAJADIVERSOS_ID "); + + sQuery.append("FROM PACOTE_FORMAPAGO PFP "); + sQuery.append("JOIN FORMA_PAGO FP ON FP.FORMAPAGO_ID = PFP.FORMAPAGO_ID "); + sQuery.append("LEFT JOIN VENDA_PACOTE VP ON VP.VENDAPACOTE_ID = PFP.VENDAPACOTE_ID "); + sQuery.append("LEFT JOIN NOTA_CREDITO_VENDA_PACOTE NC ON NC.NOTACREDITOVENDAPACOTE_ID = PFP.NOTACREDITOVENDAPACOTE_ID "); + sQuery.append("LEFT JOIN VENDA_PACOTE VPC ON NC.VENDAPACOTECANCELAMENTO_ID = VPC.VENDAPACOTE_ID "); + sQuery.append("LEFT JOIN OCD OCD ON OCD.OCD_ID = PFP.OCD_ID "); + sQuery.append("INNER JOIN CAJA_DIVERSOS CD ON CD.VENDAPACOTE_ID = PFP.VENDAPACOTE_ID "); + + sQuery.append("WHERE 1=1 AND CD.PRECIO >= 0 AND (FP.CVESISTEMA <> 'FORMA_PAGO_RESERVA' OR FP.CVESISTEMA IS NULL) "); + + adicionarFiltros(sQuery, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + sQuery.append("ORDER BY VP.VENDAPACOTE_ID, PFP.PACOTEFORMAPAGO_ID"); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("VALOR", BigDecimalType.INSTANCE) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("FORMAPAGO_ID", IntegerType.INSTANCE) + .addScalar("DESCPAGO", StringType.INSTANCE) + .addScalar("NOTACREDITOVENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("NUMOPERACAOPACOTECANCELAMENTO", StringType.INSTANCE) + .addScalar("TIPO_PAGO", IntegerType.INSTANCE) + .addScalar("OCD_ID", LongType.INSTANCE) + .addScalar("NUMOPERACION_OCD", StringType.INSTANCE) + .addScalar("CAJADIVERSOS_ID", LongType.INSTANCE); + + query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP); + adicionarFiltros(query, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + HashMap>> resultGroupedByCajaDiversos = new HashMap>>(); + + for (HashMap h : (List>) query.list()) { + Long cajaDiversosId = (Long) h.get("CAJADIVERSOS_ID"); + if (!resultGroupedByCajaDiversos.containsKey(cajaDiversosId)) { + List> list = new ArrayList>(); + list.add(h); + resultGroupedByCajaDiversos.put(cajaDiversosId, list); + } else { + resultGroupedByCajaDiversos.get(cajaDiversosId).add(h); + } + } + + List pagamentos = getResult(resultGroupedByCajaDiversos); + + for (PacoteVO pacote : pacotes) { + int flag = -1; + for (PagamentoVO pagamento : pagamentos) { + if (pagamento.getVendapacoteId().equals(pacote.getVendapacoteId())) { + + flag = 0; + if (pacote.getFormaspagamento() == null) { + pacote.setFormaspagamento(new ArrayList()); + } + + if (isPacoteReserva(pacote) && isPagamentoPacoteReserva(pagamento) || + (isPagamentoPacoteReserva(pagamento) && pacote.getQtdePacoteFormaspago() == 1) || + (!isPacoteReserva(pacote) && !isPagamentoPacoteReserva(pagamento))) { + pacote.getFormaspagamento().add(pagamento); + } + + if (isPagamentoDeposito(pagamento)) { + carregarDadosDeposito(pacote, pagamento); + } + } else if (flag == 0) { + break; + } + + } + } + } + + @SuppressWarnings("unchecked") + private List getResult(HashMap>> firstResult) { + + StringBuilder sQuery = new StringBuilder(); + + sQuery.append("SELECT CDP.CAJADIVERSOSPAGO_ID, "); + sQuery.append("CT.TIPOTARJETA, "); + sQuery.append("CT.NUMAUTORIZACION, "); + sQuery.append("CT.CANTPARCELAS, "); + sQuery.append("CT.NOMBTITULAR, "); + sQuery.append("CT.FECOPERACION, "); + sQuery.append("CT.NUMTARJETA, "); + sQuery.append("CT.DESCOPERADORACARTAO, "); + sQuery.append("CDP.CAJADIVERSOS_ID "); + sQuery.append("FROM CAJA_DIVERSOS_PAGO CDP "); + sQuery.append("LEFT JOIN CAJA_TARJETA CT ON CT.CAJATARJETA_ID = CDP.CAJATARJETA_ID "); + sQuery.append("WHERE CDP.CAJADIVERSOS_ID IN (:cajaDiversosId) "); + sQuery.append("ORDER BY CDP.CAJADIVERSOS_ID, CDP.CAJADIVERSOSPAGO_ID "); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("CAJADIVERSOSPAGO_ID", LongType.INSTANCE) + .addScalar("TIPOTARJETA", StringType.INSTANCE) + .addScalar("NUMAUTORIZACION", StringType.INSTANCE) + .addScalar("CANTPARCELAS", IntegerType.INSTANCE) + .addScalar("NOMBTITULAR", StringType.INSTANCE) + .addScalar("FECOPERACION", DateType.INSTANCE) + .addScalar("NUMTARJETA", StringType.INSTANCE) + .addScalar("DESCOPERADORACARTAO", StringType.INSTANCE) + .addScalar("CAJADIVERSOS_ID", LongType.INSTANCE); + + query.setParameterList("cajaDiversosId", firstResult.keySet()); + + query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP); + + List> secondResult = query.list(); + int count = 0; + + for (Long cajaDiversosId : firstResult.keySet()) { + count = 0; + for (HashMap s : secondResult) { + if (cajaDiversosId.equals(s.get("CAJADIVERSOS_ID"))) { + try{ + firstResult.get(cajaDiversosId).get(count).putAll(s); + }catch(Exception ex){ + log.info("***info> cajaDiversosId: " + cajaDiversosId + ", verificar reserva"); + } + count++; + } + } + } + + List pagamentos = new ArrayList(); + List> dadosExtraidos = new ArrayList>(); + + for (Long cajaDiversosId : firstResult.keySet()) { + dadosExtraidos.addAll(firstResult.get(cajaDiversosId)); + } + + for (HashMap m : dadosExtraidos) { + PagamentoVO pagamento = new PagamentoVO(); + setDatosPacote(pagamento, m); + pagamentos.add(pagamento); + } + + return pagamentos; + } + + private void setDatosPacote(PagamentoVO pagamento, Map tupleMap) { + pagamento.setMoeda("R$"); + pagamento.setVendapacoteId((Long) tupleMap.get("VENDAPACOTE_ID")); + pagamento.setFormapagoId((Integer) tupleMap.get("FORMAPAGO_ID")); + pagamento.setFormapagamento((String) tupleMap.get("DESCPAGO")); + pagamento.setValor((BigDecimal) tupleMap.get("VALOR")); + + Integer tipoPago = (Integer) tupleMap.get("TIPO_PAGO"); + pagamento.setTipoFormapago(TipoFormapago.getTipoFormapagoByValor(tipoPago)); + + if (isVentaCartaoCredito(pagamento.getTipoFormapago()) || isVentaCartaoDebito(pagamento.getTipoFormapago())) { + PagamentoCartaoVO cartao = new PagamentoCartaoVO(); + cartao.setBandeira((String) tupleMap.get("TIPOTARJETA")); + cartao.setNumautorizacao((String) tupleMap.get("NUMAUTORIZACION")); + cartao.setParcelas((Integer) tupleMap.get("CANTPARCELAS")); + cartao.setTitular((String) tupleMap.get("NOMBTITULAR")); + cartao.setDatapagamento((Date) tupleMap.get("FECOPERACION")); + cartao.setNumcartao((String) tupleMap.get("NUMTARJETA")); + cartao.setNumcartao((String) tupleMap.get("NUMTARJETA")); + cartao.setOperadoracartao((String) tupleMap.get("DESCOPERADORACARTAO")); + + pagamento.setCartao(cartao); + } + + if (isVentaNotaCredito(pagamento.getTipoFormapago())) { + if (tupleMap.get("NOTACREDITOVENDAPACOTE_ID") != null) { + NotaCreditoVendaPacoteVO notacredito = new NotaCreditoVendaPacoteVO(); + notacredito.setVouchernotacredito(((Long) tupleMap.get("NOTACREDITOVENDAPACOTE_ID")).toString()); + notacredito.setNumoperacaopacotecancelamento((String) tupleMap.get("NUMOPERACAOPACOTECANCELAMENTO")); + pagamento.setNotacredito(notacredito); + } + + if (tupleMap.get("OCD_ID") != null) { + String voucherocd = OcdUtil.generaLocalizadorOCD((String) tupleMap.get("NUMOPERACION_OCD"), (Long) tupleMap.get("OCD_ID")); + OcdPacoteVO ocdPacote = new OcdPacoteVO(); + ocdPacote.setVoucherocd(voucherocd); + pagamento.setOcd(ocdPacote); + } + } + + } + + private boolean isVentaCartaoCredito(TipoFormapago tipoFormapago) { + return TipoFormapago.CREDITO.equals(tipoFormapago); + } + + private boolean isVentaCartaoDebito(TipoFormapago tipoFormapago) { + return TipoFormapago.DEBITO.equals(tipoFormapago); + } + + private boolean isVentaNotaCredito(TipoFormapago tipoFormapago) { + return TipoFormapago.NOTA_CREDITO.equals(tipoFormapago); + } + + /** + * Adiciona os filtros na query + * + * @param query + * @param fecInicial + * @param fecFinal + * @param fecVentaInicial + * @param fecVentaFinal + * @param fecAlteracaoInicial + * @param fecAlteracaoFinal + */ + private void adicionarFiltros(SQLQuery query, Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal, Date fecAlteracaoInicial, Date fecAlteracaoFinal) { + query.setParameter("situacaoPacote", SituacaoVendaPacote.RESERVA.getShortValue()); + + if (fecInicial != null) { + query.setParameter("fecInicial", fecInicial, DateType.INSTANCE); + } + if (fecFinal != null) { + query.setParameter("fecFinal", fecFinal, DateType.INSTANCE); + } + + if (fecVentaInicial != null) { + query.setParameter("fecVentaInicial", fecVentaInicial, TimestampType.INSTANCE); + } + if (fecVentaFinal != null) { + query.setParameter("fecVentaFinal", fecVentaFinal, TimestampType.INSTANCE); + } + + if (fecAlteracaoInicial != null) { + query.setParameter("fecAlteracaoInicial", fecAlteracaoInicial, TimestampType.INSTANCE); + } + if (fecAlteracaoFinal != null) { + query.setParameter("fecAlteracaoFinal", fecAlteracaoFinal, TimestampType.INSTANCE); + } + } + + private void adicionarFiltros(StringBuilder sQuery, Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal, Date fecAlteracaoInicial, Date fecAlteracaoFinal) { + + sQuery.append("AND VP.SITUACAO != :situacaoPacote "); + + if (fecInicial != null) { + sQuery.append("AND VP.DATAPACOTE >= :fecInicial "); + } + if (fecFinal != null) { + sQuery.append("AND VP.DATAPACOTE <= :fecFinal "); + } + + if (fecVentaInicial != null) { + sQuery.append("AND VP.DATAVENDA >= :fecVentaInicial "); + } + if (fecVentaFinal != null) { + sQuery.append("AND VP.DATAVENDA <= :fecVentaFinal "); + } + + if (fecAlteracaoInicial != null) { + sQuery.append("AND VP.FECMODIF >= :fecAlteracaoInicial "); + } + if (fecAlteracaoFinal != null) { + sQuery.append("AND VP.FECMODIF <= :fecAlteracaoFinal "); + } + + } + + private boolean isPagamentoDeposito(PagamentoVO pagamento) { + return TipoFormapago.DEPOSITO.equals(pagamento.getTipoFormapago()); + } + + private boolean isPacoteReserva(PacoteVO pacote) { + return SituacaoVendaPacote.RESERVA.toString().equals(pacote.getStatus()); + } + + private boolean isPagamentoPacoteReserva(PagamentoVO pagamento) { + return TipoFormapago.RESERVA.equals(pagamento.getTipoFormapago()); + } + + @SuppressWarnings("unchecked") + private void carregarDadosServico(List pacotes, Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal, Date fecAlteracaoInicial, Date fecAlteracaoFinal) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT VP.VENDAPACOTE_ID, B.FECHORVIAJE, B.ORIGEN_ID, CONCAT(CONCAT(ORI.CVEPARADA,' - '),ORI.DESCPARADA) AS ORIGEM, CONCAT(CONCAT(DES.CVEPARADA,' - '),DES.DESCPARADA) AS DESTINO ") + .append("FROM VENDA_PACOTE VP ") + .append("JOIN PACOTE P ON P.PACOTE_ID = VP.PACOTE_ID ") + .append("JOIN TARIFA_VENDA_PACOTE TVP ON TVP.VENDAPACOTE_ID = VP.VENDAPACOTE_ID ") + .append("JOIN BOLETO B ON B.BOLETO_ID = TVP.BOLETO_ID ") + .append("JOIN PARADA ORI ON ORI.PARADA_ID = B.ORIGEN_ID ") + .append("JOIN PARADA DES ON DES.PARADA_ID = B.DESTINO_ID ") + .append("WHERE 1=1 "); + + adicionarFiltros(sQuery, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("FECHORVIAJE", TimestampType.INSTANCE) + .addScalar("ORIGEN_ID", IntegerType.INSTANCE) + .addScalar("ORIGEM", StringType.INSTANCE) + .addScalar("DESTINO", StringType.INSTANCE); + + query.setResultTransformer(new DatosServicoResultTransformer()); + adicionarFiltros(query, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + List servicos = query.list(); + for (PacoteVO pacote : pacotes) { + for (ServicoVO servico : servicos) { + if (servico.getVendapacoteId().equals(pacote.getVendapacoteId())) { + pacote.setServico(servico); + break; + } + } + } + } + + @SuppressWarnings("unchecked") + private void carregarDadosCliente(List pacotes, Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal, Date fecAlteracaoInicial, Date fecAlteracaoFinal) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT VP.VENDAPACOTE_ID, C.NOMBCLIENTE, C.APELLIDOPATERNO, C.APELLIDOMATERNO, C.NUMTELEFONO, C.DESCCORREO, C.NUMIDENTIFICAUNO, ") + .append("CD.DESCCALLE, CD.DESCCALLECOMP, CD.DESCCOLONIA, CD.DESCIUDAD, CD.NUMINTERIOR, CD.CODPOSTAL, CD.DESESTADO ") + .append("FROM CLIENTE C ") + .append("JOIN VENDA_PACOTE VP ON VP.CLIENTE_ID = C.CLIENTE_ID ") + .append("LEFT JOIN CLIENTE_DIRECCION CD ON CD.CLIENTE_ID = C.CLIENTE_ID ") + .append("WHERE 1=1 "); + + adicionarFiltros(sQuery, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("NOMBCLIENTE", StringType.INSTANCE) + .addScalar("APELLIDOPATERNO", StringType.INSTANCE) + .addScalar("APELLIDOMATERNO", StringType.INSTANCE) + .addScalar("NUMIDENTIFICAUNO", StringType.INSTANCE) + .addScalar("DESCCORREO", StringType.INSTANCE) + .addScalar("NUMTELEFONO", StringType.INSTANCE) + .addScalar("CODPOSTAL", StringType.INSTANCE) + .addScalar("DESCCALLE", StringType.INSTANCE) + .addScalar("NUMINTERIOR", StringType.INSTANCE) + .addScalar("DESCCALLECOMP", StringType.INSTANCE) + .addScalar("DESESTADO", StringType.INSTANCE) + .addScalar("DESCIUDAD", StringType.INSTANCE) + .addScalar("DESCCOLONIA", StringType.INSTANCE); + + query.setResultTransformer(new DatosClientePacoteResultTransformer()); + adicionarFiltros(query, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + List clientesPacotes = query.list(); + for (PacoteVO pacote : pacotes) { + for (ClientePacoteVO clientePacote : clientesPacotes) { + if (clientePacote.getVendapacoteId().equals(pacote.getVendapacoteId())) { + pacote.setClientePacote(clientePacote); + } + } + } + } + + @SuppressWarnings("unchecked") + private void carregarDadosPassageiros(List pacotes, Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal, Date fecAlteracaoInicial, Date fecAlteracaoFinal) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT VP.VENDAPACOTE_ID, TVP.TARIFAVENDAPACOTE_ID, TVP.NOMEPASSAGEIRO, CONCAT(CONCAT(TVP.TIPODOC,' - '), TVP.DOCUMENTO) AS DOCUMENTO, B.NUMASIENTO, C.CATEGORIA_ID, C.DESCCATEGORIA, B.BOLETO_ID,C.CVECATEGORIA ") + .append("FROM VENDA_PACOTE VP ") + .append("JOIN TARIFA_VENDA_PACOTE TVP ON TVP.VENDAPACOTE_ID = VP.VENDAPACOTE_ID ") + .append("LEFT JOIN BOLETO B ON B.BOLETO_ID = TVP.BOLETO_ID ") + .append("LEFT JOIN CATEGORIA C ON C.CATEGORIA_ID = B.CATEGORIA_ID ") + .append("WHERE 1=1 "); + + adicionarFiltros(sQuery, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("BOLETO_ID", LongType.INSTANCE) + .addScalar("TARIFAVENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("NOMEPASSAGEIRO", StringType.INSTANCE) + .addScalar("DOCUMENTO", StringType.INSTANCE) + .addScalar("NUMASIENTO", StringType.INSTANCE) + .addScalar("CATEGORIA_ID", IntegerType.INSTANCE) + .addScalar("CVECATEGORIA", StringType.INSTANCE) + .addScalar("DESCCATEGORIA", StringType.INSTANCE); + + query.setResultTransformer(new DatosPassageiroResultTransformer()); + adicionarFiltros(query, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + List passageiros = query.list(); + for (PacoteVO pacote : pacotes) { + for (PassageiroVO passageiro : passageiros) { + if (passageiro.getVendapacoteId().equals(pacote.getVendapacoteId())) { + if (pacote.getPax() == null) { + pacote.setPax(new ArrayList()); + } + pacote.getPax().add(passageiro); + } + } + } + } + + @SuppressWarnings("unchecked") + private void carregarDadosEnderecoApanhe(List pacotes, Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal, Date fecAlteracaoInicial, Date fecAlteracaoFinal) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT VP.VENDAPACOTE_ID, EA.LOCAL, EA.DESCHOTEL, EA.CEP, EA.ENDERECO, EA.NUMERO, EA.COMPLEMENTO, EA.CIDADE, EA.BAIRRO, EA.REFERENCIA ") + .append("FROM ENDERECO_APANHE EA ") + .append("JOIN VENDA_PACOTE VP ON EA.VENDAPACOTE_ID = VP.VENDAPACOTE_ID ") + .append("WHERE EA.ACTIVO = 1 "); + + adicionarFiltros(sQuery, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("LOCAL", IntegerType.INSTANCE) + .addScalar("CEP", StringType.INSTANCE) + .addScalar("ENDERECO", StringType.INSTANCE) + .addScalar("NUMERO", StringType.INSTANCE) + .addScalar("COMPLEMENTO", StringType.INSTANCE) + .addScalar("CIDADE", StringType.INSTANCE) + .addScalar("BAIRRO", StringType.INSTANCE) + .addScalar("REFERENCIA", StringType.INSTANCE) + .addScalar("DESCHOTEL", StringType.INSTANCE); + + query.setResultTransformer(new DatosEnderecoApanheResultTransformer()); + adicionarFiltros(query, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + List enderecosApanhe = query.list(); + for (PacoteVO pacote : pacotes) { + for (EnderecoApanheVO enderecoApanhe : enderecosApanhe) { + if (enderecoApanhe.getVendapacoteId().equals(pacote.getVendapacoteId())) { + pacote.setEnderecoApanhe(enderecoApanhe); + } + } + } + } + + @SuppressWarnings("unchecked") + private void carregarDadosItemPacotes(List pacotes, Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal, Date fecAlteracaoInicial, Date fecAlteracaoFinal) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT IA.DESCITEMADICIONAL, VP.VENDAPACOTE_ID, PI.ITEMADICIONAL_ID ") + .append("FROM ITEM_ADICIONAL IA ") + .append("JOIN PACOTE_ITEM PI ON IA.ITEMADICIONAL_ID = PI.ITEMADICIONAL_ID ") + .append("JOIN PACOTE P ON P.PACOTE_ID = PI.PACOTE_ID ") + .append("JOIN VENDA_PACOTE VP ON VP.PACOTE_ID = P.PACOTE_ID ") + .append("WHERE IA.ACTIVO = 1 "); + + adicionarFiltros(sQuery, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("DESCITEMADICIONAL", StringType.INSTANCE) + .addScalar("VENDAPACOTE_ID", LongType.INSTANCE) + .addScalar("ITEMADICIONAL_ID", LongType.INSTANCE); + + query.setResultTransformer(new DatosItemAdicionalResultTransformer()); + adicionarFiltros(query, fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + + List itens = query.list(); + for (PacoteVO pacote : pacotes) { + for (ItemAdicionalVO itemAdicional : itens) { + if (itemAdicional.getVendapacoteId().equals(pacote.getVendapacoteId())) { + if (pacote.getItens() == null) { + pacote.setItens(new ArrayList()); + } + pacote.getItens().add(itemAdicional); + } + } + } + } + + @SuppressWarnings("unchecked") + private void carregarDadosDeposito(PacoteVO pacote, PagamentoVO pagamento) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT CDDP.IDENTIFICACAO_DEPOSITO, CDDP.IMPORTE, CDDP.FECDEPOSITO ") + .append("FROM CAJA_DET_DEPOSITO_PAGO CDDP ") + .append("JOIN CAJA_DIVERSOS_PAGO CDP ON CDP.CAJADIVERSOSPAGO_ID = CDDP.CAJADIVERSOSPAGO_ID ") + .append("JOIN CAJA_DIVERSOS CD ON CD.CAJADIVERSOS_ID = CDP.CAJADIVERSOS_ID ") + .append("WHERE CDDP.ACTIVO = 1 ") + .append("AND CD.VENDAPACOTE_ID = :vendapacoteId ") + .append("AND CDP.FORMAPAGO_ID = :formapagoId "); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("IDENTIFICACAO_DEPOSITO", StringType.INSTANCE) + .addScalar("IMPORTE", BigDecimalType.INSTANCE) + .addScalar("FECDEPOSITO", DateType.INSTANCE); + + query.setResultTransformer(new DatosDadosBancarioResultTransformer()); + query.setParameter("vendapacoteId", pacote.getVendapacoteId()); + query.setParameter("formapagoId", pagamento.getFormapagoId()); + + List dadosBancarios = query.list(); + if (dadosBancarios != null && !dadosBancarios.isEmpty()) { + pagamento.setDadosBancarios(dadosBancarios); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CajaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CajaHibernateDAO.java new file mode 100644 index 000000000..53558a28f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CajaHibernateDAO.java @@ -0,0 +1,704 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.BigDecimalType; +import org.hibernate.type.BooleanType; +import org.hibernate.type.DateType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.LongType; +import org.hibernate.type.StringType; +import org.hibernate.type.TimestampType; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CajaDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.Caja; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enums.TipoFormapago; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoFormapagoException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaFormapagoException; +import com.rjconsultores.ventaboletos.utilerias.OcdUtil; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.DadosBancarioVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.NotaCreditoVendaPacoteVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosDadosBancarioResultTransformer; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.RelatorioVendaCartaoCashMonitorResultTransformer; +import com.rjconsultores.ventaboletos.vo.caja.CajaCerradoVO; +import com.rjconsultores.ventaboletos.vo.caja.CajaDetalleVO; +import com.rjconsultores.ventaboletos.vo.caja.CajaVO; +import com.rjconsultores.ventaboletos.vo.caja.PagamentoCartaoVO; +import com.rjconsultores.ventaboletos.vo.caja.PagamentoVO; +import com.rjconsultores.ventaboletos.vo.caja.ReceitaDespesaVO; +import com.rjconsultores.ventaboletos.vo.caja.UsuarioVO; +import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO; +import com.rjconsultores.ventaboletos.vo.cashmonitor.RelatorioVendaCartaoCashMonitorVO; + +@Repository("cajaDAO") +@SuppressWarnings("unchecked") +public class CajaHibernateDAO extends GenericHibernateDAO implements CajaDAO { + + private static Logger log = org.slf4j.LoggerFactory.getLogger(CajaHibernateDAO.class); + + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public CajaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarCajaFecha(boolean yaCerrado, Date fechaDesde, Date fechaHasta) { + List list = new ArrayList(); + HashMap map = new HashMap(); + + String sqlBuscarCajaFecha = sqlBuilder.getSQLBuscarCajaFecha(yaCerrado, fechaDesde, fechaHasta); + SQLQuery sql = getSession().createSQLQuery(sqlBuscarCajaFecha) + .addScalar("cajaId", LongType.INSTANCE) + .addScalar("numAsiento", StringType.INSTANCE) + .addScalar("categoriaId", IntegerType.INSTANCE) + .addScalar("numFolioSistema", StringType.INSTANCE) + .addScalar("claseServicioId", IntegerType.INSTANCE) + .addScalar("marcaId", IntegerType.INSTANCE) + .addScalar("origenId", IntegerType.INSTANCE) + .addScalar("destinoId", IntegerType.INSTANCE) + .addScalar("corridaId", IntegerType.INSTANCE) + .addScalar("fecCorrida", DateType.INSTANCE) + .addScalar("nombPasajero", StringType.INSTANCE) + .addScalar("precioBase", BigDecimalType.INSTANCE) + .addScalar("precioPagado", BigDecimalType.INSTANCE) + .addScalar("tipoVentaId", IntegerType.INSTANCE) + .addScalar("numSeriePreimpresa", StringType.INSTANCE) + .addScalar("numFolioPreImpreso", StringType.INSTANCE) + .addScalar("fecHorViaje", TimestampType.INSTANCE) + .addScalar("fecHorVenta", TimestampType.INSTANCE) + .addScalar("puntoVentaId", IntegerType.INSTANCE) + .addScalar("numPuntoVenta", StringType.INSTANCE) + .addScalar("numKmViaje", BigDecimalType.INSTANCE) + .addScalar("numOperacion", StringType.INSTANCE) + .addScalar("motivoCancelacionId", IntegerType.INSTANCE) + .addScalar("empresaPuntoVentaId", IntegerType.INSTANCE) + .addScalar("empresaCorridaId", IntegerType.INSTANCE) + .addScalar("turnoId", IntegerType.INSTANCE) + .addScalar("importeTaxaEmbarque", BigDecimalType.INSTANCE) + .addScalar("importePedagio", BigDecimalType.INSTANCE) + .addScalar("importeOutros", BigDecimalType.INSTANCE) + .addScalar("importeSeguro", BigDecimalType.INSTANCE) + .addScalar("rutaId", IntegerType.INSTANCE) + .addScalar("usuarioId", IntegerType.INSTANCE) + .addScalar("numAutorizacion", StringType.INSTANCE) + .addScalar("ordenSevicio", StringType.INSTANCE); + + sql.setResultTransformer(new AliasToBeanResultTransformer(CajaVO.class)); + + for (CajaVO cv : (List) sql.list()) { + if (map.containsKey(cv.getCajaId()) && map.get(cv.getCajaId()).getImporteTaxaEmbarque() != null && + !map.get(cv.getCajaId()).getImporteTaxaEmbarque().equals(0)) { + cv.setImporteTaxaEmbarque(new BigDecimal(0)); + } else { + map.put(cv.getCajaId(), cv); + } + list.add(cv); + } + + return list; + } + + @Override + public List buscarDetalleCaja(Date fechaDesde, Date fechaHasta, Boolean sembilhetesPacote) { + + String sqlBuscarCajaFecha = sqlBuilder.getSQLBuscarDatosCaja(fechaDesde, fechaHasta, sembilhetesPacote); + + SQLQuery sql = getSession().createSQLQuery(sqlBuscarCajaFecha) + .addScalar("cajaId", LongType.INSTANCE) + .addScalar("numAsiento", StringType.INSTANCE) + .addScalar("categoriaId", IntegerType.INSTANCE) + .addScalar("numFolioSistema", StringType.INSTANCE) + .addScalar("claseServicioId", IntegerType.INSTANCE) + .addScalar("marcaId", IntegerType.INSTANCE) + .addScalar("origenId", IntegerType.INSTANCE) + .addScalar("destinoId", IntegerType.INSTANCE) + .addScalar("corridaId", IntegerType.INSTANCE) + .addScalar("fecCorrida", DateType.INSTANCE) + .addScalar("nombPasajero", StringType.INSTANCE) + .addScalar("precioBase", BigDecimalType.INSTANCE) + .addScalar("precioPagado", BigDecimalType.INSTANCE) + .addScalar("tipoVentaId", IntegerType.INSTANCE) + .addScalar("numSeriePreimpresa", StringType.INSTANCE) + .addScalar("numFolioPreImpreso", StringType.INSTANCE) + .addScalar("fecHorViaje", TimestampType.INSTANCE) + .addScalar("fecHorVenta", TimestampType.INSTANCE) + .addScalar("puntoVentaId", IntegerType.INSTANCE) + .addScalar("numPuntoVenta", StringType.INSTANCE) + .addScalar("numKmViaje", BigDecimalType.INSTANCE) + .addScalar("numOperacion", StringType.INSTANCE) + .addScalar("motivoCancelacionId", IntegerType.INSTANCE) + .addScalar("empresaPuntoVentaId", IntegerType.INSTANCE) + .addScalar("empresaCorridaId", IntegerType.INSTANCE) + .addScalar("turnoId", IntegerType.INSTANCE) + .addScalar("importeTaxaEmbarque", BigDecimalType.INSTANCE) + .addScalar("importePedagio", BigDecimalType.INSTANCE) + .addScalar("importeOutros", BigDecimalType.INSTANCE) + .addScalar("importeSeguro", BigDecimalType.INSTANCE) + .addScalar("rutaId", IntegerType.INSTANCE) + .addScalar("usuarioId", IntegerType.INSTANCE) + .addScalar("numAutorizacion", StringType.INSTANCE) + .addScalar("ordenSevicio", StringType.INSTANCE) + .addScalar("descPago", StringType.INSTANCE) + .addScalar("cveCategoria", StringType.INSTANCE) + .addScalar("formaPagoId", IntegerType.INSTANCE) + .addScalar("vlrFormaPago", BigDecimalType.INSTANCE) + .addScalar("descMotivo", StringType.INSTANCE) + .addScalar("transacaoId", LongType.INSTANCE) + .addScalar("transacaooriginalId", LongType.INSTANCE) + .addScalar("descnumdoc", StringType.INSTANCE) + .addScalar("descnumdoc2", StringType.INSTANCE) + .addScalar("desctipodoc", StringType.INSTANCE) + .addScalar("desctipodoc2", StringType.INSTANCE) + .addScalar("desctelefono", StringType.INSTANCE) + .addScalar("tipotarjeta", StringType.INSTANCE) + .addScalar("cantparcelas", IntegerType.INSTANCE) + .addScalar("numtarjeta", StringType.INSTANCE) + .addScalar("fecoperacion", TimestampType.INSTANCE) + .addScalar("nombtitular", StringType.INSTANCE) + .addScalar("ocdId", LongType.INSTANCE) + .addScalar("numoperacionOcd", StringType.INSTANCE) + .addScalar("notacreditovendapacoteId", LongType.INSTANCE) + .addScalar("operadoracartao", StringType.INSTANCE) + .addScalar("cvesecretaria", StringType.INSTANCE) + .addScalar("tipoPago", IntegerType.INSTANCE) + .addScalar("indEncargoVenta", BooleanType.INSTANCE) + .addScalar("descconvenio", StringType.INSTANCE) + .addScalar("cveconvenio", StringType.INSTANCE) + .addScalar("descsecretaria", StringType.INSTANCE); + + sql.setResultTransformer(new AliasToBeanResultTransformer(CajaDetalleVO.class)); + + List lsBusca = sql.list(); + + List lsResultado = new ArrayList(); + + for (CajaDetalleVO cd : lsBusca) { + + int indexOf = lsResultado.indexOf(cd); + + CajaDetalleVO cajaDetalleVO = null; + + if (indexOf != -1) { + cajaDetalleVO = lsResultado.get(indexOf); + } else { + cajaDetalleVO = cd; + } + + if (cajaDetalleVO.getFormaspagamento() == null) { + cajaDetalleVO.setFormaspagamento(new ArrayList()); + } + + if (!cd.getDescPago().equalsIgnoreCase("TROCA DE PASSAGEM")) { + PagamentoVO pagamentoVO = new PagamentoVO(); + pagamentoVO.setFormapagamento(cd.getDescPago()); + pagamentoVO.setMoeda("R$"); + pagamentoVO.setValor(cd.getVlrFormaPago()); + pagamentoVO.setIdentificacaoEmpresa(cd.getCvesecretaria()); + pagamentoVO.setRazaoSocial(cd.getDescsecretaria()); + + if (cd.getNotacreditovendapacoteId() != null) { + NotaCreditoVendaPacoteVO notacredito = new NotaCreditoVendaPacoteVO(); + notacredito.setVouchernotacredito(cd.getNotacreditovendapacoteId().toString()); + pagamentoVO.setNotacredito(notacredito); + } + + if (cd.getOcdId() != null) { + NotaCreditoVendaPacoteVO notacredito = new NotaCreditoVendaPacoteVO(); + notacredito.setVouchernotacredito(OcdUtil.generaLocalizadorOCD(cd.getNumoperacionOcd(), cd.getOcdId())); + pagamentoVO.setNotacredito(notacredito); + } + + if (StringUtils.isNotBlank(cd.getNumAutorizacion())) { + PagamentoCartaoVO cartao = new PagamentoCartaoVO(); + cartao.setNumautorizacao(cd.getNumAutorizacion()); + cartao.setBandeira(cd.getTipotarjeta()); + cartao.setDatapagamento(cd.getFecoperacion()); + cartao.setNumcartao(cd.getNumtarjeta()); + cartao.setParcelas(cd.getCantparcelas()); + cartao.setTitular(cd.getNombtitular()); + cartao.setOperadoracartao(cd.getOperadoracartao()); + + pagamentoVO.setCartao(cartao); + } + + cajaDetalleVO.getFormaspagamento().add(pagamentoVO); + + if (pagamentoVO.getDadosBancarios() == null) { + pagamentoVO.setDadosBancarios(new ArrayList()); + } + + if (isPagamentoDeposito(TipoFormapago.getTipoFormapagoByValor(cd.getTipoPago()))) { + pagamentoVO.getDadosBancarios().addAll(carregarDadosDeposito(cd.getCajaId(), cd.getFormaPagoId())); + } + + if (pagamentoVO.getDadosBancarios().isEmpty()) { + pagamentoVO.setDadosBancarios(null); + } + } + if (indexOf == -1) { + lsResultado.add(cajaDetalleVO); + } + } + + List filtrados = new ArrayList(); + for (CajaDetalleVO c : lsResultado) { + if (c.getFormaspagamento() != null && !c.getFormaspagamento().isEmpty() && !existeApenasFpReserva(c)) { + filtrados.add(c); + } + } + + return filtrados; + } + + private Boolean existeApenasFpReserva(CajaDetalleVO c) { + if (c.getFormaspagamento().size() == 1 + && c.getFormaspagamento().get(0).getFormapagamento().equals("RESERVA")) { + return true; + } + + return false; + } + + @Override + public List buscarCajaCerrado(Date fecha, String cveusuario, String turnoid) { + return buscarCajaCerrado(fecha, cveusuario, turnoid, false); + } + + @Override + public List buscarUsuarioCerrado(Date fecha) { + return buscarCajaCerrado(fecha, "*", "*", true); + } + + private List buscarCajaCerrado(Date fecha, String cveusuario, String turnoid, boolean sinDatosCaja) { + List list = new ArrayList(); + HashMap map = new HashMap(); + + try { + String sqlBuscarUsuariosCajaCerrado = sqlBuilder.getSQLBuscarUsuariosCajaCerrado(fecha, cveusuario, turnoid); + + SQLQuery sql = getSession().createSQLQuery(sqlBuscarUsuariosCajaCerrado) + .addScalar("usuarioId", IntegerType.INSTANCE) + .addScalar("cveusuario", StringType.INSTANCE) + .addScalar("puntoVentaId", IntegerType.INSTANCE) + .addScalar("numPuntoVenta", StringType.INSTANCE) + .addScalar("fecCorte", DateType.INSTANCE) + .addScalar("turnoId", IntegerType.INSTANCE) + .addScalar("importeTotal", BigDecimalType.INSTANCE); + + sql.setResultTransformer(new AliasToBeanResultTransformer(UsuarioVO.class)); + + List usuarios = sql.list(); + if (sinDatosCaja) { + return usuarios; + } + for (UsuarioVO u : usuarios) { + String sqlBuscarCajaFecha = sqlBuilder.getSQLBuscarCajaCerrado(u.getUsuarioId(), fecha, turnoid); + + sql = getSession().createSQLQuery(sqlBuscarCajaFecha) + .addScalar("cajaId", LongType.INSTANCE) + .addScalar("numFolioSistema", StringType.INSTANCE) + .addScalar("origen", StringType.INSTANCE) + .addScalar("destino", StringType.INSTANCE) + .addScalar("corridaId", IntegerType.INSTANCE) + .addScalar("precioPagado", BigDecimalType.INSTANCE) + .addScalar("fecHorVenta", DateType.INSTANCE) + .addScalar("importeTaxaEmbarque", BigDecimalType.INSTANCE) + .addScalar("ruta", StringType.INSTANCE) + .addScalar("numAutorizacion", StringType.INSTANCE) + .addScalar("ordenSevicio", StringType.INSTANCE) + .addScalar("secretaria", StringType.INSTANCE) + .addScalar("cvesecretaria", StringType.INSTANCE) + .addScalar("emissorTarjeta", StringType.INSTANCE) + .addScalar("tipoPasaje", StringType.INSTANCE) + .addScalar("formaPago", StringType.INSTANCE); + + sql.setResultTransformer(new AliasToBeanResultTransformer(CajaCerradoVO.class)); + + for (CajaCerradoVO cv : (List) sql.list()) { + if (map.containsKey(cv.getCajaId()) && map.get(cv.getCajaId()).getImporteTaxaEmbarque() != null && + !map.get(cv.getCajaId()).getImporteTaxaEmbarque().equals(0)) { + cv.setImporteTaxaEmbarque(new BigDecimal(0)); + } else { + map.put(cv.getCajaId(), cv); + } + list.add(cv); + } + + u.setPasajes(list); + + String sqlBuscarReceitaDespesa = sqlBuilder.getSQLBuscarReceitasDespesasCaja(u.getUsuarioId(), fecha); + sql = getSession().createSQLQuery(sqlBuscarReceitaDespesa) + .addScalar("precio", BigDecimalType.INSTANCE) + .addScalar("tipoEvento", StringType.INSTANCE); + sql.setResultTransformer(new AliasToBeanResultTransformer(ReceitaDespesaVO.class)); + u.setDiversos(sql.list()); + } + return usuarios; + } catch (Exception e) { + log.error("", e); + + return null; + } + } + + @Override + @Transactional(rollbackFor = { BusinessException.class, VendaEmbarcadaBoletoException.class, VendaEmbarcadaBoletoFormapagoException.class, VendaEmbarcadaCajaException.class, VendaEmbarcadaCajaFormapagoException.class }) + public void gerarVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaBoletoException, VendaEmbarcadaBoletoFormapagoException, VendaEmbarcadaCajaException, VendaEmbarcadaCajaFormapagoException { + inserirBoletoVendaEmbarcada(vendaEmbarcada); + inserirBoletoFormaPagoVendaEmbarcada(vendaEmbarcada); + inserirCajaVendaEmbarcada(vendaEmbarcada); + inserirCajaFormaPagoVendaEmbarcada(vendaEmbarcada); + } + + private void inserirCajaVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaCajaException { + + try { + + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirCajaVendaEmbarcada()); + + vendaEmbarcada.setCajaId(obterIdCaja().longValue()); + + query.setLong("cajaId", vendaEmbarcada.getCajaId()); + query.setString("numAsiento", vendaEmbarcada.getNumAsiento()); + query.setInteger("categoriaId", vendaEmbarcada.getCategoriaId()); + query.setInteger("claseServicioId", vendaEmbarcada.getClaseServicioId()); + query.setInteger("marcaId", vendaEmbarcada.getMarcaId()); + query.setInteger("origemId", vendaEmbarcada.getOrigemId()); + query.setInteger("destinoId", vendaEmbarcada.getDestinoId()); + query.setInteger("corridaId", vendaEmbarcada.getCorridaId()); + query.setDate("fecCorrida", vendaEmbarcada.getFecCorrida()); + query.setBigDecimal("precioBase", vendaEmbarcada.getPrecio()); + query.setBigDecimal("precioPagado", vendaEmbarcada.getPrecio()); + query.setInteger("tipoVentaId", vendaEmbarcada.getTipoVentaId()); + query.setDate("fechorViaje", vendaEmbarcada.getFechorViaje()); + query.setDate("fechorVenta", vendaEmbarcada.getFechorVenta()); + query.setInteger("puntoVentaId", vendaEmbarcada.getPuntoVentaId()); + query.setString("numOperacion", vendaEmbarcada.getNumOperacion()); + query.setBigInteger("empresaPuntoVentaId", vendaEmbarcada.getEmpresaId()); + query.setBigInteger("empresaCorridaId", vendaEmbarcada.getEmpresaId()); + query.setInteger("estacionId", vendaEmbarcada.getEstacionId()); + query.setInteger("usuarioId", vendaEmbarcada.getUsuarioId()); + query.setBigDecimal("importeTaxaEmbarque", vendaEmbarcada.getImporteTaxaEmbarque()); + query.setBigDecimal("importePedagio", vendaEmbarcada.getImportePedagio()); + query.setBigDecimal("importeOutros", vendaEmbarcada.getImporteOutros()); + query.setBigDecimal("importeSeguro", vendaEmbarcada.getImporteSeguro()); + query.setDate("fecCreacion", vendaEmbarcada.getFechorVenta()); + query.setInteger("rutaId", vendaEmbarcada.getRutaId()); + query.setTimestamp("fecModIf", vendaEmbarcada.getFecModIf()); + query.setString("numFolioPreimpresso", vendaEmbarcada.getNumFolioPreimpresso()); + query.setString("serieImpFiscal", vendaEmbarcada.getSerieImpFiscal()); + + if (query.executeUpdate() != 1) { + throw new VendaEmbarcadaCajaException("Erro ao gerar caixa venda embarcada"); + } + + } catch (VendaEmbarcadaCajaException e) { + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new VendaEmbarcadaCajaException(e.getMessage(), e); + } + + } + + private void inserirCajaFormaPagoVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaCajaFormapagoException { + try { + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirCajaFormaPagoVendaEmbarcada()); + + query.setInteger("formaPagoId", vendaEmbarcada.getFormaPagoId()); + query.setLong("cajaId", vendaEmbarcada.getCajaId()); + query.setBigDecimal("importe", vendaEmbarcada.getPrecio()); + query.setInteger("usuarioId", vendaEmbarcada.getUsuarioId()); + query.setLong("cajaFormaPagoId", obterIdCajaFormaPago().longValue()); + query.setTimestamp("fecModIf", vendaEmbarcada.getFecModIf()); + + if (query.executeUpdate() != 1) { + throw new VendaEmbarcadaCajaFormapagoException("Erro ao gerar forma de pagamento do caixa venda embarcada"); + } + + } catch (VendaEmbarcadaCajaFormapagoException e) { + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new VendaEmbarcadaCajaFormapagoException(e.getMessage(), e); + } + } + + private void inserirBoletoVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaBoletoException { + try { + + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirBoletoVendaEmbarcada()); + + vendaEmbarcada.setBoletoId(obterIdBoleto().longValue()); + vendaEmbarcada.setNumOperacion(obterNumOperacion().toString()); + + query.setBigInteger("empresaCorridaId", vendaEmbarcada.getEmpresaId()); + query.setInteger("destinoId", vendaEmbarcada.getDestinoId()); + query.setInteger("tipoVentaId", vendaEmbarcada.getTipoVentaId()); + query.setInteger("categoriaId", vendaEmbarcada.getCategoriaId()); + query.setInteger("corridaId", vendaEmbarcada.getCorridaId()); + query.setInteger("claseServicioId", vendaEmbarcada.getClaseServicioId()); + query.setDate("fecCorrida", vendaEmbarcada.getFecCorrida()); + query.setInteger("puntoVentaId", vendaEmbarcada.getPuntoVentaId()); + query.setBigInteger("empresaPuntoVentaId", vendaEmbarcada.getEmpresaId()); + query.setInteger("origemId", vendaEmbarcada.getOrigemId()); + query.setInteger("marcaId", vendaEmbarcada.getMarcaId()); + query.setString("numAsiento", vendaEmbarcada.getNumAsiento()); + query.setBigDecimal("precioPagado", vendaEmbarcada.getPrecio()); + query.setDate("fechorViaje", vendaEmbarcada.getFechorViaje()); + query.setDate("fechorVenta", vendaEmbarcada.getFechorVenta()); + query.setString("numOperacion", vendaEmbarcada.getNumOperacion()); + query.setInteger("usuarioId", vendaEmbarcada.getUsuarioId()); + query.setBigDecimal("precioBase", vendaEmbarcada.getPrecio()); + query.setInteger("estacionId", vendaEmbarcada.getEstacionId()); + query.setBigDecimal("importeTaxaEmbarque", vendaEmbarcada.getImporteTaxaEmbarque()); + query.setBigDecimal("importePedagio", vendaEmbarcada.getImportePedagio()); + query.setBigDecimal("importeOutros", vendaEmbarcada.getImporteOutros()); + query.setBigDecimal("importeSeguro", vendaEmbarcada.getImporteSeguro()); + query.setInteger("rutaId", vendaEmbarcada.getRutaId()); + query.setLong("boletoId", vendaEmbarcada.getBoletoId()); + query.setTimestamp("fecModIf", vendaEmbarcada.getFecModIf()); + query.setBigDecimal("precioPricing", vendaEmbarcada.getPrecio()); + query.setString("numFolioPreimpresso", vendaEmbarcada.getNumFolioPreimpresso()); + query.setString("serieImpFiscal", vendaEmbarcada.getSerieImpFiscal()); + + if (query.executeUpdate() != 1) { + throw new VendaEmbarcadaBoletoException("Erro ao gerar boleto venda embarcada"); + } + + } catch (VendaEmbarcadaBoletoException e) { + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new VendaEmbarcadaBoletoException(e.getMessage(), e); + } + } + + private void inserirBoletoFormaPagoVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws VendaEmbarcadaBoletoFormapagoException { + try { + + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirBoletoFormaPagoVendaEmbarcada()); + + query.setInteger("formaPagoId", vendaEmbarcada.getFormaPagoId()); + query.setLong("boletoId", vendaEmbarcada.getBoletoId()); + query.setBigDecimal("importe", vendaEmbarcada.getPrecio()); + query.setTimestamp("fecModIf", vendaEmbarcada.getFecModIf()); + query.setInteger("usuarioId", vendaEmbarcada.getUsuarioId()); + query.setBigDecimal("boletoFormaPagoId", obterIdBoletoFormaPago()); + + if (query.executeUpdate() != 1) { + throw new VendaEmbarcadaBoletoFormapagoException("Erro ao gerar forma de pagamento do boleto venda embarcada"); + } + + } catch (VendaEmbarcadaBoletoFormapagoException e) { + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new VendaEmbarcadaBoletoFormapagoException(e.getMessage(), e); + } + } + + private BigDecimal obterIdBoletoFormaPago() { + SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceBoletoFormaPago()); + + return gerarChave((BigDecimal) sql.uniqueResult()); + } + + private BigDecimal obterIdCajaFormaPago() { + SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCajaFormaPago()); + + return gerarChave((BigDecimal) sql.uniqueResult()); + } + + private BigDecimal obterIdBoleto() { + SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCajaFormaPago()); + + return gerarChave((BigDecimal) sql.uniqueResult()); + } + + private BigDecimal obterIdCaja() { + SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCaja()); + + return gerarChave((BigDecimal) sql.uniqueResult()); + } + + private BigDecimal obterNumOperacion() { + SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenciaNumOperacion()); + + return gerarChave((BigDecimal) sql.uniqueResult()); + } + + private BigDecimal gerarChave(BigDecimal seq) { + Integer tamChave = 13; + + String chave = "1"; + + --tamChave; + + while ((seq.toString().length() + chave.length()) <= (tamChave)) { + chave += "0"; + } + + return new BigDecimal(chave += seq); + } + + private List carregarDadosDeposito(Long cajaId, Integer formapagoId) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT CDDP.IDENTIFICACAO_DEPOSITO, CDDP.IMPORTE, CDDP.FECDEPOSITO ") + .append("FROM CAJA_DET_DEPOSITO_PAGO CDDP ") + .append("JOIN CAJA_FORMAPAGO CFP ON CFP.CAJAFORMAPAGO_ID = CDDP.CAJAFORMAPAGO_ID ") + .append("WHERE CDDP.ACTIVO = 1 ") + .append("AND CFP.CAJA_ID = :cajaId ") + .append("AND CFP.FORMAPAGO_ID = :formapagoId "); + + SQLQuery query = getSession().createSQLQuery(sQuery.toString()) + .addScalar("IDENTIFICACAO_DEPOSITO", StringType.INSTANCE) + .addScalar("IMPORTE", BigDecimalType.INSTANCE) + .addScalar("FECDEPOSITO", DateType.INSTANCE); + + query.setResultTransformer(new DatosDadosBancarioResultTransformer()); + query.setParameter("cajaId", cajaId); + query.setParameter("formapagoId", formapagoId); + + return query.list(); + } + + private boolean isPagamentoDeposito(TipoFormapago tipoFormapago) { + return TipoFormapago.DEPOSITO.equals(tipoFormapago); + } + + @Override + public Map> buscarCajaYTarjeta(String... numoperacionList) { + + String queryString = "SELECT DISTINCT c FROM Caja c " + + "LEFT JOIN FETCH c.cajaFormaPago cfp " + + "LEFT JOIN FETCH cfp.cajaDetPago cdp " + + "LEFT JOIN FETCH cdp.cajaTarjetas ct " + + "WHERE c.numoperacion IN(:numoperacion) "; + + Query query = getSession().createQuery(queryString); + query.setParameterList("numoperacion", numoperacionList); + + List cajaList = query.list(); + HashMap> result = new HashMap>(); + for (Caja caja : cajaList) { + String numoperacion = caja.getNumoperacion(); + List cajaListTemp = result.get(numoperacion); + if (cajaListTemp == null) { + cajaListTemp = new ArrayList(); + result.put(numoperacion, cajaListTemp); + } + cajaListTemp.add(caja); + } + + return result; + + } + + @Override + @Transactional(rollbackFor = { BusinessException.class }) + public Integer atualizaCajasIntegracaoTotvs(Marca marca, Date dataIncial, Date dataFinal, PuntoVenta puntoVenta) throws BusinessException { + + // update caja set integradototvs = 0 where PUNTOVENTA_ID = 269 and FECHORVENTA >= '30/03/2018' and FECHORVENTA <= '01/04/2018'; + StringBuilder sb = new StringBuilder(); + sb.append(" update caja set integradototvs = 2, CONTADORINTEGRADOTOTVS = 0 "); + sb.append(" where FECHORVENTA >= :fechorInicial "); + sb.append(" and FECHORVENTA <= :fechorFinal "); + sb.append(" and PUNTOVENTA_ID = :puntoVentaId "); + if (marca != null) { + sb.append(" and MARCA_ID = :marcaId "); + } + SQLQuery query = getSession().createSQLQuery(sb.toString()); + if (marca != null) { + query.setInteger("marcaId", marca.getMarcaId()); + } + query.setInteger("puntoVentaId", puntoVenta.getPuntoventaId()); + query.setTimestamp("fechorInicial", dataIncial); + query.setTimestamp("fechorFinal", dataFinal); + Integer result = query.executeUpdate(); + return result; + } + + @Override + public List buscarVendaCartaoCashMonitor(Date dataIncial, Date dataFinal, Empresa empresa, PuntoVenta puntoVenta) { + SimpleDateFormat formatadorData = new SimpleDateFormat("dd/MM/yyyy"); + + StringBuilder sql = new StringBuilder(); + sql.append("select to_char(ct.fecoperacion, 'dd/mm/yyyy') as data_transacao, "); + sql.append("pv.nombpuntoventa as loja, "); + sql.append("ct.nombtitular as adquirente, "); + sql.append("ct.nsu as nsu, "); + sql.append("ct.numautorizacion as autorizacao, "); + sql.append("sum(cfp.importe) as valor_bruto, "); + sql.append("fp.formapago_id as formapago_id, "); + sql.append("ct.tipotarjeta as bandeira, "); + sql.append("c.numoperacion as codigo_pedido, "); + sql.append("cfp.importe valor_parcela, "); + sql.append("count(ct.cajatarjeta_id) as parcelas "); + sql.append("from caja c "); + sql.append("inner join caja_formapago cfp on c.caja_id = cfp.caja_id and cfp.activo = 1 "); + sql.append("inner join marca ma on ma.marca_id = c.marca_id "); + sql.append("inner join forma_pago fp on cfp.formapago_id = fp.formapago_id "); + sql.append("inner join caja_det_pago cdp on c.caja_id = cdp.caja_id and cdp.cajaformapago_id = cfp.cajaformapago_id "); + sql.append("inner join caja_tarjeta ct on ct.cajadetpago_id = cdp.cajadetpago_id "); + sql.append("inner join punto_venta pv on pv.puntoventa_id = c.puntoventa_id "); + sql.append("where c.activo = 1 "); + sql.append("and c.indreimpresion = 0 "); + sql.append("and fp.formapago_id in (2, 3) "); // Débito e Crédito + sql.append("and ct.fecoperacion between to_date('" + formatadorData.format(dataIncial) + " 00:00', 'dd/mm/yyyy hh24:mi') and to_date('" + formatadorData.format(dataFinal) + " 23:59', 'dd/mm/yyyy hh24:mi') "); + + if (empresa!=null) { + sql.append(" and ma.empresa_id = " + empresa.getEmpresaId()); + } + + if (puntoVenta!=null) { + sql.append(" and c.puntoventa_id = " + puntoVenta.getPuntoventaId()); + } + + sql.append(" group by to_char(ct.fecoperacion, 'dd/mm/yyyy'), pv.nombpuntoventa, ct.nombtitular, ct.nsu, ct.numautorizacion, fp.formapago_id, ct.tipotarjeta, c.numoperacion, cfp.importe"); + sql.append(" order by 1, 2, 3, 4, 5"); + + SQLQuery query = getSession().createSQLQuery(sql.toString()) + .addScalar("data_transacao", StringType.INSTANCE) + .addScalar("loja", StringType.INSTANCE) + .addScalar("adquirente", StringType.INSTANCE) + .addScalar("nsu", StringType.INSTANCE) + .addScalar("autorizacao", StringType.INSTANCE) + .addScalar("valor_bruto", BigDecimalType.INSTANCE) + .addScalar("formapago_id", IntegerType.INSTANCE) + .addScalar("bandeira", StringType.INSTANCE) + .addScalar("codigo_pedido", StringType.INSTANCE) + .addScalar("valor_parcela", BigDecimalType.INSTANCE) + .addScalar("parcelas", IntegerType.INSTANCE); + + query.setResultTransformer(new RelatorioVendaCartaoCashMonitorResultTransformer()); + + return query.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CalcularPeajeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CalcularPeajeHibernateDAO.java new file mode 100644 index 000000000..e7bbd66f3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CalcularPeajeHibernateDAO.java @@ -0,0 +1,635 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.log4j.Logger; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.dao.CalcularPeajeDAO; +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; +import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.ClasseIndicePeaje; +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje; +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeajeVigencia; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PrecioFixoPedagio; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService; +import com.rjconsultores.ventaboletos.service.PrecioFixoPedagioService; +import com.rjconsultores.ventaboletos.service.RutaCombinacionService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Repository("calcularPeajeDAO") +public class CalcularPeajeHibernateDAO extends GenericHibernateDAO + implements CalcularPeajeDAO { + + @Autowired + private OrgaoConcedenteService orgaoConcedenteService; + + @Autowired + private RutaCombinacionService rutaCombinacionService; + + @Autowired + private PrecioFixoPedagioService precioFixoPedagioService; + + @Autowired + public CalcularPeajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + private static Logger log = Logger.getLogger(CalcularPeajeHibernateDAO.class); + + @Override + public List buscarRutaWithCasetaPeajeFromOrgao(OrgaoConcedente oc) { + StringBuilder sql = new StringBuilder() + .append("select distinct r ") + .append("from Ruta r, RutaCaseta rc, RutaSecuencia rs, CasetaPeaje cp ") + .append("where rc.rutaSecuencia.rutasecuenciaId = rs.rutasecuenciaId ") + .append(" and rc.casetaPeaje.casetaPeajeId = cp.casetaPeajeId ") + .append(" and rs.ruta.rutaId = r.rutaId "); + if (oc != null && oc.getOrgaoConcedenteId() != null) { + sql.append(" and r.orgaoConcedente.orgaoConcedenteId = :orgaoConcedenteId "); + } + sql.append(" order by r.descruta "); + + Query query = getSession().createQuery(sql.toString()); + if (oc != null && oc.getOrgaoConcedenteId() != null) { + query.setInteger("orgaoConcedenteId", oc.getOrgaoConcedenteId()); + } + + return query.list(); + } + + @Override + public List buscarCasetasPeajeWithinTramo(Ruta ruta) { + StringBuilder sql = new StringBuilder() + .append("with tramo_tmp as ( ") + .append(" select t.origen_id as orig, t.destino_id as dest, t.tramo_id as tra, ") + .append(" t.desctramo as tradesc, t.origen_id as traorig, t.destino_id as tradest, ") + .append(" t.via_id as travia, t.cantkmreal as tracantkm, t.cantkmpagoconductor as tracantkmpago, ") + .append(" t.activo as traactivo, t.fecmodif as trafecmodif, t.usuario_id as trausuario ") + .append(" from ruta_combinacion rcom ") + .append(" inner join ruta r on r.ruta_id = rcom.ruta_id ") + .append(" inner join orgao_concedente oc on oc.orgaoconcedente_id = r.orgaoconcedente_id ") + .append(" inner join tramo t on t.tramo_id = rcom.tramo_id ") + .append(" where r.ruta_id = :rutaId and rcom.activo =1 and r.activo=1 and oc.activo =1 and t.activo = 1 ") + .append("), mytable as ( ") + .append(" select eiorig.icms as icms, ") + .append(" rseqorig.numsecuencia as origen_tramo_inicial_seq, rseqdest.numsecuencia as destino_tramo_final_seq, ") + .append(" torig.tramo_id as tramo_orig, tdest.tramo_id as tramo_dest, ") + .append(" tt.tra as tracomb, tt.orig as ttorig, tt.dest as ttdest, ") + .append(" tt.tradesc as tracombdesc, tt.traorig as tracomborig, tt.tradest as tracombdest, ") + .append(" tt.travia as tracombvia, tt.tracantkm as tracombcantkm, tt.tracantkmpago as tracombcantkmpago, ") + .append(" tt.traactivo as tracombactivo, tt.trafecmodif as tracombfecmodif, tt.trausuario as tracombusuario, emp.NOMBEMPRESA, es.NOMBESTADO ") + .append(" from ruta_secuencia rseqorig ") + .append(" inner join tramo torig on torig.tramo_id = rseqorig.tramo_id and rseqorig.ruta_id = :rutaId ") + .append(" inner join ruta_secuencia rseqdest on rseqorig.ruta_id = rseqdest.ruta_id ") + .append(" inner join tramo tdest on tdest.tramo_id = rseqdest.tramo_id and rseqdest.ruta_id = :rutaId ") + .append(" inner join ruta_empresa re on re.ruta_id = :rutaId ") + .append(" inner join empresa e on re.empresa_id = e.empresa_id ") + .append(" inner join parada porig on torig.origen_id = porig.parada_id ") + .append(" inner join ciudad corig on corig.ciudad_id = porig.ciudad_id ") + .append(" inner join estado eorig on eorig.estado_id = corig.estado_id ") + .append(" inner join empresa_imposto eiorig on eiorig.empresa_id = e.empresa_id and eiorig.estado_id = eorig.estado_id and eiorig.activo = 1 ") + + .append(" join empresa emp on emp.empresa_id = eiorig.empresa_id ") + .append(" join estado es on eiorig.estado_id = es.estado_id ") + + .append(" inner join tramo_tmp tt on torig.origen_id = tt.orig and tdest.destino_id = tt.dest ") + .append(" where rseqorig.activo = 1 and torig.activo = 1 and rseqdest.activo = 1 and tdest.activo = 1 and re.activo = 1 and e.activo = 1 and porig.activo = 1 and corig.activo = 1 and eorig.activo = 1 ") + .append("), caseta_tramo_da_ruta as ( ") + .append(" select rcas.rutacaseta_id as rutacasetaid, rcas.rutasecuencia_id as rutasecuenciaid, rcas.casetapeaje_id, ") + .append(" rseq1.numsecuencia as numsecuencia, rseq1.tramo_id as tramoid, rseq2.numsecuencia as numsecuencia2, ") + .append(" casp.casetapeaje_id as casetapeajeid, casp.desccaseta as desccaseta, casp.importeida as importeida, ") + .append(" casp.importevuelta as importevuelta, casp.activo as caspactivo, casp.fecmodif as caspfecmodif, ") + .append(" casp.usuario_id as caspusuario ") + .append(" from ruta_caseta rcas ") + .append(" inner join ruta_secuencia rseq1 on rcas.rutasecuencia_id = rseq1.rutasecuencia_id ") + .append(" inner join ruta_secuencia rseq2 on rseq2.tramo_id = rseq1.tramo_id ") + .append(" inner join tramo tra on tra.tramo_id = rseq1.tramo_id and rseq1.ruta_id = :rutaId ") + .append(" inner join caseta_peaje casp on casp.casetapeaje_id = rcas.casetapeaje_id ") + .append(" where rcas.activo =1 and rseq1.activo =1 and rseq2.activo =1 and tra.activo =1 and casp.activo =1 ") + .append(") ") + .append("select distinct origen_tramo_inicial_seq, destino_tramo_final_seq, tramo_orig, tramo_dest, tracomb, ttorig, ttdest, ") + .append(" tracombdesc, tracomborig, tracombdest, tracombvia, tracombcantkm, tracombcantkmpago, tracombactivo, ") + .append(" tracombfecmodif, tracombusuario, rutacasetaid, rutasecuenciaid, casetapeaje_id, tramoid, casetapeajeid, ") + .append(" desccaseta, importeida, importevuelta, caspactivo, caspfecmodif, caspusuario, icms, NOMBEMPRESA, NOMBESTADO ") + .append("from mytable my ") + .append(" inner join caseta_tramo_da_ruta ctr on ctr.numsecuencia between my.origen_tramo_inicial_seq and my.destino_tramo_final_seq ") + .append(" order by tracomb "); + + Query query = getSession().createSQLQuery(sql.toString()); + query.setInteger("rutaId", ruta.getRutaId()); + query.setInteger("rutaId", ruta.getRutaId()); + query.setInteger("rutaId", ruta.getRutaId()); + query.setInteger("rutaId", ruta.getRutaId()); + + return query.list(); + } + + // pra cada ruta obter as combinacoes de tramos, cada tramo com sua lista de casetaPeaje + public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao, boolean usaICMS) throws Exception { + boolean isOrgaoNull = orgao == null; + List updates = new ArrayList(); + Set peajes = new HashSet(); + + List classeIndicePeajes = new ArrayList(); + if(orgao != null){ + orgao = orgaoConcedenteService.obtenerID(orgao.getOrgaoConcedenteId()); + classeIndicePeajes = orgao.getClassesIndicePeaje(); + isOrgaoNull = orgao == null; + } + + log.info("****** INICIO DO PROCESSO DE CALCULO DE PEDAGIO ******"); + log.info("****** QTD DE LINHAS = "+lsRuta.size()+"******"); + int z = 0; + for (Ruta ruta : lsRuta) { + log.info("****** Linha "+(++z)+" de "+lsRuta.size()+" ******"); + log.info("****** LINHA : "+ruta.toString()+" ******"); + + List lsObj = buscarCasetasPeajeWithinTramo(ruta); + log.info("****** QTD COMBINAÇÕES DE TRECHOS x QTD PEDAGIOS POR TRECHO: "+lsObj.size()+" ******"); + + if(isOrgaoNull){ + orgao = orgaoConcedenteService.obtenerID(ruta.getOrgaoConcedente().getOrgaoConcedenteId()); + classeIndicePeajes = orgao.getClassesIndicePeaje(); + String update = " update peaje set activo = 0 where ruta_id ="+ruta.getRutaId(); + updates.add(update); + } + + List lsPrecioFixoPedagio = precioFixoPedagioService.obtenerTodos(); + + if (null != lsObj) { + + for (Object arrObj : lsObj) { + + if (((Object[]) arrObj)[27] == null) { + throw new Exception (((Object[])arrObj)[28].toString() + " / " + ((Object[])arrObj)[29].toString()); + } + BigDecimal bigKm = new BigDecimal(((Object[]) arrObj)[11].toString()) ; + PeajeVO pvo = PeajeVO.create(ruta, orgao, (Object[]) arrObj, classeIndicePeajes, usaICMS, bigKm); + // ATENCAO !!! + // neste 'FOR' nao se pode abrir nenhum tipo de consulta no banco pois o 'lsObj' vem com milhares de registros + // e se abrir uma sessao no banco para cada um dos registros, o banco trava. + + PrecioFixoPedagio pfp = new PrecioFixoPedagio(); + pfp.setOrgaoConcedenteId(orgao); + pfp.setClasseId(ruta.getClaseServicio()); + CasetaPeaje pracaPedagio = new CasetaPeaje(); + pracaPedagio.setCasetaPeajeId(pvo.casetaPeajeId); + pfp.setPracaPedagioId(pracaPedagio); + + for(PrecioFixoPedagio pfp2 : lsPrecioFixoPedagio){ + if(pfp.getOrgaoConcedenteId().getOrgaoConcedenteId() == -1 || (pfp2.getPracaPedagioId().getCasetaPeajeId().equals(pfp.getPracaPedagioId().getCasetaPeajeId()) + && pfp2.getOrgaoConcedenteId().getOrgaoConcedenteId().equals(pfp.getOrgaoConcedenteId().getOrgaoConcedenteId()) + && pfp2.getClasseId().getClaseservicioId().equals(pfp.getClasseId().getClaseservicioId())) + ){ + pvo.importePeaje = pfp2.getValorFixo(); + break; + } + } + + peajes.add(pvo); + } + } + log.info("****** FIM LINHA : "+ruta.toString()+" . INSTRUCOES DE INSERT NO BANCO PRONTAS ******"); + } + log.info("****** FIM DO PROCESSO DE CALCULO DE PEDAGIO ******"); + + StringBuilder updateSql = new StringBuilder(); + if(isOrgaoNull == false){ + updateSql = new StringBuilder() + .append("update peaje set activo = 0 ") + .append("where orgaoconcedente_id = ") + .append(orgao.getOrgaoConcedenteId()); + } + + int[] result = {}; + Connection con = getSession().connection(); + try { + Statement stmt = con.createStatement(); + con.setAutoCommit(false); + if(!isOrgaoNull){ + stmt.addBatch(updateSql.toString()); + }else{ + for(String up : updates){ + stmt.addBatch(up); + } + } + int i=0; + + for(PeajeVO peajeVO : peajes){ + i++; + + stmt.addBatch(peajeVO.toInsertQuery()); + stmt.addBatch(peajeVO.toUpdateExcepcionPeajeQuery()); + stmt.addBatch(peajeVO.toUpdateExcepcionPeajeVigenciaQuery()); + + + log.info("**** "+i+ "- de "+ peajes.size()+" de combinacoes de trecho X (praca pedagio por trecho) ****"); + + if(i%100 == 0){ + result = stmt.executeBatch(); + con.commit(); + stmt.close(); + stmt = con.createStatement(); + } + + } + + result = stmt.executeBatch(); + con.commit(); + stmt.close(); + recalcularExcecoesPedagio(peajes); + } + catch (SQLException e) { + e.printStackTrace(); + } + + return result; + } + + private Map buscaCasetas(Set pvo) { + Set ids = new LinkedHashSet(); + Map casetas = new HashMap(); + + for (PeajeVO p : pvo) { + ids.add(p.casetaPeajeId); + } + + if(!ids.isEmpty()){ + Query query = getSession() + .createQuery("select c from CasetaPeaje c where c.casetaPeajeId in (:ids) "); + query.setParameterList("ids", ids); + + for (CasetaPeaje c : (List) query.list()) { + casetas.put(c.getCasetaPeajeId(), c); + } + } + + return casetas; + } + + private ExcepcionPeaje getExcepcion(Integer rutaId, Integer origenId, Integer destinoId) { + Query query = getSession().createQuery("select e from ExcepcionPeaje e where e.ruta.rutaId = :rutaId " + + "and e.origem.paradaId = :origenId and e.destino.paradaId = :destinoId and e.activo = 1 "); + + query.setInteger("rutaId", rutaId); + query.setInteger("origenId", origenId); + query.setInteger("destinoId", destinoId); + return (ExcepcionPeaje) query.uniqueResult(); + } + + private Parada getParada(Integer paradaId) { + return (Parada) getSession().get(Parada.class, paradaId); + } + + private Ruta getRuta(Integer rutaId) { + return (Ruta) getSession().get(Ruta.class, rutaId); + } + + @Transactional + private void recalcularExcecoesPedagio(Set pvos) { + Map casetas = buscaCasetas(pvos); + for (PeajeVO peaje : pvos) { + ExcepcionPeaje excepcion = null; + CasetaPeaje caseta = casetas.get(peaje.casetaPeajeId); + + for (CasetaPeajeExcepcion cpe : caseta.getLsCasetaPeajeExcepcion()) { + if (excepcion == null) { + excepcion = new ExcepcionPeaje(); + excepcion.setActivo(true); + excepcion.setDestino(getParada(peaje.destinoId)); + excepcion.setFecmodif(Calendar.getInstance().getTime()); + excepcion.setOrigem(getParada(peaje.origenId)); + excepcion.setRuta(getRuta(peaje.rutaId)); + excepcion.setUsuarioId(1); + } + ExcepcionPeajeVigencia epv = new ExcepcionPeajeVigencia(); + epv.setActivo(cpe.getActivo()); + epv.setExcepcionPeaje(excepcion); + epv.setFecmodif(Calendar.getInstance().getTime()); + epv.setFecVentaFin(cpe.getFecVentaFin()); + epv.setFecVentaIni(cpe.getFecVentaIni()); + epv.setHoraFin(cpe.getHoraFin()); + epv.setHoraIni(cpe.getHoraIni()); + epv.setINDDOMINGO(cpe.getINDDOMINGO()); + epv.setINDJUEVES(cpe.getINDJUEVES()); + epv.setINDLUNES(cpe.getINDLUNES()); + epv.setINDMARTES(cpe.getINDMARTES()); + epv.setINDMIERCOLES(cpe.getINDMIERCOLES()); + epv.setINDSABADO(cpe.getINDSABADO()); + epv.setINDVIERNES(cpe.getINDVIERNES()); + epv.setPrecio(cpe.getPrecio()); + epv.setUsuarioId(1); + epv.setCasetaPeaje(caseta); + excepcion.getLsExcepcionPeajeVigencia().add(epv); + } + if (excepcion != null) { + getSession().saveOrUpdate(excepcion); + } + } + } + + private static class PeajeVO { + + private static final int HIGH_PRECISION = 10; + private static final BigDecimal A_HUNDRED = new BigDecimal(100); + private static final SimpleDateFormat SDF = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); + + private Integer rutaId; + private Integer origenId; + private Integer destinoId; + private Integer orgaoId; + private Integer casetaPeajeId; + private Integer cantAsientos; + private Integer cantEixos; + private BigDecimal importePeaje; + private BigDecimal indicePeaje; + private Integer activo; + private Date fecmodif; + private Integer usuarioId; + + private static BigDecimal getCantEixos(Ruta ruta) { + try { + return new BigDecimal(ruta.getCantEixos()); + } catch (NullPointerException e) { + throw new RuntimeException("rutaSemQtdEixos;" + ruta.getRutaId()); + } + } + + private static BigDecimal getRutaCantAsientos(Ruta ruta) { + try { + return new BigDecimal(ruta.getCantAsientos()); + } + catch (NullPointerException e) { + throw new RuntimeException("rutaSemQtdAsientos;" + ruta.getRutaId()); + } + } + + private static BigDecimal getImporte(Ruta ruta, Object[] obj) { + if (ruta.getIndSentidoIda()) { + return new BigDecimal(obj[22].toString()); + } + else { + return new BigDecimal(obj[23].toString()); + } + } + + private static BigDecimal getIcms(Ruta ruta, Object[] obj) { + return new BigDecimal(obj[27].toString()) + .divide(A_HUNDRED, HIGH_PRECISION, RoundingMode.HALF_UP); + } + + // ((importe * rutaCantEixos) / (indice * rutaCantAsientos)) / ( 1 - icms) + private static BigDecimal calculateImportePeajeANTT(BigDecimal importe, BigDecimal icms, + BigDecimal indice, BigDecimal rutaCantEixos, BigDecimal rutaCantAsientos, boolean usaICMS) { + + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CALCULO_PEAJE_REUNIDAS_ANTT.getDescricao())) { + // (importe * rutaCantEixos) / (indice) + return importe.multiply(rutaCantEixos) + .divide(indice, HIGH_PRECISION, RoundingMode.HALF_UP); + } + else { + if(!usaICMS){ + return importe.multiply(rutaCantEixos) + .divide(indice.multiply(rutaCantAsientos), HIGH_PRECISION, RoundingMode.HALF_UP); + }else{ + return importe.multiply(rutaCantEixos) + .divide(indice.multiply(rutaCantAsientos), HIGH_PRECISION, RoundingMode.HALF_UP) + .divide(BigDecimal.ONE.subtract(icms), HIGH_PRECISION, RoundingMode.HALF_UP); + } + + } + } + + private static BigDecimal calculateImportePeajeAGER(BigDecimal km) { + return km.multiply(new BigDecimal(0.004895f)).setScale(HIGH_PRECISION, RoundingMode.HALF_UP); // esse valor deveria vir do indice do orgao mas as casas decimais nao sao compativeis.. verificar se pode mudar a precisao do campo de indice.. + } + + // ((importe * rutaCantEixos) / (indice)) / ( 1 - icms) + private static BigDecimal calculateImportePeajeARTESP(BigDecimal importe, BigDecimal icms, + BigDecimal indice, BigDecimal rutaCantEixos, boolean usaICMS) { + if(!usaICMS){ + return importe.multiply(rutaCantEixos) + .divide(indice, HIGH_PRECISION, RoundingMode.HALF_UP); + }else{ + return importe.multiply(rutaCantEixos) + .divide(indice, HIGH_PRECISION, RoundingMode.HALF_UP) + .divide(BigDecimal.ONE.subtract(icms), HIGH_PRECISION, RoundingMode.HALF_UP); + } + + } + + private static BigDecimal calculateImportePeaje(Ruta ruta, OrgaoConcedente orgao, Object[] obj, BigDecimal indicePeaje, boolean usaICMS, BigDecimal km) { + BigDecimal rutaCantEixos = getCantEixos(ruta); + BigDecimal indice = indicePeaje; + BigDecimal importe = getImporte(ruta, obj); + BigDecimal icms = usaICMS ? getIcms(ruta, obj) : null; + + if (Constantes.ORGAOS_CONCEDENTES_CALCULO_ARTESP.contains(orgao.getOrgaoConcedenteId())) { + return calculateImportePeajeARTESP(importe, icms, indice, rutaCantEixos, usaICMS); + } + if (Constantes.ORGAOS_CONCEDENTES_CALCULO_ANTT.contains(orgao.getOrgaoConcedenteId())) { + return calculateImportePeajeANTT(importe, icms, indice, rutaCantEixos, getRutaCantAsientos(ruta), usaICMS); + } + if (Constantes.ORGAOS_CONCEDENTES_CALCULO_AGER.contains(orgao.getOrgaoConcedenteId())) { + return calculateImportePeajeAGER(km); + } + + return BigDecimal.ZERO; // TODO throw an exception? como calcular quando é outro orgao concendente? + } + + private static BigDecimal getIndicePeaje(ClaseServicio claseServicio, + OrgaoConcedente orgao, List lsClasseIndicePeaje) { + + for (ClasseIndicePeaje classeIndicePeaje : lsClasseIndicePeaje) { + if (claseServicio.equals(classeIndicePeaje.getClasseServicio())) { + return classeIndicePeaje.getIndicePeaje(); + } + } + return orgao.getIndicePeaje(); + } + + private static PeajeVO create(Ruta ruta, OrgaoConcedente orgao, + Object[] obj, List lsClasseIndicePeaje, boolean usaICMS, BigDecimal km) { + + PeajeVO pvo = new PeajeVO(); + + pvo.rutaId = ruta.getRutaId(); + pvo.cantEixos = ruta.getCantEixos(); + pvo.cantAsientos = ruta.getCantAsientos(); + pvo.origenId = Integer.parseInt(obj[8].toString()); + pvo.destinoId = Integer.parseInt(obj[9].toString()); + pvo.orgaoId = orgao.getOrgaoConcedenteId(); + pvo.casetaPeajeId = Integer.parseInt(obj[20].toString()); + pvo.indicePeaje = getIndicePeaje(ruta.getClaseServicio(), orgao, lsClasseIndicePeaje); + + pvo.importePeaje = calculateImportePeaje(ruta, orgao, obj, pvo.indicePeaje, usaICMS, km); + + pvo.activo = 1; + pvo.fecmodif = new Date(); + pvo.usuarioId = UsuarioLogado.getUsuarioLogado().getUsuarioId(); + + return pvo; + } + + private String toInsertQuery() { + return new StringBuilder() + .append("insert into peaje ( peaje_id, ruta_id, origen_id, destino_id, ") + .append(" orgaoconcedente_id, casetapeaje_id, cantasientos, canteixos, ") + .append(" importepeaje, indicepeaje, activo, fecmodif, usuario_id ) ") + .append("values ( peaje_seq.nextval, ") + .append(rutaId).append(", ") + .append(origenId).append(", ") + .append(destinoId).append(", ") + .append(orgaoId).append(", ") + .append(casetaPeajeId).append(", ") + .append(cantAsientos).append(", ") + .append(cantEixos).append(", ") + .append(importePeaje).append(", ") + .append(indicePeaje).append(", ") + .append(activo).append(", ") + .append("to_date('") + .append(SDF.format(fecmodif)) + .append("', 'yyyy/mm/dd hh24:mi:ss'), ") + .append(usuarioId).append(" ) ") + .toString(); + } + + private String toUpdateExcepcionPeajeQuery() { + return new StringBuilder() + .append("update excepcion_peaje ") + .append("set activo = 0 ") + .append("where ruta_id = ").append(rutaId) + .append(" and origen_id = ").append(origenId) + .append(" and destino_id = ").append(origenId) + .toString(); + } + + private String toUpdateExcepcionPeajeVigenciaQuery() { + return new StringBuilder() + .append("update excepcion_peaje_vigencia ") + .append("set activo = 0 ") + .append("where excepcionpeaje_id in ( ") + .append(" select excepcionpeaje_id ") + .append(" from excepcion_peaje ") + .append(" where ruta_id = ").append(rutaId) + .append(" and origen_id = ").append(origenId) + .append(" and destino_id = ").append(origenId) + .append(")") + .toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activo == null) ? 0 : activo.hashCode()); + result = prime * result + ((cantAsientos == null) ? 0 : cantAsientos.hashCode()); + result = prime * result + ((cantEixos == null) ? 0 : cantEixos.hashCode()); + result = prime * result + ((casetaPeajeId == null) ? 0 : casetaPeajeId.hashCode()); + result = prime * result + ((destinoId == null) ? 0 : destinoId.hashCode()); + result = prime * result + ((importePeaje == null) ? 0 : importePeaje.hashCode()); + result = prime * result + ((indicePeaje == null) ? 0 : indicePeaje.hashCode()); + result = prime * result + ((orgaoId == null) ? 0 : orgaoId.hashCode()); + result = prime * result + ((origenId == null) ? 0 : origenId.hashCode()); + result = prime * result + ((rutaId == null) ? 0 : rutaId.hashCode()); + result = prime * result + ((usuarioId == null) ? 0 : usuarioId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PeajeVO other = (PeajeVO) obj; + if (activo == null) { + if (other.activo != null) + return false; + } else if (!activo.equals(other.activo)) + return false; + if (cantAsientos == null) { + if (other.cantAsientos != null) + return false; + } else if (!cantAsientos.equals(other.cantAsientos)) + return false; + if (cantEixos == null) { + if (other.cantEixos != null) + return false; + } else if (!cantEixos.equals(other.cantEixos)) + return false; + if (casetaPeajeId == null) { + if (other.casetaPeajeId != null) + return false; + } else if (!casetaPeajeId.equals(other.casetaPeajeId)) + return false; + if (destinoId == null) { + if (other.destinoId != null) + return false; + } else if (!destinoId.equals(other.destinoId)) + return false; + if (importePeaje == null) { + if (other.importePeaje != null) + return false; + } else if (!importePeaje.equals(other.importePeaje)) + return false; + if (indicePeaje == null) { + if (other.indicePeaje != null) + return false; + } else if (!indicePeaje.equals(other.indicePeaje)) + return false; + if (orgaoId == null) { + if (other.orgaoId != null) + return false; + } else if (!orgaoId.equals(other.orgaoId)) + return false; + if (origenId == null) { + if (other.origenId != null) + return false; + } else if (!origenId.equals(other.origenId)) + return false; + if (rutaId == null) { + if (other.rutaId != null) + return false; + } else if (!rutaId.equals(other.rutaId)) + return false; + if (usuarioId == null) { + if (other.usuarioId != null) + return false; + } else if (!usuarioId.equals(other.usuarioId)) + return false; + return true; + } + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCargoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCargoHibernateDAO.java new file mode 100644 index 000000000..079d896a5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCargoHibernateDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CancelacionCargoDAO; +import com.rjconsultores.ventaboletos.entidad.CancelacionCargo; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("cancelacionCargoDAO") +public class CancelacionCargoHibernateDAO extends GenericHibernateDAO + implements CancelacionCargoDAO { + + @Autowired + public CancelacionCargoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCtrlHibernateDAO.java new file mode 100644 index 000000000..a2b55ecb7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CancelacionCtrlHibernateDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CancelacionCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.CancelacionCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("cancelacionCtrlDAO") +public class CancelacionCtrlHibernateDAO extends GenericHibernateDAO + implements CancelacionCtrlDAO { + + @Autowired + public CancelacionCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(Date tiempoprevsalida, PuntoVenta puntoVenta, Parada paradaOrigem, + Parada paradaDestino, Marca marca) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("tiempoprevsalida", tiempoprevsalida)); + c.add(Restrictions.eq("puntoVenta", puntoVenta)); + c.add(Restrictions.eq("paradaOrigem", paradaOrigem)); + c.add(Restrictions.eq("paradaDestino", paradaDestino)); + c.add(Restrictions.eq("marca", marca)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CasetaPeajeExcepcionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CasetaPeajeExcepcionHibernateDAO.java new file mode 100644 index 000000000..7aec38aca --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CasetaPeajeExcepcionHibernateDAO.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CasetaPeajeExcepcionDAO; +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; +import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion; + +@Repository("casetaPeajeExcepcionDAO") +public class CasetaPeajeExcepcionHibernateDAO extends GenericHibernateDAO implements CasetaPeajeExcepcionDAO { + + @Autowired + public CasetaPeajeExcepcionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List obtenerPorCasetaPeaje(CasetaPeaje caseta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("casetaPeaje", caseta)); + c.add(Restrictions.eq("activo", true)).setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CasetaPeajeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CasetaPeajeHibernateDAO.java new file mode 100644 index 000000000..3a3db6a26 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CasetaPeajeHibernateDAO.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CasetaPeajeDAO; +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; +import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion; + +@Repository("casetaPeajeDAO") +public class CasetaPeajeHibernateDAO extends GenericHibernateDAO implements CasetaPeajeDAO { + + @Autowired + public CasetaPeajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return (List) c.list(); + } + + public List buscarTodosOrdenadoPorDescricao() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desccaseta")); + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + return (List) c.list(); + } + + @Override + public List buscar(String casetaPeajeDesc) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desccaseta", casetaPeajeDesc)); + return c.list(); + } + + @Override + public void deletarVigencias(List cpes) { + for (CasetaPeajeExcepcion cpe : cpes) { + String hql = " update CasetaPeajeExcepcion set activo = false, fecModif = :fecModif, usuarioId = :usuarioId where casetaPeajeExcepcionId = " + cpe.getCasetaPeajeExcepcionId(); + Query sq = getSession().createQuery(hql); + sq.setTimestamp("fecModif", cpe.getFecmodif()); + sq.setInteger("usuarioId", cpe.getUsuarioId()); + sq.executeUpdate(); + } + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaBloqueioImpPosteriorHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaBloqueioImpPosteriorHibernateDAO.java new file mode 100644 index 000000000..e4f4f627a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaBloqueioImpPosteriorHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.CategoriaBloqueioImpPosteriorDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaBloqueioImpPosterior; + +@Repository("categoriaBloqueioImpPosteriorDAO") +public class CategoriaBloqueioImpPosteriorHibernateDAO extends GenericHibernateDAO + implements CategoriaBloqueioImpPosteriorDAO { + + @Autowired + public CategoriaBloqueioImpPosteriorHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaClaseHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaClaseHibernateDAO.java new file mode 100644 index 000000000..199636b48 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaClaseHibernateDAO.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaClaseDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaClase; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("categoriaClaseDAO") +public class CategoriaClaseHibernateDAO extends GenericHibernateDAO + implements CategoriaClaseDAO { + + @Autowired + public CategoriaClaseHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public CategoriaClase busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("categoriaCtrl", categoriaCtrl)); + + return (CategoriaClase) c.uniqueResult(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCorridaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCorridaHibernateDAO.java new file mode 100644 index 000000000..b20b81a80 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCorridaHibernateDAO.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaCorridaDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCorrida; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("categoriaCorridaDAO") +public class CategoriaCorridaHibernateDAO extends GenericHibernateDAO + implements CategoriaCorridaDAO { + + @Autowired + public CategoriaCorridaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public CategoriaCorrida busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("categoriaCtrl", categoriaCtrl)); + + return (CategoriaCorrida) c.uniqueResult(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCtrlHibernateDAO.java new file mode 100644 index 000000000..4ec3086f9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaCtrlHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("categoriaCtrlDAO") +public class CategoriaCtrlHibernateDAO extends GenericHibernateDAO + implements CategoriaCtrlDAO { + + @Autowired + public CategoriaCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java new file mode 100644 index 000000000..429da6817 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java @@ -0,0 +1,80 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.hibernate.type.BooleanType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CategoriaDescuentoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; + +/** + * + * @author Administrador + */ +@Repository("categoriaDescuentoDAO") +public class CategoriaDescuentoHibernateDAO + extends GenericHibernateDAO + implements CategoriaDescuentoDAO { + + @Autowired + public CategoriaDescuentoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public CategoriaDescuento pesquisarPorCategoriaEmpresa(Integer categoriaId, Integer empresaId){ + Criteria c = getSession().createCriteria(getPersistentClass()) + .createAlias("categoriaCtrl", "ctrl") + .createAlias("ctrl.empresa", "e") + .add(Restrictions.eq("activo", Boolean.TRUE)) + .add(Restrictions.eq("e.empresaId", empresaId)) + .add(Restrictions.eq("categoria.categoriaId", categoriaId)); + c.setMaxResults(1); + + return (CategoriaDescuento) c.uniqueResult(); + } + + @Override + public boolean isAplicaTarifaMinima(Integer categoriaId, Integer empresaId) { + + StringBuilder sql = new StringBuilder(); + + sql.append(" SELECT coalesce(cd.indnaoaplicatarifaminima, 0) as tarifa "); + sql.append(" from categoria_descuento cd "); + sql.append(" inner join categoria_ctrl cc "); + sql.append(" on cc.categoriactrl_id = cd.categoriactrl_id "); + sql.append(" and cc.empresa_id = :empresaId "); + sql.append(" and cc.activo = 1 "); + sql.append(" where cd.categoria_id = :categoriaId "); + sql.append(" and cd.activo = 1 "); + + Query query = getSession().createSQLQuery(sql.toString()) + .addScalar("tarifa", BooleanType.INSTANCE); + + query.setParameter("empresaId", empresaId ); + query.setParameter("categoriaId", categoriaId ); + + Boolean retorno = (Boolean)query.uniqueResult(); + + return Boolean.FALSE.equals(retorno); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaHibernateDAO.java new file mode 100644 index 000000000..70f523905 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaHibernateDAO.java @@ -0,0 +1,79 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; + +/** + * + * @author Administrador + */ +@Repository("categoriaDAO") +public class CategoriaHibernateDAO extends GenericHibernateDAO + implements CategoriaDAO { + + @Autowired + public CategoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desccategoria")); + + return c.list(); + } + + public List buscar(String desccategoria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desccategoria", desccategoria)); + + return c.list(); + } + + @Override + public List buscarCategoriaPesquisada(String desccategoria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ilike("desccategoria", desccategoria, MatchMode.ANYWHERE)); + + return c.list(); + } + + @Override + public List buscarCategoriaOrgaoConcedente(String orgaoConcedente) { + + StringBuilder sql = new StringBuilder(); + + orgaoConcedente = "'%" + orgaoConcedente + "%'"; + + sql.append("SELECT DISTINCT c.desccategoria "); + sql.append(" FROM Categoria c "); + sql.append(" left join categoria_descuento cd on (c.categoria_id = cd.categoria_id and cd.activo=1 ) "); + sql.append(" left join CATEGORIA_ORGAO co on (co.categoriactrl_id = cd.categoriactrl_id and co.activo = 1) "); + sql.append(" left join orgao_concedente oc on (co.orgaoconcedente_id = oc.orgaoconcedente_id) "); + sql.append(" WHERE oc.descorgao like '%DAER%' or oc.descorgao LIKE 'TODOS' "); + + Query sq = getSession().createSQLQuery(sql.toString()); + + return sq.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMarcaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMarcaHibernateDAO.java new file mode 100644 index 000000000..e8cbc17d6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMarcaHibernateDAO.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMarca; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("categoriaMarcaDAO") +public class CategoriaMarcaHibernateDAO extends GenericHibernateDAO + implements CategoriaMarcaDAO { + + @Autowired + public CategoriaMarcaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public CategoriaMarca busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("categoriaCtrl", categoriaCtrl)); + + return (CategoriaMarca) c.uniqueResult(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMercadoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMercadoHibernateDAO.java new file mode 100644 index 000000000..84ad8a3c6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaMercadoHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMercado; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("categoriaMercadoDAO") +public class CategoriaMercadoHibernateDAO + extends GenericHibernateDAO + implements CategoriaMercadoDAO { + + @Autowired + public CategoriaMercadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public CategoriaMercado busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("categoriaCtrl", categoriaCtrl)); + + return (CategoriaMercado) c.uniqueResult(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaOrgaoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaOrgaoHibernateDAO.java new file mode 100644 index 000000000..6334b5011 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaOrgaoHibernateDAO.java @@ -0,0 +1,44 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CategoriaOrgaoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaOrgao; + +@Repository("categoriaOrgaoDAO") + +public class CategoriaOrgaoHibernateDAO extends GenericHibernateDAO + implements CategoriaOrgaoDAO { + + @Autowired + public CategoriaOrgaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public CategoriaOrgao busquedaPorCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("categoriaCtrl", categoriaCtrl)); + + return (CategoriaOrgao) c.uniqueResult(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaPeriodoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaPeriodoHibernateDAO.java new file mode 100644 index 000000000..8c700c76b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaPeriodoHibernateDAO.java @@ -0,0 +1,74 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CategoriaPeriodoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo; + +/** + * + * @author Administrador + */ +@Repository("categoriaPeriodoDAO") +public class CategoriaPeriodoHibernateDAO + extends GenericHibernateDAO + implements CategoriaPeriodoDAO { + + @Autowired + public CategoriaPeriodoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscarPeriodoIntervalo(CategoriaPeriodo cPeriodo) { + + Calendar feciniciovigencia = Calendar.getInstance(); + feciniciovigencia.setTime(cPeriodo.getFecinicio()); + feciniciovigencia.set(Calendar.MILLISECOND, 0); + feciniciovigencia.set(Calendar.SECOND, 0); + + Calendar fecfinvigencia = Calendar.getInstance(); + fecfinvigencia.setTime(cPeriodo.getFecfin()); + fecfinvigencia.set(Calendar.MILLISECOND, 0); + fecfinvigencia.set(Calendar.SECOND, 0); + + Criteria c = this.getSession().createCriteria(CategoriaPeriodo.class); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ge("fecfin", feciniciovigencia.getTime())); + c.add(Restrictions.le("fecinicio", fecfinvigencia.getTime())); + c.add(Restrictions.eq("categoriaDescuento", cPeriodo.getCategoriaDescuento())); + + + return c.list(); + } + + @Override + public List obtenerPorCategoriaDescuento(CategoriaDescuento categoriaDescuento) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("categoriaDescuento", categoriaDescuento)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaTipoPtoVtaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaTipoPtoVtaHibernateDAO.java new file mode 100644 index 000000000..5cc9c0d84 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaTipoPtoVtaHibernateDAO.java @@ -0,0 +1,55 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CategoriaTipoPtoVtaDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("categoriaTipoPtoVtaDAO") +public class CategoriaTipoPtoVtaHibernateDAO extends GenericHibernateDAO + implements CategoriaTipoPtoVtaDAO { + + @Autowired + public CategoriaTipoPtoVtaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarPorPuntoVenta(TipoPuntoVenta tipoPuntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tipoPuntoVenta", tipoPuntoVenta)); + + return c.list(); + } + + public void borrarFisico(CategoriaTipoPtoVta cd) { + + String hql = " delete from CategoriaTipoPtoVta where categoriatipoptovtaId = " + cd.getCategoriatipoptovtaId(); + Query sq = getSession().createQuery(hql); + sq.executeUpdate(); + + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CiudadHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CiudadHibernateDAO.java new file mode 100644 index 000000000..40a94f76b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CiudadHibernateDAO.java @@ -0,0 +1,79 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CiudadDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author MCosso + */ +@Repository("ciudadDAO") +public class CiudadHibernateDAO extends GenericHibernateDAO + implements CiudadDAO { + + @Autowired + public CiudadHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombciudad")); + + return c.list(); + } + + public List buscar(String nombciudad, Estado estado, Plaza plaza) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombciudad", nombciudad)); + c.add(Restrictions.eq("estado", estado)); + + return c.list(); + } + + public List buscaLike(String strCiudad) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.like("nombciudad", strCiudad, MatchMode.START)); + c.addOrder(Order.asc("nombciudad")); + + return c.list(); + } + @Override + public List buscarPorEstado(Estado estado) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("estado", estado)); + c.addOrder(Order.asc("nombciudad")); + + return c.list(); + } + + @Override + public List buscaCodMun(Integer codMun, Estado estado) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("codmunicipio", codMun)); + c.add(Restrictions.eq("estado", estado)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ClaseservicioEquivalenciaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClaseservicioEquivalenciaHibernateDAO.java new file mode 100644 index 000000000..4276dc1b3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClaseservicioEquivalenciaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ClaseservicioEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.ClaseservicioEquivalencia; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("claseservicioEquivalenciaDAO") +public class ClaseservicioEquivalenciaHibernateDAO + extends GenericHibernateDAO + implements ClaseservicioEquivalenciaDAO { + + @Autowired + public ClaseservicioEquivalenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(ClaseServicio claseServicio, ComisionistaExterno comisionistaExterno) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("claseservicio", claseServicio)); + c.add(Restrictions.eq("comisionistaExterno", comisionistaExterno)); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarEquivalencia(ClaseservicioEquivalencia claseServicioEquivalencia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("equivalenciaId", claseServicioEquivalencia.getEquivalenciaId())); + + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ClasseServicoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClasseServicoHibernateDAO.java new file mode 100644 index 000000000..23b4880ce --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClasseServicoHibernateDAO.java @@ -0,0 +1,91 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ClasseServicoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; + +/** + * + * @author Administrador + */ +@SuppressWarnings("unchecked") +@Repository("claseServicioDAO") +public class ClasseServicoHibernateDAO extends GenericHibernateDAO implements ClasseServicoDAO { + + @Autowired + public ClasseServicoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descclase")); + + return c.list(); + } + + public List buscarPorEmpresasDoUsuario(String empresasUsuario) { + + String consulta = "SELECT DISTINCT mcs.marcaClaseservicioPK.claseservicio " + + "FROM MarcaClaseServicio mcs " + + "WHERE mcs.marcaClaseservicioPK.marca.empresa.empresaId IN (:empresas) and mcs.activo = 1 "; + + List ids = new ArrayList(); + for (String empresa : empresasUsuario.split(",")) { + ids.add(new Integer(empresa)); + } + Query query = getSession().createQuery(consulta); + query.setParameterList("empresas", ids); + + List result = (List) query.list(); + return result; + } + + public List buscarPorNome(Integer idClaseServicio, String nomeClaseServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descclase", nomeClaseServicio)); + + if (idClaseServicio != null) { + c.add(Restrictions.ne("claseservicioId", idClaseServicio)); + } + + return c.list(); + } + + public List buscarTodosExceto(Integer... idClase) { + Criteria c = this.makeCriteria(); + for (Integer id : idClase) { + c.add(Restrictions.ne("claseservicioId", id)); + } + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descclase")); + + return c.list(); + } + + public List buscarListaPorIds(List claseIds) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.in("claseservicioId", claseIds)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteCursoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteCursoHibernateDAO.java new file mode 100644 index 000000000..b8cca49d7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteCursoHibernateDAO.java @@ -0,0 +1,43 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ClienteCursoDAO; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteCurso; +import com.rjconsultores.ventaboletos.entidad.Curso; + +@Repository("clienteCursoDAO") +public class ClienteCursoHibernateDAO extends GenericHibernateDAO + implements ClienteCursoDAO { + + @Autowired + public ClienteCursoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @Override + public ClienteCurso buscarClienteCurso(Cliente cliente, Curso curso) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("cliente", cliente)); + c.add(Restrictions.eq("curso", curso)); + + return (ClienteCurso) c.uniqueResult(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDescuentoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDescuentoHibernateDAO.java new file mode 100644 index 000000000..18fe7b86c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDescuentoHibernateDAO.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ClienteDescuentoDAO; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteDescuento; + +@Repository("clienteDescuentoDAO") +public class ClienteDescuentoHibernateDAO extends GenericHibernateDAO +implements ClienteDescuentoDAO { + + @Autowired + public ClienteDescuentoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Cliente cliente) { + Criteria c = getSession().createCriteria(getPersistentClass()); + //c.add(Restrictions.eq("activo", 1)); + c.add(Restrictions.eq("cliente", cliente)); + return c.list(); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDireccionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDireccionHibernateDAO.java new file mode 100644 index 000000000..02446eef7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteDireccionHibernateDAO.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + + + +import com.rjconsultores.ventaboletos.dao.ClienteDireccionDAO; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteDireccion; + + +@Repository("clienteDireccionDAO") +public class ClienteDireccionHibernateDAO extends GenericHibernateDAO + implements ClienteDireccionDAO { + + @Autowired + public ClienteDireccionHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(Integer clienteId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + Cliente cliente = new Cliente(); + cliente.setClienteId(clienteId); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("clienteId", cliente)); + return c.list(); + } + + public List buscar(Cliente cliente){ + Criteria c = getSession().createCriteria(getPersistentClass()); + //c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("clienteId", cliente)); + return c.list(); + } +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteHibernateDAO.java new file mode 100644 index 000000000..53ee8c74a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClienteHibernateDAO.java @@ -0,0 +1,95 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ClienteDAO; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +@Repository("clienteDAO") +public class ClienteHibernateDAO extends GenericHibernateDAO + implements ClienteDAO { + + private static final String FIELD_ACTIVO = "activo"; + + @Autowired + public ClienteHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getCriteriaClienteActivo(); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(String nombCliente) { + Criteria c = getCriteriaClienteActivo(); + c.add(Restrictions.eq("nombcliente", nombCliente)); + + return c.list(); + } + + @Override + public Cliente buscarPorNumeroFidelidade(String numeroFidelidade, Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq(FIELD_ACTIVO, Boolean.TRUE)); + + Criteria clienteFidelidad = null; + clienteFidelidad = c.createCriteria("listClienteFidelidad"); + clienteFidelidad.add(Restrictions.eq(FIELD_ACTIVO, Boolean.TRUE)); + clienteFidelidad.add(Restrictions.eq("empresa", empresa)); + + Criteria tarjetaFidelidad = null; + tarjetaFidelidad = clienteFidelidad.createCriteria("tarjetaFidelidad"); + tarjetaFidelidad.add(Restrictions.eq("numTarjeta", numeroFidelidade)); + tarjetaFidelidad.add(Restrictions.eq(FIELD_ACTIVO, Boolean.TRUE)); + + c.setMaxResults(1); + return (Cliente)c.uniqueResult(); + } + + @Override + public List buscarPorDocumento(String documento) { + Criteria c = getCriteriaClienteActivo(); + c.add(Restrictions.eq("numIdentificaUno", documento)); + + return c.list(); + } + + private Criteria getCriteriaClienteActivo() { + Criteria criteria = getSession().createCriteria(getPersistentClass()); + criteria.add(Restrictions.eq(FIELD_ACTIVO, Boolean.TRUE)); + return criteria; + } + + @Override + public Cliente buscarPorNumeroFidelidade(String numeroFidelidade) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + Criteria clienteFidelidad = null; + clienteFidelidad = c.createCriteria("listClienteFidelidad"); + clienteFidelidad.add(Restrictions.eq(FIELD_ACTIVO, Boolean.TRUE)); + + + Criteria tarjetaFidelidad = null; + tarjetaFidelidad = clienteFidelidad.createCriteria("tarjetaFidelidad"); + tarjetaFidelidad.add(Restrictions.eq("numTarjeta", numeroFidelidade)); + tarjetaFidelidad.add(Restrictions.eq(FIELD_ACTIVO, Boolean.TRUE)); + + + c.setMaxResults(1); + return (Cliente)c.uniqueResult(); } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ClientePacoteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClientePacoteHibernateDAO.java new file mode 100644 index 000000000..4c7dae245 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ClientePacoteHibernateDAO.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Query; +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.ClientePacoteDAO; +import com.rjconsultores.ventaboletos.entidad.ClientePacote; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO; + +@Repository("clientePacoteDAO") +public class ClientePacoteHibernateDAO extends GenericHibernateDAO implements ClientePacoteDAO { + + @Autowired + public ClientePacoteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List busquedaDatosClientePacote(String cpfCnpj) { + List clientePacoteVOs = new ArrayList(); + if(StringUtils.isNotBlank(cpfCnpj)) { + Map parametros = new HashMap(); + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT NEW com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO(cp.razaoSocial, cp.cpfCnpj, cp.tipoPessoa, cp.descemail, cp.desctelefone, cp.descfax, cp.cep, ") + .append("cp.endereco, cp.numero, cp.complemento, cp.pais, cp.estado, cp.cidade, cp.bairro) ") + .append("FROM ClientePacote cp "); + + if(StringUtils.isNotBlank(cpfCnpj)) { + sQuery.append("WHERE cp.cpfCnpj = :cpfCnpj "); + parametros.put("cpfCnpj", cpfCnpj.replaceAll("[^0-9]", "")); + } + + sQuery.append("ORDER BY cp.razaoSocial "); + Query qr = getSession().createQuery(sQuery.toString()); + for (Entry parametro : parametros.entrySet()) { + qr.setParameter(parametro.getKey(), parametro.getValue()); + } + + clientePacoteVOs = qr.list(); + } + + return clientePacoteVOs; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CobrancaAdcPuntoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CobrancaAdcPuntoVentaHibernateDAO.java new file mode 100644 index 000000000..975274a65 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CobrancaAdcPuntoVentaHibernateDAO.java @@ -0,0 +1,82 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.hibernate.Query; +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.CobrancaAdcPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.CobrancaAdcPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.CobrancaAdicionalHistorico; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +@Repository("cobrancaAdcPuntoVentaHibernateDAO") +public class CobrancaAdcPuntoVentaHibernateDAO extends GenericHibernateDAO implements CobrancaAdcPuntoVentaDAO { + + @Autowired + public CobrancaAdcPuntoVentaHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List buscaHistoricoCobranca(CobrancaAdcPuntoVenta cobranca, Date dataInicial, Date dataFinal) { + List cobrancaHistorico = new ArrayList(); + + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT ") + .append(" h ") + .append("FROM ") + .append(" CobrancaAdicionalHistorico h ") + .append("WHERE ") + .append(" h.cobrancaAdicional.cobrancaAddPuntoVenta_id = :cobrancaAdicionalId and ") + .append(" h.dataRegistro between :dataInicial and :dataFinal ") + .append("ORDER BY ") + .append(" h.cobrancaAdicionalHistoricoID "); + + Query qr = getSession().createQuery(sQuery.toString()); + + qr.setParameter("dataInicial", dataInicial); + qr.setParameter("dataFinal", dataFinal); + qr.setParameter("cobrancaAdicionalId", cobranca == null ? 0 : cobranca.getCobrancaAddPuntoVenta_id()); + + cobrancaHistorico = qr.list(); + + return cobrancaHistorico; + } + + @Override + @SuppressWarnings("unchecked") + public List buscarTodasAsCobrancas(PuntoVenta puntoVenta) { + + if (puntoVenta == null) + return null; + + List cobrancaAdcList = new ArrayList(); + + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT ") + .append(" h ") + .append("FROM ") + .append(" CobrancaAdcPuntoVenta h ") + .append("WHERE ") + .append(" h.puntoVenta.puntoventaId = :puntoVentaId ") + .append("ORDER BY ") + .append(" h.cobrancaAddPuntoVenta_id "); + + Query qr = getSession().createQuery(sQuery.toString()); + + qr.setParameter("puntoVentaId", puntoVenta.getPuntoventaId()); + + cobrancaAdcList = qr.list(); + + return cobrancaAdcList; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CoeficienteTarifaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CoeficienteTarifaHibernateDAO.java new file mode 100644 index 000000000..b2b92499a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CoeficienteTarifaHibernateDAO.java @@ -0,0 +1,44 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CoeficienteTarifaDAO; +import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; + +@Repository("coeficienteTarifaDAO") +public class CoeficienteTarifaHibernateDAO extends GenericHibernateDAO + implements CoeficienteTarifaDAO { + + @Autowired + public CoeficienteTarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descCoeficiente")); + + return c.list(); + } + + @Override + public List buscar(String nomb) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ilike("descCoeficiente", nomb, MatchMode.START)); + c.addOrder(Order.asc("descCoeficiente")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ColoniaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ColoniaHibernateDAO.java new file mode 100644 index 000000000..0391cd98c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ColoniaHibernateDAO.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ColoniaDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Colonia; + +import java.util.List; + +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("coloniaDAO") +public class ColoniaHibernateDAO extends GenericHibernateDAO + implements ColoniaDAO { + + @Autowired + public ColoniaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desccolonia")); + + return c.list(); + } + + public List buscar(String desccolonia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desccolonia", desccolonia)); + + return c.list(); + } + + public List buscarPorCiudad(Ciudad ciudad) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("ciudad", ciudad)); + c.addOrder(Order.asc("desccolonia")); + return c.list(); + } + + @Override + public List buscaLike(String desccolonia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.like("desccolonia", desccolonia, MatchMode.START)); + c.addOrder(Order.asc("desccolonia")); + + return c.list(); + } + + @Override + public List buscarPorCodMun(Ciudad ciudad, String desccolonia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("ciudad", ciudad)); + c.add(Restrictions.eq("desccolonia", desccolonia)); + return c.list(); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ComisionistaExternoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ComisionistaExternoHibernateDAO.java new file mode 100644 index 000000000..8a3adcb70 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ComisionistaExternoHibernateDAO.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ComisionistaExternoDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("comisionistaExternoDAO") +public class ComisionistaExternoHibernateDAO extends GenericHibernateDAO + implements ComisionistaExternoDAO { + + @Autowired + public ComisionistaExternoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desccomisionista")); + + return c.list(); + } + + public List buscar(String desccomisionista) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desccomisionista", desccomisionista)); + + c.addOrder(Order.asc("desccomisionista")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoHibernateDAO.java new file mode 100644 index 000000000..c86544b88 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoHibernateDAO.java @@ -0,0 +1,283 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Collection; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.BigDecimalType; +import org.hibernate.type.BooleanType; +import org.hibernate.type.DateType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.constantes.TipoEventoExtra; +import com.rjconsultores.ventaboletos.dao.ComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.Comissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao; + +@Repository("comissaoHibernateDAO") +public class ComissaoHibernateDAO extends GenericHibernateDAO implements ComissaoDAO { + + @Autowired + public ComissaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List buscarReceitasComissoes(Integer puntoVentaId, Integer empresaId, Date periodo) { + + StringBuffer sql = new StringBuffer(); + sql.append("select "); + sql.append("b.marca_id as empresaId, b.puntoventa_id as puntoVentaId, "); + sql.append("to_char(b.fechorventa, 'dd-mm-yyyy') as datavenda, b.indstatusboleto as indstatusboleto, "); + sql.append("b.tipoventa_id as tipoVenta, b.motivocancelacion_id as motivoCancelacionId, "); + sql.append("coalesce(sum(b.preciopagado), 0) as valorpagado, coalesce(sum(b.importeseguro), 0) as seguro, "); + sql.append("coalesce(sum(b.importepedagio), 0) as pedagio, coalesce(sum(b.importetaxaembarque), 0) as embarque, "); + sql.append("coalesce(sum(case when tee.cvetipoevento = :teeexcbag then ee.impingreso else 0 end), 0) as excessoBagagem, "); + sql.append("coalesce(sum(case when tee.cvetipoevento = :teesegop then ee.impingreso else 0 end), 0) as seguroOpcional, "); + sql.append("coalesce(sum(case when tee.cvetipoevento not in (:teesegop,:teeexcbag) then ee.impingreso else 0 end), 0) as seguroOutros, "); + sql.append("case when b.ptovtaventa_id = b.puntoventa_id then 1 else 0 end as ptoVtaOrigem, "); + sql.append("ei.icms as icmsBase, e.estado_id as estadoId "); + sql.append("from boleto b "); + sql.append("inner join parada origen on origen.parada_id = b.origen_id "); + sql.append("inner join ciudad ci on origen.ciudad_id = ci.ciudad_id "); + sql.append("inner join estado e on ci.estado_id = e.estado_id "); + sql.append("inner join punto_venta p on b.puntoventa_id = p.puntoventa_id "); + sql.append("inner join empresa_imposto ei on (ei.estado_id = e.estado_id "); + sql.append(" and ei.empresa_id = b.marca_id and ei.activo = 1) "); + /*sql.append("left join caja c on c.numoperacion = b.numoperacion and c.numfoliosistema = b.numfoliosistema "); + sql.append(" and c.numfoliopreimpreso = b.numfoliopreimpreso and c.numseriepreimpresa = b.numseriepreimpresa ");*/ + sql.append("left join evento_extra ee on ee.boleto_id = b.boleto_id "); + sql.append("left join tipo_evento_extra tee on tee.tipoeventoextra_id = ee.tipoeventoextra_id "); + sql.append("where b.fechorventa between TO_DATE(:dataInicial,'DD/MM/YYYY HH24:MI') and TO_DATE(:dataFinal,'DD/MM/YYYY HH24:MI') "); + sql.append("and b.marca_id = :empresaId "); + sql.append("and (p.puntoventa_id = :puntoventaId or p.puntoventapadre_id = :puntoventaId) "); + sql.append("group by b.marca_id, b.puntoventa_id, to_char(b.fechorventa, 'dd-mm-yyyy'), "); + sql.append("b.indstatusboleto, b.tipoventa_id, b.motivocancelacion_id, b.ptovtaventa_id, ei.icms, e.estado_id "); + sql.append("order by datavenda "); + + Query query = getSession().createSQLQuery(sql.toString()) + .addScalar("empresaId", IntegerType.INSTANCE) + .addScalar("puntoVentaId", IntegerType.INSTANCE) + .addScalar("datavenda", StringType.INSTANCE) + .addScalar("tipoVenta", IntegerType.INSTANCE) + .addScalar("indstatusboleto", StringType.INSTANCE) + .addScalar("motivoCancelacionId", IntegerType.INSTANCE) + .addScalar("valorpagado", BigDecimalType.INSTANCE) + .addScalar("seguro", BigDecimalType.INSTANCE) + .addScalar("pedagio", BigDecimalType.INSTANCE) + .addScalar("embarque", BigDecimalType.INSTANCE) + .addScalar("excessoBagagem", BigDecimalType.INSTANCE) + .addScalar("seguroOpcional", BigDecimalType.INSTANCE) + .addScalar("seguroOutros", BigDecimalType.INSTANCE) + .addScalar("ptoVtaOrigem", BooleanType.INSTANCE) + .addScalar("icmsBase", BigDecimalType.INSTANCE) + .addScalar("estadoId", IntegerType.INSTANCE) + .setResultTransformer(new AliasToBeanResultTransformer(BoletoComissao.class)); + + Date inicioPeriodo = DateUtil.inicioFechaPeriodoMeses(periodo); + Date fimPeriodo = DateUtil.fimFechaPeriodoMeses(periodo); + + query.setString("dataInicial", DateUtil.getStringDate(inicioPeriodo, "dd/MM/yyyy HH:mm")); + query.setString("dataFinal", DateUtil.getStringDate(fimPeriodo, "dd/MM/yyyy HH:mm")); + query.setInteger("puntoventaId", puntoVentaId); + query.setInteger("empresaId", empresaId); + query.setString("teeexcbag", TipoEventoExtra.EXCESSO_BAGAGEM.toString()); + query.setString("teesegop", TipoEventoExtra.SEGURO_OPCIONAL.toString()); + + return query.list(); + } + + @Override + public Comissao buscaComissaoVigencia(Integer puntoVentaId, Integer empresaId, String competencia) { + + StringBuilder hql = new StringBuilder(); + hql.append(" from Comissao c "); + hql.append(" where c.activo = 1 "); + hql.append(" AND c.puntoVenta.puntoventaId = :puntoventaId "); + hql.append(" AND c.empresaId = :empresaId "); + hql.append(" AND c.competencia = :periodo "); + + Query query = getSession().createQuery(hql.toString()); + query.setString("periodo", competencia); + query.setInteger("puntoventaId", puntoVentaId); + query.setInteger("empresaId", empresaId); + + return (Comissao) query.uniqueResult(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaHistoricoComissao(Map parametros) { + + /*String competenciaInicio = DateUtil.getStringDate(periodoInicio, "MM/yyyy"); + String competenciaFim = DateUtil.getStringDate(periodoFim, "MM/yyyy");*/ + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT c.competencia AS competencia, pv.nombpuntoventa, pv.numpuntoventa, "); + sql.append(" c.datapagamento AS dataPagamento, "); + sql.append(" c.comissao_bpr AS comissaoBpr, "); + sql.append(" c.receita_excessobagagem AS receitaExcessobagagem, "); + sql.append(" c.receita_seguroopcional AS receitaSeguroopcional, "); + sql.append(" c.receita_seguro AS receitaSeguro, "); + sql.append(" c.descontos_fixos AS descontosFixos, "); + sql.append(" c.descontos_eventuais AS descontosEventuais, "); + sql.append(" c.royaties AS royaties, "); + sql.append(" c.iss_retido AS issRetido, "); + sql.append(" c.bonificacao_metas AS bonificacaoMetas, "); + sql.append(" c.entregas_passagem AS entregasPassagem, "); + sql.append(" c.receita_outros AS receitaOutros, "); + sql.append(" c.receita_bpr AS receitaBPR, "); + sql.append(" c.devolvidos AS devolvidos, "); + sql.append(" c.receita_bruta_excessobagagem AS receitaBrutaExcessoBagagem, "); + sql.append(" c.receita_bruta_seguroopcional AS receitaBrutaSeguroopcional, "); + sql.append(" c.receita_bruta_seguro AS receitaBrutaSeguro, "); + sql.append(" c.indpago AS indPago, "); + sql.append(" CASE WHEN c.indpago = 1 THEN 'PAGO' ELSE 'PENDENTE' END AS pagamento, "); + sql.append(" up.nombusuario AS usuarioPagamento, "); + sql.append(" ul.nombusuario AS usuarioLancamento, "); + sql.append(" e.nombempresa, e.cnpj, "); + sql.append(" pa.numagencia as agencia, pa.numconta || '-' || pa.digito as conta, if.nome as banco, "); + sql.append(" ci.nombciudad as cidade, pv.descCorreo, pv.razonsocial, pv.numdocpuntoventa as cnpjPuntoventa, "); + sql.append(" c.data_inicial as dataInicial, c.data_final as dataFinal, "); + sql.append(" c.receita_gap as receitaGAP, c.empresa_id as empresaId "); + sql.append("FROM comissao c "); + sql.append("JOIN punto_venta pv on pv.puntoventa_id = c.puntoventa_id "); + sql.append("JOIN empresa e on e.empresa_id = c.empresa_id "); + sql.append("LEFT JOIN ptovta_agencia pa on pa.ptovtaagencia_id = pv.ptovtaagencia_id "); + sql.append("LEFT JOIN insti_financeira if on if.instifinanceira_id = pa.instifinanceira_id "); + sql.append("LEFT JOIN colonia co on co.colonia_id = pv.colonia_id "); + sql.append("LEFT JOIN ciudad ci on ci.ciudad_id = co.ciudad_id "); + sql.append("LEFT JOIN usuario up ON up.usuario_id = c.usuariopagamento_id "); + sql.append("LEFT JOIN usuario ul ON ul.usuario_id = c.usuario_id "); + sql.append("WHERE c.activo = 1 "); + + if(parametros.containsKey("empresaId")) { + sql.append(" AND c.empresa_id = :empresaId "); + } + + if(parametros.containsKey("competenciaInicial") && parametros.containsKey("competenciaFinal")) { + sql.append(" AND TO_DATE(c.competencia,'MM/YYYY') BETWEEN TO_DATE(:competenciaInicial,'MM/YYYY') and TO_DATE(:competenciaFinal,'MM/YYYY') "); + } + + if(parametros.containsKey("dataInicial") && parametros.containsKey("dataFinal")) { + sql.append(" AND ((TO_DATE(:dataInicial,'dd/mm/yyyy') between c.data_inicial and c.data_final) OR (TO_DATE(:dataFinal,'dd/mm/yyyy') between c.data_inicial and c.data_final)) "); + } + + if(parametros.containsKey("puntoventaId")) { + sql.append(" AND c.puntoventa_id = :puntoventaId "); + } + + if(parametros.containsKey("competenciaInicio") && parametros.containsKey("competenciaFim")) { + sql.append("ORDER BY pv.nombpuntoventa, TO_DATE(c.competencia,'MM/YYYY') "); + } + + if(parametros.containsKey("dataInicial") && parametros.containsKey("dataFinal")) { + sql.append("ORDER BY pv.nombpuntoventa, c.data_inicial "); + } + + Query query = getSession().createSQLQuery(sql.toString()) + .addScalar("competencia", StringType.INSTANCE) + .addScalar("nombpuntoventa", StringType.INSTANCE) + .addScalar("numpuntoventa", StringType.INSTANCE) + .addScalar("dataPagamento", DateType.INSTANCE) + .addScalar("comissaoBpr", BigDecimalType.INSTANCE) + .addScalar("receitaExcessobagagem", BigDecimalType.INSTANCE) + .addScalar("receitaSeguroopcional", BigDecimalType.INSTANCE) + .addScalar("receitaSeguro", BigDecimalType.INSTANCE) + .addScalar("descontosFixos", BigDecimalType.INSTANCE) + .addScalar("descontosEventuais", BigDecimalType.INSTANCE) + .addScalar("royaties", BigDecimalType.INSTANCE) + .addScalar("issRetido", BigDecimalType.INSTANCE) + .addScalar("bonificacaoMetas", BigDecimalType.INSTANCE) + .addScalar("entregasPassagem", BigDecimalType.INSTANCE) + .addScalar("receitaOutros", BigDecimalType.INSTANCE) + .addScalar("indPago", BooleanType.INSTANCE) + .addScalar("pagamento", StringType.INSTANCE) + .addScalar("usuarioPagamento", StringType.INSTANCE) + .addScalar("usuarioLancamento", StringType.INSTANCE) + .addScalar("nombempresa", StringType.INSTANCE) + .addScalar("cnpj", StringType.INSTANCE) + .addScalar("conta", StringType.INSTANCE) + .addScalar("banco", StringType.INSTANCE) + .addScalar("cidade", StringType.INSTANCE) + .addScalar("agencia", StringType.INSTANCE) + .addScalar("descCorreo", StringType.INSTANCE) + .addScalar("razonsocial", StringType.INSTANCE) + .addScalar("cnpjPuntoventa", StringType.INSTANCE) + .addScalar("receitaBPR", BigDecimalType.INSTANCE) + .addScalar("devolvidos", BigDecimalType.INSTANCE) + .addScalar("receitaBrutaExcessoBagagem", BigDecimalType.INSTANCE) + .addScalar("receitaBrutaSeguroopcional", BigDecimalType.INSTANCE) + .addScalar("receitaBrutaSeguro", BigDecimalType.INSTANCE) + .addScalar("dataInicial", DateType.INSTANCE) + .addScalar("dataFinal", DateType.INSTANCE) + .addScalar("receitaGAP", BigDecimalType.INSTANCE) + .addScalar("empresaId", IntegerType.INSTANCE) + .setResultTransformer(new AliasToBeanResultTransformer(HistoricoComissao.class)); + + setParametros(query, parametros); + + return query.list(); + } + + @Override + @SuppressWarnings("unchecked") + public List buscaPuntoVentasEmpresaComComissaoParametrizada(Integer empresaId) { + StringBuilder sQuery = new StringBuilder("SELECT NEW com.rjconsultores.ventaboletos.entidad.PuntoVenta(pv.puntoventaId, pv.nombpuntoventa) FROM PtovtaComissao c "); + sQuery.append("JOIN c.puntoventaId pv ") + .append("JOIN c.empresaId e ") + .append("WHERE pv.activo = 1 ") + .append("AND e.empresaId = :empresaId ") + .append("AND c.activo = 1") + .append("AND pv.statusaprobacion = 'A'"); + Query qr = getSession().createQuery(sQuery.toString()); + qr.setParameter("empresaId", empresaId); + + return qr.list(); + } + + @Override + public Comissao buscaComissaoVigencia(Integer puntoVentaId, Integer empresaId, Date dataInicial, Date dataFinal) { + StringBuilder hql = new StringBuilder(); + hql.append(" from Comissao c "); + hql.append(" where c.activo = 1 "); + hql.append(" AND c.puntoVenta.puntoventaId = :puntoventaId "); + hql.append(" AND c.empresaId = :empresaId "); + hql.append(" AND ((TO_DATE(:dataInicial,'dd/mm/yyyy') between c.dataInicial and c.dataFinal) OR (TO_DATE(:dataFinal,'dd/mm/yyyy') between c.dataInicial and c.dataFinal))"); + + Query query = getSession().createQuery(hql.toString()); + query.setString("dataInicial", DateUtil.getStringDate(dataInicial, "dd/MM/yyyy")); + query.setString("dataFinal", DateUtil.getStringDate(dataFinal, "dd/MM/yyyy")); + query.setInteger("puntoventaId", puntoVentaId); + query.setInteger("empresaId", empresaId); + + return (Comissao) query.uniqueResult(); + } + + @SuppressWarnings("rawtypes") + private void setParametros(Query qr, Map parametros) { + for (Entry parametro : parametros.entrySet()) { + if (parametro.getValue() instanceof Collection) { + qr.setParameterList(parametro.getKey(), (Collection) parametro.getValue()); + } else if (parametro.getValue() instanceof List) { + qr.setParameterList(parametro.getKey(), (List) parametro.getValue()); + } else { + qr.setParameter(parametro.getKey(), parametro.getValue()); + } + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoLogHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoLogHibernateDAO.java new file mode 100644 index 000000000..f1119b622 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoLogHibernateDAO.java @@ -0,0 +1,66 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Query; +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.ComissaoLogDAO; +import com.rjconsultores.ventaboletos.entidad.ComissaoLog; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.vo.comissao.ComissaoLogVO; + +@Repository("comissaoLogHibernateDAO") +public class ComissaoLogHibernateDAO extends GenericHibernateDAO implements ComissaoLogDAO { + + @Autowired + public ComissaoLogHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public void limparComissaoLog(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) { + StringBuilder hql = new StringBuilder(); + hql.append("delete comissao_log "); + hql.append("where activo = 1 "); + hql.append(" AND puntoventa_id = :puntoventaId "); + hql.append(" AND empresa_id = :empresaId "); + hql.append(" AND feccorte between TO_DATE(:dataInicial,'DD/MM/YYYY hh24:mi') and TO_DATE(:dataFinal,'DD/MM/YYYY hh24:mi') "); + + Query query = getSession().createSQLQuery(hql.toString()); + query.setString("dataInicial", DateUtil.getStringDate(DateUtil.inicioFecha(dataInicial), "dd/MM/yyyy HH:mm")); + query.setString("dataFinal", DateUtil.getStringDate(DateUtil.inicioFecha(dataFinal), "dd/MM/yyyy HH:mm")); + query.setInteger("puntoventaId", puntoVentaId); + query.setInteger("empresaId", empresaId); + + query.executeUpdate(); + } + + @Override + public void suscribirTodos(List lsComissaoLogVO) { + for (ComissaoLogVO vo : lsComissaoLogVO) { + ComissaoLog comissaoLog = new ComissaoLog(); + comissaoLog.setPuntoventaId(vo.getPuntoventaId()); + comissaoLog.setEmpresaId(vo.getEmpresaId()); + comissaoLog.setActivo(true); + comissaoLog.setFecmodif(new Date()); + comissaoLog.setFeccorte(vo.getFeccorte()); + comissaoLog.setUsuarioId(vo.getUsuarioId()); + comissaoLog.setTurnoId(vo.getTurnoId()); + comissaoLog.setCajaId(vo.getCajaId()); + comissaoLog.setCajadiversosId(vo.getCajadiversosId()); + comissaoLog.setPorcComissao(vo.getPorcComissao()); + comissaoLog.setValorBase(vo.getValorBase()); + comissaoLog.setValorComissao(vo.getValorComissao()); + comissaoLog.setOrigem(vo.getOrigem()); + comissaoLog.setTexto(vo.getTexto()); + + suscribir(comissaoLog); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoReceitaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoReceitaHibernateDAO.java new file mode 100644 index 000000000..daadcb55e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ComissaoReceitaHibernateDAO.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Query; +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.ComissaoReceitaDAO; +import com.rjconsultores.ventaboletos.entidad.ComissaoReceita; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +@Repository("comissaoReceitaHibernateDAO") +public class ComissaoReceitaHibernateDAO extends GenericHibernateDAO implements ComissaoReceitaDAO { + + @Autowired + public ComissaoReceitaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List recuperarComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) { + StringBuilder hql = new StringBuilder(); + hql.append("select c from ComissaoReceita c ") + .append("where c.activo = 1 ") + .append(" AND c.puntoVenta.puntoventaId = :puntoventaId ") + .append(" AND c.empresa.empresaId = :empresaId ") + .append(" AND c.datamovimento between TO_DATE(:dataInicial,'DD/MM/YYYY') and TO_DATE(:dataFinal,'DD/MM/YYYY') ") + .append("order by c.empresa.nombempresa, c.puntoVenta.nombpuntoventa, c.datamovimento"); + + Query query = getSession().createQuery(hql.toString()); + query.setString("dataInicial", DateUtil.getStringDate(dataInicial, "dd/MM/yyyy")); + query.setString("dataFinal", DateUtil.getStringDate(dataFinal, "dd/MM/yyyy")); + query.setInteger("puntoventaId", puntoVentaId); + query.setInteger("empresaId", empresaId); + + return query.list(); + } + + @Override + public void limparComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) { + StringBuilder hql = new StringBuilder(); + hql.append("delete comissao_receita "); + hql.append("where activo = 1 "); + hql.append(" AND puntoventa_id = :puntoventaId "); + hql.append(" AND empresa_id = :empresaId "); + hql.append(" AND datamovimento between TO_DATE(:dataInicial,'DD/MM/YYYY hh24:mi') and TO_DATE(:dataFinal,'DD/MM/YYYY hh24:mi') "); + + Query query = getSession().createSQLQuery(hql.toString()); + query.setString("dataInicial", DateUtil.getStringDate(DateUtil.inicioFecha(dataInicial), "dd/MM/yyyy HH:mm")); + query.setString("dataFinal", DateUtil.getStringDate(DateUtil.inicioFecha(dataFinal), "dd/MM/yyyy HH:mm")); + query.setInteger("puntoventaId", puntoVentaId); + query.setInteger("empresaId", empresaId); + + query.executeUpdate(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CompaniaBancariaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CompaniaBancariaHibernateDAO.java new file mode 100644 index 000000000..62c742f20 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CompaniaBancariaHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CompaniaBancariaDAO; +import com.rjconsultores.ventaboletos.entidad.CompaniaBancaria; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("companiaBancariaDAO") +public class CompaniaBancariaHibernateDAO extends GenericHibernateDAO + implements CompaniaBancariaDAO { + + @Autowired + public CompaniaBancariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(CompaniaBancaria companiaBancaria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.eq("cvecompania", companiaBancaria.getCvecompania())); + c.add(Restrictions.eq("cvesucursal", companiaBancaria.getCvesucursal())); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConductorHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConductorHibernateDAO.java new file mode 100644 index 000000000..cfa9112bf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConductorHibernateDAO.java @@ -0,0 +1,54 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConductorDAO; +import com.rjconsultores.ventaboletos.entidad.Conductor; + +/** + * + * @author Administrador + */ +@Repository("conductorDAO") +public class ConductorHibernateDAO extends GenericHibernateDAO + implements ConductorDAO { + + @Autowired + public ConductorHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public Conductor buscar(String claveConductor, String contraSenha) { + Conductor c = new Conductor(1); + c.setNombconductor("Rafius"); + + return c; + } + + public Conductor buscarPorEmpleado(int empleadoId){ + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empleado.empleadoId", empleadoId)); + + return (Conductor) c.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionConfHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionConfHibernateDAO.java new file mode 100644 index 000000000..30ea4790a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionConfHibernateDAO.java @@ -0,0 +1,53 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionConfDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionConf; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; + +@Repository("conexionConfDAO") +public class ConexionConfHibernateDAO extends GenericHibernateDAO + implements ConexionConfDAO { + + @Autowired + public ConexionConfHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public ConexionConf buscar(Long conexionCtrlId, Integer numgrupo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("grupo", numgrupo)); + + Criteria ctrl = c.createCriteria("conexionCtrl"); + ctrl.add(Restrictions.eq("conexionctrlId", conexionCtrlId)); + + return (ConexionConf) c.uniqueResult(); + } + + @Override + public List buscarPorConexionCtrl(ConexionCtrl conexionCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("conexionCtrl", conexionCtrl)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionCtrlHibernateDAO.java new file mode 100644 index 000000000..abcc46104 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionCtrlHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +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.ConexionCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; + +@Repository("conexionCtrlDAO") +public class ConexionCtrlHibernateDAO extends GenericHibernateDAO + implements ConexionCtrlDAO { + + @Autowired + public ConexionCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarConexionesCtrl(Integer origenId, Integer destinoId) { + + StringBuilder sb = new StringBuilder(); + sb.append(" from ConexionCtrl "); + sb.append(" where activo = 1 "); + + if (origenId != null) { + sb.append(" and origenId = ").append(origenId); + } + if (destinoId != null) { + sb.append(" and destinoId = ").append(destinoId); + } + + Query query = getSession().createQuery(sb.toString()); + List list = query.list(); + + return list; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionDescuentoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionDescuentoHibernateDAO.java new file mode 100644 index 000000000..a1c77e4ef --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionDescuentoHibernateDAO.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionDescuentoDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionDescuento; + +@Repository("conexionDescuentoDAO") +public class ConexionDescuentoHibernateDAO extends GenericHibernateDAO +implements ConexionDescuentoDAO { + + @Autowired + public ConexionDescuentoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List bucarPorConexion(Long conexionId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("conexion.conexionId", conexionId)); + c.add(Restrictions.eq("activo", true)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionHibernateDAO.java new file mode 100644 index 000000000..8f4986363 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionHibernateDAO.java @@ -0,0 +1,31 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionExcepcionDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcion; + +@Repository("conexionExcepcionDAO") +public class ConexionExcepcionHibernateDAO extends GenericHibernateDAO + implements ConexionExcepcionDAO { + + @Autowired + public ConexionExcepcionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerConexionExcepcionsActivo(Long conexionctrlId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("conexionctrlId", conexionctrlId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionRutaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionRutaHibernateDAO.java new file mode 100644 index 000000000..77806ae05 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionExcepcionRutaHibernateDAO.java @@ -0,0 +1,31 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionExcepcionRutaDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta; + +@Repository("conexionExcepcionRutaDAO") +public class ConexionExcepcionRutaHibernateDAO extends GenericHibernateDAO + implements ConexionExcepcionRutaDAO { + + @Autowired + public ConexionExcepcionRutaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerConexionExcepcionsActivo(Long conexionctrlId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("conexionctrlId", conexionctrlId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java new file mode 100644 index 000000000..924c92899 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java @@ -0,0 +1,297 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionDAO; +import com.rjconsultores.ventaboletos.entidad.Conexion; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrlTemp; +import com.rjconsultores.ventaboletos.entidad.ConexionTemp; +import com.rjconsultores.ventaboletos.vo.conexion.ConexionVO; + +@Repository("conexionDAO") +public class ConexionHibernateDAO extends GenericHibernateDAO + implements ConexionDAO { + + @Autowired + public ConexionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarConexionesValidas() { + + StringBuilder sb = new StringBuilder(); + sb.append("SELECT DISTINCT cct.conexionctrl_id AS conexionCtrlId, "); + sb.append(" po1.descparada AS conOrigen, "); + sb.append(" pd1.descparada AS conDestino, "); + sb.append(" c.numgrupo AS grupo, "); + sb.append(" po2.descparada AS tramoOrigen, "); + sb.append(" pd2.descparada AS tramoDestino, "); + sb.append(" c.numsecuencia AS numSecuencia "); + sb.append("FROM conexion c "); + sb.append(" inner join conexion_conf cf "); + sb.append(" ON ( cf.conexionctrl_id = c.conexionctrl_id "); + sb.append(" AND cf.activo = 1 ) "); + sb.append(" inner join conexion_ctrl cct "); + sb.append(" ON ( cct.conexionctrl_id = c.conexionctrl_id "); + sb.append(" AND cct.activo = 1 ) "); + sb.append(" inner join parada po1 "); + sb.append(" ON ( po1.parada_id = cct.origen_id ) "); + sb.append(" inner join parada pd1 "); + sb.append(" ON ( pd1.parada_id = cct.destino_id ) "); + sb.append(" inner join parada po2 "); + sb.append(" ON ( po2.parada_id = c.origen_id ) "); + sb.append(" inner join parada pd2 "); + sb.append(" ON ( pd2.parada_id = c.destino_id ) "); + sb.append("WHERE cct.activo = 1 and c.activo = 1 "); + sb.append("ORDER BY po1.descparada, "); + sb.append(" pd1.descparada, "); + sb.append(" cct.conexionctrl_id, "); + sb.append(" c.numgrupo, "); + sb.append(" c.numsecuencia, "); + sb.append(" po2.descparada, "); + sb.append(" pd2.descparada "); + + Query query = getSession().createSQLQuery(sb.toString()); + List conexionVOs = new ArrayList(); + + for (Object o : query.list()) { + Object[] oc = (Object[]) o; + + ConexionVO conexionVO = new ConexionVO(); + conexionVO.setConexionCtrlId(((BigDecimal) oc[0]).longValue()); + conexionVO.setConOrigen((String) oc[1]); + conexionVO.setConDestino((String) oc[2]); + conexionVO.setGrupo(((BigDecimal) oc[3]).intValue()); + conexionVO.setTramoOrigen((String) oc[4]); + conexionVO.setTramoDestino((String) oc[5]); + conexionVOs.add(conexionVO); + } + + return conexionVOs; + } + + @Override + public List buscarConexiones(Integer origenId, Integer destinoId) { + + StringBuilder sb = new StringBuilder(); + sb.append(" select cc.conexionctrl_id as conexionCtrlId, occ.descparada as conOrigen, dcc.descparada as conDestino, "); + sb.append(" c.numgrupo as grupo, oc.descparada as tramoOrigen, dc.descparada as tramoDestino "); + sb.append(" from conexion_ctrl cc "); + sb.append(" inner join conexion_conf conf "); + sb.append(" on conf.conexionctrl_id = cc.conexionctrl_id, "); + sb.append(" conexion c, "); + sb.append(" parada occ, "); + sb.append(" parada dcc, "); + sb.append(" parada oc, "); + sb.append(" parada dc "); + sb.append(" where cc.activo = 1 and c.activo = 1 and conf.activo = 1"); + sb.append(" and cc.conexionctrl_id = c.conexionctrl_id "); + sb.append(" and occ.parada_id = cc.origen_id "); + sb.append(" and conf.grupo = c.numgrupo "); + sb.append(" and dcc.parada_id = cc.destino_id "); + sb.append(" and oc.parada_id = c.origen_id "); + sb.append(" and dc.parada_id = c.destino_id "); + if (origenId != null) { + sb.append(" and cc.origen_id = ").append(origenId); + } + if (destinoId != null) { + sb.append(" and cc.destino_id = ").append(destinoId); + } + sb.append(" order by occ.descparada, dcc.descparada, cc.conexionctrl_id, c.numgrupo, c.numsecuencia, oc.descparada, dc.descparada "); + + Query query = getSession().createSQLQuery(sb.toString()); + List list = query.list(); + + List vos = new ArrayList(); + for (Object[] o : list) { + ConexionVO vo = new ConexionVO(); + vo.setConexionCtrlId(((BigDecimal) o[0]).longValue()); + vo.setConOrigen((String) o[1]); + vo.setConDestino((String) o[2]); + vo.setGrupo(((BigDecimal) o[3]).intValue()); + vo.setTramoOrigen((String) o[4]); + vo.setTramoDestino((String) o[5]); + + vos.add(vo); + } + + return vos; + } + + @Override + public void generarConexiones(Integer usuarioId) { + this.getSession().createQuery("DELETE ConexionTemp").executeUpdate(); + this.getSession().createQuery("DELETE ConexionCtrlTemp").executeUpdate(); + + Query queryParadas = this.getSession().createQuery("select distinct t.origem.paradaId,t.destino.paradaId from Tramo t where t.activo = 1 order by t.origem.paradaId "); + List lsParadas = queryParadas.list(); + + StringBuilder sb = new StringBuilder(""); + sb.append("SELECT "); + sb.append(" t.origem.paradaId, "); + sb.append(" t.destino.paradaId, "); + sb.append(" t2.origem.paradaId, "); + sb.append(" t2.destino.paradaId, "); + sb.append(" MAX(t.kmReal), "); + sb.append(" MAX(tcs.tiemporecorrido), "); + sb.append(" MAX(t2.kmReal), "); + sb.append(" MAX(tcs2.tiemporecorrido) "); + sb.append(" "); + sb.append("FROM "); + sb.append(" Tramo t, "); + sb.append(" Tramo t2, "); + sb.append(" TramoServicio tcs, "); + sb.append(" TramoServicio tcs2 "); + sb.append(" "); + sb.append("where "); + sb.append(" t.origem.paradaId = :origen "); + sb.append(" and t.activo=1 "); + sb.append(" "); + sb.append(" and t2.destino.paradaId = :destino "); + sb.append(" and t2.activo=1 "); + sb.append(" and t2.origem= t.destino "); + sb.append(" "); + sb.append(" and tcs.tramo=t "); + sb.append(" and tcs.activo=1 "); + sb.append(" "); + sb.append(" and tcs2.tramo=t2 "); + sb.append(" and tcs2.activo=1 "); + sb.append(" "); + sb.append("group by "); + sb.append(" t.origem.paradaId, "); + sb.append(" t.destino.paradaId, "); + sb.append(" t2.origem.paradaId, "); + sb.append(" t2.destino.paradaId "); + + Map mapConexionCtrlId = new HashMap(); + for (Object[] obj : lsParadas) { + int grupo = 0; + Integer origenId = (Integer) obj[0]; + Integer destinoId = (Integer) obj[1]; + + Query query = getSession().createQuery(sb.toString()); + query.setParameter("origen", origenId); + query.setParameter("destino", destinoId); + + List list = query.list(); + + for (Object[] objConexion : list) { + Integer origen1 = (Integer) objConexion[0]; + Integer destino1 = (Integer) objConexion[1]; + Integer origen2 = (Integer) objConexion[2]; + Integer destino2 = (Integer) objConexion[3]; + + String claveConexionCtrl = origenId + "-" + destinoId; + + Long conexionCtrlId = mapConexionCtrlId.get(claveConexionCtrl); + + if (conexionCtrlId == null) { + ConexionCtrlTemp c = new ConexionCtrlTemp(); + c.setActivo(true); + c.setOrigenId(origen1); + c.setDestinoId(destino2); + c.setFecmodif(new java.util.Date()); + c.setUsuarioId(usuarioId); + + conexionCtrlId = (Long) this.getSession().save(c); + mapConexionCtrlId.put(claveConexionCtrl, conexionCtrlId); + } + grupo++; + + ConexionTemp cTemp = new ConexionTemp(); + cTemp.setActivo(true); + cTemp.setConexionctrlId(conexionCtrlId); + cTemp.setOrigenId(origen1); + cTemp.setDestinoId(destino1); + cTemp.setNumgrupo(grupo); + cTemp.setNumsecuencia((short) 1); + cTemp.setUsuarioId(usuarioId); + cTemp.setFecmodif(new java.util.Date()); + + ConexionTemp cTemp2 = new ConexionTemp(); + cTemp2.setActivo(true); + cTemp2.setConexionctrlId(conexionCtrlId); + cTemp2.setOrigenId(origen2); + cTemp2.setDestinoId(destino2); + cTemp2.setNumgrupo(grupo); + cTemp2.setNumsecuencia((short) 2); + cTemp2.setUsuarioId(usuarioId); + cTemp2.setFecmodif(new java.util.Date()); + + getSession().save(cTemp); + getSession().save(cTemp2); + } + } + + // deletando, exceto conexoes que foram criadas manualmente: + this.getSession().createQuery("DELETE Conexion c WHERE c.conexionctrlId NOT IN (SELECT cc.conexionCtrl.conexionctrlId FROM ConexionConf cc)").executeUpdate(); + this.getSession().createQuery("DELETE ConexionCtrl cct WHERE cct.conexionctrlId NOT IN (SELECT cc.conexionCtrl.conexionctrlId FROM ConexionConf cc)").executeUpdate(); + + sb = new StringBuilder(""); + sb.append(" INSERT INTO ConexionCtrl (conexionctrlId,fecmodif,activo,usuarioId,origenId,destinoId) "); + sb.append(" SELECT cct.conexionctrlId, "); + sb.append(" cct.fecmodif, "); + sb.append(" cct.activo, "); + sb.append(" cct.usuarioId, "); + sb.append(" cct.origenId, "); + sb.append(" cct.destinoId "); + sb.append(" FROM ConexionCtrlTemp cct "); + sb.append(" WHERE cct.origenId || '_' || cct.destinoId NOT IN "); + sb.append(" ( SELECT cc.origenId || '_' || cc.destinoId "); + sb.append(" FROM ConexionCtrl cc "); + sb.append(" WHERE cc.activo = 1) "); + this.getSession().createQuery(sb.toString()).executeUpdate(); + + sb = new StringBuilder(""); + sb.append(" INSERT INTO Conexion (conexionId,numgrupo,numsecuencia,activo,fecmodif,usuarioId,origenId,destinoId,conexionctrlId) "); + sb.append(" SELECT ct.conexionId, "); + sb.append(" ct.numgrupo, "); + sb.append(" ct.numsecuencia, "); + sb.append(" ct.activo, "); + sb.append(" ct.fecmodif, "); + sb.append(" ct.usuarioId, "); + sb.append(" ct.origenId, "); + sb.append(" ct.destinoId, "); + sb.append(" ct.conexionctrlId "); + sb.append(" FROM ConexionTemp ct "); + sb.append(" WHERE ct.origenId || '_' || ct.destinoId NOT IN "); + sb.append(" ( SELECT c.origenId || '_' || c.destinoId "); + sb.append(" FROM Conexion c "); + sb.append(" WHERE c.activo = 1) "); + this.getSession().createQuery(sb.toString()).executeUpdate(); + } + + @Override + public List buscarPorConexionCtrl(Long conexionCtrlId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("conexionctrlId", conexionCtrlId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("numgrupo")); + c.addOrder(Order.asc("numsecuencia")); + + return c.list(); + } + + @Override + public Conexion buscarPorConexionRutaTramoCtrl(Integer conexionRutaTramoId) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("conexionRutaTramoId", conexionRutaTramoId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return (Conexion) c.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaConfHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaConfHibernateDAO.java new file mode 100644 index 000000000..495354180 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaConfHibernateDAO.java @@ -0,0 +1,313 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionRutaConfDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.vo.conexion.OrdenarLocalidadesGeradas; +import com.rjconsultores.ventaboletos.vo.parada.ConexionCtrlVO; +import com.rjconsultores.ventaboletos.vo.parada.ConexionRutaConfVO; +import com.rjconsultores.ventaboletos.vo.parada.ConexionRutaCtrlVO; +import com.rjconsultores.ventaboletos.vo.parada.ParadaVOConexionRuta; + +@Repository("conexionRutaConfDAO") +public class ConexionRutaConfHibernateDAO extends GenericHibernateDAO implements ConexionRutaConfDAO { + + @Autowired + public ConexionRutaConfHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarPorDescricao(String descricao) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ilike("descricao", descricao, MatchMode.ANYWHERE)); + + return c.list(); + } + + @Override + public List obtenerTodosActivo() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @Override + public void excluirConfiguracao(ConexionRutaConf conexion, Integer usuarioId, boolean excluirConexionRutaConf, boolean isConexionGerada) { + List comandos = carregarComandosInativarConfiguracao(excluirConexionRutaConf, isConexionGerada); + for (String comando : comandos) { + Query qr = getSession().createSQLQuery(comando); + qr.setParameter("usuarioId", usuarioId); + qr.setParameter("conexionrutaconfId", conexion.getConexionRutaConfId()); + qr.setParameter("fecmodif", Calendar.getInstance().getTime()); + qr.executeUpdate(); + } + } + + private List carregarComandosInativarConfiguracao(boolean excluirConexionRutaConf, boolean isConexionGerada) { + List comandos = new ArrayList(0); + + StringBuilder sb = new StringBuilder(); + if(excluirConexionRutaConf) { + sb.append("update conexion_ruta_conf ") + .append("set activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif ") + .append("where conexionrutaconf_id = :conexionrutaconfId ") + .append("and activo = 1"); + comandos.add(sb.toString()); + } + + sb = new StringBuilder(); + sb.append("update conexion_ruta_excepcion_ptovta ") + .append("set activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif ") + .append("where conexionrutaconf_id = :conexionrutaconfId ") + .append("and activo = 1"); + comandos.add(sb.toString()); + + sb = new StringBuilder(); + sb.append("update conexion_rutaexcepciontipopta ") + .append("set activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif ") + .append("where conexionrutaconf_id = :conexionrutaconfId ") + .append("and activo = 1"); + comandos.add(sb.toString()); + + if(isConexionGerada || excluirConexionRutaConf) { + sb = new StringBuilder(); + sb.append("update conexion_ruta_ctrl ") + .append("set activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif ") + .append("where conexionrutaconf_id = :conexionrutaconfId ") + .append("and activo = 1"); + comandos.add(sb.toString()); + + sb = new StringBuilder(); + sb.append("merge into conexion_ruta_tramo_ctrl c ") + .append("using ( ") + .append("select c1.conexionrutatramoctrl_id ") + .append("from conexion_ruta_tramo_ctrl c1 ") + .append("join conexion_ruta_ctrl c2 on c1.conexionrutactrl_id = c2.conexionrutactrl_id ") + .append("where c2.conexionrutaconf_id = :conexionrutaconfId and c1.activo = 1) t on (t.conexionrutatramoctrl_id = c.conexionrutatramoctrl_id) ") + .append("when matched then update set c.activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif "); + comandos.add(sb.toString()); + + sb = new StringBuilder(); + sb.append("merge into conexion c ") + .append("using ( ") + .append("select c.conexion_id ") + .append("from conexion c ") + .append("join conexion_ruta_tramo_ctrl c1 on c.conexionrutatramoctrl_id = c1.conexionrutatramoctrl_id ") + .append("join conexion_ruta_ctrl c2 on c1.conexionrutactrl_id = c2.conexionrutactrl_id ") + .append("where c2.conexionrutaconf_id = :conexionrutaconfId and c.activo = 1) t on (t.conexion_id = c.conexion_id) ") + .append("when matched then update set c.activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif"); + comandos.add(sb.toString()); + + sb = new StringBuilder(); + sb.append("merge into conexion_ctrl c ") + .append("using ( ") + .append("select distinct c.conexionctrl_id ") + .append("from conexion_ctrl c ") + .append("join conexion c3 on c3.conexionctrl_id = c.conexionctrl_id ") + .append("join conexion_ruta_tramo_ctrl c1 on c3.conexionrutatramoctrl_id = c1.conexionrutatramoctrl_id ") + .append("join conexion_ruta_ctrl c2 on c1.conexionrutactrl_id = c2.conexionrutactrl_id ") + .append("where c2.conexionrutaconf_id = :conexionrutaconfId and c.activo = 1) t on (t.conexionctrl_id = c.conexionctrl_id) ") + .append("when matched then update set c.activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif"); + comandos.add(sb.toString()); + + sb = new StringBuilder(); + sb.append("merge into conexion_conf c ") + .append("using ( ") + .append("select distinct c.conexionconf_id ") + .append("from conexion_conf c ") + .append("join conexion_ctrl c4 on c4.conexionctrl_id = c.conexionctrl_id ") + .append("join conexion c3 on c3.conexionctrl_id = c4.conexionctrl_id ") + .append("join conexion_ruta_tramo_ctrl c1 on c3.conexionrutatramoctrl_id = c1.conexionrutatramoctrl_id ") + .append("join conexion_ruta_ctrl c2 on c1.conexionrutactrl_id = c2.conexionrutactrl_id ") + .append("where c2.conexionrutaconf_id = :conexionrutaconfId and c.activo = 1) t on (t.conexionconf_id = c.conexionconf_id) ") + .append("when matched then update set c.activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif "); + comandos.add(sb.toString()); + } + + return comandos; + } + + @SuppressWarnings("unchecked") + @Override + public ConexionRutaConfVO carregarConexoesCadastradas(Integer conexionrutaconfId) { + ConexionRutaConfVO retorno = new ConexionRutaConfVO(); + + if(conexionrutaconfId == null) { + return retorno; + } + + StringBuilder sQuery = new StringBuilder(); + sQuery.append("select ctrl.conexionrutatramoctrl_id conexionrutatramoctrlId, r.ruta_id rutaId, r.numruta, ") + .append("case when coalesce(r.indsentidoida,1) = 1 then 'IDA' else 'VOLTA' end sentido, ") + .append("ori.parada_id paradaIdOri, ori.cveparada cveparadaOri, ori.descparada descparadaOri, ") + .append("des.parada_id paradaIdDes, des.cveparada cveparadaDes, des.descparada descparadaDes, ") + .append("oriT.parada_id paradaIdOriT, oriT.cveparada cveparadaOriT, oriT.descparada descparadaOriT, ") + .append("desT.parada_id paradaIdDesT, desT.cveparada cveparadaDesT, desT.descparada descparadaDesT, ") + .append("co.numgrupo, co.numsecuencia, ctr.ruta_origen_id rutaOrigenId, ctr.ruta_destino_id rutaDestinoId, ") + .append("ctr.ruta_destinoc_id rutaDestinoCId ") + .append("from conexion_ruta_tramo_ctrl ctrl ") + .append("join ruta r on r.ruta_id = ctrl.ruta_id ") + .append("join conexion_ruta_ctrl ctr on ctr.conexionrutactrl_id = ctrl.conexionrutactrl_id ") + .append("join conexion_ruta_conf conf on conf.conexionrutaconf_id = ctr.conexionrutaconf_id ") + .append("join conexion co on co.conexionrutatramoctrl_id = ctrl.conexionrutatramoctrl_id and co.activo = 1 ") + .append("join conexion_ctrl coctrl on coctrl.conexionctrl_id = co.conexionctrl_id and co.activo = 1 ") + .append("join parada ori on ori.parada_id = ctrl.origen_id ") + .append("join parada des on des.parada_id = ctrl.destino_id ") + .append("join parada oriT on oriT.parada_id = coctrl.origen_id ") + .append("join parada desT on desT.parada_id = coctrl.destino_id ") + .append("where ctrl.activo = 1 ") + .append("and conf.conexionrutaconf_id = :conexionrutaconfId "); + + Query qr = getSession().createSQLQuery(sQuery.toString()); + qr.setParameter("conexionrutaconfId", conexionrutaconfId); + + List localidadesCombinadas = new ArrayList(0); + List listConexionCtrl = new ArrayList(0); + List listConexionCtrlVO = new ArrayList(0); + + List result = qr.list(); + for (Object[] tupla : result) { + Long conexionRutaTramoId = Long.valueOf(tupla[0].toString()); + Integer rutaId = Integer.valueOf(tupla[1].toString()); + String numRuta = tupla[2].toString(); + String sentido = tupla[3].toString(); + + Parada paradaOrigem = new Parada(Integer.valueOf(tupla[4].toString()), tupla[5].toString(), tupla[6].toString()); + Parada paradaDestino = new Parada(Integer.valueOf(tupla[7].toString()), tupla[8].toString(), tupla[9].toString()); + Parada paradaOrigemTrecho = new Parada(Integer.valueOf(tupla[10].toString()), tupla[11].toString(), tupla[12].toString()); + Parada paradaDestinoTrecho = new Parada(Integer.valueOf(tupla[13].toString()), tupla[14].toString(), tupla[15].toString()); + Integer grupo = Integer.valueOf(tupla[16].toString()); + Short secuencia = Short.valueOf(tupla[17].toString()); + + Integer rutaOrigemId = Integer.valueOf(tupla[18].toString()); + Integer rutaDestinoId = Integer.valueOf(tupla[19].toString()); + + Integer rutaDestinoCId = null; + if(tupla[20] != null) { + rutaDestinoCId = Integer.valueOf(tupla[20].toString()); + } + + ConexionCtrlVO conexionCtrl = recuperarConexionCtrlVO(listConexionCtrlVO, listConexionCtrl, paradaOrigemTrecho.getParadaId(), paradaDestinoTrecho.getParadaId()); + ConexionRutaCtrlVO conexionRutaCtrl = new ConexionRutaCtrlVO(rutaOrigemId, rutaDestinoId, rutaDestinoCId); + + ParadaVOConexionRuta trecho = new ParadaVOConexionRuta(grupo, paradaOrigem, paradaDestino, rutaId, numRuta, secuencia, true, paradaOrigemTrecho, paradaDestinoTrecho, conexionCtrl, conexionRutaCtrl, sentido); + trecho.setConexionRutaTramoId(conexionRutaTramoId); + + localidadesCombinadas.add(trecho); + + } + + retorno.setListConexionCtrl(listConexionCtrl); + + Collections.sort(localidadesCombinadas, new OrdenarLocalidadesGeradas()); + retorno.setLocalidadesCombinadas(localidadesCombinadas); + + return retorno; + } + + private ConexionCtrlVO recuperarConexionCtrlVO(List listConexionCtrlVO, List listConexionCtrl, Integer origemConexaoCtrl, Integer destinoConexaoCtrl) { + for (ConexionCtrlVO conexionCtrlTemp : listConexionCtrlVO) { + if(conexionCtrlTemp.isOrigemDestinoIgual(origemConexaoCtrl, destinoConexaoCtrl)) { + return conexionCtrlTemp; + } + } + + ConexionCtrlVO conexionCtrlVO = new ConexionCtrlVO(origemConexaoCtrl, destinoConexaoCtrl); + listConexionCtrlVO.add(conexionCtrlVO); + listConexionCtrl.add(new ConexionCtrl(origemConexaoCtrl, destinoConexaoCtrl, null)); + + return conexionCtrlVO; + } + + @Override + @SuppressWarnings("unchecked") + public List> buscarRutasPorConexionConf(Integer conexionRutaConfId) { + StringBuilder sQuery = new StringBuilder("SELECT ctrl "); + sQuery.append("FROM ConexionRutaCtrl ctrl ") + .append("WHERE ctrl.activo = 1 ") + .append("AND ctrl.conexionRutaConf.conexionRutaConfId = :conexionRutaConfId "); + + + Query qr = getSession().createQuery(sQuery.toString()); + qr.setParameter("conexionRutaConfId", conexionRutaConfId); + List result = qr.list(); + + List lsRutaOrigem = new ArrayList(); + List lsRutaDestino = new ArrayList(); + List lsRutaDestinoC = new ArrayList(); + + for (ConexionRutaCtrl conexionRutaCtrl : result) { + if(!lsRutaOrigem.contains(conexionRutaCtrl.getRutaOrigen())) { + lsRutaOrigem.add(conexionRutaCtrl.getRutaOrigen()); + } + + if(!lsRutaDestino.contains(conexionRutaCtrl.getRutaDestino())) { + lsRutaDestino.add(conexionRutaCtrl.getRutaDestino()); + } + + if(conexionRutaCtrl.getRutaDestinoC() != null && !lsRutaDestinoC.contains(conexionRutaCtrl.getRutaDestinoC())) { + lsRutaDestinoC.add(conexionRutaCtrl.getRutaDestinoC()); + } + } + + List> retorno = new ArrayList>(); + retorno.add(lsRutaOrigem); + retorno.add(lsRutaDestino); + retorno.add(lsRutaDestinoC); + + return retorno; + + } + + @Override + public void atualizarTempoMinimoEMaximo(ConexionRutaConf conexionRutaConf) { + StringBuilder sb = new StringBuilder(); + sb.append("merge into conexion_conf c ") + .append("using ( ") + .append("select distinct c.conexionconf_id ") + .append("from conexion_conf c ") + .append("join conexion_ctrl c4 on c4.conexionctrl_id = c.conexionctrl_id ") + .append("join conexion c3 on c3.conexionctrl_id = c4.conexionctrl_id ") + .append("join conexion_ruta_tramo_ctrl c1 on c3.conexionrutatramoctrl_id = c1.conexionrutatramoctrl_id ") + .append("join conexion_ruta_ctrl c2 on c1.conexionrutactrl_id = c2.conexionrutactrl_id ") + .append("where c2.conexionrutaconf_id = :conexionrutaconfId and c.activo = 1) t on (t.conexionconf_id = c.conexionconf_id) ") + .append("when matched then update set usuario_id = :usuarioId, fecmodif = :fecmodif, tiempomin = :tiempomin, tiempomax = :tiempomax "); + + Query qr = getSession().createSQLQuery(sb.toString()); + qr.setParameter("usuarioId", conexionRutaConf.getUsuarioId()); + qr.setParameter("conexionrutaconfId", conexionRutaConf.getConexionRutaConfId()); + qr.setParameter("fecmodif", Calendar.getInstance().getTime()); + qr.setParameter("tiempomin", conexionRutaConf.getTiempoMin()); + qr.setParameter("tiempomax", conexionRutaConf.getTiempoMax()); + qr.executeUpdate(); + } + + @Override + public ConexionRutaConf getByIdActivo(Integer conexionRutaConfId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("conexionRutaConfId", conexionRutaConfId)); + return (ConexionRutaConf) c.uniqueResult(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaCtrlHibernateDAO.java new file mode 100644 index 000000000..e3b7617e1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaCtrlHibernateDAO.java @@ -0,0 +1,146 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionRutaCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; +import com.rjconsultores.ventaboletos.vo.conexion.ConexionRutaVO; + +@Repository("conexionRutaCtrlDAO") +public class ConexionRutaCtrlHibernateDAO extends GenericHibernateDAO implements ConexionRutaCtrlDAO { + + @Autowired + public ConexionRutaCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarConexionesValidas() { + + StringBuilder sb = new StringBuilder(); + + sb.append("SELECT ro.descruta as descLinhaOrigem, "); + sb.append(" ro.numruta as numRutaOrigen, "); + sb.append(" rd.descruta as descLinhaDestino, "); + sb.append(" rd.numruta as numRutaDestino, "); + sb.append(" po.descparada as tramoOrigen, "); + sb.append(" pd.descparada as tramoDestino, "); + sb.append(" crc.conexionrutactrl_id as conexionRutaCtrl, "); + sb.append(" ro.ruta_id as rutaOrigenId, "); + sb.append(" rd.ruta_id as rutaDestinonId "); + sb.append("FROM conexion_ruta_ctrl crc "); + sb.append("INNER JOIN conexion_ruta_tramo_ctrl crtc ON (crc.conexionrutactrl_id = crtc.conexionrutactrl_id "); + sb.append(" AND crtc.activo = 1) "); + sb.append("INNER JOIN ruta ro ON (crc.ruta_origen_id = ro.ruta_id "); + sb.append(" AND ro.activo =1 )"); + sb.append("INNER JOIN ruta rd ON (crc.ruta_destino_id = rd.ruta_id"); + sb.append(" AND rd.activo =1)"); + sb.append("INNER JOIN parada po ON (po.parada_id = crtc.origen_id) "); + sb.append("INNER JOIN parada pd ON (pd.parada_id = crtc.destino_id) "); + sb.append("WHERE crc.activo =1"); + sb.append(" AND crtc.activo = 1"); + sb.append(" AND ro.activo = 1"); + sb.append(" ORDER BY crtc.conexionrutatramoctrl_id, conexionRutaCtrl "); + + Query query = getSession().createSQLQuery(sb.toString()); + List conexionVOs = new ArrayList(); + + for (Object o : query.list()) { + Object[] oc = (Object[]) o; + + ConexionRutaVO conexionVO = new ConexionRutaVO(); + conexionVO.setDescLinhaOrigem((String) oc[0]); + conexionVO.setNumRutaOrigen(((BigDecimal) oc[1]).intValue()); + conexionVO.setDescLinhaDestino((String) oc[2]); + conexionVO.setNumRutaDestino(((BigDecimal) oc[3]).intValue()); + conexionVO.setTramoOrigen((String) oc[4]); + conexionVO.setTramoDestino((String) oc[5]); + conexionVO.setConexionRutaCtrl(((BigDecimal) oc[6]).intValue()); + conexionVO.setRutaOrigenId(((BigDecimal) oc[7]).intValue()); + conexionVO.setRutaDestinoId(((BigDecimal) oc[8]).intValue()); + conexionVOs.add(conexionVO); + } + + return conexionVOs; + + } + + @Override + public List buscarConexionesValidas(Integer rutaOrigemId, Integer rutaDestinoId) { + + StringBuilder sb = new StringBuilder(); + + sb.append("SELECT ro.descruta as descLinhaOrigem, "); + sb.append(" ro.numruta as numRutaOrigen, "); + sb.append(" rd.descruta as descLinhaDestino, "); + sb.append(" rd.numruta as numRutaDestino, "); + sb.append(" po.descparada as tramoOrigen, "); + sb.append(" pd.descparada as tramoDestino, "); + sb.append(" crc.conexionrutactrl_id as conexionRutaCtrl, "); + sb.append(" ro.ruta_id as rutaOrigenId, "); + sb.append(" rd.ruta_id as rutaDestinonId "); + sb.append("FROM conexion_ruta_ctrl crc "); + sb.append("INNER JOIN conexion_ruta_tramo_ctrl crtc ON (crc.conexionrutactrl_id = crtc.conexionrutactrl_id "); + sb.append(" AND crtc.activo = 1) "); + sb.append("INNER JOIN ruta ro ON (crc.ruta_origen_id = ro.ruta_id "); + sb.append(" AND ro.activo =1 )"); + sb.append("INNER JOIN ruta rd ON (crc.ruta_destino_id = rd.ruta_id"); + sb.append(" AND rd.activo =1)"); + sb.append("INNER JOIN parada po ON (po.parada_id = crtc.origen_id) "); + sb.append("INNER JOIN parada pd ON (pd.parada_id = crtc.destino_id) "); + sb.append("WHERE crc.activo = 1"); + sb.append(" AND crtc.activo = 1"); + sb.append(" AND ro.activo = 1"); + if (rutaOrigemId != null) { + sb.append(" and crc.ruta_origen_id = ").append(rutaOrigemId); + } + if (rutaDestinoId != null) { + sb.append(" and crc.ruta_destino_id = ").append(rutaDestinoId); + } + sb.append(" ORDER BY conexionRutaCtrl,ro.descruta, "); + sb.append(" rd.descruta,"); + sb.append(" crtc.conexionrutatramoctrl_id "); + + Query query = getSession().createSQLQuery(sb.toString()); + List conexionVOs = new ArrayList(); + + for (Object o : query.list()) { + Object[] oc = (Object[]) o; + + ConexionRutaVO conexionVO = new ConexionRutaVO(); + conexionVO.setDescLinhaOrigem((String) oc[0]); + conexionVO.setNumRutaOrigen(((BigDecimal) oc[1]).intValue()); + conexionVO.setDescLinhaDestino((String) oc[2]); + conexionVO.setNumRutaDestino(((BigDecimal) oc[3]).intValue()); + conexionVO.setTramoOrigen((String) oc[4]); + conexionVO.setTramoDestino((String) oc[5]); + conexionVO.setConexionRutaCtrl(((BigDecimal) oc[6]).intValue()); + conexionVO.setRutaOrigenId(((BigDecimal) oc[7]).intValue()); + conexionVO.setRutaDestinoId(((BigDecimal) oc[8]).intValue()); + conexionVOs.add(conexionVO); + } + + return conexionVOs; + } + + @Override + public List buscarPorConexionConf(ConexionRutaConf conexionRutaConf) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("conexionRutaConf", conexionRutaConf)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaExcepcionTipoPtoVtaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaExcepcionTipoPtoVtaHibernateDAO.java new file mode 100644 index 000000000..bccce1d28 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaExcepcionTipoPtoVtaHibernateDAO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionRutaExcepcionTipoPtoVtaDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaExcepcionTipoPtoVta; + +@Repository("conexionRutaExcepcionTipoPtoVtaDAO") +public class ConexionRutaExcepcionTipoPtoVtaHibernateDAO extends GenericHibernateDAO implements ConexionRutaExcepcionTipoPtoVtaDAO { + + @Autowired + public ConexionRutaExcepcionTipoPtoVtaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarPorConexionConf(ConexionRutaConf conexionRutaConf) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("conexionRutaConf", conexionRutaConf)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaRestricaoPtoVtaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaRestricaoPtoVtaHibernateDAO.java new file mode 100644 index 000000000..2b0dbac08 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaRestricaoPtoVtaHibernateDAO.java @@ -0,0 +1,39 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionRutaExcepcionPtoVtaDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaExcepcionPtoVta; + +@Repository("conexionRutaRestricaoPtoVtaDAO") +public class ConexionRutaRestricaoPtoVtaHibernateDAO extends GenericHibernateDAO implements ConexionRutaExcepcionPtoVtaDAO { + + @Autowired + public ConexionRutaRestricaoPtoVtaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarPorConexionConf(ConexionRutaConf conexionRutaConf) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("conexionRutaConf", conexionRutaConf)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @Override + public void update(ConexionRutaExcepcionPtoVta entidad) { + Session session = getSessionFactory().getCurrentSession(); + session.update(entidad); + session.flush(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java new file mode 100644 index 000000000..8accbde22 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java @@ -0,0 +1,159 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConexionRutaTramoCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaTramoCtrl; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; + +@Repository("conexionRutaTramoCtrlDAO") +public class ConexionRutaTramoCtrlHibernateDAO extends GenericHibernateDAO implements ConexionRutaTramoCtrlDAO { + + @Autowired + public ConexionRutaTramoCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public boolean validarConexioneRutasExistentes(Integer rutaOrigenId, Integer rutaDestinoId, Integer rutaDestinoCId, Integer paradaOrigenId, Integer paradaDestinoId, Integer origemTrechoId, Integer destinoTrechoId) { + + + StringBuilder sb = new StringBuilder(); + + sb.append("SELECT *"); + sb.append(" FROM conexion_ruta_ctrl crt "); + sb.append(" INNER JOIN conexion_ruta_tramo_ctrl crtl ON (crtl.conexionrutactrl_id = crt.conexionrutactrl_id) "); + sb.append(" INNER JOIN conexion c ON (c.conexionrutatramoctrl_id = crtl.conexionrutatramoctrl_id) "); + sb.append(" INNER JOIN conexion_ctrl cc ON (cc.conexionctrl_id = c.conexionctrl_id) "); + sb.append(" WHERE crt.ruta_origen_id = ").append(rutaOrigenId); + sb.append(" AND crt.ruta_destino_id = ").append(rutaDestinoId); + sb.append(" AND crt.ruta_destinoc_id = ").append(rutaDestinoCId); + sb.append(" AND crtl.origen_id = ").append(paradaOrigenId); + sb.append(" AND crtl.destino_id = ").append(paradaDestinoId); + sb.append(" AND cc.origen_id = ").append(origemTrechoId); + sb.append(" AND cc.destino_id = ").append(destinoTrechoId); + sb.append(" and crt.activo = 1 and crtl.activo = 1 and c.activo =1 and cc.activo = 1"); + + Query query = getSession().createSQLQuery(sb.toString()); + List list = query.list(); + + return !list.isEmpty(); + } + + @Override + public List buscarPorConexionRutaCtrl(ConexionRutaCtrl conexionRutaCtrl, Integer rutaId) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("conexionRutaCtrl", conexionRutaCtrl)); + c.add(Restrictions.eq("ruta.rutaId", rutaId)); + + return c.list(); + } + + @Override + public List buscarTodasLocalidadesOrigem(Integer conexionRutaConfId) { + return carregarParadas(conexionRutaConfId, 'A'); + } + + @Override + public List buscarTodasLocalidadesDestino(Integer conexionRutaConfId) { + return carregarParadas(conexionRutaConfId, 'B'); + } + + @Override + public List buscarTodasLocalidadesDestinoC(Integer conexionRutaConfId) { + return carregarParadas(conexionRutaConfId, 'C'); + } + + @SuppressWarnings("unchecked") + private List carregarParadas(Integer conexionRutaConfId, char tipo) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT t ") + .append("FROM ConexionRutaCtrl ctrl "); + + switch (tipo) { + case 'A': + sQuery.append("JOIN ctrl.rutaOrigen r "); + break; + case 'B': + sQuery.append("JOIN ctrl.rutaDestino r "); + break; + case 'C': + sQuery.append("JOIN ctrl.rutaDestinoC r "); + break; + } + + sQuery.append("JOIN r.rutaCombinacionList rc ") + .append("JOIN rc.tramo t ") + .append("WHERE ctrl.activo = 1 ") + .append("AND rc.activo = 1 ") + .append("AND t.activo = 1 ") + .append("AND ctrl.conexionRutaConf.conexionRutaConfId = :conexionRutaConfId"); + + Query qr = getSession().createQuery(sQuery.toString()); + qr.setParameter("conexionRutaConfId", conexionRutaConfId); + List listTramos = qr.list(); + Set paradas = new HashSet(); + for (Tramo tramo : listTramos) { + paradas.add(tramo.getOrigem()); + paradas.add(tramo.getDestino()); + } + + return new ArrayList(paradas); + } + + @Override + @SuppressWarnings("unchecked") + public List buscarPorConexionRutaConf(Integer conexionRutaConfId, char tipo) { + + String filtro = ""; + String join = ""; + + switch (tipo) { + case 'A': + filtro = "AND ctrlt.ruta = ctrl.rutaOrigen "; + join = "JOIN ctrlt.origen p "; + break; + case 'B': + filtro = "AND ctrlt.ruta = ctrl.rutaDestino "; + join = "JOIN ctrlt.destino p "; + break; + case 'C': + filtro = "AND ctrlt.ruta = ctrl.rutaDestinoC "; + join = "JOIN ctrlt.destino p "; + break; + } + + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT DISTINCT p ") + .append("FROM ConexionRutaTramoCtrl ctrlt ") + .append(join) + .append("JOIN ctrlt.conexionRutaCtrl ctrl ") + .append("WHERE ctrlt.activo = 1") + .append("AND ctrl.activo = 1") + .append("AND ctrl.conexionRutaConf.conexionRutaConfId = :conexionRutaConfId ") + .append(filtro); + + Query qr = getSession().createQuery(sQuery.toString()); + qr.setParameter("conexionRutaConfId", conexionRutaConfId); + List paradas = qr.list(); + + return paradas; + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfContratoPuntoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfContratoPuntoVentaHibernateDAO.java new file mode 100644 index 000000000..1d2dad713 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfContratoPuntoVentaHibernateDAO.java @@ -0,0 +1,134 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.BigDecimalType; +import org.hibernate.type.DateType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConfContratoPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ConfContratoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO; +import com.rjconsultores.ventaboletos.vo.configuracioneccomerciales.ConfLayoutContratoVO; + +@Repository("confContratoPuntoVentaDAO") +public class ConfContratoPuntoVentaHibernateDAO extends GenericHibernateDAO implements ConfContratoPuntoVentaDAO { + + @Autowired + public ConfContratoPuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarConfContratoPorPuntoVenta(PuntoVenta puntoVenta) { + + List abastos = findByCriteria(Restrictions.eq("puntoventa", puntoVenta), Restrictions.eq("activo", Boolean.TRUE)); + return abastos; + } + + @Override + public ConfLayoutContratoVO buscarInformacoesPontoVendaparaGerarContratos(Integer puntoVentaId, Integer empresaId) { + + + StringBuilder sb = new StringBuilder(); + + sb.append("select pa.descparada as nomeLocalidade,"); + sb.append(" pv.numdocpuntoventa as CNPJ,"); + sb.append(" pv.fecabertura as dataAbertura,"); + sb.append(" pv.razonsocial as razaoSocial,"); + sb.append(" ci.nombciudad as nomeCidade,"); + sb.append(" pv.desccorreo as email,"); + sb.append(" pv.codpostal codigoPostal,"); + sb.append(" pv.direccionnumero as numero,"); + sb.append(" ptoco.passagembaixa as passagemBaixa,"); + sb.append(" ptoco.passagemalta as passagemAlta,"); + sb.append(" ptoco.seguroobrigatoriobaixa as seguroObrigatorioBaixa,"); + sb.append(" ptoco.seguroobrigatorioalta as seguroObrigatorioAlta,"); + sb.append(" ptoco.valor_venda_gap_comp as valorVendaGapBaixa,"); + sb.append(" ptoco.valor_venda_gap_alta_comp as valorVendaGapAlta,"); + sb.append(" ptoco.valor_imp_gap_comp as valorVendaGapBaixaImp,"); + sb.append(" ptoco.valor_imp_gap_alta_comp as valorVendaGapAltaImp,"); + sb.append(" ptoco.segurobaixa as seguroBaixa,"); + sb.append(" ptoco.seguroalta as seguroAlta,"); + sb.append(" ptoco.outrosbaixa as outrosBaixa,"); + sb.append(" ptoco.outrosalta as outrosAlta,"); + sb.append(" ptoco.excessobaixa as excesssoBaixa,"); + sb.append(" ptoco.excessoalta as excesssoAlta, "); + sb.append(" pvt.nome as nomeTitular, "); + sb.append(" ifi.nome as nomeBanco, "); + sb.append(" pva.numagencia as numeroAgencia, "); + sb.append(" pva.numconta as numeroConta, "); + sb.append(" pv.tipo_socio as tipoSocio, "); + sb.append(" pv.direccioncalle as rua, "); + sb.append(" co.desccolonia as bairro "); + sb.append("from punto_venta pv "); + sb.append("inner join ptovta_comissao ptoco on (ptoco.puntoventa_id = pv.puntoventa_id "); + sb.append(" and ptoco.empresa_id =:empresaId )"); + sb.append("inner join ptovta_empresa pe on (pe.puntoventa_id = pv.puntoventa_id "); + sb.append(" and ptoco.empresa_id = pe.empresa_id) "); + sb.append("inner join parada pa on (pv.parada_id = pa.parada_id)"); + sb.append("inner join colonia co on (co.colonia_id = pv.colonia_id) "); + sb.append("inner join ciudad ci on (ci.ciudad_id = co.ciudad_id) "); + sb.append("inner join ptovta_titular pvt on (pvt.ptovtatitular_id = pv.ptovtatitular_id) "); + sb.append("inner join ptovta_agencia pva on (pva.ptovtaagencia_id = pv.ptovtaagencia_id) "); + sb.append("inner join insti_financeira ifi on (ifi.instifinanceira_id = pva.instifinanceira_id) "); + sb.append("where pv.puntoventa_id =:puntoVentaId "); + sb.append(" and ptoco.empresa_id =:empresaId "); + sb.append(" and pv.activo =1 "); + sb.append(" and ptoco.activo =1 "); + sb.append(" and pe.activo = 1 "); + + + + SQLQuery sql = getSession().createSQLQuery(sb.toString()) + .addScalar("nomeLocalidade", StringType.INSTANCE) + .addScalar("CNPJ", StringType.INSTANCE) + .addScalar("dataAbertura", DateType.INSTANCE) + .addScalar("razaoSocial", StringType.INSTANCE) + .addScalar("nomeCidade", StringType.INSTANCE) + .addScalar("email", StringType.INSTANCE) + .addScalar("codigoPostal", StringType.INSTANCE) + .addScalar("numero", StringType.INSTANCE) + .addScalar("passagemBaixa", BigDecimalType.INSTANCE) + .addScalar("passagemAlta", BigDecimalType.INSTANCE) + .addScalar("seguroObrigatorioBaixa", BigDecimalType.INSTANCE) + .addScalar("seguroObrigatorioAlta", BigDecimalType.INSTANCE) + .addScalar("valorVendaGapBaixa", BigDecimalType.INSTANCE) + .addScalar("valorVendaGapAlta", BigDecimalType.INSTANCE) + .addScalar("valorVendaGapBaixaImp", BigDecimalType.INSTANCE) + .addScalar("valorVendaGapAltaImp", BigDecimalType.INSTANCE) + .addScalar("seguroBaixa", BigDecimalType.INSTANCE) + .addScalar("seguroAlta", BigDecimalType.INSTANCE) + .addScalar("outrosBaixa", BigDecimalType.INSTANCE) + .addScalar("outrosAlta", BigDecimalType.INSTANCE) + .addScalar("excesssoBaixa", BigDecimalType.INSTANCE) + .addScalar("excesssoAlta", BigDecimalType.INSTANCE) + .addScalar("nomeTitular", StringType.INSTANCE) + .addScalar("nomeBanco", StringType.INSTANCE) + .addScalar("numeroAgencia", StringType.INSTANCE) + .addScalar("numeroConta", StringType.INSTANCE) + .addScalar("tipoSocio", StringType.INSTANCE) + .addScalar("bairro", StringType.INSTANCE) + .addScalar("rua", StringType.INSTANCE); + + + + sql.setInteger("empresaId", empresaId); + sql.setInteger("puntoVentaId", puntoVentaId); + sql.setResultTransformer(new AliasToBeanResultTransformer(ConfLayoutContratoVO.class)); + + @SuppressWarnings("unchecked") + ConfLayoutContratoVO confLayoutContratoVO = (ConfLayoutContratoVO) sql.uniqueResult(); + + return confLayoutContratoVO; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoCanalVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoCanalVentaHibernateDAO.java new file mode 100644 index 000000000..718317700 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoCanalVentaHibernateDAO.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.ConfRestricaoCanalVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoCanalVenta; + +@Repository("confRestricaoCanalVentaDAO") +public class ConfRestricaoCanalVentaHibernateDAO extends GenericHibernateDAO implements ConfRestricaoCanalVentaDAO { + + @Autowired + public ConfRestricaoCanalVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoExcecaoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoExcecaoHibernateDAO.java new file mode 100644 index 000000000..0354b91ee --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoExcecaoHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.ConfRestricaoExcecaoDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoExcecao; + +@Repository("confRestricaoExcecaoDAO") +public class ConfRestricaoExcecaoHibernateDAO extends GenericHibernateDAO + implements ConfRestricaoExcecaoDAO { + + @Autowired + public ConfRestricaoExcecaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoOrgaoConcedenteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoOrgaoConcedenteHibernateDAO.java new file mode 100644 index 000000000..7741797a4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoOrgaoConcedenteHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.ConfRestricaoOrgaoConcedenteDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoOrgaoConcedente; + +@Repository("confRestricaoOrgaoConcedenteDAO") +public class ConfRestricaoOrgaoConcedenteHibernateDAO extends GenericHibernateDAO + implements ConfRestricaoOrgaoConcedenteDAO { + + @Autowired + public ConfRestricaoOrgaoConcedenteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoPtovtaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoPtovtaHibernateDAO.java new file mode 100644 index 000000000..a8bd5442c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoPtovtaHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.ConfRestricaoPtovtaDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoPtovta; + +@Repository("confRestricaoPtovtaDAO") +public class ConfRestricaoPtovtaHibernateDAO extends GenericHibernateDAO + implements ConfRestricaoPtovtaDAO { + + @Autowired + public ConfRestricaoPtovtaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoRutasHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoRutasHibernateDAO.java new file mode 100644 index 000000000..f510ff452 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoRutasHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.ConfRestricaoRutasDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoRutas; + +@Repository("confRestricaoRutasDAO") +public class ConfRestricaoRutasHibernateDAO extends GenericHibernateDAO + implements ConfRestricaoRutasDAO { + + @Autowired + public ConfRestricaoRutasHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoTramoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoTramoHibernateDAO.java new file mode 100644 index 000000000..cd281063e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoTramoHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.ConfRestricaoTramoDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoTramo; + +@Repository("confRestricaoTramoDAO") +public class ConfRestricaoTramoHibernateDAO extends GenericHibernateDAO + implements ConfRestricaoTramoDAO { + + @Autowired + public ConfRestricaoTramoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoTramoOCHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoTramoOCHibernateDAO.java new file mode 100644 index 000000000..773d0ca58 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoTramoOCHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.ConfRestricaoTramoOCDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoTramoOC; + +@Repository("confRestricaoTramoOCDAO") +public class ConfRestricaoTramoOCHibernateDAO extends GenericHibernateDAO + implements ConfRestricaoTramoOCDAO { + + @Autowired + public ConfRestricaoTramoOCHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoVendaWebHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoVendaWebHibernateDAO.java new file mode 100644 index 000000000..8f72fd2c2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoVendaWebHibernateDAO.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoVendaWebDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb; +import com.rjconsultores.ventaboletos.entidad.Constante; + +@Repository("confRestricaoVendaWebDAO") +public class ConfRestricaoVendaWebHibernateDAO extends GenericHibernateDAO + implements ConfRestricaoVendaWebDAO { + + @Autowired + public ConfRestricaoVendaWebHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfTotemHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfTotemHibernateDAO.java new file mode 100644 index 000000000..27904a13f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfTotemHibernateDAO.java @@ -0,0 +1,44 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConfTotemDAO; +import com.rjconsultores.ventaboletos.entidad.ConfTotem; + +/** + * + * @author Wallace + */ +@Repository("confTotemDAO") +public class ConfTotemHibernateDAO extends GenericHibernateDAO + implements ConfTotemDAO { + + @Autowired + public ConfTotemHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public ConfTotem buscar(String chave) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.ilike("chave", chave)); + + return c.list().isEmpty() ? null : (ConfTotem) c.list().get(0); + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java new file mode 100644 index 000000000..4b83a76db --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java @@ -0,0 +1,1462 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collection; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeSet; + +import javax.sql.DataSource; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.hibernate.Hibernate; +import org.hibernate.HibernateException; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.transform.Transformers; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.dao.ConferenciaComissaoDAO; +import com.rjconsultores.ventaboletos.dao.ContaCorrenteAgenciaDAO; +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.entidad.ContaCorrentePtoVta; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.LogConferencia; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.DiaConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO; +import com.rjconsultores.ventaboletos.vo.comissao.FormapagoVO; +import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO; +import com.rjconsultores.ventaboletos.vo.comissao.OcdVO; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +@Repository("conferenciaComissaoDAO") +public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO + implements ConferenciaComissaoDAO { + + private static Logger log = Logger.getLogger(ConferenciaComissaoHibernateDAO.class); + + @Autowired + private ContaCorrenteAgenciaDAO contaCorrenteAgenciaDAO; + + @Autowired + private DataSource dataSourceRead; + + @Autowired + private DataSource dataSource; + + @Autowired + public ConferenciaComissaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List carregarConferenciaComissao(String competencia, + Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, boolean isDesconsideraPtVendaFechados) throws BusinessException { + Connection con = null; + try { + con = getConnection(); + + List lsConferencias = new ArrayList(); + + carregarPuntoVentas(lsConferencias, competencia, empresa, puntoVenta, dataMovimento, isDesconsideraPtVendaFechados); + carregarConferenciasRegistradas(lsConferencias, competencia, empresa, puntoVenta, dataMovimento, null, null, null); + carregarMovimentoVendas(con, lsConferencias, competencia, empresa, puntoVenta, dataMovimento, null, null); + carregarDiasSemMovimento(lsConferencias, competencia, empresa, puntoVenta, dataMovimento); + + Collections.sort(lsConferencias); + + return lsConferencias; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } finally { + try { + if (con != null && !con.isClosed()) { + con.close(); + } + } catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + } + + public List carregarConferenciaComissao(Date dataInicial, Date dataFinal, + Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, boolean isDesconsideraPtVendaFechados) throws BusinessException { + Connection con = null; + try { + con = getConnection(); + + List lsConferencias = new ArrayList(); + Map parametros = carregarParametros(dataInicial, dataFinal, null, empresa, puntoVenta, dataMovimento, false); + + SimpleDateFormat format = new SimpleDateFormat("MM/yyyy"); + String competencia = format.format(dataInicial); + + carregarPuntoVentas(lsConferencias, dataInicial, dataFinal, empresa, puntoVenta, dataMovimento); + carregarConferenciasRegistradas(lsConferencias, null, empresa, puntoVenta, dataMovimento, null, null, parametros); + carregarMovimentoVendas(con, lsConferencias, null, empresa, puntoVenta, dataMovimento, dataInicial, dataFinal); + carregarDiasSemMovimento(lsConferencias, competencia, empresa, puntoVenta, dataMovimento); + + return lsConferencias; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } finally { + try { + if (con != null && !con.isClosed()) { + con.close(); + } + } catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + } + + private void carregarPuntoVentas(List lsConferencias, Date dataInicial, Date dataFinal, + Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento) throws BusinessException { + + Set diasSemMovimentos = DateUtil.carregarDiasCompetencia(dataInicial, dataFinal); + ConferenciaComissaoVO conferenciaComissao = new ConferenciaComissaoVO(); + conferenciaComissao.setPuntoventaId(puntoVenta.getPuntoventaId()); + conferenciaComissao.setNombpuntoventa(puntoVenta.getNombpuntoventa()); + conferenciaComissao.setNumPuntoVenta(puntoVenta.getNumPuntoVenta()); + conferenciaComissao.setDataInicial(dataInicial); + conferenciaComissao.setDataFinal(dataFinal); + conferenciaComissao.setDiasSemMovimentos(diasSemMovimentos); + lsConferencias.add(conferenciaComissao); + + return; + } + + @SuppressWarnings("unchecked") + private void carregarPuntoVentas(List lsConferencias, String competencia, + Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, boolean isDesconsideraPtVendaFechados) throws BusinessException { + try { + if (puntoVenta != null && puntoVenta.getPuntoventaId() > -1) { + Set diasSemMovimentos = DateUtil.carregarDiasCompetencia(competencia, dataMovimento); + ConferenciaComissaoVO conferenciaComissao = new ConferenciaComissaoVO(); + conferenciaComissao.setPuntoventaId(puntoVenta.getPuntoventaId()); + conferenciaComissao.setNombpuntoventa(puntoVenta.getNombpuntoventa()); + conferenciaComissao.setNumPuntoVenta(puntoVenta.getNumPuntoVenta()); + conferenciaComissao.setCompetencia(competencia); + conferenciaComissao.setDiasSemMovimentos(diasSemMovimentos); + lsConferencias.add(conferenciaComissao); + + return; + } + + Map parametros = new HashMap(); + StringBuilder sQuery = new StringBuilder() + .append("SELECT PV.PUNTOVENTA_ID AS \"puntoventaId\", ") + .append("PV.NUMPUNTOVENTA as \"numPuntoVenta\", PV.NOMBPUNTOVENTA as \"nombpuntoventa\" ") + .append("FROM PUNTO_VENTA PV ") + .append("JOIN PTOVTA_EMPRESA PTE ON PTE.PUNTOVENTA_ID = PV.PUNTOVENTA_ID AND PTE.ACTIVO = 1 ") + .append("WHERE PV.ACTIVO = 1 "); + + if (empresa != null) { + sQuery.append("AND PTE.EMPRESA_ID = :empresaId "); + parametros.put("empresaId", empresa.getEmpresaId()); + } + + if(isDesconsideraPtVendaFechados) { + sQuery.append("AND PV.STATUSAPROBACION = 'A' "); + } + + sQuery.append("ORDER BY PV.NOMBPUNTOVENTA "); + + @SuppressWarnings("deprecation") + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("puntoventaId", Hibernate.INTEGER) + .addScalar("numPuntoVenta", Hibernate.STRING) + .addScalar("nombpuntoventa", Hibernate.STRING) + .setResultTransformer(Transformers.aliasToBean(ConferenciaComissaoVO.class)); + setParametros(qr, parametros); + + processarQueryConferenciaComissao(qr.list(), lsConferencias, competencia, dataMovimento, null, null); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @SuppressWarnings("unchecked") + private void carregarConferenciasRegistradas(List lsConferencias, + String competencia, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, Date dataInicial, Date dataFinal, Map parametros) throws BusinessException { + try { + if (parametros == null) { + parametros = carregarParametros(dataInicial, dataFinal, competencia, empresa, puntoVenta, dataMovimento, false); + } + StringBuilder sQuery = new StringBuilder("SELECT co FROM Conferencia co "); + sQuery.append("JOIN co.empresa em ") + .append("JOIN co.puntoVenta pv ") + .append("WHERE co.activo = 1 ") + .append("AND co.datamovimento BETWEEN TO_DATE(:dataInicial,'DD/MM/YYYY HH24:MI') AND TO_DATE(:dataFinal,'DD/MM/YYYY HH24:MI') "); + + if (parametros.containsKey("empresaId")) { + sQuery.append("AND em.empresaId = :empresaId "); + } + if (parametros.containsKey("puntoventaId")) { + sQuery.append("AND pv.puntoventaId = :puntoventaId "); + } + + Query qr = getSession().createQuery(sQuery.toString()); + setParametros(qr, parametros); + dataInicial = parametros.get("dataInicial") != null ? DateUtil.getDateFromString(parametros.get("dataInicial").toString(), "dd/MM/yyyy HH:mm") : null; + dataFinal = parametros.get("dataFinal") != null ? DateUtil.getDateFromString(parametros.get("dataFinal").toString(), "dd/MM/yyyy HH:mm") : null; + processarQueryConferencia(qr.list(), lsConferencias, competencia, dataMovimento, dataInicial, dataFinal); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @SuppressWarnings("rawtypes") + private void setParametros(Query qr, Map parametros) { + for (Entry parametro : parametros.entrySet()) { + if (parametro.getValue() instanceof Collection) { + qr.setParameterList(parametro.getKey(), (Collection) parametro.getValue()); + } else if (parametro.getValue() instanceof List) { + qr.setParameterList(parametro.getKey(), (List) parametro.getValue()); + } else { + qr.setParameter(parametro.getKey(), parametro.getValue()); + } + } + } + + private void setParametros(NamedParameterStatement npst, Map parametros) throws SQLException { + for (Entry parametro : parametros.entrySet()) { + npst.setObject(parametro.getKey(), parametro.getValue()); + } + } + + private void carregarMovimentoVendas(Connection con, List lsConferencias, + String competencia, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, Date dataInicialDate, Date dataFinalDate) + throws BusinessException, SQLException { + PreparedStatement stmt = null; + ResultSet rset = null; + try { + + Map parametros = carregarParametros(dataInicialDate, dataFinalDate, competencia, empresa, puntoVenta, dataMovimento, false); + + StringBuilder sQuery = new StringBuilder() + .append("SELECT PV.PUNTOVENTA_ID AS \"puntoventaId\", PV.NUMPUNTOVENTA as \"numPuntoVenta\", ") + .append("PV.NOMBPUNTOVENTA as \"nombpuntoventa\", TO_DATE(C.FECCORTE, 'DD/MM/YY') as \"datamovimento\" ") + .append("FROM CAJA C ") + .append("INNER JOIN PUNTO_VENTA PV ON C.PUNTOVENTA_ID = PV.PUNTOVENTA_ID ") + .append("INNER JOIN MARCA M ON C.MARCA_ID = M.MARCA_ID ") + .append("WHERE PV.ACTIVO = 1 ") + .append("AND ((C.INDSTATUSBOLETO = 'E' AND C.INDREIMPRESION = 1) OR C.INDREIMPRESION = 0 OR C.MOTIVOCANCELACION_ID = ?) ") + .append("AND C.FECCORTE BETWEEN TO_DATE(?, 'DD/MM/YYYY HH24:MI') AND TO_DATE(?, 'DD/MM/YYYY HH24:MI') "); + + if (parametros.containsKey("empresaId")) { + sQuery.append("AND M.EMPRESA_ID = ? "); + } + if (parametros.containsKey("puntoventaId")) { + sQuery.append("AND PV.PUNTOVENTA_ID = ? "); + } + + sQuery.append(" UNION ") + .append(" SELECT PV.PUNTOVENTA_ID AS \"puntoventaId\", PV.NUMPUNTOVENTA as \"numPuntoVenta\", ") + .append(" PV.NOMBPUNTOVENTA as \"nombpuntoventa\", TO_DATE(C.FECCORTE, 'DD/MM/YY') as \"datamovimento\" ") + .append(" FROM EVENTO_EXTRA ee ") + .append(" INNER JOIN CAJA_DIVERSOS C ON C.EVENTOEXTRA_ID = EE.EVENTOEXTRA_ID ") + .append(" INNER JOIN punto_venta pv ON ee.puntoventa_id = pv.puntoventa_id ") + .append(" WHERE ee.activo = 1") + .append(" AND C.FECCORTE BETWEEN TO_DATE(?, 'DD/MM/YYYY HH24:MI') AND TO_DATE(?, 'DD/MM/YYYY HH24:MI') "); + + if (parametros.containsKey("empresaId")) { + sQuery.append("AND ee.EMPRESA_ID = ? "); + } + + if (parametros.containsKey("puntoventaId")) { + sQuery.append("AND PV.PUNTOVENTA_ID = ? "); + } + + sQuery.append("GROUP BY PV.PUNTOVENTA_ID, PV.NUMPUNTOVENTA, PV.NOMBPUNTOVENTA, TO_DATE(C.FECCORTE, 'DD/MM/YY') "); + + int idxParametro = 1; + stmt = con.prepareStatement(sQuery.toString()); + String dataIncial = (String) parametros.get("dataInicial"); + String dataFinal = (String) parametros.get("dataFinal"); + stmt.setInt(idxParametro++, Constantes.MVO_CANCEL_GERACAO_OCD.intValue()); + stmt.setString(idxParametro++, dataIncial); + stmt.setString(idxParametro++, dataFinal); + if (parametros.containsKey("empresaId")) { + stmt.setInt(idxParametro++, (Integer) parametros.get("empresaId")); + } + if (parametros.containsKey("puntoventaId") && ((Integer)parametros.get("puntoventaId")) != -1) { + stmt.setInt(idxParametro++, (Integer) parametros.get("puntoventaId")); + } + + //Parametros Evento extra + stmt.setString(idxParametro++, dataIncial); + stmt.setString(idxParametro++, dataFinal); + + if (parametros.containsKey("empresaId")) { + stmt.setInt(idxParametro++, (Integer) parametros.get("empresaId")); + } + + if (parametros.containsKey("puntoventaId") && ((Integer)parametros.get("puntoventaId")) != -1) { + stmt.setInt(idxParametro++, (Integer) parametros.get("puntoventaId")); + } + + rset = stmt.executeQuery(); + List movimentos = new ArrayList(); + while (rset.next()) { + ConferenciaComissaoVO conferenciaComissao = new ConferenciaComissaoVO(); + conferenciaComissao.setPuntoventaId(rset.getInt("puntoventaId")); + conferenciaComissao.setNumPuntoVenta(rset.getString("numPuntoVenta")); + conferenciaComissao.setNombpuntoventa(rset.getString("nombpuntoventa")); + conferenciaComissao.setDataMovimento(rset.getDate("datamovimento")); + + movimentos.add(conferenciaComissao); + } + + processarQueryConferenciaComissao(movimentos, lsConferencias, competencia, dataMovimento, dataInicialDate, dataFinalDate); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } finally { + if (rset != null && !rset.isClosed()) { + rset.close(); + } + if (stmt != null && !stmt.isClosed()) { + stmt.close(); + } + } + } + + /** + * Carrega a {@link ConferenciaComissaoVO} a partir de uma consulta com sql nativo, transformando o resultado em uma coleção de {@link ConferenciaComissaoVO} + * + * @param lsQuery + * @param lsConferencias + * @param competencia + * @param corPadrao + * @throws ParseException + */ + private void processarQueryConferenciaComissao(List lsQuery, + List lsConferencias, String competencia, Date dataMovimento, Date dataInicial, Date dataFinal) throws ParseException { + + Set diasSemMovimentos = new TreeSet(); + if(dataInicial != null && dataFinal != null) { + diasSemMovimentos = DateUtil.carregarDiasCompetencia(dataInicial, dataFinal); + } + + if (competencia != null) { + diasSemMovimentos = DateUtil.carregarDiasCompetencia(competencia, dataMovimento); + } + + for (ConferenciaComissaoVO conferenciaComissaoMovimentoDiario : lsQuery) { + ConferenciaComissaoVO conferenciaComissao = new ConferenciaComissaoVO(); + conferenciaComissao.setCompetencia(competencia); + conferenciaComissao.setDataInicial(dataInicial); + conferenciaComissao.setDataFinal(dataFinal); + conferenciaComissao.setPuntoventaId(conferenciaComissaoMovimentoDiario.getPuntoventaId()); + conferenciaComissao.setNumPuntoVenta(conferenciaComissaoMovimentoDiario.getNumPuntoVenta()); + conferenciaComissao.setNombpuntoventa(conferenciaComissaoMovimentoDiario.getNombpuntoventa()); + conferenciaComissao.setDiasSemMovimentos(new TreeSet(diasSemMovimentos)); + + if (lsConferencias.contains(conferenciaComissao)) { + conferenciaComissao = lsConferencias.get(lsConferencias.indexOf(conferenciaComissao)); + } + + if (conferenciaComissaoMovimentoDiario.getDataMovimento() != null) { + Integer dia = Integer.valueOf(DateUtil.getStringDate(conferenciaComissaoMovimentoDiario.getDataMovimento(), "dd")); + if (conferenciaComissao.getDiasSemMovimentos() != null && conferenciaComissao.getDiasSemMovimentos().contains(dia)) { + + DiaConferenciaComissaoVO diaConferenciaComissao = new DiaConferenciaComissaoVO(); + diaConferenciaComissao.setDia(dia); + if (competencia != null) { + diaConferenciaComissao.setData(DateUtil.getDateFromString(dia + "/" + competencia, "dd/MM/yyyy")); + } else { + diaConferenciaComissao.setData(dataMovimento); + } + + if (conferenciaComissao.getDias() == null) { + conferenciaComissao.setDias(new ArrayList()); + } + + conferenciaComissao.getDias().add(diaConferenciaComissao); + conferenciaComissao.getDiasSemMovimentos().remove(diaConferenciaComissao.getDia()); + } + } + + if (!lsConferencias.contains(conferenciaComissao)) { + lsConferencias.add(conferenciaComissao); + } + } + } + + /** + * Carrega a {@link ConferenciaComissaoVO} a partir dos registros da tabela {@link Conferencia} + * + * @param lsQuery + * @param lsConferencias + * @param competencia + * @throws ParseException + */ + private void processarQueryConferencia(List lsQuery, + List lsConferencias, String competencia, Date dataMovimento, Date dataInicial, Date dataFinal) throws ParseException { + if (lsQuery != null && !lsQuery.isEmpty()) { + Set diasSemMovimentos = null; + if (competencia != null) { + diasSemMovimentos = DateUtil.carregarDiasCompetencia(competencia, dataMovimento); + } + for (Conferencia conferencia : lsQuery) { + ConferenciaComissaoVO conferenciaComissao = new ConferenciaComissaoVO(); + conferenciaComissao.setCompetencia(competencia); + conferenciaComissao.setDataInicial(dataInicial); + conferenciaComissao.setDataFinal(dataFinal); + conferenciaComissao.setPuntoventaId(conferencia.getPuntoVenta().getPuntoventaId()); + conferenciaComissao.setNumPuntoVenta(conferencia.getPuntoVenta().getNumPuntoVenta()); + conferenciaComissao.setNombpuntoventa(conferencia.getPuntoVenta().getNombpuntoventa()); + conferenciaComissao.setDiasSemMovimentos(diasSemMovimentos == null ? null : new TreeSet(diasSemMovimentos)); + + if (lsConferencias.contains(conferenciaComissao)) { + conferenciaComissao = lsConferencias.get(lsConferencias.indexOf(conferenciaComissao)); + } + + if (conferencia.getDatamovimento() != null) { + Integer dia = Integer.valueOf(DateUtil.getStringDate(conferencia.getDatamovimento(), "dd")); + if (conferenciaComissao.getDiasSemMovimentos() != null && conferenciaComissao.getDiasSemMovimentos().contains(dia)) { + + DiaConferenciaComissaoVO diaConferenciaComissao = new DiaConferenciaComissaoVO(); + diaConferenciaComissao.setConferenciaId(conferencia.getConferenciaId()); + diaConferenciaComissao.setDia(dia); + if (competencia != null) { + diaConferenciaComissao.setData(DateUtil.getDateFromString(dia + "/" + competencia, "dd/MM/yyyy")); + } else { + diaConferenciaComissao.setData(dataMovimento); + } + diaConferenciaComissao.setIndboletogerado(conferencia.getIndboletogerado()); + diaConferenciaComissao.setIndconferido(conferencia.getIndconferido()); + diaConferenciaComissao.setIndmaloterecebido(conferencia.getIndmaloterecebido()); + diaConferenciaComissao.setIndpendencia(conferencia.getIndpendencia()); + diaConferenciaComissao.setIndsemmovimento(conferencia.getIndsemmovimento()); + + if (conferenciaComissao.getDias() == null) { + conferenciaComissao.setDias(new ArrayList()); + } + + conferenciaComissao.getDias().add(diaConferenciaComissao); + conferenciaComissao.getDiasSemMovimentos().remove(diaConferenciaComissao.getDia()); + } + } + + if (!lsConferencias.contains(conferenciaComissao)) { + lsConferencias.add(conferenciaComissao); + } + } + } + } + + private void carregarDiasSemMovimento(List lsConferencias, + String competencia, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento) throws ParseException { + for (ConferenciaComissaoVO conferenciaComissao : lsConferencias) { + for (Integer diaSemMovimento : conferenciaComissao.getDiasSemMovimentos()) { + DiaConferenciaComissaoVO diaConferenciaComissao = new DiaConferenciaComissaoVO(); + diaConferenciaComissao.setDia(diaSemMovimento); + if (competencia == null && diaSemMovimento != null) { + diaConferenciaComissao.setData(dataMovimento); + } else { + diaConferenciaComissao.setData(DateUtil.getDateFromString(diaSemMovimento + "/" + competencia, "dd/MM/yyyy")); + } + diaConferenciaComissao.setIndsemmovimento(true); + + if (conferenciaComissao.getDias() == null) { + conferenciaComissao.setDias(new ArrayList()); + } + conferenciaComissao.getDias().add(diaConferenciaComissao); + } + conferenciaComissao.getDiasSemMovimentos().clear(); + } + } + + private Map carregarParametros(Date dataInicial, Date dataFinal, String competencia, Empresa empresa, + PuntoVenta puntoVenta, Date datamovimento, boolean formatoDataSemHora) throws ParseException { + Map parametros = new HashMap(); + + String formatoData = (formatoDataSemHora ? "dd/MM/yyyy" : "dd/MM/yyyy HH:mm"); + + if (empresa != null) { + parametros.put("empresaId", empresa.getEmpresaId()); + } + if (puntoVenta != null && puntoVenta.getPuntoventaId() > -1) { + parametros.put("puntoventaId", puntoVenta.getPuntoventaId()); + } + + if (datamovimento != null) { + parametros.put("dataInicial", DateUtil.getStringDate(DateUtil.inicioFecha(datamovimento), formatoData)); + parametros.put("dataFinal", DateUtil.getStringDate(DateUtil.fimFecha(datamovimento), formatoData)); + } + + if (StringUtils.isNotBlank(competencia) && datamovimento == null) { + parametros.put("dataInicial", DateUtil.getStringDate(DateUtil.inicioFecha(DateUtil.getDataInicialCompetencia(competencia)), formatoData)); + parametros.put("dataFinal", DateUtil.getStringDate(DateUtil.fimFecha(DateUtil.getDataFinalCompetencia(competencia)), formatoData)); + } + + if (parametros.get("dataInicial") == null && dataInicial != null) { + parametros.put("dataInicial", DateUtil.getStringDate(dataInicial, formatoData)); + parametros.put("dataFinal", DateUtil.getStringDate(dataFinal, formatoData)); + } + + return parametros; + } + + @Override + @Transactional + public Conferencia confirmarChegadaMalote(Conferencia conferencia) throws BusinessException { + try { + conferencia.setIndmaloterecebido(Boolean.TRUE); + if (conferencia.isSemPendenciaConferencia()) { + return encerrarMovimentoDiario(conferencia); + } + return suscribirOrActualizacion(conferencia); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + @Transactional + public Conferencia cancelarChegadaMalote(Conferencia conferencia) { + conferencia.setIndmaloterecebido(Boolean.FALSE); + return suscribirOrActualizacion(conferencia); + } + + @Override + @Transactional + public Conferencia suscribirOrActualizacion(Conferencia entidad) { + if (entidad.getConferenciaId() == null) { + return suscribir(entidad); + } else { + return actualizacion(entidad); + } + } + + @Override + @Transactional + public Conferencia encerrarMovimentoDiario(Conferencia conferencia) throws BusinessException { + try { + conferencia.setIndconferido(Boolean.TRUE); + conferencia.setIndpendencia(isMovimentoDiarioPendencia(conferencia)); + conferencia.setIndboletogerado(isMovimentoDiarioBoletoGerado(conferencia)); + + gerarLancamentoContaCorrente(conferencia); + return suscribirOrActualizacion(conferencia); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + @Transactional + public Conferencia reabrirMovimentoDiario(Conferencia conferencia) throws BusinessException { + try { + conferencia.setIndconferido(Boolean.FALSE); + return suscribirOrActualizacion(conferencia); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + private boolean isMovimentoDiarioBoletoGerado(Conferencia conferencia) + throws BusinessException { + try { + Map parametros = carregarParametros(null, null, null, conferencia.getEmpresa(), conferencia.getPuntoVenta(), null, false); + StringBuilder sQuery = new StringBuilder() + .append("SELECT FECHAMENTOCNTCORRENTE_ID ") + .append("FROM FECHAMENTO_CNTCORRENTE ") + .append("WHERE ACTIVO = 1 ") + .append("AND :datamovimento BETWEEN FECINIFECHAMENTO AND FECFINFECHAMENTO "); + + parametros.put("datamovimento", conferencia.getDatamovimento()); + if (parametros.containsKey("empresaId")) { + sQuery.append("AND EMPRESA_ID = :empresaId "); + } + if (parametros.containsKey("puntoventaId")) { + sQuery.append("AND PUNTOVENTA_ID = :puntoventaId "); + } + + Query qr = getSession().createSQLQuery(sQuery.toString()); + setParametros(qr, parametros); + + return !qr.list().isEmpty(); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + private boolean isMovimentoDiarioPendencia(Conferencia conferencia) { + Query qr = getSession().createQuery( + "SELECT COUNT(log) FROM LogConferencia log WHERE log.activo = 1 AND log.conferencia.conferenciaId = :conferenciaId AND log.status = :status"); + qr.setParameter("conferenciaId", conferencia.getConferenciaId()); + qr.setParameter("status", StatusLogConferencia.PENDENCIA); + return !qr.list().isEmpty() && ((Long) qr.list().get(0)) > 0; + } + + @Override + public List carregarEventosFinanceiros(Conferencia conferencia) + throws BusinessException { + Connection con = null; + NamedParameterStatement npst = null; + ResultSet rSet = null; + + try { + Map parametros = carregarParametros(conferencia.getDataInicial(), conferencia.getDataFinal(), conferencia.getCompetencia(), conferencia.getEmpresa(), + conferencia.getPuntoVenta(), conferencia.getDatamovimento(), true); + StringBuilder sQuery = new StringBuilder() + .append("SELECT EE.BOLETO_ID AS \"boletoId\", EE.EVENTOEXTRA_ID AS \"eventoextraId\", EE.NUMDOCUMENTO AS \"numdocumento\", ") + .append("CFP.IMPORTE AS \"impingreso\", TEE.DESCTIPOEVENTO AS \"desctipoevento\", EE.DESCINFO AS \"descinfo\", ") + .append("NVL(LOG.STATUS,-1) AS \"status\", FP.FORMAPAGO_ID AS \"formapagoId\", FP.DESCPAGO AS \"descpago\", ") + .append("TEE.INDTIPO AS \"indtipo\", U.NOMBUSUARIO AS \"nombusuario\", LOG.LOGCONFERENCIA_ID AS \"logconferenciaId\", ") + .append("COMFP.COMEMPFORMAPAGO_ID AS \"comempformapagoId\", COMTEE.COMEMPTIPOEVENTOEXTRA_ID AS \"comemptipoeventoextraId\", ") + .append("COALESCE(CEC.INDTIPO_DEB_CRED, 0) AS \"tipoeventoextradebcred\", ") + .append("CEC.INDEVENTOSFINANCEIROS AS \"exigeConferenciaAba\", B.NUMFOLIOSISTEMA \"numFolioSistema\", ") + .append("TEE.CVETIPOEVENTO AS \"cvetipoevento\", CD.FECCORTE AS \"feccorte\", ") + .append("EI.ICMS as \"icmsBase\", NVL(EST.ESTADO_ID,0) as \"estadoId\", CD.CAJADIVERSOS_ID as cajaDiversosId, U.USUARIO_ID as usuarioId, ") + .append("CD.TURNO_ID as turnoId ") + .append("FROM EVENTO_EXTRA EE ") + .append("JOIN TIPO_EVENTO_EXTRA TEE ON EE.TIPOEVENTOEXTRA_ID = TEE.TIPOEVENTOEXTRA_ID ") + .append("JOIN CAJA_DIVERSOS CD ON CD.EVENTOEXTRA_ID = EE.EVENTOEXTRA_ID ") + .append("JOIN CAJA_DIVERSOS_PAGO CFP ON CFP.CAJADIVERSOS_ID = CD.CAJADIVERSOS_ID ") + .append("JOIN FORMA_PAGO FP ON FP.FORMAPAGO_ID = CFP.FORMAPAGO_ID ") + .append("INNER JOIN USUARIO U ON EE.USUARIO_ID = U.USUARIO_ID ") + .append("LEFT JOIN COM_EMP_CONFERENCIA CEC ON EE.EMPRESA_ID = CEC.EMPRESA_ID AND CEC.ACTIVO = 1 ") + .append("LEFT JOIN LOG_CONFERENCIA LOG ON LOG.EVENTOEXTRA_ID = EE.EVENTOEXTRA_ID AND LOG.ACTIVO = 1 ") + .append("LEFT JOIN COM_EMP_FORMAPAGO COMFP ON COMFP.FORMAPAGO_ID = FP.FORMAPAGO_ID AND COMFP.EMPRESA_ID = EE.EMPRESA_ID AND COMFP.ACTIVO = 1 ") + .append("LEFT JOIN COM_EMP_TIPOEVENTOEXTRA COMTEE ON COMTEE.TIPOEVENTOEXTRA_ID = TEE.TIPOEVENTOEXTRA_ID AND COMTEE.EMPRESA_ID = EE.EMPRESA_ID AND COMTEE.ACTIVO = 1 ") + .append("LEFT JOIN BOLETO B ON B.BOLETO_ID = EE.BOLETO_ID ") + .append("LEFT JOIN PARADA ORI ON ORI.PARADA_ID = B.ORIGEN_ID ") + .append("LEFT JOIN CIUDAD CID ON CID.CIUDAD_ID = ORI.CIUDAD_ID ") + .append("LEFT JOIN ESTADO EST ON EST.ESTADO_ID = CID.ESTADO_ID ") + .append("LEFT JOIN MARCA M ON B.MARCA_ID = M.MARCA_ID ") + .append("LEFT JOIN EMPRESA E ON E.EMPRESA_ID = M.EMPRESA_ID ") + .append("LEFT JOIN EMPRESA_IMPOSTO EI ON (EI.ESTADO_ID = EST.ESTADO_ID AND EI.EMPRESA_ID = E.EMPRESA_ID AND EI.ACTIVO = 1) ") + .append("WHERE EE.ACTIVO = 1 ") + .append("AND CD.FECCORTE BETWEEN TO_DATE(:dataInicial, 'DD/MM/YYYY') AND TO_DATE(:dataFinal, 'DD/MM/YYYY') "); + + if (parametros.containsKey("empresaId")) { + sQuery.append("AND EE.EMPRESA_ID = :empresaId "); + } + if (parametros.containsKey("puntoventaId")) { + sQuery.append("AND CD.PUNTOVENTA_ID = :puntoventaId "); + } + sQuery.append("ORDER BY TEE.DESCTIPOEVENTO "); + + con = getConnection(); + npst = new NamedParameterStatement(con, sQuery.toString()); + setParametros(npst, parametros); + rSet = npst.executeQuery(); + + List result = new ArrayList(); + while(rSet.next()) { + EventosFinanceirosVO eventosFinanceiros = new EventosFinanceirosVO(rSet.getLong("eventoextraId"), rSet.getLong("logconferenciaId") > 0 ? rSet.getLong("logconferenciaId") : 0); + eventosFinanceiros.setBoletoId(rSet.getLong("boletoId") > 0 ? rSet.getLong("boletoId") : null); + eventosFinanceiros.setNumdocumento(rSet.getString("numdocumento")); + eventosFinanceiros.setImpingreso(rSet.getBigDecimal("impingreso")); + eventosFinanceiros.setDesctipoevento(rSet.getString("desctipoevento")); + eventosFinanceiros.setDescinfo(rSet.getString("descinfo")); + eventosFinanceiros.setStatus(rSet.getInt("status") >= 0 ? rSet.getInt("status") : null); + eventosFinanceiros.setFormapagoId(rSet.getInt("formapagoId") > 0 ? rSet.getInt("formapagoId") : null); + eventosFinanceiros.setDescpago(rSet.getString("descpago")); + eventosFinanceiros.setComempformapagoId(rSet.getInt("comempformapagoId") > 0 ? rSet.getInt("comempformapagoId") : null); + eventosFinanceiros.setComemptipoeventoextraId(rSet.getInt("comemptipoeventoextraId") > 0 ? rSet.getInt("comemptipoeventoextraId") : null); + eventosFinanceiros.setTipoeventoextradebcred(rSet.getInt("tipoeventoextradebcred") > 0 ? rSet.getInt("tipoeventoextradebcred") : null); + eventosFinanceiros.setIndtipo(rSet.getString("indtipo")); + eventosFinanceiros.setNombusuario(rSet.getString("nombusuario")); + eventosFinanceiros.setExigeConferenciaAba(rSet.getBoolean("exigeConferenciaAba")); + eventosFinanceiros.setNumFolioSistema(rSet.getString("numFolioSistema")); + eventosFinanceiros.setCvetipoevento(rSet.getString("cvetipoevento")); + eventosFinanceiros.setFeccorte(rSet.getDate("feccorte")); + eventosFinanceiros.setIcmsBase(rSet.getBigDecimal("icmsBase")); + eventosFinanceiros.setEstadoId(rSet.getInt("estadoId") > 0 ? rSet.getInt("estadoId") : null); + eventosFinanceiros.setCajaDiversosId(rSet.getLong("cajaDiversosId")); + eventosFinanceiros.setUsuarioId(rSet.getInt("usuarioId")); + eventosFinanceiros.setTurnoId(rSet.getInt("turnoId")); + + eventosFinanceiros.setConferencia(conferencia); + if (!result.contains(eventosFinanceiros)) { + result.add(eventosFinanceiros); + } + + } + + return result; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } finally { + try { + if(rSet != null && !rSet.isClosed()) { + rSet.close(); + } + if(npst != null && !npst.isClosed()) { + npst.close(); + } + if(con != null && !con.isClosed()) { + con.close(); + } + } catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + } + + @Override + @SuppressWarnings("unchecked") + public List carregarLogConferencia(Conferencia conferencia) + throws BusinessException { + try { + if (conferencia != null && conferencia.getConferenciaId() != null) { + StringBuilder sQuery = new StringBuilder() + .append("SELECT LOG.LOGCONFERENCIA_ID AS \"logconferenciaId\", LOG.OBSERVACAO AS \"observacao\", LOG.PRECO AS \"preco\", ") + .append("LOG.STATUS AS \"status\", NVL(B.NUMFOLIOSISTEMA,C.NUMFOLIOSISTEMA) AS \"numfoliosistema\", LOG.TIPO AS \"tipo\", ") + .append("O.NUMOPERACION AS \"numoperacion\", TEE.DESCTIPOEVENTO AS \"desctipoevento\", U.NOMBUSUARIO AS \"nombusuario\", ") + .append("LOG.FECMODIF AS \"fecmodif\", LOG.INDCREDITO AS \"indcredito\", B.BOLETO_ID AS \"boletoId\", O.OCD_ID AS \"ocdId\", ") + .append("EE.EVENTOEXTRA_ID AS \"eventoextraId\", TI.DESCTIPO AS \"desctipoinformativo\", LOG.CONFERENCIAPENDENCIA_ID as \"pendenciaId\", ") + .append("CP.DESCPENDENCIA AS \"descpendencia\", LOG.INDMESMODIA AS \"descComportamentoData\", C.CAJA_ID AS \"cajaId\" ") + .append("FROM LOG_CONFERENCIA LOG ") + .append("LEFT JOIN BOLETO B ON B.BOLETO_ID = LOG.BOLETO_ID ") + .append("LEFT JOIN CAJA C ON C.CAJA_ID = LOG.CAJA_ID ") + .append("LEFT JOIN EVENTO_EXTRA EE ON EE.EVENTOEXTRA_ID = LOG.EVENTOEXTRA_ID ") + .append("LEFT JOIN TIPO_EVENTO_EXTRA TEE ON TEE.TIPOEVENTOEXTRA_ID = EE.TIPOEVENTOEXTRA_ID ") + .append("LEFT JOIN OCD O ON O.OCD_ID = LOG.OCD_ID ") + .append("LEFT JOIN TIPO_INFORMATIVO TI ON TI.TIPOINFORMATIVO_ID = LOG.TIPOINFORMATIVOCOMISSAO_ID ") + .append("LEFT JOIN CONFERENCIA_PENDENCIA CP ON CP.CONFERENCIAPENDENCIA_ID = LOG.CONFERENCIAPENDENCIA_ID ") + .append("JOIN USUARIO U ON U.USUARIO_ID = LOG.USUARIO_ID ") + .append("WHERE LOG.ACTIVO = 1 ") + .append("AND LOG.CONFERENCIA_ID = :conferenciaId ORDER BY LOGCONFERENCIA_ID"); + + @SuppressWarnings("deprecation") + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("logconferenciaId", Hibernate.LONG) + .addScalar("observacao", Hibernate.STRING) + .addScalar("preco", Hibernate.BIG_DECIMAL) + .addScalar("descComportamentoData", Hibernate.STRING) + .addScalar("status", Hibernate.INTEGER) + .addScalar("numfoliosistema", Hibernate.STRING) + .addScalar("tipo", Hibernate.INTEGER) + .addScalar("numoperacion", Hibernate.STRING) + .addScalar("desctipoevento", Hibernate.STRING) + .addScalar("nombusuario", Hibernate.STRING) + .addScalar("fecmodif", Hibernate.TIMESTAMP) + .addScalar("indcredito", Hibernate.SHORT) + .addScalar("boletoId", Hibernate.LONG) + .addScalar("ocdId", Hibernate.LONG) + .addScalar("eventoextraId", Hibernate.LONG) + .addScalar("desctipoinformativo", Hibernate.STRING) + .addScalar("descpendencia", Hibernate.STRING) + .addScalar("cajaId", Hibernate.LONG) + .addScalar("pendenciaId", Hibernate.INTEGER) + .setResultTransformer(Transformers.aliasToBean(LogConferenciaVO.class)); + qr.setParameter("conferenciaId", conferencia.getConferenciaId()); + + List result = qr.list(); + + for (LogConferenciaVO l : result) { + l.setConferencia(conferencia); + } + + return result; + } + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + + return new ArrayList(); + } + + @Override + @Transactional + public LogConferencia suscribirLogConferencia(LogConferencia logConferencia) + throws BusinessException { + try { + logConferencia.setActivo(Boolean.TRUE); + logConferencia.setUsuario(UsuarioLogado.getUsuarioLogado()); + logConferencia.setFecmodif(new Date()); + + if (logConferencia.getConferencia().getConferenciaId() == null) { + logConferencia.setConferencia(suscribir(logConferencia.getConferencia())); + } + + getSession().save(logConferencia); + return logConferencia; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + @Transactional + public void borrarLogConferencia(LogConferencia logConferencia) throws BusinessException { + try { + if(logConferencia == null) { + return; + } + + if (logConferencia.getContaCorrentePtoVta() != null) { + ContaCorrentePtoVta contaCorrentePtoVta = logConferencia.getContaCorrentePtoVta(); + contaCorrentePtoVta.setActivo(Boolean.FALSE); + contaCorrentePtoVta.setFecmodif(logConferencia.getFecmodif()); + contaCorrentePtoVta.setUsuario(logConferencia.getUsuario()); + + contaCorrenteAgenciaDAO.actualizacion(contaCorrentePtoVta); + } + + logConferencia.setActivo(Boolean.FALSE); + logConferencia.setUsuario(UsuarioLogado.getUsuarioLogado()); + logConferencia.setFecmodif(new Date()); + + getSession().merge(logConferencia); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public LogConferencia obtenerLogConferenciaID(Long logconferenciaId) { + try { + return (LogConferencia) this.getHibernateTemplate().get(LogConferencia.class.getName(), logconferenciaId); + } catch (final HibernateException ex) { + throw convertHibernateAccessException(ex); + } + } + + @Override + public List carregarBilhetesComissao(Conferencia conferencia, boolean isCalculoComissao, boolean isConsideraBilhetesDevolvidosEmOutraAgencia) + throws BusinessException { + + Connection con = null; + NamedParameterStatement npst = null; + ResultSet rSet = null; + + try { + Map parametros = carregarParametros(conferencia.getDataInicial(), conferencia.getDataFinal(), conferencia.getCompetencia(), conferencia.getEmpresa(), + conferencia.getPuntoVenta(), conferencia.getDatamovimento(), true); + + StringBuilder sQuery = new StringBuilder() + .append("SELECT DISTINCT C.CAJA_ID AS \"cajaId\", C.NUMASIENTO AS \"numAsiento\", C.NUMASIENTOVINCULADO AS \"numAsientoVinculado\", C.NUMOPERACION AS \"numoperacion\", C.NUMFOLIOSISTEMA AS \"numFolioSistema\", ") + .append("C.NUMSERIEPREIMPRESA AS \"numSeriePreimpresa\", C.NUMFOLIOPREIMPRESO AS \"numFolioPreImpreso\", EST.CVEESTADO AS \"uf\", CAT.DESCCATEGORIA AS \"desccategoria\", ") + .append("NVL(C.PRECIOBASE,0) AS \"valorbase\", NVL(C.PRECIOPAGADO,0) AS \"valorpagado\", NVL(C.IMPORTEOUTROS,0) AS \"seguroOutros\", NVL(C.IMPORTEPEDAGIO,0) AS \"pedagio\", NVL(C.IMPORTESEGURO,0) AS \"seguro\", ") + .append("NVL(C.IMPORTETAXAEMBARQUE,0) AS \"embarque\", C.TIPOVENTA_ID AS \"tipoVenta\", C.INDSTATUSBOLETO AS \"indstatusboleto\", NVL(LOG.STATUS,-1) AS \"status\", FP.FORMAPAGO_ID AS \"formapagoId\", ") + .append("FP.DESCPAGO AS \"descpago\", LOG.LOGCONFERENCIA_ID AS \"logconferenciaId\", MC.DESCMOTIVO AS \"descmotivocancelacion\", U.NOMBUSUARIO AS \"nombusuario\", C.MOTIVOCANCELACION_ID AS \"motivocancelacionId\", ") + .append("CF.IMPORTE AS \"importeFp\", COMFP.COMEMPFORMAPAGO_ID AS \"comempformapagoId\", ") + .append("(select max(COMEMPCATEGORIA_ID) from COM_EMP_CATEGORIA where CATEGORIA_ID = C.CATEGORIA_ID AND EMPRESA_ID = M.EMPRESA_ID AND ACTIVO = 1) AS \"comempcategoriaId\", C.NOMBPASAJERO AS \"nombpasajero\", ") + .append("E.INDCARBOLETOSDEVOLVIDOSCONF AS \"indcarboletosdevolvidosconf\", C.FECCORRIDA AS \"feccorrida\", C.CORRIDA_ID \"corridaId\", ") + .append("case when t.tarifa_id is not null then nvl(t.precio, 0) + nvl(t.importepedagio, 0) + nvl(t.importetaxaembarque, 0) + nvl(t.importeseguro, 0) + nvl ") + .append("(t.importeoutros, 0) else nvl(c.preciobase,0) + nvl(c.importepedagio, 0) + nvl(c.importetaxaembarque, 0) + nvl(c.importeseguro, 0) + nvl ") + .append("(c.importeoutros, 0) end AS \"valorTabela\"," ) + .append("C.INDCANCELACION AS \"indCancelacion\", C.INDREIMPRESION AS \"indreimpresion\", C.FECCORTE AS \"feccorte\", C.TRANSACAOORIGINAL_ID AS \"transacaoOriginalId\", ") + .append("EI.ICMS as \"icmsBase\", EST.ESTADO_ID as \"estadoId\", ") + .append("CASE WHEN C.PTOVTAVENTA_ID = :puntoventaId OR C.PTOVTAVENTA_ID IS NULL THEN 1 ELSE 0 END AS ptoVtaOrigem, ") + .append("M.EMPRESA_ID AS empresaId, C.TRANSACAO_ID AS \"transacaoId\", ") + .append("CASE WHEN LOG.CONFERENCIA_ID IS NOT NULL OR ") + .append(" (C.INDSTATUSBOLETO = 'E' ") + .append(" AND LOG.LOGCONFERENCIA_ID IS NULL ") + .append(" AND (SELECT LC.LOGCONFERENCIA_ID FROM LOG_CONFERENCIA LC ") + .append(" WHERE LC.ACTIVO = 1 ") + .append(" AND LC.TRANSACAOORIGINAL_ID = C.TRANSACAOORIGINAL_ID ") + .append(" AND LC.LOGCONFERENCIA_ID <> LOG.LOGCONFERENCIA_ID) IS NOT NULL) ") + .append(" THEN 1 ELSE 0 END AS \"conferidoEntrega\", ") + .append("C.PTOVTAVENTA_ID AS ptovtaventaId, ") + .append("C.PUNTOVENTA_ID AS puntoventaId ") + .append(", CF.cajaformapago_id, U.USUARIO_ID usuarioId, C.TURNO_ID as turnoId ") //Mantis 17018 + .append("FROM CAJA C ") + .append("LEFT JOIN PARADA ORI ON ORI.PARADA_ID = C.ORIGEN_ID ") + .append("LEFT JOIN CIUDAD CID ON CID.CIUDAD_ID = ORI.CIUDAD_ID ") + .append("LEFT JOIN ESTADO EST ON EST.ESTADO_ID = CID.ESTADO_ID ") + .append("LEFT JOIN CATEGORIA CAT ON CAT.CATEGORIA_ID = C.CATEGORIA_ID ") + .append("LEFT JOIN CORRIDA_TRAMO CT ON CT.CORRIDA_ID = C.CORRIDA_ID AND CT.FECCORRIDA = C.FECCORRIDA AND CT.ORIGEN_ID = C.ORIGEN_ID AND CT.DESTINO_ID = C.DESTINO_ID ") + .append("LEFT JOIN LOG_CONFERENCIA LOG ON LOG.CAJA_ID = C.CAJA_ID AND LOG.ACTIVO = 1 ") + .append("LEFT JOIN MOTIVO_CANCELACION MC ON MC.MOTIVOCANCELACION_ID = C.MOTIVOCANCELACION_ID ") + .append("INNER JOIN CAJA_FORMAPAGO CF ON CF.CAJA_ID = C.CAJA_ID ") + .append("INNER JOIN FORMA_PAGO FP ON FP.FORMAPAGO_ID = CF.FORMAPAGO_ID ") + .append("INNER JOIN USUARIO U ON C.USUARIO_ID = U.USUARIO_ID ") + .append("INNER JOIN MARCA M ON C.MARCA_ID = M.MARCA_ID ") + .append("INNER JOIN EMPRESA E ON E.EMPRESA_ID = M.EMPRESA_ID ") + .append("LEFT JOIN EMPRESA_IMPOSTO EI ON (EI.ESTADO_ID = EST.ESTADO_ID AND EI.EMPRESA_ID = E.EMPRESA_ID AND EI.ACTIVO = 1) ") + .append("LEFT JOIN COM_EMP_FORMAPAGO COMFP ON COMFP.FORMAPAGO_ID = FP.FORMAPAGO_ID AND COMFP.EMPRESA_ID = M.EMPRESA_ID AND COMFP.ACTIVO = 1 ") + .append("LEFT JOIN TARIFA T ON (T.DESTINO_ID = C.DESTINO_ID AND T.CLASESERVICIO_ID = C.CLASESERVICIO_ID AND T.MARCA_ID = M.MARCA_ID AND T.ORIGEN_ID = C.ORIGEN_ID AND T.RUTA_ID = C.RUTA_ID and T.ACTIVO = 1 and (ct.tramo_id = t.tramo_id)) ") + .append("LEFT JOIN VIGENCIA_TARIFA VT ON (VT.VIGENCIATARIFA_ID = T.VIGENCIATARIFA_ID ) ") + .append("WHERE C.ACTIVO = 1 AND (T.TARIFA_ID IS NULL OR (T.TARIFA_ID IS NOT NULL AND C.FECHORVENTA BETWEEN VT.FECINICIOVIGENCIA AND VT.FECFINVIGENCIA)) ") + .append("AND C.FECCORTE BETWEEN TO_DATE(:dataInicial, 'DD/MM/YYYY') AND TO_DATE(:dataFinal, 'DD/MM/YYYY') ") + .append("AND ((C.INDSTATUSBOLETO = 'E' AND C.INDREIMPRESION = 1) OR C.INDREIMPRESION = 0 OR C.MOTIVOCANCELACION_ID = :motivoCancelacionGeracaoOcd) "); + parametros.put("motivoCancelacionGeracaoOcd", Constantes.MVO_CANCEL_GERACAO_OCD.intValue()); + + if (parametros.containsKey("empresaId")) { + sQuery.append("AND M.EMPRESA_ID = :empresaId "); + } + + if (parametros.containsKey("puntoventaId")) { + if (isCalculoComissao && isConsideraBilhetesDevolvidosEmOutraAgencia){ + String sMotivosCancelacion = Arrays.asList( + Constantes.MVO_CANCEL_DEVOLUCAO.intValue(), + Constantes.MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_100.intValue(), + Constantes.MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_50.intValue(), + Constantes.MVO_CANCEL_CANCELACION.intValue(), + Constantes.MVO_CANCEL_GERACAO_OCD.intValue(), + Constantes.MVO_CANCEL_TROCA.intValue(), + Constantes.MVO_CANCEL_TRANSFERENCIA.intValue() + ).toString().replaceAll("[\\[\\]]", ""); + + sQuery.append("AND ( ") + /* Filtra pela agencias, com a operação feita na agencia ou que tenha origem na agencia de filtro */ + .append(" ( ") + .append(" ((C.PUNTOVENTA_ID = :puntoventaId AND C.PTOVTAVENTA_ID IS NULL) OR C.PTOVTAVENTA_ID = :puntoventaId) ") + .append(" AND ") + /* Filtro os não cancelados e os cancelados conforme lista de motivos de cancelamentos aceitos */ + .append(" ( ") + .append(" C.MOTIVOCANCELACION_ID IS NULL ") + .append(" OR ") + .append(" C.MOTIVOCANCELACION_ID IN (").append(sMotivosCancelacion).append(") ") + .append(" ) ") + .append(" ) ") + /* Carrega os bilhetes entregues na agencia */ + .append(" OR ") + .append(" (C.PUNTOVENTA_ID = :puntoventaId AND C.INDSTATUSBOLETO = 'E' AND C.MOTIVOCANCELACION_ID IS NULL) ") + .append(" ) "); + }else{ + sQuery.append("AND C.PUNTOVENTA_ID = :puntoventaId "); + } + } + if (StringUtils.isNotBlank(conferencia.getNumfoliosistema())) { + sQuery.append("AND C.NUMFOLIOSISTEMA = :numfoliosistema "); + parametros.put("numfoliosistema", conferencia.getNumfoliosistema()); + } + sQuery.append("ORDER BY C.INDSTATUSBOLETO, C.MOTIVOCANCELACION_ID, C.CAJA_ID "); + + con = getConnection(); + npst = new NamedParameterStatement(con, sQuery.toString()); + setParametros(npst, parametros); + npst.setFetchSize(100); + rSet = npst.executeQuery(); + + List lsBoletoComissao = new ArrayList(); + while(rSet.next()) { + BoletoComissao boletoComissao = new BoletoComissao(); + boletoComissao.setCajaId(rSet.getLong("cajaId")); + boletoComissao.setTransacaoOriginalId(rSet.getLong("transacaoOriginalId") > 0 ? rSet.getLong("transacaoOriginalId") : null ); + boletoComissao.setNumAsiento(rSet.getString("numAsiento")); + boletoComissao.setNumAsientoVinculado(rSet.getString("numAsientoVinculado")); + boletoComissao.setNumFolioSistema(rSet.getString("numFolioSistema")); + boletoComissao.setNumSeriePreimpresa(rSet.getString("numSeriePreimpresa")); + boletoComissao.setNumFolioPreImpreso(rSet.getString("numFolioPreImpreso")); + boletoComissao.setUf(rSet.getString("uf")); + boletoComissao.setDesccategoria(rSet.getString("desccategoria")); + boletoComissao.setValorpagado(rSet.getBigDecimal("valorpagado")); + boletoComissao.setValorTabela(rSet.getBigDecimal("valorTabela")); + boletoComissao.setSeguroOutros(rSet.getBigDecimal("seguroOutros")); + boletoComissao.setPedagio(rSet.getBigDecimal("pedagio")); + boletoComissao.setEmbarque(rSet.getBigDecimal("embarque")); + boletoComissao.setSeguro(rSet.getBigDecimal("seguro")); + boletoComissao.setTipoVenta(rSet.getInt("tipoVenta")); + boletoComissao.setIndstatusboleto(rSet.getString("indstatusboleto")); + boletoComissao.setStatus(rSet.getInt("status") >= 0 ? rSet.getInt("status") : null); + boletoComissao.setFormapagoId(rSet.getInt("formapagoId") > 0 ? rSet.getInt("formapagoId") : null); + boletoComissao.setDescpago(rSet.getString("descpago")); + boletoComissao.setLogconferenciaId(rSet.getLong("logconferenciaId") > 0 ? rSet.getLong("logconferenciaId") : null); + boletoComissao.setDescmotivocancelacion(rSet.getString("descmotivocancelacion")); + boletoComissao.setNombusuario(rSet.getString("nombusuario")); + boletoComissao.setMotivoCancelacionId(rSet.getInt("motivoCancelacionId") > 0 ? rSet.getInt("motivoCancelacionId") : null); + boletoComissao.setImporteFp(rSet.getBigDecimal("importeFp")); + boletoComissao.setComempformapagoId(rSet.getInt("comempformapagoId") > 0 ? rSet.getInt("comempformapagoId") : null); + boletoComissao.setComempcategoriaId(rSet.getInt("comempcategoriaId") > 0 ? rSet.getInt("comempcategoriaId") : null); + boletoComissao.setNumoperacion(rSet.getString("numoperacion")); + boletoComissao.setNombpasajero(rSet.getString("nombpasajero")); + boletoComissao.setIndcarboletosdevolvidosconf(rSet.getBoolean("indcarboletosdevolvidosconf")); + boletoComissao.setFeccorrida(rSet.getDate("feccorrida")); + boletoComissao.setCorridaId(rSet.getInt("corridaId") > 0 ? rSet.getInt("corridaId") : null); + boletoComissao.setIndCancelacion(rSet.getBoolean("indCancelacion")); + boletoComissao.setIndreimpresion(rSet.getBoolean("indreimpresion")); + boletoComissao.setFeccorte(rSet.getDate("feccorte")); + boletoComissao.setIcmsBase(rSet.getBigDecimal("icmsBase")); + boletoComissao.setEstadoId(rSet.getInt("estadoId") > 0 ? rSet.getInt("estadoId") : null); + boletoComissao.setPtoVtaOrigem(rSet.getBoolean("ptoVtaOrigem")); + boletoComissao.setValorbase(rSet.getBigDecimal("valorbase")); + boletoComissao.setEmpresaId(rSet.getInt("empresaId")); + boletoComissao.setTransacaoId(rSet.getLong("transacaoId") > 0 ? rSet.getLong("transacaoId") : null); + boletoComissao.setPtovtaventaId(rSet.getInt("ptovtaventaId")); + boletoComissao.setPuntoVentaId(rSet.getInt("puntoventaId")); + boletoComissao.setConferidoEntrega(rSet.getBoolean("conferidoEntrega")); + boletoComissao.setUsuarioId(rSet.getInt("usuarioId")); + boletoComissao.setTurnoId(rSet.getInt("turnoId")); + + if(boletoComissao.getStatus() == null && boletoComissao.getConferidoEntrega() != null && boletoComissao.getConferidoEntrega()) { + boletoComissao.setConferido(true); + boletoComissao.setStatus(StatusLogConferencia.CONFERIDO.getValue()); + } + + if (boletoComissao.getFormapagos() == null) { + boletoComissao.setFormapagos(new ArrayList()); + boletoComissao.setConferencia(conferencia); + } + if(boletoComissao.getImporteFp() == null){ + boletoComissao.setImporteFp(BigDecimal.ZERO); + } + + if (lsBoletoComissao.contains(boletoComissao)) { + int indice = lsBoletoComissao.indexOf(boletoComissao); + BoletoComissao aux = lsBoletoComissao.get(indice); + aux.setComempcategoriaId(boletoComissao.getComempcategoriaId() != null + ? boletoComissao.getComempcategoriaId() : aux.getComempcategoriaId()); + aux.setComempformapagoId(boletoComissao.getComempformapagoId() != null + ? boletoComissao.getComempformapagoId() : aux.getComempformapagoId()); + + FormapagoVO formapagoVO = new FormapagoVO(boletoComissao.getFormapagoId(), + boletoComissao.getDescpago(), + boletoComissao.getIndconferenciafisicacomissao(), + boletoComissao.getImporteFp()); + + if (aux.getFormapagos().contains(formapagoVO)) { + formapagoVO = aux.getFormapagos().get(aux.getFormapagos().indexOf(formapagoVO)); + formapagoVO.add(boletoComissao.getImporteFp()); + } else { + aux.getFormapagos().add(formapagoVO); + } + lsBoletoComissao.set(indice, aux); + } else { + boletoComissao.getFormapagos().add(new FormapagoVO(boletoComissao.getFormapagoId(), + boletoComissao.getDescpago(), + boletoComissao.getIndconferenciafisicacomissao(), + boletoComissao.getImporteFp())); + lsBoletoComissao.add(boletoComissao); + } + } + + return lsBoletoComissao; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } finally { + try { + if(rSet != null && !rSet.isClosed()) { + rSet.close(); + } + if(npst != null && !npst.isClosed()) { + npst.close(); + } + if(con != null && !con.isClosed()) { + con.close(); + } + } catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + } + + @Override + public List carregarOcds(Conferencia conferencia) throws BusinessException { + + Connection con = null; + NamedParameterStatement npst = null; + ResultSet rSet = null; + + try { + Map parametros = carregarParametros(null, null, null, conferencia.getEmpresa(), + conferencia.getPuntoVenta(), conferencia.getDatamovimento(), false); + + StringBuilder sQuery = new StringBuilder() + .append("SELECT DISTINCT O.OCD_ID AS \"ocdId\", O.NUMOPERACION AS \"numoperacion\", O.FECINC AS \"fecinc\", O.FECPAGAR AS \"fecpagar\", O.FECPAGO AS \"fecpago\", ") + .append("O.INDPAGO AS \"indpago\", O.VALOR_PAGAR AS \"valorPagar\", (B.PRECIOPAGADO * (O.PENALIZACION / 100)) AS \"penalizacion\", NVL(LOG.STATUS,-1) AS \"status\", ") + .append("U.NOMBUSUARIO AS \"nombusuario\", LOG.LOGCONFERENCIA_ID AS \"logconferenciaId\", U.CVEUSUARIO AS \"login\", B.NUMFOLIOSISTEMA AS \"numFolioSistema\", ") + .append("CEC.INDOCD AS \"exigeConferenciaAba\" ") + .append("FROM OCD O ") + .append("INNER JOIN BOLETO B ON B.BOLETO_ID = O.BOLETO_ID ") + .append("INNER JOIN MARCA M ON B.MARCA_ID = M.MARCA_ID ") + .append("LEFT JOIN LOG_CONFERENCIA LOG ON LOG.OCD_ID = O.OCD_ID AND LOG.ACTIVO = 1 ") + .append("INNER JOIN USUARIO U ON O.USUARIOPAGO_ID = U.USUARIO_ID ") + .append("LEFT JOIN COM_EMP_CONFERENCIA CEC ON CEC.EMPRESA_ID = M.EMPRESA_ID AND CEC.ACTIVO = 1 ") + .append("INNER JOIN MARCA ON m.MARCA_ID = b.MARCA_ID ") + .append("WHERE O.ACTIVO = 1 ") + .append("AND O.FECPAGO BETWEEN TO_DATE(:dataInicial, 'DD/MM/YYYY HH24:MI') AND TO_DATE(:dataFinal, 'DD/MM/YYYY HH24:MI') ") + .append("AND O.INDPAGO = 1 "); + + if (parametros.containsKey("empresaId")) { + sQuery.append("AND ((B.EMPRESACORRIDA_ID IS NOT NULL AND B.EMPRESACORRIDA_ID = :empresaId) OR(m.EMPRESA_ID = :empresaId)) "); + } + if (parametros.containsKey("puntoventaId")) { + sQuery.append("AND O.PUNTOVENTAPAGO_ID = :puntoventaId "); + } + + con = getConnection(); + npst = new NamedParameterStatement(con, sQuery.toString()); + setParametros(npst, parametros); + rSet = npst.executeQuery(); + + List result = new ArrayList(); + while(rSet.next()) { + OcdVO ocd = new OcdVO(); + ocd.setOcdId(rSet.getLong("ocdId")); + ocd.setNumoperacion(rSet.getString("numoperacion")); + ocd.setFecinc(rSet.getDate("fecinc")); + ocd.setFecpagar(rSet.getDate("fecpagar")); + ocd.setFecpago(rSet.getDate("fecpago")); + ocd.setIndpago(rSet.getBoolean("indpago")); + ocd.setValorPagar(rSet.getBigDecimal("valorPagar")); + ocd.setPenalizacion(rSet.getBigDecimal("penalizacion")); + ocd.setStatus(rSet.getInt("status") >= 0 ? rSet.getInt("status") : null); + ocd.setLogconferenciaId(rSet.getLong("logconferenciaId") > 0 ? rSet.getLong("logconferenciaId") : null); + ocd.setLogin(rSet.getString("login")); + ocd.setNombusuario(rSet.getString("nombusuario")); + ocd.setNumFolioSistema(rSet.getString("numFolioSistema")); + ocd.setExigeConferenciaAba(rSet.getBoolean("exigeConferenciaAba")); + ocd.setConferencia(conferencia); + + result.add(ocd); + } + + return result; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } finally { + try { + if(rSet != null && !rSet.isClosed()) { + rSet.close(); + } + if(npst != null && !npst.isClosed()) { + npst.close(); + } + if(con != null && !con.isClosed()) { + con.close(); + } + } catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + } + + @Override + public Conferencia obtenerConferenciaDataMovimento(Date datamovimento, Integer puntoventaId, + Integer empresaId) throws BusinessException { + try { + StringBuilder sQuery = new StringBuilder() + .append("SELECT co ").append("FROM Conferencia co ") + .append("WHERE co.activo = 1 ").append("AND co.datamovimento = :datamovimento ") + .append("AND co.empresa.empresaId = :empresaId ") + .append("AND co.puntoVenta.puntoventaId = :puntoventaId "); + + Query qr = getSession().createQuery(sQuery.toString()); + qr.setParameter("datamovimento", datamovimento); + qr.setParameter("empresaId", empresaId); + qr.setParameter("puntoventaId", puntoventaId); + qr.setMaxResults(1); + return (Conferencia) qr.uniqueResult(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Transactional + private void gerarLancamentoContaCorrente(Conferencia conferencia) throws BusinessException { + try { + + Calendar calHoje = Calendar.getInstance(); + Calendar calAmanha = Calendar.getInstance(); + + calAmanha.add(Calendar.DAY_OF_MONTH, 1); + + List lsLogConferencia = carregarLogConferencia(conferencia.getConferenciaId()); + String sDataMovimento = DateUtil.getStringDate(conferencia.getDatamovimento(), "dd/MM/yyyy"); + String descOperacion = "CONFERENCIA MOVIMENTO DIA - " + sDataMovimento; + + for (LogConferencia logConferencia : lsLogConferencia) { + Calendar cal = calHoje; + + if (!Boolean.TRUE.equals(logConferencia.getIndmesmodia())) { + cal = calAmanha; + } + + if (logConferencia.getStatus().equals(StatusLogConferencia.CONFERIDO) + || ((logConferencia.getContaCorrentePtoVta() != null + && logConferencia.getContaCorrentePtoVta().getActivo() != null + && logConferencia.getContaCorrentePtoVta().getActivo())) + || (logConferencia.getPreco() == null + || logConferencia.getPreco().doubleValue() == 0d) + || logConferencia.isIndcredito().equals((short) 2)) { + continue; + } + + ContaCorrentePtoVta contaCorrentePtoVta = contaCorrenteAgenciaDAO + .gravarContaCorrente(conferencia.getPuntoVenta().getPuntoventaId(), + descOperacion, DateUtil.normalizarToFecha(cal.getTime()), logConferencia.getUsuario().getUsuarioId(), + logConferencia.isIndcredito().equals((short) 1) ? Constantes.TIPO_OPERACION_CC_PAGO : Constantes.TIPO_OPERACION_CC_LQ, + conferencia.getEmpresa().getEmpresaId(), + Constantes.TURNO_AUTOMATICO, BigDecimal.ZERO, BigDecimal.ZERO, + BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, + BigDecimal.ZERO, BigDecimal.ZERO, logConferencia.getPreco(), false, + BigDecimal.ZERO, BigDecimal.ZERO, logConferencia.getPreco()); + + logConferencia.setContaCorrentePtoVta(contaCorrentePtoVta); + suscribirLogConferencia(logConferencia); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + @SuppressWarnings("unchecked") + public List carregarLogConferencia(Long conferenciaId) throws BusinessException { + try { + StringBuilder sQuery = new StringBuilder() + .append("SELECT log ") + .append("FROM LogConferencia log ") + .append("WHERE log.activo = 1 ") + .append("AND log.conferencia.conferenciaId = :conferenciaId "); + Query qr = getSession().createQuery(sQuery.toString()); + qr.setParameter("conferenciaId", conferenciaId); + return qr.list(); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, + PuntoVenta puntoVenta, boolean isDesconsideraPtVendaFechados) throws BusinessException { + try { + List lsConferencias = new ArrayList(); + + carregarConferenciasRegistradas(lsConferencias, competencia, empresa, puntoVenta, null, null, null, null); + carregarDiasSemMovimento(lsConferencias, competencia, empresa, puntoVenta, null); + + for (ConferenciaComissaoVO conferenciaComissao : lsConferencias) { + for (DiaConferenciaComissaoVO diaConferenciaComissao : conferenciaComissao.getDias()) { + if (!diaConferenciaComissao.getIndsemmovimento() && !diaConferenciaComissao.getIndconferido()) { + return false; + } + } + } + + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public BigDecimal carregarValorDepositoContaCorrente(Integer empresaId, Integer puntoventaId, Date datamovimento) { + StringBuilder sQuery = new StringBuilder() + .append("SELECT SUM(importeTotalEfectivo) ").append("FROM ContaCorrentePtoVta cc ") + .append("WHERE cc.activo = 1 ").append("AND cc.empresa.empresaId = :empresaId ") + .append("AND cc.puntoVenta.puntoventaId = :puntoventaId ") + .append("AND cc.fecHorOperacion = :datamovimento "); + + Query qr = getSession().createQuery(sQuery.toString()); + qr.setParameter("empresaId", empresaId); + qr.setParameter("puntoventaId", puntoventaId); + qr.setParameter("datamovimento", datamovimento); + qr.setMaxResults(1); + + return (BigDecimal) qr.uniqueResult(); + } + + @Override + @SuppressWarnings("unchecked") + public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, + Empresa empresa, PuntoVenta puntoVenta) throws BusinessException { + try { + String competencia = DateUtil.getStringDate(datamovimento, "MM/yyyy"); + Map parametros = carregarParametros(null, null, competencia, empresa, puntoVenta, datamovimento, false); + StringBuilder sQuery = new StringBuilder("SELECT co FROM Conferencia co ") + .append("JOIN co.empresa em ").append("JOIN co.puntoVenta pv ") + .append("WHERE co.activo = 1 ") + .append("AND co.datamovimento BETWEEN TO_DATE(:dataInicial,'DD/MM/YYYY HH24:MI') AND TO_DATE(:dataFinal,'DD/MM/YYYY HH24:MI') "); + + if (parametros.containsKey("empresaId")) { + sQuery.append("AND em.empresaId = :empresaId "); + } + if (parametros.containsKey("puntoventaId")) { + sQuery.append("AND pv.puntoventaId = :puntoventaId "); + } + + Query qr = getSession().createQuery(sQuery.toString()); + setParametros(qr, parametros); + + List lsConferenciaComissao = new ArrayList(); + processarQueryConferencia(qr.list(), lsConferenciaComissao, competencia, datamovimento, null, null); + + if (!lsConferenciaComissao.isEmpty()) { + for (DiaConferenciaComissaoVO diaConferenciaComissao : lsConferenciaComissao + .iterator().next().getDiasOrdenado()) { + if (diaConferenciaComissao.getData().equals(datamovimento)) { + return diaConferenciaComissao; + } + } + } + + return null; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + /** + * Recupera a conexão conforme parametrização em application.properties + * + * @return + * @throws SQLException + */ + public Connection getConnection() throws SQLException { + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.IS_DATASOURCE_COMISSAO_BANCO_PRODUCAO.getDescricao())) { + return dataSource.getConnection(); + } else { + return dataSourceRead.getConnection(); + } + } + + @Override + public boolean isConferidoVenta(BoletoComissao boletoComissao) { + if(boletoComissao.getTransacaoOriginalId() == null ){ + return false; + } + + StringBuilder sql = new StringBuilder(); + + sql.append(" SELECT * FROM log_conferencia lc "); + sql.append(" WHERE lc.ACTIVO = 1 "); + sql.append(" AND lc.TRANSACAOORIGINAL_ID =:transacaoId "); + + Query qr = getSession().createSQLQuery(sql.toString()); + qr.setParameter("transacaoId", boletoComissao.getTransacaoOriginalId()); + + return !qr.list().isEmpty(); + + } + + @Override + @SuppressWarnings("unchecked") + @Transactional + public void borrarLogConferenciaTransacaoId(Long transacaoId) throws BusinessException { + try { + StringBuilder sql = new StringBuilder(); + + sql.append("SELECT log ") + .append("FROM LogConferencia log ") + .append("WHERE log.activo = 1 ") + .append("AND log.transacaoOriginalId =:transacaoId "); + + Query qr = getSession().createQuery(sql.toString()); + qr.setParameter("transacaoId", transacaoId); + + List logConferencias = qr.list(); + for (LogConferencia logConferencia : logConferencias) { + borrarLogConferencia(logConferencia); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public boolean isConferenciaCompetenciaEncerrada(Date dataInicial, Date dataFinal, Empresa empresa, PuntoVenta puntoVenta, boolean isDesconsideraPtVendaFechados) throws BusinessException { + try { + List lsConferencias = new ArrayList(); + + String competencia = DateUtil.getStringDate(dataInicial, "MM/yyyy"); + + carregarConferenciasRegistradas(lsConferencias, competencia, empresa, puntoVenta, null, dataInicial, dataFinal, null); + carregarDiasSemMovimento(lsConferencias, competencia, empresa, puntoVenta, null); + + for (ConferenciaComissaoVO conferenciaComissao : lsConferencias) { + for (DiaConferenciaComissaoVO diaConferenciaComissao : conferenciaComissao.getDias()) { + if (DateUtil.compareOnlyDate(diaConferenciaComissao.getData(), dataInicial) >= 0 && + DateUtil.compareOnlyDate(diaConferenciaComissao.getData(), dataFinal) <= 0 && + !diaConferenciaComissao.getIndsemmovimento() && !diaConferenciaComissao.getIndconferido()) { + return false; + } + } + } + + return true; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public boolean isConfMovFPTrocaVlrDeposito(Empresa empresa) { + if(empresa == null || empresa.getEmpresaId() == null) { + return false; + } + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT EMPRESA_ID ") + .append(" FROM EMPRESA ") + .append(" WHERE ACTIVO = 1 ") + .append(" AND INDCONFMOVFPTROCAVLRDEPOSITO = 1 ") + .append(" AND EMPRESA_ID = :empresaId "); + + Query qr = getSession().createSQLQuery(sql.toString()); + qr.setParameter("empresaId", empresa.getEmpresaId()); + + return !qr.list().isEmpty(); + } + + @Override + public BigDecimal getComissaoPuntoVenta(Integer puntoventaId, Integer empresaId, Date dataInicial, Date dataFinal) throws BusinessException { + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT SUM(importe) ") + .append(" FROM conta_corrente_ptovta ") + .append(" WHERE ACTIVO = 1 ") + .append(" AND EMPRESA_ID = :empresaId ") + .append(" AND PUNTOVENTA_ID = :puntoventaId ") + .append(" AND TIPOOPERACIONCC_ID = 5 ") + .append(" AND feccorte BETWEEN to_date(:dataInicial, 'DD/MM/YYYY') AND to_date(:dataFinal, 'DD/MM/YYYY') "); + + + Query qr = getSession().createSQLQuery(sql.toString()); + qr.setParameter("empresaId", empresaId); + qr.setParameter("puntoventaId", puntoventaId); + qr.setParameter("dataInicial", DateUtil.getStringDate(DateUtil.inicioFecha(dataInicial), "dd/MM/yyyy")); + qr.setParameter("dataFinal", DateUtil.getStringDate(DateUtil.inicioFecha(dataFinal), "dd/MM/yyyy")); + + return (BigDecimal) qr.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaPendenciaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaPendenciaHibernateDAO.java new file mode 100644 index 000000000..d1b7e203a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaPendenciaHibernateDAO.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConferenciaPendenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ConferenciaPendencia; + +/** + * + * @author Wilian + */ +@Repository("conferenciaPendenteDAO") +public class ConferenciaPendenciaHibernateDAO extends GenericHibernateDAO + implements ConferenciaPendenciaDAO { + + @Autowired + public ConferenciaPendenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfigRestriccionPagoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfigRestriccionPagoHibernateDAO.java new file mode 100644 index 000000000..ee6042804 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfigRestriccionPagoHibernateDAO.java @@ -0,0 +1,84 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConfigRestriccionPagoDAO; +import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; + +/** + * + * @author Administrador + */ +@Repository("configRestriccionPagoDAO") +public class ConfigRestriccionPagoHibernateDAO + extends GenericHibernateDAO + implements ConfigRestriccionPagoDAO { + + @Autowired + public ConfigRestriccionPagoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(FormaPago formaPago, + RestriccionPago restriccionPago, Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("restriccion", restriccionPago)); + c.add(Restrictions.eq("formaPago", formaPago)); + + Criterion empresaNull = Restrictions.isNull("empresa"); + Criterion empresaMenosUm = Restrictions.eq("empresa", new Empresa(-1)); + + if(empresa != null) { + Criterion empresaIgual = Restrictions.eq("empresa", empresa); + c.add(Restrictions.or(Restrictions.or(empresaNull, empresaMenosUm), empresaIgual)); + } else { + c.add(Restrictions.or(empresaNull, empresaMenosUm)); + } + + return c.list(); + } + + public Map buscar(FormaPago formaPago) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("formaPago", formaPago)); + + Map mapRespuesta = new LinkedHashMap(); + + List list = c.list(); + if (!list.isEmpty()) { + for (ConfigRestriccionPago crp : list) { + mapRespuesta.put(crp.getRestriccion().getRestriccionId().intValue(), crp); + } + } + + return mapRespuesta; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConstanteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConstanteHibernateDAO.java new file mode 100644 index 000000000..cd48e1c1c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConstanteHibernateDAO.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConstanteDAO; +import com.rjconsultores.ventaboletos.entidad.Constante; + +/** + * + * @author Administrador + */ +@Repository("constanteDAO") +@SuppressWarnings("unchecked") +public class ConstanteHibernateDAO extends GenericHibernateDAO + implements ConstanteDAO { + + @Autowired + public ConstanteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombconstante")); + + return c.list(); + } + + public Constante buscarPorNomeConstante(String nomeConstante) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("nombconstante", nomeConstante)); + + return (Constante) c.uniqueResult(); + } + + public List buscar(String nombconstante) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("nombconstante", nombconstante)); + + return c.list(); + } + + public List buscarPorNomeConstanteLike(String nombconstante) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.ilike("nombconstante", "%" + nombconstante + "%")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ContaCorrenteAgenciaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ContaCorrenteAgenciaHibernateDAO.java new file mode 100644 index 000000000..a37bb11e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ContaCorrenteAgenciaHibernateDAO.java @@ -0,0 +1,76 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.Date; + +import org.apache.log4j.Logger; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ContaCorrenteAgenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ContaCorrentePtoVta; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoOperacionCC; +import com.rjconsultores.ventaboletos.entidad.Turno; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +@Repository("contaCorrenteAgenciaDAO") +public class ContaCorrenteAgenciaHibernateDAO extends GenericHibernateDAO implements ContaCorrenteAgenciaDAO { + + private static Logger log = Logger.getLogger(ContaCorrenteAgenciaHibernateDAO.class); + + @Autowired + public ContaCorrenteAgenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @Transactional + public ContaCorrentePtoVta gravarContaCorrente(Integer puntoVentaId, String descOperacion, Date fecCorte, Integer usuarioId, Integer tipoOperacionCCId, Integer empresaId, short turnoId, BigDecimal importeTotalTarifa, BigDecimal importeTotalPedagio, BigDecimal importeTotalTasaAbordaje, BigDecimal importeTotalSeguro, BigDecimal importeTotalIngreso, BigDecimal importeTotalEgreso, BigDecimal importeTotalDevolucion, BigDecimal importeTotalTransferencia, BigDecimal importeFinal, boolean corteAutomatico, BigDecimal totalVentaSegOpcional, BigDecimal totalCancSegOpcional, BigDecimal importeTotalEfectivo) throws BusinessException { + try { + + ContaCorrentePtoVta ccPtoVta = new ContaCorrentePtoVta(); + ccPtoVta.setActivo(Boolean.TRUE); + ccPtoVta.setDescOperacion(descOperacion); + ccPtoVta.setEmpresa(new Empresa(empresaId)); + ccPtoVta.setFecmodif(Calendar.getInstance().getTime()); + ccPtoVta.setImporteTotalTarifa(importeTotalTarifa); + ccPtoVta.setImporteTotalPedagio(importeTotalPedagio); + ccPtoVta.setImporteTotalTasaAbordaje(importeTotalTasaAbordaje); + ccPtoVta.setImporteTotalSeguro(importeTotalSeguro); + ccPtoVta.setImporteTotalIngreso(importeTotalIngreso); + ccPtoVta.setImporteTotalEgreso(importeTotalEgreso); + ccPtoVta.setImporteTotalDevolucion(importeTotalDevolucion); + ccPtoVta.setImporteTotalTransferencia(importeTotalTransferencia); + ccPtoVta.setImporte(importeFinal); + ccPtoVta.setImporteTotalEfectivo(importeTotalEfectivo); + ccPtoVta.setPuntoVenta(new PuntoVenta(puntoVentaId)); + ccPtoVta.setTurno(new Turno(turnoId)); + ccPtoVta.setUsuarioModifId(usuarioId); + ccPtoVta.setUsuario(new Usuario(usuarioId)); + ccPtoVta.setTipoOperacionCC(new TipoOperacionCC(tipoOperacionCCId)); + ccPtoVta.setFecCorte(fecCorte); + ccPtoVta.setFecHorOperacion(fecCorte); + ccPtoVta.setTotalVentaSegOpcional(totalVentaSegOpcional); + ccPtoVta.setTotalCancSegOpcional(totalCancSegOpcional); + ccPtoVta.setIndComissao(Boolean.TRUE); + ccPtoVta.setImportetotalDebito(BigDecimal.ZERO); + ccPtoVta.setImportetotalCredito(BigDecimal.ZERO); + + getSession().save(ccPtoVta); + + return ccPtoVta; + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ContaMDHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ContaMDHibernateDAO.java new file mode 100644 index 000000000..db5e09c2d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ContaMDHibernateDAO.java @@ -0,0 +1,46 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ContaMDDAO; +import com.rjconsultores.ventaboletos.entidad.ContaMD; + +@Repository("contaMDDAO") +public class ContaMDHibernateDAO extends GenericHibernateDAO + implements ContaMDDAO { + + @Autowired + public ContaMDHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public Boolean existeConta(ContaMD conta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("nome", conta.getNome())); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tipo", conta.getTipo())); + + if (conta.getContaId() != null) { + c.add(Restrictions.ne("contaId", conta.getContaId())); + } + + return c.list().isEmpty(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioDetHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioDetHibernateDAO.java new file mode 100644 index 000000000..1cdb9cf8f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioDetHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ConvenioDetDAO; +import com.rjconsultores.ventaboletos.entidad.ConvenioDet; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("convenioDetDAO") +public class ConvenioDetHibernateDAO extends GenericHibernateDAO + implements ConvenioDetDAO { + + @Autowired + public ConvenioDetHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioHibernateDAO.java new file mode 100644 index 000000000..7a31c99f7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConvenioHibernateDAO.java @@ -0,0 +1,49 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.Convenio; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("convenioDAO") +public class ConvenioHibernateDAO extends GenericHibernateDAO + implements ConvenioDAO { + + @Autowired + public ConvenioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descconvenio")); + + return c.list(); + } + + public List buscar(String descconvenio, String cveconvenio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.or(Restrictions.eq("descconvenio", descconvenio), Restrictions.eq("cveconvenio", cveconvenio))); + + c.addOrder(Order.asc("descconvenio")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaCtrlHibernateDAO.java new file mode 100644 index 000000000..d8997da84 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaCtrlHibernateDAO.java @@ -0,0 +1,87 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CorridaCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("corridaCtrlDAO") +public class CorridaCtrlHibernateDAO extends GenericHibernateDAO + implements CorridaCtrlDAO { + + @Autowired + public CorridaCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public CorridaCtrl buscar(Ruta ruta, ClaseServicio claseServicio, Marca marca, + Date horario, boolean isPisoExtra) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("horario", horario)); + + if (isPisoExtra) { + // CorridaCtrl para Piso Extra + c.add(Restrictions.eq("pisoExtra", true)); + } else { + // num piso == null ou false + c.add(Restrictions.or(Restrictions.not(Restrictions.eq("pisoExtra", true)), Restrictions.isNull("pisoExtra"))); + } + + List lsCorridaCtrl = c.list(); + + if ((lsCorridaCtrl == null) || (lsCorridaCtrl.isEmpty())) { + return null; + } else { + return lsCorridaCtrl.get(0); + } + } + + @Override + public CorridaCtrl buscar(Integer corridaId, Parada origem, Parada destino, ClaseServicio claseServicio, Marca marca) { + StringBuilder hql = new StringBuilder(); + hql.append(" SELECT cc "); + hql.append(" FROM CorridaCtrl cc "); + hql.append(" INNER JOIN cc.ruta.rutaCombinacionList AS rutaCombinacionList "); + hql.append(" INNER JOIN rutaCombinacionList.tramo AS tramo"); + hql.append(" WHERE cc.activo = true "); + hql.append(" AND cc.corridaId = :corridaId "); + hql.append(" AND cc.marca.marcaId = :marcaId "); + hql.append(" AND cc.claseServicio = :claseservicioId "); + hql.append(" AND tramo.activo = true "); + hql.append(" AND tramo.origem.paradaId = :paradaOrigemId "); + hql.append(" AND tramo.destino.paradaId = :paradaDestinoId "); + hql.append(" AND rutaCombinacionList.activo = true "); + + Query sq = getSession().createQuery(hql.toString()); + sq.setInteger("corridaId", corridaId); + sq.setInteger("marcaId", marca.getMarcaId()); + sq.setInteger("claseservicioId", claseServicio.getClaseservicioId()); + sq.setInteger("paradaOrigemId", origem.getParadaId()); + sq.setInteger("paradaDestinoId", destino.getParadaId()); + + return (CorridaCtrl) sq.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java new file mode 100644 index 000000000..d0cd6ab95 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java @@ -0,0 +1,1100 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.List; + +import org.apache.commons.lang.math.NumberUtils; +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.Transformers; +import org.hibernate.type.BooleanType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CorridaDAO; +import com.rjconsultores.ventaboletos.dao.CorridaTramoDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Corrida.Id; +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.ActivoUtil; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.vo.corrida.CorridaVO; +import com.rjconsultores.ventaboletos.vo.secuencia.SecuenciaVO; + +/** + * + * @author rodrigo + */ +@SuppressWarnings("unchecked") +@Repository("corridaDAO") +public class CorridaHibernateDAO extends GenericHibernateDAO implements CorridaDAO { + + @Autowired + private SQLBuilder sqlBuilder; + private static final Integer ULTIMA_HORA_DIA = Integer.valueOf(23); + private static final Integer ULTIMO_MINUTO_SEGUNDO = Integer.valueOf(59); + private static final Integer ULTIMO_MILLISEGUNDO = Integer.valueOf(99); + @Autowired + private CorridaTramoDAO corridaTramoDao; + + private static Logger log = Logger.getLogger(CorridaHibernateDAO.class); + + @Autowired + public CorridaHibernateDAO(@Qualifier("sessionFactory") final SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public Boolean existe(final Id id) { + + Criteria c = makeCriteria(); + c.setProjection(Projections.rowCount()); + c.add(Restrictions.eq("id", id)); + + Long cant = HibernateFix.count(c.list()); + + return (cant > 0); + } + + @Override + public Corrida suscribir(final Corrida entity) { + + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.GERAR_CAMPO_EQUIVALENCIA_CORRIDA.getDescricao())) { + String sql = "SELECT CORRIDA_EQUIVALENCIA_SEQ.NEXTVAL FROM DUAL"; + Object o = this.getSession().createSQLQuery(sql).uniqueResult(); + entity.setEquivalenciaId(o.toString()); + } + + Corrida corrida = super.suscribir(entity); + this.getSession().flush(); + return corrida; + } + + @Override + public List buscarPorAutobusCorridasFuturas(final DiagramaAutobus diagramaAutobus) { + String hql = " select co from Corrida co, Autobus ab " + + " where ab.autobusId = co.autobus.autobusId " + + " and ab.diagramaAutobus.diagramaautobusId = " + diagramaAutobus.getDiagramaautobusId() + + " and co.id.feccorrida > current_timestamp()"; + + Query sq = getSession().createQuery(hql); + + List lsCorridas = sq.list(); + + return lsCorridas; + } + + @Override + public List buscarPorRolOperativoCorridasFuturas(final DiagramaAutobus diagramaAutobus) { + String hql = " select co from Corrida co, RolOperativo rol " + + " where rol.roloperativoId = co.rolOperativo.roloperativoId " + + " and rol.diagramaAutobus.diagramaautobusId = " + diagramaAutobus.getDiagramaautobusId() + + " and co.id.feccorrida > current_timestamp()"; + + Query sq = getSession().createQuery(hql); + List lsCorridas = sq.list(); + + return lsCorridas; + } + + @Override + public List buscarPorFecCorrida(final Date value) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + + c.add(Restrictions.eq("id.feccorrida", value)); + + return c.list(); + } + + @Override + public Long count(final Ruta ruta) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + c.setProjection(Projections.rowCount()); + + return HibernateFix.count(c.list()); + + } + + @Override + public List verificarCorridaId(Integer corridaId) { + + StringBuilder hql = new StringBuilder(); + hql.append("select distinct "); + hql.append(" new com.rjconsultores.ventaboletos.entidad.Corrida("); + hql.append(" c.id.corridaId, "); + hql.append(" c.origem, "); + hql.append(" c.destino) "); + hql.append("from "); + hql.append(" Corrida c "); + hql.append("where "); + hql.append(" 1 = 1 "); + hql.append(" and c.activo = 1 "); + hql.append(" and cast(c.id.corridaId as string) like :corridaId "); + hql.append(" group by "); + hql.append(" c.id.corridaId, "); + hql.append(" c.origem, "); + hql.append(" c.destino) "); + + Query sq = getSession().createQuery(hql.toString()); + + if (corridaId != null) { + sq.setParameter("corridaId", corridaId.toString() + '%'); + } else { + sq.setParameter("corridaId", '%'); + } + + return sq.list(); + } + + @Override + public List buscarPorId(final Integer idCorrida) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + c.add(Restrictions.eq("id.corridaId", idCorrida)); + + return c.list(); + } + + @Override + public List buscarFiltro(final Parada ori, final Parada des, final Date hora, final ClaseServicio cs) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + c.add(Restrictions.eq("origem", ori)); + c.add(Restrictions.eq("destino", des)); + c.add(Restrictions.between("fechorsalida", getDiaGeracaoHoraIni(hora), getDiaGeracaoHoraFim(hora))); + c.add(Restrictions.eq("claseServicio", cs)); + + return c.list(); + } + + @Override + public boolean count(final Parada ori, final Parada des, final Date hora, + final ClaseServicio cs, final boolean pisoExtra) { + + Criteria c = makeCriteria(); + c.setProjection(Projections.rowCount()); + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + c.add(Restrictions.eq("origem", ori)); + c.add(Restrictions.eq("destino", des)); + c.add(Restrictions.between("fechorsalida", getDiaGeracaoHoraIni(hora), getDiaGeracaoHoraFim(hora))); + c.add(Restrictions.eq("claseServicio", cs)); + + // Se for piso extra numPiso = 2 + if (pisoExtra) { + // Corrida Piso Extra + c.add(Restrictions.eq("numPiso", 2)); + } else { + // num piso == null ou diferente de 2 + c.add(Restrictions.or(Restrictions.not(Restrictions.eq("numPiso", 2)), Restrictions.isNull("numPiso"))); + } + + Long cant = HibernateFix.count(c.list()); + + return (cant > 0); + } + + private Date getDiaGeracaoHoraIni(final Date hora) { + Date dataCorreta = new Date(); + + // para pegar a hora e adicionar ao dia da geracao: + GregorianCalendar gAux = new GregorianCalendar(); + gAux.setTime(hora); + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(hora); + gcalendar.set(Calendar.HOUR_OF_DAY, gAux.get(Calendar.HOUR_OF_DAY)); + gcalendar.set(Calendar.MINUTE, gAux.get(Calendar.MINUTE)); + gcalendar.set(Calendar.SECOND, NumberUtils.INTEGER_ZERO); + gcalendar.set(Calendar.MILLISECOND, NumberUtils.INTEGER_ZERO); + + dataCorreta = gcalendar.getTime(); + + return dataCorreta; + } + + private Date getDiaGeracaoHoraFim(final Date hora) { + Date dataCorreta = new Date(); + + // para pegar a hora e adicionar ao dia da geracao: + GregorianCalendar gAux = new GregorianCalendar(); + gAux.setTime(hora); + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(hora); + gcalendar.set(Calendar.HOUR_OF_DAY, gAux.get(Calendar.HOUR_OF_DAY)); + gcalendar.set(Calendar.MINUTE, gAux.get(Calendar.MINUTE)); + gcalendar.set(Calendar.SECOND, NumberUtils.INTEGER_ZERO); + gcalendar.set(Calendar.MILLISECOND, ULTIMA_HORA_DIA); + + dataCorreta = gcalendar.getTime(); + + return dataCorreta; + } + + @Override + public List buscarDistinct(final Parada ori, final Parada des, final Date horaSalidaInicio, + final Date horaSalidaFin, final ClaseServicio cs, final Integer corridaId) { + StringBuilder hql = new StringBuilder(""); + hql.append("select distinct "); + hql.append(" new com.rjconsultores.ventaboletos.entidad.Corrida("); + hql.append(" c.marca, "); + hql.append(" c.id.corridaId, "); + hql.append(" c.origem, "); + hql.append(" c.destino, "); + hql.append(" c.claseServicio, "); + hql.append(" c.corridaCtrl.horario) "); + hql.append("from "); + hql.append(" Corrida c "); + hql.append("where "); + hql.append(" 1 = 1 "); + if (ori != null) { + hql.append(" and c.origem = :origen "); + } + if (des != null) { + hql.append(" and c.destino = :destino"); + } + if (cs != null) { + hql.append(" and c.claseServicio = :claseServicio "); + } + if (corridaId != null) { + hql.append(" and c.id.corridaId = :corridaId "); + } + if (horaSalidaInicio != null) { + + hql.append(" and c.corridaCtrl.horario >= :horaSalidaInicio"); + } + if (horaSalidaFin != null) { + + hql.append(" and c.corridaCtrl.horario <= :horaSalidaFin"); + } + + hql.append(" order by c.id.corridaId,c.corridaCtrl.horario"); + + Query query = getSession().createQuery(hql.toString()); + + if (ori != null) { + query.setParameter("origen", ori); + } + if (des != null) { + query.setParameter("destino", des); + } + if (cs != null) { + query.setParameter("claseServicio", cs); + } + if (corridaId != null) { + query.setParameter("corridaId", corridaId); + } + + if (horaSalidaInicio != null) { + + query.setParameter("horaSalidaInicio", horaSalidaInicio); + } + if (horaSalidaFin != null) { + query.setParameter("horaSalidaFin", horaSalidaFin); + + } + + return query.list(); + } + + @Override + public boolean existe(final Ruta ruta, final Date fecCorrida, final Date horaCorrida, + final ClaseServicio claseServicio, final Marca marca, final boolean pisoExtra) { + Calendar soloFecha = Calendar.getInstance(); + soloFecha.setTime(fecCorrida); + soloFecha.set(Calendar.HOUR, NumberUtils.INTEGER_ZERO); + soloFecha.set(Calendar.MINUTE, NumberUtils.INTEGER_ZERO); + soloFecha.set(Calendar.SECOND, NumberUtils.INTEGER_ZERO); + soloFecha.set(Calendar.MILLISECOND, NumberUtils.INTEGER_ZERO); + + Criteria c = makeCriteria(); + c.setProjection(Projections.rowCount()); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("id.feccorrida", soloFecha.getTime())); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("marca", marca)); + + // Se for piso extra numPiso = 2 + if (pisoExtra) { + // Corrida Piso Extra + c.add(Restrictions.eq("numPiso", 2)); + } else { + // num piso == null ou diferente de 2 + c.add(Restrictions.or(Restrictions.not(Restrictions.eq("numPiso", 2)), Restrictions.isNull("numPiso"))); + } + + Criteria cCorridaCtrl = c.createCriteria("corridaCtrl"); + cCorridaCtrl.add(Restrictions.eq("horario", horaCorrida)); + + Long cant = HibernateFix.count(c.list()); + + return (cant > 0); + } + + @Override + public Long cantCorridaGeneradasHoy() { + Calendar cTmp1 = Calendar.getInstance(); + Calendar cTmp2 = Calendar.getInstance(); + + cTmp1.set(Calendar.HOUR_OF_DAY, NumberUtils.INTEGER_ZERO); + cTmp1.set(Calendar.MINUTE, NumberUtils.INTEGER_ZERO); + cTmp1.set(Calendar.MILLISECOND, NumberUtils.INTEGER_ZERO); + cTmp1.set(Calendar.SECOND, NumberUtils.INTEGER_ZERO); + + cTmp2.set(Calendar.HOUR_OF_DAY, ULTIMA_HORA_DIA); + cTmp2.set(Calendar.MINUTE, ULTIMO_MINUTO_SEGUNDO); + cTmp2.set(Calendar.SECOND, ULTIMO_MINUTO_SEGUNDO); + cTmp2.set(Calendar.MILLISECOND, ULTIMO_MILLISEGUNDO); + + String sql = "select count(c.fecmodif) from Corrida c where c.fecmodif between :inicio and :fim"; + + Query query = getSession().createQuery(sql); + query.setParameter("inicio", cTmp1.getTime()); + query.setParameter("fim", cTmp2.getTime()); + Long count = HibernateFix.count(query.uniqueResult()); + + return count; + } + + @Override + public List buscarGroupCorrridaId(final Integer corridaId, final Integer origem, final Integer destino, + final Integer ruta, final Integer numRuta, final Date dateInicio, final Date dateFin) { + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT c.corrida_id "); + sql.append(" FROM corrida c "); + if (numRuta != null) { + sql.append(" INNER JOIN Ruta r ON r.ruta_id=c.ruta_id "); + } + sql.append(" WHERE c.feccorrida BETWEEN :dateInicio AND :dateFin "); + sql.append(" AND c.corrida_id LIKE :corridaId "); + + if (origem != null) { + sql.append(" AND c.ORIGEN_ID=:origem"); + } + if (destino != null) { + sql.append(" AND c.DESTINO_ID=:destino"); + } + if (ruta != null) { + sql.append(" AND c.RUTA_ID=:ruta"); + } + if (numRuta != null) { + sql.append(" AND r.NUMRUTA=:numRuta"); + } + + sql.append(" GROUP BY c.corrida_id "); + + Query sq = getSession().createSQLQuery(sql.toString()); + + if (corridaId != null) { + sq.setParameter("corridaId", corridaId.toString() + '%'); + } else { + sq.setParameter("corridaId", '%'); + } + + if (origem != null) { + sq.setParameter("origem", origem); + } + if (destino != null) { + sq.setParameter("destino", destino); + } + if (ruta != null) { + sq.setParameter("ruta", ruta); + } + if (numRuta != null) { + sq.setParameter("numRuta", numRuta.toString()); + } + + sq.setParameter("dateInicio", dateInicio); + sq.setParameter("dateFin", dateFin); + + List lsObject = sq.list(); + + List lsCorridas = new ArrayList(); + + if (lsObject != null && !lsObject.isEmpty()) { + + for (Object object : lsObject) { + + BigDecimal id = (BigDecimal) object; + + StringBuffer hql = new StringBuffer(); + hql.append(" FROM Corrida "); + hql.append(" WHERE id.corridaId = " + id); + + Query squery = getSession().createQuery(hql.toString()); + squery.setMaxResults(NumberUtils.INTEGER_ONE); + + List lsCorridasAux = squery.list(); + + if (lsCorridasAux != null && !lsCorridasAux.isEmpty()) { + lsCorridas.add(lsCorridasAux.iterator().next()); + } + } + } + + return lsCorridas; + } + + @Override + public List buscarGroupCorrridaId(final Integer corridaId, final Date dateInicio, final Date dateFin) { + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT c.corrida_id "); + sql.append(" FROM corrida c "); + sql.append(" WHERE c.feccorrida BETWEEN :dateInicio AND :dateFin "); + sql.append(" AND c.corrida_id LIKE :corridaId "); + sql.append(" GROUP BY c.corrida_id "); + + Query sq = getSession().createSQLQuery(sql.toString()); + + if (corridaId != null) { + sq.setParameter("corridaId", corridaId.toString() + '%'); + } else { + sq.setParameter("corridaId", '%'); + } + + sq.setParameter("dateInicio", dateInicio); + sq.setParameter("dateFin", dateFin); + + List lsObject = sq.list(); + + List lsCorridas = new ArrayList(); + + if (lsObject != null && !lsObject.isEmpty()) { + + for (Object object : lsObject) { + + BigDecimal id = (BigDecimal) object; + + StringBuilder hql = new StringBuilder(); + hql.append(" FROM Corrida "); + hql.append(" WHERE id.corridaId = " + id); + hql.append(" and id.feccorrida BETWEEN :dateInicio AND :dateFin"); + + Query squery = getSession().createQuery(hql.toString()); + squery.setParameter("dateInicio", dateInicio); + squery.setParameter("dateFin", dateFin); + squery.setMaxResults(NumberUtils.INTEGER_ONE); + + List lsCorridasAux = squery.list(); + + if (lsCorridasAux != null && !lsCorridasAux.isEmpty()) { + lsCorridas.add(lsCorridasAux.iterator().next()); + } + } + } + + return lsCorridas; + } + + @Override + public void actualizaFecHusoFecVerano(final Corrida corrida) { + + Integer corridaId = corrida.getId().getCorridaId(); + Date feccorrida = corrida.getId().getFeccorrida(); + + Query queryCorrida = getSession().createQuery( + sqlBuilder.getSQLActualizarCorridaFecHusoFecVerano()); + queryCorrida.setInteger("corridaId", corridaId); + queryCorrida.setInteger("corridaId", corridaId); + queryCorrida.setDate("feccorrida", feccorrida); + queryCorrida.executeUpdate(); + + Query queryCorridaTramo = getSession().createQuery( + sqlBuilder.getSQLActualizarCorridaTramoFecHusoFecVerano()); + queryCorridaTramo.setInteger("corridaId", corridaId); + queryCorridaTramo.setDate("feccorrida", feccorrida); + queryCorridaTramo.executeUpdate(); + } + + @SuppressWarnings("deprecation") + @Override + public void actualizaFecHusoFecVerano(final List corridas) { + + for (Corrida corrida : corridas) { + + Date husoHorVeranoLlegadaAnterior = null; + Date fechorSalidaOriginalUpdate = null; + Date fechorsalidaUpdate = null; + Date fechorllegadaUpdate = null; + Integer corridatramoId = 0; + Date fechorSalidaOriginal = null; + Date fechorsalida = null; + Date fechorllegada = null; + Integer tiempoHorHusoOrigem = Integer.valueOf(0); + Integer tiempoHorVeranoOrigem = Integer.valueOf(0); + Integer tiempoHorHusoDestino = Integer.valueOf(0); + Integer tiempoHorVeranoDestino = Integer.valueOf(0); + Date tiempoestancia = null; + + List tramos = buscarTramosCorrida(corrida); + + for (Object[] objeto : tramos) { + corridatramoId = Integer.valueOf(objeto[0].toString()); + fechorSalidaOriginal = (Date) objeto[2]; + fechorsalida = (Date) objeto[3]; + fechorllegada = (Date) objeto[4]; + tiempoHorHusoOrigem = Integer.valueOf(objeto[5].toString()); + tiempoHorVeranoOrigem = Integer.valueOf(objeto[6].toString()); + tiempoHorHusoDestino = Integer.valueOf(objeto[7].toString()); + tiempoHorVeranoDestino = Integer.valueOf(objeto[8].toString()); + tiempoestancia = (Date) objeto[9]; + + if (husoHorVeranoLlegadaAnterior == null) { + fechorSalidaOriginalUpdate = fechorSalidaOriginal; + fechorsalidaUpdate = fechorsalida; + } else { + fechorSalidaOriginalUpdate = husoHorVeranoLlegadaAnterior; + fechorsalidaUpdate = husoHorVeranoLlegadaAnterior; + } + + husoHorVeranoLlegadaAnterior = calcularHusoHorVeranoLlegada( + fechorsalida, + fechorllegada, + fechorsalidaUpdate, + tiempoHorHusoOrigem + tiempoHorVeranoOrigem, + tiempoHorHusoDestino + tiempoHorVeranoDestino); + + if (tiempoestancia != null) { + Calendar aux = Calendar.getInstance(); + aux.setTime(DateUtil.normalizar(husoHorVeranoLlegadaAnterior)); + aux.add(Calendar.MINUTE, tiempoestancia.getMinutes()); + aux.add(Calendar.HOUR_OF_DAY, tiempoestancia.getHours()); + + husoHorVeranoLlegadaAnterior = aux.getTime(); + + Calendar auxFechorsalidaUpdate = Calendar.getInstance(); + auxFechorsalidaUpdate.setTime(DateUtil.normalizar(fechorsalidaUpdate)); + auxFechorsalidaUpdate.add(Calendar.MINUTE, tiempoestancia.getMinutes()); + auxFechorsalidaUpdate.add(Calendar.HOUR_OF_DAY, tiempoestancia.getHours()); + + fechorsalidaUpdate = auxFechorsalidaUpdate.getTime(); + } + + if (husoHorVeranoLlegadaAnterior != null) { + fechorllegadaUpdate = husoHorVeranoLlegadaAnterior; + } else { + fechorllegadaUpdate = fechorllegada; + } + + Query queryCorridaTramo = getSession().createQuery(sqlBuilder.getSQLActualizarCorridaTramoFecHusoFecVerano()); + queryCorridaTramo.setTimestamp("fechorSalidaOriginalH", fechorSalidaOriginalUpdate); + queryCorridaTramo.setTimestamp("fechorsalidaH", fechorsalidaUpdate); + queryCorridaTramo.setTimestamp("fechorllegadaH", fechorllegadaUpdate); + queryCorridaTramo.setInteger("corridatramoId", corridatramoId); + queryCorridaTramo.executeUpdate(); + } + } + } + + private Date calcularHusoHorVeranoLlegada(Date fechorsalida, Date fechorllegada, Date fechorsalidaH, int tiempoOrigen, int tiempoDestino) { + Calendar horLlegada = null; + + // Si los tiempos son distintos, hube cambio de huso horario/horario de verano + + long elapsedMinutes = DateUtil.getElapsedMinutos(fechorsalida, fechorllegada); + + horLlegada = Calendar.getInstance(); + horLlegada.setTime(fechorsalidaH); + horLlegada.add(Calendar.MINUTE, (int) elapsedMinutes); + + if (tiempoOrigen != tiempoDestino) { + horLlegada.add(Calendar.HOUR, difHuso(tiempoOrigen, tiempoDestino)); + + } + + return (horLlegada == null) ? null : horLlegada.getTime(); + } + + private int difHuso(int a, int b) { + return b - a; + } + + @Override + public List buscarPorEstado(final Estado estado, final Date dataInicial, Integer corridaId) { + StringBuilder hql = new StringBuilder(); + + hql.append(" select "); + hql.append(" distinct new com.rjconsultores.ventaboletos.entidad.Corrida").append("("); + hql.append(" ct.corrida.id.corridaId, "); + hql.append(" ct.corrida.id.feccorrida").append(")"); + hql.append(" from CorridaTramo ct "); + hql.append(" left join ct.origem.ciudad.estado eo "); + hql.append(" left join ct.destino.ciudad.estado ed "); + hql.append(" where ct.corrida.activo = :isActivo "); + hql.append(" and ct.corrida.id.feccorrida >= :feccorrida "); + hql.append(" and ( eo.estadoId = :estadoId "); + hql.append(" or ed.estadoId = :estadoId )"); + if (corridaId != null) { + hql.append(" and ct.corrida.id.corridaId = :corridaId )"); + } + hql.append(" group by "); + hql.append(" ct.corrida.id.corridaId, "); + hql.append(" ct.corrida.id.feccorrida "); + + Query query = getSession().createQuery(hql.toString()); + query.setInteger("isActivo", ActivoUtil.ATIVO); + query.setDate("feccorrida", dataInicial); + query.setInteger("estadoId", estado.getEstadoId()); + + if (corridaId != null) { + query.setInteger("corridaId", corridaId); + } + + return query.list(); + } + + @Override + public List buscarPorEstado(final Estado estado, final Date dataInicial) { + return buscarPorEstado(estado, dataInicial, null); + } + + private List buscarTramosCorrida(final Corrida corrida) { + StringBuilder hql = new StringBuilder(); + + hql.append(" select "); + hql.append(" ct.corridatramoId, "); + hql.append(" ct.numsecuencia,"); + hql.append(" ct.fechorSalidaOriginal,"); + hql.append(" ct.fechorsalida,"); + hql.append(" ct.fechorllegada,"); + hql.append(" nvl(estadoO.tiempoHorHuso, 0) as tiempoHorHusoOrigem,"); + hql.append(" nvl( case when "); + hql.append(" ct.fechorSalidaOriginal between "); + hql.append(" estadoO.fecInicioHorVerano "); + hql.append(" and estadoO.fecFinoHorVerano "); + hql.append(" then (estadoO.tiempoHorVerano)"); + hql.append(" else 0 end, 0) as tiempoHorVeranoOrigem,"); + hql.append(" nvl(estadoD.tiempoHorHuso, 0) as tiempoHorHusoDestino,"); + hql.append(" nvl( case when "); + hql.append(" ct.fechorSalidaOriginal between "); + hql.append(" estadoD.fecInicioHorVerano "); + hql.append(" and estadoD.fecFinoHorVerano "); + hql.append(" then (estadoD.tiempoHorVerano)"); + hql.append(" else 0 end, 0) as tiempoHorVeranoDestino,"); + hql.append(" ct.tiempoEstancia "); + hql.append(" from CorridaTramo ct "); + hql.append(" inner join ct.origem origem "); + hql.append(" inner join origem.ciudad ciudadO "); + hql.append(" inner join ciudadO.estado estadoO "); + hql.append(" inner join ct.destino destino "); + hql.append(" inner join destino.ciudad ciudadD "); + hql.append(" inner join ciudadD.estado estadoD "); + + hql.append(" where ct.corrida.activo = :isActivo "); + hql.append(" and ct.activo = :isActivo "); + hql.append(" and ct.corrida.id.corridaId = :corridaId "); + hql.append(" and ct.corrida.id.feccorrida = :feccorrida "); + hql.append(" order by "); + hql.append(" ct.numsecuencia "); + + Query query = getSession().createQuery(hql.toString()); + query.setInteger("isActivo", ActivoUtil.ATIVO); + query.setDate("feccorrida", corrida.getId().getFeccorrida()); + query.setInteger("corridaId", corrida.getId().getCorridaId()); + + return query.list(); + } + + @Override + public Corrida buscaCorrridaFutura(Ruta ruta, Date fecInicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.gt("fechorsalida", fecInicio)); + c.addOrder(Order.asc("fechorsalida")); + List lsCorrida = c.list(); + if (!lsCorrida.isEmpty()) { + return lsCorrida.get(0); + } + return null; + } + + @Override + public Boolean editarCorridaPorOutraCorrida(List corridas, Corrida corridaPadrao) { + List tramosPadrao = corridaTramoDao.buscarCorridaTramoPorCorrida(corridaPadrao); + + for (Corrida corrida : corridas) { + List tramos = corridaTramoDao.buscarCorridaTramoPorCorrida(corrida); + + try{ + for (CorridaTramo tramo : tramos) { + + for (CorridaTramo tramoPadrao : tramosPadrao) { + if (tramoPadrao.getNumsecuencia().equals(tramo.getNumsecuencia())) { + tramo.setFechorsalida(mudarData(tramoPadrao.getFechorsalida(), tramo.getFechorsalida())); + tramo.setFechorsalidaH(mudarData(tramoPadrao.getFechorsalidaH(), tramo.getFechorsalidaH())); + tramo.setFechorSalidaOriginal(mudarData(tramoPadrao.getFechorSalidaOriginal(), tramo.getFechorSalidaOriginal())); + tramo.setFechorllegada(mudarData(tramoPadrao.getFechorllegada(), tramo.getFechorllegada())); + tramo.setFechorllegadaH(mudarData(tramoPadrao.getFechorllegadaH(), tramo.getFechorllegadaH())); + corridaTramoDao.actualizacion(tramo); + break; + } + } + } + }catch(Exception e){ + log.error(e.getMessage()); + } + + } + return true; + } + + private Date mudarData(Date dataPadrao, Date dataMudanca) { + try{ + Calendar calPadrao = Calendar.getInstance(); + calPadrao.setTime(dataPadrao); + Calendar calMudanca = Calendar.getInstance(); + calMudanca.setTime(dataMudanca); + + calMudanca.set(calMudanca.get(Calendar.YEAR), calMudanca.get(Calendar.MONTH), calMudanca.get(Calendar.DAY_OF_MONTH), + calPadrao.get(Calendar.HOUR_OF_DAY), calPadrao.get(Calendar.MINUTE), calPadrao.get(Calendar.SECOND)); + return calMudanca.getTime(); + }catch(Exception e){ + return null; + } + } + + @Override + public Corrida buscarPorId(Id id) { + + StringBuilder hql = new StringBuilder(); + + hql.append(" from Corrida corrida "); + hql.append(" where corrida.id.feccorrida = :feccorrida "); + hql.append(" and corrida.id.corridaId = :corridaId )"); + + Query query = getSession().createQuery(hql.toString()); + query.setDate("feccorrida", id.getFeccorrida()); + query.setInteger("corridaId", id.getCorridaId()); + + query.setMaxResults(1); + return (Corrida)query.uniqueResult(); + } + + @Override + public List buscarCorridaRelAproveitamento(Parada origem, Parada destino, + Date feccorrida, Integer corridaId) { + + StringBuilder sql = new StringBuilder(); + sql.append(" select "); + sql.append(" c.corrida_id as corrida_id, "); + sql.append(" c.feccorrida as feccorrida, "); + sql.append(" c.fechorsalida as fechorsalida, "); + sql.append(" origen.parada_id as origen_id, "); + sql.append(" origen.descparada as origen, "); + sql.append(" destino.parada_id as destino_id, "); + sql.append(" destino.descparada as destino, "); + sql.append(" r.ruta_id as ruta_id, "); + sql.append(" r.descruta as descruta, "); + sql.append(" cs.claseservicio_id as claseservicio_id, "); + sql.append(" cs.descclase as descclase "); + sql.append(" from corrida c "); + sql.append(" inner join parada origen on c.origen_id = origen.parada_id "); + sql.append(" inner join parada destino on c.destino_id = destino.parada_id "); + sql.append(" inner join ruta r on c.ruta_id = r.ruta_id "); + sql.append(" inner join clase_servicio cs on c.claseservicio_id = cs.claseservicio_id "); + sql.append(" where c.activo <> 0 "); + if (corridaId != null) { + sql.append(" and c.corrida_id = :corridaId "); + } + sql.append(feccorrida == null ? "" : " and c.feccorrida = :feccorrida "); + if (origem != null) { + sql.append(origem == null ? "" : " and c.origen_id = :origen_id "); + } + if (destino != null) { + sql.append(destino == null ? "" : " and c.destino_id = :destino_id "); + } + + Query query = getSession().createSQLQuery(sql.toString()); + if (corridaId != null) { + query.setParameter("corridaId", corridaId); + } + query.setParameter("feccorrida", feccorrida); + if (origem != null) { + query.setParameter("origen_id", origem.getParadaId()); + } + if (destino != null) { + query.setParameter("destino_id", destino.getParadaId()); + } + + List lsObject = query.list(); + + List lsCorridas = new ArrayList(); + + if (lsObject != null && !lsObject.isEmpty()) { + + for (Object object : lsObject) { + if (object != null) { + Object objectArray[] = (Object[]) object; + Id id = new Id(); + id.setCorridaId(((BigDecimal) objectArray[0]).intValue()); + id.setFeccorrida((Timestamp) objectArray[1]); + + Parada o = new Parada(); + o.setParadaId(((BigDecimal) objectArray[3]).intValue()); + o.setDescparada((String) objectArray[4]); + + Parada d = new Parada(); + d.setParadaId(((BigDecimal) objectArray[5]).intValue()); + d.setDescparada((String) objectArray[6]); + + Ruta ruta = new Ruta(); + ruta.setRutaId(((BigDecimal) objectArray[7]).intValue()); + ruta.setDescruta((String) objectArray[8]); + + ClaseServicio claseServicio = new ClaseServicio(); + claseServicio.setClaseservicioId(((BigDecimal) objectArray[9]).intValue()); + claseServicio.setDescclase((String) objectArray[10]); + + Corrida corrida = new Corrida(); + corrida.setId(id); + corrida.setFechorsalida((Timestamp) objectArray[2]); + corrida.setOrigem(o); + corrida.setDestino(d); + corrida.setRuta(ruta); + corrida.setClaseServicio(claseServicio); + + lsCorridas.add(corrida); + } + } + } + return lsCorridas; + } + + @Override + public Boolean existeCorrida(Long id) { + StringBuilder sql = new StringBuilder(); + sql.append("SELECT CORRIDA_ID FROM CORRIDA corrida "); + sql.append("WHERE CORRIDA_ID = " + id + " AND ACTIVO = 1"); + + Query query = getSession().createSQLQuery(sql.toString()); + + return query.list().size() > 0; + } + + @Override + @Transactional(rollbackFor = { BusinessException.class }) + public Integer atualizaCorridasIntegracaoTotvs(Marca marca, Date dataIncial, Date dataFinal, Integer corridaId) throws BusinessException { + + // update caja set integradototvs = 0 where PUNTOVENTA_ID = 269 and FECHORVENTA >= '30/03/2018' and FECHORVENTA <= '01/04/2018'; + StringBuilder sb = new StringBuilder(); + sb.append(" update corrida set integradototvs = 0 "); + sb.append(" where FECCORRIDA >= :fechorInicial "); + sb.append(" and FECCORRIDA <= :fechorFinal "); + sb.append(" and CORRIDA_ID = :corridaId "); + if (marca != null) { + sb.append(" and MARCA_ID = :marcaId "); + } + SQLQuery query = getSession().createSQLQuery(sb.toString()); + if (marca != null) { + query.setInteger("marcaId", marca.getMarcaId()); + } + query.setInteger("corridaId", corridaId); + query.setTimestamp("fechorInicial", dataIncial); + query.setTimestamp("fechorFinal", dataFinal); + Integer result = query.executeUpdate(); + return result; + } + + @Override + public List buscarListaPorIds(List corridaIds){ + + StringBuilder hql = new StringBuilder(); + hql.append(" select co ") + .append(" from Corrida co") + .append(" where co.activo = 1 ") + .append(" and co.id in ( :corridaIds )"); + + Query query = getSession().createQuery(hql.toString()); + query.setParameterList("corridaIds", corridaIds); + List lsCorridas = query.list(); + + List listCorrida = new ArrayList(); + for (Corrida corrida : lsCorridas) { + CorridaVO co = new CorridaVO(corrida); + + preencherTramoSequencia(co, corrida); + + listCorrida.add(co); + } + + return listCorrida; + } + + @Override + public CorridaVO buscarVOPorId(Id corridaId){ + + StringBuilder sb = new StringBuilder(); + sb.append(" select "); + sb.append(" c.corrida_id as corridaId, "); + sb.append(" to_char(c.feccorrida, 'dd/MM/yyyy') as feccorrida, "); + sb.append(" c.corrida_id as numCorrida, "); + sb.append(" to_char(c.fechorsalida, 'dd/MM/yyyy HH24:mi:ss')||'.000' as fechorsalida, "); + sb.append(" c.origen_id as origenId, "); + sb.append(" c.destino_id as destinoId, "); + sb.append(" c.tiposervicio_id as tipoServicioId, "); + sb.append(" c.roloperativo_id as rolOperativoId, "); + sb.append(" c.claseservicio_id as claseServicioId, "); + sb.append(" c.empresacorrida_id as empresaId, "); + sb.append(" mar.marca_id as marcaId, "); + sb.append(" emp.indtabelaprecoembarcada as tarifaEmbarcada, "); + sb.append(" c.ruta_id as rutaId "); + sb.append(" from corrida c "); + sb.append(" JOIN empresa emp ON emp.empresa_id = c.empresacorrida_id "); + sb.append(" JOIN marca mar ON mar.empresa_id = emp.empresa_id "); + sb.append(" AND mar.activo = 1 "); + sb.append(" where c.activo = 1 "); + sb.append(" and C.CORRIDA_ID = :corridaId "); + sb.append(" and C.FECCORRIDA = :feccorrida "); + + Query query = getSession().createSQLQuery(sb.toString()) + .addScalar("corridaId", IntegerType.INSTANCE) + .addScalar("feccorrida", StringType.INSTANCE) + .addScalar("numCorrida", IntegerType.INSTANCE) + .addScalar("fechorsalida", StringType.INSTANCE) + .addScalar("origenId", IntegerType.INSTANCE) + .addScalar("destinoId", IntegerType.INSTANCE) + .addScalar("tipoServicioId", IntegerType.INSTANCE) + .addScalar("rolOperativoId", IntegerType.INSTANCE) + .addScalar("claseServicioId", IntegerType.INSTANCE) + .addScalar("empresaId", IntegerType.INSTANCE) + .addScalar("marcaId", IntegerType.INSTANCE) + .addScalar("tarifaEmbarcada", BooleanType.INSTANCE) + .addScalar("rutaId", IntegerType.INSTANCE) + .setResultTransformer(Transformers.aliasToBean(CorridaVO.class)); + + query.setParameter("corridaId", corridaId.getCorridaId()); + query.setParameter("feccorrida", corridaId.getFeccorrida()); + + return (CorridaVO)query.uniqueResult(); + + } + + private void preencherTramoSequencia(CorridaVO corridaVO, Corrida corrida ) { + + StringBuilder sb = new StringBuilder(); + + sb.append(" SELECT"); + sb.append(" CT.NUMSECUENCIA,"); + sb.append(" CT.ORIGEN_ID, "); + sb.append(" CT.DESTINO_ID, "); + sb.append(" CT.TRAMO_ID "); + sb.append(" FROM CORRIDA C"); + sb.append(" JOIN CORRIDA_TRAMO CT ON CT.CORRIDA_ID = C.CORRIDA_ID AND CT.FECCORRIDA = C.FECCORRIDA"); + sb.append(" WHERE C.CORRIDA_ID = :corridaId AND C.FECCORRIDA = :feccorrida and CT.activo = 1 "); + sb.append(" ORDER BY CT.NUMSECUENCIA "); + + Query query = getSession().createSQLQuery(sb.toString()); + + query.setParameter("corridaId", corrida.getId().getCorridaId()); + query.setParameter("feccorrida", corrida.getId().getFeccorrida()); + + List lsSecuenciaVO = new ArrayList(); + List lsTramoVO = new ArrayList(); + List controle = new ArrayList(); + + List list = query.list(); + + for (Object[] item : list) { + final Integer origensecuencia = Integer.valueOf(item[0].toString()); + final Integer origen_id = Integer.valueOf(item[1].toString()); + + final Integer destinosecuencia = Integer.valueOf(item[0].toString()) + 1; + final Integer destino_id = Integer.valueOf(item[2].toString()); + + adicionarSequencia( + controle, + lsSecuenciaVO, + origensecuencia, + origen_id); + + adicionarSequencia( + controle, + lsSecuenciaVO, + destinosecuencia, + destino_id); + + //adiciona o id do tramo + lsTramoVO.add(Integer.valueOf(item[3].toString())); + } + + corridaVO.setListTramos( lsTramoVO ); + corridaVO.setLsSecuenciaVO( lsSecuenciaVO ); + } + + private void adicionarSequencia(List controle, List lsSecuenciaVO, final Integer numsecuencia, final Integer paradaId) { + final String key = numsecuencia.toString() + "|" + paradaId.toString(); + + if (!controle.contains(key)) { + SecuenciaVO sequencia = new SecuenciaVO(); + sequencia.setSecuencia(numsecuencia); + sequencia.setLocalidadeId(paradaId); + + lsSecuenciaVO.add(sequencia); + + controle.add(key); + } + } + + public Integer buscarOcupacaoCorrida(Corrida corrida) { + try { + if(corrida == null) { + return 0; + } + //TODO: VERIFICAR ERRO NA PESQUISA + StringBuilder sb = new StringBuilder(); + + sb.append(" SELECT"); + sb.append(" COUNT(BOLETO_ID) "); + sb.append(" FROM "); + sb.append(" BOLETO "); + sb.append(" WHERE "); + sb.append(" ACTIVO = 1 AND motivocancelacion_id IS NULL AND "); + sb.append(" CORRIDA_ID = :corridaId AND FECCORRIDA = :feccorrida "); + + Query query = getSession().createSQLQuery(sb.toString()); + query.setParameter("corridaId", corrida.getId().getCorridaId()); + query.setParameter("feccorrida", corrida.getId().getFeccorrida()); + + BigDecimal resultado = (BigDecimal) query.uniqueResult(); + + return resultado.intValue(); + } catch (Exception e) { + log.error("Erro ao buscar ocupacao da corrida: " + corrida.getId().getCorridaId() + " - " + corrida.getId().getFeccorrida(), e); + } + + return 0; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaTramoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaTramoHibernateDAO.java new file mode 100644 index 000000000..4efcc0bc8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaTramoHibernateDAO.java @@ -0,0 +1,96 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.List; + +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.HibernateException; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.ShortType; +import org.hibernate.type.TimestampType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CorridaTramoDAO; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; +import com.rjconsultores.ventaboletos.utilerias.ActivoUtil; + +@Repository("corridaTramoDAO") +public class CorridaTramoHibernateDAO extends GenericHibernateDAO implements CorridaTramoDAO { + + @Autowired + public CorridaTramoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + private static final long serialVersionUID = 1L; + private static Logger log = Logger.getLogger(CorridaTramoHibernateDAO.class); + + @Override + public List obtenerTramoTarjetaEmitida() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.isNotNull("fechortarjetaviaje")); + c.add(Restrictions.isNull("indmanttarjeta")); + c.add(Restrictions.eq("numsecuencia", (short) 1)); + + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + + return c.list(); + } + + public List buscarTarjetaMesmaCorrida(CorridaTramo ct) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", ActivoUtil.ATIVO)); + c.add(Restrictions.eq("corrida", ct.getCorrida())); + + return c.list(); + } + + public List buscarCorridaTramoPorCorrida(Corrida corrida) { + try{ + String queryStr = "select ct.Numsecuencia as Numsecuencia, ct.Fechorsalida as Fechorsalida, ct.FechorsalidaH as FechorsalidaH, ct.FechorSalidaOriginal as FechorSalidaOriginal, ct.Fechorllegada as Fechorllegada, ct.FechorllegadaH as FechorllegadaH from Corrida_Tramo ct where ct.activo = :activo and ct.corrida_id = :corridaId and ct.feccorrida = :feccorrida "; + Query query = getSession().createSQLQuery(queryStr).addScalar("numsecuencia", ShortType.INSTANCE) + .addScalar("fechorsalida", TimestampType.INSTANCE) + .addScalar("fechorsalidaH", TimestampType.INSTANCE) + .addScalar("fechorSalidaOriginal", TimestampType.INSTANCE) + .addScalar("fechorllegada", TimestampType.INSTANCE) + .addScalar("fechorllegadaH", TimestampType.INSTANCE); + + query.setInteger("activo", ActivoUtil.ATIVO); + query.setInteger("corridaId", corrida.getId().getCorridaId()); + query.setDate("feccorrida", corrida.getId().getFeccorrida()); + + query.setResultTransformer(new AliasToBeanResultTransformer(CorridaTramo.class)); + + + return (List)query.list(); + + }catch(HibernateException e){ + log.error(e.getMessage()); + } + return null; + } + + public BigDecimal buscarSumTarjetaMesmaCorrida(CorridaTramo ct) { + + String hql = " select sum(t.kmReal) from CorridaTramo ct, Tramo t " + + " where ct.tramo.tramoId = t.tramoId and ct.activo = 1 " + + " and ct.corrida.id.corridaId = :id " + + " and ct.corrida.id.feccorrida = :data " + + " group by ct.corrida.id.corridaId,ct.corrida.id.feccorrida "; + + Query sq = getSession().createQuery(hql); + sq.setParameter("id", ct.getCorrida().getId().getCorridaId()); + sq.setDate("data", ct.getCorrida().getId().getFeccorrida()); + + BigDecimal km = (BigDecimal) sq.uniqueResult(); + + return km; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaBeneficiarioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaBeneficiarioHibernateDAO.java new file mode 100644 index 000000000..75245e218 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaBeneficiarioHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CortesiaBeneficiarioDAO; +import com.rjconsultores.ventaboletos.entidad.CortesiaBeneficiario; +import java.io.Serializable; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("cortesiaBeneficiarioDAO") +public class CortesiaBeneficiarioHibernateDAO extends GenericHibernateDAO + implements CortesiaBeneficiarioDAO { + + @Autowired + public CortesiaBeneficiarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaDireccionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaDireccionHibernateDAO.java new file mode 100644 index 000000000..a2f28fe3d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaDireccionHibernateDAO.java @@ -0,0 +1,115 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CortesiaDireccionDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CortesiaDireccion; +import com.rjconsultores.ventaboletos.entidad.Marca; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import org.hibernate.Query; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; + +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("cortesiaDireccionDAO") +public class CortesiaDireccionHibernateDAO extends GenericHibernateDAO + implements CortesiaDireccionDAO { + + @Autowired + public CortesiaDireccionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List pesquisar(Marca marca, ClaseServicio claseServicio, + Date fecInicio, Date fecFinal) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (marca != null) { + c.add(Restrictions.eq("marca", marca)); + } + + if (claseServicio != null) { + c.add(Restrictions.eq("claseServicio", claseServicio)); + } + + if (fecInicio != null) { + c.add(Restrictions.eq("fecInicioV", fecInicio)); + } + + if (fecFinal != null) { + c.add(Restrictions.eq("fecFinV", fecFinal)); + } + + return c.list(); + } + + public List buscar(CortesiaDireccion cortesiaDireccion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + +// if (cortesiaDireccion.getFecInicioV() != null) { +// c.add(Restrictions.eq("fecInicioV", cortesiaDireccion.getFecInicioV())); +// } +// +// if (cortesiaDireccion.getFecFinV() != null) { +// c.add(Restrictions.eq("fecFinV", cortesiaDireccion.getFecFinV())); +// } + + if (cortesiaDireccion.getClaseServicio() != null) { + c.add(Restrictions.eq("claseServicio", cortesiaDireccion.getClaseServicio())); + } + + if (cortesiaDireccion.getMarca() != null) { + c.add(Restrictions.eq("marca", cortesiaDireccion.getMarca())); + } + + if (cortesiaDireccion.getTipocortesiaDescuento() != null) { + c.add(Restrictions.eq("tipocortesiaDescuento", + cortesiaDireccion.getTipocortesiaDescuento())); + } + + return c.list(); + } + + public List buscarFolio(CortesiaDireccion cortesiaDireccion) { + + Integer folioInicio = cortesiaDireccion.getNumFolioInicio(); + Integer folioFim = cortesiaDireccion.getNumFolioFin(); + + String hql = "select pv from CortesiaDireccion pv " + + " where pv.activo = 1 " + + " and tipocortesiaDescuento = " + cortesiaDireccion.getTipocortesiaDescuento().getTipocortesiadescuentoId() + + " and marca = " + cortesiaDireccion.getMarca().getMarcaId() + + " and claseServicio = " + cortesiaDireccion.getClaseServicio().getClaseservicioId() + + " and (((( " + folioInicio + " BETWEEN numFolioInicio AND numFolioFin ) " + + " OR " + folioFim + " BETWEEN numFolioInicio AND numFolioFin)) " + + " OR ((numFolioInicio BETWEEN " + folioInicio + " AND " + folioFim + ") " + + " OR (numFolioFin BETWEEN " + folioInicio + " AND " + folioFim + "))) "; + + Query sq = getSession().createQuery(hql); + + return sq.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaHibernateDAO.java new file mode 100644 index 000000000..e36705460 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CortesiaHibernateDAO.java @@ -0,0 +1,79 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CortesiaDAO; +import com.rjconsultores.ventaboletos.entidad.Cortesia; +import com.rjconsultores.ventaboletos.entidad.Empleado; + +/** + * + * @author Shiro + */ +@Repository("cortesiaDAO") +public class CortesiaHibernateDAO extends GenericHibernateDAO + implements CortesiaDAO { + + @Autowired + public CortesiaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List pesquisar(Empleado empleado) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + + if (empleado != null) { + c.add(Restrictions.eq("empleado", empleado)); + } + return c.list(); + } + + public Cortesia buscar(Cortesia cortesia) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + + if (cortesia != null) { + c.add(Restrictions.eq("empleado", cortesia)); + } + return (Cortesia) c.uniqueResult(); + } + + public List buscarDplicidad(Cortesia cortesia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("empleado", cortesia.getEmpleado())); + c.add(Restrictions.eq("marca", cortesia.getMarca())); + c.add(Restrictions.eq("claseServicio", cortesia.getClaseServicio())); + c.add(Restrictions.eq("origem", cortesia.getOrigem())); + c.add(Restrictions.eq("destino", cortesia.getDestino())); + c.add(Restrictions.eq("fecinicio", cortesia.getFecinicio())); + c.add(Restrictions.eq("fecfinal", cortesia.getFecfinal())); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CotacaoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CotacaoHibernateDAO.java new file mode 100644 index 000000000..d2c1abd33 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CotacaoHibernateDAO.java @@ -0,0 +1,51 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CotacaoDAO; +import com.rjconsultores.ventaboletos.entidad.Cotacao; +import com.rjconsultores.ventaboletos.entidad.Moneda; + +@Repository("cotacaoHibernateDAO") +@SuppressWarnings("unchecked") +public class CotacaoHibernateDAO extends GenericHibernateDAO + implements CotacaoDAO { + + @Autowired + public CotacaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String descmoneda) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public void inativarCotacoesAntigas(Moneda moneda) { + + StringBuilder sql = new StringBuilder("UPDATE COTACAO SET ACTIVO = 0 WHERE MONEDA_ID = "); + sql.append(moneda.getMonedaId()); + + getSession().createSQLQuery(sql.toString()).executeUpdate(); + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlFechamentoCaixaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlFechamentoCaixaHibernateDAO.java new file mode 100644 index 000000000..0c98089c5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlFechamentoCaixaHibernateDAO.java @@ -0,0 +1,37 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; + +import org.hibernate.Query; +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.CtrlFechamentoCaixaDAO; +import com.rjconsultores.ventaboletos.entidad.CtrlFechamentoCaixa; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +@Repository("ctrlFechamentoCaixaDAO") +public class CtrlFechamentoCaixaHibernateDAO extends GenericHibernateDAO implements CtrlFechamentoCaixaDAO { + + @Autowired + public CtrlFechamentoCaixaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public CtrlFechamentoCaixa obtenerFeccorte(Date feccorte) { + StringBuilder hql = new StringBuilder(); + hql.append(" from CtrlFechamentoCaixa c ") + .append(" where c.activo = 1 ") + .append(" and c.feccorte = TO_DATE(:feccorte,'DD/MM/YYYY') "); + + Query qr = getSession().createQuery(hql.toString()); + qr.setParameter("feccorte", DateUtil.getStringDate(feccorte, "dd/MM/yyyy")); + qr.setMaxResults(1); + + return (CtrlFechamentoCaixa) qr.uniqueResult(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieBPeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieBPeHibernateDAO.java new file mode 100644 index 000000000..ab1625bb8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieBPeHibernateDAO.java @@ -0,0 +1,131 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +import javax.sql.DataSource; + +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CtrlSerieBPeDAO; +import com.rjconsultores.ventaboletos.entidad.CtrlSerieBPe; + +@Repository("ctrlSerieBPeDAO") +public class CtrlSerieBPeHibernateDAO extends GenericHibernateDAO implements CtrlSerieBPeDAO { + private static final Logger log = LoggerFactory.getLogger(CtrlSerieBPeHibernateDAO.class); + + @Autowired + private DataSource dataSource; + + @Autowired + public CtrlSerieBPeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public Boolean gerarSeqSerieBPe(Integer empresaId, String estado, Integer minvalue) throws RuntimeException { + Boolean retorno = Boolean.FALSE; + Connection conn = null; + + log.info(String.format("Gerando sequence empresaId:%s, estado:%s, minvalue:%s",empresaId,estado,minvalue)); + + try { + conn = dataSource.getConnection(); + + StringBuilder seq = new StringBuilder(); + seq.append("SERIE_BPE_"); + seq.append(estado).append("_"); + seq.append(empresaId).append("_"); + seq.append("SEQ"); + + + boolean sequenceExiste = conn.createStatement().executeQuery("select SEQUENCE_NAME from USER_SEQUENCES where SEQUENCE_NAME like '" + seq.toString() + "%'").next(); + + log.info(String.format("sequenceExiste:%s",sequenceExiste)); + + if (!sequenceExiste) { + conn.createStatement().execute("CREATE SEQUENCE " + seq.toString() + " MINVALUE 1 MAXVALUE 999 INCREMENT BY 1 START WITH " + minvalue.toString() + " ORDER NOCACHE"); + + log.info("SEQUENCIA " + seq.toString() + " GERADA COM SUCESSO."); + + retorno = Boolean.TRUE; + } + } catch (SQLException e) { + throw new RuntimeException(e); + } finally { + try { + if (conn != null && !conn.isClosed()) { + conn.close(); + } + } catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + + return retorno; + } + + public Integer buscarSequencia(Integer empresaId, String estado) { + Integer retorno = null; + + Connection conn = null; + Statement st = null; + ResultSet rs = null; + + try { + conn = dataSource.getConnection(); + + StringBuilder seq = new StringBuilder(); + seq.append("SERIE_BPE_"); + seq.append(estado).append("_"); + seq.append(empresaId).append("_"); + seq.append("SEQ"); + + StringBuilder sql = new StringBuilder(); + sql.append("select ").append(seq.toString()).append(".nextval from dual"); + + st = conn.createStatement(); + rs = st.executeQuery(sql.toString()); + + rs.next(); + + retorno = rs.getInt(1); + + } catch (SQLException e) { + throw new RuntimeException(e); + } finally { + try { if (rs != null) rs.close(); } catch (Exception e) { log.error("", e); } + try { if (st != null) st.close(); } catch (Exception e) { log.error("", e); } + + try { + if (conn != null && !conn.isClosed()) { + conn.close(); + } + } catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + + return retorno; + } + + public CtrlSerieBPe buscarPorEmpresaEstado(Integer empresaId, Integer estadoId) { + StringBuilder sb = new StringBuilder(); + sb.append("SELECT ctrl "); + sb.append("FROM CtrlSerieBPe ctrl "); + sb.append("WHERE ctrl.activo = 1 AND ctrl.empresa.empresaId = :empresaId AND ctrl.estado.estadoId = :estadoId "); + + Query qr = getSession().createQuery(sb.toString()); + qr.setInteger("empresaId", empresaId); + qr.setInteger("estadoId", estadoId); + + return (CtrlSerieBPe) qr.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieEmbarcadaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieEmbarcadaHibernateDAO.java new file mode 100644 index 000000000..3756686fb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieEmbarcadaHibernateDAO.java @@ -0,0 +1,297 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.Date; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Set; + +import org.hibernate.HibernateException; +import org.hibernate.LockOptions; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.LongType; +import org.hibernate.type.StringType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CtrlSerieEmbarcadaDAO; +import com.rjconsultores.ventaboletos.entidad.CtrlSerieEmbarcada; +import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcada; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.exception.SerieEmbarcadaNaoDisponivelException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.embarcada.SerieEmbarcada; + +@Repository("ctrlSerieEmbarcadaDAO") +public class CtrlSerieEmbarcadaHibernateDAO extends GenericHibernateDAO implements CtrlSerieEmbarcadaDAO { + private static final Logger log = LoggerFactory.getLogger(CtrlSerieEmbarcadaHibernateDAO.class); + + private static final Long MAX_NUMFOLIOSISTEMA_BPE = 999999999l; + + @Autowired + public CtrlSerieEmbarcadaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @Transactional + public CtrlSerieEmbarcada suscribir(CtrlSerieEmbarcada entity) { + entity.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entity.setFecmodif(Calendar.getInstance().getTime()); + + try { + this.getHibernateTemplate().save(entity); + getHibernateTemplate().flush(); + + return entity; + } catch (final HibernateException ex) { + throw convertHibernateAccessException(ex); + } + } + + @Transactional + @Override + public void borrar(CtrlSerieEmbarcada entity) { + entity.setActivo(Boolean.FALSE); + entity.setIndBaixado(Boolean.TRUE); + + actualizacion(entity); + } + + @Override + @Transactional + public CtrlSerieEmbarcada actualizacion(CtrlSerieEmbarcada entity) { + entity.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entity.setFecmodif(Calendar.getInstance().getTime()); + + entity = getHibernateTemplate().merge(entity); + + getHibernateTemplate().flush(); + + return entity; + } + + public Boolean validaDispositivoEmpresaEstadoCadastrado(DispositivoEmbarcada dispositivo, Empresa empresa, Estado estado) { + StringBuilder sb = new StringBuilder(); + sb.append("select count(se.ctrlSerieEmbarcadaId) "); + sb.append("from CtrlSerieEmbarcada se "); + sb.append("where se.activo = 1 and se.indBaixado = 0 "); + sb.append("and se.dispositivoEmbarcada.dispositivoEmbarcadaId = :dispositivoEmbarcadaId "); + sb.append("and se.empresa.empresaId = :empresaId "); + sb.append("and se.estado.estadoId = :estadoId "); + + Query qry = getSession().createQuery(sb.toString()); + qry.setLong("dispositivoEmbarcadaId", dispositivo.getDispositivoEmbarcadaId()); + qry.setLong("empresaId", empresa.getEmpresaId()); + qry.setLong("estadoId", estado.getEstadoId()); + + Number n = (Number) qry.uniqueResult(); + + if (n == null) { + return false; + } + + return n.longValue() > 0; + } + + @SuppressWarnings("unchecked") + public List buscarSeriesEmbarcadaDisponivel(final Integer empresaId, final Integer estadoId) { + StringBuilder sb = new StringBuilder(); + sb.append("select se.ctrlserieembarcada_id as ctrlSerieEmbarcadaId, se.serie as serie, se.numerocorrente + 1 as numero "); + sb.append("from ctrl_serie_embarcada se "); + sb.append("left join ctrl_serie_embarcada seq on seq.ctrlserieembarcadaseq_id = se.ctrlserieembarcada_id "); + sb.append("where se.activo = 1 and se.ind_baixado = 1 and se.ind_reutilizado = 0 and seq.ctrlserieembarcada_id is null and se.empresa_id = :empresaId and se.estado_id = :estadoId "); + sb.append("order by se.serie "); + + Query query = getSession().createSQLQuery(sb.toString()) + .addScalar("ctrlSerieEmbarcadaId", LongType.INSTANCE) + .addScalar("serie", StringType.INSTANCE) + .addScalar("numero", StringType.INSTANCE) + .setResultTransformer(new AliasToBeanResultTransformer(SerieEmbarcada.class)); + + query.setInteger("empresaId", empresaId); + query.setInteger("estadoId", estadoId); + + return query.list(); + } + + @SuppressWarnings("unchecked") + public CtrlSerieEmbarcada buscarCtrlSerieEmbarcada(final Long ctrlSerieEmbarcadaId) throws SerieEmbarcadaNaoDisponivelException { + CtrlSerieEmbarcada retorno = null; + + StringBuilder sb = new StringBuilder(); + sb.append("select se "); + sb.append("from CtrlSerieEmbarcada se "); + sb.append("where se.activo = 1 and se.indReutilizado = 0 and se.ctrlSerieEmbarcadaId = :ctrlSerieEmbarcadaId"); + + Session session = null; + + try { + session = getSessionFactory().openSession(); + + Query query = session.createQuery(sb.toString()); + query.setLong("ctrlSerieEmbarcadaId", ctrlSerieEmbarcadaId); + + query.setMaxResults(1); + query.setLockOptions(LockOptions.UPGRADE); + query.setTimeout(20); + + List list = query.list(); + + if (list != null && list.size() > 0) { + retorno = list.get(0); + + session.getTransaction().begin(); + + retorno.setIndReutilizado(Boolean.TRUE); + retorno.setFecmodif(new Date()); + + session.update(retorno); + + session.getTransaction().commit(); + } else { + throw new SerieEmbarcadaNaoDisponivelException(); + } + + } catch (SerieEmbarcadaNaoDisponivelException e) { + throw new SerieEmbarcadaNaoDisponivelException(); + } catch (Exception e) { + log.error("CtrlSerieEmbarcada: " + e.getMessage(), e); + + } finally { + if (session != null) { + session.flush(); + session.close(); + } + } + + return retorno; + } + + @SuppressWarnings("unchecked") + public SerieEmbarcada buscarSerieEmbarcadaDisponivel(final Integer empresaId, final Integer estadoId) throws SerieEmbarcadaNaoDisponivelException { + SerieEmbarcada retorno = null; + + StringBuilder sb = new StringBuilder(); + sb.append("select se "); + sb.append("from CtrlSerieEmbarcada se "); + sb.append("where se.indReutilizado = 0 and se.indBaixado = 1 and se.ctrlSerieEmbarcadaId in (:list)"); + sb.append("order by se.serie "); + + Set ids = buscarIdsSeriesEmbarcadaDisponivel(empresaId, estadoId); + + log.info("BuscarSerieEmbarcada :: IDs nao disponiveis"); + + if (ids.isEmpty()) { + throw new SerieEmbarcadaNaoDisponivelException(); + } + + log.info(String.format("BuscarSerieEmbarcada :: IDs teste disponivel %s" , ids.toString())); + + Session session = null; + + try { + session = getSessionFactory().openSession(); + + Query query = session.createQuery(sb.toString()); + query.setParameterList("list", ids); + + query.setLockOptions(LockOptions.UPGRADE); + query.setTimeout(20); + + List list = query.list(); + + if (list != null && list.size() > 0) { + CtrlSerieEmbarcada ctrl = list.get(0); + + session.getTransaction().begin(); + + ctrl.setIndReutilizado(Boolean.TRUE); + ctrl.setFecmodif(new Date()); + + session.update(ctrl); + + session.getTransaction().commit(); + + retorno = new SerieEmbarcada(); + retorno.setCtrlSerieEmbarcada(ctrl); + retorno.setSerie(ctrl.getSerie()); + + Long numero = Long.valueOf(ctrl.getNumeroCorrente()); + + if (!ctrl.getNumeroInicial().equals(ctrl.getNumeroCorrente())) { + numero++; + } + + log.info(String.format("BuscarSerieEmbarcada :: Numero encontrado [%d]", numero)); + + if (numero > MAX_NUMFOLIOSISTEMA_BPE) { + retorno = null; + } else { + retorno.setNumero(String.valueOf(numero)); + } + + } else { + throw new SerieEmbarcadaNaoDisponivelException(); + } + + } catch (SerieEmbarcadaNaoDisponivelException e) { + throw new SerieEmbarcadaNaoDisponivelException(); + } catch (Exception e) { + log.error("CtrlSerieEmbarcada: " + e.getMessage(), e); + } finally { + if (session != null) { + session.flush(); + session.close(); + } + } + + return retorno; + } + + @SuppressWarnings("unchecked") + public Set buscarIdsSeriesEmbarcadaDisponivel(final Integer empresaId, final Integer estadoId) { + StringBuilder sb = new StringBuilder(); + sb.append("select se.ctrlserieembarcada_id as ctrlSerieEmbarcadaId "); + sb.append("from ctrl_serie_embarcada se "); + sb.append("left join ctrl_serie_embarcada seq on seq.ctrlserieembarcadaseq_id = se.ctrlserieembarcada_id "); + sb.append("where se.ind_baixado = 1 and se.ind_reutilizado = 0 and seq.ctrlserieembarcada_id is null and se.empresa_id = :empresaId and se.estado_id = :estadoId "); + sb.append("order by se.serie "); + + Query query = getSession().createSQLQuery(sb.toString()) + .addScalar("ctrlSerieEmbarcadaId", LongType.INSTANCE); + + query.setInteger("empresaId", empresaId); + query.setInteger("estadoId", estadoId); + + return new LinkedHashSet(query.list()); + } + + public Boolean validaPossuiDispositivo(Integer empresaId, Integer estadoId, String serie) { + StringBuilder sql = new StringBuilder("") + .append("SELECT COUNT(*) ") + .append("FROM ctrl_serie_embarcada se ") + .append("WHERE se.activo = 1 AND se.empresa_id = :empresaId AND se.estado_id = :estadoId AND se.serie = :serie"); + + Query query = getSession().createSQLQuery(sql.toString()); + query.setInteger("empresaId", empresaId); + query.setInteger("estadoId", estadoId); + query.setString("serie", serie); + + Number n = (Number) query.uniqueResult(); + + if (n == null) { + return false; + } + + return n.longValue() > 0; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CuponConvenioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CuponConvenioHibernateDAO.java new file mode 100644 index 000000000..30dd0ad29 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CuponConvenioHibernateDAO.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CuponConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.CuponConvenio; +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; + +/** + * + * @author Shiro + */ +@Repository("cuponConvenioDAO") +public class CuponConvenioHibernateDAO extends GenericHibernateDAO + implements CuponConvenioDAO { + + @Autowired + public CuponConvenioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List pesquisar(TipoConvenio tipoConvenio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (tipoConvenio != null) { + c.add(Restrictions.eq("tipoConvenio", tipoConvenio)); + } + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CuponSecretariaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CuponSecretariaHibernateDAO.java new file mode 100644 index 000000000..b3ed0965a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CuponSecretariaHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.CuponSecretariaDAO; +import com.rjconsultores.ventaboletos.entidad.CuponSecretaria; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("cuponSecretariaDAO") +public class CuponSecretariaHibernateDAO extends GenericHibernateDAO + implements CuponSecretariaDAO { + + @Autowired + public CuponSecretariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CursoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CursoHibernateDAO.java new file mode 100644 index 000000000..8486d1dcc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CursoHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CursoDAO; +import com.rjconsultores.ventaboletos.entidad.Curso; + +@Repository("cursoDAO") +public class CursoHibernateDAO extends GenericHibernateDAO + implements CursoDAO { + + @Autowired + public CursoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nomcurso")); + + return c.list(); + } + + public List buscar(String nomcurso){ + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nomcurso", nomcurso)); + c.addOrder(Order.asc("nomcurso")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CustomHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CustomHibernateDAO.java new file mode 100644 index 000000000..a1349e276 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CustomHibernateDAO.java @@ -0,0 +1,53 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.CustomDAO; +import com.rjconsultores.ventaboletos.entidad.Custom; + +/** + * + * @author Lucas + */ +@Repository("customDAO") +public class CustomHibernateDAO extends GenericHibernateDAO + implements CustomDAO { + + @Autowired + public CustomHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public Custom buscar(String chave) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.ilike("chave", chave)); + + return c.list().isEmpty() ? null : (Custom) c.list().get(0); + } + + public Custom buscar(Integer sistema, String chave) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("sistema", sistema)); + c.add(Restrictions.ilike("chave", chave)); + return c.list().isEmpty() ? null : (Custom) c.list().get(0); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/DepositoBancarioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/DepositoBancarioHibernateDAO.java new file mode 100644 index 000000000..7143a1043 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/DepositoBancarioHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.DepositoBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.DepositoBancario; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("depositoBancarioDAO") +public class DepositoBancarioHibernateDAO extends GenericHibernateDAO + implements DepositoBancarioDAO { + + @Autowired + public DepositoBancarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/DescontoComissaoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/DescontoComissaoHibernateDAO.java new file mode 100644 index 000000000..bf73e597f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/DescontoComissaoHibernateDAO.java @@ -0,0 +1,45 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Query; +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.DescontoComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.DescontoComissao; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +@Repository("descontoComissaoDAO") +public class DescontoComissaoHibernateDAO extends GenericHibernateDAO implements DescontoComissaoDAO { + + @Autowired + public DescontoComissaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaDescontoComissao(Integer puntoVentaId, Integer empresaId, Date inicioPeriodo, Date fimPeriodo) { + + StringBuilder sql = new StringBuilder(); + sql.append("from DescontoComissao dc "); + sql.append("where activo = 1 "); + sql.append(" and dc.puntoVenta.puntoventaId = :puntoventaId "); + sql.append(" and dc.empresa.empresaId = :empresaId "); + sql.append(" and dc.datainicial <= TO_DATE(:datainicial,'DD/MM/YYYY HH24:MI') "); + sql.append(" and (dc.datafinal >= TO_DATE(:datafinal,'DD/MM/YYYY HH24:MI') or dc.datafinal is null)"); + + Query query = getSession().createQuery(sql.toString()); + query.setInteger("puntoventaId", puntoVentaId); + query.setInteger("empresaId", empresaId); + query.setString("datainicial", DateUtil.getStringDate(inicioPeriodo, "dd/MM/yyyy HH:mm")); + query.setString("datafinal", DateUtil.getStringDate(fimPeriodo, "dd/MM/yyyy HH:mm")); + + return query.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/DetAbastoBoletoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/DetAbastoBoletoHibernateDAO.java new file mode 100644 index 000000000..4c7decf01 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/DetAbastoBoletoHibernateDAO.java @@ -0,0 +1,130 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.List; + +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.DetAbastoBoletoDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Estacion; + +@Repository("detAbastoBoletoDAO") +public class DetAbastoBoletoHibernateDAO extends GenericHibernateDAO + implements DetAbastoBoletoDAO { + + @Autowired + public DetAbastoBoletoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public Long getSecuencia() { + + StringBuffer sql = new StringBuffer(); + sql.append(" select nummovimiento_seq.nextval from dual "); + + Query query = getSession().createSQLQuery(sql.toString()); + + BigDecimal secuencia = (BigDecimal) query.uniqueResult(); + return secuencia.longValue(); + + } + + @Override + public List buscaDetAbastoBoletos(AbastoBoleto abastoBoleto) { + + List detAbastoBoletos = findByCriteria(Restrictions.eq("abastoBoleto", abastoBoleto)); + return detAbastoBoletos; + } + + @Override + public List buscaDetAbastoBoletos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa) { + + StringBuilder queryString = new StringBuilder("from DetAbastoBoleto det where ") + .append(" det.abastoBoleto.estacion.estacionId = :origem") + .append(" and det.numseriepreimpresa = :numseriepreimpresa") + .append(" and (det.numfolioinicial >= :numfolioinicial and det.numfoliofinal <= :numfoliofinal) ") + .append(" order by det.detabastoboletoId"); + + Query query = getSession().createQuery(queryString.toString()); + query.setInteger("origem", origem.getEstacionId()); + query.setString("numseriepreimpresa", numseriepreimpresa); + query.setString("numfolioinicial", numfolioinicial); + query.setString("numfoliofinal", numfoliofinal); + + List detAbastoBoletos = query.list(); + + return detAbastoBoletos; + } + + @Transactional + public void desativaDetAbastos(List detAbastoBoletos) { + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for (DetAbastoBoleto det : detAbastoBoletos) { + det.setActivo(Boolean.FALSE); + session.update(det); + + if (++count % 20 == 0) { + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + + } + + @Override + public List buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa) { + + StringBuilder qs = new StringBuilder(); + qs.append(" from DetAbastoBoleto det "); + qs.append(" where det.activo = 1 "); + qs.append(" and det.statusoperacion = 1 "); + qs.append(" and det.abastoBoleto.estacion.estacionId = :estacion "); + qs.append(" and det.numseriepreimpresa = :numseriepreimpresa "); + + Query query = getSession().createQuery(qs.toString()); + query.setInteger("estacion", estacion.getEstacionId()); + query.setString("numseriepreimpresa", numseriepreimpresa); + + List detAbastoBoletos = query.list(); + + return detAbastoBoletos; + } + + @Override + public List buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(Aidf aidf){ + StringBuilder qs = new StringBuilder(); + + qs.append(" select detabastoboleto_id from det_abasto_boleto dat where (numseriepreimpresa like ( "); + qs.append(" select (case when ( select (coalesce "); + qs.append(" ( "); + qs.append(" (select trim((select to_char( (select aidf_id from aidf where aidf_id = :aidf_id), '000' ) from dual )) from dual) , "); + qs.append(" '-_-_' "); + qs.append(" ) "); + qs.append(" ) from dual) = '-_-_' then '' else concat ((select trim((select to_char( (select aidf_id from aidf where aidf_id = :aidf_id), '000' ) from dual )) from dual) , '%' ) end ) from dual "); + qs.append(" "); + qs.append(" ) OR dat.aidf_id = :aidf_id) and dat.activo = 1 "); + + Query query = getSession().createSQLQuery(qs.toString()); + query.setLong("aidf_id", aidf.getAidfId()); + + return query.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/DetDiagramaAutobusHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/DetDiagramaAutobusHibernateDAO.java new file mode 100644 index 000000000..a83ff0e1a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/DetDiagramaAutobusHibernateDAO.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.DetDiagramaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; + +/** + * + * @author Administrador + */ +@Repository("detDiagramaAutobusDAO") +public class DetDiagramaAutobusHibernateDAO extends GenericHibernateDAO implements DetDiagramaAutobusDAO { + + @Autowired + public DetDiagramaAutobusHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public DetDiagramaAutobus obtenerPorDiagramaAutobusAsiento(Integer diagramaAutobusId, String numAsiento) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("diagramaAutobus.diagramaautobusId", Short.valueOf(diagramaAutobusId.toString()))); + c.add(Restrictions.eq("asiento", numAsiento)); + + return (DetDiagramaAutobus) c.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/DiagramaAutobusHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/DiagramaAutobusHibernateDAO.java new file mode 100644 index 000000000..fb289ab28 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/DiagramaAutobusHibernateDAO.java @@ -0,0 +1,110 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.HibernateException; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.DiagramaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; + +/** + * + * @author Administrador + */ +@Repository("diagramaAutobusDAO") +public class DiagramaAutobusHibernateDAO extends GenericHibernateDAO + implements DiagramaAutobusDAO { + + private static final Logger log = LoggerFactory.getLogger(DiagramaAutobusHibernateDAO.class); + + @Autowired + public DiagramaAutobusHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descDiagrama")); + + return c.list(); + } + + public List buscar(String descDiagrama, Short maxparados, + Short cantasientos) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("cantasientos", cantasientos)); + c.add(Restrictions.eq("maxparados", maxparados)); + c.add(Restrictions.eq("descDiagrama", descDiagrama)); + + return c.list(); + } + + public List buscar(String descDiagrama) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descDiagrama", descDiagrama)); + + return c.list(); + } + + @Override + public DiagramaAutobus suscribir(DiagramaAutobus entity) { + try { + this.getHibernateTemplate().save(entity); + getHibernateTemplate().flush(); + updateAsientosVendibles(entity); + + return entity; + } catch (final HibernateException ex) { + + throw convertHibernateAccessException(ex); + } + } + + @Override + public DiagramaAutobus actualizacion(DiagramaAutobus entity) { + entity = getHibernateTemplate().merge(entity); + getHibernateTemplate().flush(); + updateAsientosVendibles(entity); + return entity; + } + + private void updateAsientosVendibles(DiagramaAutobus entity) { + try{ + StringBuilder qry = new StringBuilder(); + qry.append("UPDATE diagrama_autobus "); + qry.append("SET CANTASIENTOSVENDIBLES = (SELECT Count(DD.detdiagramaautobus_id) "); + qry.append(" FROM det_diagrama_autobus DD "); + qry.append(" WHERE "); + qry.append(" DD.diagramaautobus_id = :diagramaautobus_id "); + qry.append(" AND DD.vendible = 1 "); + qry.append(" AND DD.activo = 1) "); + qry.append(" WHERE diagramaautobus_id = :diagramaautobus_id "); + + Query query = getSession().createSQLQuery(qry.toString()); + query.setShort("diagramaautobus_id", entity.getDiagramaautobusId()); + query.executeUpdate(); + } catch (final Exception ex) { + throw new RuntimeException("Erro ao atualizar qtd de assentos disponíveis",ex); + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/DispositivoEmbarcadaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/DispositivoEmbarcadaHibernateDAO.java new file mode 100644 index 000000000..21c7d5d9b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/DispositivoEmbarcadaHibernateDAO.java @@ -0,0 +1,200 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.HibernateException; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Property; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.DispositivoEmbarcadaDAO; +import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcada; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; +import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro; +import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +@SuppressWarnings("unchecked") +@Repository("dispositivoEmbarcadaDAO") +public class DispositivoEmbarcadaHibernateDAO extends GenericHibernateDAO + implements DispositivoEmbarcadaDAO { + + @Autowired + public DispositivoEmbarcadaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descricao")); + + return c.list(); + } + + @Override + public DispositivoEmbarcada buscarVersaoUltimaSinc(String versaoUltimaSinc) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("versaoUltimaSinc", versaoUltimaSinc)); + + return (DispositivoEmbarcada) c.uniqueResult(); + } + + @Override + public List buscarAllVersaoUltimaSinc() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.setProjection(Projections.distinct(Property.forName("versaoUltimaSinc"))); + c.add(Restrictions.isNotNull("versaoUltimaSinc")); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("versaoUltimaSinc")); + + return (List) c.list(); + } + + @Override + public DispositivoEmbarcada buscarImeiDuplicado(String imei){ + StringBuilder sb = new StringBuilder(); + sb.append("select dp "); + sb.append("from DispositivoEmbarcada dp "); + sb.append("where dp.imei = :imei "); + + Query query = getSession().createQuery(sb.toString()); + query.setString("imei", imei); + + List list = query.list(); + + if (list.isEmpty()) { + return null; + } + + return (DispositivoEmbarcada) list.get(0); + + } + + @Override + public DispositivoEmbarcada buscarImei(String imei) { + StringBuilder sb = new StringBuilder(); + sb.append("select dp "); + sb.append("from DispositivoEmbarcada dp "); + sb.append(" inner join fetch dp.series as se "); + sb.append("where se.activo = 1 "); + sb.append(" and se.indBaixado = 0 "); + sb.append("and dp.imei = :imei "); + sb.append("and dp.activo = 1 "); + Query query = getSession().createQuery(sb.toString()); + query.setString("imei", imei); + return (DispositivoEmbarcada) query.uniqueResult(); + + } + + @Override + @Transactional + public DispositivoEmbarcada suscribir(DispositivoEmbarcada entity) { + try { + this.getHibernateTemplate().save(entity); + getHibernateTemplate().flush(); + + return entity; + } catch (final HibernateException ex) { + + throw convertHibernateAccessException(ex); + } + } + + @Override + @Transactional + public DispositivoEmbarcada actualizacion(DispositivoEmbarcada entity) { + entity = getHibernateTemplate().merge(entity); + getHibernateTemplate().flush(); + return entity; + } + + @Override + @Transactional + public DispositivoEmbarcada suscribirActualizar(DispositivoEmbarcada dispositivoEmbarcada) { + if (buscarDispositivoPorId(dispositivoEmbarcada) != null) { + actualizacion(dispositivoEmbarcada); + } else { + suscribir(dispositivoEmbarcada); + } + return dispositivoEmbarcada; + } + + @Override + public DispositivoEmbarcada buscarDispositivoPorId(DispositivoEmbarcada dispositivoEmbarcada) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("id", dispositivoEmbarcada.getDispositivoEmbarcadaId())); + + return (DispositivoEmbarcada) c.uniqueResult(); + } + + @Override + public List buscarPorEmpresaPuntoVenta(Empresa empresa, PuntoVenta puntoventa) { + StringBuilder sb = new StringBuilder(); + sb.append("from DispositivoEmbarcada de "); + sb.append("where activo = 1 "); + sb.append("and de.empresaId = :empresaId "); + sb.append("and de.puntoVentaId = :puntoVentaId "); + + Query qry = getSession().createQuery(sb.toString()); + qry.setLong("empresaId", empresa.getEmpresaId()); + qry.setLong("puntoVentaId", puntoventa.getPuntoventaId()); + + return qry.list(); + } + + @Override + public List buscarTodos() { + StringBuilder sb = new StringBuilder(); + sb.append("from DispositivoEmbarcada de "); + sb.append("where activo = 1 "); + + Query qry = getSession().createQuery(sb.toString()); + + return qry.list(); + } + + @Override + public List getListaFormaPago(Integer puntoventaId) { + String queryStr = "from FormaPagoDet fp where fp.activo = true and fp.indEmbarcada = true and fp.puntoVenta.puntoventaId = :puntoventaId"; + + Query query = getSession().createQuery(queryStr); + query.setInteger("puntoventaId", puntoventaId); + + return query.list(); + } + + @Override + public List getListaSeguroTaxaEmbarque(Integer puntoventaId) { + String queryStr = "from PtoVtaSeguro x where x.activo = true and x.puntoventaId.puntoventaId = :puntoventaId"; + + Query query = getSession().createQuery(queryStr); + query.setInteger("puntoventaId", puntoventaId); + + return query.list(); + } + + @Override + public List getListaTiposPassagensBloqueadas(Integer puntoventaId) { + String queryStr = "from PtovtaCatInd x where x.activo = true and x.indEmbarcada = true and x.puntoVenta.puntoventaId = :puntoventaId"; + + Query query = getSession().createQuery(queryStr); + query.setInteger("puntoventaId", puntoventaId); + + return query.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/DispositivoEmbarcadaHistoricoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/DispositivoEmbarcadaHistoricoHibernateDAO.java new file mode 100644 index 000000000..a2b378db9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/DispositivoEmbarcadaHistoricoHibernateDAO.java @@ -0,0 +1,82 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.HibernateException; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.DispositivoEmbarcadaHistoricoDAO; +import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcadaHistorico; + +@Repository("dispositivoEmbarcadaHistoricoDAO") +public class DispositivoEmbarcadaHistoricoHibernateDAO extends GenericHibernateDAO + implements DispositivoEmbarcadaHistoricoDAO { + + private static final Logger log = LoggerFactory.getLogger(DispositivoEmbarcadaHistoricoHibernateDAO.class); + + @Autowired + public DispositivoEmbarcadaHistoricoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descricao")); + + return c.list(); + } + + @Override + @Transactional + public DispositivoEmbarcadaHistorico suscribir(DispositivoEmbarcadaHistorico entity) { + try { + this.getHibernateTemplate().save(entity); + getHibernateTemplate().flush(); + + return entity; + } catch (final HibernateException ex) { + + throw convertHibernateAccessException(ex); + } + } + + @Override + public DispositivoEmbarcadaHistorico actualizacion(DispositivoEmbarcadaHistorico entity) { + entity = getHibernateTemplate().merge(entity); + getHibernateTemplate().flush(); + return entity; + } + + @SuppressWarnings("unchecked") + @Override + public List buscarHistoricoDispositivoPorId(Long dispositivoId) { + // Criteria c = getSession().createCriteria(getPersistentClass()); + // c.add(Restrictions.eq("activo", Boolean.TRUE)); + // c.add(Restrictions.eq("dispositivoEmbarcada.dispositivoEmbarcadaId", dispositivoId)); + // c.addOrder(Order.desc("dispositivoEmbarcadaHistId")); + // + // return (List)c.list(); + + // Mantis 16258 + // Query acima continha muitos joins fetchs desnecessários a partir de EMPRESA, que foram criados de forma não explícita. + // Assim a query retornava um número de registros além do real e não conseguia converter para a lista de DispositivoEmbarcadaHistorico + final String hql = "select dh from DispositivoEmbarcadaHistorico dh join fetch dh.dispositivoEmbarcada de where de.dispositivoEmbarcadaId = :dispositivoEmbarcadaId order by dh.dispositivoEmbarcadaHistId"; + Query query = getSession().createQuery(hql); + query.setParameter("dispositivoEmbarcadaId", dispositivoId); + + return query.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/DivisionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/DivisionHibernateDAO.java new file mode 100644 index 000000000..873dce331 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/DivisionHibernateDAO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.DivisionDAO; +import com.rjconsultores.ventaboletos.entidad.Division; + + +@Repository("divisionDAO") +public class DivisionHibernateDAO extends GenericHibernateDAO +implements DivisionDAO { + + @Autowired + public DivisionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmbarcadaDispOperadorHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmbarcadaDispOperadorHibernateDAO.java new file mode 100644 index 000000000..f08703060 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmbarcadaDispOperadorHibernateDAO.java @@ -0,0 +1,106 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.log4j.Logger; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.transform.Transformers; +import org.hibernate.type.BooleanType; +import org.hibernate.type.LongType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmbarcadaDispOperadorDAO; +import com.rjconsultores.ventaboletos.entidad.EmbarcadaDispOperador; + +@Repository("embarcadaDispOperadorDAO") +public class EmbarcadaDispOperadorHibernateDAO extends GenericHibernateDAO + implements EmbarcadaDispOperadorDAO { + private static Logger log = Logger.getLogger(EmbarcadaDispOperadorHibernateDAO.class); + + @Autowired + public EmbarcadaDispOperadorHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List buscarEmbarcadaDispOperadorPorPuntoVenta(Long puntoVentaId) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("select EMBARCADADISPOPERADOR_ID as embarcadaDispOperador, ") + .append(" DISPOSITIVOEMBARCADA_ID as dispositivoEmbarcadaId, ") + .append(" USUARIO_ID as usuarioId, ") + .append(" PUNTOVENTA_ID as puntoVentaId, ") + .append(" ACTIVO as activo ") + .append(" from embarcada_disp_operador embdispop ") + .append(" where ") + .append(" embdispop.puntoventa_id = :puntoVentaId ") + .append(" and embdispop.activo = 1 "); + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("embarcadaDispOperador", new LongType()) + .addScalar("dispositivoEmbarcadaId", new LongType()) + .addScalar("usuarioId", new LongType()) + .addScalar("puntoVentaId", new LongType()) + .addScalar("activo", new BooleanType()) + .setResultTransformer(Transformers.aliasToBean(EmbarcadaDispOperador.class)); + + qr.setLong("puntoVentaId", puntoVentaId); + return (List) qr.list(); + } + + @Transactional + @Override + public boolean removerListEmbarcadaDispOperador(List embarcadaDisOperadorList) { + try { + for (EmbarcadaDispOperador embarcadaDispOperador : embarcadaDisOperadorList) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("delete ") + .append(" from embarcada_disp_operador embdispop ") + .append(" where ") + .append(" embdispop.usuario_id = :usuarioId ") + .append(" and embdispop.dispositivoembarcada_id = :dispositivoEmbarcadaId ") + .append(" and embdispop.activo = 1 "); + Query qr = getSession().createSQLQuery(sQuery.toString()); + qr.setLong("usuarioId", embarcadaDispOperador.getUsuarioId()); + qr.setLong("dispositivoEmbarcadaId", embarcadaDispOperador.getDispositivoEmbarcadaId()); + qr.executeUpdate(); + + } + } catch (Exception e) { + log.error("Erro ao deletar dispositivos usuários"); + return false; + } + return true; + } + + @SuppressWarnings("unchecked") + @Override + public List buscarEmbarcadaDispOperadorPorDispositivo(Long dispositivoEmbarcadaId) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("select embdispop.EMBARCADADISPOPERADOR_ID as embarcadaDispOperador, ") + .append(" embdispop.DISPOSITIVOEMBARCADA_ID as dispositivoEmbarcadaId, ") + .append(" embdispop.USUARIO_ID as usuarioId, ") + .append(" embdispop.PUNTOVENTA_ID as puntoVentaId, ") + .append(" embdispop.ACTIVO as activo ") + .append(" from embarcada_disp_operador embdispop ") + .append(" JOIN OPERADOR_EMBARCADA opeEmb ON (embdispop.USUARIO_ID = opeEmb.USUARIO_ID) ") + .append(" where ") + .append(" embdispop.dispositivoembarcada_id = :dispositivoEmbarcadaId ") + .append(" and embdispop.activo = 1 ") + .append(" and opeEmb.activo = 1 "); + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("embarcadaDispOperador", new LongType()) + .addScalar("dispositivoEmbarcadaId", new LongType()) + .addScalar("usuarioId", new LongType()) + .addScalar("puntoVentaId", new LongType()) + .addScalar("activo", new BooleanType()) + .setResultTransformer(Transformers.aliasToBean(EmbarcadaDispOperador.class)); + + qr.setLong("dispositivoEmbarcadaId", dispositivoEmbarcadaId); + return (List) qr.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmbarqueCatracaRodoviariaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmbarqueCatracaRodoviariaHibernateDAO.java new file mode 100644 index 000000000..0b716abb3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmbarqueCatracaRodoviariaHibernateDAO.java @@ -0,0 +1,30 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EmbarqueCatracaRodoviariaDAO; +import com.rjconsultores.ventaboletos.entidad.EmbarqueCatracaRodoviaria; + +@Repository("embarqueCatracaRodoviariaDAO") +public class EmbarqueCatracaRodoviariaHibernateDAO + extends GenericHibernateDAO implements EmbarqueCatracaRodoviariaDAO { + + @Autowired + public EmbarqueCatracaRodoviariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria criteria = getSession().createCriteria(getPersistentClass()); + criteria.add(Restrictions.eq("activo", true)); + return criteria.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpleadoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpleadoHibernateDAO.java new file mode 100644 index 000000000..4777e6d53 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpleadoHibernateDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.EmpleadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empleado; +import java.io.Serializable; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("empleadoDAO") +public class EmpleadoHibernateDAO extends GenericHibernateDAO + implements EmpleadoDAO { + + @Autowired + public EmpleadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombEmpleado")); + return c.list(); + } + + public List pesquisaClave(String empleadoClave) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("cveEmpleado", empleadoClave)); + + return c.list(); + } + + @Override + public List pesquisaEmpresa(Integer empresaId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("empresa.empresaId", empresaId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombEmpleado")); + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaContaBancariaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaContaBancariaHibernateDAO.java new file mode 100644 index 000000000..25f023c09 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaContaBancariaHibernateDAO.java @@ -0,0 +1,27 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.EmpresaContaBancariaDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; + +@Repository("empresaContaBancariaDAO") +public class EmpresaContaBancariaHibernateDAO extends GenericHibernateDAO implements EmpresaContaBancariaDAO { + + @Autowired + public EmpresaContaBancariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public EmpresaContaBancaria suscribir(EmpresaContaBancaria entity) throws RuntimeException { + + entity = super.suscribir(entity); + + getSession().flush(); + return entity; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailConfigHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailConfigHibernateDAO.java new file mode 100644 index 000000000..996f922be --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailConfigHibernateDAO.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EmpresaEmailConfigDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailConfig; + +@Repository("empresaEmailConfigDAO") +public class EmpresaEmailConfigHibernateDAO extends GenericHibernateDAO + implements EmpresaEmailConfigDAO { + + @Autowired + public EmpresaEmailConfigHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public EmpresaEmailConfig buscarPorEmpresa(Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa", empresa)); + + return (EmpresaEmailConfig) c.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailFlexBusHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailFlexBusHibernateDAO.java new file mode 100644 index 000000000..edf3d5ec3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailFlexBusHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EmpresaEmailFlexBusDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailFlexBus; + +@Repository("empresaEmailFlexBusDAO") +public class EmpresaEmailFlexBusHibernateDAO extends GenericHibernateDAO + implements EmpresaEmailFlexBusDAO { + + @Autowired + public EmpresaEmailFlexBusHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public EmpresaEmailFlexBus buscarPorEmpresa(Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa", empresa)); + + return (EmpresaEmailFlexBus) c.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailHibernateDAO.java new file mode 100644 index 000000000..59c8b2522 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailHibernateDAO.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EmpresaEmailDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmail; + +@Repository("empresaEmailDAO") +public class EmpresaEmailHibernateDAO extends GenericHibernateDAO + implements EmpresaEmailDAO { + + @Autowired + public EmpresaEmailHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public EmpresaEmail buscarPorEmpresa(Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa", empresa)); + + return (EmpresaEmail) c.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEquivalenciaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEquivalenciaHibernateDAO.java new file mode 100644 index 000000000..2981ad4c2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEquivalenciaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.EmpresaEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEquivalencia; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("empresaEquivalenciaDAO") +public class EmpresaEquivalenciaHibernateDAO + extends GenericHibernateDAO + implements EmpresaEquivalenciaDAO { + + @Autowired + public EmpresaEquivalenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Empresa empresa, ComisionistaExterno comisionistaExterno) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("comisionistaExterno", comisionistaExterno)); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(EmpresaEquivalencia empresaEquivalencia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("equivalenciaId", empresaEquivalencia.getEquivalenciaId())); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaHibernateDAO.java new file mode 100644 index 000000000..38a5563e7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaHibernateDAO.java @@ -0,0 +1,406 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.sql.DataSource; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.Hibernate; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.hibernate.type.BooleanType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.ComEmpCategoria; +import com.rjconsultores.ventaboletos.entidad.ComEmpConferencia; +import com.rjconsultores.ventaboletos.entidad.ComEmpFormapago; +import com.rjconsultores.ventaboletos.entidad.ComEmpTipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosEmpresaResultTransformer; + +/** + * + * @author Administrador + */ +@Repository("empresaDAO") +public class EmpresaHibernateDAO extends GenericHibernateDAO implements EmpresaDAO { + + private static String FOLIO_SISTEMA_BPE = "FOLIO_SISTEMA_BPE_"; + private static String FS_BPE = "FS_BPE_"; + private static String FOLIO_SISTEMA = "FOLIO_SISTEMA_"; + + @Autowired + private DataSource dataSource; + + @Autowired + public EmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ne("empresaId", -1)); + c.addOrder(Order.asc("nombempresa")); + + @SuppressWarnings("unchecked") + List retorno =(List) c.list(); + + for(Empresa empresa : retorno) { + Hibernate.initialize(empresa); + Hibernate.initialize(empresa.getInscricoesEstaduais()); + } + + return retorno; + } + + @SuppressWarnings("unchecked") + public List buscar(String nombempresa, Boolean indExterna, Short indTipo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombempresa", nombempresa)); + c.add(Restrictions.eq("indExterna", indExterna)); + c.add(Restrictions.eq("indTipo", indTipo)); + c.add(Restrictions.ne("empresaId", -1)); + + return c.list(); + } + + public List buscarTodosExceto(List empresa, Integer... idEmpresa) { + if (idEmpresa == null || idEmpresa.length == 0) { + return empresa; + } + + List empresaList = new ArrayList(); + List lsEmpresa = Arrays.asList(idEmpresa); + for (Empresa e : empresa) { + if (!lsEmpresa.contains(e.getEmpresaId())) { + empresaList.add(e); + } + } + + return empresaList; + + } + + @SuppressWarnings("unchecked") + public List obtenerIndExternoFalse() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("indExterna", Boolean.FALSE)); + c.add(Restrictions.ne("empresaId", -1)); + + c.addOrder(Order.asc("nombempresa")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + public List obtenerIndTipo2() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("indTipo", new Short("2"))); + + // Nao Buscar Empresa todas + c.add(Restrictions.ne("empresaId", -1)); + + c.addOrder(Order.asc("nombempresa")); + + return c.list(); + } + + public List buscarNotInPuntoVtaComissao(PuntoVenta puntoVenta) { + StringBuilder sb = new StringBuilder(); + + sb.append(" select em "); + sb.append(" from Empresa em "); + sb.append(" where em.activo = 1 "); + sb.append(" and em.empresaId not in ( "); + sb.append(" select pc.empresaId.empresaId from PtovtaComissao pc "); + sb.append(" where pc.activo = 1 and pc.puntoventaId.puntoventaId = :puntoventaId "); + sb.append(" )"); + sb.append(" and em.empresaId != -1 "); + sb.append(" order by em.nombempresa"); + + Query query = getSession().createQuery(sb.toString()); + query.setParameter("puntoventaId", puntoVenta.getPuntoventaId()); + + @SuppressWarnings("unchecked") + List lsEmpresa = query.list(); + + return lsEmpresa; + + } + + @SuppressWarnings("unchecked") + @Override + public List buscaInscricoesEstaduais(Empresa empresa) { + + Criteria c = getSession().createCriteria(InscricaoEstadual.class); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public void actualizaInscEstadual(InscricaoEstadual inscricaoEstadual) { + + Session session = getSessionFactory().getCurrentSession(); + session.saveOrUpdate(inscricaoEstadual); + + if(inscricaoEstadual.getIndHabilitaIEDescentralizada()) { + gerarSequenceBPeInscricaoEstadual(inscricaoEstadual); + } + + session.flush(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaLike(String nombempresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.like("nombempresa", nombempresa, MatchMode.START)); + c.add(Restrictions.ne("empresaId", -1)); + + c.addOrder(Order.asc("nombempresa")); + + return c.list(); + } + + @Override + public Empresa suscribir(Empresa entity) { + + entity = super.suscribir(entity); + + getSession().flush(); + + try { + gerarSeqNumFolioSistema(entity.getEmpresaId()); + } catch (SQLException e) { + e.printStackTrace(); + } + + return entity; + } + + @Override + public Empresa actualizacion(Empresa entity) { + entity = super.actualizacion(entity); + + try { + gerarSeqNumFolioSistema(entity.getEmpresaId()); + } catch (SQLException e) { + e.printStackTrace(); + } + + return entity; + } + + private void gerarSeqNumFolioSistema(Integer idEmpresa) throws SQLException { + final Connection conn = dataSource.getConnection(); + try { + geraSequence(conn, idEmpresa, false); + geraSequence(conn, idEmpresa, true); + } finally { + conn.close(); + } + } + + @SuppressWarnings("unchecked") + private void geraSequence(final Connection conn, final Integer idEmpresa, final Boolean isFolioBpe) throws SQLException { + final Statement statement = conn.createStatement(); + try { + List lista = getSession().createSQLQuery(obtemSqlSequence(idEmpresa, isFolioBpe)).list(); + for (String instrucao : lista) { + statement.execute(instrucao); + } + } finally { + statement.close(); + } + } + + private String obtemSqlSequence(Integer idEmpresa, Boolean isFolioBpe) { + StringBuilder sql = new StringBuilder(); + sql.append("SELECT 'CREATE SEQUENCE ' || SEQUENCIA || ' INCREMENT BY 1 START WITH 1 NOCACHE ORDER NOCYCLE' FROM ("); + sql.append(" SELECT DISTINCT '" + obtemNomeFolio(isFolioBpe) +"'||CVEESTADO||'_" + idEmpresa + "_SEQ' SEQUENCIA "); + sql.append(" FROM ESTADO WHERE ACTIVO = 1) TMP "); + sql.append("WHERE TMP.SEQUENCIA NOT IN( "); + sql.append(" SELECT SEQUENCE_NAME FROM USER_SEQUENCES "); + sql.append(" WHERE SEQUENCE_NAME LIKE '" + obtemNomeFolio(isFolioBpe) + "%_" + idEmpresa + "_SEQ')"); + return sql.toString(); + } + + private String obtemNomeFolio(Boolean isFolioBpe) { + return isFolioBpe ? FOLIO_SISTEMA_BPE : FOLIO_SISTEMA; + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodosIncluindoEmpresaTodas() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombempresa")); + + return c.list(); + } + + @Override + @Transactional + public ComEmpCategoria adicionarComissaoCategoria(ComEmpCategoria comEmpCategoria) { + getSession().save(comEmpCategoria); + return comEmpCategoria; + } + + @Override + @Transactional + public void removerComissaoCategoria(ComEmpCategoria comEmpCategoria) { + getSession().merge(comEmpCategoria); + } + + @Override + @Transactional + public ComEmpFormapago adicionarComissaoFormapago(ComEmpFormapago comEmpFormapago) { + getSession().save(comEmpFormapago); + return comEmpFormapago; + } + + @Override + @Transactional + public void removerComissaoFormapago(ComEmpFormapago comEmpFormapago) { + getSession().merge(comEmpFormapago); + } + + @Override + @Transactional + public ComEmpTipoEventoExtra adicionarComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra) { + getSession().save(comEmpTipoEventoExtra); + return comEmpTipoEventoExtra; + } + + @Override + @Transactional + public void removerComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra) { + getSession().merge(comEmpTipoEventoExtra); + } + + @Override + public ComEmpConferencia suscribir(ComEmpConferencia comEmpConferencia) { + getSession().save(comEmpConferencia); + return comEmpConferencia; + } + + @Override + public ComEmpConferencia actualizacion(ComEmpConferencia comEmpConferencia) { + getSession().merge(comEmpConferencia); + return comEmpConferencia; + } + + @Override + public void gerarSeqNumFolioSistema(Integer idEmpresa, String cveEstado) throws RuntimeException { + Connection conn = null; + try { + if(StringUtils.isNotBlank(cveEstado)) { + conn = dataSource.getConnection(); + if (!conn.createStatement().executeQuery("select SEQUENCE_NAME from DBA_SEQUENCES where SEQUENCE_NAME like 'FOLIO_SISTEMA_" + cveEstado + "_" + idEmpresa + "_SEQ%'").next()) { + conn.createStatement().execute("CREATE SEQUENCE FOLIO_SISTEMA_" + cveEstado + "_" + idEmpresa + "_SEQ INCREMENT BY 1 START WITH 1 NOCACHE ORDER NOCYCLE"); + } + } + } catch (SQLException e) { + throw new RuntimeException(e); + }finally { + try { + if(conn != null && !conn.isClosed()){ + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + + @Override + @SuppressWarnings("unchecked") + public List buscarEmpresaPtoVtaComissao() { + StringBuilder sQuery = new StringBuilder("SELECT DISTINCT em.EMPRESA_ID, em.NOMBEMPRESA, em.ACTIVO "); + sQuery.append("FROM PTOVTA_COMISSAO ptovta ") + .append("JOIN EMPRESA em ON em.empresa_id = ptovta.empresa_id ") + .append("WHERE ptovta.activo = 1 ") + .append("AND em.activo = 1"); + + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("EMPRESA_ID", IntegerType.INSTANCE) + .addScalar("NOMBEMPRESA", StringType.INSTANCE) + .addScalar("ACTIVO", BooleanType.INSTANCE) + .setResultTransformer(new DatosEmpresaResultTransformer()); + + return qr.list(); + } + + private void gerarSequenceBPeInscricaoEstadual(InscricaoEstadual inscricaoEstadual) { + StringBuilder nomeSequence = new StringBuilder(FS_BPE); + nomeSequence.append(inscricaoEstadual.getEstado().getCveestado()) + .append("_") + .append(inscricaoEstadual.getEmpresa().getEmpresaId()) + .append("_IE_") + .append(inscricaoEstadual.getInscricaoestadualId()) + .append("_SEQ"); + + if(!isSequenceBPeInscricaoEstadualCriada(nomeSequence.toString())) { + Connection conn = null; + try { + conn = dataSource.getConnection(); + conn.createStatement().execute("CREATE SEQUENCE " + nomeSequence.toString() + " MINVALUE 1 MAXVALUE 999999999 INCREMENT BY 1 START WITH 1 ORDER NOCACHE CYCLE"); + } catch (SQLException e) { + throw new RuntimeException(e); + }finally { + try { + if(conn != null && !conn.isClosed()){ + conn.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + } + + private boolean isSequenceBPeInscricaoEstadualCriada(String nomeSequence) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT SEQUENCE_NAME FROM USER_SEQUENCES ") + .append("WHERE SEQUENCE_NAME LIKE :nomeSequence"); + + Query qr = getSession().createSQLQuery(sQuery.toString()); + qr.setParameter("nomeSequence", nomeSequence); + qr.setMaxResults(1); + + String result = (String) qr.uniqueResult(); + + return StringUtils.isNotBlank(result); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaImpostoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaImpostoHibernateDAO.java new file mode 100644 index 000000000..e52c1eb26 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaImpostoHibernateDAO.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +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.EmpresaImpostoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +@Repository("empresaImpostoDAO") +public class EmpresaImpostoHibernateDAO extends GenericHibernateDAO + implements EmpresaImpostoDAO { + + @Autowired + public EmpresaImpostoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List buscarEmpresaImposto(Integer empresaId) { + + StringBuilder hql = new StringBuilder(); + hql.append(" from EmpresaImposto ei "); + hql.append(" where ei.activo = 1 "); + hql.append(" AND ei.empresa.empresaId = :empresaId "); + + Query query = getSession().createQuery(hql.toString()); + query.setInteger("empresaId", empresaId); + + return query.list(); + } + + @Override + public List buscarByEmpresa(Empresa empresa) { + return buscarEmpresaImposto(empresa.getEmpresaId()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaSaferConfigHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaSaferConfigHibernateDAO.java new file mode 100644 index 000000000..2282ad9a1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaSaferConfigHibernateDAO.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EmpresaSaferConfigDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaSaferConfig; + +@Repository("empresaSaferConfigDAO") +public class EmpresaSaferConfigHibernateDAO extends GenericHibernateDAO + implements EmpresaSaferConfigDAO { + + @Autowired + public EmpresaSaferConfigHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public EmpresaSaferConfig buscarPorEmpresa(Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa", empresa)); + + return (EmpresaSaferConfig) c.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaTrocoSimplesHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaTrocoSimplesHibernateDAO.java new file mode 100644 index 000000000..95c2ba0f5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaTrocoSimplesHibernateDAO.java @@ -0,0 +1,30 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EmpresaTrocoSimplesDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaTrocoSimples; + +@Repository("empresaTrocoSimplesDAO") +public class EmpresaTrocoSimplesHibernateDAO extends GenericHibernateDAO implements EmpresaTrocoSimplesDAO { + + @Autowired + public EmpresaTrocoSimplesHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public EmpresaTrocoSimples buscarPorEmpresaId(Integer empresaId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa.empresaId", empresaId)); + + return (EmpresaTrocoSimples) c.uniqueResult(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EnderecoApanheHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EnderecoApanheHibernateDAO.java new file mode 100644 index 000000000..b67e43a6a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EnderecoApanheHibernateDAO.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EnderecoApanheDAO; +import com.rjconsultores.ventaboletos.entidad.EnderecoApanhe; + +@Repository("enderecoApanheDAO") +public class EnderecoApanheHibernateDAO extends GenericHibernateDAO implements EnderecoApanheDAO { + + @Autowired + public EnderecoApanheHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(Date datapacote, String numoperacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if(datapacote != null) { + c.add(Restrictions.eq("hotel.datapacote", datapacote)); + } + + if(StringUtils.isNotBlank(numoperacion)) { + c.add(Restrictions.eq("hotel.numoperacion", numoperacion)); + } + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EscolaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EscolaHibernateDAO.java new file mode 100644 index 000000000..358427c7c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EscolaHibernateDAO.java @@ -0,0 +1,46 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EscolaDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Escola; + +@Repository("escolaDAO") +public class EscolaHibernateDAO extends GenericHibernateDAO + implements EscolaDAO { + + @Autowired + public EscolaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombescola")); + + return c.list(); + } + + @Override + public List buscar(String nombescola, Ciudad ciudad) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombescola", nombescola)); + c.add(Restrictions.eq("ciudad", ciudad)); + c.addOrder(Order.asc("nombescola")); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAgrupacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAgrupacionHibernateDAO.java new file mode 100644 index 000000000..5d99001b2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAgrupacionHibernateDAO.java @@ -0,0 +1,86 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.commons.lang.math.NumberUtils; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Disjunction; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EsquemaAgrupacionDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaAgrupacion; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; + +/** + * + * @author RJ Consultores + */ +@Repository("esquemaAgrupacionDAO") +public class EsquemaAgrupacionHibernateDAO extends GenericHibernateDAO implements EsquemaAgrupacionDAO { + + @Autowired + public EsquemaAgrupacionHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public EsquemaAgrupacion suscribir(final EsquemaAgrupacion entity) { + + String sql = "SELECT ESQUEMA_AGRUPACION_SEQ.NEXTVAL FROM DUAL"; + Object o = this.getSession().createSQLQuery(sql).uniqueResult(); + entity.setEsquemaagrupacionId(Integer.valueOf(o.toString())); + + EsquemaAgrupacion esquemaAgrupacion = super.suscribir(entity); + this.getSession().flush(); + return esquemaAgrupacion; + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(EsquemaAgrupacion esquemaAgrupacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("esquemaAgrupacion", esquemaAgrupacion)); + return c.list(); + } + + public EsquemaAgrupacion obtenerByEsquemaAgrupacion( + Integer ec) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("numagrupacion", ec)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (EsquemaAgrupacion) c.uniqueResult(); + } + + @Override + public boolean buscarNumAgrupacion(Integer numAgrupacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("numagrupacion", numAgrupacion)); + + if (c.list().isEmpty()) { + return false; + } else { + return true; + } + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAsientoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAsientoHibernateDAO.java new file mode 100644 index 000000000..5a41a4274 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaAsientoHibernateDAO.java @@ -0,0 +1,54 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.EsquemaAsientoDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaAsiento; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("esquemaAsientoHibernateDAO") +public class EsquemaAsientoHibernateDAO extends GenericHibernateDAO implements EsquemaAsientoDAO { + + @Autowired + public EsquemaAsientoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List obtenerPorCorrida(EsquemaCorrida esquemaCorrida) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("esquemaCorrida", esquemaCorrida)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public EsquemaAsiento obtenerPorCorridaeAsiento(EsquemaCorrida esquemaCorrida, String asiento) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("esquemaCorrida", esquemaCorrida)); + c.add(Restrictions.eq("numasiento", asiento)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + EsquemaAsiento ea = new EsquemaAsiento(); + + List lsAsientos = c.list(); + + if (!lsAsientos.isEmpty()) { + ea = lsAsientos.get(0); + } + + return ea; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaCorridaEmbarqueDesembarqueHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaCorridaEmbarqueDesembarqueHibernateDAO.java new file mode 100644 index 000000000..57c4f9f36 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaCorridaEmbarqueDesembarqueHibernateDAO.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaEmbarqueDesembarqueDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorridaEmbarqueDesembarque; + +@Repository("esquemaCorridaEmbarqueDesembarqueHibernateDAO") +public class EsquemaCorridaEmbarqueDesembarqueHibernateDAO extends GenericHibernateDAO implements EsquemaCorridaEmbarqueDesembarqueDAO { + + @Autowired + public EsquemaCorridaEmbarqueDesembarqueHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerPorEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("esquemaCorrida", esquemaCorrida)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaCorridaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaCorridaHibernateDAO.java new file mode 100644 index 000000000..c59e46021 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaCorridaHibernateDAO.java @@ -0,0 +1,305 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.math.NumberUtils; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Disjunction; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +/** + * + * @author Rafius + */ +@Repository("esquemaCorridaDAO") +public class EsquemaCorridaHibernateDAO extends GenericHibernateDAO implements EsquemaCorridaDAO { + + @Autowired + public EsquemaCorridaHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscarPorEmpresaCorrida(Empresa empresa) { + StringBuilder sb = new StringBuilder(); + sb.append("from EsquemaCorrida ec where ec.empresa.empresaId= :empresaId and activo = 1"); + + Query qry = getSession().createQuery(sb.toString()); + qry.setInteger("empresaId", empresa.getEmpresaId()); + + return qry.list(); + } + + @Override + public List buscarPorEsquemaOperacional( + EsquemaOperacional eo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("esquemaOperacional", eo)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public EsquemaCorrida obtenerByEsquemaCorrida( + Integer ec) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("numCorrida", ec)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + List result = c.list(); + if (!result.isEmpty()) { + return (EsquemaCorrida) result.get(NumberUtils.INTEGER_ZERO); + } + return null; + } + + @Override + public List buscar(Marca marca, RolOperativo rolOperativo, + Ruta ruta, ClaseServicio claseServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("rolOperativo", rolOperativo)); + + return c.list(); + } + + @Override + public List buscarPorRuta(Ruta ruta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("ruta", ruta)); + + return c.list(); + } + + @Override + public boolean esHijoRebote(EsquemaCorrida esquemaCorrida) { + Criteria c = makeCriteria(); + c.setProjection(Projections.rowCount()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("esquemaCorridaRebote", esquemaCorrida)); + + Long cant = HibernateFix.count(c.list()); + + return (cant > 0); + } + + /** + * Indica se o esquema é o indicado como segundo piso nas configuações de doble piso + * + * @param esquemaCorrida + * @return + */ + @Override + public boolean esSegundoPiso(EsquemaCorrida esquemaCorrida) { + Criteria c = makeCriteria(); + c.setProjection(Projections.rowCount()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numCorridaPisoExtra", esquemaCorrida.getNumCorrida())); + + Long cant = HibernateFix.count(c.list()); + + return (cant > 0); + } + + @Override + public List buscaDentroVigencia(Date dataGeracao) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + Criteria cEsquemaOperacional = c.createCriteria("esquemaOperacional"); + cEsquemaOperacional.add(Restrictions.le("fecniciovigencia", dataGeracao)); + cEsquemaOperacional.add(Restrictions.ge("fecfinvigencia", dataGeracao)); + cEsquemaOperacional.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscaDentroVigenciaQtdeDiasNull(Date dataGeracao) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.isNull("cantDiasGeneracion")); + + Criteria cEsquemaOperacional = c.createCriteria("esquemaOperacional"); + cEsquemaOperacional.add(Restrictions.le("fecniciovigencia", dataGeracao)); + cEsquemaOperacional.add(Restrictions.ge("fecfinvigencia", dataGeracao)); + cEsquemaOperacional.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public boolean buscarEsquemaCorridaExisteTramo(Tramo tramo) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + Criteria cEsquemaOperacional = c.createCriteria("esquemaTramoList"); + cEsquemaOperacional.add(Restrictions.eq("tramo", tramo)); + + if (c.list().isEmpty()) { + return false; + } else { + return true; + } + } + + @Override + public List existe(Ruta ruta, Integer paradaId) { + + Criteria c = makeCriteria(); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + Criteria cEsquemaTramo = c.createCriteria("esquemaTramoList"); + cEsquemaTramo.add(Restrictions.eq("activo", Boolean.TRUE)); + + Criteria cTramo = cEsquemaTramo.createCriteria("tramo"); + + Disjunction or = Restrictions.disjunction(); + or.add(Restrictions.eq("origem.paradaId", paradaId)); + or.add(Restrictions.eq("destino.paradaId", paradaId)); + + cTramo.add(or); + + c.setProjection(Projections.property("esquemacorridaId")); + + return c.list(); + } + + @Override + public EsquemaCorrida buscaEsquemaPorRuta(Ruta ruta) { + List lsEsquemaCorrida; + Criteria c = makeCriteria(); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setFirstResult(0); + c.setMaxResults(1); + c.createCriteria("esquemaOperacional").add(Restrictions.ge("fecfinvigencia", new Date())); + + lsEsquemaCorrida = c.list(); + return lsEsquemaCorrida.isEmpty() ? null : lsEsquemaCorrida.get(0); + } + + @Override + public EsquemaCorrida buscaEsquemaPorRutaSemVigencia(Integer rutaId, Integer numCorrida) { + List lsEsquemaCorrida; + Criteria c = makeCriteria(); + c.add(Restrictions.eq("ruta.rutaId", rutaId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numCorrida", numCorrida)); + c.setFirstResult(0); + c.setMaxResults(1); + + lsEsquemaCorrida = c.list(); + return lsEsquemaCorrida.isEmpty() ? null : lsEsquemaCorrida.get(0); + } + + @Override + public boolean buscarNumCorrida(Integer numCorrida, Integer numCorridaPisoExtra, boolean isDoublePiso) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + Disjunction or = Restrictions.disjunction(); + + if (isDoublePiso) { + or.add(Restrictions.or(Restrictions.eq("numCorridaPisoExtra", numCorridaPisoExtra), Restrictions.eq("numCorrida", numCorrida))); + or.add(Restrictions.eq("numCorrida", numCorridaPisoExtra)); + } else { + or.add(Restrictions.eq("numCorrida", numCorrida)); + } + + c.add(or); + + if (c.list().isEmpty()) { + return false; + } else { + return true; + } + } + + @Override + public EsquemaCorrida buscarPeloNumCorrida(Integer numCorrida) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numCorrida", numCorrida)); + + return (EsquemaCorrida) c.uniqueResult(); + } + + @Override + public List buscaDentroVigenciaQtdeDiasNotNull(Date dataGeracao) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.isNotNull("cantDiasGeneracion")); + + Criteria cEsquemaOperacional = c.createCriteria("esquemaOperacional"); + cEsquemaOperacional.add(Restrictions.ge("fecfinvigencia", dataGeracao)); + cEsquemaOperacional.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + @Transactional(rollbackFor = { BusinessException.class }) + public Integer atualizaServicoIntegracaoTotvs(Marca marca, Integer numcorrida) throws BusinessException { + + // update caja set integradototvs = 0 where PUNTOVENTA_ID = 269 and FECHORVENTA >= '30/03/2018' and FECHORVENTA <= '01/04/2018'; + StringBuilder sb = new StringBuilder(); + sb.append(" update esquema_corrida set integradototvs = 0 "); + sb.append(" where NUMCORRIDA = :numcorrida "); + if (marca != null) { + sb.append(" and MARCA_ID = :marcaId "); + } + SQLQuery query = getSession().createSQLQuery(sb.toString()); + if (marca != null) { + query.setInteger("marcaId", marca.getMarcaId()); + } + query.setInteger("numcorrida", numcorrida); + Integer result = query.executeUpdate(); + return result; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaOperacionalHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaOperacionalHibernateDAO.java new file mode 100644 index 000000000..ab3332515 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaOperacionalHibernateDAO.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.EsquemaOperacionalDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("esquemaOperacional") +public class EsquemaOperacionalHibernateDAO extends GenericHibernateDAO + implements EsquemaOperacionalDAO { + + @Autowired + public EsquemaOperacionalHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List dentroVigenciaEsquemaOperacional(Date dataGeracao) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.le("fecniciovigencia", dataGeracao)); + c.add(Restrictions.ge("fecfinvigencia", dataGeracao)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List dentroVigenciaEsquemaOperacional(Date dataDe, Date dataAte) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.le("fecniciovigencia", dataDe)); + c.add(Restrictions.ge("fecfinvigencia", dataAte)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaTramoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaTramoHibernateDAO.java new file mode 100644 index 000000000..a501547ed --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EsquemaTramoHibernateDAO.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.EsquemaTramoDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaTramo; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("esquemaTramoDAO") +public class EsquemaTramoHibernateDAO extends GenericHibernateDAO + implements EsquemaTramoDAO { + + @Autowired + public EsquemaTramoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List obtenerPorEsquemaCorrida(EsquemaCorrida ec) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("esquemaCorrida", ec)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List obtenerPorEsquemaCorridaOrderNumSec(EsquemaCorrida ec) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("esquemaCorrida", ec)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("numsecuencia")); + + return c.list(); + } + + public List obtenerAtivosDesativosPorEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("esquemaCorrida", esquemaCorrida)); + //c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("numsecuencia")); + + return c.list(); + } + + public Boolean verificarDuplicidadeEsquemaTramo(EsquemaTramo esquemaTramo){ + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("esquemaCorrida", esquemaTramo.getEsquemaCorrida())); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numsecuencia", esquemaTramo.getNumsecuencia())); + c.addOrder(Order.asc("numsecuencia")); + + return !c.list().isEmpty(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionHibernateDAO.java new file mode 100644 index 000000000..2be743d2e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionHibernateDAO.java @@ -0,0 +1,282 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Property; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EstacionDAO; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; + +/** + * + * @author Administrador + */ +@Repository("estacionDAO") +@SuppressWarnings({"unchecked", "rawtypes"}) +public class EstacionHibernateDAO extends GenericHibernateDAO implements EstacionDAO { + + @Autowired + public EstacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descestacion")); + + return c.list(); + } + + public List buscar(String descEstacion, String descMac, Long nunCaja, PuntoVenta pv) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if(StringUtils.isNotBlank(descEstacion)) { + c.add(Restrictions.like("descestacion", descEstacion, MatchMode.START)); + } + if(StringUtils.isNotBlank(descMac)) { + c.add(Restrictions.eq("descmac", descMac)); + } + if(nunCaja != null) { + c.add(Restrictions.eq("numcaja", nunCaja)); + } + if(pv != null) { + c.add(Restrictions.eq("puntoVenta", pv)); + } + + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + return c.list(); + } + + public List buscar(String descMac) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descmac", descMac)); + + return c.list(); + } + + public Estacion buscarPorIMEI(String imei) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("imei", imei)); + + return (Estacion) c.uniqueResult(); + } + + @Override + public List buscar(Long numCaja, PuntoVenta puntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numcaja", numCaja)); + c.add(Restrictions.eq("puntoVenta", puntoVenta)); + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + return c.list(); + } + + public List buscarEstaciones(PuntoVenta puntoVenta) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("puntoVenta", puntoVenta)); + c.addOrder(Order.asc("numcaja")); + c.addOrder(Order.asc("descestacion")); + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + return c.list(); + } + + @Override + public List buscarPuntosVentaEstacionPorUsuario(Usuario usuario) { + Criteria buscaPuntoVentasUsuario = getSession().createCriteria(getPersistentClass()) + .setProjection(Projections.distinct(Property.forName("puntoVenta"))) + .add(Restrictions.eq("activo", Boolean.TRUE)) + .add(Restrictions.eq("usuarioId", usuario.getUsuarioId())); + + return buscaPuntoVentasUsuario.list(); + } + + public Boolean temEstoque(PuntoVenta puntoVenta, Estacion estacion) { + + StringBuilder sb = new StringBuilder(); + sb.append("select dab.numseriepreimpresa as serie, "); + sb.append(" dab.numfolioinicial as folioinicial, "); + sb.append(" dab.numfoliofinal as foliofinal, "); + sb.append(" pv.nombpuntoventa as descpuntoventa, "); + sb.append(" e.numcaja as numcaja, "); + sb.append(" e.descestacion as descestacion, "); + sb.append(" fp.foliopreimpreso as folioatual, "); + sb.append(" e.estacion_id as estacionid, "); + sb.append(" ab.articulo_id as articuloid, "); + sb.append(" a.descarticulo as tipo, "); + sb.append(" em.nombempresa as nombempresa, "); + sb.append(" em.empresa_id as empresaid "); + sb.append("from det_abasto_boleto dab "); + sb.append(" inner join abasto_boleto ab "); + sb.append(" on dab.abastoboleto_id = ab.abastoboleto_id "); + sb.append(" inner join punto_venta pv "); + sb.append(" on ab.puntoventa_id = pv.puntoventa_id "); + sb.append(" inner join estacion e "); + sb.append(" on ab.estacion_id = e.estacion_id "); + sb.append(" inner join folio_preimpreso fp "); + sb.append(" on fp.estacion_id = ab.estacion_id "); + sb.append(" and fp.empresa_id = ab.empresa_id "); + sb.append(" and ( fp.numeserie = dab.numseriepreimpresa "); + sb.append(" or ( fp.numeserie is null "); + sb.append(" and dab.numseriepreimpresa is null ) ) "); + sb.append(" left join articulo a "); + sb.append(" on a.articulo_id = ab.articulo_id "); + sb.append(" left join empresa em "); + sb.append(" on em.empresa_id = ab.empresa_id "); + sb.append("where dab.statusoperacion = 1 "); + sb.append(" and fp.activo = 1 "); + sb.append(" and dab.activo = 1 "); + sb.append(" and ab.puntoventa_id = :puntoventaId "); + sb.append(" and e.estacion_id = :estacionId "); + sb.append("union "); + sb.append("select dab.numseriepreimpresa as serie, "); + sb.append(" dab.numfolioinicial as folioinicial, "); + sb.append(" dab.numfoliofinal as foliofinal, "); + sb.append(" pv.nombpuntoventa as descpuntoventa, "); + sb.append(" e.numcaja as numcaja, "); + sb.append(" e.descestacion as descestacion, "); + sb.append(" dab.numfolioinicial as folioatual, "); + sb.append(" e.estacion_id as estacionid, "); + sb.append(" ab.articulo_id as articuloid, "); + sb.append(" a.descarticulo as tipo, "); + sb.append(" em.nombempresa as nombempresa, "); + sb.append(" em.empresa_id as empresaid "); + sb.append("from det_abasto_boleto dab "); + sb.append(" inner join abasto_boleto ab "); + sb.append(" on dab.abastoboleto_id = ab.abastoboleto_id "); + sb.append(" inner join punto_venta pv "); + sb.append(" on ab.puntoventa_id = pv.puntoventa_id "); + sb.append(" inner join estacion e "); + sb.append(" on ab.estacion_id = e.estacion_id "); + sb.append(" left join articulo a "); + sb.append(" on a.articulo_id = ab.articulo_id "); + sb.append(" left join empresa em "); + sb.append(" on em.empresa_id = ab.empresa_id "); + sb.append("where dab.statusoperacion = 0 "); + sb.append(" and dab.activo = 1 "); + sb.append(" and ab.puntoventa_id = :puntoventaId "); + sb.append(" and e.estacion_id = :estacionId "); + + SQLQuery query = getSession().createSQLQuery(sb.toString()); + query.setParameter("puntoventaId", puntoVenta.getPuntoventaId()); + query.setParameter("estacionId", estacion.getEstacionId()); + + List list = query.list(); + if (list.size() > 0) + return true; + else + return false; + + } + + @Override + public List buscarEstaciones(List lsPuntoVenta) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.in("puntoVenta", lsPuntoVenta)); + c.addOrder(Order.asc("numcaja")); + c.addOrder(Order.asc("descestacion")); + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + return c.list(); + + } + + public List buscarEstacionesStockCentral(PuntoVenta puntoVenta) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("indStockCentral", Boolean.TRUE)); + c.add(Restrictions.eq("puntoVenta", puntoVenta)); + c.addOrder(Order.asc("descestacion")); + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + return c.list(); + } + + public Estacion buscarEstacionDuplicadaPorMAC(String descMac, Integer estacionId) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT e ") + .append("FROM Estacion e ") + .append("WHERE e.activo = 1") + .append("AND e.descmac = :descmac "); + + if(estacionId != null) { + sQuery.append("AND e.estacionId <> :estacionId "); + } + + Query qr = getSession().createQuery(sQuery.toString()); + qr.setParameter("descmac", descMac); + + if(estacionId != null) { + qr.setParameter("estacionId", estacionId); + } + + qr.setMaxResults(1); + + List lsEstacions = qr.list(); + + if(lsEstacions != null && !lsEstacions.isEmpty()) { + return lsEstacions.iterator().next(); + } + + return null; + } + + public Estacion buscarEstacionDuplicadaPorIMEI(String imei, Integer estacionId) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT e ") + .append("FROM Estacion e ") + .append("WHERE e.activo = 1") + .append("AND e.imei = :imei "); + + if(estacionId != null) { + sQuery.append("AND e.estacionId <> :estacionId "); + } + + Query qr = getSession().createQuery(sQuery.toString()); + qr.setParameter("imei", imei); + + if(estacionId != null) { + qr.setParameter("estacionId", estacionId); + } + + qr.setMaxResults(1); + + List lsEstacions = qr.list(); + + if(lsEstacions != null && !lsEstacions.isEmpty()) { + return lsEstacions.iterator().next(); + } + + return null; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionSitefHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionSitefHibernateDAO.java new file mode 100644 index 000000000..9abdc81d3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionSitefHibernateDAO.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EstacionSitefDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EstacionSitef; +import com.rjconsultores.ventaboletos.enums.TipoIntegracaoTEF; + +/** + * + * @author Lucas + * + */ +@Repository("estacionSitefDAO") +public class EstacionSitefHibernateDAO extends GenericHibernateDAO implements EstacionSitefDAO { + + @Autowired + public EstacionSitefHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public EstacionSitef buscar(Empresa empresa, Integer numempresa, Integer numfilial, String numpdv) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("numempresa", numempresa)); + c.add(Restrictions.eq("numfilial", numfilial)); + c.add(Restrictions.eq("numpdv", numpdv)); + c.add(Restrictions.eq("activo", true)); + List estacionsSitef = c.list(); + return estacionsSitef.isEmpty() ? null : estacionsSitef.get(0); + } + + @SuppressWarnings("unchecked") + @Override + public EstacionSitef buscar(Empresa empresa, TipoIntegracaoTEF tipoIntegracaoTEF, String numpdv, Integer numfilial) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.or(Restrictions.isNull("tipoIntegracao"), Restrictions.eq("tipoIntegracao", tipoIntegracaoTEF != null ? tipoIntegracaoTEF : TipoIntegracaoTEF.SITEF))); + c.add(Restrictions.eq("numpdv", numpdv)); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.eq("numfilial", numfilial)); + + List estacionsSitef = c.list(); + return estacionsSitef.isEmpty() ? null : estacionsSitef.get(0); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EstadoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EstadoHibernateDAO.java new file mode 100644 index 000000000..2cef940a3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EstadoHibernateDAO.java @@ -0,0 +1,181 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.DateType; +import org.hibernate.type.IntegerType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EstadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Pais; + +/** + * + * @author MCosso + */ +@Repository("estadoDAO") +public class EstadoHibernateDAO extends GenericHibernateDAO + implements EstadoDAO { + + private static Logger log = LoggerFactory.getLogger(EstadoHibernateDAO.class); + + @Autowired + public EstadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombestado")); + + return c.list(); + } + + public List buscar(String nombestado, Pais pais) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombestado", nombestado)); + c.add(Restrictions.eq("pais", pais)); + + return c.list(); + } + + public List buscarNotInEmpresaImposto(Empresa empresa) { + StringBuilder sb = new StringBuilder(); + + sb.append(" select es "); + sb.append(" from Estado es "); + sb.append(" where es.activo = 1 "); + sb.append(" and es.estadoId not in ( "); + sb.append(" select ei.estado.estadoId from EmpresaImposto ei "); + sb.append(" where ei.activo = 1 and ei.empresa.empresaId =:empresaId "); + sb.append(" )"); + sb.append(" order by es.nombestado"); + + Query query = getSession().createQuery(sb.toString()); + query.setParameter("empresaId", empresa.getEmpresaId()); + + List lsEstado = query.list(); + + return lsEstado; + } + + @Override + public List buscarCveEstado(String cveEstado) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("cveestado", cveEstado)); + return c.list(); + } + + @Override + public Map getConfiguracoesFusoVeraoParada(Integer paradaId, Date data) { + return getConfiguracoesFusoVerao(null, paradaId, data); + } + + @Override + public Map getConfiguracoesFusoVeraoPuntoventa(Integer puntoventaId, Date data) { + return getConfiguracoesFusoVerao(puntoventaId, null, data); + } + + @SuppressWarnings("unchecked") + private Map getConfiguracoesFusoVerao(final Integer puntoventaId, final Integer paradaId, final Date data) { + Map retorno = new HashMap(); + + if(puntoventaId == null && paradaId == null) { + return retorno; + } + + Calendar dataServidorFuso = new GregorianCalendar(); + dataServidorFuso.setTime(data); + + final StringBuilder sql = new StringBuilder(); + sql.append(" select e.tiempohorhuso as tiempoHorHuso, e.tiempohorverano as tiempoHorVerano, "); + sql.append(" e.feciniciohorverano as fecInicioHorVerano, e.fecfinohorverano as fecFinoHorVerano "); + sql.append(" from estado e"); + sql.append(" join ciudad c on c.estado_id = e.estado_id"); + + if (puntoventaId != null) { + sql.append(" join colonia o on o.ciudad_id = c.ciudad_id"); + sql.append(" join punto_venta p on p.colonia_id = o.colonia_id"); + } + + if(paradaId != null) { + sql.append(" join parada p on c.ciudad_id = p.ciudad_id"); + } + + sql.append(" where e.activo = 1"); + if (puntoventaId != null) { + sql.append(" and p.puntoventa_id = :puntoventaId"); + } + + if(paradaId != null) { + sql.append(" and p.parada_id = :paradaId"); + } + + try { + Query qr = getSession().createSQLQuery(sql.toString()) + .addScalar("tiempoHorHuso", IntegerType.INSTANCE) + .addScalar("tiempoHorVerano", IntegerType.INSTANCE) + .addScalar("fecInicioHorVerano", DateType.INSTANCE) + .addScalar("fecFinoHorVerano", DateType.INSTANCE) + .setResultTransformer(new AliasToBeanResultTransformer(Estado.class)); + if (puntoventaId != null) { + qr.setParameter("puntoventaId", puntoventaId); + } + if(paradaId != null) { + qr.setParameter("paradaId", paradaId); + } + + List resultado = qr.list(); + for (Estado estado : resultado) { + Integer tiempohorhuso = estado.getTiempoHorHuso(); + Integer tiempohorverano = estado.getTiempoHorVerano(); + Date feciniciohorverano = estado.getFecInicioHorVerano(); + Date fecfinohorverano = estado.getFecFinoHorVerano(); + + if (tiempohorhuso != null) { + retorno.put("tiempohorhuso", tiempohorhuso); + } + + if (fecfinohorverano != null && feciniciohorverano != null) { + if ((dataServidorFuso.getTime().equals(feciniciohorverano) + || dataServidorFuso.getTime().after(feciniciohorverano)) + && dataServidorFuso.getTime().before(fecfinohorverano)) { + retorno.put("tiempohorverano", tiempohorverano); + } + } + + break; + } + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return retorno; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EventoExtraHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EventoExtraHibernateDAO.java new file mode 100644 index 000000000..7d1dd1456 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EventoExtraHibernateDAO.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EventoExtraDAO; +import com.rjconsultores.ventaboletos.entidad.EventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; + +@Repository("eventoExtraDAO") +public class EventoExtraHibernateDAO extends + GenericHibernateDAO implements EventoExtraDAO { + + @Autowired + public EventoExtraHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List obtenerPorTipo(TipoEventoExtra tipoEventoExtra) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("tipoeventoextraId", tipoEventoExtra.getTipoeventoextraId())); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionPeajeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionPeajeHibernateDAO.java new file mode 100644 index 000000000..0529d595d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionPeajeHibernateDAO.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Hibernate; +import org.hibernate.Query; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ExcepcionPeajeDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje; +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeajeVigencia; + +@Repository("excepcionPeajeDAO") +public class ExcepcionPeajeHibernateDAO extends GenericHibernateDAO +implements ExcepcionPeajeDAO { + + @Autowired + public ExcepcionPeajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(String descconvenio, String cveconvenio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descconvenio", descconvenio)); + c.add(Restrictions.eq("cveconvenio", cveconvenio)); + + c.addOrder(Order.asc("descconvenio")); + + return c.list(); + } + + public List obtenerTodos() { + Session session = getSession(); + session.enableFilter("ativo"); + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + List list = (List)c.list(); + for (ExcepcionPeaje excepcionPeaje : list) { + if(!Hibernate.isInitialized(excepcionPeaje.getLsExcepcionPeajeVigencia())){ + Hibernate.initialize(excepcionPeaje.getLsExcepcionPeajeVigencia()); + } + } + return list; + } + + @Override + public void deletarVigencias(List excepcionPeajeVigencias) { + + for (ExcepcionPeajeVigencia epv : excepcionPeajeVigencias) { + String hql = " update ExcepcionPeajeVigencia set activo = false, fecModif = :fecModif, usuarioId = :usuarioId where excepcionPeajeVigenciaId = " + epv.getExcepcionPeajeVigenciaId(); + Query sq = getSession().createQuery(hql); + sq.setTimestamp("fecModif", epv.getFecmodif()); + sq.setInteger("usuarioId", epv.getUsuarioId()); + sq.executeUpdate(); + } + + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionRedondoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionRedondoHibernateDAO.java new file mode 100644 index 000000000..fd178be63 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionRedondoHibernateDAO.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ExcepcionRedondoDAO; +import com.rjconsultores.ventaboletos.entidad.ExcepcionRedondo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("excepcionRedondoDAO") +public class ExcepcionRedondoHibernateDAO extends GenericHibernateDAO implements ExcepcionRedondoDAO { + + @Autowired + public ExcepcionRedondoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("indtipo")); + + return c.list(); + } + + public List buscar(String indTipo, Parada origem, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("indtipo", indTipo)); + + c.addOrder(Order.asc("indtipo")); + + return c.list(); + } + + @Override + public List buscar(Parada origem, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamgeralHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamgeralHibernateDAO.java new file mode 100644 index 000000000..c3b9b0941 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamgeralHibernateDAO.java @@ -0,0 +1,63 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FechamentoParamgeralDAO; +import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Repository("fechamentoParamgeralDAO") +public class FechamentoParamgeralHibernateDAO extends GenericHibernateDAO implements FechamentoParamgeralDAO { + + + @Autowired + public FechamentoParamgeralHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscaParametrosPorEmpresas(List empresasId) { + Criteria query = getSession().createCriteria(getPersistentClass()); + query.createAlias("empresa", "emp"); + query.add(Restrictions.in("emp.empresaId", empresasId)); + query.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)query.list(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + @Override + public List buscaParametrosPorEmpresa(Integer empresaId) { + Criteria query = getSession().createCriteria(getPersistentClass()); + query.createAlias("empresa", "emp"); + query.add(Restrictions.eq("emp.empresaId", empresaId)); + query.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)query.list(); + } + + @Override + public void borrar(FechamentoParamgeral entity) { + entity.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entity.setFecmodif(Calendar.getInstance().getTime()); + entity.setActivo(Boolean.FALSE); + actualizacion(entity); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamptovtaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamptovtaHibernateDAO.java new file mode 100644 index 000000000..7d242ff69 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FechamentoParamptovtaHibernateDAO.java @@ -0,0 +1,86 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FechamentoParamptovtaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Repository("fechamentoParamptovtaDAO") +public class FechamentoParamptovtaHibernateDAO extends GenericHibernateDAO implements FechamentoParamptovtaDAO { + + + @Autowired + public FechamentoParamptovtaHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscaParametrosPorEmpresas(List empresasId) { + Criteria query = getSession().createCriteria(getPersistentClass()); + query.createAlias("empresa", "emp"); + query.add(Restrictions.in("emp.empresaId", empresasId)); + query.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)query.list(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + @Override + public List buscaParametrosPorEmpresa(Integer empresaId) { + Criteria query = getSession().createCriteria(getPersistentClass()); + query.createAlias("empresa", "emp"); + query.add(Restrictions.eq("emp.empresaId", empresaId)); + query.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)query.list(); + } + + @Override + public void borrar(FechamentoParamptovta entity) { + entity.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entity.setFecmodif(Calendar.getInstance().getTime()); + entity.setActivo(Boolean.FALSE); + actualizacion(entity); + } + + @Override + public List buscaParametrosPorPuntoventa(PuntoVenta puntoventa) { + Criteria query = getSession().createCriteria(getPersistentClass()); + query.add(Restrictions.eq("puntoventa", puntoventa)); + query.add(Restrictions.eq("activo", Boolean.TRUE)); + + List params = query.list(); + + return params; + } + + @Override + public FechamentoParamptovta buscaParametrosPorPuntoventa(PuntoVenta puntoventa, Empresa empresa) { + Criteria query = getSession().createCriteria(getPersistentClass()); + query.add(Restrictions.eq("puntoventa", puntoventa)); + query.add(Restrictions.eq("activo", Boolean.TRUE)); + query.add(Restrictions.eq("empresa", empresa)); + + return (FechamentoParamptovta) query.uniqueResult(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FeriadoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FeriadoHibernateDAO.java new file mode 100644 index 000000000..2b595d07c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FeriadoHibernateDAO.java @@ -0,0 +1,86 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Date; +import java.text.SimpleDateFormat; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FeriadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Feriado; + +@Repository("feriadoDAO") +public class FeriadoHibernateDAO extends GenericHibernateDAO implements FeriadoDAO { + + private static SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + + @Autowired + public FeriadoHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(Date descferiado) { + String hql = " select new com.rjconsultores.ventaboletos.entidad.Feriado(feriado.feriadoId, feriado.fecferiado,feriado.descferiado) from Feriado feriado" + + " where feriado.activo = 1 and feriado.fecferiado =:data"; + + Query sq = getSession().createQuery(hql); + sq.setParameter("data", descferiado); + List lsFeriado = sq.list(); + return lsFeriado; + } + + @Override + public boolean ehFeriado(Date fecFeriado, Empresa empresa, Estado estadoOrigem) { + + StringBuilder sb = new StringBuilder(""); + + sb.append(" select count(*) "); + sb.append(" from "); + sb.append(" Feriado f "); + sb.append(" where "); + sb.append(" f.activo = 1 "); + sb.append(" and f.fecferiado = TO_DATE(:fecFeriado,'dd/MM/yyyy') "); + sb.append(" and (f.estado is null or f.estado = :estado) "); + sb.append(" and (f.empresa is null or f.empresa = :empresa) "); + + + Query query = this.getSession().createQuery(sb.toString()); + query.setString("fecFeriado", sdf.format(fecFeriado)); + query.setParameter("estado",estadoOrigem); + query.setParameter("empresa",empresa); + + return HibernateFix.count(query.uniqueResult()) > 0; + } + + @Override + public List buscarDataEmpresaEstado(Date data, Empresa empresa, Estado estado) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("fecferiado", data)); + c.add(Restrictions.eq("estado", estado)); + c.add(Restrictions.eq("empresa", empresa)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalAliquotaEmpresaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalAliquotaEmpresaHibernateDAO.java new file mode 100644 index 000000000..f0d971b91 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalAliquotaEmpresaHibernateDAO.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.FiscalAliquotaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.FiscalAliquotaEmpresa; + +@Repository("fiscalAliquotaEmpresaDAO") +public class FiscalAliquotaEmpresaHibernateDAO extends GenericHibernateDAO + implements FiscalAliquotaEmpresaDAO { + + @Autowired + public FiscalAliquotaEmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java new file mode 100644 index 000000000..664927b86 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalHibernateDAO.java @@ -0,0 +1,4487 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.sql.DataSource; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; +import org.apache.log4j.Logger; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.jdbc.Work; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FiscalDAO; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; +import com.rjconsultores.ventaboletos.utilerias.StringHelper; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoBPR; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoBPRBase; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECF; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFBase; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoCCF; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoCFC; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoICF; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoPRC; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoBPS; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoDBP; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoPAR; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoRMD; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoSeqBPS; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoSeqDBP; +import com.rjconsultores.ventaboletos.utilerias.fiscal.vo.DetalhadoFiscal; +import com.rjconsultores.ventaboletos.utilerias.fiscal.vo.FiscalRdi; +import com.rjconsultores.ventaboletos.utilerias.fiscal.vo.RdiValidacion; +import com.rjconsultores.ventaboletos.utilerias.impressaormd.vo.DetalhadoRMD; +import com.rjconsultores.ventaboletos.utilerias.impressaormd.vo.ImpressaoRMD; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionNaoFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ItemFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Repository("fiscalDAO") +public class FiscalHibernateDAO extends HibernateDaoSupport implements FiscalDAO { + private static final String DATE_FORMAT_FISCAL = "yyyyMMdd"; + private static final String DATE_FORMAT_DMY = "dd/MM/yyyy"; + + private static final String CODIGO_INDICADOR_CONTR_PREVIDENCIARIA = "00000060"; + + private static Logger log = Logger.getLogger(FiscalHibernateDAO.class); + + @Autowired + private DataSource dataSource; + + @Autowired + public FiscalHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + private boolean isEstadoTodos(Integer estadoId) { + if (estadoId == -1 || estadoId == null) + return true; + else + return false; + } + + @Override + public List buscaDatosFiscaisECFManual(Date inicio, Date fim, Integer empresaId, Integer estadoId, Connection connection, boolean isBoletoHist) throws SQLException { + PreparedStatement stmt = null; + ResultSet rset = null; + + StringBuilder sql = new StringBuilder(); + sql.append("select distinct "); + sql.append(" (case when r2.numserie20 is null then '' else r2.numserie20 end) || imp.numserie20 as numImpressora, "); + sql.append(" coalesce(b.numfoliosistema, (case when r4.caja_id is null then '000001' else r4.coo end)) as coo, "); + sql.append(" to_char(b.feccreacion, 'yyyymmdd') as dataEmissao, "); + sql.append(" r4.cpfcnpjcliente as cnpjCliente, "); + sql.append(" b.caja_id as boletoId, "); + sql.append(" b.empresacorrida_id as empresaId, "); + sql.append(" b.numseriepreimpresa as serie, "); + sql.append(" a.subserie as subSerie, "); + sql.append(" a.docfiscal as aidf, "); + sql.append(" (case when s.aliasorigen_id is null then eo.estado_id else eos.estado_id end) as estadoIdOrigen, "); + sql.append(" (case when s.aliasorigen_id is null then co.codibge else cos.codibge end) as origenId, "); + sql.append(" (case when s.aliasorigen_id is null then co.codibge else cos.codibge end) as origenUf, "); + sql.append(" (case when s.aliasdestino_id is null then ed.estado_id else eds.estado_id end) as estadoIdDestino, "); + sql.append(" (case when s.aliasdestino_id is null then cd.codibge else cds.codibge end) as destinoId, "); + sql.append(" (case when s.aliasdestino_id is null then cd.codibge else cds.codibge end) as destinoUf, "); + sql.append(" imp.numcnpj as cnpjImpressora, "); + sql.append(" imp.numserie as numpdv, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" r5.imptotalliquido as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" imp.modelo as modeloImpressora, "); + sql.append(" b.usuario_id as numCaixa, "); + sql.append(" b.preciopagado as importetarifa, "); + sql.append(" cs.descclase AS claseServicio, "); + sql.append(" translate(imp.numcnpj, ' / - . ', ' ') as cnpjEcf, "); + sql.append(" coalesce(ei.icms, eos.icms) as icms, "); + sql.append(" ei.porctributo as porctributo, "); + sql.append(" case when b.indstatusboleto = 'V' or b.motivocancelacion_id is null THEN 'N' ELSE 'C' END status, "); + sql.append(" r4.indcancelamento AS indcancelamento, "); + sql.append(" b.preciopagado as valorTotal, "); + sql.append(" case b.importetaxaembarque when 0 then null else b.importetaxaembarque end as importetaxaembarque, "); + sql.append(" case b.importepedagio when 0 then null else b.importepedagio end as importepedagio, "); + sql.append(" case b.importeoutros when 0 then null else b.importeoutros end as importeoutros, "); + sql.append(" case b.importeseguro when 0 then null else b.importeseguro end as importeseguro "); + + if (isBoletoHist) + sql.append("from caja_hist b "); + else + sql.append("from caja b "); + + sql.append(" left join fiscal_r4 r4 on r4.caja_id = b.caja_id "); + sql.append(" left join fiscal_r5 r5 on r4.numserie20 = r5.numserie20 and r4.coo = r5.coo and r4.datamov = r5.datamov and r4.contador = r5.contador "); + sql.append(" left join fiscal_impressora imp on imp.numserie = b.serieimpfiscal "); + sql.append(" left join fiscal_r2 r2 on r2.numserie20 = imp.numserie20 and r2.datamov = to_char(b.feccreacion, 'YYYYMMDD') "); + sql.append(" left join clase_servicio cs on cs.claseservicio_id = b.claseservicio_id "); + sql.append(" join marca m on b.marca_id = m.marca_id "); + sql.append(" join empresa e on e.empresa_id = m.empresa_id "); + sql.append(" left join aidf a on a.aidf_id = b.aidf_id "); + sql.append(" join punto_venta pv on pv.puntoventa_id = b.puntoventa_id "); + sql.append(" join ciudad ce on ce.ciudad_id = e.ciudad_id "); + sql.append(" join estado ee on ee.estado_id = ce.estado_id "); + sql.append(" join parada po on po.parada_id = b.origen_id "); + sql.append(" join ciudad co on co.ciudad_id = po.ciudad_id "); + sql.append(" join estado eo on eo.estado_id = co.estado_id "); + sql.append(" join parada pd on pd.parada_id = b.destino_id "); + sql.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id "); + sql.append(" join estado ed on ed.estado_id = cd.estado_id "); + sql.append(" left join alias_servico s on s.origen_id = b.origen_id "); + sql.append(" and s.destino_id = b.destino_id and (s.corrida_id = b.corrida_id or s.corrida_id is null) "); + sql.append(" and s.ruta_id = b.ruta_id and s.activo = 1 "); + sql.append(" left join parada pos on pos.parada_id = s.aliasorigen_id "); + sql.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id "); + sql.append(" left join estado eos on eos.estado_id = cos.estado_id "); + sql.append(" left join parada pds on pds.parada_id = s.aliasdestino_id "); + sql.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id "); + sql.append(" left join estado eds on eds.estado_id = cds.estado_id "); + sql.append(" left join estado ae on ae.estado_id = a.estado_id "); + sql.append(" left join inscricao_estadual ie on e.empresa_id = ie.empresa_id "); + sql.append(" and ie.estado_id = (case when s.aliasorigen_id is null then eo.estado_id else eos.estado_id end) and ie.activo = 1 "); + sql.append(" left join ciudad cie on cie.ciudad_id = ie.ciudad_id "); + sql.append(" left join estado eie on eie.estado_id = cie.estado_id "); + sql.append(" left join empresa_imposto ei on ei.empresa_id = b.empresacorrida_id "); + sql.append(" and ei.estado_id = (case when s.aliasorigen_id is null then eo.estado_id else eos.estado_id end) and ei.activo = 1 "); + sql.append("where ((b.tipoventa_id = 3 and b.indstatusboleto in ('V', 'C') and b.indreimpresion = 0) "); + sql.append(" or (b.tipoventa_id in (12,18) and b.indstatusboleto = 'E' and b.numfoliosistema = b.numfoliopreimpreso)) "); + sql.append(" and (b.motivocancelacion_id is null or b.motivocancelacion_id <> 35) "); + sql.append(" and b.feccreacion >= to_date(:DATE_INICIO,'DD/MM/YYYY HH24:MI:SS') and b.feccreacion <= to_date(:DATE_FIM,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and b.empresacorrida_id = ? "); + sql.append(isEstadoTodos(estadoId) ? "" : " and (case when s.aliasorigen_id is null then eo.estado_id else eos.estado_id end) = ? "); + sql.append("ORDER BY dataEmissao, coo, modeloImpressora "); + + List listManuais = new ArrayList(); + + stmt = connection.prepareStatement(sql.toString()); + stmt.setFetchSize(100); + stmt.setString(1, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00"); + stmt.setString(2, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); + stmt.setInt(3, empresaId); + + if (!isEstadoTodos(estadoId)) + stmt.setInt(4, estadoId); + + rset = stmt.executeQuery(); + while (rset.next()) { + + ImportacionManualFiscalVO item = new ImportacionManualFiscalVO(); + + item.setNumImpressora(rset.getString("numImpressora")); + item.setCoo(rset.getString("coo")); + item.setBoletoId(rset.getLong("boletoId")); + item.setEmpresaId(rset.getInt("empresaId")); + item.setDataEmissao(rset.getString("dataEmissao")); + item.setValorTotal(rset.getBigDecimal("valorTotal")); + item.setNumItem(rset.getString("numItem")); + item.setCodProduto(rset.getString("codProduto")); + item.setNumpdv(rset.getString("numpdv")); + item.setRepTributado(rset.getString("repTributado")); + item.setTipoPassagem(rset.getString("tipoPassagem")); + item.setValorItem(rset.getBigDecimal("valorItem")); + item.setOrigenId(rset.getInt("origenId")); + + Integer origenIbge = rset.getInt("origenUf"); + item.setOrigenUf(origenIbge == null ? null : origenIbge.toString()); + + item.setDestinoId(rset.getInt("destinoId")); + + Integer destinoIbge = rset.getInt("destinoUf"); + item.setDestinoUf(destinoIbge == null ? null : destinoIbge.toString()); + + item.setModeloImpressora(rset.getString("modeloImpressora")); + item.setNumCaixa(rset.getString("numCaixa")); + item.setStatus(rset.getString("status")); + item.setSerie(rset.getString("serie")); + item.setIcms(rset.getBigDecimal("icms")); + item.setPorctributo(rset.getBigDecimal("porctributo")); + item.setEstadoIdOrigen(rset.getInt("estadoIdOrigen")); + item.setEstadoIdDestino(rset.getInt("estadoIdDestino")); + item.setImportetaxaembarque(rset.getBigDecimal("importetaxaembarque")); + item.setImportepedagio(rset.getBigDecimal("importepedagio")); + item.setImporteoutros(rset.getBigDecimal("importeoutros")); + item.setImporteseguro(rset.getBigDecimal("importeseguro")); + item.setSubSerie(rset.getString("subSerie")); + item.setAidf(rset.getString("aidf")); + item.setClaseServicio(rset.getString("claseServicio")); + + listManuais.add(item); + } + + return listManuais; + + } + + private String sqlFiscaisReducaoZPendencia(boolean isEstadoTodos) { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r2.datamov AS datamov, "); + sql.append(" r2.numreducoes AS numreducoes, "); + sql.append(" r2.crz AS crz, "); + sql.append(" r2.numserie20 AS numserie20, "); + sql.append(" r2.coo AS coo, "); + sql.append(" r2.cro AS cro, "); + sql.append(" r2.cooinicial AS cooinicial, "); + sql.append(" r2.coofinal AS coofinal, "); + sql.append(" r2.vendabrutadiaria AS vendabrutadiaria, "); + sql.append(" r2.datareducao AS datareducao, "); + sql.append(" r2.horareducao AS horareducao, "); + sql.append(" r3.totparcial AS aliquota, "); + sql.append(" r3.valoracumulado AS imposto, "); + sql.append(" ifi.numserie AS numpdv, "); + sql.append(" TRANSLATE(t2.cnpj, ' / - . ', ' ') AS cnpj,"); + sql.append(" r2.totgeral AS gtFinal, "); + sql.append(" anterior.totgeral AS gtInicial, "); + sql.append(" CASE WHEN r3.totparcial = 'Can-T' THEN 'CANCELADO' "); + sql.append(" WHEN r3.totparcial = 'DT' THEN 'DESCONTO' ELSE '' END AS status "); + sql.append("FROM fiscal_r2 r2 "); + sql.append(" inner join fiscal_impressora ifi "); + sql.append(" ON ifi.numserie20 = r2.numserie20 "); + sql.append(" inner join fiscal_r3 r3 "); + sql.append(" ON r3.crz = r2.crz "); + sql.append(" AND r2.numserie20 = r3.numserie20 "); + sql.append(" AND r3.datamov = r2.datamov "); + sql.append(" AND r3.fiscalimpressora_id = ifi.fiscalimpressora_id "); + sql.append(" inner join fiscal_t2 t2 "); + sql.append(" ON ifi.fiscalimpressora_id = t2.fiscalimpressora_id "); + sql.append(" inner join empresa e ON ( t2.cnpj = e.cnpjnumero ) or "); + sql.append(" ( t2.cnpj in "); + sql.append(" (select TRANSLATE(cnpj, ' / - . ', ' ') from inscricao_estadual where empresa_id = ? and activo = 1 )) "); + sql.append(" inner join inscricao_estadual ie ON e.empresa_id = ie.empresa_id, "); + sql.append(" (SELECT numserie20, crz, totgeral "); + sql.append(" FROM fiscal_r2) anterior "); + sql.append("WHERE r2.datamov BETWEEN ? AND ? "); + sql.append(" AND r2.activo = 1 "); + sql.append(" AND e.empresa_id = ? "); + sql.append(isEstadoTodos ? "" : " AND ie.estado_id = ? "); + sql.append(" AND r3.totparcial IN ("); + sql.append("'" + SituacaoTributaria.CANCELADO.getValue() + "'").append(", "); + sql.append("'" + SituacaoTributaria.DESCONTO.getValue() + "'").append(")"); + sql.append(" AND anterior.numserie20 = r2.numserie20 "); + sql.append(" AND anterior.crz = r2.crz - 1 "); + sql.append(" AND (SELECT MAX(fiscalr4_id) FROM fiscal_r4 r4 WHERE r4.numserie20 = r2.numserie20 "); + sql.append(" AND r4.datamov = r2.datamov) IS NOT NULL "); + sql.append("GROUP BY r2.datamov, "); + sql.append(" r2.numreducoes, "); + sql.append(" r2.crz, "); + sql.append(" r2.numserie20, "); + sql.append(" r2.coo, "); + sql.append(" r2.cro, "); + sql.append(" r2.cooinicial, "); + sql.append(" r2.coofinal, "); + sql.append(" r2.vendabrutadiaria, "); + sql.append(" r2.datareducao, "); + sql.append(" r2.horareducao, "); + sql.append(" r3.totparcial, "); + sql.append(" r3.valoracumulado, "); + sql.append(" ifi.numserie, "); + sql.append(" t2.cnpj, "); + sql.append(" r2.totgeral, "); + sql.append(" anterior.totgeral "); + sql.append("ORDER BY r2.datamov, "); + sql.append(" numserie20, "); + sql.append(" crz, "); + sql.append(" r2.numreducoes, "); + sql.append(" r3.totparcial desc "); + return sql.toString(); + } + + private String sqlFiscaisReducaoZPendenciaInconcistencias(boolean isEstadoTodos) { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r2.datamov AS datamov, "); + sql.append(" r2.numreducoes AS numreducoes, "); + sql.append(" r2.crz AS crz, "); + sql.append(" r2.numserie20 AS numserie20, "); + sql.append(" r2.coo AS coo, "); + sql.append(" r2.cro AS cro, "); + sql.append(" r2.cooinicial AS cooinicial, "); + sql.append(" r2.coofinal AS coofinal, "); + sql.append(" r2.vendabrutadiaria AS vendabrutadiaria, "); + sql.append(" r2.datareducao AS datareducao, "); + sql.append(" r2.horareducao AS horareducao, "); + sql.append(" r3.totparcial AS aliquota, "); + sql.append(" r3.valoracumulado AS imposto, "); + sql.append(" ifi.numserie AS numpdv, "); + sql.append(" t2.cnpj AS cnpj,"); + sql.append(" r2.totgeral AS gtFinal, "); + sql.append(" anterior.totgeral AS gtInicial, "); + sql.append(" 'INCONSISTENTE' AS status "); + sql.append("FROM fiscal_r2 r2 "); + sql.append(" inner join fiscal_impressora ifi "); + sql.append(" ON ifi.numserie20 = r2.numserie20 "); + sql.append(" inner join fiscal_r3 r3 "); + sql.append(" ON r3.crz = r2.crz "); + sql.append(" AND r2.numserie20 = r3.numserie20 "); + sql.append(" AND r3.datamov = r2.datamov "); + sql.append(" AND r3.fiscalimpressora_id = ifi.fiscalimpressora_id "); + sql.append(" inner join fiscal_t2 t2 "); + sql.append(" ON ifi.fiscalimpressora_id = t2.fiscalimpressora_id "); + sql.append(" inner join empresa e ON ( t2.cnpj = e.cnpjnumero ) or "); + sql.append(" ( t2.cnpj in "); + sql.append(" (select TRANSLATE(cnpj, ' / - . ', ' ') from inscricao_estadual where empresa_id = ? and activo = 1 )) "); + sql.append(" inner join inscricao_estadual ie ON e.empresa_id = ie.empresa_id, "); + sql.append(" (SELECT numserie20, crz, totgeral "); + sql.append(" FROM fiscal_r2) anterior "); + sql.append("WHERE r2.datamov BETWEEN ? AND ? "); + sql.append(" AND r2.activo = 1 "); + sql.append(" AND e.empresa_id = ? "); + sql.append(isEstadoTodos ? "" : " AND ie.estado_id = ? "); + sql.append(" AND r3.totparcial not in ("); + sql.append("'" + SituacaoTributaria.NAO_FISCAL.getValue() + "'").append(")"); + sql.append(" AND anterior.numserie20 = r2.numserie20 "); + sql.append(" AND anterior.crz = r2.crz - 1 "); + sql.append(" AND (SELECT MAX(fiscalr4_id) FROM fiscal_r4 r4 WHERE r4.numserie20 = r2.numserie20 "); + sql.append(" AND r4.datamov = r2.datamov) IS NULL "); + sql.append("GROUP BY r2.datamov, "); + sql.append(" r2.numreducoes, "); + sql.append(" r2.crz, "); + sql.append(" r2.numserie20, "); + sql.append(" r2.coo, "); + sql.append(" r2.cro, "); + sql.append(" r2.cooinicial, "); + sql.append(" r2.coofinal, "); + sql.append(" r2.vendabrutadiaria, "); + sql.append(" r2.datareducao, "); + sql.append(" r2.horareducao, "); + sql.append(" r3.totparcial, "); + sql.append(" r3.valoracumulado, "); + sql.append(" ifi.numserie, "); + sql.append(" t2.cnpj, "); + sql.append(" r2.totgeral, "); + sql.append(" anterior.totgeral "); + sql.append("ORDER BY r2.datamov, "); + sql.append(" numserie20, "); + sql.append(" crz, "); + sql.append(" r2.numreducoes, "); + sql.append(" r3.totparcial desc "); + return sql.toString(); + } + + private String sqlFiscaisReducaoZ(boolean isEstadoTodos) { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r2.datamov AS datamov, "); + sql.append(" r2.numreducoes AS numreducoes, "); + sql.append(" r2.crz AS crz, "); + sql.append(" r2.numserie20 AS numserie20, "); + sql.append(" r2.coo AS coo, "); + sql.append(" r2.cro AS cro, "); + sql.append(" r2.cooinicial AS cooinicial, "); + sql.append(" r2.coofinal AS coofinal, "); + sql.append(" r2.vendabrutadiaria AS vendabrutadiaria, "); + sql.append(" r2.datareducao AS datareducao, "); + sql.append(" r2.horareducao AS horareducao, "); + sql.append(" r3.totparcial AS aliquota, "); + sql.append(" r3.valoracumulado AS imposto, "); + sql.append(" ifi.numserie AS numpdv, "); + sql.append(" t2.cnpj AS cnpj,"); + sql.append(" r2.totgeral AS gtFinal, "); + sql.append(" anterior.totgeral AS gtInicial, "); + sql.append(" 'NORMAL' AS status "); + sql.append("FROM fiscal_r2 r2 "); + sql.append(" inner join fiscal_impressora ifi "); + sql.append(" ON ifi.numserie20 = r2.numserie20 "); + sql.append(" inner join fiscal_r3 r3 "); + sql.append(" ON r3.crz = r2.crz "); + sql.append(" AND r2.numserie20 = r3.numserie20 "); + sql.append(" AND r3.datamov = r2.datamov "); + sql.append(" AND r3.fiscalimpressora_id = ifi.fiscalimpressora_id "); + sql.append(" inner join fiscal_t2 t2 "); + sql.append(" ON ifi.fiscalimpressora_id = t2.fiscalimpressora_id "); + sql.append(" inner join empresa e ON ( t2.cnpj = e.cnpjnumero ) or "); + sql.append(" (t2.cnpj in "); + sql.append(" (select TRANSLATE(cnpj, ' / - . ', ' ') from inscricao_estadual where empresa_id = ? and activo = 1 )) "); + sql.append(" inner join inscricao_estadual ie ON e.empresa_id = ie.empresa_id, "); + sql.append(" (SELECT numserie20, datamov, crz, totgeral "); + sql.append(" FROM fiscal_r2) anterior "); + sql.append("WHERE r2.datamov BETWEEN ? AND ? "); + sql.append(" AND r2.activo = 1 "); + sql.append(" AND e.empresa_id = ? "); + sql.append(isEstadoTodos ? "" : " AND ie.estado_id = ? "); + sql.append(" AND r3.totparcial not in ("); + sql.append("'" + SituacaoTributaria.NAO_FISCAL.getValue() + "'").append(")"); + sql.append(" AND anterior.numserie20 = r2.numserie20 "); + sql.append(" AND anterior.datamov = r2.datamov - 1 "); + sql.append(" AND to_number(anterior.crz) = to_number(r2.crz) - 1 "); + sql.append(" AND r2.vendabrutadiaria > 0 "); + sql.append("GROUP BY r2.datamov, "); + sql.append(" r2.numreducoes, "); + sql.append(" r2.crz, "); + sql.append(" r2.numserie20, "); + sql.append(" r2.coo, "); + sql.append(" r2.cro, "); + sql.append(" r2.cooinicial, "); + sql.append(" r2.coofinal, "); + sql.append(" r2.vendabrutadiaria, "); + sql.append(" r2.datareducao, "); + sql.append(" r2.horareducao, "); + sql.append(" r3.totparcial, "); + sql.append(" r3.valoracumulado, "); + sql.append(" ifi.numserie, "); + sql.append(" t2.cnpj, "); + sql.append(" r2.totgeral, "); + sql.append(" anterior.totgeral "); + sql.append("ORDER BY r2.datamov, "); + sql.append(" numserie20, "); + sql.append(" crz, "); + sql.append(" r2.numreducoes, "); + // TODO: No ambiente de produção a ordenação so vem correta quando declarado para vir como desc + // contrario aos outros servidores que deve ser asc + sql.append(" r3.totparcial desc "); + return sql.toString(); + } + + @Override + public List buscaDatosFiscaisReducaoZ(Date inicio, Date fim, Integer empresaId, Integer estadoId, boolean isPendencias, Connection connection) throws SQLException { + if (isPendencias) { + List list = new ArrayList(); + list.addAll(montarItensReducaoZ(inicio, fim, empresaId, estadoId, sqlFiscaisReducaoZPendencia(isEstadoTodos(estadoId)), connection)); + list.addAll(montarItensReducaoZ(inicio, fim, empresaId, estadoId, sqlFiscaisReducaoZPendenciaInconcistencias(isEstadoTodos(estadoId)), connection)); + return list; + + } else { + return montarItensReducaoZ(inicio, fim, empresaId, estadoId, sqlFiscaisReducaoZ(isEstadoTodos(estadoId)), connection); + } + } + + private List montarItensReducaoZ(Date inicio, Date fim, Integer empresaId, Integer estadoId, String sql, Connection connection) throws SQLException { + + List listRedZ = new ArrayList(); + PreparedStatement stmt = connection.prepareStatement(sql); + stmt.setFetchSize(100); + stmt.setInt(1, empresaId); + stmt.setString(2, DateUtil.getStringDate(inicio, DATE_FORMAT_FISCAL)); + stmt.setString(3, DateUtil.getStringDate(fim, DATE_FORMAT_FISCAL)); + stmt.setInt(4, empresaId); + + if (!isEstadoTodos(estadoId)) + stmt.setInt(5, estadoId); + + ResultSet rset = stmt.executeQuery(); + while (rset.next()) { + + ImportacionFiscalReducaoZVO item = new ImportacionFiscalReducaoZVO(); + item.setDatamov(rset.getString("datamov")); + item.setNumreducoes(rset.getString("numreducoes")); + item.setCrz(rset.getString("crz")); + item.setNumserie20(rset.getString("numserie20")); + item.setCoo(rset.getString("coo")); + item.setCro(rset.getString("cro")); + item.setCooinicial(rset.getString("cooinicial")); + item.setCoofinal(rset.getString("coofinal")); + item.setVendabrutadiaria(rset.getBigDecimal("vendabrutadiaria")); + item.setDatareducao(rset.getString("datareducao")); + item.setHorareducao(rset.getString("horareducao")); + item.setAliquota(rset.getString("aliquota")); + item.setImposto(rset.getBigDecimal("imposto")); + item.setNumpdv(rset.getString("numpdv")); + item.setCnpj(rset.getString("cnpj")); + item.setGtFinal(rset.getBigDecimal("gtFinal")); + item.setGtInicial(rset.getBigDecimal("gtInicial")); + item.setStatus(rset.getString("status")); + listRedZ.add(item); + } + + return listRedZ; + } + + private String sqlFiscaisECFCancelados(boolean isEstadoTodos, boolean isBoletoHist) { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT DISTINCT r4.numserie20 as numImpressora, "); + sql.append(" r4.coo as coo, "); + sql.append(" r4.imptotalliquido as valorTotal, "); + sql.append(" r4.datamov as dataEmissao, "); + sql.append(" r4.cpfcnpjcliente as cnpjCliente, "); + sql.append(" r4.boleto_id as boletoId, "); + sql.append(" me.empresa_id as empresaId, "); + sql.append(" co.codibge as origenId, "); + sql.append(" eo.codibge as origenUf, "); + sql.append(" cd.codibge as destinoId, "); + sql.append(" ed.codibge as destinoUf, "); + sql.append(" fi.numcnpj as cnpjImpressora, "); + sql.append(" fi.numserie as numpdv, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" r5.imptotalliquido as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" fi.modelo as modeloImpressora, "); + sql.append(" r4.usuario_id as numCaixa, "); + sql.append(" cajb.preciopagado as importetarifa, "); + sql.append(" cajb.importetaxaembarque as importetaxaembarque, "); + sql.append(" cajb.importepedagio as importepedagio, "); + sql.append(" cajb.importeseguro as importeseguro, "); + sql.append(" 'C' as status, "); + sql.append(" cajb.motivocancelacion_id as motivocancelacion, "); + sql.append(" ee.impingreso as valorMulta, "); + sql.append(" cs.descclase as claseServicio, "); + sql.append(" translate(fi.numcnpj, ' / - . ', ' ') as cnpjEcf "); + + sql.append(" FROM "); + if (isBoletoHist) + sql.append(" caja_hist caj "); + else + sql.append(" caja caj "); + + sql.append(" INNER JOIN "); + if (isBoletoHist) + sql.append(" caja_hist cajb "); + else + sql.append(" caja cajb "); + + sql.append(" on (((cajb.feccorrida = caj.feccorrida) or (cajb.feccorrida is null and caj.feccorrida is null)) "); + sql.append(" and ((cajb.numasiento = caj.numasiento) or (cajb.numasiento is null and caj.numasiento is null)) "); + sql.append(" and cajb.numfoliosistema = caj.numfoliosistema and cajb.origen_id = caj.origen_id and cajb.destino_id=caj.destino_id "); + sql.append(" and ((cajb.tipoventa_id not in (5,12,18,81,41,49) "); + sql.append(" and (cajb.indstatusboleto = 'V' or (cajb.indstatusboleto = 'T' and cajb.indreimpresion=0) )) "); + sql.append(" or (cajb.tipoventa_id in (5,12,18,81,41,49) and cajb.indstatusboleto = 'E')) ) "); + sql.append(" INNER JOIN fiscal_r4 r4 on r4.caja_id = cajb.caja_id "); + sql.append(" LEFT JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 and r4.coo = r5.coo "); + sql.append(" and r4.datamov = r5.datamov and r4.contador = r5.contador "); + sql.append(" INNER JOIN fiscal_impressora fi ON fi.numserie20 = r4.numserie20 "); + sql.append(" INNER JOIN marca me ON me.marca_id = cajb.marca_id "); + sql.append(" INNER JOIN clase_servicio cs ON cs.claseservicio_id = cajb.claseservicio_id "); + sql.append(" LEFT JOIN evento_extra ee on ee.boleto_id = r4.boleto_id and ee.tipoeventoextra_id in (42) "); + sql.append(" LEFT JOIN alias_servico ase ON ase.origen_id = cajb.origen_id "); + sql.append(" and ase.destino_id = caj.destino_id and ase.ruta_id = cajb.ruta_id and ase.activo = 1 and ase.corrida_id is null "); + sql.append(" INNER JOIN parada o ON coalesce(ase.aliasorigen_id, cajb.origen_id) = o.parada_id "); + sql.append(" INNER JOIN ciudad co ON o.ciudad_id = co.ciudad_id "); + sql.append(" INNER JOIN estado eo ON eo.estado_id = co.estado_id "); + sql.append(" INNER JOIN parada d ON coalesce(ase.aliasdestino_id, cajb.destino_id) = d.parada_id "); + sql.append(" INNER JOIN ciudad cd ON d.ciudad_id = cd.ciudad_id "); + sql.append(" INNER JOIN estado ed ON ed.estado_id = cd.estado_id "); + sql.append(" WHERE caj.feccreacion >= to_date(:DATE_INICIO,'DD/MM/YYYY HH24:MI:SS') and caj.feccreacion <= to_date(:DATE_FIM,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and me.empresa_id = :EMPRESA_ID "); + sql.append(isEstadoTodos ? "" : " AND eo.estado_id = :ESTADO_ID "); + sql.append(" and caj.motivocancelacion_id IN (31,32,10,37,99,36) "); + sql.append(" and caj.indcancelacion = 1 "); + sql.append(" and caj.indstatusboleto = 'C' "); + sql.append(" and r4.indcancelamento = 'N' "); + sql.append(" and caj.num_bpe is null "); + sql.append(" ORDER BY r4.datamov, "); + sql.append(" r4.numserie20, "); + sql.append(" r4.coo, "); + sql.append(" r5.numitem "); + return sql.toString(); + } + + private String sqlFiscaisECF(boolean isEstadoTodos, boolean isBoletoHist) { + + StringBuilder sql = new StringBuilder(); + sql.append("select distinct "); + sql.append(" (case when r2.numserie20 is null then 'X' else '' end) || imp.numserie20 as numImpressora, "); + sql.append(" (case when r4.caja_id is null then '000001' else r4.coo end) as coo, "); + sql.append(" r4.imptotalliquido as valorTotal, "); + sql.append(" to_char(c.feccreacion, 'yyyymmdd') as dataEmissao, "); + sql.append(" r4.cpfcnpjcliente as cnpjCliente, "); + sql.append(" c.caja_id as boletoId, "); + sql.append(" (case when s.aliasorigen_id is null then co.codibge else cos.codibge end) as origenId, "); + sql.append(" (case when s.aliasorigen_id is null then co.codibge else cos.codibge end) as origenUf, "); + sql.append(" (case when s.aliasdestino_id is null then cd.codibge else cds.codibge end) as destinoId, "); + sql.append(" (case when s.aliasdestino_id is null then cd.codibge else cds.codibge end) as destinoUf, "); + sql.append(" imp.numcnpj as cnpjImpressora, "); + sql.append(" imp.numserie as numpdv, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" r5.imptotalliquido as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" imp.modelo as modeloImpressora, "); + sql.append(" c.usuario_id as numCaixa, "); + sql.append(" c.preciopagado as importetarifa, "); + sql.append(" c.importetaxaembarque as importetaxaembarque, "); + sql.append(" c.importepedagio as importepedagio, "); + sql.append(" c.importeseguro as importeseguro, "); + sql.append(" cs.descclase AS claseServicio, "); + sql.append(" translate(imp.numcnpj, ' / - . ', ' ') as cnpjEcf, "); + sql.append(" (case when s.aliasorigen_id is null then ei.icms else eis.icms end) as impostoEstado, "); + sql.append(" 'N' as status, "); + sql.append(" r4.indcancelamento AS indcancelamento "); + + if (isBoletoHist) + sql.append(" from caja_hist c "); + else + sql.append(" from caja c "); + + sql.append(" join ruta r on r.ruta_id = c.ruta_id "); + sql.append(" join parada po on po.parada_id = c.origen_id "); + sql.append(" join ciudad co on co.ciudad_id = po.ciudad_id "); + sql.append(" join estado eo on eo.estado_id = co.estado_id "); + sql.append(" join parada pd on pd.parada_id = c.destino_id "); + sql.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id "); + sql.append(" join estado ed on ed.estado_id = cd.estado_id "); + sql.append(" join empresa_imposto ei on ei.empresa_id = c.empresacorrida_id and ei.estado_id = eo.estado_id "); + sql.append(" join fiscal_impressora imp on imp.numserie = c.serieimpfiscal "); + sql.append(" left join clase_servicio cs on cs.claseservicio_id = c.claseservicio_id "); + sql.append(" left join estado e on e.estado_id = imp.estadolocal_id "); + sql.append(" left join alias_servico s on s.origen_id = c.origen_id and s.destino_id = c.destino_id and (s.corrida_id = c.corrida_id or s.corrida_id is null) and s.ruta_id = c.ruta_id and s.activo = 1 "); + sql.append(" left join parada pos on pos.parada_id = s.aliasorigen_id "); + sql.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id "); + sql.append(" left join estado eos on eos.estado_id = cos.estado_id "); + sql.append(" left join parada pds on pds.parada_id = s.aliasdestino_id "); + sql.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id "); + sql.append(" left join estado eds on eds.estado_id = cds.estado_id "); + sql.append(" left join empresa_imposto eis on eis.empresa_id = c.empresacorrida_id and eis.estado_id = eos.estado_id "); + sql.append(" left join fiscal_r4 r4 on r4.caja_id = c.caja_id "); + sql.append(" left join fiscal_r5 r5 on r4.numserie20 = r5.numserie20 and r4.coo = r5.coo and r4.datamov = r5.datamov and r4.contador = r5.contador "); + sql.append(" left join fiscal_r2 r2 on r2.numserie20 = imp.numserie20 and r2.datamov = to_char(c.feccreacion, 'YYYYMMDD') "); + sql.append(" where c.activo = 1 and po.activo = 1 and co.activo = 1 and eo.activo = 1 and ei.activo = 1 "); + sql.append(" and coalesce(case when s.aliasorigen_id is null then ei.activo else eis.activo end, 0) = 1 "); + sql.append(" and c.serieimpfiscal is not null "); + sql.append(" and c.num_bpe is null "); + sql.append(" and ((c.indreimpresion = 0 and c.motivocancelacion_id is null and c.numfoliosistema is not null) or (c.indstatusboleto = 'E' and c.indreimpresion = 1)) "); + // sql.append(" and (coalesce(c.preciopagado,0) + coalesce(c.importetaxaembarque,0) + coalesce(c.importeseguro,0) + coalesce(c.importepedagio,0) + coalesce(c.importeoutros,0)) > 0 "); + // sql.append(" and ((case when coalesce(r.indtribtarifa,0) = 1 then c.preciopagado else 0 end) + (case when coalesce(r.indtribtaxaembarque,0) = 1 then c.importetaxaembarque else 0 end) + (case when coalesce(r.indtribpedagio,0) = 1 then c.importepedagio else 0 end)) > 0 "); + sql.append(" and c.feccreacion >= to_date(:DATE_INICIO,'DD/MM/YYYY HH24:MI:SS') and c.feccreacion <= to_date(:DATE_FIM,'DD/MM/YYYY HH24:MI:SS') "); + sql.append(" and c.empresacorrida_id = :EMPRESA_ID "); + sql.append(isEstadoTodos ? "" : " and ((case when s.aliasorigen_id is null then eo.estado_id else eos.estado_id end) = :ESTADO_ID )"); + sql.append("order by dataEmissao, numImpressora, coo, numItem"); + return sql.toString(); + } + + private String sqlFiscaisECFPendenciasDesconto(boolean isEstadoTodos) { + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT r4.numserie20 as numImpressora, "); + sql.append(" r4.coo as coo, "); + sql.append(" r4.imptotalliquido as valorTotal, "); + sql.append(" r4.datamov as dataEmissao, "); + sql.append(" r4.cpfcnpjcliente as cnpjCliente, "); + sql.append(" fi.numcnpj as cnpjImpressora, "); + sql.append(" fi.numserie as numpdv, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" r5.imptotalliquido as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" fi.modelo as modeloImpressora, "); + sql.append(" r4.usuario_id as numCaixa, "); + sql.append(" r5.impdesconto as desconto, "); + sql.append(" 'DESCONTO' as status"); + sql.append(" FROM fiscal_r4 r4 "); + sql.append(" INNER JOIN boleto b ON b.boleto_id = r4.boleto_id "); + sql.append(" INNER JOIN marca m ON m.marca_id = b.marca_id "); + sql.append(" LEFT JOIN alias_servico ase ON ase.origen_id = b.origen_id "); + sql.append(" and ase.destino_id = b.destino_id and ase.ruta_id = b.ruta_id and ase.activo = 1 and ase.corrida_id is null "); + sql.append(" INNER JOIN parada o ON coalesce(ase.aliasorigen_id, b.origen_id) = o.parada_id "); + sql.append(" INNER JOIN ciudad co ON o.ciudad_id = co.ciudad_id "); + + sql.append(" INNER JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 AND r4.coo = r5.coo "); + sql.append(" AND r4.datamov = r5.datamov AND r4.contador = r5.contador "); + sql.append(" LEFT JOIN fiscal_impressora fi ON fi.numserie20 = r4.numserie20 AND fi.fiscalimpressora_id = r5.fiscalimpressora_id "); + sql.append(" WHERE r4.datamov BETWEEN :STR_INICIO AND :STR_FIM "); + sql.append(" AND m.empresa_id = :EMPRESA_ID "); + sql.append(isEstadoTodos ? "" : " AND co.estado_id = :ESTADO_ID "); + sql.append(" AND r5.impdesconto <> 0 "); + sql.append(" GROUP BY r4.numserie20, r4.coo, r4.datamov, r4.cpfcnpjcliente, "); + sql.append(" r4.imptotalliquido, fi.numcnpj, fi.numserie, r5.impdesconto, "); + sql.append(" r5.totparcial, r5.imptotalliquido, r5.tipopassagem, "); + sql.append(" r5.numitem, r5.codproduto, fi.modelo, r4.usuario_id "); + sql.append(" ORDER BY r4.datamov, r4.numserie20, r4.coo, r5.numitem "); + return sql.toString(); + } + + private String sqlFiscaisECFPendenciasCancelado(boolean isEstadoTodos) { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r4.numserie20 as numImpressora, "); + sql.append(" r4.coo as coo, "); + sql.append(" r4.imptotalliquido as valorTotal, "); + sql.append(" r4.datamov as dataEmissao, "); + sql.append(" r4.cpfcnpjcliente as cnpjCliente, "); + sql.append(" b.boleto_id as boletoId, "); + sql.append(" m.empresa_id as empresaId, "); + sql.append(" fi.numcnpj as cnpjImpressora, "); + sql.append(" fi.numserie as numpdv, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" r5.imptotalliquido as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" fi.modelo as modeloImpressora, "); + sql.append(" r4.usuario_id as numCaixa, "); + sql.append(" b.preciopagado as importetarifa, "); + sql.append(" b.importetaxaembarque as importetaxaembarque, "); + sql.append(" b.importepedagio as importepedagio, "); + sql.append(" b.importeseguro as importeseguro, "); + sql.append(" translate(fi.numcnpj, ' / - . ', ' ') as cnpjEcf, "); + sql.append(" r4.indcancelamento, "); + sql.append(" 'CANCELADO' as status "); + sql.append("FROM fiscal_r4 r4 "); + sql.append(" INNER JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 AND r4.coo = r5.coo "); + sql.append(" AND r4.datamov = r5.datamov AND r4.contador = r5.contador "); + sql.append(" INNER JOIN fiscal_impressora fi ON fi.numserie20 = r4.numserie20 AND fi.fiscalimpressora_id = r5.fiscalimpressora_id "); + sql.append(" INNER JOIN boleto b ON b.boleto_id = r4.boleto_id "); + sql.append(" INNER JOIN marca m ON m.marca_id = b.marca_id "); + sql.append(" LEFT JOIN alias_servico ase ON ase.origen_id = b.origen_id "); + sql.append(" and ase.destino_id = b.destino_id and ase.ruta_id = b.ruta_id and ase.activo = 1 and ase.corrida_id is null "); + sql.append(" INNER JOIN parada o ON coalesce(ase.aliasorigen_id, b.origen_id) = o.parada_id "); + sql.append(" INNER JOIN ciudad co ON o.ciudad_id = co.ciudad_id "); + sql.append("WHERE r4.datamov BETWEEN :STR_INICIO AND :STR_FIM "); + sql.append(" AND m.empresa_id = :EMPRESA_ID "); + sql.append(isEstadoTodos ? "" : " AND co.estado_id = :ESTADO_ID "); + sql.append(" AND r4.indcancelamento = 'S' "); + sql.append(" AND (SELECT r3.numserie20 FROM fiscal_r3 r3 where r3.numserie20 = r4.numserie20"); + sql.append(" AND r3.datamov = r4.datamov AND r3.totparcial IN ('Can-T')) IS NOT NULL "); + sql.append("GROUP BY r4.numserie20, r4.coo, r4.datamov, "); + sql.append(" r4.cpfcnpjcliente, r4.imptotalliquido, "); + sql.append(" b.boleto_id, m.empresa_id, fi.numcnpj, "); + sql.append(" fi.numserie, r5.impdesconto, r5.totparcial, "); + sql.append(" r5.imptotalliquido, r5.tipopassagem, r5.numitem, "); + sql.append(" r5.codproduto, fi.modelo, r4.usuario_id, "); + sql.append(" b.preciopagado, b.importetaxaembarque, b.importepedagio, "); + sql.append(" b.importeseguro, fi.numcnpj, r4.indcancelamento, r4.indcancelamento "); + sql.append("ORDER BY r4.datamov, r4.numserie20, r4.coo, r5.numitem "); + return sql.toString(); + } + + private String sqlFiscaisECFPendenciasGratuidade(boolean isEstadoTodos) { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r4.numserie20 as numImpressora, "); + sql.append(" r4.coo as coo, "); + sql.append(" r4.imptotalliquido as valorTotal, "); + sql.append(" r4.datamov as dataEmissao, "); + sql.append(" r4.cpfcnpjcliente as cnpjCliente, "); + sql.append(" b.boleto_id as boletoId, "); + sql.append(" m.empresa_id as empresaId, "); + sql.append(" fi.numcnpj as cnpjImpressora, "); + sql.append(" fi.numserie as numpdv, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" r5.imptotalliquido as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" fi.modelo as modeloImpressora, "); + sql.append(" r4.usuario_id as numCaixa, "); + sql.append(" b.preciopagado as importetarifa, "); + sql.append(" b.importetaxaembarque as importetaxaembarque, "); + sql.append(" b.importepedagio as importepedagio, "); + sql.append(" b.importeseguro as importeseguro, "); + sql.append(" translate(fi.numcnpj, ' / - . ', ' ') as cnpjEcf, "); + sql.append(" r4.indcancelamento, "); + sql.append(" 'GRATUIDADE' as status "); + sql.append("FROM fiscal_r4 r4 "); + sql.append(" INNER JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 AND r4.coo = r5.coo "); + sql.append(" AND r4.datamov = r5.datamov AND r4.contador = r5.contador "); + sql.append(" INNER JOIN fiscal_impressora fi ON fi.numserie20 = r4.numserie20 AND fi.fiscalimpressora_id = r5.fiscalimpressora_id "); + sql.append(" INNER JOIN boleto b ON b.boleto_id = r4.boleto_id "); + sql.append(" INNER JOIN marca m ON m.marca_id = b.marca_id "); + sql.append(" LEFT JOIN alias_servico ase ON ase.origen_id = b.origen_id "); + sql.append(" and ase.destino_id = b.destino_id and ase.ruta_id = b.ruta_id and ase.activo = 1 and ase.corrida_id is null "); + sql.append(" INNER JOIN parada o ON coalesce(ase.aliasorigen_id, b.origen_id) = o.parada_id "); + sql.append(" INNER JOIN ciudad co ON o.ciudad_id = co.ciudad_id "); + sql.append("WHERE r4.datamov BETWEEN :STR_INICIO AND :STR_FIM "); + sql.append(" AND m.empresa_id = :EMPRESA_ID "); + sql.append(isEstadoTodos ? "" : " AND co.estado_id = :ESTADO_ID "); + sql.append(" AND r5.imptotalliquido = 1 "); + sql.append(" AND b.preciopagado = 0 "); + sql.append("GROUP BY r4.numserie20, r4.coo, r4.datamov, "); + sql.append(" r4.cpfcnpjcliente, r4.imptotalliquido, "); + sql.append(" b.boleto_id, m.empresa_id, fi.numcnpj, "); + sql.append(" fi.numserie, r5.impdesconto, r5.totparcial, "); + sql.append(" r5.imptotalliquido, r5.tipopassagem, r5.numitem, "); + sql.append(" r5.codproduto, fi.modelo, r4.usuario_id, "); + sql.append(" b.preciopagado, b.importetaxaembarque, b.importepedagio, "); + sql.append(" b.importeseguro, fi.numcnpj, r4.indcancelamento, r4.indcancelamento "); + sql.append("ORDER BY r4.datamov, r4.numserie20, r4.coo, r5.numitem "); + return sql.toString(); + } + + private String sqlFiscaisECFPendenciasInconsistente(boolean isEstadoTodos) { + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT r4.numserie20 as numImpressora, "); + sql.append(" r4.coo as coo, "); + sql.append(" r4.imptotalliquido as valorTotal, "); + sql.append(" r4.datamov as dataEmissao, "); + sql.append(" r4.cpfcnpjcliente as cnpjCliente, "); + sql.append(" b.boleto_id as boletoId, "); + sql.append(" m.empresa_id as empresaId, "); + sql.append(" fi.numcnpj as cnpjImpressora, "); + sql.append(" fi.numserie as numpdv, "); + sql.append(" r5.totparcial as repTributado, "); + sql.append(" r5.imptotalliquido as valorItem, "); + sql.append(" r5.tipopassagem as tipoPassagem, "); + sql.append(" r5.numitem as numItem, "); + sql.append(" r5.codproduto as codProduto, "); + sql.append(" fi.modelo as modeloImpressora, "); + sql.append(" r4.usuario_id as numCaixa, "); + sql.append(" b.preciopagado as importetarifa, "); + sql.append(" b.importetaxaembarque as importetaxaembarque, "); + sql.append(" b.importepedagio as importepedagio, "); + sql.append(" b.importeseguro as importeseguro, "); + sql.append(" translate(fi.numcnpj, ' / - . ', ' ') as cnpjEcf, "); + sql.append(" r4.indcancelamento, "); + sql.append(" 'INCONSISTENTE' as status "); + sql.append("FROM fiscal_r4 r4 "); + sql.append(" LEFT JOIN fiscal_r5 r5 ON r4.numserie20 = r5.numserie20 AND r4.coo = r5.coo "); + sql.append(" AND r4.datamov = r5.datamov AND r4.contador = r5.contador "); + sql.append(" LEFT JOIN fiscal_impressora fi ON fi.numserie20 = r4.numserie20 AND fi.fiscalimpressora_id = r5.fiscalimpressora_id "); + sql.append(" INNER JOIN boleto b ON b.boleto_id = r4.boleto_id "); + sql.append(" INNER JOIN marca m ON m.marca_id = b.marca_id "); + sql.append(" LEFT JOIN alias_servico ase ON ase.origen_id = b.origen_id "); + sql.append(" and ase.destino_id = b.destino_id and ase.ruta_id = b.ruta_id and ase.activo = 1 and ase.corrida_id is null "); + sql.append(" INNER JOIN parada o ON coalesce(ase.aliasorigen_id, b.origen_id) = o.parada_id "); + sql.append(" INNER JOIN ciudad co ON o.ciudad_id = co.ciudad_id "); + sql.append("WHERE r4.datamov BETWEEN :STR_INICIO AND :STR_FIM "); + sql.append(" AND m.empresa_id = :EMPRESA_ID "); + sql.append(isEstadoTodos ? "" : " AND co.estado_id = :ESTADO_ID "); + sql.append(" AND r4.indcancelamento = 'S' "); + sql.append(" AND (SELECT MAX(r3.numserie20) FROM fiscal_r3 r3 where r3.numserie20 = r4.numserie20"); + sql.append(" AND r3.datamov = r4.datamov AND r3.totparcial IN ('Can-T', 'DT')) IS NULL "); + sql.append("GROUP BY r4.numserie20, r4.coo, r4.datamov, "); + sql.append(" r4.cpfcnpjcliente, r4.imptotalliquido, "); + sql.append(" b.boleto_id, m.empresa_id, fi.numcnpj, "); + sql.append(" fi.numserie, r5.impdesconto, r5.totparcial, "); + sql.append(" r5.imptotalliquido, r5.tipopassagem, r5.numitem, "); + sql.append(" r5.codproduto, fi.modelo, r4.usuario_id, "); + sql.append(" b.preciopagado, b.importetaxaembarque, b.importepedagio, "); + sql.append(" b.importeseguro, fi.numcnpj, r4.indcancelamento, r4.indcancelamento "); + sql.append("ORDER BY r4.datamov, r4.numserie20, r4.coo, r5.numitem "); + return sql.toString(); + } + + @Override + public List buscaDatosFiscaisECF(Date inicio, Date fim, Integer empresaId, Integer estadoId, boolean isNormal, boolean isCancelados, boolean isPendencias, Connection connection, boolean isBoletoHist) throws SQLException { + + if (isNormal) { + return montarItensECF(inicio, fim, empresaId, estadoId, connection, sqlFiscaisECF(isEstadoTodos(estadoId), isBoletoHist), true); + + } else if (isCancelados) { + return montarItensECF(inicio, fim, empresaId, estadoId, connection, sqlFiscaisECFCancelados(isEstadoTodos(estadoId), isBoletoHist), true); + + } else if (isPendencias) { + + List list = new ArrayList(); + list.addAll(montarItensECF(inicio, fim, empresaId, estadoId, connection, sqlFiscaisECFPendenciasCancelado(isEstadoTodos(estadoId)), false)); + list.addAll(montarItensECF(inicio, fim, empresaId, estadoId, connection, sqlFiscaisECFPendenciasDesconto(isEstadoTodos(estadoId)), false)); + list.addAll(montarItensECF(inicio, fim, empresaId, estadoId, connection, sqlFiscaisECFPendenciasInconsistente(isEstadoTodos(estadoId)), false)); + list.addAll(montarItensECF(inicio, fim, empresaId, estadoId, connection, sqlFiscaisECFPendenciasGratuidade(isEstadoTodos(estadoId)), false)); + return list; + + } + return null; + } + + private List montarItensECF(Date inicio, Date fim, Integer empresaId, Integer estadoId, Connection connection, String sql, boolean isDate) throws SQLException { + + boolean isEstadoTodos = isEstadoTodos(estadoId); + + NamedParameterStatement stmt = new NamedParameterStatement(connection, sql); + stmt.getStatement().setFetchSize(100); + + stmt.setInt("EMPRESA_ID", empresaId); + if (isDate) { + stmt.setString("DATE_INICIO", DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00"); + stmt.setString("DATE_FIM", DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); + } else { + stmt.setString("STR_INICIO", DateUtil.getStringDate(inicio, DATE_FORMAT_FISCAL)); + stmt.setString("STR_FIM", DateUtil.getStringDate(fim, DATE_FORMAT_FISCAL)); + } + + if (!isEstadoTodos) { + stmt.setInt("ESTADO_ID", estadoId); + } + + List list = new ArrayList(); + ImportacionFiscalVO fiscal = null; + String codProduto = null; + + List columns = new ArrayList(); + ResultSetMetaData rsMetaData = stmt.getStatement().getMetaData(); + for (int i = 1; i <= rsMetaData.getColumnCount(); i++) { + columns.add(rsMetaData.getColumnName(i).toLowerCase()); + } + + ResultSet rset = stmt.executeQuery(); + while (rset.next()) { + + ItemFiscalVO item = new ItemFiscalVO(); + item.setNumImpressora(columns.contains("numimpressora") ? rset.getString("numImpressora") : null); + item.setCoo(columns.contains("coo") ? rset.getString("coo") : null); + item.setBoletoId(columns.contains("boletoid") ? rset.getLong("boletoId") : null); + item.setEmpresaId(columns.contains("empresaid") ? rset.getInt("empresaId") : null); + item.setDataEmissao(columns.contains("dataemissao") ? rset.getString("dataEmissao") : null); + item.setCnpjCliente(columns.contains("cnpjcliente") ? rset.getString("cnpjCliente") : null); + item.setCnpjImpressora(columns.contains("cnpjimpressora") ? rset.getString("cnpjImpressora") : null); + item.setOrigenId(columns.contains("origenid") ? rset.getInt("origenId") : null); + + Integer origenIbge = (columns.contains("origenuf") ? rset.getInt("origenUf") : null); + item.setOrigenUf(origenIbge == null ? null : origenIbge.toString()); + + item.setDestinoId(columns.contains("destinoid") ? rset.getInt("destinoId") : null); + + Integer destinoIbge = (columns.contains("destinouf") ? rset.getInt("destinoUf") : null); + item.setDestinoUf(destinoIbge == null ? null : destinoIbge.toString()); + + item.setNumpdv(columns.contains("numpdv") ? rset.getString("numpdv") : null); + item.setNumItem(columns.contains("numitem") ? rset.getString("numItem") : null); + item.setCodProduto(columns.contains("codproduto") ? rset.getString("codProduto") : null); + item.setRepTributado(columns.contains("reptributado") ? rset.getString("repTributado") : null); + item.setTipoPassagem(columns.contains("tipopassagem") ? rset.getString("tipoPassagem") : null); + item.setModeloImpressora(columns.contains("modeloimpressora") ? rset.getString("modeloImpressora") : null); + item.setNumCaixa(columns.contains("numcaixa") ? rset.getString("numCaixa") : null); + item.setStatus(columns.contains("status") ? rset.getString("status") : null); + item.setClaseServicio(columns.contains("claseservicio") ? rset.getString("claseServicio") : null); + item.setMotivocancelacion(columns.contains("motivocancelacion") ? rset.getInt("motivocancelacion") : null); + item.setValorMulta(columns.contains("valormulta") ? rset.getBigDecimal("valorMulta") : null); + item.setImpostoEstado(columns.contains("impostoestado") ? rset.getBigDecimal("impostoEstado") : null); + item.setDesconto(columns.contains("desconto") ? rset.getBigDecimal("desconto") : null); + item.setIndcancelamento(columns.contains("indcancelamento") ? rset.getString("indcancelamento") : null); + + // TODO: Estes atributos foram criados, por motivo de divergencia no valorTotal com o valor unitario na tabela FISCAL_R5 + item.setValorTarifa(columns.contains("importetarifa") ? rset.getBigDecimal("importetarifa") : null); + item.setValorPedagio(columns.contains("importepedagio") ? rset.getBigDecimal("importepedagio") : null); + item.setValorEmbarque(columns.contains("importetaxaembarque") ? rset.getBigDecimal("importetaxaembarque") : null); + item.setValorSeguro(columns.contains("importeseguro") ? rset.getBigDecimal("importeseguro") : null); + + ImportacionFiscalVO novoFiscal = item; + + codProduto = item.getCodProduto(); + if (codProduto != null) { + codProduto = codProduto.toString().replace("-", "").replace("TA", "").replace("TX", "").replace("PE", "").replace("SE", ""); + } else { + String boleto = item.getBoletoId().toString(); + codProduto = boleto.substring(boleto.length() - 8) + "F" + boleto.substring(boleto.length() - 2); + } + + if (fiscal == null) { + fiscal = item; + } else if (!novoFiscal.equals(fiscal)) { + List itensFiscais = validaItensFiscais(fiscal, codProduto); + fiscal.setItensFiscais(itensFiscais); + list.add(fiscal); + fiscal = item; + } + + fiscal.getItensFiscais().add(item); + + } + + if (fiscal != null) { + List itensFiscais = validaItensFiscais(fiscal, codProduto); + fiscal.setItensFiscais(itensFiscais); + list.add(fiscal); + } + + return list; + } + + private boolean validaValorExiste(BigDecimal valor) { + if (valor == null) { + return Boolean.FALSE; + } else if (valor.equals(BigDecimal.ZERO)) { + return Boolean.FALSE; + } else { + return Boolean.TRUE; + } + } + + private List validaItensFiscais(ImportacionFiscalVO fiscal, String codProduto) { + + boolean temTarifa = validaValorExiste(fiscal.getValorTarifa()); + boolean temPedagio = validaValorExiste(fiscal.getValorPedagio()); + boolean temEmbarque = validaValorExiste(fiscal.getValorEmbarque()); + boolean temSeguro = validaValorExiste(fiscal.getValorSeguro()); + + boolean tarifaCriada = false; + boolean pedagioCriada = false; + boolean embarqueCriada = false; + boolean seguroCriada = false; + + boolean inconsistencia = false; + + List itensFiscais = new ArrayList(); + for (ItemFiscalVO item : fiscal.getItensFiscais()) { + + String codigoProduto = item.getCodProduto(); + if (codigoProduto != null) { + if (codigoProduto.indexOf("TA") >= 0) + tarifaCriada = true; + + if (codigoProduto.indexOf("TX") >= 0) + embarqueCriada = true; + + if (codigoProduto.indexOf("PE") >= 0) + pedagioCriada = true; + + if (codigoProduto.indexOf("SE") >= 0) + seguroCriada = true; + } else { + inconsistencia = true; + break; + } + + itensFiscais.add(item); + } + + int numeroItem = 1; + if (temTarifa && !tarifaCriada) { + ItemFiscalVO novoTarifa = new ItemFiscalVO(fiscal); + novoTarifa.setCodProduto(codProduto + "-TA"); + novoTarifa.setTipoPassagem("E"); + novoTarifa.setValorItem(fiscal.getValorTarifa()); + novoTarifa.setRepTributado("N1"); + novoTarifa.setNumItem(StringHelper.preencherZeroEsquerda((numeroItem++) + "", 3)); + novoTarifa.setInconsistencia(inconsistencia); + itensFiscais.add(novoTarifa); + } + + if (temEmbarque && !embarqueCriada) { + ItemFiscalVO novoEmbarque = new ItemFiscalVO(fiscal); + novoEmbarque.setCodProduto(codProduto + "-TX"); + novoEmbarque.setTipoPassagem("E"); + novoEmbarque.setValorItem(fiscal.getValorEmbarque()); + novoEmbarque.setRepTributado("N1"); + novoEmbarque.setNumItem(StringHelper.preencherZeroEsquerda((numeroItem++) + "", 3)); + novoEmbarque.setInconsistencia(inconsistencia); + itensFiscais.add(novoEmbarque); + } + + if (temPedagio && !pedagioCriada) { + ItemFiscalVO novoPedagio = new ItemFiscalVO(fiscal); + novoPedagio.setCodProduto(codProduto + "-PE"); + novoPedagio.setTipoPassagem("E"); + novoPedagio.setValorItem(fiscal.getValorPedagio()); + novoPedagio.setRepTributado("N1"); + novoPedagio.setNumItem(StringHelper.preencherZeroEsquerda((numeroItem++) + "", 3)); + novoPedagio.setInconsistencia(inconsistencia); + itensFiscais.add(novoPedagio); + } + + if (temSeguro && !seguroCriada) { + ItemFiscalVO novoSeguro = new ItemFiscalVO(fiscal); + novoSeguro.setCodProduto(codProduto + "-SE"); + novoSeguro.setTipoPassagem("E"); + novoSeguro.setValorItem(fiscal.getValorSeguro()); + novoSeguro.setRepTributado("N1"); + novoSeguro.setNumItem(StringHelper.preencherZeroEsquerda((numeroItem++) + "", 3)); + novoSeguro.setInconsistencia(inconsistencia); + itensFiscais.add(novoSeguro); + } + + return itensFiscais; + } + + private int gerarRegistroP2(List lsEsquemaCorrida, Date dataDe, Date dataAte) throws SQLException { + Integer[] idsCorrida = getIdsCorrida(lsEsquemaCorrida); + + StringBuilder sb = new StringBuilder(""); + sb.append(" INSERT INTO FISCAL_P2 (CODPRODUTO,descricao,valorunitario_ta,valorunitario_tx,valorunitario_pe,valorunitario_ot,valorunitario_se,empresa_id,estado_origem,estado_aliascorrida,estado_aliasgeral, ncm) "); + sb.append(" "); + sb.append(" select DISTINCT "); + sb.append(" CODPRODUTO(t.origen_id , t.destino_id , rc.ruta_id) AS CODPRODUTO, "); + sb.append(" concat(concat(concat(concat(concat(po.cveparada, '-'),pd.cveparada),'('),v.nombvia),')') as descricao, "); + sb.append(" tr.precio as valorunitario_ta, "); + sb.append(" tr.importetaxaembarque as valorunitario_tx, "); + sb.append(" tr.importepedagio as valorunitario_pe, "); + sb.append(" tr.importeoutros as valorunitario_ot, "); + sb.append(" tr.importeseguro as valorunitario_se, "); + sb.append(" c.empresacorrida_id as empresa_id, "); + sb.append(" co.estado_id as estado_origem, "); + sb.append(" cas1.estado_id as estado_aliascorrida, "); + sb.append(" cas2.estado_id as estado_aliasgeral, "); + sb.append(" '1040311' as ncm "); + sb.append(" "); + sb.append(" from "); + sb.append(" ruta_combinacion rc "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sb.append(" inner join via v on v.via_id = t.via_id "); + sb.append(" inner join parada po on po.parada_id = t.origen_id "); + sb.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sb.append(" inner join corrida c on c.ruta_id = rc.ruta_id "); + sb.append(" inner join corrida_tramo cto on cto.corrida_id = c.corrida_id and cto.feccorrida = c.feccorrida and t.origen_id = cto.origen_id "); + sb.append(" inner join corrida_tramo ctd on ctd.corrida_id = c.corrida_id and ctd.feccorrida = c.feccorrida and t.destino_id = ctd.destino_id "); + sb.append(" inner join tarifa tr on tr.ruta_id = rc.ruta_id and tr.origen_id = t.origen_id and tr.destino_id = t.destino_id "); + sb.append(" inner join vigencia_tarifa vt on vt.vigenciatarifa_id = tr.vigenciatarifa_id "); + sb.append(" inner join ciudad co on co.ciudad_id = po.ciudad_id "); + sb.append(" left join alias_servico as1 on as1.corrida_id = as1.corrida_id and as1.origen_id = t.origen_id and as1.destino_id = t.destino_id and as1.ruta_id = rc.ruta_id "); + sb.append(" left join parada pas1 on pas1.parada_id = as1.aliasorigen_id "); + sb.append(" left join ciudad cas1 on cas1.ciudad_id = pas1.ciudad_id "); + sb.append(" left join alias_servico as2 on as2.corrida_id is null and as2.origen_id = t.origen_id and as2.destino_id = t.destino_id and as2.ruta_id = rc.ruta_id "); + sb.append(" left join parada pas2 on pas2.parada_id = as2.aliasorigen_id "); + sb.append(" left join ciudad cas2 on cas2.ciudad_id = pas2.ciudad_id "); + sb.append(" where "); + sb.append(" rc.activo = 1 "); + sb.append(" and cto.activo = 1 "); + sb.append(" and ctd.activo = 1 "); + sb.append(" and tr.activo = 1 "); + sb.append(" and cto.fechorsalida between vt.feciniciovigencia and vt.fecfinvigencia "); + sb.append(" and c.feccorrida between :datIni and :datFim "); + sb.append(" and c.corrida_id in (:corridaId) "); + sb.append(" and CODPRODUTO(t.origen_id , t.destino_id , rc.ruta_id) not in (select codproduto from fiscal_p2) "); + // sb.append(" and ROWNUM < 50 "); + + int qtd = 0; + + Connection connection = null; + try { + connection = dataSource.getConnection(); + + connection.setAutoCommit(false); + + PreparedStatement ps = connection.prepareStatement(sb.toString()); + + ps.setDate(1, new java.sql.Date(dataDe.getTime())); + ps.setDate(2, new java.sql.Date(dataAte.getTime())); + ps.setString(3, StringUtils.join(idsCorrida, ",")); + + qtd = ps.executeUpdate(); + + connection.commit(); + } catch (Throwable t) { + connection.rollback(); + } finally { + if (connection != null) { + connection.close(); + } + } + + return qtd; + + } + + private Integer[] getIdsCorrida(List lsEsquemaCorrida) { + Integer[] idsCorrida = new Integer[lsEsquemaCorrida.size()]; + int i = 0; + for (EsquemaCorrida ec : lsEsquemaCorrida) { + idsCorrida[i] = ec.getNumCorrida(); + i++; + } + return idsCorrida; + } + + private int gerarRegistroF2(List lsEsquemaCorrida, Date dataDe, Date dataAte) throws SQLException { + StringBuilder sb = new StringBuilder(""); + sb.append(" INSERT INTO FISCAL_F2 (cnpj, codigo_local_emissao,identificacao_linha, descricao_linha, data_partida, hora_partida, codigo_tipo_viagem) "); + sb.append(" select distinct oc.cnpj, t.origen_id as codigo_local_emissao, r.prefixo as identificacao_linha, concat(concat(po.cveparada, '-'),pd.cveparada) as descricao, to_char(cto.fechorsalida, 'YYYYMMdd') as data_partida, to_char(cto.fechorsalida, 'hh24miss') as hora_partida, (case nvl(c.tiposervicio_id, 0) when 2 then '01' else '00' end) as codigo_tipo_viagem "); + sb.append(" from "); + sb.append(" ruta_combinacion rc "); + sb.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sb.append(" inner join orgao_concedente oc on oc.orgaoconcedente_id = r.orgaoconcedente_id "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sb.append(" inner join parada po on po.parada_id = t.origen_id "); + sb.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sb.append(" inner join corrida c on c.ruta_id = rc.ruta_id "); + sb.append(" inner join corrida_tramo cto on cto.corrida_id = c.corrida_id and cto.feccorrida = c.feccorrida and t.origen_id = cto.origen_id "); + sb.append(" inner join corrida_tramo ctd on ctd.corrida_id = c.corrida_id and ctd.feccorrida = c.feccorrida and t.destino_id = ctd.destino_id "); + sb.append(" inner join tarifa tr on tr.ruta_id = rc.ruta_id and tr.origen_id = t.origen_id and tr.destino_id = t.destino_id "); + sb.append(" inner join vigencia_tarifa vt on vt.vigenciatarifa_id = tr.vigenciatarifa_id "); + sb.append(" inner join punto_venta pv on pv.empresa_id = c.empresacorrida_id "); + sb.append(" where "); + sb.append(" rc.activo = 1 "); + sb.append(" and cto.activo = 1 "); + sb.append(" and ctd.activo = 1 "); + sb.append(" and cto.fechorsalida between vt.feciniciovigencia and vt.fecfinvigencia "); + sb.append(" and c.feccorrida between :datIni and :datFim "); + sb.append(" and c.corrida_id in (:corridaId) "); + // sb.append(" and ROWNUM < 2 "); + + Integer[] idsCorrida = getIdsCorrida(lsEsquemaCorrida); + Connection connection = null; + + int qtd = 0; + + try { + connection = dataSource.getConnection(); + + connection.setAutoCommit(false); + + PreparedStatement ps = connection.prepareStatement(sb.toString()); + + ps.setDate(1, new java.sql.Date(dataDe.getTime())); + ps.setDate(2, new java.sql.Date(dataAte.getTime())); + ps.setString(3, StringUtils.join(idsCorrida, ",")); + + qtd = ps.executeUpdate(); + + connection.commit(); + + } catch (Throwable t) { + connection.rollback(); + } finally { + if (connection != null) { + connection.close(); + } + } + + return qtd; + } + + @Override + public int gerarRegistroP2_F2(List lsEsquemaCorrida, Date dataDe, Date dataAte) throws SQLException { + int gerarRegistroP2 = this.gerarRegistroP2(lsEsquemaCorrida, dataDe, dataAte); + int gerarRegistroF2 = this.gerarRegistroF2(lsEsquemaCorrida, dataDe, dataAte); + return gerarRegistroP2 + gerarRegistroF2; + } + + @Override + public List buscaDatosNaoFiscais(Date inicio, Date fim, Integer empresaId, Integer estadoId, Connection connection) throws SQLException { + PreparedStatement stmt = null; + ResultSet rset = null; + + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT TEE.TIPOEVENTOEXTRA_ID AS TIPOEVENTOEXTRAID, TEE.DESCTIPOEVENTO AS DESCTIPOEVENTO, ") + .append(" TRUNC(CD.FECHORVTA) AS FECHORVTA, SUM(CD.PRECIO) AS TOTAL ") + .append("FROM TIPO_EVENTO_EXTRA TEE ") + .append("JOIN EVENTO_EXTRA EE ON TEE.TIPOEVENTOEXTRA_ID = EE.TIPOEVENTOEXTRA_ID ") + .append("JOIN PUNTO_VENTA PV ON PV.PUNTOVENTA_ID = EE.PUNTOVENTA_ID ") + .append("JOIN PARADA PA ON PA.PARADA_ID = PV.PARADA_ID ") + .append("JOIN CIUDAD CI ON CI.CIUDAD_ID = PA.CIUDAD_ID ") + .append("JOIN ESTADO ES ON ES.ESTADO_ID = CI.ESTADO_ID ") + .append("LEFT JOIN CAJA_DIVERSOS CD ON EE.EVENTOEXTRA_ID = CD.EVENTOEXTRA_ID ") + .append("WHERE TEE.ACTIVO = 1 ") + .append("AND EE.EMPRESA_ID = ? ") + .append("AND TRUNC(CD.FECHORVTA) BETWEEN ? AND ? ") + .append(isEstadoTodos(estadoId) ? "" : " AND ES.ESTADO_ID = ? ") + .append("GROUP BY TEE.TIPOEVENTOEXTRA_ID, TEE.DESCTIPOEVENTO, TRUNC(CD.FECHORVTA) ") + .append("ORDER BY TRUNC(CD.FECHORVTA), TEE.DESCTIPOEVENTO "); + + stmt = connection.prepareStatement(sQuery.toString()); + stmt.setInt(1, empresaId); + stmt.setDate(2, new java.sql.Date(inicio.getTime())); + stmt.setDate(3, new java.sql.Date(fim.getTime())); + + if (!isEstadoTodos(estadoId)) + stmt.setInt(4, estadoId); + + rset = stmt.executeQuery(); + List importacionNaoFiscalVOs = new ArrayList(); + while (rset.next()) { + ImportacionNaoFiscalVO importacionNaoFiscal = new ImportacionNaoFiscalVO(); + importacionNaoFiscal.setTipoeventoextraId(rset.getInt("TIPOEVENTOEXTRAID")); + importacionNaoFiscal.setDesctipoevento(rset.getString("DESCTIPOEVENTO")); + importacionNaoFiscal.setFechorvta(rset.getDate("FECHORVTA")); + importacionNaoFiscal.setTotal(rset.getBigDecimal("TOTAL")); + + importacionNaoFiscalVOs.add(importacionNaoFiscal); + } + + return importacionNaoFiscalVOs; + + } + + @Override + public ExportacaoECF buscarRegistroECF(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado) { + ExportacaoECF exportacaoECF = new ExportacaoECF(); + + StringBuilder sb = new StringBuilder(); + sb.append(" select distinct"); + sb.append(" (case when r2.numserie20 is null then 'X' else '' end) || imp.numserie20 as ecf,"); + sb.append(" (case when r2.numserie20 is null then 'X' else '' end) || imp.numserie as numserie,"); + sb.append(" (case when r2.numserie20 is null then '000001' else r2.cooinicial end) as cooinicial,"); + sb.append(" (case when r2.numserie20 is null then '000001' else r2.coofinal end) as coofinal,"); + sb.append(" (case when r2.numserie20 is null then '000001' else r2.crz end) as crz,"); + sb.append(" (case when r2.numserie20 is null then '000001' else r2.cro end) as cro,"); + sb.append(" (case when r2.numserie20 is null then '000001' else r2.coo end) as r2_coo,"); + sb.append(" to_char(c.feccreacion, 'yyyymmdd') as datamov,"); + sb.append(" (case when r4.caja_id is null then '000001' else r4.coo end) as r4_coo,"); + sb.append(" (case when s.aliasorigen_id is null then ei.codestabelecimento else eis.codestabelecimento end) as codestabelecimento,"); + sb.append(" e.codestabelecimento as codestabelecimentoimpressora,"); + sb.append(" imp.numeroidentificacao as numeroidentificacao,"); + sb.append(" (case when (coalesce(case when s.aliasorigen_id is null then po.regionmetropolitana_id else pos.regionmetropolitana_id end, -1) = coalesce(case when s.aliasorigen_id is null then pd.regionmetropolitana_id else pds.regionmetropolitana_id end, -2)) then 1 else 0 end) as isenta,"); + sb.append(" ((case when coalesce(r.indtribtarifa,0) = 1 then c.preciopagado else 0 end) + (case when coalesce(r.indtribtaxaembarque,0) = 1 then c.importetaxaembarque else 0 end) + (case when coalesce(r.indtribpedagio,0) = 1 then c.importepedagio else 0 end)) as valortributado,"); + sb.append(" (case when s.aliasorigen_id is null then co.codibge else cos.codibge end) as municipio_origem,"); + sb.append(" (case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) as estado_origem,"); + sb.append(" (case when s.aliasdestino_id is null then cd.codibge else cds.codibge end) as municipio_destino,"); + sb.append(" (case when s.aliasdestino_id is null then ed.cveestado else eds.cveestado end) as estado_destino,"); + sb.append(" (case when s.aliasorigen_id is null then ei.porcredbaseicms else eis.porcredbaseicms end) as red_base_calc_icms,"); + sb.append(" (case when s.aliasorigen_id is null then ei.porcredmunicipal else eis.porcredmunicipal end) as porc_red_municipal,"); + sb.append(" (case when s.aliasorigen_id is null then ei.porcredestadual else eis.porcredestadual end) as porc_red_estadual,"); + sb.append(" (case when s.aliasorigen_id is null then ei.tributacaoimportacao else eis.tributacaoimportacao end) as tributacao_importacao,"); + sb.append(" coalesce(c.preciopagado,0) + coalesce(c.importetaxaembarque,0) + coalesce(c.importeseguro,0) + coalesce(c.importepedagio,0) + coalesce(c.importeoutros,0) as valortotal,"); + sb.append(" c.numfoliosistema as numfoliosistema,"); + sb.append(" c.caja_id"); + sb.append(" from caja c"); + sb.append(" join ruta r on r.ruta_id = c.ruta_id"); + sb.append(" join parada po on po.parada_id = c.origen_id and po.activo = 1 "); + sb.append(" join ciudad co on co.ciudad_id = po.ciudad_id and co.activo = 1 "); + sb.append(" join estado eo on eo.estado_id = co.estado_id and eo.activo = 1 "); + sb.append(" join parada pd on pd.parada_id = c.destino_id"); + sb.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id"); + sb.append(" join estado ed on ed.estado_id = cd.estado_id"); + sb.append(" join empresa_imposto ei on ei.empresa_id = c.empresacorrida_id and ei.estado_id = eo.estado_id and ei.activo = 1 "); + sb.append(" join fiscal_impressora imp on imp.numserie = c.serieimpfiscal"); + sb.append(" left join estado e on e.estado_id = imp.estadolocal_id"); + sb.append(" left join alias_servico s on s.origen_id = c.origen_id and s.destino_id = c.destino_id and (s.corrida_id = c.corrida_id or s.corrida_id is null) and s.ruta_id = c.ruta_id and s.activo = 1 "); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + sb.append(" left join parada pds on pds.parada_id = s.aliasdestino_id"); + sb.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id"); + sb.append(" left join estado eds on eds.estado_id = cds.estado_id"); + sb.append(" left join empresa_imposto eis on eis.empresa_id = c.empresacorrida_id and eis.estado_id = eos.estado_id"); + sb.append(" left join fiscal_r4 r4 on r4.caja_id = c.caja_id"); + sb.append(" left join fiscal_r2 r2 on r2.numserie20 = imp.numserie20 and r2.datamov = to_char(c.feccreacion, 'YYYYMMDD')"); + sb.append(" where c.activo = 1 "); + sb.append(" and coalesce(case when s.aliasorigen_id is null then ei.activo else eis.activo end, 0) = 1 "); + sb.append(" and c.serieimpfiscal is not null "); + sb.append(" and ((c.indreimpresion = 0 and c.motivocancelacion_id is null and c.numfoliosistema is not null) or (c.indstatusboleto = 'E' and c.indreimpresion = 1)) "); + sb.append(" and (coalesce(c.preciopagado,0) + coalesce(c.importetaxaembarque,0) + coalesce(c.importeseguro,0) + coalesce(c.importepedagio,0) + coalesce(c.importeoutros,0)) > 0 "); + sb.append(" and ((case when coalesce(r.indtribtarifa,0) = 1 then c.preciopagado else 0 end) + (case when coalesce(r.indtribtaxaembarque,0) = 1 then c.importetaxaembarque else 0 end) + (case when coalesce(r.indtribpedagio,0) = 1 then c.importepedagio else 0 end)) > 0 "); + sb.append(" and c.feccreacion >= to_date(?,'DD/MM/YYYY HH24:MI:SS') and c.feccreacion <= to_date(?,'DD/MM/YYYY HH24:MI:SS') "); + sb.append(" and c.empresacorrida_id = ? "); + sb.append(" and c.num_bpe is null "); + sb.append(" and ((case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) = ?) "); + + try { + PreparedStatement ps = connection.prepareStatement(sb.toString()); + ps.setString(1, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00"); + ps.setString(2, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); + ps.setLong(3, Long.valueOf(empresaId)); + ps.setString(4, cveestado); + + ResultSet rs = ps.executeQuery(); + + ExportacaoECFBase registro = null; + + while (rs.next()) { + BigDecimal valortributado = BigDecimal.ZERO; + BigDecimal valortotal = BigDecimal.ZERO; + + if (rs.getBigDecimal("valortributado") != null) { + valortributado = rs.getBigDecimal("valortributado"); + } + + if (rs.getBigDecimal("valortotal") != null) { + valortotal = rs.getBigDecimal("valortotal"); + } + + registro = new ExportacaoECFBase(); + registro.setEcf(rs.getString("ecf")); + registro.setNumeroSerie(rs.getString("numserie")); + registro.setCooInicial(Integer.valueOf(rs.getString("cooinicial"))); + registro.setCooFinal(Integer.valueOf(rs.getString("coofinal"))); + registro.setContadorReducao(Integer.valueOf(rs.getString("crz"))); + registro.setCro(Integer.valueOf(rs.getString("cro"))); + registro.setCooReducaoZ(Integer.valueOf(rs.getString("r2_coo"))); + registro.setDataEmissao(rs.getString("datamov")); + registro.setCoo(Integer.valueOf(rs.getString("r4_coo"))); + registro.setEstabelecimento(rs.getString("codestabelecimento")); + registro.setEstabelecimentoECF(rs.getString("codestabelecimentoimpressora")); + registro.setNumeroIdentificacaoECF(rs.getString("numeroidentificacao") == null || rs.getString("numeroidentificacao").isEmpty() ? "0" : rs.getString("numeroidentificacao")); + registro.setUfOrigem(rs.getString("estado_origem")); + registro.setMunicipioOrigem(Integer.valueOf(rs.getString("municipio_origem"))); + registro.setMunicipioDestino(Integer.valueOf(rs.getString("municipio_destino"))); + registro.setUfDestino(rs.getString("estado_destino")); + registro.setReducaoBaseCalcICMS(rs.getBigDecimal("red_base_calc_icms")); + registro.setPorcReducaoMunicipal(rs.getBigDecimal("porc_red_municipal")); + registro.setPorcReducaoEstadual(rs.getBigDecimal("porc_red_estadual")); + registro.setTributacaoImportacao(rs.getBigDecimal("tributacao_importacao")); + registro.setNumFolioSistema(rs.getString("numFolioSistema")); + registro.setInfoPadraoBilhetePassagem(CODIGO_INDICADOR_CONTR_PREVIDENCIARIA); + + registro.setIsenta(rs.getInt("isenta")); + registro.setValorTributado(valortributado); + registro.setValorTotal(valortotal); + + exportacaoECF.getListaRegistroECF().add(registro); + } + + rs.close(); + ps.close(); + + exportacaoECF.gerarListas(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return exportacaoECF; + } + + public void limparCache(Connection connection) { + + ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService"); + Constante contante = constanteService.buscarPorNomeConstante("LIMPA_CACHE_RELATORIOS"); + String command = null; + if ((contante != null && (StringUtils.isNotBlank(contante.getValorconstante())))) { + command = contante.getValorconstante(); + + PreparedStatement pstmt = null; + try { + pstmt = connection.prepareStatement(command); + pstmt.executeBatch(); + } catch (Exception e) { + log.error("", e); + } finally { + try { + if (pstmt != null && !pstmt.isClosed()) { + pstmt.close(); + } + } catch (Exception e) { + log.error("", e); + } + } + } + } + + @Deprecated + @Override + public List buscarRegistroECFTipoCFC(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado) { + List retorno = new ArrayList(); + + StringBuilder sb = new StringBuilder(); + sb.append(" select ecf, numserie, datamov, cooinicial, coofinal, crz, cro, coo, codestabelecimento, codestabelecimentoimpressora, numeroidentificacao, estadoorigem, sum(totalisenta) as totalisenta, sum(vendabrutadiaria) as vendabrutadiaria, sum(totgeral) as totgeral, sum(totalvenda) as totalvenda"); + sb.append(" from ("); + sb.append(" select distinct"); + sb.append(" imp.numserie20 as ecf,"); + sb.append(" imp.numserie as numserie,"); + sb.append(" r2.datamov as datamov,"); + sb.append(" r2.cooinicial as cooinicial,"); + sb.append(" r2.coofinal as coofinal,"); + sb.append(" r2.crz as crz,"); + sb.append(" r2.cro as cro,"); + sb.append(" r2.coo as coo,"); + sb.append(" CASE WHEN s.aliasorigen_id IS NULL THEN ei.codestabelecimento ELSE eis.codestabelecimento END as codestabelecimento,"); + sb.append(" e.codestabelecimento as codestabelecimentoimpressora,"); + sb.append(" imp.numeroidentificacao as numeroidentificacao,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) as estadoorigem,"); + sb.append(" coalesce(("); + sb.append(" select sum((coalesce(to_number(r4i.imptotalliquido), 0) / 100 - coalesce((select sum(to_number(r5x.imptotalliquido) / 100) from fiscal_r5 r5x where r5x.contador = r4i.contador and r5x.numserie20 = r4i.numserie20 and r5x.totparcial like 'N1'), 0)))"); + sb.append(" from fiscal_r4 r4i"); + sb.append(" join caja ci on ci.caja_id = r4i.caja_id"); + sb.append(" join parada poi on poi.parada_id = ci.origen_id"); + sb.append(" join parada pdi on pdi.parada_id = ci.destino_id"); + sb.append(" left join alias_servico si on si.origen_id = ci.origen_id and si.destino_id = ci.destino_id and (si.corrida_id = ci.corrida_id or si.corrida_id is null) and si.ruta_id = ci.ruta_id"); + sb.append(" left join parada posi on posi.parada_id = si.aliasorigen_id"); + sb.append(" left join parada pdsi on pdsi.parada_id = si.aliasdestino_id"); + sb.append(" where r4i.numserie20 = r4.numserie20 and r4i.datamov = r2.datamov"); + sb.append(" and (nvl(case when si.aliasorigen_id is null then poi.regionmetropolitana_id else posi.regionmetropolitana_id end, -1) = nvl(case when si.aliasorigen_id is null then pdi.regionmetropolitana_id else pdsi.regionmetropolitana_id end, -2))"); + sb.append(" ), 0) as totalisenta,"); + sb.append(" to_number(r2.vendabrutadiaria)/100 as vendabrutadiaria,"); + sb.append(" to_number(r2.totgeral)/100 as totgeral,"); + sb.append(" ("); + sb.append(" (to_number(coalesce(r4.imptotalliquido,'0')) / 100) - "); + sb.append(" coalesce(("); + sb.append(" select sum(to_number(coalesce(r5x.imptotalliquido,'0')) / 100)"); + sb.append(" from fiscal_r5 r5x"); + sb.append(" where r5x.contador = r4.contador and r5x.numserie20 = r4.numserie20 and r5x.totparcial like 'N1'"); + sb.append(" ), 0)"); + sb.append(" ) as totalvenda,"); + sb.append(" b.boleto_id as caja_id"); + sb.append(" from fiscal_r4 r4"); + sb.append(" join fiscal_r2 r2 on r2.numserie20 = r4.numserie20 and r2.datamov = r4.datamov"); + sb.append(" join fiscal_impressora imp on imp.numserie20 = r4.numserie20"); + sb.append(" join boleto b on b.boleto_id = r4.boleto_id"); + sb.append(" join parada po on po.parada_id = b.origen_id"); + sb.append(" join ciudad co on co.ciudad_id = po.ciudad_id"); + sb.append(" join estado eo on eo.estado_id = co.estado_id"); + sb.append(" join empresa_imposto ei on ei.empresa_id = b.empresacorrida_id and ei.estado_id = co.estado_id"); + sb.append(" left join alias_servico s on s.origen_id = b.origen_id and s.destino_id = b.destino_id and (s.corrida_id = b.corrida_id or s.corrida_id is null) and s.ruta_id = b.ruta_id"); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + sb.append(" left join empresa_imposto eis on eis.empresa_id = b.empresacorrida_id and eis.estado_id = cos.estado_id"); + sb.append(" left join estado e on e.estado_id = imp.estadolocal_id"); + sb.append(" where b.activo = 1"); + sb.append(" and nvl(CASE WHEN s.aliasorigen_id IS NULL THEN ei.activo ELSE eis.activo END, 0) = 1"); + sb.append(" and coalesce(r4.indcancelamento, 'N') <> 'S'"); + sb.append(" and r4.datamov >= ? and r4.datamov <= ?"); + sb.append(" and b.empresacorrida_id = ?"); + sb.append(" and ((CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) = ?)"); + sb.append(" UNION"); + sb.append(" select distinct"); + sb.append(" (case when r2.numserie20 is null then 'X' else '' end) || imp.numserie20 as ecf,"); + sb.append(" (case when r2.numserie20 is null then 'X' else '' end) || imp.numserie as numserie,"); + sb.append(" to_char(c.feccreacion, 'YYYYMMDD') as datamov,"); + sb.append(" case when r2.numserie20 is null then '000001' else r2.cooinicial end as cooinicial,"); + sb.append(" case when r2.numserie20 is null then '000001' else r2.coofinal end as coofinal,"); + sb.append(" case when r2.numserie20 is null then '0000' else r2.crz end as crz,"); + sb.append(" case when r2.numserie20 is null then '0000' else r2.cro end as cro,"); + sb.append(" case when r2.numserie20 is null then '000000' else r2.coo end as coo,"); + sb.append(" CASE WHEN s.aliasorigen_id IS NULL THEN ei.codestabelecimento ELSE eis.codestabelecimento END as codestabelecimento,"); + sb.append(" e.codestabelecimento as codestabelecimentoimpressora,"); + sb.append(" imp.numeroidentificacao as numeroidentificacao,"); + sb.append(" CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END as estadoorigem,"); + sb.append(" ("); + sb.append(" select nvl(sum(ci.preciopagado), 0)"); + sb.append(" from caja ci"); + sb.append(" join parada poi on poi.parada_id = ci.origen_id"); + sb.append(" join parada pdi on pdi.parada_id = ci.destino_id"); + sb.append(" left join alias_servico si on si.origen_id = ci.origen_id and si.destino_id = ci.destino_id and (si.corrida_id = ci.corrida_id or si.corrida_id is null) and si.ruta_id = ci.ruta_id"); + sb.append(" left join parada posi on posi.parada_id = si.aliasorigen_id"); + sb.append(" left join parada pdsi on pdsi.parada_id = si.aliasdestino_id"); + sb.append(" where ci.caja_id = c.caja_id"); + sb.append(" and (nvl(case when si.aliasorigen_id is null then poi.regionmetropolitana_id else posi.regionmetropolitana_id end, -1) = nvl(case when si.aliasorigen_id is null then pdi.regionmetropolitana_id else pdsi.regionmetropolitana_id end, -2))"); + sb.append(" ) as totalisenta,"); + sb.append(" 0 as vendabrutadiaria,"); + sb.append(" ("); + sb.append(" select nvl(sum(ci.preciopagado + ci.importetaxaembarque + ci.importeseguro + ci.importepedagio + ci.importeoutros), 0)"); + sb.append(" from caja ci"); + sb.append(" where ci.caja_id = c.caja_id"); + sb.append(" ) as totgeral,"); + sb.append(" ("); + sb.append(" select nvl(sum(ci.preciopagado), 0)"); + sb.append(" from caja ci"); + sb.append(" where ci.caja_id = c.caja_id"); + sb.append(" ) as totalvenda,"); + sb.append(" c.caja_id"); + sb.append(" from caja c"); + sb.append(" join parada po on po.parada_id = c.origen_id"); + sb.append(" join ciudad co on co.ciudad_id = po.ciudad_id"); + sb.append(" join estado eo on eo.estado_id = co.estado_id"); + sb.append(" join empresa_imposto ei on ei.empresa_id = c.empresacorrida_id and ei.estado_id = co.estado_id"); + sb.append(" join fiscal_impressora imp on imp.numserie = c.serieimpfiscal"); + sb.append(" left join alias_servico s on s.origen_id = c.origen_id and s.destino_id = c.destino_id and (s.corrida_id = c.corrida_id or s.corrida_id is null) and s.ruta_id = c.ruta_id"); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + sb.append(" left join empresa_imposto eis on eis.empresa_id = c.empresacorrida_id and eis.estado_id = cos.estado_id"); + sb.append(" left join fiscal_r4 r4 on r4.caja_id = c.caja_id"); + sb.append(" left join estado e on e.estado_id = imp.estadolocal_id"); + sb.append(" left join fiscal_r2 r2 on r2.numserie20 = imp.numserie20 and r2.datamov = to_char(c.feccreacion, 'YYYYMMDD')"); + sb.append(" where c.activo = 1 and po.activo = 1 and co.activo = 1 and eo.activo = 1 and ei.activo = 1"); + sb.append(" and c.serieimpfiscal is not null and r4.caja_id is null"); + sb.append(" and ((c.indreimpresion = 0 and c.motivocancelacion_id is null and c.numfoliosistema is not null) or (c.indstatusboleto = 'E' and c.indreimpresion = 1))"); + sb.append(" and coalesce(CASE WHEN s.aliasorigen_id IS NULL THEN ei.activo ELSE eis.activo END, 0) = 1"); + sb.append(" and c.feccreacion >= TO_DATE(?,'DD/MM/YYYY HH24:MI:SS') and c.feccreacion <= TO_DATE(?,'DD/MM/YYYY HH24:MI:SS')"); + sb.append(" and c.empresacorrida_id = ?"); + sb.append(" and ((CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) = ?)"); + sb.append(" )"); + sb.append(" having sum(totalvenda) > 0"); + sb.append(" group by ecf, numserie, datamov, cooinicial, coofinal, crz, cro, coo, codestabelecimento, codestabelecimentoimpressora, numeroidentificacao, estadoorigem"); + sb.append(" order by datamov"); + + try { + PreparedStatement ps = connection.prepareStatement(sb.toString()); + ps.setString(1, DateUtil.getStringDate(inicio, DATE_FORMAT_FISCAL)); + ps.setString(2, DateUtil.getStringDate(fim, DATE_FORMAT_FISCAL)); + ps.setLong(3, Long.valueOf(empresaId)); + ps.setString(4, cveestado); + ps.setString(5, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY + " 00:00:00")); + ps.setString(6, DateUtil.getStringDate(fim, DATE_FORMAT_DMY + " 23:59:59")); + ps.setLong(7, Long.valueOf(empresaId)); + ps.setString(8, cveestado); + + ResultSet rs = ps.executeQuery(); + + ExportacaoECFTipoCFC registro = null; + + while (rs.next()) { + BigDecimal totalIsenta = BigDecimal.ZERO; + BigDecimal totalvenda = BigDecimal.ZERO; + + if (rs.getBigDecimal("totalisenta") != null) { + totalIsenta = rs.getBigDecimal("totalisenta"); + } + + if (rs.getBigDecimal("totalvenda") != null) { + totalvenda = rs.getBigDecimal("totalvenda"); + } + + registro = new ExportacaoECFTipoCFC(); + registro.setEstabelecimento(rs.getString("codestabelecimento")); + registro.setDataEmissao(rs.getString("datamov")); + registro.setNumeroIdentificacaoECF(rs.getString("numeroidentificacao") == null || rs.getString("numeroidentificacao").isEmpty() ? "0" : rs.getString("numeroidentificacao")); + registro.setEcf(rs.getString("ecf")); + registro.setCooReducaoZ(Integer.valueOf(rs.getString("coo"))); + registro.setCooInicial(Integer.valueOf(rs.getString("cooinicial"))); + registro.setCooFinal(Integer.valueOf(rs.getString("coofinal"))); + registro.setContadorReducao(Integer.valueOf(rs.getString("crz"))); + registro.setCro(Integer.valueOf(rs.getString("cro"))); + registro.setValorTotal(totalvenda); + registro.setValorIsentas(totalIsenta); + registro.setEstabelecimentoECF(rs.getString("codestabelecimentoimpressora")); + registro.setNumeroSerie(rs.getString("numserie")); + registro.setInfoPadraoBilhetePassagem(CODIGO_INDICADOR_CONTR_PREVIDENCIARIA); + + retorno.add(registro); + } + + rs.close(); + ps.close(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return retorno; + } + + @Deprecated + @Override + public List buscarRegistroECFTipoCCF(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado) { + List retorno = new ArrayList(); + + StringBuilder sb = new StringBuilder(); + sb.append(" select ecf, datamov, coo, sum(valortarifa) as valortarifa, sum(preciopagado) as preciopagado, municipio_origem, estado_origem, municipio_destino, estado_destino, red_base_calc_icms, porc_red_municipal, porc_red_estadual, tributacao_importacao, isenta, numfoliosistema, sum(valortotal) as valortotal"); + sb.append(" from ("); + sb.append(" select distinct"); + sb.append(" r4.numserie20 as ecf,"); + sb.append(" r4.datamov as datamov,"); + sb.append(" r4.coo as coo,"); + sb.append(" ("); + sb.append(" (to_number(coalesce(r4.imptotalliquido,'0')) / 100) - "); + sb.append(" coalesce(("); + sb.append(" select sum(to_number(coalesce(r5x.imptotalliquido,'0')) / 100)"); + sb.append(" from fiscal_r5 r5x"); + sb.append(" where r5x.contador = r4.contador and r5x.numserie20 = r4.numserie20 and r5x.totparcial like 'N1'"); + sb.append(" ), 0)"); + sb.append(" ) as valortarifa,"); + sb.append(" c.preciopagado as preciopagado,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN co.codibge ELSE cos.codibge END) as municipio_origem,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) as estado_origem,"); + sb.append(" (CASE WHEN s.aliasdestino_id IS NULL THEN cd.codibge ELSE cds.codibge END) as municipio_destino,"); + sb.append(" (CASE WHEN s.aliasdestino_id IS NULL THEN ed.cveestado ELSE eds.cveestado END) as estado_destino,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredbaseicms ELSE eis.porcredbaseicms END) as red_base_calc_icms,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredmunicipal ELSE eis.porcredmunicipal END) as porc_red_municipal,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredestadual ELSE eis.porcredestadual END) as porc_red_estadual,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.tributacaoimportacao ELSE eis.tributacaoimportacao END) as tributacao_importacao,"); + sb.append(" (CASE WHEN (nvl((CASE WHEN s.aliasorigen_id IS NULL THEN po.regionmetropolitana_id ELSE pos.regionmetropolitana_id END),-1) = nvl((CASE WHEN s.aliasdestino_id IS NULL THEN pd.regionmetropolitana_id ELSE pds.regionmetropolitana_id END),-2)) THEN 1 ELSE 0 END) as isenta,"); + sb.append(" to_number(r4.impsubtotal)/100 as valortotal,"); + sb.append(" b.numfoliosistema as numfoliosistema,"); + sb.append(" b.boleto_id as caja_id"); + sb.append(" from fiscal_r4 r4"); + sb.append(" left join fiscal_r5 r5 on r5.numserie20 = r4.numserie20 and r5.coo = r4.coo and r5.totparcial not like 'N1'"); + sb.append(" left join caja c on c.caja_id = r4.caja_id"); + sb.append(" join fiscal_r2 r2 on r2.numserie20 = r4.numserie20 and r2.datamov = r4.datamov"); + sb.append(" join boleto b on b.boleto_id = r4.boleto_id"); + sb.append(" join parada po on po.parada_id = b.origen_id"); + sb.append(" join ciudad co on co.ciudad_id = po.ciudad_id"); + sb.append(" join estado eo on eo.estado_id = co.estado_id"); + sb.append(" join parada pd on pd.parada_id = b.destino_id"); + sb.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id"); + sb.append(" join estado ed on ed.estado_id = cd.estado_id"); + sb.append(" join empresa_imposto ei on ei.empresa_id = b.empresacorrida_id and ei.estado_id = eo.estado_id"); + sb.append(" left join alias_servico s on s.origen_id = b.origen_id and s.destino_id = b.destino_id and (s.corrida_id = b.corrida_id or s.corrida_id is null) and s.ruta_id = b.ruta_id"); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + sb.append(" left join parada pds on pds.parada_id = s.aliasdestino_id"); + sb.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id"); + sb.append(" left join estado eds on eds.estado_id = cds.estado_id"); + sb.append(" left join empresa_imposto eis on eis.empresa_id = b.empresacorrida_id and eis.estado_id = eos.estado_id"); + sb.append(" where coalesce(r4.indcancelamento, 'N') <> 'S' and nvl(CASE WHEN s.aliasorigen_id IS NULL THEN ei.activo ELSE eis.activo END, 0) = 1 and b.activo = 1 and r4.datamov >= ? and r4.datamov <= ? and b.empresacorrida_id = ? and ((CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) = ?)"); + sb.append(" UNION"); + sb.append(" select distinct"); + sb.append(" (case when r2.numserie20 is null then 'X' else '' end) || imp.numserie20 as ecf,"); + sb.append(" to_char(c.feccreacion, 'YYYYMMDD') as datamov,"); + sb.append(" '000001' as coo,"); + sb.append(" c.preciopagado as valortarifa,"); + sb.append(" c.preciopagado as preciopagado,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN co.codibge ELSE cos.codibge END) as municipio_origem,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) as estado_origem,"); + sb.append(" (CASE WHEN s.aliasdestino_id IS NULL THEN cd.codibge ELSE cds.codibge END) as municipio_destino,"); + sb.append(" (CASE WHEN s.aliasdestino_id IS NULL THEN ed.cveestado ELSE eds.cveestado END) as estado_destino,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredbaseicms ELSE eis.porcredbaseicms END) as red_base_calc_icms,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredmunicipal ELSE eis.porcredmunicipal END) as porc_red_municipal,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredestadual ELSE eis.porcredestadual END) as porc_red_estadual,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.tributacaoimportacao ELSE eis.tributacaoimportacao END) as tributacao_importacao,"); + sb.append(" (CASE WHEN (nvl((CASE WHEN s.aliasorigen_id IS NULL THEN po.regionmetropolitana_id ELSE pos.regionmetropolitana_id END),-1) = nvl((CASE WHEN s.aliasdestino_id IS NULL THEN pd.regionmetropolitana_id ELSE pds.regionmetropolitana_id END),-2)) THEN 1 ELSE 0 END) as isenta,"); + sb.append(" c.preciopagado + c.importetaxaembarque + c.importeseguro + c.importepedagio + c.importeoutros as valortotal,"); + sb.append(" c.numfoliosistema as numfoliosistema,"); + sb.append(" c.caja_id"); + sb.append(" from caja c"); + sb.append(" join parada po on po.parada_id = c.origen_id"); + sb.append(" join ciudad co on co.ciudad_id = po.ciudad_id"); + sb.append(" join estado eo on eo.estado_id = co.estado_id"); + sb.append(" join parada pd on pd.parada_id = c.destino_id"); + sb.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id"); + sb.append(" join estado ed on ed.estado_id = cd.estado_id"); + sb.append(" join empresa_imposto ei on ei.empresa_id = c.empresacorrida_id and ei.estado_id = eo.estado_id"); + sb.append(" join fiscal_impressora imp on imp.numserie = c.serieimpfiscal"); + sb.append(" left join alias_servico s on s.origen_id = c.origen_id and s.destino_id = c.destino_id and (s.corrida_id = c.corrida_id or s.corrida_id is null) and s.ruta_id = c.ruta_id"); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + sb.append(" left join parada pds on pds.parada_id = s.aliasdestino_id"); + sb.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id"); + sb.append(" left join estado eds on eds.estado_id = cds.estado_id"); + sb.append(" left join empresa_imposto eis on eis.empresa_id = c.empresacorrida_id and eis.estado_id = eos.estado_id"); + sb.append(" left join fiscal_r4 r4 on r4.caja_id = c.caja_id"); + sb.append(" left join fiscal_r2 r2 on r2.numserie20 = imp.numserie20 and r2.datamov = to_char(c.feccreacion, 'YYYYMMDD')"); + sb.append(" where c.activo = 1 and po.activo = 1 and co.activo = 1 and eo.activo = 1 and ei.activo = 1"); + sb.append(" and coalesce(CASE WHEN s.aliasorigen_id IS NULL THEN ei.activo ELSE eis.activo END, 0) = 1"); + sb.append(" and c.serieimpfiscal is not null and r4.caja_id is null"); + sb.append(" and ((c.indreimpresion = 0 and c.motivocancelacion_id is null and c.numfoliosistema is not null) or (c.indstatusboleto = 'E' and c.indreimpresion = 1))"); + sb.append(" and (c.preciopagado + c.importetaxaembarque + c.importeseguro + c.importepedagio + c.importeoutros) > 0"); + sb.append(" and c.feccreacion >= TO_DATE(?,'DD/MM/YYYY HH24:MI:SS') and c.feccreacion <= TO_DATE(?,'DD/MM/YYYY HH24:MI:SS')"); + sb.append(" and c.empresacorrida_id = ?"); + sb.append(" and ((CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) = ?)"); + sb.append(" ) "); + sb.append(" group by ecf, datamov, coo, municipio_origem, estado_origem, municipio_destino, estado_destino, red_base_calc_icms, porc_red_municipal, porc_red_estadual, tributacao_importacao, isenta, numfoliosistema"); + + try { + PreparedStatement ps = connection.prepareStatement(sb.toString()); + ps.setString(1, DateUtil.getStringDate(inicio, DATE_FORMAT_FISCAL)); + ps.setString(2, DateUtil.getStringDate(fim, DATE_FORMAT_FISCAL)); + ps.setLong(3, Long.valueOf(empresaId)); + ps.setString(4, cveestado); + ps.setString(5, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY + " 00:00:00")); + ps.setString(6, DateUtil.getStringDate(fim, DATE_FORMAT_DMY + " 23:59:59")); + ps.setLong(7, Long.valueOf(empresaId)); + ps.setString(8, cveestado); + + ResultSet rs = ps.executeQuery(); + + ExportacaoECFTipoCCF registro = null; + + while (rs.next()) { + BigDecimal valorTributado = BigDecimal.ZERO; + + if (rs.getString("valortarifa") != null) { + valorTributado = BigDecimal.valueOf(Double.valueOf(rs.getString("valortarifa"))); + } else { + valorTributado = rs.getBigDecimal("preciopagado"); + + log.info("Tarifa nao encontrada na R5. (ECF: " + rs.getString("ecf") + " / DATAMOV: " + rs.getString("datamov") + " / COO: " + rs.getString("coo") + ")"); + } + + registro = new ExportacaoECFTipoCCF(); + registro.setEcf(rs.getString("ecf")); + registro.setDataEmissao(rs.getString("datamov")); + registro.setCoo(Integer.valueOf(rs.getString("coo"))); + registro.setValorServico(valorTributado); + registro.setDescontoGlobal(null); + registro.setCodigoParticipante(null); + registro.setSituacaoCOO(0); // 0 - Documento Regular; 2 - Documento Cancelado + registro.setAcrescimo(null); + registro.setNumFolioSistema(rs.getString("numFolioSistema")); + + registro.setCodigoSituacaoTribColunaB(null); + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + if (rs.getInt("isenta") == 1) { + registro.setCodigoSituacaoTribColunaB(40); + } + + registro.setUfOrigem(rs.getString("estado_origem")); + registro.setMunicipioOrigem(Integer.valueOf(rs.getString("municipio_origem"))); + registro.setUfDestino(rs.getString("estado_destino")); + + // IM=5357; Serviço IE= 6357 + if (rs.getString("estado_origem").equals(rs.getString("estado_destino"))) { + registro.setCfop(5357); + } else { + registro.setCfop(6357); + } + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + if (registro.getCodigoSituacaoTribColunaB() == null) { + registro.setCodigoSituacaoTribColunaB(rs.getInt("red_base_calc_icms") == 0 ? 0 : 20); + } + + // TODO: Mudança para o valor tributado (Email no dia 9 de agosto de 2017 08:28) + BigDecimal valorTotal = valorTributado; // BigDecimal.valueOf(Double.valueOf(rs.getString("valortotal"))); + + BigDecimal red_base_calc_icms = rs.getBigDecimal("red_base_calc_icms"); + // BigDecimal porc_red_municipal = rs.getBigDecimal("porc_red_municipal"); + // BigDecimal porc_red_estadual = rs.getBigDecimal("porc_red_estadual"); + BigDecimal tributacao_importacao = rs.getBigDecimal("tributacao_importacao"); + BigDecimal valorBaseCalculoICMS = BigDecimal.ZERO; + + if ("30|40|41|50|60".contains(registro.getCodigoSituacaoTribColunaB().toString())) { + tributacao_importacao = BigDecimal.ZERO; + } + + if (red_base_calc_icms != null) { + valorBaseCalculoICMS = valorTotal.subtract(valorTotal.multiply(red_base_calc_icms.divide(BigDecimal.valueOf(100d)))); + } else { + // if (tributacao_importacao != null) { + // if (rs.getString("estado_origem").equals(rs.getString("estado_destino"))) { + // if (porc_red_municipal != null) { + // BigDecimal porc = tributacao_importacao.subtract(tributacao_importacao.multiply(porc_red_municipal.divide(BigDecimal.valueOf(100d)))); + // valorBaseCalculoICMS = valorTotal.multiply(porc.divide(BigDecimal.valueOf(100d))); + // } + // } else { + // if (porc_red_estadual != null) { + // BigDecimal porc = tributacao_importacao.subtract(tributacao_importacao.multiply(porc_red_estadual.divide(BigDecimal.valueOf(100d)))); + // valorBaseCalculoICMS = valorTotal.multiply(porc.divide(BigDecimal.valueOf(100d))); + // } + // } + // } + + // Email 17/02/2017 + valorBaseCalculoICMS = valorTotal; + } + + if (rs.getInt("isenta") == 1) { + valorBaseCalculoICMS = null; + } + + registro.setValorTotal(valorTotal); + + // 1 - Demais; 2 - Região Metropolitanao ou seja, quando o campo CSTB for "40", esse campo deve vir "2". Do contrário, deve vir "1" + registro.setTributacaoICMS(registro.getCodigoSituacaoTribColunaB() == 40 ? 2 : 1); + + registro.setValorBaseCalculoICMS(valorBaseCalculoICMS); + registro.setAliquotaICMS(tributacao_importacao); + + if (valorTotal.doubleValue() != 0) { + retorno.add(registro); + } + } + + rs.close(); + ps.close(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return retorno; + } + + @Deprecated + @Override + public List buscarRegistroECFTipoICF(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado) { + List retorno = new ArrayList(); + + StringBuilder sb = new StringBuilder(); + sb.append(" select ecf, datamov, coo, municipio_origem, estado_origem, municipio_destino, estado_destino, red_base_calc_icms, porc_red_municipal, porc_red_estadual, tributacao_importacao, isenta, sum(valortotal) as valortotal"); + sb.append(" from ("); + sb.append(" select distinct"); + sb.append(" r4.numserie20 as ecf,"); + sb.append(" r4.datamov as datamov,"); + sb.append(" r4.coo as coo,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN co.codibge ELSE cos.codibge END) as municipio_origem,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) as estado_origem,"); + sb.append(" (CASE WHEN s.aliasdestino_id IS NULL THEN cd.codibge ELSE cds.codibge END) as municipio_destino,"); + sb.append(" (CASE WHEN s.aliasdestino_id IS NULL THEN ed.cveestado ELSE eds.cveestado END) as estado_destino,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredbaseicms ELSE eis.porcredbaseicms END) as red_base_calc_icms,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredmunicipal ELSE eis.porcredmunicipal END) as porc_red_municipal,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredestadual ELSE eis.porcredestadual END) as porc_red_estadual,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.tributacaoimportacao ELSE eis.tributacaoimportacao END) as tributacao_importacao,"); + sb.append(" (CASE WHEN (nvl((CASE WHEN s.aliasorigen_id IS NULL THEN po.regionmetropolitana_id ELSE pos.regionmetropolitana_id END),-1) = nvl((CASE WHEN s.aliasdestino_id IS NULL THEN pd.regionmetropolitana_id ELSE pds.regionmetropolitana_id END),-2)) THEN 1 ELSE 0 END) as isenta,"); + sb.append(" ("); + sb.append(" (to_number(coalesce(r4.imptotalliquido,'0')) / 100) - "); + sb.append(" coalesce(("); + sb.append(" select sum(to_number(coalesce(r5x.imptotalliquido,'0')) / 100)"); + sb.append(" from fiscal_r5 r5x"); + sb.append(" where r5x.contador = r4.contador and r5x.numserie20 = r4.numserie20 and r5x.totparcial like 'N1'"); + sb.append(" ), 0)"); + sb.append(" ) as valortotal"); + sb.append(" from fiscal_r4 r4"); + sb.append(" join fiscal_r2 r2 on r2.numserie20 = r4.numserie20 and r2.datamov = r4.datamov"); + sb.append(" join boleto b on b.boleto_id = r4.boleto_id"); + sb.append(" join parada po on po.parada_id = b.origen_id"); + sb.append(" join ciudad co on co.ciudad_id = po.ciudad_id"); + sb.append(" join estado eo on eo.estado_id = co.estado_id"); + sb.append(" join parada pd on pd.parada_id = b.destino_id"); + sb.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id"); + sb.append(" join estado ed on ed.estado_id = cd.estado_id"); + sb.append(" join empresa_imposto ei on ei.empresa_id = b.empresacorrida_id and ei.estado_id = eo.estado_id"); + sb.append(" left join alias_servico s on s.origen_id = b.origen_id and s.destino_id = b.destino_id and (s.corrida_id = b.corrida_id or s.corrida_id is null) and s.ruta_id = b.ruta_id"); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + sb.append(" left join parada pds on pds.parada_id = s.aliasdestino_id"); + sb.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id"); + sb.append(" left join estado eds on eds.estado_id = cds.estado_id"); + sb.append(" left join empresa_imposto eis on eis.empresa_id = b.empresacorrida_id and eis.estado_id = eos.estado_id"); + sb.append(" where coalesce(r4.indcancelamento, 'N') <> 'S' and nvl(CASE WHEN s.aliasorigen_id IS NULL THEN ei.activo ELSE eis.activo END, 0) = 1 and b.activo = 1 and r4.datamov >= ? and r4.datamov <= ? and b.empresacorrida_id = ? and ((CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) = ?)"); + sb.append(" UNION"); + sb.append(" select distinct"); + sb.append(" (case when r2.numserie20 is null then 'X' else '' end) || imp.numserie20 as ecf,"); + sb.append(" to_char(c.feccreacion, 'YYYYMMDD') as datamov,"); + sb.append(" '000001' as coo,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN co.codibge ELSE cos.codibge END) as municipio_origem,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) as estado_origem,"); + sb.append(" (CASE WHEN s.aliasdestino_id IS NULL THEN cd.codibge ELSE cds.codibge END) as municipio_destino,"); + sb.append(" (CASE WHEN s.aliasdestino_id IS NULL THEN ed.cveestado ELSE eds.cveestado END) as estado_destino,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredbaseicms ELSE eis.porcredbaseicms END) as red_base_calc_icms,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredmunicipal ELSE eis.porcredmunicipal END) as porc_red_municipal,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredestadual ELSE eis.porcredestadual END) as porc_red_estadual,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.tributacaoimportacao ELSE eis.tributacaoimportacao END) as tributacao_importacao,"); + sb.append(" (CASE WHEN (nvl((CASE WHEN s.aliasorigen_id IS NULL THEN po.regionmetropolitana_id ELSE pos.regionmetropolitana_id END),-1) = nvl((CASE WHEN s.aliasdestino_id IS NULL THEN pd.regionmetropolitana_id ELSE pds.regionmetropolitana_id END),-2)) THEN 1 ELSE 0 END) as isenta,"); + sb.append(" (c.preciopagado) as valortotal"); + sb.append(" from caja c"); + sb.append(" join parada po on po.parada_id = c.origen_id"); + sb.append(" join ciudad co on co.ciudad_id = po.ciudad_id"); + sb.append(" join estado eo on eo.estado_id = co.estado_id"); + sb.append(" join parada pd on pd.parada_id = c.destino_id"); + sb.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id"); + sb.append(" join estado ed on ed.estado_id = cd.estado_id"); + sb.append(" join empresa_imposto ei on ei.empresa_id = c.empresacorrida_id and ei.estado_id = eo.estado_id"); + sb.append(" join fiscal_impressora imp on imp.numserie = c.serieimpfiscal"); + sb.append(" left join alias_servico s on s.origen_id = c.origen_id and s.destino_id = c.destino_id and (s.corrida_id = c.corrida_id or s.corrida_id is null) and s.ruta_id = c.ruta_id"); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + sb.append(" left join parada pds on pds.parada_id = s.aliasdestino_id"); + sb.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id"); + sb.append(" left join estado eds on eds.estado_id = cds.estado_id"); + sb.append(" left join empresa_imposto eis on eis.empresa_id = c.empresacorrida_id and eis.estado_id = eos.estado_id"); + sb.append(" left join fiscal_r4 r4 on r4.caja_id = c.caja_id"); + sb.append(" left join fiscal_r2 r2 on r2.numserie20 = imp.numserie20 and r2.datamov = to_char(c.feccreacion, 'YYYYMMDD')"); + sb.append(" where c.activo = 1 and po.activo = 1 and co.activo = 1 and eo.activo = 1 and ei.activo = 1"); + sb.append(" and coalesce(CASE WHEN s.aliasorigen_id IS NULL THEN ei.activo ELSE eis.activo END, 0) = 1"); + sb.append(" and ((c.indreimpresion = 0 and c.motivocancelacion_id is null and c.numfoliosistema is not null) or (c.indstatusboleto = 'E' and c.indreimpresion = 1))"); + sb.append(" and (c.preciopagado) > 0"); + sb.append(" and c.serieimpfiscal is not null and r4.caja_id is null"); + sb.append(" and c.feccreacion >= TO_DATE(?,'DD/MM/YYYY HH24:MI:SS') and c.feccreacion <= TO_DATE(?,'DD/MM/YYYY HH24:MI:SS')"); + sb.append(" and c.empresacorrida_id = ?"); + sb.append(" and ((CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) = ?)"); + sb.append(" )"); + sb.append(" group by ecf, datamov, coo, municipio_origem, estado_origem, municipio_destino, estado_destino, red_base_calc_icms, porc_red_municipal, porc_red_estadual, tributacao_importacao, isenta"); + sb.append(" order by ecf, datamov"); + + try { + PreparedStatement ps = connection.prepareStatement(sb.toString()); + ps.setString(1, DateUtil.getStringDate(inicio, DATE_FORMAT_FISCAL)); + ps.setString(2, DateUtil.getStringDate(fim, DATE_FORMAT_FISCAL)); + ps.setLong(3, Long.valueOf(empresaId)); + ps.setString(4, cveestado); + ps.setString(5, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY + " 00:00:00")); + ps.setString(6, DateUtil.getStringDate(fim, DATE_FORMAT_DMY + " 23:59:59")); + ps.setLong(7, Long.valueOf(empresaId)); + ps.setString(8, cveestado); + + ResultSet rs = ps.executeQuery(); + + ExportacaoECFTipoICF registro = null; + + Map group = new HashMap(); + + while (rs.next()) { + BigDecimal valorTotal = rs.getBigDecimal("valortotal"); + + if (valorTotal == null || valorTotal.doubleValue() == 0) { + continue; + } + + BigDecimal red_base_calc_icms = MoneyHelper.instanciar(rs.getBigDecimal("red_base_calc_icms")); + BigDecimal porc_red_municipal = MoneyHelper.instanciar(rs.getBigDecimal("porc_red_municipal")); + BigDecimal porc_red_estadual = MoneyHelper.instanciar(rs.getBigDecimal("porc_red_estadual")); + BigDecimal tributacao_importacao = MoneyHelper.instanciar(rs.getBigDecimal("tributacao_importacao")); + BigDecimal valorBaseCalculoICMS = BigDecimal.ZERO; + + if (red_base_calc_icms != null) { + BigDecimal aRed_base_calc_icms = MoneyHelper.dividir(red_base_calc_icms, BigDecimal.valueOf(100d)); + valorBaseCalculoICMS = MoneyHelper.subtrair(valorTotal, MoneyHelper.multiplicar(valorTotal, aRed_base_calc_icms)); + } else { + // if (tributacao_importacao != null) { + // if (rs.getString("estado_origem").equals(rs.getString("estado_destino"))) { + // if (porc_red_municipal != null) { + // BigDecimal aPorc_red_municipal = MoneyHelper.dividir(porc_red_municipal, BigDecimal.valueOf(100d)); + // BigDecimal porc = MoneyHelper.subtrair(tributacao_importacao, MoneyHelper.multiplicar(tributacao_importacao, aPorc_red_municipal)); + // BigDecimal aPorc = MoneyHelper.dividir(porc, BigDecimal.valueOf(100d)); + // + // valorBaseCalculoICMS = MoneyHelper.multiplicar(valorTotal, aPorc); + // } + // } else { + // if (porc_red_estadual != null) { + // BigDecimal aPorc_red_estadual = MoneyHelper.dividir(porc_red_estadual, BigDecimal.valueOf(100d)); + // BigDecimal porc = MoneyHelper.subtrair(tributacao_importacao, MoneyHelper.multiplicar(tributacao_importacao, aPorc_red_estadual)); + // BigDecimal aPorc = MoneyHelper.dividir(porc, BigDecimal.valueOf(100d)); + // + // valorBaseCalculoICMS = MoneyHelper.multiplicar(valorTotal, aPorc); + // } + // } + // } + + // Email 17/02/2017 + valorBaseCalculoICMS = valorTotal; + } + + BigDecimal valorICMSDebitado = BigDecimal.ZERO; + + if (tributacao_importacao != null) { + BigDecimal aTributacao_importacao = MoneyHelper.dividir(tributacao_importacao, BigDecimal.valueOf(100d)); + valorICMSDebitado = MoneyHelper.multiplicar(valorBaseCalculoICMS, aTributacao_importacao); + } + + BigDecimal valorICMSIsento = BigDecimal.ZERO; + BigDecimal valorICMSOutros = MoneyHelper.subtrair(valorTotal, valorBaseCalculoICMS); + + String ecf = rs.getString("ecf"); + String datamov = rs.getString("datamov"); + String ufDestino = ""; + String ufOrigem = ""; + Integer municipioOrigem = 0; + Integer cfop = 0; // IM=5357; Serviço IE= 6357 + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + Integer codigoSituacaoTribColunaB = null; + + if (rs.getInt("isenta") == 1) { + codigoSituacaoTribColunaB = 40; + + valorICMSOutros = valorTotal; + } + + ufDestino = rs.getString("estado_destino"); + ufOrigem = rs.getString("estado_origem"); + municipioOrigem = rs.getInt("municipio_origem"); + + // IM=5357; Serviço IE= 6357 + if (rs.getString("estado_origem").equals(rs.getString("estado_destino"))) { + cfop = 5357; + } else { + cfop = 6357; + } + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + if (codigoSituacaoTribColunaB == null) { + codigoSituacaoTribColunaB = rs.getInt("red_base_calc_icms") == 0 ? 0 : 20; + } + + if (codigoSituacaoTribColunaB == 40) { + tributacao_importacao = BigDecimal.ZERO; + valorBaseCalculoICMS = BigDecimal.ZERO; + valorICMSDebitado = BigDecimal.ZERO; + valorICMSOutros = BigDecimal.ZERO; + + valorICMSIsento = valorTotal; + } + + String key = ecf + "|" + datamov + "|" + ufDestino + "|" + cfop.toString() + "|" + codigoSituacaoTribColunaB.toString(); + + if (group.containsKey(key)) { + registro = group.get(key); + + valorTotal = MoneyHelper.somar(valorTotal, registro.getValorTotal()); + valorBaseCalculoICMS = MoneyHelper.somar(valorBaseCalculoICMS, registro.getValorBaseCalculoICMS()); + valorICMSDebitado = MoneyHelper.somar(valorICMSDebitado, registro.getValorICMSDebitado()); + valorICMSIsento = MoneyHelper.somar(valorICMSIsento, registro.getValorICMSIsento()); + valorICMSOutros = MoneyHelper.somar(valorICMSOutros, registro.getValorICMSOutros()); + } else { + registro = new ExportacaoECFTipoICF(); + registro.setEcf(ecf); + registro.setDataEmissao(datamov); + registro.setUfDestino(ufDestino); + registro.setCfop(cfop); // IM=5357; Serviço IE= 6357 + registro.setCodigoSituacaoTribColunaB(codigoSituacaoTribColunaB); // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + registro.setAliquotaICMS(tributacao_importacao); + registro.setUfOrigem(ufOrigem); + registro.setMunicipioOrigem(municipioOrigem); + + registro.setRedutorBaseCalculoIcms(red_base_calc_icms); + registro.setRedutorMunicipalIcms(porc_red_municipal); + registro.setRedutorEstadualIcms(porc_red_estadual); + + group.put(key, registro); + } + + registro.setValorTotal(valorTotal); + registro.setValorBaseCalculoICMS(valorBaseCalculoICMS); + registro.setValorICMSDebitado(valorICMSDebitado); + registro.setValorICMSIsento(valorICMSIsento); + registro.setValorICMSOutros(valorICMSOutros); + } + + for (Map.Entry entry : group.entrySet()) { + retorno.add(entry.getValue()); + } + + rs.close(); + ps.close(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return retorno; + } + + @Deprecated + @Override + public List buscarRegistroECFTipoPRC(final Connection conn, final Date inicio, final Date fim, final Integer empresaId, final String cveestado) { + final List retorno = new ArrayList(); + + final StringBuilder sb = new StringBuilder(); + sb.append(" select ecf, datamov, municipio_origem, estado_origem, estado_destino, red_base_calc_icms, porc_red_municipal, porc_red_estadual, tributacao_importacao, SUM(valortotal) as valortotal"); + sb.append(" from ("); + sb.append(" select distinct"); + sb.append(" r4.coo as coo,"); + sb.append(" r4.numserie20 as ecf,"); + sb.append(" r4.datamov as datamov,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN co.codibge ELSE cos.codibge END) as municipio_origem,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) as estado_origem,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ed.cveestado ELSE eds.cveestado END) as estado_destino,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredbaseicms ELSE eis.porcredbaseicms END) as red_base_calc_icms,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredmunicipal ELSE eis.porcredmunicipal END) as porc_red_municipal,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredestadual ELSE eis.porcredestadual END) as porc_red_estadual,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.tributacaoimportacao ELSE eis.tributacaoimportacao END) as tributacao_importacao,"); + sb.append(" ("); + sb.append(" (to_number(coalesce(r4.imptotalliquido,'0')) / 100) - "); + sb.append(" coalesce(("); + sb.append(" select sum(to_number(coalesce(r5x.imptotalliquido,'0')) / 100)"); + sb.append(" from fiscal_r5 r5x"); + sb.append(" where r5x.contador = r4.contador and r5x.numserie20 = r4.numserie20 and r5x.totparcial like 'N1'"); + sb.append(" ), 0)"); + sb.append(" ) as valortotal,"); + sb.append(" b.boleto_id as caja_id"); + sb.append(" from fiscal_r4 r4"); + sb.append(" join fiscal_r2 r2 on r2.numserie20 = r4.numserie20 and r2.datamov = r4.datamov"); + sb.append(" join boleto b on b.boleto_id = r4.boleto_id"); + sb.append(" join parada po on po.parada_id = b.origen_id"); + sb.append(" join ciudad co on co.ciudad_id = po.ciudad_id"); + sb.append(" join estado eo on eo.estado_id = co.estado_id"); + sb.append(" join parada pd on pd.parada_id = b.destino_id"); + sb.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id"); + sb.append(" join estado ed on ed.estado_id = cd.estado_id"); + sb.append(" join empresa_imposto ei on ei.empresa_id = b.empresacorrida_id and ei.estado_id = eo.estado_id"); + sb.append(" left join alias_servico s on s.origen_id = b.origen_id and s.destino_id = b.destino_id and (s.corrida_id = b.corrida_id or s.corrida_id is null) and s.ruta_id = b.ruta_id"); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + sb.append(" left join parada pds on pds.parada_id = s.aliasdestino_id"); + sb.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id"); + sb.append(" left join estado eds on eds.estado_id = cds.estado_id"); + sb.append(" left join empresa_imposto eis on eis.empresa_id = b.empresacorrida_id and eis.estado_id = eos.estado_id"); + sb.append(" where coalesce(r4.indcancelamento, 'N') <> 'S' and nvl(CASE WHEN s.aliasorigen_id IS NULL THEN ei.activo ELSE eis.activo END, 0) = 1 and b.activo = 1 and r4.datamov >= ? and r4.datamov <= ? and b.empresacorrida_id = ? and ((CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) = ?)"); + sb.append(" UNION"); + sb.append(" select distinct"); + sb.append(" '000001' as coo,"); + sb.append(" (case when r2.numserie20 is null then 'X' else '' end) || imp.numserie20 as ecf,"); + sb.append(" to_char(c.feccreacion, 'YYYYMMDD') as datamov,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN co.codibge ELSE cos.codibge END) as municipio_origem,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) as estado_origem,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ed.cveestado ELSE eds.cveestado END) as estado_destino,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredbaseicms ELSE eis.porcredbaseicms END) as red_base_calc_icms,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredmunicipal ELSE eis.porcredmunicipal END) as porc_red_municipal,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredestadual ELSE eis.porcredestadual END) as porc_red_estadual,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.tributacaoimportacao ELSE eis.tributacaoimportacao END) as tributacao_importacao,"); + sb.append(" c.preciopagado as valortotal,"); + sb.append(" c.caja_id"); + sb.append(" from caja c"); + sb.append(" join parada po on po.parada_id = c.origen_id"); + sb.append(" join ciudad co on co.ciudad_id = po.ciudad_id"); + sb.append(" join estado eo on eo.estado_id = co.estado_id"); + sb.append(" join parada pd on pd.parada_id = c.destino_id"); + sb.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id"); + sb.append(" join estado ed on ed.estado_id = cd.estado_id"); + sb.append(" join empresa_imposto ei on ei.empresa_id = c.empresacorrida_id and ei.estado_id = eo.estado_id"); + sb.append(" join fiscal_impressora imp on imp.numserie = c.serieimpfiscal"); + sb.append(" left join alias_servico s on s.origen_id = c.origen_id and s.destino_id = c.destino_id and (s.corrida_id = c.corrida_id or s.corrida_id is null) and s.ruta_id = c.ruta_id"); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + sb.append(" left join parada pds on pds.parada_id = s.aliasdestino_id"); + sb.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id"); + sb.append(" left join estado eds on eds.estado_id = cds.estado_id"); + sb.append(" left join empresa_imposto eis on eis.empresa_id = c.empresacorrida_id and eis.estado_id = eos.estado_id"); + sb.append(" left join fiscal_r4 r4 on r4.caja_id = c.caja_id"); + sb.append(" left join fiscal_r2 r2 on r2.numserie20 = imp.numserie20 and r2.datamov = to_char(c.feccreacion, 'YYYYMMDD')"); + sb.append(" where c.activo = 1 and po.activo = 1 and co.activo = 1 and eo.activo = 1 and ei.activo = 1"); + sb.append(" and coalesce(CASE WHEN s.aliasorigen_id IS NULL THEN ei.activo ELSE eis.activo END, 0) = 1"); + sb.append(" and ((c.indreimpresion = 0 and c.motivocancelacion_id is null and c.numfoliosistema is not null) or (c.indstatusboleto = 'E' and c.indreimpresion = 1))"); + sb.append(" and (c.preciopagado) > 0"); + sb.append(" and c.serieimpfiscal is not null and r4.caja_id is null"); + sb.append(" and c.feccreacion >= TO_DATE(?,'DD/MM/YYYY HH24:MI:SS') and c.feccreacion <= TO_DATE(?,'DD/MM/YYYY HH24:MI:SS')"); + sb.append(" and c.empresacorrida_id = ?"); + sb.append(" and ((CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) = ?)"); + sb.append(" ) group by ecf, datamov, municipio_origem, estado_origem, estado_destino, red_base_calc_icms, porc_red_municipal, porc_red_estadual, tributacao_importacao"); + + Session session = null; + + try { + session = getSessionFactory().openSession(); + + session.doWork(new Work() { + @Override + public void execute(Connection connection) throws SQLException { + PreparedStatement ps = connection.prepareStatement(sb.toString()); + ps.setString(1, DateUtil.getStringDate(inicio, DATE_FORMAT_FISCAL)); + ps.setString(2, DateUtil.getStringDate(fim, DATE_FORMAT_FISCAL)); + ps.setLong(3, Long.valueOf(empresaId)); + ps.setString(4, cveestado); + ps.setString(5, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY + " 00:00:00")); + ps.setString(6, DateUtil.getStringDate(fim, DATE_FORMAT_DMY + " 23:59:59")); + ps.setLong(7, Long.valueOf(empresaId)); + ps.setString(8, cveestado); + + ResultSet rs = ps.executeQuery(); + + ExportacaoECFTipoPRC registro = null; + + Map group = new HashMap(); + + while (rs.next()) { + BigDecimal valorTotal = rs.getBigDecimal("valortotal"); + + BigDecimal red_base_calc_icms = MoneyHelper.instanciar(rs.getBigDecimal("red_base_calc_icms")); + // BigDecimal porc_red_municipal = MoneyHelper.instanciar(rs.getBigDecimal("porc_red_municipal")); + // BigDecimal porc_red_estadual = MoneyHelper.instanciar(rs.getBigDecimal("porc_red_estadual")); + BigDecimal tributacao_importacao = MoneyHelper.instanciar(rs.getBigDecimal("tributacao_importacao")); + BigDecimal valorBaseCalculoICMS = BigDecimal.ZERO; + + if (tributacao_importacao != null) { + tributacao_importacao = MoneyHelper.dividir(tributacao_importacao, BigDecimal.valueOf(100d)); + } + + if (red_base_calc_icms != null) { + BigDecimal aRed_base_calc_icms = MoneyHelper.dividir(red_base_calc_icms, BigDecimal.valueOf(100d)); + valorBaseCalculoICMS = MoneyHelper.subtrair(valorTotal, MoneyHelper.multiplicar(valorTotal, aRed_base_calc_icms)); + } else { + // if (tributacao_importacao != null) { + // if (rs.getString("estado_origem").equals(rs.getString("estado_destino"))) { + // if (porc_red_municipal != null) { + // BigDecimal aPorc_red_municipal = MoneyHelper.dividir(porc_red_municipal, BigDecimal.valueOf(100d)); + // BigDecimal porc = MoneyHelper.subtrair(tributacao_importacao, MoneyHelper.multiplicar(tributacao_importacao, aPorc_red_municipal)); + // + // BigDecimal aPorc = MoneyHelper.dividir(porc, BigDecimal.valueOf(100d)); + // valorBaseCalculoICMS = MoneyHelper.multiplicar(valorTotal, aPorc); + // } + // } else { + // if (porc_red_estadual != null) { + // BigDecimal aPorc_red_estadual = MoneyHelper.dividir(porc_red_estadual, BigDecimal.valueOf(100d)); + // BigDecimal porc = MoneyHelper.subtrair(tributacao_importacao, MoneyHelper.multiplicar(tributacao_importacao, aPorc_red_estadual)); + // + // BigDecimal aPorc = MoneyHelper.dividir(porc, BigDecimal.valueOf(100d)); + // valorBaseCalculoICMS = MoneyHelper.multiplicar(valorTotal, aPorc); + // } + // } + // } + + // Email 17/02/2017 + valorBaseCalculoICMS = valorTotal; + } + + BigDecimal valorICMS = BigDecimal.ZERO; + + if (tributacao_importacao != null) { + valorICMS = MoneyHelper.multiplicar(valorBaseCalculoICMS, tributacao_importacao); + } + + String key = rs.getString("ecf") + "|" + rs.getString("datamov") + "|" + rs.getString("estado_origem") + "|" + rs.getString("municipio_origem"); + + if (group.containsKey(key)) { + registro = group.get(key); + + registro.setValorTotal(MoneyHelper.somar(registro.getValorTotal(), valorTotal)); + registro.setValorBaseCalculoICMS(MoneyHelper.somar(registro.getValorBaseCalculoICMS(), valorBaseCalculoICMS)); + registro.setValorICMS(MoneyHelper.somar(registro.getValorICMS(), valorICMS)); + + } else { + registro = new ExportacaoECFTipoPRC(); + registro.setEcf(rs.getString("ecf")); + registro.setDataEmissao(rs.getString("datamov")); + registro.setUfOrigem(rs.getString("estado_origem")); + registro.setMunicipioOrigem(Integer.valueOf(rs.getString("municipio_origem"))); + registro.setValorTotal(valorTotal); + registro.setValorBaseCalculoICMS(valorBaseCalculoICMS); + registro.setValorICMS(valorICMS); + registro.setTributacao(tributacao_importacao); + } + + group.put(key, registro); + } + + for (Map.Entry entry : group.entrySet()) { + retorno.add(entry.getValue()); + } + + rs.close(); + ps.close(); + } + }); + + } catch (Exception e) { + log.error(e.getMessage(), e); + + } finally { + session.close(); + + } + + return retorno; + } + + @Override + public ExportacaoBPR buscarRegistroBPR(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado) { + ExportacaoBPR exportacaoRMD = new ExportacaoBPR(); + + boolean isDif = validaConstanteCustom(empresaId.toString(), "IMPORT_FISCAL_DIF"); + + StringBuilder sb = new StringBuilder(); + sb.append(" select distinct"); + sb.append(" eof.estado_id as codigoParticipantePar,"); + sb.append(" eif.codestabelecimento as codigoEstabelecimentoPar,"); + sb.append(" e.nombempresa as nomeParticipante,"); + sb.append(" eof.cveestado as ufParticipante,"); + sb.append(" ie.cnpj as cnpjParticipante,"); + sb.append(" ie.numinscricaoestadual as ieParticipante,"); + sb.append(" ie.logradouro as logradouro,"); + sb.append(" ie.numero as numero,"); + sb.append(" ie.complemento as complemento,"); + sb.append(" ie.bairro as bairro,"); + sb.append(" ie.cep as cep,"); + sb.append(" cast(f.fechorfolio as date) as dataEmissaoRMD,"); + sb.append(" (case when s.aliasorigen_id is null then eo.estado_id else cos.estado_id end) as codigoParticipante,"); + sb.append(" ei.codestabelecimento as codigoEstabelecimento,"); + sb.append(" coalesce(a.acfiscal, 'X') as numeroAIDF,"); + sb.append(" coalesce(a.serie, 'X') as serieAIDF,"); + sb.append(" a.subserie as subSerieAIDF,"); + sb.append(" f.folio as numeroFormularioBilheteAIDF,"); + sb.append(" (case when coalesce(f.indcancelacion, 0) = 1 then 'S' else 'N' end) as documentoCancelado,"); + sb.append(" (case when (case when s.aliasorigen_id is null then eo.estado_id else cos.estado_id end) = "); + sb.append(" (case when s.aliasorigen_id is null then cd.estado_id else cds.estado_id end) "); + sb.append(" then ei.codigocontabilmunicipal else ei.codigocontabilestadual end) as codigoContabil,"); + sb.append(" b.feccreacion as dataEmissao,"); + sb.append(" b.numfoliopreimpreso as numeroFormulario,"); + sb.append(" r.acfiscal as numeroAIDFRMD,"); + sb.append(" r.serie as serieAIDFRMD,"); + sb.append(" r.subserie as subSerieAIDFRMD,"); + sb.append(" b.foliormd as numeroRMD,"); + sb.append(" (case when ( coalesce(case when s.aliasorigen_id is null then po.regionmetropolitana_id else pos.regionmetropolitana_id end, -1) = "); + sb.append(" coalesce(case when s.aliasorigen_id is null then pd.regionmetropolitana_id else pds.regionmetropolitana_id end, -2) ) then 1 else 0 end) as boletoIsento,"); + sb.append(" (case when b.motivocancelacion_id is not null then 1 else 0 end) as boletoCancelado,"); + sb.append(" b.preciopagado as valorPago,"); + sb.append(" (case when s.aliasorigen_id is null then ed.cveestado else eds.cveestado end) as ufDestino,"); + sb.append(" (case when s.aliasorigen_id is null then cd.codibge else cds.codibge end) as municipioDestino,"); + sb.append(" (case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) as ufOrigem,"); + sb.append(" (case when s.aliasorigen_id is null then co.codibge else cos.codibge end) as municipioOrigem,"); + sb.append(" cie.codibge as municipioOrigemPadrao,"); + sb.append(" (case when ((case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) ="); + sb.append(" (case when s.aliasorigen_id is null then ed.cveestado else eds.cveestado end)) then 5357 else 6357 end) as cfop,"); + sb.append(" ei.porcredbaseicms as reducaoBaseCalcICMS,"); + sb.append(" ei.porcredmunicipal as porcReducaoMunicipal,"); + sb.append(" ei.porcredestadual as porcReducaoEstadual,"); + sb.append(" ei.tributacaoimportacao as tributacaoImportacao,"); + sb.append(" b.rmd_id,"); + sb.append(" coalesce(b.aidf_id, -1),"); + sb.append(" b.caja_id"); + sb.append(" from folio_consumo_rmd f"); + sb.append(" join estado eof on eof.estado_id = f.estado_id"); + sb.append(" join aidf r on r.aidf_id = f.rmd_id"); + sb.append(" join empresa e on e.empresa_id = f.empresa_id"); + sb.append(" join ciudad c on c.ciudad_id = e.ciudad_id"); + sb.append(" left join empresa_imposto eif on eif.activo = 1 and eif.empresa_id = f.empresa_id and eif.estado_id = eof.estado_id"); + sb.append(" left join inscricao_estadual ie on ie.empresa_id = f.empresa_id and ie.estado_id = eof.estado_id and ie.activo = 1"); + sb.append(" left join ciudad cie on cie.ciudad_id = ie.ciudad_id"); + sb.append(" left join caja b on b.activo = 1 and b.rmd_id = f.rmd_id and b.empresacorrida_id = f.empresa_id and b.foliormd = f.folio and to_char(b.fechorventa, 'ddmmyyyy') = to_char(f.fechorfolio, 'ddmmyyyy')"); + sb.append(" left join parada po on po.parada_id = b.origen_id and po.activo = 1 "); + sb.append(" left join ciudad co on co.ciudad_id = po.ciudad_id and co.activo = 1 "); + sb.append(" left join estado eo on eo.estado_id = co.estado_id and eo.activo = 1 "); + sb.append(" left join parada pd on pd.parada_id = b.destino_id"); + sb.append(" left join ciudad cd on cd.ciudad_id = pd.ciudad_id"); + sb.append(" left join estado ed on ed.estado_id = cd.estado_id"); + sb.append(" left join empresa_imposto ei on ei.activo = 1 and ei.empresa_id = b.empresacorrida_id and ei.estado_id = eof.estado_id"); + sb.append(" left join alias_servico s on s.origen_id = b.origen_id and s.destino_id = b.destino_id"); + sb.append(" and (s.corrida_id = b.corrida_id or s.corrida_id is null) and s.ruta_id = b.ruta_id and s.activo = 1 "); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + sb.append(" left join parada pds on pds.parada_id = s.aliasdestino_id"); + sb.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id"); + sb.append(" left join estado eds on eds.estado_id = cds.estado_id"); + sb.append(" left join aidf a on a.aidf_id = b.aidf_id"); + sb.append(" where f.activo = 1 "); + sb.append(" and f.indinactivo = 0 "); + sb.append(" and f.indbpr = 1 "); + sb.append(" and f.fechorfolio >= to_date(?,'DD/MM/YYYY HH24:MI:SS') and f.fechorfolio <= to_date(?,'DD/MM/YYYY HH24:MI:SS') "); + sb.append(" and f.empresa_id = ? "); + sb.append(" and eof.cveestado like ? "); + sb.append(" and (f.indcancelacion = 1 or ( "); + + if (isDif) { + sb.append(" ((b.tipoventa_id not in (5,12,18,81,82,49,41) and b.indstatusboleto = 'V' and b.indreimpresion = 0) "); + sb.append(" or (b.tipoventa_id in (5,12,18,81,82,49,41) "); + sb.append(" and b.indstatusboleto = 'E' and b.numfoliosistema = b.numfoliopreimpreso)) "); + sb.append(" and a.aidf_id is not null and b.indcancelacion = 0 "); + sb.append(" and (b.motivocancelacion_id is null or b.motivocancelacion_id <> 35) )) "); + } else { + sb.append(" ((b.tipoventa_id = 3 and b.indstatusboleto = 'V' and b.indreimpresion = 0) "); + sb.append(" or (b.tipoventa_id in (12,18) and b.indstatusboleto = 'E' and b.numfoliosistema = b.numfoliopreimpreso)) "); + sb.append(" and (b.motivocancelacion_id is null or b.motivocancelacion_id <> 35) )) "); + } + + sb.append(" order by dataEmissaoRMD "); + + try { + PreparedStatement ps = connection.prepareStatement(sb.toString()); + ps.setString(1, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00"); + ps.setString(2, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); + ps.setLong(3, Long.valueOf(empresaId)); + ps.setString(4, cveestado); + + ResultSet rs = ps.executeQuery(); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + + ExportacaoBPRBase registro = null; + + while (rs.next()) { + String ufDestino = rs.getString("ufDestino"); + String ufOrigem = rs.getString("ufOrigem"); + Integer municipioOrigem = rs.getInt("municipioOrigem"); + Integer municipioDestino = rs.getInt("municipioDestino"); + Integer municipioOrigemPadrao = rs.getInt("municipioOrigemPadrao"); + Integer cfop = rs.getInt("cfop"); + + if (ufOrigem != null && ufDestino != null) { + if (!ufOrigem.equals(cveestado)) { + if (ufDestino.equals(cveestado)) { + ufOrigem = cveestado; + municipioOrigem = municipioDestino; + } else { + ufOrigem = cveestado; + municipioOrigem = municipioOrigemPadrao; + } + + cfop = (ufOrigem.equals(ufDestino) ? 5357 : 6357); + } + } + + registro = new ExportacaoBPRBase(); + + // PAR + registro.setCodigoParticipantePar(rs.getInt("codigoParticipantePar")); + registro.setCodigoEstabelecimentoPar(rs.getInt("codigoEstabelecimentoPar")); + registro.setNomeParticipante(rs.getString("nomeParticipante")); + registro.setUfParticipante(rs.getString("ufParticipante")); + registro.setCpfParticipante(rs.getString("cnpjParticipante")); + registro.setIeParticipante(rs.getString("ieParticipante")); + registro.setLogradouro(rs.getString("logradouro")); + registro.setNumero(rs.getString("numero")); + registro.setComplemento(rs.getString("complemento")); + registro.setBairro(rs.getString("bairro")); + registro.setCep(rs.getString("cep") == null ? null : Integer.parseInt(rs.getString("cep").replace("-", "").replace(".", ""))); + + // RMD + registro.setDataEmissaoRMD(sdf.format(rs.getDate("dataEmissaoRMD"))); + registro.setCodigoParticipante(rs.getInt("codigoParticipante")); + registro.setCodigoEstabelecimento(rs.getInt("codigoEstabelecimento")); + registro.setNumeroAIDF(rs.getString("numeroAIDF")); + registro.setSerieAIDF(rs.getString("serieAIDF")); + registro.setSubSerieAIDF(rs.getString("subSerieAIDF")); + registro.setNumeroFormularioBilheteAIDF(rs.getLong("numeroFormularioBilheteAIDF")); + registro.setDocumentoCancelado(rs.getString("documentoCancelado").equals("S") ? Boolean.TRUE : Boolean.FALSE); + registro.setCodigoContabil(rs.getString("codigoContabil")); + + // BPS + registro.setDataEmissao(rs.getDate("dataEmissao") == null ? null : sdf.format(rs.getDate("dataEmissao"))); + registro.setNumeroFormulario(rs.getLong("numeroFormulario")); + registro.setNumeroAIDFRMD(rs.getString("numeroAIDFRMD")); + registro.setSerieAIDFRMD(rs.getString("serieAIDFRMD")); + registro.setSubSerieAIDFRMD(rs.getString("subSerieAIDFRMD")); + registro.setNumeroRMD(rs.getInt("numeroRMD")); + registro.setBoletoIsento(rs.getInt("boletoIsento")); + registro.setBoletoCancelado(rs.getInt("boletoCancelado")); + registro.setValorPago(rs.getBigDecimal("valorPago")); + + // DBP + registro.setUfDestino(ufDestino); + registro.setUfOrigem(ufOrigem); + registro.setMunicipioOrigem(municipioOrigem); + registro.setCfop(cfop); + registro.setReducaoBaseCalcICMS(rs.getBigDecimal("reducaoBaseCalcICMS")); + registro.setPorcReducaoMunicipal(rs.getBigDecimal("porcReducaoMunicipal")); + registro.setPorcReducaoEstadual(rs.getBigDecimal("porcReducaoEstadual")); + registro.setTributacaoImportacao(rs.getBigDecimal("tributacaoImportacao")); + + exportacaoRMD.getListaRegistroBPR().add(registro); + } + + rs.close(); + ps.close(); + + exportacaoRMD.gerarListas(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return exportacaoRMD; + } + + @Override + public List buscarRegistroRMDTipoPAR(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado) { + List retorno = new ArrayList(); + + StringBuilder sb = new StringBuilder(); + sb.append(" select"); + sb.append(" c.estado_id as cod_participante,"); + sb.append(" ei.codestabelecimento as cod_estabelecimento,"); + sb.append(" e.nombempresa as nombempresa,"); + sb.append(" ess.cveestado as cveestado,"); + sb.append(" ie.cnpj as cnpj,"); + sb.append(" ie.numinscricaoestadual as numinscricaoestadual,"); + sb.append(" ie.logradouro as logradouro,"); + sb.append(" ie.numero as numero,"); + sb.append(" ie.complemento as complemento,"); + sb.append(" ie.bairro as bairro,"); + sb.append(" ie.cep as cep"); + sb.append(" from empresa e"); + sb.append(" join ciudad c on c.ciudad_id = e.ciudad_id"); + sb.append(" join estado es on es.estado_id = c.estado_id"); + sb.append(" left join estado ess on ess.cveestado = ?"); + sb.append(" left join inscricao_estadual ie on ie.empresa_id = e.empresa_id and ie.estado_id = ess.estado_id and ie.activo = 1"); + sb.append(" left join empresa_imposto ei on ei.activo = 1 and ei.empresa_id = e.empresa_id and ei.estado_id = ess.estado_id"); + sb.append(" where e.empresa_id = ?"); + + try { + PreparedStatement ps = connection.prepareStatement(sb.toString()); + ps.setString(1, cveestado); + ps.setLong(2, Long.valueOf(empresaId)); + + ResultSet rs = ps.executeQuery(); + + ExportacaoRMDTipoPAR registro = null; + + while (rs.next()) { + registro = new ExportacaoRMDTipoPAR(); + registro.setCodigoParticipante(rs.getInt("cod_participante")); + registro.setCodigoEstabelecimento(rs.getInt("cod_estabelecimento")); + registro.setNomeParticipante(rs.getString("nombempresa")); + registro.setUfParticipante(rs.getString("cveestado")); + registro.setCpfParticipante(rs.getString("cnpj")); + registro.setIeParticipante(rs.getString("numinscricaoestadual")); + registro.setLogradouro(rs.getString("logradouro")); + registro.setNumero(rs.getString("numero")); + registro.setComplemento(rs.getString("complemento")); + registro.setBairro(rs.getString("bairro")); + registro.setCep(rs.getString("cep") == null ? null : Integer.parseInt(rs.getString("cep").replace("-", "").replace(".", ""))); + + retorno.add(registro); + } + + rs.close(); + ps.close(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return retorno; + } + + @Override + public List buscarRegistroRMDTipoRMD(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado) { + List retorno = new ArrayList(); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + + StringBuilder sb = new StringBuilder(); + sb.append(" select"); + sb.append(" ei.codestabelecimento as cod_estabelecimento,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN eo.estado_id ELSE eos.estado_id END) as cod_participante,"); + sb.append(" a.acfiscal as num_aidf,"); + sb.append(" a.serie as serie,"); + sb.append(" a.subserie as subserie,"); + sb.append(" b.foliormd as num_bilhete,"); + sb.append(" b.foliormd as num_formulario,"); + sb.append(" trunc(b.feccreacion) as data_emissao,"); + sb.append(" 'N' as doc_cancelado,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN (CASE WHEN co.estado_id = cd.estado_id THEN ei.codigocontabilmunicipal ELSE ei.codigocontabilestadual END) ELSE (CASE WHEN cos.estado_id = cds.estado_id THEN ei.codigocontabilmunicipal ELSE ei.codigocontabilestadual END) END) as cod_contabil"); + sb.append(" from boleto b"); + sb.append(" join empresa e on e.empresa_id = b.empresacorrida_id"); + sb.append(" join ciudad ce on ce.ciudad_id = e.ciudad_id"); + sb.append(" join parada po on po.parada_id = b.origen_id"); + sb.append(" join ciudad co on co.ciudad_id = po.ciudad_id"); + sb.append(" join estado eo on eo.estado_id = co.estado_id"); + sb.append(" left join alias_servico s on s.origen_id = b.origen_id and s.destino_id = b.destino_id and (s.corrida_id = b.corrida_id or s.corrida_id is null) and s.ruta_id = b.ruta_id and s.activo = 1 "); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + sb.append(" join parada pd on pd.parada_id = b.destino_id"); + sb.append(" join ciudad cd on cd.ciudad_id = po.ciudad_id"); + sb.append(" left join parada pds on pds.parada_id = s.aliasdestino_id"); + sb.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id"); + sb.append(" join aidf a on a.aidf_id = b.rmd_id"); + sb.append(" join empresa_imposto ei on ei.activo = 1 and ei.empresa_id = b.empresacorrida_id and ei.estado_id = (CASE WHEN s.aliasorigen_id IS NULL THEN co.estado_id ELSE cos.estado_id END)"); + sb.append(" where"); + sb.append(" b.activo = 1"); + sb.append(" and b.tipoventa_id = 3"); + sb.append(" and (b.indstatusboleto like 'V')"); + sb.append(" and b.empresacorrida_id = ?"); + sb.append(" and (b.feccreacion >= to_date(?, 'dd/MM/YYYY hh24:mi:ss') and b.feccreacion <= to_date(?, 'dd/MM/YYYY hh24:mi:ss'))"); + sb.append(" and (CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) like ?"); + sb.append(" group by"); + sb.append(" ei.codestabelecimento,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN eo.estado_id ELSE eos.estado_id END),"); + sb.append(" a.acfiscal,"); + sb.append(" a.serie,"); + sb.append(" a.subserie,"); + sb.append(" b.foliormd,"); + sb.append(" trunc(b.feccreacion),"); + sb.append(" 'N',"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN (CASE WHEN co.estado_id = cd.estado_id THEN ei.codigocontabilmunicipal ELSE ei.codigocontabilestadual END) ELSE (CASE WHEN cos.estado_id = cds.estado_id THEN ei.codigocontabilmunicipal ELSE ei.codigocontabilestadual END) END)"); + sb.append(" UNION"); + sb.append(" select distinct"); + sb.append(" ei.codestabelecimento as cod_estabelecimento,"); + sb.append(" eo.estado_id as cod_participante,"); + sb.append(" a.acfiscal as num_aidf,"); + sb.append(" a.serie as serie,"); + sb.append(" a.subserie as subserie,"); + sb.append(" f.folio as num_bilhete,"); + sb.append(" f.folio as num_formulario,"); + sb.append(" trunc(f.fechorfolio) as data_emissao,"); + sb.append(" 'S' as doc_cancelado,"); + sb.append(" null as cod_contabil"); + sb.append(" from folio_consumo_rmd f"); + sb.append(" join estado eo on eo.estado_id = f.estado_id"); + sb.append(" join empresa_imposto ei on ei.activo = 1 and ei.empresa_id = f.empresa_id and ei.estado_id = eo.estado_id"); + sb.append(" join aidf a on a.aidf_id = f.rmd_id"); + sb.append(" where"); + sb.append(" f.empresa_id = ?"); + sb.append(" and (f.fechorfolio >= to_date(?, 'dd/MM/YYYY hh24:mi:ss') and f.fechorfolio <= to_date(?, 'dd/MM/YYYY hh24:mi:ss'))"); + sb.append(" and eo.cveestado like ?"); + sb.append(" and f.indcancelacion = 1 and f.indbpr = 1 and f.activo = 1"); + + try { + PreparedStatement ps = connection.prepareStatement(sb.toString()); + ps.setLong(1, Long.valueOf(empresaId)); + ps.setString(2, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00"); + ps.setString(3, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); + ps.setString(4, cveestado); + ps.setLong(5, Long.valueOf(empresaId)); + ps.setString(6, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00"); + ps.setString(7, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); + ps.setString(8, cveestado); + + ResultSet rs = ps.executeQuery(); + + ExportacaoRMDTipoRMD registro = null; + + while (rs.next()) { + registro = new ExportacaoRMDTipoRMD(); + registro.setCodigoEstabelecimento(rs.getInt("cod_estabelecimento")); + registro.setNumeroAIDF(rs.getString("num_aidf")); + registro.setSerieAIDF(rs.getString("serie")); + registro.setSubSerieAIDF(rs.getString("subserie")); + registro.setNumeroBilheteAIDF(rs.getLong("num_bilhete")); + registro.setNumeroFormularioAIDF(rs.getLong("num_formulario")); + registro.setDataEmissao(sdf.format(rs.getDate("data_emissao"))); + registro.setCancelado(rs.getString("doc_cancelado").equals("S") ? Boolean.TRUE : Boolean.FALSE); + registro.setCodigoParticipante(rs.getInt("cod_participante")); + registro.setCodigoContabil(rs.getString("cod_contabil")); + + retorno.add(registro); + } + + rs.close(); + ps.close(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return retorno; + } + + @Override + @Deprecated + public List buscarRegistroRMDTipoBPS(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado) { + List retorno = new ArrayList(); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + + StringBuilder sb = new StringBuilder(); + sb.append(" select"); + sb.append(" ei.codestabelecimento as cod_estabelecimento,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN eo.estado_id ELSE eos.estado_id END) as cod_participante,"); + sb.append(" (CASE WHEN b.indstatusboleto like 'C' THEN 1 ELSE 0 END) as cancelado,"); + sb.append(" a.acfiscal as num_aidf,"); + sb.append(" a.serie as serie,"); + sb.append(" a.subserie as subserie,"); + sb.append(" b.feccreacion as data_emissao,"); + sb.append(" b.numfoliopreimpreso as num_formulario,"); + sb.append(" b.preciopagado as valor_total,"); + sb.append(" r.acfiscal as num_aidf_rmd,"); + sb.append(" r.serie as serie_rmd,"); + sb.append(" r.subserie as subserie_rmd,"); + sb.append(" b.foliormd as num_rmd"); + sb.append(" from boleto b"); + sb.append(" join empresa e on e.empresa_id = b.empresacorrida_id"); + sb.append(" join ciudad ce on ce.ciudad_id = e.ciudad_id"); + sb.append(" join parada po on po.parada_id = b.origen_id"); + sb.append(" join ciudad co on co.ciudad_id = po.ciudad_id"); + sb.append(" join estado eo on eo.estado_id = co.estado_id"); + sb.append(" left join alias_servico s on s.origen_id = b.origen_id and s.destino_id = b.destino_id and (s.corrida_id = b.corrida_id or s.corrida_id is null) and s.ruta_id = b.ruta_id"); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + // sb.append(" join aidf a on a.serie = substr(b.numseriepreimpresa, 1, 3) and a.estado_id = (CASE WHEN s.aliasorigen_id IS NULL THEN eo.estado_id ELSE eos.estado_id END)"); + sb.append(" join aidf a on a.aidf_id = b.aidf_id"); + sb.append(" join aidf r on r.aidf_id = b.rmd_id"); + sb.append(" join empresa_imposto ei on ei.activo = 1 and ei.empresa_id = b.empresacorrida_id and ei.estado_id = (CASE WHEN s.aliasorigen_id IS NULL THEN eo.estado_id ELSE eos.estado_id END)"); + sb.append(" where"); + sb.append(" b.activo = 1"); + sb.append(" and b.tipoventa_id = 3"); + sb.append(" and (b.indstatusboleto like 'V' or b.indstatusboleto like 'C')"); + sb.append(" and b.empresacorrida_id = ?"); + sb.append(" and (b.fechorventa >= to_date(?, 'dd/MM/YYYY hh24:mi:ss') and b.fechorventa <= to_date(?, 'dd/MM/YYYY hh24:mi:ss'))"); + sb.append(" and (CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) like ?"); + sb.append(" order by b.feccreacion,a.acfiscal,b.numfoliopreimpreso"); + + try { + PreparedStatement ps = connection.prepareStatement(sb.toString()); + ps.setLong(1, Long.valueOf(empresaId)); + ps.setString(2, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00"); + ps.setString(3, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); + ps.setString(4, cveestado); + + ResultSet rs = ps.executeQuery(); + + Map group = new HashMap(); + + ExportacaoRMDTipoBPS registro = null; + + Long numeroInicial = null; + Long numeroFinal = null; + + while (rs.next()) { + String key = sdf.format(rs.getDate("data_emissao")) + "|" + rs.getLong("num_aidf") + "|" + rs.getLong("num_formulario"); + + if (group.containsKey(key)) { + registro = group.get(key); + + numeroInicial = rs.getLong("num_formulario"); + numeroFinal = rs.getLong("num_formulario"); + + if (numeroInicial.intValue() > registro.getNumeroInicial().intValue()) { + numeroInicial = registro.getNumeroInicial(); + } + + if (numeroFinal.intValue() < registro.getNumeroFinal().intValue()) { + numeroFinal = registro.getNumeroFinal(); + } + + } else { + registro = new ExportacaoRMDTipoBPS(); + registro.setCodigoEstabelecimento(rs.getInt("cod_estabelecimento")); + registro.setEspecie("BPR"); + registro.setNumeroAIDF(rs.getLong("num_aidf")); + registro.setSerieAIDF(rs.getString("serie")); + registro.setSubSerieAIDF(rs.getString("subserie")); + registro.setNumeroAIDFRMD(rs.getLong("num_aidf_rmd")); + registro.setSerieAIDFRMD(rs.getString("serie_rmd")); + registro.setSubSerieAIDFRMD(rs.getString("subserie_rmd")); + registro.setNumeroRMD(rs.getInt("num_rmd")); + + registro.setDataEmissao(sdf.format(rs.getDate("data_emissao"))); + + registro.setQuantidadeTotal(0); + registro.setQuantidadeCancelados(0); + registro.setValorTotal(BigDecimal.ZERO); + registro.setResumoMovimentoDiario(null); + + numeroInicial = rs.getLong("num_formulario"); + numeroFinal = rs.getLong("num_formulario"); + } + + registro.setNumeroInicial(numeroInicial); + registro.setNumeroFinal(numeroFinal); + + registro.setQuantidadeTotal(registro.getQuantidadeTotal() + 1); + registro.setQuantidadeCancelados(registro.getQuantidadeCancelados() + rs.getInt("cancelado")); + + if (rs.getInt("cancelado") == 0) { + registro.setValorTotal(registro.getValorTotal().add(rs.getBigDecimal("valor_total"))); + } + + group.put(key, registro); + } + + for (Map.Entry entry : group.entrySet()) { + registro = entry.getValue(); + + if (registro.getQuantidadeTotal().intValue() == registro.getQuantidadeCancelados().intValue()) { + registro.setValorTotal(null); + } else { + registro.setResumoMovimentoDiario(Boolean.TRUE); + } + + retorno.add(registro); + } + + rs.close(); + ps.close(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return retorno; + } + + @Override + @Deprecated + public List buscarRegistroRMDTipoDBP(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado) { + List retorno = new ArrayList(); + + StringBuilder sb = new StringBuilder(); + sb.append(" select"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) as estado_origem,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ed.cveestado ELSE eds.cveestado END) as estado_destino,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN co.codibge ELSE cos.codibge END) as municipio_origem,"); + sb.append(" (CASE WHEN ((CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) = (CASE WHEN s.aliasorigen_id IS NULL THEN ed.cveestado ELSE eds.cveestado END)) THEN 5357 ELSE 6357 END) as cod_operacao,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredbaseicms ELSE eis.porcredbaseicms END) as red_base_calc_icms,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredmunicipal ELSE eis.porcredmunicipal END) as porc_red_municipal,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredestadual ELSE eis.porcredestadual END) as porc_red_estadual,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.tributacaoimportacao ELSE eis.tributacaoimportacao END) as tributacao_importacao,"); + sb.append(" (CASE WHEN (nvl((CASE WHEN s.aliasorigen_id IS NULL THEN po.regionmetropolitana_id ELSE pos.regionmetropolitana_id END),-1) = nvl((CASE WHEN s.aliasorigen_id IS NULL THEN pd.regionmetropolitana_id ELSE pds.regionmetropolitana_id END),-2)) THEN 1 ELSE 0 END) as isenta,"); + sb.append(" (nvl(b.preciopagado,0) - nvl(b.importetaxaembarque,0) - nvl(b.importepedagio,0) - nvl(b.importeseguro,0) - nvl(b.importeoutros,0)) as valor_tarifa,"); + sb.append(" b.preciopagado as valor_total,"); + sb.append(" (CASE WHEN nvl(case when s.aliasorigen_id is null then po.regionmetropolitana_id else pos.regionmetropolitana_id end, -1) = nvl(case when s.aliasorigen_id is null then pd.regionmetropolitana_id else pds.regionmetropolitana_id end, -2) THEN 1 ELSE 0 END) as reg_metropolitana"); + sb.append(" from boleto b"); + sb.append(" join empresa e on e.empresa_id = b.empresacorrida_id"); + sb.append(" join parada po on po.parada_id = b.origen_id"); + sb.append(" join ciudad co on co.ciudad_id = po.ciudad_id"); + sb.append(" join estado eo on eo.estado_id = co.estado_id"); + sb.append(" join parada pd on pd.parada_id = b.destino_id"); + sb.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id"); + sb.append(" join estado ed on ed.estado_id = cd.estado_id"); + sb.append(" left join alias_servico s on s.origen_id = b.origen_id and s.destino_id = b.destino_id and (s.corrida_id = b.corrida_id or s.corrida_id is null) and s.ruta_id = b.ruta_id"); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + sb.append(" left join parada pds on pds.parada_id = s.aliasdestino_id"); + sb.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id"); + sb.append(" left join estado eds on eds.estado_id = cds.estado_id"); + sb.append(" join empresa_imposto ei on ei.activo = 1 and ei.empresa_id = b.empresacorrida_id and ei.estado_id = eo.estado_id"); + sb.append(" left join empresa_imposto eis on eis.activo = 1 and eis.empresa_id = b.empresacorrida_id and eis.estado_id = eos.estado_id"); + sb.append(" where"); + sb.append(" b.activo = 1"); + sb.append(" and b.tipoventa_id = 3"); + sb.append(" and (b.indstatusboleto like 'V' or b.indstatusboleto like 'C')"); + sb.append(" and b.empresacorrida_id = ?"); + sb.append(" and (b.fechorventa >= to_date(?, 'dd/MM/YYYY hh24:mi:ss') and b.fechorventa <= to_date(?, 'dd/MM/YYYY hh24:mi:ss'))"); + sb.append(" and (CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) like ?"); + + try { + PreparedStatement ps = connection.prepareStatement(sb.toString()); + ps.setLong(1, Long.valueOf(empresaId)); + ps.setString(2, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00"); + ps.setString(3, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); + ps.setString(4, cveestado); + + ResultSet rs = ps.executeQuery(); + + ExportacaoRMDTipoDBP registro = null; + + Map group = new HashMap(); + + while (rs.next()) { + String key = rs.getString("estado_destino") + "|" + rs.getInt("cod_operacao") + "|" + rs.getString("estado_origem") + "|" + rs.getInt("municipio_origem"); + + if (group.containsKey(key)) { + registro = group.get(key); + } else { + registro = new ExportacaoRMDTipoDBP(); + registro.setUfDestino(rs.getString("estado_destino")); + registro.setCfop(rs.getInt("cod_operacao")); // IM=5357; Serviço IE= 6357 + registro.setUfOrigem(rs.getString("estado_origem")); + registro.setMunicipioOrigem(rs.getInt("municipio_origem")); + + registro.setCodigoSituacaoTribColunaB(null); + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + if (rs.getInt("isenta") == 1) { + registro.setCodigoSituacaoTribColunaB(40); + } + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + if (registro.getCodigoSituacaoTribColunaB() == null) { + registro.setCodigoSituacaoTribColunaB(rs.getInt("red_base_calc_icms") == 0 ? 0 : 20); + } + + registro.setValorBaseCalculoICMS(BigDecimal.ZERO); + registro.setValorTotal(BigDecimal.ZERO); + registro.setValorICMS(BigDecimal.ZERO); + registro.setValorICMSIsento(BigDecimal.ZERO); + registro.setValorICMSOutros(BigDecimal.ZERO); + } + + BigDecimal valorTotal = rs.getBigDecimal("valor_total"); + BigDecimal red_base_calc_icms = rs.getBigDecimal("red_base_calc_icms"); + BigDecimal porc_red_municipal = rs.getBigDecimal("porc_red_municipal"); + BigDecimal porc_red_estadual = rs.getBigDecimal("porc_red_estadual"); + BigDecimal tributacao_importacao = rs.getBigDecimal("tributacao_importacao"); + BigDecimal valorBaseCalculoICMS = BigDecimal.ZERO; + + BigDecimal valorIsenta = BigDecimal.ZERO; + BigDecimal valorIsentaOutros = BigDecimal.ZERO; + + if (rs.getInt("reg_metropolitana") == 1) { + valorIsenta = valorTotal; + valorTotal = BigDecimal.ZERO; + } else { + if (red_base_calc_icms != null) { + valorBaseCalculoICMS = valorTotal.subtract(valorTotal.multiply(red_base_calc_icms.divide(BigDecimal.valueOf(100d)))); + } else { + // if (tributacao_importacao != null) { + // if (rs.getString("estado_origem").equals(rs.getString("estado_destino"))) { + // if (porc_red_municipal != null) { + // BigDecimal porc = tributacao_importacao.subtract(tributacao_importacao.multiply(porc_red_municipal.divide(BigDecimal.valueOf(100d)))); + // valorBaseCalculoICMS = valorTotal.multiply(porc.divide(BigDecimal.valueOf(100d))); + // } + // } else { + // if (porc_red_estadual != null) { + // BigDecimal porc = tributacao_importacao.subtract(tributacao_importacao.multiply(porc_red_estadual.divide(BigDecimal.valueOf(100d)))); + // valorBaseCalculoICMS = valorTotal.multiply(porc.divide(BigDecimal.valueOf(100d))); + // } + // } + // } + + valorBaseCalculoICMS = valorTotal; + } + } + + registro.setAliquotaICMS(tributacao_importacao); + + if (tributacao_importacao == null) { + tributacao_importacao = BigDecimal.ZERO; + } else { + if (red_base_calc_icms != null) { + BigDecimal porc_red = BigDecimal.ZERO; + + if (rs.getString("estado_origem").equals(rs.getString("estado_destino"))) { + if (porc_red_municipal != null) { + porc_red = porc_red_municipal; + } + } else { + if (porc_red_estadual != null) { + porc_red = porc_red_estadual; + } + } + + BigDecimal porc = tributacao_importacao.subtract(porc_red.divide(BigDecimal.valueOf(100d))); + valorIsentaOutros = valorTotal.multiply(porc); + } + + tributacao_importacao = MoneyHelper.dividir(tributacao_importacao, BigDecimal.valueOf(100d)); + } + + BigDecimal valorICMS = MoneyHelper.multiplicar(valorBaseCalculoICMS, tributacao_importacao); + + registro.setValorBaseCalculoICMS(registro.getValorBaseCalculoICMS().add(valorBaseCalculoICMS)); + registro.setValorTotal(registro.getValorTotal().add(valorTotal)); + registro.setValorICMS(registro.getValorICMS().add(valorICMS)); + registro.setValorICMSIsento(registro.getValorICMSIsento().add(valorIsenta)); + registro.setValorICMSOutros(registro.getValorICMSOutros().add(valorIsentaOutros)); + + group.put(key, registro); + } + + for (Map.Entry entry : group.entrySet()) { + retorno.add(entry.getValue()); + } + + rs.close(); + ps.close(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return retorno; + } + + @Override + @Deprecated + public List buscarRegistroRMDSeqTipoBPS(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado) { + List listaBPS = new ArrayList(); + + StringBuilder sb = new StringBuilder(); + sb.append(" select"); + sb.append(" ei.codestabelecimento as cod_estabelecimento,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN eo.estado_id ELSE eos.estado_id END) as cod_participante,"); + sb.append(" (CASE WHEN b.indstatusboleto like 'C' THEN 1 ELSE 0 END) as cancelado,"); + sb.append(" b.aidf_id,"); + sb.append(" a.acfiscal as num_aidf,"); + sb.append(" a.serie as serie,"); + sb.append(" a.subserie as subserie,"); + sb.append(" b.feccreacion as data_emissao,"); + sb.append(" b.numfoliopreimpreso as num_formulario,"); + sb.append(" b.preciopagado as valor_total,"); + sb.append(" b.rmd_id,"); + sb.append(" r.acfiscal as num_aidf_rmd,"); + sb.append(" r.serie as serie_rmd,"); + sb.append(" r.subserie as subserie_rmd,"); + sb.append(" b.foliormd as num_rmd,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) as estado_origem,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ed.cveestado ELSE eds.cveestado END) as estado_destino,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN co.codibge ELSE cos.codibge END) as municipio_origem,"); + sb.append(" (CASE WHEN ((CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) = (CASE WHEN s.aliasorigen_id IS NULL THEN ed.cveestado ELSE eds.cveestado END)) THEN 5357 ELSE 6357 END) as cod_operacao,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredbaseicms ELSE eis.porcredbaseicms END) as red_base_calc_icms,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredmunicipal ELSE eis.porcredmunicipal END) as porc_red_municipal,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.porcredestadual ELSE eis.porcredestadual END) as porc_red_estadual,"); + sb.append(" (CASE WHEN s.aliasorigen_id IS NULL THEN ei.tributacaoimportacao ELSE eis.tributacaoimportacao END) as tributacao_importacao,"); + sb.append(" (CASE WHEN (nvl((CASE WHEN s.aliasorigen_id IS NULL THEN po.regionmetropolitana_id ELSE pos.regionmetropolitana_id END),-1) = nvl((CASE WHEN s.aliasorigen_id IS NULL THEN pd.regionmetropolitana_id ELSE pds.regionmetropolitana_id END),-2)) THEN 1 ELSE 0 END) as isenta,"); + sb.append(" (nvl(b.preciopagado,0) - nvl(b.importetaxaembarque,0) - nvl(b.importepedagio,0) - nvl(b.importeseguro,0) - nvl(b.importeoutros,0)) as valor_tarifa,"); + sb.append(" b.preciopagado as valor_total,"); + sb.append(" (CASE WHEN nvl(case when s.aliasorigen_id is null then po.regionmetropolitana_id else pos.regionmetropolitana_id end, -1) = nvl(case when s.aliasorigen_id is null then pd.regionmetropolitana_id else pds.regionmetropolitana_id end, -2) THEN 1 ELSE 0 END) as reg_metropolitana"); + sb.append(" from boleto b"); + sb.append(" join empresa e on e.empresa_id = b.empresacorrida_id"); + sb.append(" join parada po on po.parada_id = b.origen_id"); + sb.append(" join ciudad co on co.ciudad_id = po.ciudad_id"); + sb.append(" join estado eo on eo.estado_id = co.estado_id"); + sb.append(" join parada pd on pd.parada_id = b.destino_id"); + sb.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id"); + sb.append(" join estado ed on ed.estado_id = cd.estado_id"); + sb.append(" left join alias_servico s on s.origen_id = b.origen_id and s.destino_id = b.destino_id and (s.corrida_id = b.corrida_id or s.corrida_id is null) and s.ruta_id = b.ruta_id"); + sb.append(" left join parada pos on pos.parada_id = s.aliasorigen_id"); + sb.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id"); + sb.append(" left join estado eos on eos.estado_id = cos.estado_id"); + sb.append(" left join parada pds on pds.parada_id = s.aliasdestino_id"); + sb.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id"); + sb.append(" left join estado eds on eds.estado_id = cds.estado_id"); + sb.append(" join empresa_imposto ei on ei.activo = 1 and ei.empresa_id = b.empresacorrida_id and ei.estado_id = eo.estado_id"); + sb.append(" left join empresa_imposto eis on eis.activo = 1 and eis.empresa_id = b.empresacorrida_id and eis.estado_id = eos.estado_id"); + sb.append(" join aidf a on a.aidf_id = b.aidf_id"); + sb.append(" join aidf r on r.aidf_id = b.rmd_id"); + sb.append(" where"); + sb.append(" b.activo = 1"); + sb.append(" and b.tipoventa_id = 3"); + sb.append(" and (b.indstatusboleto like 'V' or b.indstatusboleto like 'C')"); + sb.append(" and b.empresacorrida_id = ?"); + sb.append(" and (b.fechorventa >= to_date(?, 'dd/MM/YYYY hh24:mi:ss') and b.fechorventa <= to_date(?, 'dd/MM/YYYY hh24:mi:ss'))"); + sb.append(" and (CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) like ?"); + sb.append(" order by b.fechorventa, b.numfoliopreimpreso, (CASE WHEN ((CASE WHEN s.aliasorigen_id IS NULL THEN eo.cveestado ELSE eos.cveestado END) = (CASE WHEN s.aliasorigen_id IS NULL THEN ed.cveestado ELSE eds.cveestado END)) THEN 5357 ELSE 6357 END), (CASE WHEN s.aliasorigen_id IS NULL THEN ed.cveestado ELSE eds.cveestado END)"); + + try { + PreparedStatement ps = connection.prepareStatement(sb.toString()); + ps.setLong(1, Long.valueOf(empresaId)); + ps.setString(2, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00"); + ps.setString(3, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); + ps.setString(4, cveestado); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + + ResultSet rs = ps.executeQuery(); + + ExportacaoRMDTipoSeqBPS registroBPS = null; + ExportacaoRMDTipoSeqDBP registroDBP = null; + + Long numeroInicial = 0l; + Long numeroFinal = 0l; + + String dataEmissaoControle = ""; + Integer cfopControle = 0; + + Integer quantidadeTotal = 0; + Integer quantidadeCancelado = 0; + + BigDecimal totalizador = BigDecimal.ZERO; + + while (rs.next()) { + Integer codigoEstabelecimento = rs.getInt("cod_estabelecimento"); + String numeroAIDF = rs.getString("num_aidf"); + String serieAIDF = rs.getString("serie"); + String subSerieAIDF = rs.getString("subserie"); + String numeroAIDFRMD = rs.getString("num_aidf_rmd"); + String serieAIDFRMD = rs.getString("serie_rmd"); + String subSerieAIDFRMD = rs.getString("subserie_rmd"); + Integer numeroRMD = rs.getInt("num_rmd"); + String dataEmissao = sdf.format(rs.getDate("data_emissao")); + Long numeroFormulario = rs.getLong("num_formulario"); + String ufDestino = rs.getString("estado_destino"); + Integer cfop = rs.getInt("cod_operacao"); // IM=5357; Serviço IE= 6357 + String ufOrigem = rs.getString("estado_origem"); + Integer municipioOrigem = rs.getInt("municipio_origem"); + Boolean isenta = (rs.getInt("isenta") == 1); + Boolean cancelado = (rs.getInt("cancelado") == 1); + BigDecimal valorTotal = rs.getBigDecimal("valor_total"); + BigDecimal red_base_calc_icms = rs.getBigDecimal("red_base_calc_icms"); + BigDecimal porc_red_municipal = rs.getBigDecimal("porc_red_municipal"); + BigDecimal porc_red_estadual = rs.getBigDecimal("porc_red_estadual"); + BigDecimal tributacao_importacao = rs.getBigDecimal("tributacao_importacao"); + + // BPR + if ((numeroFinal + 1) != numeroFormulario || !dataEmissaoControle.equals(dataEmissao) || !cfopControle.equals(cfop)) { + numeroInicial = numeroFormulario; + dataEmissaoControle = dataEmissao; + cfopControle = cfop; + + registroBPS = new ExportacaoRMDTipoSeqBPS(); + registroBPS.setEspecie("BPR"); + registroBPS.setNumeroInicial(numeroInicial); + registroBPS.setCodigoEstabelecimento(codigoEstabelecimento); + registroBPS.setNumeroAIDF(numeroAIDF); + registroBPS.setSerieAIDF(serieAIDF); + registroBPS.setSubSerieAIDF(subSerieAIDF); + registroBPS.setNumeroAIDFRMD(numeroAIDFRMD); + registroBPS.setSerieAIDFRMD(serieAIDFRMD); + registroBPS.setSubSerieAIDFRMD(subSerieAIDFRMD); + registroBPS.setNumeroRMD(numeroRMD); + registroBPS.setDataEmissao(dataEmissao); + registroBPS.setInfoPadraoBilhetePassagem(CODIGO_INDICADOR_CONTR_PREVIDENCIARIA); + + listaBPS.add(registroBPS); + + quantidadeTotal = 0; + quantidadeCancelado = 0; + + totalizador = BigDecimal.ZERO; + } + + quantidadeTotal++; + + if (cancelado) { + quantidadeCancelado++; + } else { + totalizador = MoneyHelper.somar(totalizador, valorTotal); + } + + numeroFinal = numeroFormulario; + + registroBPS.setNumeroFinal(numeroFinal); + + registroBPS.setQuantidadeTotal(quantidadeTotal); + registroBPS.setQuantidadeCancelados(quantidadeCancelado); + registroBPS.setValorTotal(totalizador); + + // DBP + registroDBP = new ExportacaoRMDTipoSeqDBP(ufDestino); + + Integer indice = registroBPS.getListaDBP().indexOf(registroDBP); + + if (indice == -1) { + registroBPS.getListaDBP().add(registroDBP); + + registroDBP.setCfop(cfop); // IM=5357; Serviço IE= 6357 + registroDBP.setUfOrigem(ufOrigem); + registroDBP.setMunicipioOrigem(municipioOrigem); + + registroDBP.setCodigoSituacaoTribColunaB(null); + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + if (isenta) { + registroDBP.setCodigoSituacaoTribColunaB(40); + } + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + if (registroDBP.getCodigoSituacaoTribColunaB() == null) { + registroDBP.setCodigoSituacaoTribColunaB(red_base_calc_icms == null || red_base_calc_icms.compareTo(BigDecimal.ZERO) == 0 ? 0 : 20); + } + + registroDBP.setValorBaseCalculoICMS(BigDecimal.ZERO); + registroDBP.setValorTotal(BigDecimal.ZERO); + registroDBP.setValorICMS(BigDecimal.ZERO); + registroDBP.setValorICMSIsento(BigDecimal.ZERO); + registroDBP.setValorICMSOutros(BigDecimal.ZERO); + } else { + registroDBP = registroBPS.getListaDBP().get(indice); + } + + BigDecimal valorBaseCalculoICMS = BigDecimal.ZERO; + + BigDecimal valorIsenta = BigDecimal.ZERO; + BigDecimal valorIsentaOutros = BigDecimal.ZERO; + + if (rs.getInt("reg_metropolitana") == 1) { + valorIsenta = valorTotal; + valorTotal = BigDecimal.ZERO; + } else { + if (red_base_calc_icms != null) { + valorBaseCalculoICMS = valorTotal.subtract(valorTotal.multiply(red_base_calc_icms.divide(BigDecimal.valueOf(100d)))); + } else { + valorBaseCalculoICMS = valorTotal; + } + } + + registroDBP.setAliquotaICMS(tributacao_importacao); + + if (tributacao_importacao == null) { + tributacao_importacao = BigDecimal.ZERO; + } else { + if (red_base_calc_icms != null) { + BigDecimal porc_red = BigDecimal.ZERO; + + if (rs.getString("estado_origem").equals(rs.getString("estado_destino"))) { + if (porc_red_municipal != null) { + porc_red = porc_red_municipal; + } + } else { + if (porc_red_estadual != null) { + porc_red = porc_red_estadual; + } + } + + BigDecimal porc = tributacao_importacao.subtract(porc_red.divide(BigDecimal.valueOf(100d))); + valorIsentaOutros = valorTotal.multiply(porc); + } + + tributacao_importacao = MoneyHelper.dividir(tributacao_importacao, BigDecimal.valueOf(100d)); + } + + BigDecimal valorICMS = MoneyHelper.multiplicar(valorBaseCalculoICMS, tributacao_importacao); + + registroDBP.setValorBaseCalculoICMS(registroDBP.getValorBaseCalculoICMS().add(valorBaseCalculoICMS)); + registroDBP.setValorTotal(registroDBP.getValorTotal().add(valorTotal)); + registroDBP.setValorICMS(registroDBP.getValorICMS().add(valorICMS)); + registroDBP.setValorICMSIsento(registroDBP.getValorICMSIsento().add(valorIsenta)); + registroDBP.setValorICMSOutros(registroDBP.getValorICMSOutros().add(valorIsentaOutros)); + } + + rs.close(); + ps.close(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return listaBPS; + } + + @Override + public void cancelarRMDBoleto(Connection connection, Date inicio, Date fim, Integer empresaId, Estado estado, Aidf aidf, + String folioInicial, String folioFinal, boolean isCancela, boolean isInativa, boolean isECF, boolean isBPR) { + + List boletos = new ArrayList(); + String boletoAgr = null; + int cont = 0; + + List foliosRmd = new ArrayList(); + + if (isCancela) { + cancelaFolioConsumoRmd(connection, empresaId, estado.getEstadoId(), aidf.getAidfId(), folioInicial, folioFinal, inicio, fim); + } else { + inativarFolioConsumoRmd(connection, empresaId, estado.getEstadoId(), aidf.getAidfId(), folioInicial, folioFinal, inicio, fim); + } + + for (DetalhadoRMD brp : buscarRegistroImpressaoBPR(connection, inicio, fim, empresaId, estado.getCveestado(), aidf.getAidfId(), + folioInicial, folioFinal, isBPR, isECF, true)) { + + if (!foliosRmd.contains(brp.getFoliormd())) + foliosRmd.add(brp.getFoliormd()); + + if (cont == 999) { + boletos.add(boletoAgr); + boletoAgr = null; + cont = 0; + } + + if (boletoAgr == null) + boletoAgr = brp.getCajaId().toString(); + else + boletoAgr = boletoAgr + " ," + brp.getCajaId(); + + cont++; + } + boletos.add(boletoAgr); + + if (isInativa) { + for (String folio : foliosRmd) { + insereConsulmoFolioRMD(connection, inicio, empresaId, estado.getEstadoId(), aidf, folio, + isCancela, isInativa, false, isECF, isBPR, null, null, null, null, null, null); + } + } + + marcarRMDCaja(connection, boletos, null, null); + } + + private void cancelaFolioConsumoRmd(Connection connection, Integer empresaId, Integer estadoId, + Long rmdId, String folioInicial, String folioFinal, Date inicio, Date fim) { + + PreparedStatement pstmt = null; + try { + StringBuilder sb = new StringBuilder(); + sb.append(" update folio_consumo_rmd "); + sb.append(" set activo = 1, fecmodif = sysdate, indcancelacion = 1 "); + sb.append(" where activo = 1 "); + sb.append(" and indimpresso = 1 "); + sb.append(" and rmd_id = ? "); + sb.append(" and empresa_id = ? "); + sb.append(" and estado_id = ? "); + sb.append(" and folio between ? and ? "); + sb.append(" and fechorfolio between to_date(?,'dd/MM/yyyy HH24:MI:SS') and to_date(?,'dd/MM/yyyy HH24:MI:SS') "); + + pstmt = connection.prepareStatement(sb.toString()); + pstmt.setInt(1, rmdId.intValue()); + pstmt.setInt(2, empresaId); + pstmt.setInt(3, estadoId); + pstmt.setString(4, folioInicial); + pstmt.setString(5, folioFinal); + pstmt.setString(6, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00"); + pstmt.setString(7, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); + + pstmt.executeUpdate(); + + } catch (Exception e) { + log.error("", e); + } finally { + try { + if (pstmt != null && !pstmt.isClosed()) { + pstmt.close(); + } + } catch (Exception e) { + log.error("", e); + } + } + } + + private void inativarFolioConsumoRmd(Connection connection, Integer empresaId, Integer estadoId, + Long rmdId, String folioInicial, String folioFinal, Date inicio, Date fim) { + + PreparedStatement pstmt = null; + try { + StringBuilder sb = new StringBuilder(); + sb.append(" update folio_consumo_rmd "); + sb.append(" set activo = 0, fecmodif = sysdate "); + sb.append(" where activo = 1 "); + sb.append(" and indimpresso = 1 "); + sb.append(" and rmd_id = ? "); + sb.append(" and empresa_id = ? "); + sb.append(" and estado_id = ? "); + sb.append(" and folio between ? and ? "); + sb.append(" and fechorfolio between to_date(?,'dd/MM/yyyy HH24:MI:SS') and to_date(?,'dd/MM/yyyy HH24:MI:SS') "); + + pstmt = connection.prepareStatement(sb.toString()); + pstmt.setInt(1, rmdId.intValue()); + pstmt.setInt(2, empresaId); + pstmt.setInt(3, estadoId); + pstmt.setString(4, folioInicial); + pstmt.setString(5, folioFinal); + pstmt.setString(6, DateUtil.getStringDate(inicio, DATE_FORMAT_DMY) + " 00:00:00"); + pstmt.setString(7, DateUtil.getStringDate(fim, DATE_FORMAT_DMY) + " 23:59:59"); + + pstmt.executeUpdate(); + + } catch (Exception e) { + log.error("", e); + } finally { + try { + if (pstmt != null && !pstmt.isClosed()) { + pstmt.close(); + } + } catch (Exception e) { + log.error("", e); + } + } + } + + private void insereConsulmoFolioRMD(Connection connection, Date dataBilhete, Integer empresaId, Integer estadoId, Aidf aidf, + String folio, boolean isCancela, boolean isInativa, boolean isImpresso, boolean isECF, boolean isBPR, + BigDecimal valorContabil, BigDecimal baseCalculo, BigDecimal aliquota, BigDecimal isentos, + BigDecimal outros, BigDecimal icms) { + + PreparedStatement pstmt = null; + try { + StringBuilder sb = new StringBuilder(); + sb.append(" insert into FOLIO_CONSUMO_RMD (FOLIOCONSUMORMD_ID, RMD_ID, FOLIO, "); + sb.append(" EMPRESA_ID, ESTADO_ID, INDCANCELACION, INDINACTIVO, INDIMPRESSO, FECHORFOLIO, "); + sb.append(" VALORCONTABIL, BASECALCULO, ALIQUOTA, ISENTOS, OUTROS, ICMS, "); + sb.append(" INDECF, INDBPR, ACTIVO, FECMODIF, USUARIO_ID) "); + sb.append(" values (").append("FOLIO_CONSUMO_RMD_SEQ.NEXTVAL").append(","); + sb.append(aidf.getAidfId()).append(",").append(folio).append(","); + sb.append(empresaId).append(",").append(estadoId).append(","); + + if (isCancela) + sb.append(1).append(",").append(0).append(",").append(0).append(","); + else if (isInativa) + sb.append(0).append(",").append(1).append(",").append(0).append(","); + else if (isImpresso) + sb.append(0).append(",").append(0).append(",").append(1).append(","); + + sb.append("?").append(","); + sb.append("?").append(","); + sb.append("?").append(","); + sb.append("?").append(","); + sb.append("?").append(","); + sb.append("?").append(","); + sb.append("?").append(","); + + if (isECF) + sb.append(1).append(",").append(0).append(","); + else + sb.append(0).append(",").append(1).append(","); + + sb.append(1).append(",").append("SYSDATE").append(",").append(UsuarioLogado.getUsuarioLogado().getUsuarioId()).append(")"); + + pstmt = connection.prepareStatement(sb.toString()); + pstmt.setTimestamp(1, new java.sql.Timestamp(DateUtil.inicioFecha(dataBilhete).getTime())); + pstmt.setBigDecimal(2, MoneyHelper.arredondar(valorContabil)); + pstmt.setBigDecimal(3, MoneyHelper.arredondar(baseCalculo)); + pstmt.setBigDecimal(4, MoneyHelper.arredondar(aliquota)); + pstmt.setBigDecimal(5, MoneyHelper.arredondar(isentos)); + pstmt.setBigDecimal(6, MoneyHelper.arredondar(outros)); + pstmt.setBigDecimal(7, MoneyHelper.arredondar(icms)); + pstmt.executeUpdate(); + + } catch (Exception e) { + log.error("", e); + } finally { + try { + if (pstmt != null && !pstmt.isClosed()) { + pstmt.close(); + } + } catch (Exception e) { + log.error("", e); + } + } + } + + @Override + public void gravarRMDBoleto(Connection connection, List rmds, Aidf aidf, String folio, Integer empresaId, Integer estadoId, boolean isECF, boolean isBPR) { + + int cont = 0; + Integer rmdIterate = Integer.parseInt(folio); + rmdIterate = rmdIterate - 1; + + String boletoAgr = null; + List boletos = new ArrayList(); + int contBolto = 0; + Date dataBilhete = null; + + BigDecimal valorContabil = BigDecimal.ZERO; + BigDecimal baseCalculo = BigDecimal.ZERO; + BigDecimal aliquota = BigDecimal.ZERO; + BigDecimal isentos = BigDecimal.ZERO; + BigDecimal outros = BigDecimal.ZERO; + BigDecimal icms = BigDecimal.ZERO; + + for (ImpressaoRMD imp : rmds) { + + if (dataBilhete == null) + dataBilhete = imp.getData(); + + // Numero maximo de itens na folha do RMD + if (cont == 23 || (!dataBilhete.equals(imp.getData()))) { + + // add primeiro ou ultimo na lista de insercao dos boletos + boletos.add(boletoAgr); + + // incrementa na contagem dos folios na impressao do RMD + rmdIterate++; + cont = 0; + + insereConsulmoFolioRMD(connection, dataBilhete, empresaId, estadoId, aidf, rmdIterate.toString(), false, false, true, isECF, isBPR, + valorContabil, baseCalculo, aliquota, isentos, outros, icms); + + marcarRMDCaja(connection, boletos, aidf.getAidfId(), rmdIterate); + + // limpa a lista de inseções do boleto + boletos = new ArrayList(); + boletoAgr = null; + contBolto = 0; + dataBilhete = imp.getData(); + + valorContabil = BigDecimal.ZERO; + baseCalculo = BigDecimal.ZERO; + aliquota = BigDecimal.ZERO; + isentos = BigDecimal.ZERO; + outros = BigDecimal.ZERO; + icms = BigDecimal.ZERO; + } + + for (DetalhadoRMD det : imp.getDetalhada()) { + + if (contBolto == 999) { + boletos.add(boletoAgr); + boletoAgr = null; + contBolto = 0; + } + + if (boletoAgr == null) + boletoAgr = det.getCajaId().toString(); + else + boletoAgr = boletoAgr + " ," + det.getCajaId(); + + contBolto++; + } + cont++; + + valorContabil = valorContabil.add(imp.getValorContabil()); + baseCalculo = baseCalculo.add(imp.getBaseCalculo()); + aliquota = imp.getAliquota(); + isentos = isentos.add(imp.getIsentos()); + outros = outros.add(imp.getOutros()); + icms = icms.add(imp.getIcms()); + } + + if (boletos.isEmpty()) { + rmdIterate++; + boletos.add(boletoAgr); + insereConsulmoFolioRMD(connection, dataBilhete, empresaId, estadoId, aidf, rmdIterate.toString(), false, false, true, isECF, isBPR, + valorContabil, baseCalculo, aliquota, isentos, outros, icms); + marcarRMDCaja(connection, boletos, aidf.getAidfId(), rmdIterate); + } + } + + private void marcarRMDCaja(Connection connection, List boletos, Long rmdId, Integer folio) { + + for (String bs : boletos) { + StringBuilder sb = new StringBuilder(); + PreparedStatement pstmt = null; + try { + sb.append(" update caja set rmd_id = ").append(rmdId).append(", "); + sb.append(" foliormd = ").append(folio).append(" "); + sb.append(" where caja_id in ( ").append(bs).append(" ) "); + pstmt = connection.prepareStatement(sb.toString()); + pstmt.executeUpdate(); + } catch (Exception e) { + log.error("", e); + } finally { + try { + if (pstmt != null && !pstmt.isClosed()) { + pstmt.close(); + } + } catch (Exception e) { + log.error("", e); + } + } + } + } + + @Override + public List getRegistroImpressaoRMDTipoBPR(Connection connection, Date inicio, Date fim, Integer empresaId, + String cveestado, String rmd, String folio) { + + List list = new ArrayList(); + + // IMPRESSAO RMD MANUAL + Date data = null; + String numPuntoVenta = null; + + ImpressaoRMD impRmd = null; + + for (DetalhadoRMD brp : buscarRegistroImpressaoBPR(connection, inicio, fim, empresaId, cveestado, null, null, null, true, false, false)) { + + if (numPuntoVenta == null) { + impRmd = new ImpressaoRMD(brp.getEmpresa(), brp.getEnderecoEmpresa(), brp.getCnpjEmpresa(), brp.getIeEmpresa(), + brp.getFechorVenta(), rmd, "SERVIÇO DE TRANSPORTE", "DVB", null, null, folio); + numPuntoVenta = brp.getNumPuntoVenta(); + data = brp.getFechorVenta(); + + } else if (!(numPuntoVenta.equals(brp.getNumPuntoVenta()) && data.equals(brp.getFechorVenta()))) { + impRmd.setNumero(brp.getCcf()); + list.add(impRmd); + + impRmd = new ImpressaoRMD(brp.getEmpresa(), brp.getEnderecoEmpresa(), brp.getCnpjEmpresa(), brp.getIeEmpresa(), + brp.getFechorVenta(), rmd, "SERVIÇO DE TRANSPORTE", "DVB", null, null, folio); + numPuntoVenta = brp.getNumPuntoVenta(); + data = brp.getFechorVenta(); + } + + impRmd.getDetalhada().add(brp); + } + + if (impRmd != null) + list.add(impRmd); + + agruparImpressaoRMD(list); + + return list; + } + + @Override + public List getRegistroImpressaoRMDTipoECF(Connection connection, Date inicio, Date fim, Integer empresaId, + String cveestado, String rmd, String folio) { + + List list = new ArrayList(); + + // IMPRESSAO RMD ECF + String serie = null; + String datamov = null; + ImpressaoRMD impRmd = null; + + for (DetalhadoRMD brp : buscarRegistroImpressaoBPR(connection, inicio, fim, empresaId, cveestado, null, null, null, false, true, false)) { + Date dataMovimento = null; + try { + dataMovimento = DateUtil.getDateFromString(brp.getDatamov(), DATE_FORMAT_FISCAL); + } catch (Exception e) { + } + + if (serie == null) { + + impRmd = new ImpressaoRMD(brp.getEmpresa(), brp.getEnderecoEmpresa(), brp.getCnpjEmpresa(), brp.getIeEmpresa(), + dataMovimento, rmd, "SERVIÇO DE TRANSPORTE", "ECF", brp.getEcf(), brp.getEstadoImpressora(), folio); + serie = brp.getEcf(); + datamov = brp.getDatamov(); + + } else if (!(serie.equals(brp.getEcf()) && datamov.equals(brp.getDatamov()))) { + impRmd.setNumero(brp.getCcf()); + list.add(impRmd); + + impRmd = new ImpressaoRMD(brp.getEmpresa(), brp.getEnderecoEmpresa(), brp.getCnpjEmpresa(), brp.getIeEmpresa(), + dataMovimento, rmd, "SERVIÇO DE TRANSPORTE", "ECF", brp.getEcf(), brp.getEstadoImpressora(), folio); + serie = brp.getEcf(); + datamov = brp.getDatamov(); + } + + impRmd.getDetalhada().add(brp); + } + + if (impRmd != null) + list.add(impRmd); + + agruparImpressaoRMD(list); + + return list; + } + + private void agruparImpressaoRMD(List list) { + + for (ImpressaoRMD impRmd : list) { + + BigDecimal valorContabil = BigDecimal.ZERO; + BigDecimal baseCalculo = BigDecimal.ZERO; + BigDecimal aliquota = BigDecimal.ZERO; + BigDecimal icms = BigDecimal.ZERO; + BigDecimal isentos = BigDecimal.ZERO; + BigDecimal outros = BigDecimal.ZERO; + String cooFim = null; + + for (DetalhadoRMD brp : impRmd.getDetalhada()) { + + if (brp.getIsenta()) { + isentos = isentos == null ? BigDecimal.ZERO : isentos.add(somarTotalBilhete(brp)); + } else { + valorContabil = valorContabil == null ? BigDecimal.ZERO : valorContabil.add(brp.getTarifa() == null ? BigDecimal.ZERO : brp.getTarifa()); + + BigDecimal redBaseCalcIcms = brp.getRedBaseCalcIcms() == null ? BigDecimal.ZERO : brp.getRedBaseCalcIcms().divide(UtiliteriasFiscal.CEM); + BigDecimal redutor = valorContabil.multiply(redBaseCalcIcms); + baseCalculo = valorContabil.subtract(redutor); + + aliquota = brp.getTributacaoImportacao() == null ? brp.getIcmsInterestadual() : brp.getTributacaoImportacao(); + icms = baseCalculo.multiply(aliquota.divide(BigDecimal.TEN.multiply(BigDecimal.TEN))); + outros = valorContabil.subtract(baseCalculo); + } + cooFim = brp.getCoo() == null ? brp.getNumPuntoVenta() : brp.getCoo(); + } + impRmd.setNumero(cooFim); + impRmd.setValorContabil(valorContabil); + impRmd.setBaseCalculo(baseCalculo); + impRmd.setAliquota(aliquota); + impRmd.setIcms(icms); + impRmd.setIsentos(isentos); + impRmd.setOutros(outros); + } + } + + private BigDecimal somarTotalBilhete(DetalhadoRMD brp) { + + BigDecimal total = BigDecimal.ZERO; + total = total.add(brp.getTarifa() == null ? BigDecimal.ZERO : brp.getTarifa()); + total = total.add(brp.getTaxaEmbarque() == null ? BigDecimal.ZERO : brp.getTaxaEmbarque()); + total = total.add(brp.getPedagio() == null ? BigDecimal.ZERO : brp.getPedagio()); + total = total.add(brp.getSeguro() == null ? BigDecimal.ZERO : brp.getSeguro()); + total = total.add(brp.getOutros() == null ? BigDecimal.ZERO : brp.getOutros()); + return total; + } + + public List buscarRegistroImpressaoBPR(Connection connection, Date inicio, Date fim, Integer empresaId, + String cveestado, Long rmdId, String folioInicial, String folioFinal, boolean isManual, boolean isECF, boolean isCancelamento) { + + List list = new ArrayList(); + try { + boolean isDif = validaConstanteCustom(empresaId.toString(), "IMPORT_FISCAL_DIF"); + + String sql = null; + if (isECF && !isCancelamento) { + sql = getSqlImpressaoRMDTipoECF(); + } else if (isManual && !isCancelamento) { + sql = getSqlImpressaoRMDTipoBPR(isDif); + } else if (isCancelamento) { + sql = getSqlImpressaoRMDCancelados(); + } + + NamedParameterStatement ps = new NamedParameterStatement(connection, sql); + ps.getStatement().setFetchSize(100); + ps.setInt("EMPRESA_ID", empresaId); + ps.setTimestamp("DATE_INICIO", new java.sql.Timestamp(DateUtil.inicioFecha(inicio).getTime())); + ps.setTimestamp("DATE_FIM", new java.sql.Timestamp(DateUtil.fimFecha(fim).getTime())); + + if (isCancelamento) { + ps.setLong("RMD_ID", rmdId); + ps.setLong("FOLIO_INICIAL", NumberUtils.createLong(folioInicial)); + ps.setLong("FOLIO_FINAL", NumberUtils.createLong(folioFinal)); + } else { + ps.setString("CVEESTADO", cveestado); + } + + ResultSet rs = ps.executeQuery(); + while (rs.next()) { + + DetalhadoRMD brp = new DetalhadoRMD(); + brp.setCajaId(rs.getLong("cajaId")); + if (!isCancelamento) { + brp.setNumoperacion(rs.getString("numoperacion")); + brp.setSerie(rs.getString("serieCompl")); + brp.setFolio(rs.getInt("folio")); + brp.setEstadoId(rs.getInt("estadoId")); + brp.setFechorVenta(rs.getDate("fechorVenta")); + brp.setEmpresa(rs.getString("empresa")); + brp.setEnderecoEmpresa(rs.getString("enderecoEmpresa")); + brp.setCnpjEmpresa(rs.getString("cnpjEmpresa")); + brp.setIeEmpresa(rs.getString("ieEmpresa")); + brp.setIcmsInterestadual(rs.getBigDecimal("icmsInterestadual")); + brp.setIcmsIntermunicipal(rs.getBigDecimal("icmsIntermunicipal")); + brp.setEstadoOrigem(rs.getString("estadoOrigem")); + brp.setEstadoDestino(rs.getString("estadoDestino")); + brp.setMunicipioOrigem(rs.getString("municipioOrigem")); + brp.setInterEstadual(rs.getBoolean("isInterEstadual")); + brp.setIcmsInterestadual(rs.getBigDecimal("icmsInterestadual")); + brp.setRedBaseCalcIcms(rs.getBigDecimal("redBaseCalcIcms")); + brp.setPorcRedMunicipal(rs.getBigDecimal("porcRedMunicipal")); + brp.setPorcRedEstadual(rs.getBigDecimal("porcRedEstadual")); + brp.setTributacaoImportacao(rs.getBigDecimal("tributacaoImportacao")); + brp.setIsenta(rs.getBoolean("isenta")); + brp.setTarifa(rs.getBigDecimal("tarifa")); + brp.setTaxaEmbarque(rs.getBigDecimal("taxaEmbarque")); + brp.setPedagio(rs.getBigDecimal("pedagio")); + brp.setSeguro(rs.getBigDecimal("seguro")); + brp.setOutros(rs.getBigDecimal("outros")); + brp.setNombPuntoVenta(rs.getString("nombPuntoVenta")); + brp.setNumPuntoVenta(rs.getString("numPuntoVenta")); + + if (isECF && !isCancelamento) { + brp.setEcf(rs.getString("ecf")); + brp.setDatamov(rs.getString("datamov")); + brp.setCoo(rs.getString("cooredz")); + brp.setCcf(rs.getString("ccf")); + brp.setTotalFiscal(rs.getString("totalFiscal")); + brp.setEstadoImpressora(rs.getString("estadoImpressora")); + } + } else { + brp.setRmdId(rs.getInt("rmd_id")); + brp.setFoliormd(rs.getString("foliormd")); + } + + list.add(brp); + } + + rs.close(); + ps.close(); + + } catch (SQLException e) { + log.error("", e); + } + + return list; + } + + public boolean validaConstanteCustom(String valor, String nomeConstante) { + ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService"); + Constante contante = constanteService.buscarPorNomeConstante(nomeConstante); + String value = contante == null ? null : contante.getValorconstante(); + + if (StringUtils.isBlank(value)) + return false; + + List valuesList = Arrays.asList(value.split(",", -1)); + return valuesList.contains(valor); + } + + private String getSqlImpressaoRMDTipoBPR(boolean isDif) { + + StringBuilder sql = new StringBuilder(); + sql.append("select distinct "); + sql.append(" b.caja_id as cajaId, "); + sql.append(" b.numoperacion as numoperacion, "); + sql.append(" b.numseriepreimpresa as serieCompl, "); + sql.append(" b.numfoliopreimpreso as folio, "); + sql.append(" a.acfiscal as numAidf, "); + sql.append(" a.serie as serieAidf, "); + sql.append(" a.subserie as subSerieAidf, "); + sql.append(" trunc(b.feccreacion) as fechorVenta, "); + sql.append(" e.nombempresa as empresa, "); + sql.append(" coalesce(ie.cnpj, e.cnpj) as cnpjEmpresa, "); + sql.append(" case when ie.logradouro is null "); + sql.append(" then (e.logradouro || ', ' || e.numero || ' - ' || e.bairro || ', ' || ce.nombciudad "); + sql.append(" || ' - ' || ee.cveestado || ', ' || e.cep ) "); + sql.append(" else (ie.logradouro || ', ' || ie.numero || ' - ' || ie.bairro || ', ' || cie.nombciudad "); + sql.append(" || ' - ' || eie.cveestado || ', ' || ie.cep ) end as enderecoEmpresa, "); + sql.append(" pv.nombpuntoventa as nombPuntoVenta, "); + sql.append(" pv.numpuntoventa as numPuntoVenta, "); + sql.append(" ie.numinscricaoestadual as ieEmpresa, "); + sql.append(" coalesce(ae.estado_id, e_ag.estado_id, eos.estado_id, eo.estado_id) as estadoId, "); + sql.append(" coalesce(ei.icms, eos.icms) as icmsInterestadual, "); + sql.append(" ei.icmsim as icmsIntermunicipal, "); + sql.append(" coalesce(ae.cveestado, e_ag.cveestado, eos.cveestado, eo.cveestado) as estadoOrigem, "); + sql.append(" ed.cveestado as estadoDestino, "); + sql.append(" co.codibge as municipioOrigem, "); + sql.append(" case when((coalesce(ae.cveestado, eos.cveestado)) = ed.cveestado) "); + sql.append(" then 0 else 1 end as isInterEstadual, "); + sql.append(" ei.porcredbaseicms as redBaseCalcIcms, "); + sql.append(" ei.porcredmunicipal as porcRedMunicipal, "); + sql.append(" ei.porcredestadual as porcRedEstadual, "); + sql.append(" ei.tributacaoimportacao as tributacaoImportacao, "); + sql.append(" case when (coalesce(pos.regionmetropolitana_id, po.regionmetropolitana_id, -1) = "); + sql.append(" coalesce(pds.regionmetropolitana_id, pd.regionmetropolitana_id, -2)) "); + sql.append(" then 1 else 0 end as isenta, "); + sql.append(" coalesce(b.preciopagado, 0) as tarifa, "); + sql.append(" coalesce(b.importetaxaembarque, 0) as taxaEmbarque, "); + sql.append(" coalesce(b.importepedagio, 0) as pedagio, "); + sql.append(" coalesce(b.importeseguro, 0) as seguro, "); + sql.append(" coalesce(b.importeoutros, 0) as outros "); + sql.append("from caja b "); + sql.append(" join marca m on b.marca_id = m.marca_id "); + sql.append(" join empresa e on e.empresa_id = m.empresa_id "); + sql.append(" left join aidf a on a.aidf_id = b.aidf_id "); + sql.append(" left join punto_venta pv on pv.puntoventa_id = b.puntoventa_id "); + sql.append(" left join parada de_ag on de_ag.parada_id = pv.parada_id "); + sql.append(" left join ciudad cd_ag on cd_ag.ciudad_id = de_ag.ciudad_id "); + sql.append(" left join estado e_ag on e_ag.estado_id = cd_ag.estado_id "); + sql.append(" left join ciudad ce on ce.ciudad_id = e.ciudad_id "); + sql.append(" left join estado ee on ee.estado_id = ce.estado_id "); + sql.append(" join parada po on po.parada_id = b.origen_id "); + sql.append(" join ciudad co on co.ciudad_id = po.ciudad_id "); + sql.append(" join estado eo on eo.estado_id = co.estado_id "); + sql.append(" join parada pd on pd.parada_id = b.destino_id "); + sql.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id "); + sql.append(" join estado ed on ed.estado_id = cd.estado_id "); + sql.append(" left join alias_servico s on s.origen_id = b.origen_id "); + sql.append(" and s.destino_id = b.destino_id and (s.corrida_id = b.corrida_id or s.corrida_id is null) "); + sql.append(" and s.ruta_id = b.ruta_id and s.activo = 1 "); + sql.append(" left join parada pos on pos.parada_id = s.aliasorigen_id "); + sql.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id "); + sql.append(" left join estado eos on eos.estado_id = cos.estado_id "); + sql.append(" left join parada pds on pds.parada_id = s.aliasdestino_id "); + sql.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id "); + sql.append(" left join estado eds on eds.estado_id = cds.estado_id "); + sql.append(" left join estado ae on ae.estado_id = a.estado_id "); + sql.append(" left join inscricao_estadual ie on e.empresa_id = ie.empresa_id "); + sql.append(" and ie.estado_id = coalesce(ae.estado_id, e_ag.estado_id, eos.estado_id, eo.estado_id) and ie.activo = 1 "); + sql.append(" left join ciudad cie on cie.ciudad_id = ie.ciudad_id "); + sql.append(" left join estado eie on eie.estado_id = cie.estado_id "); + sql.append(" left join empresa_imposto ei on ei.empresa_id = b.empresacorrida_id "); + sql.append(" and ei.estado_id = coalesce(ae.estado_id, e_ag.estado_id, eos.estado_id, eo.estado_id) and ei.activo = 1 "); + sql.append("where "); + + if (isDif) { + sql.append(" ((b.tipoventa_id not in (5,12,18,81,82,49,41) and b.indstatusboleto = 'V' and b.indreimpresion = 0) "); + sql.append(" or (b.tipoventa_id in (5,12,18,81,82,49,41) and b.indstatusboleto = 'E' and b.numfoliosistema = b.numfoliopreimpreso)) "); + sql.append(" and a.aidf_id is not null "); + } else { + sql.append(" ((b.tipoventa_id = 3 and b.indstatusboleto = 'V' and b.indreimpresion = 0) "); + sql.append(" or (b.tipoventa_id in (12,18) and b.indstatusboleto = 'E' and b.numfoliosistema = b.numfoliopreimpreso)) "); + } + + sql.append(" and (b.motivocancelacion_id is null or b.motivocancelacion_id <> 35) "); + sql.append(" and b.indcancelacion = 0 "); + sql.append(" and b.empresacorrida_id = :EMPRESA_ID "); + sql.append(" and b.feccreacion between :DATE_INICIO and :DATE_FIM "); + sql.append(" and coalesce(ae.cveestado, e_ag.cveestado, eos.cveestado, eo.cveestado) = :CVEESTADO "); + sql.append(" and b.rmd_id is null "); + sql.append(" and b.num_bpe is null "); + sql.append("order by estadoId, fechorVenta, nombPuntoVenta, numPuntoVenta "); + + return sql.toString(); + } + + private String getSqlImpressaoRMDTipoECF() { + + StringBuilder sql = new StringBuilder(); + sql.append("select distinct "); + sql.append(" c.caja_id as cajaId, "); + sql.append(" c.numoperacion as numoperacion, "); + sql.append(" c.numseriepreimpresa as serieCompl, "); + sql.append(" c.numfoliopreimpreso as folio, "); + sql.append(" '' as numAidf, "); + sql.append(" '' as serieAidf, "); + sql.append(" '' as subSerieAidf, "); + sql.append(" trunc(c.feccreacion) as fechorVenta, "); + sql.append(" ep.nombempresa as empresa, "); + sql.append(" ie.cnpj as cnpjEmpresa, "); + sql.append(" (ie.logradouro || ', ' || ie.numero || ' - ' || ie.bairro || ', ' || cie.nombciudad "); + sql.append(" || ' - ' || eie.cveestado || ', ' || ie.cep ) as enderecoEmpresa, "); + sql.append(" '' as nombPuntoVenta, "); + sql.append(" '' as numPuntoVenta, "); + sql.append(" ie.numinscricaoestadual as ieEmpresa, "); + sql.append(" (case when s.aliasorigen_id is null then eo.estado_id else eos.estado_id end) as estadoId,"); + sql.append(" (case when s.aliasorigen_id is null then ei.icms else eis.icms end) as icmsInterestadual,"); + sql.append(" (case when s.aliasorigen_id is null then ei.icmsim else eis.icmsim end) as icmsIntermunicipal,"); + sql.append(" (case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) as estadoOrigem,"); + sql.append(" (case when s.aliasdestino_id is null then ed.cveestado else eds.cveestado end) as estadoDestino,"); + sql.append(" (case when s.aliasorigen_id is null then co.codibge else cos.codibge end) as municipioOrigem,"); + sql.append(" case when ( (case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) = "); + sql.append(" (case when s.aliasdestino_id is null then ed.cveestado else eds.cveestado end) ) then 0 else 1 end as isInterEstadual, "); + sql.append(" (case when s.aliasorigen_id is null then ei.porcredbaseicms else eis.porcredbaseicms end) as redBaseCalcIcms,"); + sql.append(" (case when s.aliasorigen_id is null then ei.porcredmunicipal else eis.porcredmunicipal end) as porcRedMunicipal,"); + sql.append(" (case when s.aliasorigen_id is null then ei.porcredestadual else eis.porcredestadual end) as porcRedEstadual,"); + sql.append(" (case when s.aliasorigen_id is null then ei.tributacaoimportacao else eis.tributacaoimportacao end) as tributacaoImportacao,"); + sql.append(" (case when (coalesce(case when s.aliasorigen_id is null then po.regionmetropolitana_id "); + sql.append(" else pos.regionmetropolitana_id end, -1) = coalesce(case when s.aliasorigen_id is null "); + sql.append(" then pd.regionmetropolitana_id else pds.regionmetropolitana_id end, -2)) then 1 else 0 end) as isenta, "); + sql.append(" coalesce(c.preciopagado, 0) as tarifa, "); + sql.append(" coalesce(c.importetaxaembarque, 0) as taxaEmbarque, "); + sql.append(" coalesce(c.importepedagio, 0) as pedagio, "); + sql.append(" coalesce(c.importeseguro, 0) as seguro, "); + sql.append(" coalesce(c.importeoutros, 0) as outros, "); + sql.append(" coalesce(r2.numserie20, imp.numserie20) as ecf, "); + sql.append(" to_char(c.feccreacion, 'YYYYMMDD') as datamov, "); + sql.append(" case when r2.numserie20 is null then '000001' else r2.coo end as coo, "); + sql.append(" '000000' as ccf, "); + sql.append(" null as totalFiscal, "); + sql.append(" case when r2.numserie20 is null then '000001' else r2.coo end as cooredz, "); + sql.append(" epv.cveestado as estadoImpressora "); + sql.append(" from caja c "); + sql.append(" join ruta r on r.ruta_id = c.ruta_id "); + sql.append(" join parada po on po.parada_id = c.origen_id "); + sql.append(" join ciudad co on co.ciudad_id = po.ciudad_id "); + sql.append(" join estado eo on eo.estado_id = co.estado_id "); + sql.append(" join parada pd on pd.parada_id = c.destino_id "); + sql.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id "); + sql.append(" join estado ed on ed.estado_id = cd.estado_id "); + sql.append(" join empresa_imposto ei on ei.empresa_id = c.empresacorrida_id and ei.estado_id = eo.estado_id "); + sql.append(" join fiscal_impressora imp on imp.numserie = c.serieimpfiscal "); + sql.append(" left join estado e on e.estado_id = imp.estadolocal_id "); + sql.append(" left join alias_servico s on s.origen_id = c.origen_id and s.destino_id = c.destino_id and (s.corrida_id = c.corrida_id or s.corrida_id is null) and s.ruta_id = c.ruta_id and s.activo = 1 "); + sql.append(" left join parada pos on pos.parada_id = s.aliasorigen_id "); + sql.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id "); + sql.append(" left join estado eos on eos.estado_id = cos.estado_id "); + sql.append(" left join parada pds on pds.parada_id = s.aliasdestino_id "); + sql.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id "); + sql.append(" left join estado eds on eds.estado_id = cds.estado_id "); + sql.append(" left join empresa_imposto eis on eis.empresa_id = c.empresacorrida_id and eis.estado_id = eos.estado_id "); + sql.append(" left join fiscal_r4 r4 on r4.caja_id = c.caja_id "); + sql.append(" left join fiscal_r2 r2 on r2.numserie20 = imp.numserie20 and r2.datamov = to_char(c.feccreacion, 'YYYYMMDD') "); + sql.append(" join inscricao_estadual ie on c.empresacorrida_id = ie.empresa_id and ie.estado_id = coalesce(eos.estado_id, eo.estado_id) and ie.activo = 1 "); + sql.append(" join ciudad cie on cie.ciudad_id = ie.ciudad_id "); + sql.append(" join estado eie on eie.estado_id = cie.estado_id "); + sql.append(" join marca ma on c.marca_id = ma.marca_id "); + sql.append(" join empresa ep on ep.empresa_id = ma.empresa_id "); + sql.append(" join punto_venta pv on pv.puntoventa_id = c.puntoventa_id "); + sql.append(" left join parada ppv on ppv.parada_id = pv.parada_id "); + sql.append(" left join ciudad cpv on cpv.ciudad_id = ppv.ciudad_id "); + sql.append(" left join estado epv on epv.estado_id = cpv.estado_id "); + sql.append(" where c.activo = 1 and po.activo = 1 and co.activo = 1 and eo.activo = 1 and ei.activo = 1 "); + sql.append(" and coalesce(case when s.aliasorigen_id is null then ei.activo else eis.activo end, 0) = 1 "); + sql.append(" and c.serieimpfiscal is not null "); + sql.append(" and ((c.indreimpresion = 0 and c.motivocancelacion_id is null and c.numfoliosistema is not null) or (c.indstatusboleto = 'E' and c.indreimpresion = 1)) "); + sql.append(" and (coalesce(c.preciopagado,0) + coalesce(c.importetaxaembarque,0) + coalesce(c.importeseguro,0) + coalesce(c.importepedagio,0) + coalesce(c.importeoutros,0)) > 0 "); + sql.append(" and ((case when coalesce(r.indtribtarifa,0) = 1 then c.preciopagado else 0 end) + (case when coalesce(r.indtribtaxaembarque,0) = 1 then c.importetaxaembarque else 0 end) + (case when coalesce(r.indtribpedagio,0) = 1 then c.importepedagio else 0 end)) > 0 "); + sql.append(" and c.feccreacion >= :DATE_INICIO and c.feccreacion <= :DATE_FIM "); + sql.append(" and c.empresacorrida_id = :EMPRESA_ID "); + sql.append(" and ((case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) = :CVEESTADO ) "); + sql.append(" and c.rmd_id is null "); + sql.append(" and c.num_bpe is null "); + sql.append(" order by estadoId, datamov, ecf, coo "); + + return sql.toString(); + } + + private String getSqlImpressaoRMDCancelados() { + + StringBuilder sql = new StringBuilder(); + sql.append("select distinct "); + sql.append(" c.caja_id as cajaId, "); + sql.append(" c.rmd_id as rmd_id, "); + sql.append(" c.foliormd as foliormd "); + sql.append(" from caja c "); + sql.append(" where c.empresacorrida_id = :EMPRESA_ID "); + sql.append(" and c.feccreacion >= :DATE_INICIO and c.feccreacion <= :DATE_FIM "); + sql.append(" and c.rmd_id = :RMD_ID "); + sql.append(" and c.foliormd between :FOLIO_INICIAL and :FOLIO_FINAL "); + + return sql.toString(); + } + + @Override + public List buscarRelatorioRDI(Connection connection, Date inicio, Date fim, Integer empresaId, List estados, boolean isReceitaTerceiros) { + + String ufs = null; + for (Estado estado : estados) { + if (ufs == null) + ufs = "'" + estado.getCveestado() + "'"; + else + ufs = ufs + ",'" + estado.getCveestado() + "'"; + } + + List list = montaRelatorioRDI(connection, inicio, fim, empresaId, ufs); + List rdis = calcularRelatorioRDI(list, isReceitaTerceiros); + return agrupaRdi(rdis); + } + + private List agrupaRdi(List list) { + List aux = new ArrayList(); + + FiscalRdi rdi = null; + for (FiscalRdi detail : list) { + + FiscalRdi atual = new FiscalRdi(detail.getEstado(), detail.getTipoViagem(), detail.getTipoReceita()); + if (!aux.contains(atual)) { + rdi = new FiscalRdi(detail.getEstado(), detail.getTipoViagem(), detail.getTipoReceita()); + aux.add(rdi); + } + + int index = aux.indexOf(atual); + FiscalRdi agr = aux.get(index); + montarParametros(agr, detail); + aux.set(index, agr); + } + + List validacion = new ArrayList(); + for (FiscalRdi detail : aux) { + + RdiValidacion rv = new RdiValidacion(detail.getEstado()); + if (!validacion.contains(rv)) { + rv = new RdiValidacion(detail.getEstado()); + validacion.add(rv); + } + + int indice = validacion.indexOf(rv); + RdiValidacion rvAux = validacion.get(indice); + + if (detail.getTipoReceita().equals("REC") && detail.getTipoViagem().equals("IM")) + rvAux.setTemIMRec(true); + + if (detail.getTipoReceita().equals("DEV") && detail.getTipoViagem().equals("IM")) + rvAux.setTemIMDev(true); + + if (detail.getTipoReceita().equals("REC") && detail.getTipoViagem().equals("IE")) + rvAux.setTemIERec(true); + + if (detail.getTipoReceita().equals("DEV") && detail.getTipoViagem().equals("IE")) + rvAux.setTemIEDev(true); + + validacion.set(indice, rvAux); + } + + for (RdiValidacion val : validacion) { + + if (!val.isTemIMRec()) { + FiscalRdi rdiAux = new FiscalRdi(val.getEstado(), "IM", "REC"); + aux.add(montarParametros(rdiAux, new FiscalRdi())); + } + + if (!val.isTemIMDev()) { + FiscalRdi rdiAux = new FiscalRdi(val.getEstado(), "IM", "DEV"); + aux.add(montarParametros(rdiAux, new FiscalRdi())); + } + + if (!val.isTemIERec()) { + FiscalRdi rdiAux = new FiscalRdi(val.getEstado(), "IE", "REC"); + aux.add(montarParametros(rdiAux, new FiscalRdi())); + } + + if (!val.isTemIEDev()) { + FiscalRdi rdiAux = new FiscalRdi(val.getEstado(), "IE", "DEV"); + aux.add(montarParametros(rdiAux, new FiscalRdi())); + } + } + + Collections.sort(aux); + return aux; + } + + private FiscalRdi montarParametros(FiscalRdi agr, FiscalRdi detail) { + agr.setQuantBilhetes(agr.getQuantBilhetes().add(detail.getTarifa() == null ? BigDecimal.ZERO : BigDecimal.ONE)); + agr.setTarifa(agr.getTarifa().add(detail.getTarifa() == null ? BigDecimal.ZERO : detail.getTarifa())); + agr.setSeguro(agr.getSeguro().add(detail.getSeguro() == null ? BigDecimal.ZERO : detail.getSeguro())); + agr.setTxEmbarque(agr.getTxEmbarque().add(detail.getTxEmbarque() == null ? BigDecimal.ZERO : detail.getTxEmbarque())); + agr.setPedagio(agr.getPedagio().add(detail.getPedagio() == null ? BigDecimal.ZERO : detail.getPedagio())); + agr.setPassagem(agr.getPassagem().add(detail.getPassagem() == null ? BigDecimal.ZERO : detail.getPassagem())); + agr.setIsentos(agr.getIsentos().add(detail.getIsentos() == null ? BigDecimal.ZERO : detail.getIsentos())); + agr.setOutros(agr.getOutros().add(detail.getOutros() == null ? BigDecimal.ZERO : detail.getOutros())); + agr.setRbc(detail.getRbc() == null ? BigDecimal.ZERO : detail.getRbc()); + agr.setBaseCalculo(agr.getBaseCalculo().add(detail.getBaseCalculo() == null ? BigDecimal.ZERO : detail.getBaseCalculo())); + agr.setAliquota(detail.getAliquota() == null ? BigDecimal.ZERO : detail.getAliquota()); + agr.setIcms(agr.getIcms().add(detail.getIcms() == null ? BigDecimal.ZERO : detail.getIcms())); + agr.setCp(detail.getCp() == null ? BigDecimal.ZERO : detail.getCp()); + agr.setCredPres(agr.getCredPres().add(detail.getCredPres() == null ? BigDecimal.ZERO : detail.getCredPres())); + agr.setIcmsRec(agr.getIcmsRec().add(detail.getIcmsRec() == null ? BigDecimal.ZERO : detail.getIcmsRec())); + return agr; + } + + private List calcularRelatorioRDI(List list, boolean isReceitaTerceiros) { + + List rdis = new ArrayList(); + + for (DetalhadoFiscal det : list) { + + BigDecimal passagem = valorPassagem(det, isReceitaTerceiros); + BigDecimal isentos = valorIsenta(det, isReceitaTerceiros); + BigDecimal outros = BigDecimal.ZERO; + BigDecimal rbc = BigDecimal.ZERO; + BigDecimal baseCalculo = BigDecimal.ZERO; + BigDecimal aliquota = BigDecimal.ZERO; + BigDecimal icms = BigDecimal.ZERO; + BigDecimal cp = BigDecimal.ZERO; + BigDecimal credPres = BigDecimal.ZERO; + BigDecimal icmsRec = BigDecimal.ZERO; + + if (det.isInterEstadual()) { + aliquota = det.getTributacaoImportacao() != null ? det.getTributacaoImportacao() : det.getIcmsInterestadual(); + } else { + aliquota = det.getTributacaoImportacao() != null ? det.getTributacaoImportacao() : det.getIcmsIntermunicipal(); + } + + if (det.isInterEstadual()) { + cp = det.getPorcRedEstadual() == null ? BigDecimal.ZERO : det.getPorcRedEstadual(); + } else { + cp = det.getPorcRedMunicipal() == null ? BigDecimal.ZERO : det.getPorcRedMunicipal(); + } + + rbc = det.getRedBaseCalcIcms() == null ? BigDecimal.ZERO : det.getRedBaseCalcIcms().divide(UtiliteriasFiscal.CEM); + + BigDecimal tarifa = valorBaseCalculo(det, isReceitaTerceiros); + BigDecimal redutor = tarifa.multiply(rbc); + baseCalculo = tarifa.subtract(redutor); + + icms = baseCalculo.multiply(aliquota.divide(BigDecimal.TEN.multiply(BigDecimal.TEN))); + credPres = icms.multiply(cp.divide(BigDecimal.TEN.multiply(BigDecimal.TEN))); + icmsRec = icms.subtract(credPres); + + outros = isentos.equals(BigDecimal.ZERO) ? BigDecimal.ZERO : passagem.subtract(isentos).subtract(baseCalculo); + + String tipoViagem = det.isInterEstadual() ? "IE" : "IM"; + BigDecimal taxaEmbarque = (isReceitaTerceiros && det.getTaxaEmbarque() == null) ? det.getTaxaEmbarque() : BigDecimal.ZERO; + BigDecimal pedagio = (isReceitaTerceiros && det.getPedagio() == null) ? det.getPedagio() : BigDecimal.ZERO; + BigDecimal seguro = (isReceitaTerceiros && det.getSeguro() == null) ? det.getSeguro() : BigDecimal.ZERO; + + rdis.add(new FiscalRdi(det.getEstadoOrigem(), tipoViagem, det.getTipoReceita(), det.getTarifa(), + seguro, taxaEmbarque, pedagio, passagem, isentos, outros, det.getRedBaseCalcIcms(), + baseCalculo, aliquota, icms, cp, credPres, icmsRec)); + } + + return rdis; + } + + private BigDecimal valorBaseCalculo(DetalhadoFiscal det, boolean isReceitaTerceiros) { + BigDecimal total = BigDecimal.ZERO; + total = total.add(det.getTarifa() == null ? BigDecimal.ZERO : det.getTarifa()); + + if (isReceitaTerceiros && (det.isInterEstadual() && det.getIndTxembarqueEstadual() || !det.isInterEstadual() && det.getIndTxembarqueMunicipal())) + total = total.add(det.getTaxaEmbarque() == null ? BigDecimal.ZERO : det.getTaxaEmbarque()); + + if (isReceitaTerceiros && (det.isInterEstadual() && det.getIndPedagioEstdual() || !det.isInterEstadual() && det.getIndPedagioMunicipal())) + total = total.add(det.getPedagio() == null ? BigDecimal.ZERO : det.getPedagio()); + + if (isReceitaTerceiros && (det.isInterEstadual() && det.getIndSeguroEstadual() || !det.isInterEstadual() && det.getIndSeguroMunicipal())) + total = total.add(det.getSeguro() == null ? BigDecimal.ZERO : det.getSeguro()); + + return total; + } + + private BigDecimal valorIsenta(DetalhadoFiscal det, boolean isReceitaTerceiros) { + + BigDecimal total = BigDecimal.ZERO; + if (isReceitaTerceiros && (det.isInterEstadual() && !det.getIndTxembarqueEstadual() || !det.isInterEstadual() && !det.getIndTxembarqueMunicipal())) + total = total.add(det.getTaxaEmbarque() == null ? BigDecimal.ZERO : det.getTaxaEmbarque()); + + if (isReceitaTerceiros && (det.isInterEstadual() && !det.getIndPedagioEstdual() || !det.isInterEstadual() && !det.getIndPedagioMunicipal())) + total = total.add(det.getPedagio() == null ? BigDecimal.ZERO : det.getPedagio()); + + if (isReceitaTerceiros && (det.isInterEstadual() && !det.getIndSeguroEstadual() || !det.isInterEstadual() && !det.getIndSeguroMunicipal())) + total = total.add(det.getSeguro() == null ? BigDecimal.ZERO : det.getSeguro()); + + return total; + } + + private BigDecimal valorPassagem(DetalhadoFiscal det, boolean isReceitaTerceiros) { + BigDecimal total = BigDecimal.ZERO; + total = total.add(det.getTarifa() == null ? BigDecimal.ZERO : det.getTarifa()); + if (isReceitaTerceiros) { + total = total.add(det.getTaxaEmbarque() == null ? BigDecimal.ZERO : det.getTaxaEmbarque()); + total = total.add(det.getPedagio() == null ? BigDecimal.ZERO : det.getPedagio()); + total = total.add(det.getSeguro() == null ? BigDecimal.ZERO : det.getSeguro()); + } + return total; + } + + private List montaRelatorioRDI(Connection connection, Date inicio, Date fim, Integer empresaId, String ufs) { + + List list = new ArrayList(); + try { + + StringBuilder sql = new StringBuilder(); + sql.append(sqlRelatorioRDIVendidos(ufs)); + sql.append(" union all "); + sql.append(sqlRelatorioRDICancelados(ufs)); + + NamedParameterStatement ps = new NamedParameterStatement(connection, sql.toString()); + ps.setLong("EMPRESA_ID", Long.valueOf(empresaId)); + + ps.setTimestamp("DATE_INICIO", new java.sql.Timestamp(DateUtil.inicioFecha(inicio).getTime())); + ps.setTimestamp("DATE_FIM", new java.sql.Timestamp(DateUtil.fimFecha(fim).getTime())); + + ResultSet rs = ps.executeQuery(); + while (rs.next()) { + + DetalhadoFiscal df = new DetalhadoFiscal(); + df.setCajaId(rs.getLong("cajaId")); + df.setTipoReceita(rs.getString("tipoReceita")); + df.setNumoperacion(rs.getString("numoperacion")); + df.setEstadoId(rs.getInt("estadoId")); + df.setFechorVenta(rs.getDate("fechorVenta")); + df.setIcmsInterestadual(rs.getBigDecimal("icmsInterestadual")); + df.setIcmsIntermunicipal(rs.getBigDecimal("icmsIntermunicipal")); + df.setEstadoOrigem(rs.getString("estadoOrigem")); + df.setEstadoDestino(rs.getString("estadoDestino")); + df.setMunicipioOrigem(rs.getString("municipioOrigem")); + df.setInterEstadual(rs.getBoolean("isInterEstadual")); + df.setIcmsInterestadual(rs.getBigDecimal("icmsInterestadual")); + df.setRedBaseCalcIcms(rs.getBigDecimal("redBaseCalcIcms")); + df.setPorcRedMunicipal(rs.getBigDecimal("porcRedMunicipal")); + df.setPorcRedEstadual(rs.getBigDecimal("porcRedEstadual")); + df.setTributacaoImportacao(rs.getBigDecimal("tributacaoImportacao")); + df.setIndTarifaMunicipal(rs.getBoolean("indtarifamunicipal")); + df.setIndSeguroMunicipal(rs.getBoolean("indseguromunicipal")); + df.setIndTxembarqueMunicipal(rs.getBoolean("indtxembarquemunicipal")); + df.setIndPedagioMunicipal(rs.getBoolean("indpedagiomunicipal")); + df.setIndTarifaEstadual(rs.getBoolean("indtarifaestadual")); + df.setIndSeguroEstadual(rs.getBoolean("indseguroestadual")); + df.setIndTxembarqueEstadual(rs.getBoolean("indtxembarqueestadual")); + df.setIndPedagioEstdual(rs.getBoolean("indpedagioestdual")); + df.setIsenta(rs.getBoolean("isenta")); + df.setTarifa(rs.getBigDecimal("tarifa")); + df.setTaxaEmbarque(rs.getBigDecimal("taxaEmbarque")); + df.setPedagio(rs.getBigDecimal("pedagio")); + df.setSeguro(rs.getBigDecimal("seguro")); + df.setOutros(rs.getBigDecimal("outros")); + df.setDatamov(rs.getString("datamov")); + list.add(df); + } + + rs.close(); + ps.close(); + + } catch (SQLException e) { + log.error("", e); + } + + return list; + } + + private String sqlRelatorioRDIVendidos(String ufs) { + + StringBuilder sql = new StringBuilder(); + + sql.append("select distinct "); + sql.append(" c.caja_id as cajaId, "); + sql.append(" 'REC' as tipoReceita, "); + sql.append(" c.numoperacion as numoperacion, "); + sql.append(" trunc(c.feccreacion) as fechorVenta, "); + sql.append(" (case when s.aliasorigen_id is null then eo.estado_id else eos.estado_id end) as estadoId,"); + sql.append(" (case when s.aliasorigen_id is null then ei.icms else eis.icms end) as icmsInterestadual,"); + sql.append(" (case when s.aliasorigen_id is null then ei.icmsim else eis.icmsim end) as icmsIntermunicipal,"); + sql.append(" (case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) as estadoOrigem,"); + sql.append(" (case when s.aliasdestino_id is null then ed.cveestado else eds.cveestado end) as estadoDestino,"); + sql.append(" (case when s.aliasorigen_id is null then co.codibge else cos.codibge end) as municipioOrigem,"); + sql.append(" case when ( (case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) = "); + sql.append(" (case when s.aliasdestino_id is null then ed.cveestado else eds.cveestado end) ) then 0 else 1 end as isInterEstadual, "); + sql.append(" (case when s.aliasorigen_id is null then ei.porcredbaseicms else eis.porcredbaseicms end) as redBaseCalcIcms,"); + sql.append(" (case when s.aliasorigen_id is null then ei.porcredmunicipal else eis.porcredmunicipal end) as porcRedMunicipal,"); + sql.append(" (case when s.aliasorigen_id is null then ei.porcredestadual else eis.porcredestadual end) as porcRedEstadual,"); + sql.append(" (case when s.aliasorigen_id is null then ei.indtarifamunicipal else eis.indtarifamunicipal end) as indtarifamunicipal,"); + sql.append(" (case when s.aliasorigen_id is null then ei.indseguromunicipal else eis.indseguromunicipal end) as indseguromunicipal,"); + sql.append(" (case when s.aliasorigen_id is null then ei.indtxembarquemunicipal else eis.indtxembarquemunicipal end) as indtxembarquemunicipal,"); + sql.append(" (case when s.aliasorigen_id is null then ei.indpedagiomunicipal else eis.indpedagiomunicipal end) as indpedagiomunicipal,"); + sql.append(" (case when s.aliasorigen_id is null then ei.indtarifaestadual else eis.indtarifaestadual end) as indtarifaestadual,"); + sql.append(" (case when s.aliasorigen_id is null then ei.indseguroestadual else eis.indseguroestadual end) as indseguroestadual,"); + sql.append(" (case when s.aliasorigen_id is null then ei.indtxembarqueestadual else eis.indtxembarqueestadual end) as indtxembarqueestadual,"); + sql.append(" (case when s.aliasorigen_id is null then ei.indpedagioestdual else eis.indpedagioestdual end) as indpedagioestdual,"); + sql.append(" (case when s.aliasorigen_id is null then ei.tributacaoImportacao else eis.tributacaoImportacao end) as tributacaoImportacao,"); + sql.append(" (case when (coalesce(case when s.aliasorigen_id is null then po.regionmetropolitana_id "); + sql.append(" else pos.regionmetropolitana_id end, -1) = coalesce(case when s.aliasorigen_id is null "); + sql.append(" then pd.regionmetropolitana_id else pds.regionmetropolitana_id end, -2)) then 1 else 0 end) as isenta, "); + sql.append(" coalesce(c.preciopagado, 0) as tarifa, "); + sql.append(" coalesce(c.importetaxaembarque, 0) as taxaEmbarque, "); + sql.append(" coalesce(c.importepedagio, 0) as pedagio, "); + sql.append(" coalesce(c.importeseguro, 0) as seguro, "); + sql.append(" coalesce(c.importeoutros, 0) as outros, "); + sql.append(" coalesce(r4.datamov, to_char(trunc(c.feccreacion), 'yyyymmdd')) as datamov "); + sql.append(" "); + sql.append(" from caja c "); + sql.append(" join ruta r on r.ruta_id = c.ruta_id "); + sql.append(" join parada po on po.parada_id = c.origen_id "); + sql.append(" join ciudad co on co.ciudad_id = po.ciudad_id "); + sql.append(" join estado eo on eo.estado_id = co.estado_id "); + sql.append(" join parada pd on pd.parada_id = c.destino_id "); + sql.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id "); + sql.append(" join estado ed on ed.estado_id = cd.estado_id "); + sql.append(" join empresa_imposto ei on ei.empresa_id = c.empresacorrida_id and ei.estado_id = eo.estado_id "); + sql.append(" join fiscal_impressora imp on imp.numserie = c.serieimpfiscal "); + sql.append(" left join estado e on e.estado_id = imp.estadolocal_id "); + sql.append(" left join alias_servico s on s.origen_id = c.origen_id and s.destino_id = c.destino_id and (s.corrida_id = c.corrida_id or s.corrida_id is null) and s.ruta_id = c.ruta_id and s.activo = 1 "); + sql.append(" left join parada pos on pos.parada_id = s.aliasorigen_id "); + sql.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id "); + sql.append(" left join estado eos on eos.estado_id = cos.estado_id "); + sql.append(" left join parada pds on pds.parada_id = s.aliasdestino_id "); + sql.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id "); + sql.append(" left join estado eds on eds.estado_id = cds.estado_id "); + sql.append(" left join empresa_imposto eis on eis.empresa_id = c.empresacorrida_id and eis.estado_id = eos.estado_id "); + sql.append(" left join fiscal_r4 r4 on r4.caja_id = c.caja_id "); + sql.append(" left join fiscal_r2 r2 on r2.numserie20 = imp.numserie20 and r2.datamov = to_char(c.feccreacion, 'YYYYMMDD') "); + sql.append(" join inscricao_estadual ie on c.empresacorrida_id = ie.empresa_id and ie.estado_id = coalesce(eos.estado_id, eo.estado_id) and ie.activo = 1 "); + sql.append(" join ciudad cie on cie.ciudad_id = ie.ciudad_id "); + sql.append(" join estado eie on eie.estado_id = cie.estado_id "); + sql.append(" join marca ma on c.marca_id = ma.marca_id "); + sql.append(" join empresa ep on ep.empresa_id = ma.empresa_id "); + sql.append(" join punto_venta pv on pv.puntoventa_id = c.puntoventa_id "); + sql.append(" left join parada ppv on ppv.parada_id = pv.parada_id "); + sql.append(" left join ciudad cpv on cpv.ciudad_id = ppv.ciudad_id "); + sql.append(" left join estado epv on epv.estado_id = cpv.estado_id "); + sql.append(" "); + sql.append(" where c.activo = 1 and po.activo = 1 and co.activo = 1 and eo.activo = 1 and ei.activo = 1 "); + sql.append(" and coalesce(case when s.aliasorigen_id is null then ei.activo else eis.activo end, 0) = 1 "); + sql.append(" and c.serieimpfiscal is not null "); + sql.append(" and ((c.indreimpresion = 0 and c.motivocancelacion_id is null and c.numfoliosistema is not null) or (c.indstatusboleto = 'E' and c.indreimpresion = 1)) "); + sql.append(" and (coalesce(c.preciopagado,0) + coalesce(c.importetaxaembarque,0) + coalesce(c.importeseguro,0) + coalesce(c.importepedagio,0) + coalesce(c.importeoutros,0)) > 0 "); + sql.append(" and c.feccreacion >= :DATE_INICIO and c.feccreacion <= :DATE_FIM "); + sql.append(" and c.empresacorrida_id = :EMPRESA_ID "); + sql.append(" and c.num_bpe is null "); + sql.append(" and ((case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end) in ( ").append(ufs).append(" )) "); + sql.append(" "); + sql.append("union all "); + sql.append(" "); + sql.append("select distinct "); + sql.append(" c.caja_id as cajaId, "); + sql.append(" 'REC' as tipoReceita, "); + sql.append(" c.numoperacion as numoperacion, "); + sql.append(" trunc(c.feccreacion) as fechorVenta, "); + sql.append(" coalesce(ae.estado_id, (case when s.aliasorigen_id is null then eo.estado_id else eos.estado_id end)) as estadoId,"); + sql.append(" coalesce(ei.icms, eos.icms) as icmsInterestadual, "); + sql.append(" ei.icmsim as icmsIntermunicipal, "); + sql.append(" coalesce(ae.cveestado,(case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end)) as estadoOrigem,"); + sql.append(" (case when s.aliasdestino_id is null then ed.cveestado else eds.cveestado end) as estadoDestino,"); + sql.append(" (case when s.aliasorigen_id is null then co.codibge else cos.codibge end) as municipioOrigem,"); + sql.append(" case when(coalesce(ae.cveestado,(case when s.aliasorigen_id is null then eo.cveestado else eos.cveestado end)) = "); + sql.append(" (case when s.aliasdestino_id is null then ed.cveestado else eds.cveestado end) ) then 0 else 1 end as isInterEstadual, "); + sql.append(" ei.porcredbaseicms as redBaseCalcIcms, "); + sql.append(" ei.porcredmunicipal as porcRedMunicipal, "); + sql.append(" ei.porcredestadual as porcRedEstadual, "); + sql.append(" ei.indtarifamunicipal as indtarifamunicipal, "); + sql.append(" coalesce(ei.indseguromunicipal, 0) as indseguromunicipal, "); + sql.append(" coalesce(ei.indtxembarquemunicipal, 0) as indtxembarquemunicipal, "); + sql.append(" coalesce(ei.indpedagiomunicipal, 0) as indpedagiomunicipal, "); + sql.append(" coalesce(ei.indtarifaestadual, 0) as indtarifaestadual, "); + sql.append(" coalesce(ei.indseguroestadual, 0) as indseguroestadual, "); + sql.append(" coalesce(ei.indtxembarqueestadual, 0) as indtxembarqueestadual, "); + sql.append(" coalesce(ei.indpedagioestdual, 0) as indpedagioestdual, "); + sql.append(" ei.tributacaoimportacao as tributacaoImportacao, "); + sql.append(" (case when (coalesce(case when s.aliasorigen_id is null then po.regionmetropolitana_id "); + sql.append(" else pos.regionmetropolitana_id end, -1) = coalesce(case when s.aliasorigen_id is null "); + sql.append(" then pd.regionmetropolitana_id else pds.regionmetropolitana_id end, -2)) then 1 else 0 end) as isenta, "); + sql.append(" coalesce(c.preciopagado, 0) as tarifa, "); + sql.append(" coalesce(c.importetaxaembarque, 0) as taxaEmbarque, "); + sql.append(" coalesce(c.importepedagio, 0) as pedagio, "); + sql.append(" coalesce(c.importeseguro, 0) as seguro, "); + sql.append(" coalesce(c.importeoutros, 0) as outros, "); + sql.append(" to_char(trunc(c.feccreacion), 'yyyymmdd') as datamov "); + sql.append("from caja c "); + sql.append(" join marca m on c.marca_id = m.marca_id "); + sql.append(" join empresa e on e.empresa_id = m.empresa_id "); + sql.append(" join aidf a on a.aidf_id = c.aidf_id "); + sql.append(" join punto_venta pv on pv.puntoventa_id = c.puntoventa_id "); + sql.append(" join ciudad ce on ce.ciudad_id = e.ciudad_id "); + sql.append(" join estado ee on ee.estado_id = ce.estado_id "); + sql.append(" join parada po on po.parada_id = c.origen_id "); + sql.append(" join ciudad co on co.ciudad_id = po.ciudad_id "); + sql.append(" join estado eo on eo.estado_id = co.estado_id "); + sql.append(" join parada pd on pd.parada_id = c.destino_id "); + sql.append(" join ciudad cd on cd.ciudad_id = pd.ciudad_id "); + sql.append(" join estado ed on ed.estado_id = cd.estado_id "); + sql.append(" left join alias_servico s on s.origen_id = c.origen_id "); + sql.append(" and s.destino_id = c.destino_id and (s.corrida_id = c.corrida_id or s.corrida_id is null) "); + sql.append(" and s.ruta_id = c.ruta_id and s.activo = 1 "); + sql.append(" left join parada pos on pos.parada_id = s.aliasorigen_id "); + sql.append(" left join ciudad cos on cos.ciudad_id = pos.ciudad_id "); + sql.append(" left join estado eos on eos.estado_id = cos.estado_id "); + sql.append(" left join parada pds on pds.parada_id = s.aliasdestino_id "); + sql.append(" left join ciudad cds on cds.ciudad_id = pds.ciudad_id "); + sql.append(" left join estado eds on eds.estado_id = cds.estado_id "); + sql.append(" left join estado ae on ae.estado_id = a.estado_id "); + sql.append(" join inscricao_estadual ie on e.empresa_id = ie.empresa_id "); + sql.append(" and ie.estado_id = coalesce(ae.estado_id, eos.estado_id) and ie.activo = 1 "); + sql.append(" join ciudad cie on cie.ciudad_id = ie.ciudad_id "); + sql.append(" join estado eie on eie.estado_id = cie.estado_id "); + sql.append(" join empresa_imposto ei on ei.empresa_id = c.empresacorrida_id "); + sql.append(" and ei.estado_id = coalesce(ae.estado_id, eos.estado_id) and ei.activo = 1 "); + sql.append("where ((c.tipoventa_id = 3 and c.indstatusboleto = 'V' and c.indreimpresion = 0) "); + sql.append(" or (c.tipoventa_id in (12,18) and c.indstatusboleto = 'E' and c.numfoliosistema = c.numfoliopreimpreso)) "); + sql.append(" and (c.motivocancelacion_id is null or c.motivocancelacion_id <> 35) "); + sql.append(" and c.indcancelacion = 0 "); + sql.append(" and c.empresacorrida_id = :EMPRESA_ID "); + sql.append(" and c.feccreacion between :DATE_INICIO and :DATE_FIM "); + sql.append(" and c.num_bpe is null "); + sql.append(" and coalesce(ae.cveestado, eos.cveestado) in ( ").append(ufs).append(" ) "); + return sql.toString(); + } + + private String sqlRelatorioRDICancelados(String ufs) { + + StringBuilder sql = new StringBuilder(); + sql.append("select distinct "); + sql.append(" b.boleto_id as cajaId, "); + sql.append(" 'DEV' as tipoReceita, "); + sql.append(" b.numoperacion as numoperacion, "); + sql.append(" trunc(b.feccreacion) as fechorVenta, "); + sql.append(" coalesce(esaidf.estado_id, eos.estado_id, est.estado_id) as estadoId, "); + sql.append(" ei.icms as icmsInterestadual, "); + sql.append(" ei.icmsim as icmsIntermunicipal, "); + sql.append(" coalesce(esaidf.cveestado, eos.cveestado, est.cveestado) as estadoOrigem, "); + sql.append(" coalesce(eds.cveestado, est.cveestado) as estadoDestino, "); + sql.append(" 0 as municipioOrigem, "); + sql.append(" case when (coalesce(cos.estado_id,co.estado_id) <> coalesce(cds.estado_id,cd.estado_id)) then 1 else 0 end as isInterEstadual, "); + sql.append(" ei.porcredbaseicms as redBaseCalcIcms, "); + sql.append(" ei.porcredmunicipal as porcRedMunicipal, "); + sql.append(" ei.porcredestadual as porcRedEstadual, "); + sql.append(" coalesce(ei.indtarifamunicipal, 0) as indtarifamunicipal, "); + sql.append(" coalesce(ei.indseguromunicipal, 0) as indseguromunicipal, "); + sql.append(" coalesce(ei.indtxembarquemunicipal, 0) as indtxembarquemunicipal, "); + sql.append(" coalesce(ei.indpedagiomunicipal, 0) as indpedagiomunicipal, "); + sql.append(" coalesce(ei.indtarifaestadual, 0) as indtarifaestadual, "); + sql.append(" coalesce(ei.indseguroestadual, 0) as indseguroestadual, "); + sql.append(" coalesce(ei.indtxembarqueestadual, 0) as indtxembarqueestadual, "); + sql.append(" coalesce(ei.indpedagioestdual, 0) as indpedagioestdual, "); + sql.append(" ei.tributacaoimportacao as tributacaoImportacao, "); + sql.append(" case when (coalesce(pos.regionmetropolitana_id, ori.regionmetropolitana_id, -1) = "); + sql.append(" coalesce(pds.regionmetropolitana_id, des.regionmetropolitana_id, -2)) then 1 else 0 end as isenta, "); + sql.append(" coalesce(b.preciopagado, 0) as tarifa, "); + sql.append(" coalesce(b.importetaxaembarque, 0) as taxaEmbarque, "); + sql.append(" coalesce(b.importepedagio, 0) as pedagio, "); + sql.append(" coalesce(b.importeseguro, 0) as seguro, "); + sql.append(" coalesce(b.importeoutros, 0) as outros, "); + sql.append(" to_char(trunc(b.feccreacion), 'yyyymmdd') as datamov "); + sql.append(" "); + sql.append("from boleto b "); + sql.append("inner join marca m on m.marca_id = b.marca_id and m.activo = 1 "); + sql.append("inner join empresa e on e.empresa_id = m.empresa_id "); + sql.append("inner join punto_venta ptv on ptv.puntoventa_id = b.puntoventa_id "); + sql.append("inner join parada ori on (b.origen_id = ori.parada_id ) "); + sql.append("inner join parada des on (b.destino_id = des.parada_id ) "); + sql.append("inner join ciudad co on (co.ciudad_id = ori.ciudad_id ) "); + sql.append("inner join ciudad cd on (cd.ciudad_id = des.ciudad_id ) "); + sql.append("inner join estado est on est.estado_id = co.estado_id "); + sql.append("left join punto_venta ptvo on ptvo.puntoventa_id = b.ptovtaventa_id "); + sql.append("left join alias_servico s on s.origen_id = b.origen_id "); + sql.append(" and s.destino_id = b.destino_id and (s.corrida_id = b.corrida_id or s.corrida_id is null) "); + sql.append(" and s.ruta_id = b.ruta_id and s.activo = 1 "); + sql.append("left join parada pos on pos.parada_id = s.aliasorigen_id "); + sql.append("left join ciudad cos on cos.ciudad_id = pos.ciudad_id "); + sql.append("left join estado eos on eos.estado_id = cos.estado_id "); + sql.append("left join parada pds on pds.parada_id = s.aliasdestino_id "); + sql.append("left join ciudad cds on cds.ciudad_id = pds.ciudad_id "); + sql.append("left join estado eds on eds.estado_id = cds.estado_id "); + sql.append("left join aidf aidf on aidf.aidf_id = b.aidf_id and b.tipoventa_id = 3 "); + sql.append("left join estado esaidf on esaidf.estado_id = aidf.estado_id "); + sql.append("join inscricao_estadual ie on e.empresa_id = ie.empresa_id "); + sql.append(" and ie.estado_id = coalesce(aidf.estado_id, eos.estado_id, est.estado_id) and ie.activo = 1 "); + sql.append("join empresa_imposto ei on ei.empresa_id = e.empresa_id "); + sql.append(" and ei.estado_id = coalesce(aidf.estado_id, eos.estado_id, est.estado_id) and ei.activo = 1 "); + sql.append("where b.motivocancelacion_id in (31,32,10,37,99,36) "); + sql.append(" and b.indstatusboleto = 'C' and b.indcancelacion = 1 "); + sql.append(" and b.numfoliopreimpreso is not null "); + sql.append(" and e.empresa_id = :EMPRESA_ID "); + sql.append(" and b.fechorventa >= :DATE_INICIO "); + sql.append(" and b.fechorventa <= :DATE_FIM "); + sql.append(" and b.categoria_id not in (select valorconstante from constante where nombconstante = 'GRATUIDADE_CRIANCA') "); + sql.append(" and coalesce(esaidf.cveestado, eos.cveestado, est.cveestado) in ( ").append(ufs).append(" ) "); + sql.append(" and b.num_bpe is null "); + sql.append("order by estadoId, isInterEstadual "); + + return sql.toString(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalImpressoraEstadoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalImpressoraEstadoHibernateDAO.java new file mode 100644 index 000000000..0f900adf1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalImpressoraEstadoHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FiscalImpressoraEstadoDAO; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressoraEstado; + +@Repository("fiscalImpressoraEstadoDAO") +public class FiscalImpressoraEstadoHibernateDAO extends GenericHibernateDAO implements FiscalImpressoraEstadoDAO { + + @Autowired + public FiscalImpressoraEstadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("estado.nombestado")); + + return c.list(); + } + + public List retornaEstadosFiscalImpressora(FiscalImpressora fiscalImpressora) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("fiscalImpressora", fiscalImpressora)); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalImpressoraHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalImpressoraHibernateDAO.java new file mode 100644 index 000000000..9fd7af8b7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FiscalImpressoraHibernateDAO.java @@ -0,0 +1,245 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FiscalImpressoraDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FiscalFormapagoEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.FiscalRelgerencialEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalTotnaofiscalEmpresa; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; + +@Repository("fiscalImpressoraDAO") +public class FiscalImpressoraHibernateDAO extends GenericHibernateDAO implements FiscalImpressoraDAO { + + @Autowired + public FiscalImpressoraHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarTotsNaoFiscaisEmpresa(Integer empresaEcfId) { + StringBuilder impostoHql = new StringBuilder(); + impostoHql.append(" select e"); + impostoHql.append(" from FiscalTotnaofiscalEmpresa e"); + impostoHql.append(" where e.activo = 1 and e.empresa.id = :empresaEcfId"); + + Query qry = getSession().createQuery(impostoHql.toString()); + qry.setParameter("empresaEcfId", empresaEcfId); + + List list = qry.list(); + + return list; + } + + public List buscarFormaPagoEmpresa(Integer empresaEcfId) { + StringBuilder impostoHql = new StringBuilder(); + impostoHql.append(" select e"); + impostoHql.append(" from FiscalFormapagoEmpresa e"); + impostoHql.append(" where e.activo = 1 and e.empresa.id = :empresaEcfId"); + + Query qry = getSession().createQuery(impostoHql.toString()); + qry.setParameter("empresaEcfId", empresaEcfId); + + List list = qry.list(); + + return list; + } + + public List buscarItensRelgerencialEmpresa(Integer empresaEcfId) { + + StringBuilder impostoHql = new StringBuilder(); + impostoHql.append(" select e"); + impostoHql.append(" from FiscalRelgerencialEmpresa e"); + impostoHql.append(" where e.activo = 1 and e.empresa.id = :empresaEcfId"); + + Query qry = getSession().createQuery(impostoHql.toString()); + qry.setParameter("empresaEcfId", empresaEcfId); + + List list = qry.list(); + + return list; + } + + public List buscarFormaPagoAplicacaoImpfiscal() { + + StringBuilder impostoHql = new StringBuilder(); + impostoHql.append(" select e"); + impostoHql.append(" from FormaPago e"); + impostoHql.append(" where e.activo = 1 and e.impfiscal = 1"); + + Query qry = getSession().createQuery(impostoHql.toString()); + List list = qry.list(); + + return list; + } + + + @Override + public List obtenerTodosTotnaofiscalEmpresa() { + Criteria criteria = getSession().createCriteria(FiscalTotnaofiscalEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + return criteria.list(); + } + + @Override + public FiscalTotnaofiscalEmpresa obtenerIDTotnaofiscalEmpresa(Long id) { + Criteria criteria = getSession().createCriteria(FiscalTotnaofiscalEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("fiscalformapagoempresaId", id)); + + return (FiscalTotnaofiscalEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalTotnaofiscalEmpresa buscarTotNaoFiscal(Empresa empresa,String tipoTotalizador){ + Criteria criteria = getSession().createCriteria(FiscalTotnaofiscalEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("empresa", empresa)); + criteria.add(Restrictions.eq("tipototalizador", tipoTotalizador)); + + return (FiscalTotnaofiscalEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalTotnaofiscalEmpresa buscarTotNaoFiscal(Empresa empresa,String tipoTotalizador,String descEcf){ + Criteria criteria = getSession().createCriteria(FiscalTotnaofiscalEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("empresa", empresa)); + criteria.add(Restrictions.eq("tipototalizador", tipoTotalizador)); + criteria.add(Restrictions.eq("descricao", descEcf)); + + return (FiscalTotnaofiscalEmpresa) criteria.uniqueResult(); + } + @Override + public FiscalTotnaofiscalEmpresa buscarTotNaoFiscal(Empresa empresa,String tipoTotalizador,String descEcf,TipoEventoExtra tipoeventoextra){ + Criteria criteria = getSession().createCriteria(FiscalTotnaofiscalEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("empresa", empresa)); + criteria.add(Restrictions.eq("tipototalizador", tipoTotalizador)); + criteria.add(Restrictions.eq("descricao", descEcf)); + criteria.add(Restrictions.eq("tipoeventoextra", tipoeventoextra)); + + return (FiscalTotnaofiscalEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalTotnaofiscalEmpresa suscribirTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad) { + getSession().save(entidad); + getSession().flush(); + return entidad ; + } + @Override + public FiscalTotnaofiscalEmpresa actualizarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad) { + getSession().merge(entidad); + return entidad ; + } + + @Override + public void borrarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad) { + getSession().merge(entidad); + getSession().flush(); + } + + + @Override + public List obtenerTodosFormapagoEmpresa() { + Criteria criteria = getSession().createCriteria(FiscalFormapagoEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + return criteria.list(); + } + + @Override + public FiscalFormapagoEmpresa obtenerIDFormapagoEmpresa(Long id) { + Criteria criteria = getSession().createCriteria(FiscalFormapagoEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("fiscalformapagoempresaId", id)); + + return (FiscalFormapagoEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalFormapagoEmpresa suscribirFormapagoEmpresa(FiscalFormapagoEmpresa entidad) { + getSession().save(entidad); + getSession().flush(); + return entidad ; + } + + @Override + public FiscalFormapagoEmpresa buscarFormaPago(Empresa empresa,String tipoformapago){ + Criteria criteria = getSession().createCriteria(FiscalFormapagoEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("empresa", empresa)); + criteria.add(Restrictions.eq("tipoformapago", tipoformapago)); + + return (FiscalFormapagoEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalFormapagoEmpresa buscarFormaPago(Empresa empresa,String tipoformapago,String descEcf){ + Criteria criteria = getSession().createCriteria(FiscalFormapagoEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("empresa", empresa)); + criteria.add(Restrictions.eq("descricao", descEcf)); + criteria.add(Restrictions.eq("tipoformapago", tipoformapago)); + + return (FiscalFormapagoEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalRelgerencialEmpresa buscarRelGerencial(Empresa empresa,String tipoRelGerencial){ + Criteria criteria = getSession().createCriteria(FiscalRelgerencialEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("empresa", empresa)); + criteria.add(Restrictions.eq("tiporelgerencial", tipoRelGerencial)); + + return (FiscalRelgerencialEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalFormapagoEmpresa actualizacionFormapagoEmpresa(FiscalFormapagoEmpresa entidad) { + getSession().merge(entidad); + getSession().flush(); + return entidad; + } + + + @Override + public List obtenerTodosRelgerencialEmpresa() { + Criteria criteria = getSession().createCriteria(FiscalRelgerencialEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + return criteria.list(); + } + + @Override + public FiscalRelgerencialEmpresa obtenerIDRelgerencialEmpresa(Long id) { + Criteria criteria = getSession().createCriteria(FiscalTotnaofiscalEmpresa.class); + criteria.add(Restrictions.eq("activo", true)); + criteria.add(Restrictions.eq("fiscalformapagoempresaId", id)); + + return (FiscalRelgerencialEmpresa) criteria.uniqueResult(); + } + + @Override + public FiscalRelgerencialEmpresa suscribirRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad) { + getSession().save(entidad); + getSession().flush(); + return entidad ; + } + + @Override + public FiscalRelgerencialEmpresa actualizacionRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad) { + getSession().merge(entidad); + getSession().flush(); + return entidad; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FlywayUtilHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FlywayUtilHibernateDAO.java new file mode 100644 index 000000000..08f117522 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FlywayUtilHibernateDAO.java @@ -0,0 +1,64 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.jdbc.Work; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.dao.DataAccessResourceFailureException; +import org.springframework.orm.hibernate3.HibernateCallback; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FlywayUtilDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaAgrupacion; + +@Repository("flywayUtilDAO") +public class FlywayUtilHibernateDAO extends GenericHibernateDAO implements FlywayUtilDAO { + + private static Logger log = LoggerFactory.getLogger(FlywayUtilHibernateDAO.class); + + @Autowired + public FlywayUtilHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public boolean existeErroExecucaoScript() { + final List ls = new ArrayList(); + + try { + + getSession().doWork(new Work() { + + @Override + public void execute(Connection conn) throws SQLException { + ResultSet rs = conn.prepareStatement("select count(*) from \"schema_version\" where \"success\"=0").executeQuery(); + if (rs.next()) { + ls.add(rs.getInt(1) > 0); + } + + } + }); + + } catch (DataAccessResourceFailureException e) { + log.error("", e); + } catch (HibernateException e) { + log.error("", e); + } catch (IllegalStateException e) { + log.error("", e); + } + + return (ls.size()>0 && ls.get(0)); + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FolioPreimpresoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FolioPreimpresoHibernateDAO.java new file mode 100644 index 000000000..44e7cf099 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FolioPreimpresoHibernateDAO.java @@ -0,0 +1,43 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.apache.commons.lang.math.NumberUtils; +import org.hibernate.Query; +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.FolioPreimpresoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.FolioPreimpreso; + +@Repository("folioPreimpresoDAO") +public class FolioPreimpresoHibernateDAO extends GenericHibernateDAO implements FolioPreimpresoDAO { + + @Autowired + public FolioPreimpresoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public FolioPreimpreso buscaFolioPreImpressoEstacionImpresora(Estacion estacion, Empresa empresa) { + + StringBuffer hql = new StringBuffer(); + hql.append(" FROM FolioPreimpreso fp "); + hql.append(" WHERE fp.estacion.estacionId = :estacionId "); + hql.append(" AND fp.empresa.empresaId = :empresaId "); + hql.append(" AND fp.activo = :activo "); + hql.append(" ORDER BY fecmodif DESC "); + + Query query = getSession().createQuery(hql.toString()); + query.setParameter("activo", Boolean.TRUE); + query.setParameter("estacionId", estacion.getEstacionId()); + query.setParameter("empresaId", empresa.getEmpresaId()); + + query.setMaxResults(NumberUtils.INTEGER_ONE); + + return (FolioPreimpreso) query.uniqueResult(); + + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagamentoAgenciaDAOImpl.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagamentoAgenciaDAOImpl.java new file mode 100644 index 000000000..30121ad3d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagamentoAgenciaDAOImpl.java @@ -0,0 +1,79 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Date; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.FormaPagamentoAgenciaDAO; + +/** + * + * @author Administrador + */ +@Repository("formaPagamentoAgenciaDAO") +public class FormaPagamentoAgenciaDAOImpl implements FormaPagamentoAgenciaDAO { + + private static final Logger log = Logger.getLogger(FormaPagamentoAgenciaDAOImpl.class); + + private String getSql(Date dataInicio, Date dataFinal) { + StringBuilder where = new StringBuilder(); + where.append(" WHERE 1 = 1 "); + + if (dataInicio != null) { + where.append(" AND c.fechorventa >= ? "); + } + + if (dataFinal != null) { + where.append(" AND c.fechorventa <= ? "); + } + + StringBuilder sql = new StringBuilder(); + sql.append(" select to_char(c.fechorventa, 'dd/mm/yyyy') as data, "); + sql.append(" pv.PUNTOVENTA_ID as agencia, "); + sql.append(" fp.DESCPAGO as forma_pagamento, "); + sql.append(" sum(nvl(c.PRECIOPAGADO,0)) as tarifa, "); + sql.append(" sum(nvl(c.IMPORTEPEDAGIO,0)) as pedagio, "); + sql.append(" sum(nvl(c.IMPORTESEGURO,0)) as seguro, "); + sql.append(" sum(nvl(c.IMPORTETAXAEMBARQUE,0)) as taxa, "); + sql.append(" sum((c.PRECIOPAGADO + c.IMPORTEPEDAGIO + c.IMPORTESEGURO + c.IMPORTETAXAEMBARQUE)) as total, "); + sql.append(" count(c.PRECIOPAGADO) as qtde "); + sql.append(" from caja c "); + sql.append(" join caja_formapago cfp on c.caja_id = cfp.caja_id "); + sql.append(" join forma_pago fp on cfp.formapago_id = fp.formapago_id "); + sql.append(" join punto_venta pv on pv.PUNTOVENTA_ID = c.PUNTOVENTA_ID "); + sql.append(where); + sql.append(" group by to_char(c.fechorventa, 'dd/mm/yyyy'), pv.PUNTOVENTA_ID, fp.DESCPAGO "); + sql.append(" order by data, agencia, forma_pagamento"); + + return sql.toString(); + } + + public ResultSet executarSQL(Connection conn, Map parameters) { + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + String sql = getSql(dataInicio, dataFinal); + + PreparedStatement stmt = null; + ResultSet rset = null; + + try { + stmt = conn.prepareStatement(sql); + stmt.setDate(1, new java.sql.Date(dataInicio.getTime())); + stmt.setDate(2, new java.sql.Date(dataFinal.getTime())); + rset = stmt.executeQuery(); + } catch (Exception ex) { + log.error(ex); + } + + return rset; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoDetHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoDetHibernateDAO.java new file mode 100644 index 000000000..3805d25a1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoDetHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.FormaPagoDetDAO; +import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("formaPagoDetDAO") +public class FormaPagoDetHibernateDAO extends GenericHibernateDAO + implements FormaPagoDetDAO { + + @Autowired + public FormaPagoDetHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoHibernateDAO.java new file mode 100644 index 000000000..6e69e0146 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FormaPagoHibernateDAO.java @@ -0,0 +1,58 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.FormaPagoDAO; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("formaPagoDAO") +public class FormaPagoHibernateDAO extends GenericHibernateDAO + implements FormaPagoDAO { + + @Autowired + public FormaPagoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descpago")); + + return c.list(); + } + + public List buscarPorDescricao(String descpago) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descpago", descpago)); + + return c.list(); + } + + public List buscarTodosExceto(Integer... idFormaPago) { + Criteria c = this.makeCriteria(); + for (Integer id : idFormaPago) { + c.add(Restrictions.ne("formapagoId", id.shortValue())); + } + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descpago")); + return c.list(); + + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/FuncionSistemaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/FuncionSistemaHibernateDAO.java new file mode 100644 index 000000000..c899169a1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/FuncionSistemaHibernateDAO.java @@ -0,0 +1,40 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.FuncionSistemaDAO; +import com.rjconsultores.ventaboletos.entidad.FuncionSistema; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("funcionSistemaDAO") +public class FuncionSistemaHibernateDAO extends GenericHibernateDAO + implements FuncionSistemaDAO { + + @Autowired + public FuncionSistemaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.not(Restrictions.eq("descruta", "COM.RJCONSULTORES.ADMINISTRACION.GUI.CONFIGURACIONECCOMERCIALES.MENU.CONFIGURACIONGENERAL"))); + c.addOrder(Order.asc("nombfuncion")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/GenericHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/GenericHibernateDAO.java new file mode 100644 index 000000000..008d4e991 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/GenericHibernateDAO.java @@ -0,0 +1,161 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.ParameterizedType; +import java.util.Collection; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.hibernate.engine.LoadQueryInfluencers; +import org.hibernate.engine.SessionFactoryImplementor; +import org.hibernate.impl.CriteriaImpl; +import org.hibernate.impl.SessionImpl; +import org.hibernate.loader.OuterJoinLoader; +import org.hibernate.loader.criteria.CriteriaLoader; +import org.hibernate.persister.entity.OuterJoinLoadable; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; + +import com.rjconsultores.ventaboletos.dao.GenericDAO; + +/** + * + * @author gleimar + */ +@SuppressWarnings("unchecked") +public class GenericHibernateDAO extends HibernateDaoSupport implements GenericDAO { + public long start = System.currentTimeMillis(); + + public GenericHibernateDAO() { + this.persistentClass = (Class) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; + } + + // Classe que será persistida. + private Class persistentClass; + + public Class getPersistentClass() { + return this.persistentClass; + } + + @Override + public void borrar(T entity) { + try { + this.getHibernateTemplate().delete(entity); + } catch (final HibernateException ex) { + throw convertHibernateAccessException(ex); + } + } + + @Override + public T obtenerID(ID id) { + try { + return (T) this.getHibernateTemplate().get(getPersistentClass(), id); + } catch (final HibernateException ex) { + throw convertHibernateAccessException(ex); + } + } + + @Override + public List obtenerTodos() { + try { + return this.getHibernateTemplate().loadAll(getPersistentClass()); + } catch (final HibernateException ex) { + + throw convertHibernateAccessException(ex); + } + } + + @Override + public T suscribir(T entity) { + try { + this.getHibernateTemplate().save(entity); + return entity; + } catch (final HibernateException ex) { + + throw convertHibernateAccessException(ex); + } + } + + protected List findByCriteria(Criterion... criterion) { + try { + Criteria crit = this.getHibernateTemplate().getSessionFactory().getCurrentSession().createCriteria(getPersistentClass()); + for (Criterion c : criterion) { + crit.add(c); + } + return crit.list(); + } catch (final HibernateException ex) { + throw convertHibernateAccessException(ex); + } + } + + protected Criteria makeCriteria() { + return this.getHibernateTemplate().getSessionFactory().getCurrentSession().createCriteria(getPersistentClass()); + } + + public T actualizacion(T entity) { + return getHibernateTemplate().merge(entity); + } + + public Long count(String campo, Object o) { + Criteria c = this.makeCriteria(); + + c.add(Restrictions.eq(campo, o)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.setProjection(Projections.rowCount()); + + return HibernateFix.count(c.list()); + + } + + public void suscribirTodos(Collection entidades) { + getHibernateTemplate().saveOrUpdateAll(entidades); + } + + /* + * Metodo que retorna o sql do criteria passado + * para uso em debug e auxilio nas analises + * */ + public String getCriteriaSql( Criteria c, Session se) { + try { + CriteriaImpl ci = (CriteriaImpl) c; + SessionImpl s = (SessionImpl) se; + SessionFactoryImplementor factory = (SessionFactoryImplementor) s.getSessionFactory(); + String[] implementors = factory.getImplementors(ci.getEntityOrClassName()); + LoadQueryInfluencers lqis = new LoadQueryInfluencers(); + CriteriaLoader loader = new CriteriaLoader((OuterJoinLoadable) factory.getEntityPersister(implementors[0]), factory, ci, implementors[0], lqis); + Field f = OuterJoinLoader.class.getDeclaredField("sql"); + f.setAccessible(true); + String sql = (String) f.get(loader); + return sql; + } catch (Exception e) { + return "exception "+e.getMessage(); + } + } + + /* + * Metodo adicionado para retornar em o tempo de execucao + * de cada metodo chamado, sendo chamado nas implementacoes + * e printado via log.debug, para que possa ser analizado + * qualquer eventual demora na execução + * */ + public String printInfo(String method, long start) { + long milliseconds = System.currentTimeMillis() - start; + long minutes = (milliseconds / 1000) / 60; + long seconds = (milliseconds / 1000) % 60; + + String info = String.format("[%s] %d minutos e %d segundos", method, minutes, seconds); + + if ((minutes + seconds) == 0) { + info = String.format("[%s] %d milissegundos", method, milliseconds); + } + + return info; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCategoriaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCategoriaHibernateDAO.java new file mode 100644 index 000000000..be4c34ab7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCategoriaHibernateDAO.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.GrupoCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.GrupoCategoria; + +@Repository("grupoCategoriaDAO") +public class GrupoCategoriaHibernateDAO extends GenericHibernateDAO + implements GrupoCategoriaDAO { + + @Autowired + public GrupoCategoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscar(String descricao) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descGrupo", descricao)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCortesiasHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCortesiasHibernateDAO.java new file mode 100644 index 000000000..51ebee4ec --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoCortesiasHibernateDAO.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.GrupoCortesiasDAO; +import com.rjconsultores.ventaboletos.entidad.GrupoCortesia; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("grupoCortesiaDAO") +public class GrupoCortesiasHibernateDAO extends GenericHibernateDAO + implements GrupoCortesiasDAO { + + @Autowired + public GrupoCortesiasHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String descgrupo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descgrupo", descgrupo)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoRutaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoRutaHibernateDAO.java new file mode 100644 index 000000000..284ae66f7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/GrupoRutaHibernateDAO.java @@ -0,0 +1,46 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.GrupoRutaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.GrupoRuta; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +@Repository("grupoRutaDAO") +public class GrupoRutaHibernateDAO extends GenericHibernateDAO + implements GrupoRutaDAO { + + @Autowired + public GrupoRutaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + public List buscarPorNome(String descgrupo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descgrupo", descgrupo)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/HibernateFix.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/HibernateFix.java new file mode 100644 index 000000000..a206609fc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/HibernateFix.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.List; + +public class HibernateFix { + /** + * Usado para garantizar que las dos versiones del hibernate 3.6 y 3.2 realicen de forma correcta el count + * @param list + * @return + */ + public static Long count(List list) { + + Object resultado = list.iterator().next(); + + return count(resultado); + } + /** + * Usado para garantizar que las dos versiones del hibernate 3.6 y 3.2 realicen de forma correcta el count + * @param list + * @return + */ + public static Long count(Object resultado) { + Long cant = 0l; + + if (resultado instanceof Integer) { + cant = Long.valueOf(((Integer) resultado).longValue()); + } else if (resultado instanceof BigDecimal){ + cant= ((BigDecimal)resultado).longValue(); + } else { + cant = (Long) resultado; + } + return cant; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/HotelHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/HotelHibernateDAO.java new file mode 100644 index 000000000..0b0b34a1d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/HotelHibernateDAO.java @@ -0,0 +1,39 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.HotelDAO; +import com.rjconsultores.ventaboletos.entidad.Hotel; + +@Repository("hotelDAO") +public class HotelHibernateDAO extends GenericHibernateDAO implements HotelDAO { + + @Autowired + public HotelHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String deschotel) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("deschotel", deschotel)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ImagemHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ImagemHibernateDAO.java new file mode 100644 index 000000000..dbade2dd6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ImagemHibernateDAO.java @@ -0,0 +1,55 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ImagemDAO; +import com.rjconsultores.ventaboletos.entidad.Imagem; + +@Repository("imagemDAO") +public class ImagemHibernateDAO extends GenericHibernateDAO + implements ImagemDAO { + + @Autowired + public ImagemHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("imagemId")); + + return c.list(); + } + + public Imagem buscarPorNomeImagem(String nomeImagem) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("nombImagem", nomeImagem)); + + return (Imagem) c.uniqueResult(); + } + + public List buscar(String nomeImagem) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("nombImagem", nomeImagem)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeCategoriaVentaDAOImpl.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeCategoriaVentaDAOImpl.java new file mode 100644 index 000000000..9d2fc77fe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeCategoriaVentaDAOImpl.java @@ -0,0 +1,112 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.InformeCategoriaVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Date; +import java.util.Map; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("informeCategoriaVentaDAO") +public class InformeCategoriaVentaDAOImpl implements InformeCategoriaVentaDAO { + + private static final Logger log = Logger.getLogger(InformeCategoriaVentaDAOImpl.class); + + private String getSql(PuntoVenta puntoVenta, Ruta ruta, Parada origen, + Parada destino, Empresa empresa, Integer numServicio, Date dataInicio, + Date dataFinal) { + StringBuilder where = new StringBuilder(); + where.append(" WHERE 1 = 1 "); + + if (puntoVenta != null) { + where.append(" AND pu.puntoventa_id = ").append(puntoVenta.getPuntoventaId()); + } + + if (ruta != null) { + where.append(" AND ru.ruta_id = ").append(ruta.getRutaId()); + } + + if (origen != null) { + where.append(" AND bo.origen_id = ").append(origen.getParadaId()); + } + + if (destino != null) { + where.append(" AND bo.destino_id = ").append(destino.getParadaId()); + } + + if (empresa != null) { + where.append(" AND bo.empresacorrida_id = ").append(empresa.getEmpresaId()); + } + + if (numServicio != null) { + where.append(" AND bo.corrida_id = ").append(numServicio); + } + + if (dataInicio != null) { + where.append(" AND bo.feccorrida >= ? "); + } + + if (dataFinal != null) { + where.append(" AND bo.feccorrida <= ? "); + } + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT bo.corrida_id, bo.feccorrida, pao.descparada origen, pad.descparada destino, "); + sql.append(" ca.desccategoria, COUNT(*) qtde, SUM(bo.preciopagado) valor, ru.descruta, "); + sql.append(" pu.nombpuntoventa "); + sql.append(" FROM boleto bo "); + sql.append(" INNER JOIN categoria ca ON ca.categoria_id = bo.categoria_id "); + sql.append(" INNER JOIN parada pao ON pao.parada_id = bo.origen_id "); + sql.append(" INNER JOIN parada pad ON pad.parada_id = bo.destino_id "); + sql.append(" INNER JOIN corrida co ON co.corrida_id = bo.corrida_id "); + sql.append(" INNER JOIN ruta ru ON ru.ruta_id = co.ruta_id "); + sql.append(" INNER JOIN punto_venta pu ON pu.puntoventa_id = bo.puntoventa_id "); + sql.append(where); + sql.append(" GROUP BY bo.corrida_id, pao.descparada, pad.descparada, "); + sql.append(" ca.desccategoria, bo.feccorrida, ru.descruta, pu.nombpuntoventa "); + sql.append(" ORDER BY ca.desccategoria "); + + return sql.toString(); + } + + public ResultSet executarSQL(Connection conn, Map parameters) { + Ruta ruta = (Ruta) parameters.get("ruta"); + PuntoVenta puntoVenta = (PuntoVenta) parameters.get("puntoVenta"); + Empresa empresa = (Empresa) parameters.get("empresa"); + Parada origen = (Parada) parameters.get("origen"); + Parada destino = (Parada) parameters.get("destino"); + Integer numServicio = (Integer) parameters.get("numServicio"); + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + String sql = getSql(puntoVenta, ruta, origen, destino, empresa, + numServicio, dataInicio, dataFinal); + + PreparedStatement stmt = null; + ResultSet rset = null; + + try { + stmt = conn.prepareStatement(sql); + stmt.setDate(1, new java.sql.Date(dataInicio.getTime())); + stmt.setDate(2, new java.sql.Date(dataFinal.getTime())); + rset = stmt.executeQuery(); + } catch (Exception ex) { + log.error(ex); + } + + return rset; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/InformePasajeroServicioDAOImpl.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/InformePasajeroServicioDAOImpl.java new file mode 100644 index 000000000..b6a37a640 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/InformePasajeroServicioDAOImpl.java @@ -0,0 +1,89 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.InformePasajeroServicioDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Date; +import java.util.Map; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("informePasajeroServicioDAO") +public class InformePasajeroServicioDAOImpl implements InformePasajeroServicioDAO { + + private static final Logger log = Logger.getLogger(InformePasajeroServicioDAOImpl.class); + + private String getSql(Empresa empresa, Marca marca, Integer numServicio, + Date dataInicio, Date dataFinal) { + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT nombpasajero, feccorrida, corrida_id, boleto_id, preciopagado, "); + sql.append(" cs.descclase, pao.descparada origen, pad.descparada destino, "); + sql.append(" fechorventa, pv.nombpuntoventa, ma.descmarca, bo.usuario_id, "); + sql.append(" em.nombempresa "); + sql.append(" FROM boleto bo "); + sql.append(" INNER JOIN parada pao ON pao.parada_id = bo.origen_id "); + sql.append(" INNER JOIN parada pad ON pad.parada_id = bo.destino_id "); + sql.append(" INNER JOIN clase_servicio cs ON cs.claseservicio_id = bo.claseservicio_id "); + sql.append(" INNER JOIN punto_venta pv ON pv.puntoventa_id = bo.puntoventa_id "); + sql.append(" INNER JOIN marca ma on ma.marca_id = bo.marca_id "); + sql.append(" INNER JOIN empresa em ON em.empresa_id = bo.empresacorrida_id"); + sql.append(" WHERE 1=1 "); + + if (empresa != null) { + sql.append(" AND bo.empresacorrida_id = ").append(empresa.getEmpresaId()); + } + + if (marca != null) { + sql.append(" AND bo.marca_id = ").append(marca.getMarcaId()); + } + + if (numServicio != null) { + sql.append(" AND corrida_id = ").append(numServicio); + } + + if (dataInicio != null) { + sql.append(" AND bo.fechorventa >= ? "); + } + + if (dataFinal != null) { + sql.append(" AND bo.fechorventa <= ? "); + } + + return sql.toString(); + } + + public ResultSet executarSQL(Connection conn, Map parameters) { + Empresa empresa = (Empresa) parameters.get("empresa"); + Marca marca = (Marca) parameters.get("marca"); + Integer numServicio = (Integer) parameters.get("numServicio"); + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + + String sql = getSql(empresa, marca, numServicio, dataInicio, dataFinal); + PreparedStatement stmt = null; + ResultSet rset = null; + + try { + stmt = conn.prepareStatement(sql); + stmt.setDate(1, new java.sql.Date(dataInicio.getTime())); + stmt.setDate(2, new java.sql.Date(dataFinal.getTime())); + rset = stmt.executeQuery(); + } catch (Exception ex) { + log.error(ex); + } + + return rset; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeServicioDiarioDAOImpl.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeServicioDiarioDAOImpl.java new file mode 100644 index 000000000..e62e5d167 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeServicioDiarioDAOImpl.java @@ -0,0 +1,85 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.InformeServicioDiarioDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Date; +import java.util.Map; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("informeServicioDiarioDAO") +public class InformeServicioDiarioDAOImpl implements InformeServicioDiarioDAO { + + private static final Logger log = Logger.getLogger(InformeServicioDiarioDAOImpl.class); + + private String getSql(Empresa empresa, Integer numServicio, Date dataInicio, + Date dataFinal) { + StringBuilder where = new StringBuilder(); + where.append(" WHERE 1 = 1 "); + + if (empresa != null) { + where.append(" AND co.empresacorrida_id = ").append(empresa.getEmpresaId()); + } + + if (numServicio != null) { + where.append(" AND co.corrida_id = ").append(numServicio); + } + + if (dataInicio != null) { + where.append(" AND co.feccorrida >= ? "); + } + + if (dataFinal != null) { + where.append(" AND co.feccorrida <= ? "); + } + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT co.corrida_id servico, co.fechorsalida, SUM(tr.cantkmreal) km, "); + sql.append(" COUNT(co.corrida_id) qtdeservico, SUM(bo.preciopagado) receita, "); + sql.append(" ( SUM(bo.preciopagado) / SUM(tr.cantkmreal) ) rkm, em.nombempresa, "); + sql.append(" ru.descruta "); + sql.append(" FROM corrida co "); + sql.append(" INNER JOIN empresa em ON em.empresa_id = co.empresacorrida_id "); + sql.append(" INNER JOIN ruta ru ON ru.ruta_id = co.ruta_id "); + sql.append(" INNER JOIN ruta_secuencia rs ON rs.ruta_id = ru.ruta_id "); + sql.append(" INNER JOIN tramo tr ON tr.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN boleto bo ON bo.corrida_id = co.corrida_id "); + sql.append(where); + sql.append(" GROUP BY co.corrida_id, co.fechorsalida, em.nombempresa, ru.descruta "); + + return sql.toString(); + } + + public ResultSet executarSQL(Connection conn, Map parameters) { + Empresa empresa = (Empresa) parameters.get("empresa"); + Integer numServicio = (Integer) parameters.get("numServicio"); + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + String sql = getSql(empresa, numServicio, dataInicio, dataFinal); + + PreparedStatement stmt = null; + ResultSet rset = null; + + try { + stmt = conn.prepareStatement(sql); + stmt.setDate(1, new java.sql.Date(dataInicio.getTime())); + stmt.setDate(2, new java.sql.Date(dataFinal.getTime())); + rset = stmt.executeQuery(); + } catch (Exception ex) { + log.error(ex); + } + + return rset; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeVentasPuntoVentaDAOImpl.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeVentasPuntoVentaDAOImpl.java new file mode 100644 index 000000000..1c87fc79b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/InformeVentasPuntoVentaDAOImpl.java @@ -0,0 +1,90 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.InformeVentasPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Date; +import java.util.Map; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("informeVentasPuntoVentaDAO") +public class InformeVentasPuntoVentaDAOImpl implements InformeVentasPuntoVentaDAO { + + private static final Logger log = Logger.getLogger(InformeVentasPuntoVentaDAOImpl.class); + + private String getSql(PuntoVenta puntoVenta, Date dataInicio, Date dataFinal) { + + StringBuilder where = new StringBuilder(); + + if (dataInicio != null) { + where.append(" AND bo.fechorventa >= ? "); + } + + if (dataFinal != null) { + where.append(" AND bo.fechorventa <= ? "); + } + + if (puntoVenta != null) { + where.append(" AND pu.puntoventa_id = ").append(puntoVenta.getPuntoventaId()); + } + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT vendidos.puntoventa_id, vendidos.nombpuntoventa, "); + sql.append(" vendidos.qtde_total AS qtde_total_vendidos, "); + sql.append(" vendidos.valor_total AS valor_total_vendidos, "); + sql.append(" cancelado.qtde_total AS qtde_total_cancelado, "); + sql.append(" cancelado.valor_total as valor_total_cancelado "); + sql.append(" FROM (SELECT pu.puntoventa_id, pu.nombpuntoventa, "); + sql.append(" COUNT(*) qtde_total, "); + sql.append(" SUM(bo.preciopagado) valor_total "); + sql.append(" FROM boleto bo "); + sql.append(" INNER JOIN punto_venta pu ON pu.puntoventa_id = bo.puntoventa_id "); + sql.append(" WHERE bo.motivocancelacion_id IS NOT NULL ").append(where); + sql.append(" GROUP BY pu.puntoventa_id, pu.nombpuntoventa) cancelado "); + sql.append(" INNER JOIN (SELECT pu.puntoventa_id, pu.nombpuntoventa, "); + sql.append(" COUNT(*) qtde_total, "); + sql.append(" SUM(bo.preciopagado) valor_total "); + sql.append(" FROM boleto bo "); + sql.append(" INNER JOIN punto_venta pu ON pu.puntoventa_id = bo.puntoventa_id "); + sql.append(" WHERE bo.motivocancelacion_id IS NULL ").append(where); + sql.append(" GROUP BY pu.puntoventa_id, pu.nombpuntoventa) vendidos "); + sql.append(" ON cancelado.puntoventa_id = vendidos.puntoventa_id "); + sql.append(" ORDER BY nombpuntoventa "); + + return sql.toString(); + } + + public ResultSet executarSQL(Connection conn, Map parameters) { + PuntoVenta puntoVenta = (PuntoVenta) parameters.get("puntoVenta"); + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + + String sql = getSql(puntoVenta, dataInicio, dataFinal); + PreparedStatement stmt = null; + ResultSet rset = null; + + try { + stmt = conn.prepareStatement(sql); + stmt.setDate(1, new java.sql.Date(dataInicio.getTime())); + stmt.setDate(2, new java.sql.Date(dataFinal.getTime())); + stmt.setDate(3, new java.sql.Date(dataInicio.getTime())); + stmt.setDate(4, new java.sql.Date(dataFinal.getTime())); + rset = stmt.executeQuery(); + } catch (Exception ex) { + log.error(ex); + } + + return rset; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/InstiFinanceiraHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/InstiFinanceiraHibernateDAO.java new file mode 100644 index 000000000..e02354153 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/InstiFinanceiraHibernateDAO.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.InstiFinanceiraDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; +import com.rjconsultores.ventaboletos.entidad.InstiFinanceira; + +@Repository("ptovtaBancoDAO") +@SuppressWarnings("unchecked") +public class InstiFinanceiraHibernateDAO extends GenericHibernateDAO + implements InstiFinanceiraDAO { + + @Autowired + public InstiFinanceiraHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nome")); + return c.list(); + } + + public List buscar(String nome) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nome", nome)); + return c.list(); + } + + @Override + public List buscarContasBancariasPorIdEmpresa(Integer empresaId) { + + Criteria c = getSession().createCriteria(EmpresaContaBancaria.class); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa.empresaId", empresaId)); + + List empresasContaBancarias = (List) c.list(); + return empresasContaBancarias; + } + + +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/IntegracaoDerPrHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/IntegracaoDerPrHibernateDAO.java new file mode 100644 index 000000000..c6a2f0661 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/IntegracaoDerPrHibernateDAO.java @@ -0,0 +1,286 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.type.BigDecimalType; +import org.hibernate.type.DateType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.hibernate.type.TimestampType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.IntegracaoDerPrDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.vo.exportacao.QdmpDerCabecaVo; +import com.rjconsultores.ventaboletos.vo.exportacao.QdmpDerLinhaVo; +import com.rjconsultores.ventaboletos.vo.exportacao.QdmpDerRodapeVo; + +@Repository("integracaoDerPrDAO") +@SuppressWarnings("unchecked") +public class IntegracaoDerPrHibernateDAO extends GenericHibernateDAO implements IntegracaoDerPrDAO { + + @Autowired + public IntegracaoDerPrHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarDadosImportacaoLinha(Date inicio, Date fim, Empresa empresa, Integer linhaId) { + + StringBuilder sb = new StringBuilder(); + sb.append(" SELECT * "); + sb.append(" FROM "); + sb.append(" ( "); + sb.append(" SELECT "); + sb.append(" e.codder as codemp, "); + sb.append(" r.prefixo as linha, "); + sb.append(" rc.codigoderpr as secao, "); + sb.append(" count( distinct b.boleto_id) AS bilhete, "); + sb.append(" ( CASE "); + sb.append(" WHEN r.indsentidoida = 0 THEN "); + sb.append(" 'VOLTA' "); + sb.append(" ELSE "); + sb.append(" 'IDA' "); + sb.append(" END ) AS sentido, "); + sb.append(" count( distinct CASE "); + sb.append(" WHEN (co.tiposervicio_id = 1 ) THEN "); + sb.append(" b.boleto_id "); + sb.append(" ELSE "); + sb.append(" null "); + sb.append(" END ) AS ord, "); + sb.append(" count( distinct CASE "); + sb.append(" WHEN ((b.origen_id = co.origen_id and b.destino_id = co.destino_id) and co.tiposervicio_id = 2 ) THEN "); + sb.append(" b.boleto_id "); + sb.append(" ELSE "); + sb.append(" null "); + sb.append(" END ) AS rft, "); + sb.append(" count( distinct CASE "); + sb.append(" WHEN ((b.origen_id <> co.origen_id or b.destino_id <> co.destino_id) and co.tiposervicio_id = 2 ) THEN "); + sb.append(" b.boleto_id "); + sb.append(" ELSE "); + sb.append(" null "); + sb.append(" END ) AS rfp, "); + sb.append(" count( distinct CASE "); + sb.append(" WHEN ((b.origen_id <> co.origen_id or b.destino_id <> co.destino_id) and co.tiposervicio_id = 2 ) THEN "); + sb.append(" b.corrida_id "); + sb.append(" ELSE "); + sb.append(" null "); + sb.append(" END ) AS viagRfp "); + + preencheFrom(sb); + preencheWhere(linhaId, sb); + + sb.append(" GROUP BY "); + sb.append(" r.prefixo, "); + sb.append(" e.codder, "); + sb.append(" rc.codigoderpr, "); + sb.append(" r.indsentidoida "); + sb.append(" ) PIVOT ( "); + sb.append(" sum ( bilhete ) tot, sum( ord) ord, sum( rft ) rft, sum(rfp) rfp "); + sb.append(" FOR sentido IN ( 'IDA', 'VOLTA' ) "); + sb.append(" ) "); + sb.append(" ORDER BY "); + sb.append(" linha, secao "); + + SQLQuery qry = getSession().createSQLQuery(sb.toString()) + .addScalar("codemp", IntegerType.INSTANCE) + .addScalar("linha", StringType.INSTANCE) + .addScalar("secao", StringType.INSTANCE) + .addScalar("'IDA'_TOT", IntegerType.INSTANCE) + .addScalar("'VOLTA'_TOT", IntegerType.INSTANCE) + .addScalar("'IDA'_ORD", IntegerType.INSTANCE) + .addScalar("'VOLTA'_ORD", IntegerType.INSTANCE) + .addScalar("'IDA'_RFT", IntegerType.INSTANCE) + .addScalar("'VOLTA'_RFT", IntegerType.INSTANCE) + .addScalar("'IDA'_RFP", IntegerType.INSTANCE) + .addScalar("'VOLTA'_RFP", IntegerType.INSTANCE) + .addScalar("viagRfp", IntegerType.INSTANCE); + + qry.setParameter("EMPRESA_ID", empresa.getEmpresaId(), IntegerType.INSTANCE); + qry.setParameter("DATA_INICIAL", DateUtil.inicioFecha(inicio), DateType.INSTANCE); + qry.setParameter("DATA_FINAL", DateUtil.inicioFecha(fim), DateType.INSTANCE); + + List retorno = new ArrayList(); + List dados = qry.list(); + + for (Object[] object : dados) { + QdmpDerLinhaVo vo = new QdmpDerLinhaVo(object); + retorno.add(vo); + } + + return retorno; + } + + @Override + public String buscarDadosImportacaoCabeca(Date inicio, Date fim, Empresa empresa, Integer linhaId) { + StringBuilder sb = new StringBuilder(); + sb.append(" SELECT "); + sb.append(" e.codder as codemp, "); + sb.append(" r.prefixo as linha, "); + sb.append(" count(distinct CASE "); + sb.append(" WHEN ((b.origen_id = co.origen_id or b.destino_id = co.destino_id) and co.tiposervicio_id = 1 ) THEN "); + sb.append(" b.corrida_id+ to_char(b.feccorrida, 'ddMMyyyy') "); + sb.append(" ELSE "); + sb.append(" null "); + sb.append(" END ) AS viagOrd, "); + sb.append(" sum(distinct CASE "); + sb.append(" WHEN ((b.origen_id = co.origen_id or b.destino_id = co.destino_id) and co.tiposervicio_id = 1 ) THEN "); + sb.append(" da.cantasientos "); + sb.append(" ELSE "); + sb.append(" null "); + sb.append(" END ) AS lugOrd, "); + sb.append(" count(distinct CASE "); + sb.append(" WHEN ((b.origen_id = co.origen_id and b.destino_id = co.destino_id) and co.tiposervicio_id = 2 ) THEN "); + sb.append(" b.corrida_id+ to_char(b.feccorrida, 'ddMMyyyy') "); + sb.append(" ELSE "); + sb.append(" null "); + sb.append(" END ) AS viagRft, "); + sb.append(" sum(distinct CASE "); + sb.append(" WHEN ((b.origen_id = co.origen_id and b.destino_id = co.destino_id) and co.tiposervicio_id = 2 ) THEN "); + sb.append(" da.cantasientos "); + sb.append(" ELSE "); + sb.append(" null "); + sb.append(" END ) AS lugRft, "); + sb.append(" count(distinct CASE "); + sb.append(" WHEN ((b.origen_id <> co.origen_id or b.destino_id <> co.destino_id) and co.tiposervicio_id = 2 ) THEN "); + sb.append(" b.corrida_id+ to_char(b.feccorrida, 'ddMMyyyy') "); + sb.append(" ELSE "); + sb.append(" null "); + sb.append(" END ) AS viagRfp, "); + sb.append(" sum(distinct CASE "); + sb.append(" WHEN ((b.origen_id <> co.origen_id or b.destino_id <> co.destino_id) and co.tiposervicio_id = 2 ) THEN "); + sb.append(" da.cantasientos "); + sb.append(" ELSE "); + sb.append(" null "); + sb.append(" END ) AS lugRfp "); + + preencheFrom(sb); + preencheWhere(linhaId, sb); + + sb.append(" GROUP BY "); + sb.append(" r.prefixo, "); + sb.append(" e.codder "); + + SQLQuery qry = getSession().createSQLQuery(sb.toString()) + .addScalar("codEmp", IntegerType.INSTANCE) + .addScalar("linha", StringType.INSTANCE) + .addScalar("viagOrd", IntegerType.INSTANCE) + .addScalar("lugOrd", IntegerType.INSTANCE) + .addScalar("viagRft", IntegerType.INSTANCE) + .addScalar("lugRft", IntegerType.INSTANCE) + .addScalar("viagRfp", IntegerType.INSTANCE) + .addScalar("lugRfp", IntegerType.INSTANCE); + + qry.setParameter("EMPRESA_ID", empresa.getEmpresaId(), IntegerType.INSTANCE); + qry.setParameter("DATA_INICIAL", new Timestamp(DateUtil.inicioFecha(inicio).getTime()), TimestampType.INSTANCE); + qry.setParameter("DATA_FINAL", new Timestamp(DateUtil.inicioFecha(fim).getTime()), TimestampType.INSTANCE); + + Object[] dados = (Object[])qry.uniqueResult(); + QdmpDerCabecaVo cabeca = new QdmpDerCabecaVo(dados); + + return cabeca.toString(); + } + + @Override + public String buscarDadosImportacaoRodape(Date inicio, Date fim, Empresa empresa, Integer linhaId) { + StringBuilder sb = new StringBuilder(); + sb.append(" SELECT "); + sb.append(" e.codder as codemp, "); + sb.append(" r.prefixo as linha, "); + sb.append(" count( distinct b.boleto_id) AS totMov, "); + sb.append(" sum( b.preciopagado ) AS receita, "); + sb.append(" sum((b.preciopagado - (b.preciopagado * coalesce(ei.porcredbaseicms / 100,0))) * est.icms) / 100 AS icms, "); + sb.append(" 0 as iasp "); + + preencheFrom(sb); + preencheWhere(linhaId, sb); + + sb.append(" GROUP BY "); + sb.append(" r.prefixo, "); + sb.append(" e.codder "); + + SQLQuery qry = getSession().createSQLQuery(sb.toString()) + .addScalar("codEmp", IntegerType.INSTANCE) + .addScalar("linha", StringType.INSTANCE) + .addScalar("totMov", IntegerType.INSTANCE) + .addScalar("receita", BigDecimalType.INSTANCE) + .addScalar("icms", BigDecimalType.INSTANCE) + .addScalar("iasp", BigDecimalType.INSTANCE); + + qry.setParameter("EMPRESA_ID", empresa.getEmpresaId(), IntegerType.INSTANCE); + qry.setParameter("DATA_INICIAL", new Timestamp(DateUtil.inicioFecha(inicio).getTime()), TimestampType.INSTANCE); + qry.setParameter("DATA_FINAL", new Timestamp(DateUtil.inicioFecha(fim).getTime()), TimestampType.INSTANCE); + + Object[] dados = (Object[])qry.uniqueResult(); + QdmpDerRodapeVo rodape = new QdmpDerRodapeVo(dados); + + return rodape.toString(); + } + + private void preencheFrom(StringBuilder sb) { + sb.append(" FROM "); + sb.append(" boleto b "); + sb.append(" INNER JOIN corrida co "); + sb.append(" ON b.corrida_id = co.corrida_id "); + sb.append(" AND b.feccorrida = co.feccorrida "); + sb.append(" AND co.activo = 1 "); + sb.append(" INNER JOIN ruta r "); + sb.append(" ON b.ruta_id = r.ruta_id "); + sb.append(" AND r.activo = 1 "); + sb.append(" INNER JOIN marca m "); + sb.append(" ON m.marca_id = b.marca_id "); + sb.append(" AND m.activo = 1 "); + sb.append(" INNER JOIN empresa e "); + sb.append(" ON m.empresa_id = e.empresa_id "); + sb.append(" AND e.activo = 1 "); + sb.append(" LEFT JOIN rol_operativo ro "); + sb.append(" ON ro.roloperativo_id = co.roloperativo_id "); + sb.append(" LEFT JOIN diagrama_autobus da "); + sb.append(" ON ro.diagramaautobus_id = da.diagramaautobus_id "); + sb.append(" LEFT JOIN corrida_tramo ct "); + sb.append(" ON b.corrida_id = ct.corrida_id "); + sb.append(" AND b.feccorrida = ct.feccorrida "); + sb.append(" and b.origen_id = ct.origen_id "); + sb.append(" LEFT JOIN ruta_combinacion rc "); + sb.append(" on rc.tramo_id = ct.tramo_id "); + sb.append(" and rc.ruta_id = b.ruta_id "); + sb.append(" and rc.activo = 1 "); + sb.append(" inner join parada po "); + sb.append(" on po.parada_id = b.origen_id "); + sb.append(" and po.activo = 1 "); + sb.append(" inner join ciudad ciu "); + sb.append(" on ciu.ciudad_id = po.ciudad_id "); + sb.append(" and ciu.activo = 1 "); + sb.append(" inner join estado est "); + sb.append(" on est.estado_id = ciu.estado_id "); + sb.append(" and est.activo = 1 "); + sb.append(" inner join empresa_imposto ei "); + sb.append(" on ei.empresa_id = e.empresa_id "); + sb.append(" and ei.estado_id = est.estado_id "); + sb.append(" and ei.activo = 1 "); + } + + private void preencheWhere(Integer linhaId, StringBuilder sb) { + sb.append(" WHERE b.activo = 1 "); + sb.append(" and m.empresa_id = :EMPRESA_ID "); + sb.append(" and b.feccorrida BETWEEN :DATA_INICIAL AND :DATA_FINAL "); + + if (linhaId != null) { + sb.append(" and b.ruta_id = " + linhaId ); + } + + sb.append(" and b.MOTIVOCANCELACION_ID is null "); + sb.append(" and b.INDSTATUSBOLETO = 'V' "); + } + +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ItemAdicionalHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ItemAdicionalHibernateDAO.java new file mode 100644 index 000000000..98dda40ad --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ItemAdicionalHibernateDAO.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ItemAdicionalDAO; +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; + +@Repository("itemAdicionalDAO") +public class ItemAdicionalHibernateDAO extends GenericHibernateDAO implements ItemAdicionalDAO { + + @Autowired + public ItemAdicionalHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descitemadicional")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaItemAdicionalPacote(Pacote pacote) { + + StringBuilder sb = new StringBuilder(); + sb.append(" select pi.itemAdicional "); + sb.append(" from PacoteItem pi "); + sb.append(" where pi.pacote.pacoteId = :pacoteId "); + sb.append(" and pi.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacote.getPacoteId()); + + return query.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ItemDescontoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ItemDescontoHibernateDAO.java new file mode 100644 index 000000000..8d35743cf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ItemDescontoHibernateDAO.java @@ -0,0 +1,54 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ItemDescontoDAO; +import com.rjconsultores.ventaboletos.entidad.ItemDesconto; + +@Repository("itemDescontoDAO") +public class ItemDescontoHibernateDAO extends GenericHibernateDAO implements ItemDescontoDAO { + + @Autowired + public ItemDescontoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List buscarPorNome(String nomitemdesconto) { + StringBuilder sb = new StringBuilder(); + sb.append(" select id ") + .append(" from ItemDesconto id ") + .append(" where id.activo = 1 "); + + if(StringUtils.isNotBlank(nomitemdesconto)) { + sb.append("and id.nomitemdesconto = :nomitemdesconto "); + } + + Query query = getSession().createQuery(sb.toString()); + + if(StringUtils.isNotBlank(nomitemdesconto)) { + query.setString("nomitemdesconto", nomitemdesconto); + } + + return query.list(); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos() { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/LogAuditoriaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/LogAuditoriaHibernateDAO.java new file mode 100644 index 000000000..b24fa0c26 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/LogAuditoriaHibernateDAO.java @@ -0,0 +1,30 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +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.LogAuditoriaDAO; +import com.rjconsultores.ventaboletos.entidad.LogAuditoria; + +@Repository("LogAuditoriaDAO") +public class LogAuditoriaHibernateDAO extends GenericHibernateDAO implements LogAuditoriaDAO { + + @Autowired + public LogAuditoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List listarTodasAsTelas() { + Query query = getSession().createSQLQuery("select tela from log_auditoria where activo = 1 group by tela"); + List lista = query.list(); + return lista; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/LogDespesaReceitaDivHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/LogDespesaReceitaDivHibernateDAO.java new file mode 100644 index 000000000..30760f106 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/LogDespesaReceitaDivHibernateDAO.java @@ -0,0 +1,57 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import javax.sql.DataSource; + +import org.apache.xmlbeans.impl.xb.xsdschema.RestrictionDocument.Restriction; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.LogDespesaReceitaDivDAO; +import com.rjconsultores.ventaboletos.entidad.LogDespesaReceitaDiversa; + +@Repository("logDespesaReceitaDivDAO") +public class LogDespesaReceitaDivHibernateDAO extends GenericHibernateDAO implements LogDespesaReceitaDivDAO { + @Autowired + private DataSource dataSource; + + @Autowired + public LogDespesaReceitaDivHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.addOrder(Order.desc("dataExecucao")); + + return (List) c.list(); + } + + + public List obterPorPeriodo(Date inicio, Date fim){ + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("dataInicio", inicio)); + c.add(Restrictions.eq("dataFim", fim)); + c.addOrder(Order.desc("dataExecucao")); + + return (List) c.list(); + } + + @Override + public LogDespesaReceitaDiversa suscribir(LogDespesaReceitaDiversa entity) throws RuntimeException { + + entity = super.suscribir(entity); + + + return entity; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/LogHistoricoContingenciaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/LogHistoricoContingenciaHibernateDAO.java new file mode 100644 index 000000000..f67bc2834 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/LogHistoricoContingenciaHibernateDAO.java @@ -0,0 +1,42 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +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.LogHistoricoContingenciaDAO; +import com.rjconsultores.ventaboletos.entidad.LogHistoricoContingencia; + +/** + * @author vjcor + * + */ +@Repository("LogHistoricoContingenciaDAO") +@SuppressWarnings("unchecked") +public class LogHistoricoContingenciaHibernateDAO extends GenericHibernateDAO implements LogHistoricoContingenciaDAO { + + @Autowired + public LogHistoricoContingenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarHistorico(Integer empresaID, Integer estadoID) { + String queryStr = "from LogHistoricoContingencia log where log.empresa.empresaId = :empresaId and log.estado.estadoId = :estadoId"; + + Query query = getSession().createQuery(queryStr); + query.setInteger("empresaId", empresaID); + query.setInteger("estadoId", estadoID); + + return (List) query.list(); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaAutobusHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaAutobusHibernateDAO.java new file mode 100644 index 000000000..33d76d94e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaAutobusHibernateDAO.java @@ -0,0 +1,31 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MarcaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.MarcaAutobus; + +@Repository("marcaAutobusDAO") +public class MarcaAutobusHibernateDAO extends GenericHibernateDAO +implements MarcaAutobusDAO { + + @Autowired + public MarcaAutobusHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaClaseServicioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaClaseServicioHibernateDAO.java new file mode 100644 index 000000000..1fe9182b6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaClaseServicioHibernateDAO.java @@ -0,0 +1,74 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MarcaClaseServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicioPK; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("marcaClaseServicioDAO") +public class MarcaClaseServicioHibernateDAO + extends GenericHibernateDAO + implements MarcaClaseServicioDAO { + + @Autowired + public MarcaClaseServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(ClaseServicio clase) { + + StringBuilder hql = new StringBuilder(); + hql.append(" select mc.marcaClaseservicioPK.marca "); + hql.append(" from MarcaClaseServicio mc "); + hql.append(" where mc.activo = 1 and mc.marcaClaseservicioPK.marca.activo=1 "); + hql.append(" and mc.marcaClaseservicioPK.claseservicio.claseservicioId = " + clase.getClaseservicioId()); + + Query q = getSession().createQuery(hql.toString()); + + return q.list(); + } + + @Override + public List buscarPorEmpresasPermitidas(ClaseServicio clase, List idsEmpresa) { + + StringBuilder hql = new StringBuilder(); + hql.append(" select mc.marcaClaseservicioPK.marca "); + hql.append(" from MarcaClaseServicio mc "); + hql.append(" where mc.activo = 1 and mc.marcaClaseservicioPK.marca.activo=1 "); + hql.append(" and mc.marcaClaseservicioPK.claseservicio.claseservicioId = :idClase"); + hql.append(" and mc.marcaClaseservicioPK.marca.empresa.empresaId IN (:idsEmpresa)"); + + Query q = getSession().createQuery(hql.toString()); + q.setParameter("idClase", clase.getClaseservicioId()); + q.setParameterList("idsEmpresa", idsEmpresa); + + return q.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaHibernateDAO.java new file mode 100644 index 000000000..13cb7cbac --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MarcaHibernateDAO.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.Transformer; +import org.apache.commons.lang.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.FetchMode; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MarcaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Usuario; + +/** + * + * @author Administrador + */ +@Repository("marcaDAO") +public class MarcaHibernateDAO extends GenericHibernateDAO + implements MarcaDAO { + + @Autowired + public MarcaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descmarca")); + + return c.list(); + + } + + @Override + public List buscarPorNome(String nomeMarca) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descmarca", nomeMarca)); + + return c.list(); + } + + @Override + public List buscarTodosExceto(Usuario usuario, Integer... idMarca) { + String hql = " select new com.rjconsultores.ventaboletos.entidad.Marca(marca.marcaId, marca.descmarca) from Marca marca, UsuarioEmpresa ue" + + " where marca.empresa = ue.empresa and ue.usuarioLog = :usuarioId "; + + hql = hql + " and marca.marcaId not in ( " + StringUtils.join(idMarca, ",") + ")"; + + Query sq = getSession().createQuery(hql); + sq.setParameter("usuarioId", usuario); + List lsMarca = sq.list(); + return lsMarca; + + } + + @Override + public List buscarDescricaoIdMarca() { + String hql = " select new com.rjconsultores.ventaboletos.entidad.Marca(m.marcaId, m.descmarca) from Marca m where m.marcaId <> -1 "; + Query sq = getSession().createQuery(hql); + List lsMarca = sq.list(); + return lsMarca; + } + + @Override + public List buscarMarcaPorEmpresa(List empresa) { + if ((empresa == null) || (empresa.isEmpty())) { + return Collections.emptyList(); + } + Collection idsEmpresa = CollectionUtils.transformedCollection(empresa, new Transformer() { + + @Override + public Object transform(Object input) { + return ((Empresa) input).getEmpresaId(); + } + }); + + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.in("empresa", idsEmpresa)); + c.setFetchMode("logotipomarca", FetchMode.DEFAULT); + + return c.list(); + } + + @Override + public Marca buscarMarcaPorEmpresa(Empresa empresa) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.eq("empresa", empresa)); + List marcas = c.list(); + if (marcas != null && !marcas.isEmpty()) { + return marcas.get(0); + } + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MensagemRecusaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensagemRecusaHibernateDAO.java new file mode 100644 index 000000000..39f1f24f8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensagemRecusaHibernateDAO.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MensagemRecusaDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.MensagemRecusa; + +@Repository("MensagemRecusaDAO") +public class MensagemRecusaHibernateDAO extends GenericHibernateDAO implements MensagemRecusaDAO { + + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public MensagemRecusaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeEmpresaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeEmpresaHibernateDAO.java new file mode 100644 index 000000000..a7842a4e2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeEmpresaHibernateDAO.java @@ -0,0 +1,45 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MensajeEmpresaDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeEmpresa; + +@Repository("MensajeEmpresaDAO") +public class MensajeEmpresaHibernateDAO extends GenericHibernateDAO implements MensajeEmpresaDAO { + + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public MensajeEmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerPorMensaje(Mensaje mensaje) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("mensaje", mensaje)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeHibernateDAO.java new file mode 100644 index 000000000..520b1daa0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeHibernateDAO.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MensajeDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.Mensaje; + +@Repository("MensajeDAO") +public class MensajeHibernateDAO extends GenericHibernateDAO implements MensajeDAO { + + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public MensajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajePuntoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajePuntoVentaHibernateDAO.java new file mode 100644 index 000000000..c4808f171 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajePuntoVentaHibernateDAO.java @@ -0,0 +1,45 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MensajePuntoVentaDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajePuntoVenta; + +@Repository("MensajePuntoVentaDAO") +public class MensajePuntoVentaHibernateDAO extends GenericHibernateDAO implements MensajePuntoVentaDAO { + + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public MensajePuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerPorMensaje(Mensaje mensaje) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("mensaje", mensaje)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeUsuarioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeUsuarioHibernateDAO.java new file mode 100644 index 000000000..793826439 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MensajeUsuarioHibernateDAO.java @@ -0,0 +1,45 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MensajeUsuarioDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeUsuario; + +@Repository("MensajeUsuarioDAO") +public class MensajeUsuarioHibernateDAO extends GenericHibernateDAO implements MensajeUsuarioDAO { + + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public MensajeUsuarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerPorMensaje(Mensaje mensaje) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("mensaje", mensaje)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MercadoCompetidoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MercadoCompetidoHibernateDAO.java new file mode 100644 index 000000000..968e289e8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MercadoCompetidoHibernateDAO.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MercadoCompetidoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MercadoCompetido; +import com.rjconsultores.ventaboletos.entidad.Parada; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("mercadoCompetidoDAO") +public class MercadoCompetidoHibernateDAO + extends GenericHibernateDAO + implements MercadoCompetidoDAO { + + @Autowired + public MercadoCompetidoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public boolean existe(ClaseServicio claseServicio, Parada origem, + Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + + c.setProjection(Projections.rowCount()); + + return (HibernateFix.count(c.list()) > 0) ; + } + + public List buscar(Parada origem, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MerchantBancarioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MerchantBancarioHibernateDAO.java new file mode 100644 index 000000000..0612c810e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MerchantBancarioHibernateDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MerchantBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.MerchantBancario; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("merchantBancarioDAO") +public class MerchantBancarioHibernateDAO extends GenericHibernateDAO + implements MerchantBancarioDAO { + + @Autowired + public MerchantBancarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MonedaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MonedaHibernateDAO.java new file mode 100644 index 000000000..2371096cc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MonedaHibernateDAO.java @@ -0,0 +1,47 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MonedaDAO; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("monedaDAO") +public class MonedaHibernateDAO extends GenericHibernateDAO + implements MonedaDAO { + + @Autowired + public MonedaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descmoneda")); + + return c.list(); + } + + public List buscar(String descmoneda) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descmoneda", descmoneda)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCCFHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCCFHibernateDAO.java new file mode 100644 index 000000000..6cf3aaf71 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCCFHibernateDAO.java @@ -0,0 +1,254 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.jdbc.Work; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MonitoramentoCCFDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCCF; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCRZ; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +@Repository("monitoramentoCCFDAO") +public class MonitoramentoCCFHibernateDAO extends GenericHibernateDAO +implements MonitoramentoCCFDAO { + private static Logger log = Logger.getLogger(MonitoramentoCCFHibernateDAO.class); + private Connection con; + Boolean jaexiste; + + @Autowired + public MonitoramentoCCFHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + private String getSQL(){ + StringBuilder sql = new StringBuilder(); + + sql.append(" SELECT "); + sql.append(" fi.empresa_id as empresa, "); + sql.append(" fi.numserie20 as numserie20, "); + sql.append(" fi.fiscalimpressora_id as fiscalimpressora_id, "); + sql.append(" fi.estadolocal_id as estado, "); + sql.append(" c.FECCREACION as datamov, "); + sql.append(" fi.puntoventa_id as puntoventa_id, "); + sql.append(" c.usuario_id as usuario_id, "); + sql.append(" r4.contador as ccf, "); + sql.append(" c.caja_id as cajaId, "); + sql.append(" fi.numserie as numserie "); + sql.append(" FROM "); + sql.append(" caja c "); + sql.append(" left join fiscal_r4 R4 on R4.CAJA_ID = c.CAJA_ID "); + sql.append(" inner join fiscal_impressora fi on fi.numserie = c.SERIEIMPFISCAL "); + sql.append(" where "); + sql.append(" fi.numserie = :numserie "); + sql.append(" and trunc(c.FECCREACION) >= :data "); + sql.append(" and c.ccf >= :ccfInicial "); + sql.append(" and fi.activo = 1 "); + sql.append(" and c.activo = 1 "); + sql.append(" and ((c.indreimpresion = 0) or (c.indreimpresion = 1 and c.indstatusboleto in ('E')) or (c.indreimpresion = 1 and c.motivocancelacion_id =(select motivocancelacion_id from motivo_cancelacion where cvesistema = 'CANCELAMENTO_ECF') and c.ccf is not null)) "); + sql.append(" and c.ccf is not null "); + sql.append(" and r4.fiscalr4_id is not null "); + sql.append(" order by c.ccf "); + + return sql.toString(); + } + + private String getSqlImpressorasComCCFInicial(){ + StringBuilder sb = new StringBuilder(); + sb.append(" select "); + sb.append(" SERIEIMPFISCAL, "); + sb.append(" max(ccf) "); + sb.append(" from "); + sb.append(" caja "); + sb.append(" where "); + sb.append(" feccreacion <= :dataMenos2 "); + sb.append(" and SERIEIMPFISCAL in (select distinct c2.SERIEIMPFISCAL "); + sb.append(" from caja c2 where trunc(c2.FECCREACION) = :dataMenos1) "); + sb.append(" group by SERIEIMPFISCAL "); + return sb.toString(); + } + + @Override + public Map obterImpressorasComCCFInicial(Date data){ + Map impressoras = new HashMap(); + NamedParameterStatement stmt = null; + ResultSet rset = null; + try{ + final Calendar c = Calendar.getInstance(); + c.setTime(data); + c.add(Calendar.DAY_OF_MONTH, -1); + stmt = new NamedParameterStatement(con, getSqlImpressorasComCCFInicial()); + stmt.setDate("dataMenos2", new java.sql.Date(c.getTime().getTime())); + stmt.setDate("dataMenos1", new java.sql.Date(data.getTime())); + + rset = stmt.executeQuery(); + + while (rset.next()) { + impressoras.put(rset.getString(1), rset.getInt(2)); + } + } catch (Exception e){ + log.error("", e); + } finally { + if(stmt != null) { + try { stmt.close(); } catch (SQLException e) { log.error("", e); } + } + if(rset != null) { + try { rset.close(); } catch (SQLException e) { log.error("", e); } + } + } + return impressoras; + } + + public List buscaQuebraCCF(final String numserie, final Date data, final Integer ccfInicial){ + final List result = new ArrayList(); + + NamedParameterStatement stmt = null; + ResultSet rset = null; + try{ + stmt = new NamedParameterStatement(con, getSQL()); + stmt.setString("numserie", numserie); + stmt.setDate("data", new java.sql.Date(data.getTime())); + stmt.setInt("ccfInicial", ccfInicial); + + rset = stmt.executeQuery(); + + while (rset.next()) { + Integer empresaId = rset.getInt("empresa"); + Integer estadoId = rset.getInt("estado"); + Date dataMov = rset.getDate("datamov"); + FiscalImpressora fiscalImpressora = new FiscalImpressora(rset.getInt("fiscalimpressora_id")); + Empresa empresa = empresaId != null && empresaId != 0 ? new Empresa(empresaId) : null; + Estado estado = estadoId != null && estadoId != 0 ? new Estado(estadoId) : null; + PuntoVenta puntoVenta = new PuntoVenta(rset.getInt("puntoventa_id")); + Usuario usuario = new Usuario(rset.getInt("usuario_id")); + Integer ccf = rset.getInt("ccf"); + Integer ccf2 = null; + + if (rset.next()){ + ccf2 = rset.getInt("ccf"); + Date aux = dataMov; + if (ccf2 - ccf > 1){ + for (int i = ccf +1; i < ccf2; i++){ + Calendar c = Calendar.getInstance(); + c.setTime(aux); + c.add(Calendar.DATE, +1); + aux = c.getTime(); + + MonitoramentoCCF m = new MonitoramentoCCF(); + m.setDataMonitoramento(new Date()); + m.setDataOcorrencia(dataMov); + m.setDiasAlertaAberto(new Date()); + m.setImpressora(fiscalImpressora); + m.setEmpresa(empresa); + m.setEstadoInstalacao(estado); + m.setPuntoventa(puntoVenta); + m.setSequenciaCCFQuebrada(i); + m.setUsuario(usuario); + result.add(m); + } + } + } + } + } catch (Exception e){ + log.error("", e); + } finally { + if(stmt != null) { + try { stmt.close(); } catch (SQLException e) { log.error("", e); } + } + if(rset != null) { + try { rset.close(); } catch (SQLException e) { log.error("", e); } + } + } + return result; + } + + public List obtenerTodos(){ + StringBuilder hql = new StringBuilder(); + hql.append("SELECT m FROM MonitoramentoCCF m "); + hql.append("left join m.empresa "); + hql.append("ORDER BY m.empresa, m.impressora.numserie20, m.sequenciaCCFQuebrada "); + Query query = getSession().createQuery(hql.toString()); + + return query.list(); + } + + private String getMonitoramentoCCFSQL(){ + StringBuilder sql = new StringBuilder(); + + sql.append(" select count(*) "); + sql.append(" from monitoramento_ccf "); + sql.append(" where SEQUENCIA_CCF_QUEBRADA = :seq and fiscalimpressora_id = :fiscalimpressoraId "); + + return sql.toString(); + } + + @Override + public MonitoramentoCCF suscribir(final MonitoramentoCCF entity){ + jaexiste = false; + try{ + getSession().doWork(new Work() { + public void execute(Connection connection) throws SQLException + { + NamedParameterStatement stmt = null; + ResultSet rset = null; + try{ + log.debug("salvando ccf " + entity.getSequenciaCCFQuebrada() + " para impressora " + entity.getImpressora().getFiscalimpressoraId()); + stmt = new NamedParameterStatement(connection, getMonitoramentoCCFSQL()); + stmt.setInt("seq", entity.getSequenciaCCFQuebrada()); + stmt.setInt("fiscalimpressoraId", entity.getImpressora().getFiscalimpressoraId()); + rset = stmt.executeQuery(); + if (rset.next()){ + if (rset.getInt(1) > 0){ + jaexiste = true; + return; + } + } + } finally { + if(stmt != null) { + stmt.close(); + } + if(rset != null) { + rset.close(); + } + if(connection != null) { + //connection.close(); + } + } + } + }); + if (!jaexiste) { + return super.suscribir(entity); + } else { + return entity; + } + } catch (Exception e){ + log.error("", e); + return entity; + } + } + + @Override + public void setConnection(Connection con) { + this.con = con; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCRZHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCRZHibernateDAO.java new file mode 100644 index 000000000..489ea6879 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MonitoramentoCRZHibernateDAO.java @@ -0,0 +1,244 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.jdbc.Work; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MonitoramentoCRZDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCCF; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCRZ; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +@Repository("monitoramentoCRZDAO") +public class MonitoramentoCRZHibernateDAO extends GenericHibernateDAO +implements MonitoramentoCRZDAO { + private static Logger log = Logger.getLogger(MonitoramentoCRZHibernateDAO.class); + Boolean jaexiste; + + @Autowired + public MonitoramentoCRZHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + private String getSQL(){ + StringBuilder sql = new StringBuilder(); + + sql.append(" SELECT "); + sql.append(" * "); + sql.append(" FROM "); + sql.append(" (SELECT "); + sql.append(" R2.crz, "); + sql.append(" R2.numserie20 AS numserie20, "); + sql.append(" fi.numserie AS numserie, "); + sql.append(" fi.fiscalimpressora_id AS fiscalimpressora_id, "); + sql.append(" R2.datamov AS datamov, "); + sql.append(" R2.COOINICIAL AS COOINICIAL, "); + sql.append(" R2.COOFINAL AS COOFINAL, "); + sql.append(" fi.estadolocal_id AS estadolocal_id, "); + sql.append(" fi.empresa_id AS empresa_id, "); + sql.append(" R2.puntoventa_id AS puntoventa_id, "); + sql.append(" R2.USUARIO_ID AS USUARIO_ID "); + sql.append(" FROM "); + sql.append(" FISCAL_R2 R2 "); + sql.append(" inner join fiscal_impressora fi on fi.numserie20 = R2.numserie20 "); + sql.append(" WHERE R2.NUMSERIE20 = :numserie and R2.datamov != '20000000' "); + sql.append(" ORDER BY r2.crz desc) "); + sql.append(" where rownum <= 5 "); + + return sql.toString(); + } + + public List buscaImpressoras(){ + final List result = new ArrayList(); + try{ + getSession().doWork(new Work() { + public void execute(Connection connection) throws SQLException + { + NamedParameterStatement stmt = null; + ResultSet rset = null; + try{ + stmt = new NamedParameterStatement(connection, "select distinct numserie20 from fiscal_impressora where activo = 1"); + + rset = stmt.executeQuery(); + + while (rset.next()) { + result.add(rset.getString(1)); + } + } finally { + if(stmt != null) { + stmt.close(); + } + if(rset != null) { + rset.close(); + } + if(connection != null) { + //connection.close(); + } + } + } + }); + } catch (Exception e){ + log.error("", e); + } + return result; + } + + public List buscaQuebraCRZ(final Date data){ + final List result = new ArrayList(); + final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + try{ + getSession().doWork(new Work() { + public void execute(Connection connection) throws SQLException + { + NamedParameterStatement stmt = null; + ResultSet rset = null; + try{ + stmt = new NamedParameterStatement(connection, getSQL()); + for (String s : buscaImpressoras()){ + stmt.setString("numserie", s); + rset = stmt.executeQuery(); + + while (rset.next()) { + Integer empresaId = rset.getInt("empresa_id"); + Integer estadoId = rset.getInt("estadolocal_id"); + PuntoVenta puntoVenta = new PuntoVenta(rset.getInt("puntoventa_id")); + Usuario usuario = new Usuario(rset.getInt("usuario_id")); + FiscalImpressora fiscalImpressora = new FiscalImpressora(rset.getInt("fiscalimpressora_id")); + Integer crz = rset.getInt("CRZ"); + Date dataRegistro = sdf.parse(rset.getString("datamov")); + Integer crz2 = null; + + + if (rset.next()){ + crz2 = rset.getInt("CRZ"); + Date aux = dataRegistro; + if (crz - crz2 > 1){ // crz é maior que crz2 pois esta ordenado decrescente + for (int i = crz -1; i > crz2; i--){ + Calendar c = Calendar.getInstance(); + c.setTime(aux); + c.add(Calendar.DATE, -1); + aux = c.getTime(); + + MonitoramentoCRZ m = new MonitoramentoCRZ(); + m.setDataMonitoramento(new Date()); + m.setDataReducaoZFaltante(aux); + m.setDiasAlertaAberto(new Date()); + m.setEmpresa(empresaId != null && empresaId != 0 ? new Empresa(empresaId) : null); + m.setEstadoInstalacao(estadoId != null && estadoId != 0 ? new Estado(estadoId) : null); + m.setPuntoventa(puntoVenta); + m.setSequenciaCRZQuebrada(i); + m.setUltimoUsuarioECF(usuario); + m.setImpressora(fiscalImpressora); + result.add(m); + } + } + } + } + } + } catch (ParseException e) { + log.error("", e); + } finally { + if(stmt != null) { + stmt.close(); + } + if(rset != null) { + rset.close(); + } + if(connection != null) { + //connection.close(); + } + } + } + }); + } catch (Exception e){ + log.error("", e); + } + return result; + } + + private String getMonitoramentoCRZSQL(){ + StringBuilder sql = new StringBuilder(); + + sql.append(" select count(*) "); + sql.append(" from monitoramento_crz "); + sql.append(" where SEQUENCIA_CRZ_QUEBRADA = :seq and fiscalimpressora_id = :fiscalimpressoraId "); + + return sql.toString(); + } + + @Override + public MonitoramentoCRZ suscribir(final MonitoramentoCRZ entity){ + jaexiste = false; + try{ + getSession().doWork(new Work() { + public void execute(Connection connection) throws SQLException + { + NamedParameterStatement stmt = null; + ResultSet rset = null; + try{ + log.debug("salvando crz " + entity.getSequenciaCRZQuebrada() + " para impressora " + entity.getImpressora().getFiscalimpressoraId()); + stmt = new NamedParameterStatement(connection, getMonitoramentoCRZSQL()); + stmt.setInt("seq", entity.getSequenciaCRZQuebrada()); + stmt.setInt("fiscalimpressoraId", entity.getImpressora().getFiscalimpressoraId()); + rset = stmt.executeQuery(); + if (rset.next()){ + if (rset.getInt(1) > 0){ + jaexiste = true; + return; + } + } + } finally { + if(stmt != null) { + stmt.close(); + } + if(rset != null) { + rset.close(); + } + if(connection != null) { + //connection.close(); + } + } + } + }); + if (!jaexiste) { + return super.suscribir(entity); + } else { + return entity; + } + } catch (Exception e){ + log.error("", e); + return entity; + } + } + + @Override + public List obtenerTodos(){ + StringBuilder hql = new StringBuilder(); + hql.append("SELECT m FROM MonitoramentoCRZ m "); + hql.append("left join m.empresa "); + hql.append("ORDER BY m.empresa, m.impressora.numserie20, m.sequenciaCRZQuebrada "); + Query query = getSession().createQuery(hql.toString()); + + return query.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoCancelVendaPacotelHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoCancelVendaPacotelHibernateDAO.java new file mode 100644 index 000000000..3b0b2b23f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoCancelVendaPacotelHibernateDAO.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MotivoCancelVendaPacoteDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelVendaPacote; + +/** + * + * @author Bruno + */ +@Repository("motivoCancelacionVendaPacoteDAO") +public class MotivoCancelVendaPacotelHibernateDAO extends GenericHibernateDAO + implements MotivoCancelVendaPacoteDAO { + + @Autowired + public MotivoCancelVendaPacotelHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descmotivocancel")); + + return c.list(); + } + + public List buscar(String descmotivocancel, String tipomotivocancel) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descmotivocancel", descmotivocancel)); + c.add(Restrictions.eq("tipomotivocancel", tipomotivocancel)); + + return c.list(); + } + + public List obtenerTodosTipoMotivoCancel() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descmotivocancel")); + + return c.list(); + } + + public List obtenerTodosEspecificos(Integer[] motivos) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.in("motivocancelacionId", motivos)); + c.addOrder(Order.asc("descmotivocancel")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoCancelacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoCancelacionHibernateDAO.java new file mode 100644 index 000000000..8b7abcef0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoCancelacionHibernateDAO.java @@ -0,0 +1,83 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.MotivoCancelacionDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; + +/** + * + * @author Rafius + */ +@Repository("motivoCancelacionDAO") +@SuppressWarnings("unchecked") +public class MotivoCancelacionHibernateDAO extends GenericHibernateDAO + implements MotivoCancelacionDAO { + + @Autowired + public MotivoCancelacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descmotivo")); + + return c.list(); + } + + public List buscar(String descmotivo, String tipomotivo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descmotivo", descmotivo)); + c.add(Restrictions.eq("tipomotivo", tipomotivo)); + + return c.list(); + } + + public List obtenerTodosTipoMotivoB() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tipomotivo", "B")); + c.addOrder(Order.asc("descmotivo")); + + return c.list(); + } + + public List obtenerTodosEspecificos(Integer[] motivos) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.in("motivocancelacionId", motivos)); + c.addOrder(Order.asc("descmotivo")); + + return c.list(); + } + + public MotivoCancelacion findByCveSistema(String cveSistema) { + StringBuilder sb = new StringBuilder(); + sb.append(" select mc"); + sb.append(" from MotivoCancelacion mc"); + sb.append(" where mc.cveSistema = :cveSistema"); + sb.append(" and mc.activo=1"); + + Query miQry = getSession().createQuery(sb.toString()); + miQry.setString("cveSistema", cveSistema); + + return (MotivoCancelacion) miQry.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoDevolucaoBilheteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoDevolucaoBilheteHibernateDAO.java new file mode 100644 index 000000000..1387f1414 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoDevolucaoBilheteHibernateDAO.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MotivoDevolucaoBilheteDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoDevolucaoBilhete; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Bruno Neves + */ +@Repository("motivoDevolucaoBilheteDAO") +public class MotivoDevolucaoBilheteHibernateDAO extends GenericHibernateDAO + implements MotivoDevolucaoBilheteDAO { + + @Autowired + public MotivoDevolucaoBilheteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descmotivo")); + + return c.list(); + } + + public List buscar(String descmotivo, String tipomotivo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descmotivo", descmotivo)); + + + return c.list(); + } + + public List obtenerTodosTipoMotivoB() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descmotivo")); + + return c.list(); + } + + public List obtenerTodosEspecificos(Integer[] motivos) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.in("motivodevolucaobilheteId", motivos)); + c.addOrder(Order.asc("descmotivo")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoReimpresionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoReimpresionHibernateDAO.java new file mode 100644 index 000000000..b08c35878 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoReimpresionHibernateDAO.java @@ -0,0 +1,47 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MotivoReimpresionDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoReimpresion; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("motivoReimpresionDAO") +public class MotivoReimpresionHibernateDAO extends GenericHibernateDAO + implements MotivoReimpresionDAO { + + @Autowired + public MotivoReimpresionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descmotivo")); + + return c.list(); + } + + public List buscar(String descmotivo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descmotivo", descmotivo)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoViajeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoViajeHibernateDAO.java new file mode 100644 index 000000000..21fa984ca --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivoViajeHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MotivoViajeDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoViaje; + +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("motivoViajeDAO") +public class MotivoViajeHibernateDAO extends GenericHibernateDAO + implements MotivoViajeDAO { + + @Autowired + public MotivoViajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivocancelacionEquivalenciaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivocancelacionEquivalenciaHibernateDAO.java new file mode 100644 index 000000000..2f0ff8b46 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/MotivocancelacionEquivalenciaHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.MotivocancelacionEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import com.rjconsultores.ventaboletos.entidad.MotivocancelacionEquivalencia; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("motivocancelacionEquivalenciaDAO") +public class MotivocancelacionEquivalenciaHibernateDAO extends GenericHibernateDAO + implements MotivocancelacionEquivalenciaDAO { + + @Autowired + public MotivocancelacionEquivalenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(ComisionistaExterno comisionistaExterno, MotivoCancelacion motivoCancelacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("comisionistaExterno", comisionistaExterno)); + c.add(Restrictions.eq("motivoCancelacion", motivoCancelacion)); + + return c.list(); + } + + public List buscarEquivalencia(MotivocancelacionEquivalencia motivoCancelacionEquivalencia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("equivalenciaId", motivoCancelacionEquivalencia.getEquivalenciaId())); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/NodoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/NodoHibernateDAO.java new file mode 100644 index 000000000..4b356e325 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/NodoHibernateDAO.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.NodoDAO; +import com.rjconsultores.ventaboletos.entidad.Nodo; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("nodoDAO") +public class NodoHibernateDAO extends GenericHibernateDAO + implements NodoDAO { + + @Autowired + public NodoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descnodo")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/NotaCreditoVendaPacoteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/NotaCreditoVendaPacoteHibernateDAO.java new file mode 100644 index 000000000..0a9421d15 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/NotaCreditoVendaPacoteHibernateDAO.java @@ -0,0 +1,92 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.Query; +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.NotaCreditoVendaPacoteDAO; +import com.rjconsultores.ventaboletos.entidad.CajaDiversos; +import com.rjconsultores.ventaboletos.entidad.CajaDiversosPago; +import com.rjconsultores.ventaboletos.entidad.CajaTarjeta; +import com.rjconsultores.ventaboletos.entidad.NotaCreditoVendaPacote; +import com.rjconsultores.ventaboletos.enums.SituacaoVendaPacote; +import com.rjconsultores.ventaboletos.vo.reembolsoocdnotacredito.ReembolsoOcdNotaCreditoVO; + +@Repository("notaCreditoVendaPacoteDAO") +public class NotaCreditoVendaPacoteHibernateDAO extends GenericHibernateDAO + implements NotaCreditoVendaPacoteDAO { + + @Autowired + public NotaCreditoVendaPacoteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List busquedaDatosReembolsoOcdNotaCreditoRS(Date fecInicial, Date fecFinal, Date fecPagamentoInicial, Date fecPagamentoFinal, Boolean indPago) { + + Map params = new HashMap(); + StringBuilder queryString = new StringBuilder("SELECT n FROM NotaCreditoVendaPacote n "); + queryString.append("LEFT JOIN FETCH n.ocdDatosPagamentoList ") + .append("LEFT JOIN FETCH n.vendapacotecancelamento vpc ") + .append("WHERE 1=1 "); + + if (fecInicial != null) { + queryString.append("AND n.datanotacredito >= :fecInicial "); + params.put("fecInicial", fecInicial); + } + if (fecFinal != null) { + queryString.append("AND n.datanotacredito <= :fecFinal "); + params.put("fecFinal", fecFinal); + } + + if (fecPagamentoInicial != null) { + queryString.append("AND n.datapagamento >= :fecPagamentoInicial "); + params.put("fecPagamentoInicial", fecPagamentoInicial); + } + if (fecPagamentoFinal != null) { + queryString.append("AND n.datapagamento <= :fecPagamentoFinal "); + params.put("fecPagamentoFinal", fecPagamentoFinal); + } + if (indPago != null) { + if (indPago) { + queryString.append("AND n.situacao = :indPago "); + } else { + queryString.append("AND (n.situacao != :indPago OR n.situacao IS NULL) "); + } + params.put("indPago", SituacaoVendaPacote.PAGO.getShortValue()); + } + + Query query = getSession().createQuery(queryString.toString()); + for (String p : query.getNamedParameters()) { + query.setParameter(p, params.get(p)); + } + + List result = new ArrayList(); + List listNotaCredito = query.list(); + for (NotaCreditoVendaPacote notaCredito :listNotaCredito) { + List cajaTarjetaList = new ArrayList(); + List listCajaDiversos = notaCredito.getCajaDiversosList(); + for (CajaDiversos cajaDiversos : listCajaDiversos) { + List listCajaDiversosPago = cajaDiversos.getCajaDiversosPagosList(); + for (CajaDiversosPago cajaDiversosPago : listCajaDiversosPago) { + cajaTarjetaList.add(cajaDiversosPago.getCajaTarjeta()); + } + } + ReembolsoOcdNotaCreditoVO vo = ReembolsoOcdNotaCreditoVO.builder().notaCredito(notaCredito) + .datosPagamento(notaCredito.getOcdDatosPagamentoList()).cajaTarjeta(cajaTarjetaList).build(); + result.add(vo); + } + + return result; + + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/OCDHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/OCDHibernateDAO.java new file mode 100644 index 000000000..ca7689023 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/OCDHibernateDAO.java @@ -0,0 +1,78 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.Query; +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.OCDDAO; +import com.rjconsultores.ventaboletos.entidad.OCD; +import com.rjconsultores.ventaboletos.vo.reembolsoocdnotacredito.ReembolsoOcdNotaCreditoVO; + +@Repository("ocdHibernateDAO") +public class OCDHibernateDAO extends GenericHibernateDAO + implements OCDDAO { + + @Autowired + public OCDHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List busquedaDatosReembolsoOcdNotaCreditoRS(Date fecInicial, Date fecFinal, Date fecPagamentoInicial, Date fecPagamentoFinal, Boolean indPago) { + + Map params = new HashMap(); + String queryString = "SELECT o FROM OCD o " + + "LEFT JOIN FETCH o.boleto b " + + "LEFT JOIN FETCH o.ocdDatosPagamentos " + + "WHERE 1=1 "; + + if (fecInicial != null) { + queryString += "AND o.fecinc >= :fecInicial "; + params.put("fecInicial", fecInicial); + } + if (fecFinal != null) { + queryString += "AND o.fecinc <= :fecFinal "; + params.put("fecFinal", fecFinal); + } + + if (fecPagamentoInicial != null) { + queryString += "AND o.fecpagar >= :fecPagamentoInicial "; + params.put("fecPagamentoInicial", fecPagamentoInicial); + } + if (fecPagamentoFinal != null) { + queryString += "AND o.fecpagar <= :fecPagamentoFinal "; + params.put("fecPagamentoFinal", fecPagamentoFinal); + } + + if (indPago != null) { + queryString += "AND o.indpago = :indPago "; + params.put("indPago", indPago); + } + + Query query = getSession().createQuery(queryString); + for (String p : query.getNamedParameters()) { + query.setParameter(p, params.get(p)); + } + + List listOcd = query.list(); + List result = new ArrayList(); + for (OCD ocd : listOcd) { + ReembolsoOcdNotaCreditoVO vo = ReembolsoOcdNotaCreditoVO.builder().ocd(ocd) + .boleto(ocd.getBoleto()).datosPagamento(ocd.getOcdDatosPagamentos()).build(); + result.add(vo); + } + + return result; + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/OCDParamHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/OCDParamHibernateDAO.java new file mode 100644 index 000000000..f31ab0dc4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/OCDParamHibernateDAO.java @@ -0,0 +1,65 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.HibernateException; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.OCDParamDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.ControleEstoqueMigracao; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OCDParam; + +@Repository("ocdParamDAO") +public class OCDParamHibernateDAO extends GenericHibernateDAO implements OCDParamDAO { + + @Autowired + public OCDParamHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + List params = findByCriteria(Restrictions.eq("activo", Boolean.TRUE)); + return params; + } + + @Override + public OCDParam buscaOCDParamPorEmpresa(Empresa empresa) { + + Criteria c = makeCriteria(); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (OCDParam)c.uniqueResult(); + } + + @Override + public List buscaOCDParams(Empresa empresa) { + List params = findByCriteria(Restrictions.eq("empresa", empresa), Restrictions.eq("activo", Boolean.TRUE)); + return params; + } + + @Override + public OCDParam suscribirActualizar(OCDParam entidad){ + try { + if (entidad.getOcdparamId() != null){ + this.getHibernateTemplate().merge(entidad); + } else { + this.getHibernateTemplate().save(entidad); + } + return entidad; + } catch (final HibernateException ex) { + throw convertHibernateAccessException(ex); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/OCDPtoVtaParamHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/OCDPtoVtaParamHibernateDAO.java new file mode 100644 index 000000000..037855576 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/OCDPtoVtaParamHibernateDAO.java @@ -0,0 +1,51 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.OCDPtoVtaParamDAO; +import com.rjconsultores.ventaboletos.entidad.OCDPtoVtaParam; +import com.rjconsultores.ventaboletos.entidad.PtoVtaCheckin; + +/** + * @author Thiago + * + */ +@Repository("ocdPtoVtaParamDAO") +public class OCDPtoVtaParamHibernateDAO extends GenericHibernateDAO +implements OCDPtoVtaParamDAO { + + @Autowired + public OCDPtoVtaParamHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("ptoVtaCheckinId")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("ptoVtaCheckinId", id)); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/OperadorEmbarcadaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/OperadorEmbarcadaHibernateDAO.java new file mode 100644 index 000000000..803461b3c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/OperadorEmbarcadaHibernateDAO.java @@ -0,0 +1,93 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaDAO; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcada; +import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO; + +@Repository("operadorEmbarcadaDAO") +@SuppressWarnings("unchecked") +public class OperadorEmbarcadaHibernateDAO extends GenericHibernateDAO implements OperadorEmbarcadaDAO { + private static Logger log = org.slf4j.LoggerFactory.getLogger(OperadorEmbarcadaHibernateDAO.class); + + @Autowired + public OperadorEmbarcadaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarTodosOperadores() { + start = System.currentTimeMillis(); + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + List retorno = c.list(); + log.debug( printInfo("buscarOperadorEmbarcadaPorUsuario", start)); + return retorno; + } + + @Override + public OperadorEmbarcada burcarOperadorPorId(Long operadorEmbarcadaID) { + start = System.currentTimeMillis(); + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("operadorEmbarcadaId", operadorEmbarcadaID)); + + OperadorEmbarcada retorno = (OperadorEmbarcada) c.uniqueResult(); + log.debug( printInfo("burcarOperadorPorId", start)); + return retorno; + } + + @Override + public OperadorEmbarcada buscarOperadorEmbarcadaPorUsuario(Integer idUsuario) { + start = System.currentTimeMillis(); + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("usuario.usuarioId", idUsuario)); + + OperadorEmbarcada op = (OperadorEmbarcada) c.uniqueResult(); + log.debug( printInfo("buscarOperadorEmbarcadaPorUsuario", start)); + return op; + } + + @Override + public PuntoVentaVO getPuntoVentaVO(Integer operador) { + start = System.currentTimeMillis(); + StringBuilder sb = new StringBuilder(); + sb.append(" SELECT "); + sb.append(" PV.PUNTOVENTA_ID AS puntoventaId, "); + sb.append(" PV.NOMBPUNTOVENTA AS nombpuntoventa "); + sb.append(" FROM "); + sb.append(" USUARIO_UBICACION USU "); + sb.append(" INNER JOIN PUNTO_VENTA PV ON USU.PUNTOVENTA_ID = PV.PUNTOVENTA_ID "); + sb.append(" WHERE "); + sb.append(" USU.USUARIO_ID = :usuario_id "); + // sb.append(" AND PV.EMPRESA_ID = :empresa_id "); + sb.append(" AND USU.ACTIVO = 1 AND PV.ACTIVO = 1 "); + + SQLQuery sql = getSession().createSQLQuery(sb.toString()) + .addScalar("puntoventaId", IntegerType.INSTANCE) + .addScalar("nombpuntoventa", StringType.INSTANCE); + sql.setInteger("usuario_id", operador); + // sql.setInteger("empresa_id", empresa); + sql.setResultTransformer(new AliasToBeanResultTransformer(PuntoVentaVO.class)); + PuntoVentaVO puntoVentaVO = (PuntoVentaVO) sql.uniqueResult(); + + log.debug( printInfo("getPuntoVentaVO", start)); + return puntoVentaVO; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/OperadorEmbarcadaLinhaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/OperadorEmbarcadaLinhaHibernateDAO.java new file mode 100644 index 000000000..f2ac095c8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/OperadorEmbarcadaLinhaHibernateDAO.java @@ -0,0 +1,75 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaLinhaDAO; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcada; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcadaLinha; +import com.rjconsultores.ventaboletos.vo.ruta.RutaVO; + +@Repository("operadorEmbarcadaLinhaDAO") +@SuppressWarnings("unchecked") +public class OperadorEmbarcadaLinhaHibernateDAO extends GenericHibernateDAO implements OperadorEmbarcadaLinhaDAO { + + @Autowired + public OperadorEmbarcadaLinhaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarPorOperador(OperadorEmbarcada operador) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("operadorEmbarcada", operador)); + + return c.list(); + } + + @Override + public List getListaRutaVO(Integer operador) { + StringBuilder sb = new StringBuilder(); + sb.append(" SELECT "); + sb.append(" new com.rjconsultores.ventaboletos.vo.ruta.RutaVO(RT.rutaId, RT.numRuta, RT.prefixo, RT.descruta, ORC.orgaoConcedenteId, ORC.descOrgao, ORC.indValDocObligatorioEmbarcada, RT.indSentidoIda, CLA.claseservicioId, CLA.descclase, RT.indTribTarifa, RT.indTribTaxaEmbarque, RT.indTribPedagio) "); + sb.append(" FROM OperadorEmbarcadaLinha OPL "); + sb.append(" INNER JOIN OPL.ruta RT "); + sb.append(" INNER JOIN OPL.operadorEmbarcada OPE "); + sb.append(" INNER JOIN RT.claseServicio CLA "); + sb.append(" INNER JOIN RT.orgaoConcedente ORC "); + sb.append(" WHERE "); + sb.append(" OPE.usuario = :usuario_id "); + sb.append(" AND OPL.activo = 1 AND RT.activo = 1 AND OPE.activo = 1 AND CLA.activo = 1 AND ORC.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("usuario_id", operador); + + List rutas = (List) query.list(); + return rutas; + } + + @Override + public List getListaResumidaRutaVO(Integer operador) { + StringBuilder sb = new StringBuilder(); + sb.append(" SELECT "); + sb.append(" RT.rutaId "); + sb.append(" FROM OperadorEmbarcadaLinha OPL "); + sb.append(" INNER JOIN OPL.ruta RT "); + sb.append(" INNER JOIN OPL.operadorEmbarcada OPE "); + sb.append(" WHERE "); + sb.append(" OPE.usuario = :usuario_id "); + sb.append(" AND OPL.activo = 1 AND RT.activo = 1 AND OPE.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("usuario_id", operador); + + List rutas = (List) query.list(); + return rutas; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/OperadorEmbarcadaServicoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/OperadorEmbarcadaServicoHibernateDAO.java new file mode 100644 index 000000000..06273779e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/OperadorEmbarcadaServicoHibernateDAO.java @@ -0,0 +1,826 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.Predicate; +import org.apache.log4j.Logger; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.transform.ResultTransformer; +import org.hibernate.transform.Transformers; +import org.hibernate.type.BigDecimalType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.dao.CategoriaDescuentoDAO; +import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaServicoDAO; +import com.rjconsultores.ventaboletos.dao.util.DBUtil; +import com.rjconsultores.ventaboletos.entidad.AliasServico; +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcada; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcadaServico; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TarifaMinima; +import com.rjconsultores.ventaboletos.service.AliasServicoService; +import com.rjconsultores.ventaboletos.vo.corrida.CorridaVO; +import com.rjconsultores.ventaboletos.vo.corrida.TramoSequenciaVO; +import com.rjconsultores.ventaboletos.vo.parada.ParadaVO; +import com.rjconsultores.ventaboletos.vo.roloperativo.RolOperativoVO; +import com.rjconsultores.ventaboletos.vo.secuencia.SecuenciaVO; +import com.rjconsultores.ventaboletos.vo.tiposervicio.TipoServicioVO; +import com.rjconsultores.ventaboletos.vo.tramo.TramoVO; +import com.rjconsultores.ventaboletos.vo.via.ViaVO; + +@Repository("operadorEmbarcadaServicoDAO") +@SuppressWarnings({"unchecked", "rawtypes"}) +public class OperadorEmbarcadaServicoHibernateDAO extends GenericHibernateDAO implements OperadorEmbarcadaServicoDAO { + + private static Logger log = Logger.getLogger(OperadorEmbarcadaServicoHibernateDAO.class); + + @Autowired + private CategoriaDescuentoDAO categoriaDescuentoDAO; + + @Autowired + private ConstanteHibernateDAO constanteDAO; + + @Autowired + private AliasServicoService aliasServicoService; + + + @Autowired + public OperadorEmbarcadaServicoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarPorOperador(OperadorEmbarcada operador) { + StringBuilder sb = new StringBuilder(); + sb.append(" from OperadorEmbarcadaServico oes "); + sb.append(" where oes.operadorEmbarcada.operadorEmbarcadaId = :operadorEmbarcadaId "); + sb.append(" and oes.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setLong("operadorEmbarcadaId", operador.getOperadorEmbarcadaId()); + return query.list(); + } + + @Override + public List getListaCorridaVO(Integer operador, Empresa empresa, Date dtIni, Date dtFim, PuntoVenta puntoVenta) { + List corridas = getCorridas(operador, empresa, dtIni, dtFim); + + for (CorridaVO corrida : corridas) { + preencherTramosSequencias(corrida, puntoVenta, empresa); + preencherSequencias(corrida); + } + + return corridas; + } + + @Override + public List getListaResumidaCorridaVO(Integer operador, Empresa empresa, Date dtIni, Date dtFim, PuntoVenta puntoVenta, Boolean retornaTramos ) throws Exception { + return getCorridasResumido(operador, empresa, dtIni, dtFim, retornaTramos); + } + + @Override + public List getListaCorridaProxyVO(Integer operador, Empresa empresa, Date dtIni, Date dtFim) { + return getCorridas(operador, empresa, dtIni, dtFim); + } + + @Override + public void preencherCorrida(CorridaVO corrida, PuntoVenta puntoVenta, Empresa empresa) { + preencherTramosSequencias(corrida, puntoVenta, empresa); + preencherSequencias(corrida); + } + + private List getCorridas(Integer operador, Empresa empresa, Date dtIni, Date dtFim) { + StringBuilder sb = new StringBuilder(); + + sb.append("select * from (SELECT"); + sb.append(" COR.CORRIDA_ID AS CORRIDAID,"); + sb.append(" ESQ.NUMCORRIDA AS NUMCORRIDA,"); + sb.append(" '' AS DESCSERVICO,"); + sb.append(" COR.FECHORSALIDA AS FECHORSALIDA,"); + sb.append(" COR.TIPOSERVICIO_ID AS TIPOSERVICIOID,"); + sb.append(" TPS.DESCSERVICIO AS DESCSERVICIO,"); + sb.append(" ROL.ROLOPERATIVO_ID AS ROLOPERATIVOID,"); + sb.append(" ROL.DESCROLOPERATIVO AS DESCROLOPERATIVO,"); + sb.append(" COR.RUTA_ID AS RUTA_ID,"); + sb.append(" COR.ORIGEN_ID AS ORIGEMID,"); + sb.append(" ORI.DESCPARADA AS DESCORIGEM,"); + sb.append(" COR.DESTINO_ID AS DESTINOID,"); + sb.append(" DES.DESCPARADA AS DESCDESTINO,"); + sb.append(" ORIEST.CVEESTADO AS ORICVEESTADO,"); + sb.append(" DESEST.CVEESTADO AS DESCVEESTADO,"); + sb.append(" COR.CLASESERVICIO_ID AS CLASESERVICIO_ID,"); + sb.append(" COR.MARCA_ID AS MARCA_ID,"); + sb.append(" to_char(COR.FECCORRIDA, 'dd/MM/YYYY') AS FECCORRIDA,"); + sb.append(" COR.EMPRESACORRIDA_ID AS EMPRESA_ID"); + sb.append(" FROM OPERADOR_EMBARCADA OPE"); + sb.append(" JOIN OPERADOR_EMBARCADA_SERVICO OPS ON OPE.OPERADOR_EMBARCADA_ID = OPS.OPERADOR_EMBARCADA_ID"); + sb.append(" JOIN ESQUEMA_CORRIDA ESQ ON ESQ.ESQUEMACORRIDA_ID = OPS.ESQUEMA_CORRIDA_ID"); + sb.append(" JOIN CORRIDA COR ON COR.ESQUEMACORRIDA_ID = ESQ.ESQUEMACORRIDA_ID"); + sb.append(" JOIN TIPO_SERVICIO TPS ON COR.TIPOSERVICIO_ID = TPS.TIPOSERVICIO_ID"); + sb.append(" JOIN ROL_OPERATIVO ROL ON COR.ROLOPERATIVO_ID = ROL.ROLOPERATIVO_ID"); + sb.append(" JOIN PARADA ORI ON ORI.PARADA_ID = COR.ORIGEN_ID"); + sb.append(" JOIN CIUDAD ORICID ON ORICID.CIUDAD_ID = ORI.CIUDAD_ID"); + sb.append(" JOIN ESTADO ORIEST ON ORIEST.ESTADO_ID = ORICID.ESTADO_ID"); + sb.append(" JOIN PARADA DES ON DES.PARADA_ID = COR.DESTINO_ID"); + sb.append(" JOIN CIUDAD DESCID ON DESCID.CIUDAD_ID = DES.CIUDAD_ID"); + sb.append(" JOIN ESTADO DESEST ON DESEST.ESTADO_ID = DESCID.ESTADO_ID"); + sb.append(" WHERE OPE.USUARIO_ID = :usuarioId"); + sb.append(" AND COR.EMPRESACORRIDA_ID = :empresaId"); + sb.append(" AND COR.FECCORRIDA >= :dtIni"); + sb.append(" AND COR.FECCORRIDA <= :dtFim"); + sb.append(" AND OPS.ACTIVO = 1"); + sb.append(" AND OPE.ACTIVO = 1"); + sb.append(" AND ESQ.ACTIVO = 1"); + sb.append(" AND COR.ACTIVO = 1"); + sb.append(" AND TPS.ACTIVO = 1"); + sb.append(" AND ROL.ACTIVO = 1"); + sb.append(" AND ORI.ACTIVO = 1"); + sb.append(" AND DES.ACTIVO = 1"); + sb.append(" AND COR.INDSTATUSCORRIDA = 'H' "); + sb.append(" ORDER BY"); + sb.append(" COR.FECHORSALIDA,"); + sb.append(" COR.CORRIDA_ID) "); + sb.append(" UNION select * from (SELECT "); + sb.append(" COR.CORRIDA_ID AS CORRIDAID, "); + sb.append(" COR.CORRIDA_ID AS NUMCORRIDA, "); + sb.append(" '' AS DESCSERVICO, "); + sb.append(" COR.FECHORSALIDA AS FECHORSALIDA, "); + sb.append(" COR.TIPOSERVICIO_ID AS TIPOSERVICIOID, "); + sb.append(" TPS.DESCSERVICIO AS DESCSERVICIO, "); + sb.append(" ROL.ROLOPERATIVO_ID AS ROLOPERATIVOID, "); + sb.append(" ROL.DESCROLOPERATIVO AS DESCROLOPERATIVO, "); + sb.append(" COR.RUTA_ID AS RUTA_ID, "); + sb.append(" COR.ORIGEN_ID AS ORIGEMID, "); + sb.append(" ORI.DESCPARADA AS DESCORIGEM, "); + sb.append(" COR.DESTINO_ID AS DESTINOID, "); + sb.append(" DES.DESCPARADA AS DESCDESTINO, "); + sb.append(" ORIEST.CVEESTADO AS ORICVEESTADO, "); + sb.append(" DESEST.CVEESTADO AS DESCVEESTADO, "); + sb.append(" COR.CLASESERVICIO_ID AS CLASESERVICIO_ID, "); + sb.append(" COR.MARCA_ID AS MARCA_ID, "); + sb.append(" to_char(COR.FECCORRIDA, 'dd/MM/YYYY') AS FECCORRIDA, "); + sb.append(" COR.EMPRESACORRIDA_ID AS EMPRESA_ID"); + sb.append(" FROM OPERADOR_EMBARCADA OPE "); + sb.append(" JOIN OPERADOR_EMBARCADA_LINHA OPL ON OPE.OPERADOR_EMBARCADA_ID = OPL.OPERADOR_EMBARCADA_ID "); + sb.append(" left join operador_embarcada_servico ops on ops.operador_embarcada_id = ope.operador_embarcada_id AND ops.operador_embarcada_servico_id is null"); + sb.append(" JOIN CORRIDA COR ON COR.ruta_ID = OPL.ruta_ID "); + sb.append(" LEFT JOIN ESQUEMA_CORRIDA ESQ ON ESQ.ESQUEMACORRIDA_ID = COR.ESQUEMACORRIDA_ID "); + sb.append(" JOIN TIPO_SERVICIO TPS ON COR.TIPOSERVICIO_ID = TPS.TIPOSERVICIO_ID "); + sb.append(" JOIN ROL_OPERATIVO ROL ON COR.ROLOPERATIVO_ID = ROL.ROLOPERATIVO_ID "); + sb.append(" JOIN PARADA ORI ON ORI.PARADA_ID = COR.ORIGEN_ID "); + sb.append(" JOIN CIUDAD ORICID ON ORICID.CIUDAD_ID = ORI.CIUDAD_ID "); + sb.append(" JOIN ESTADO ORIEST ON ORIEST.ESTADO_ID = ORICID.ESTADO_ID "); + sb.append(" JOIN PARADA DES ON DES.PARADA_ID = COR.DESTINO_ID "); + sb.append(" JOIN CIUDAD DESCID ON DESCID.CIUDAD_ID = DES.CIUDAD_ID "); + sb.append(" JOIN ESTADO DESEST ON DESEST.ESTADO_ID = DESCID.ESTADO_ID "); + sb.append(" WHERE OPE.USUARIO_ID = :usuarioId"); + sb.append(" AND COR.EMPRESACORRIDA_ID = :empresaId"); + sb.append(" AND COR.FECCORRIDA >= :dtIni"); + sb.append(" AND COR.FECCORRIDA <= :dtFim"); + sb.append(" AND OPL.ACTIVO = 1 "); + sb.append(" AND OPE.ACTIVO = 1 "); + sb.append(" AND COR.ACTIVO = 1 "); + sb.append(" AND TPS.ACTIVO = 1 "); + sb.append(" AND ROL.ACTIVO = 1 "); + sb.append(" AND ORI.ACTIVO = 1 "); + sb.append(" AND DES.ACTIVO = 1 "); + sb.append(" AND TPS.TIPOSERVICIO_ID = 2 "); + sb.append(" AND COR.INDSTATUSCORRIDA = 'H' "); + sb.append(" ORDER BY "); + sb.append(" COR.FECHORSALIDA, "); + sb.append(" COR.CORRIDA_ID)"); + + Query query = getSession().createSQLQuery(sb.toString()).setResultTransformer(new ResultTransformer() { + private static final long serialVersionUID = -1157217114834593023L; + + private final int CORRIDAID = 0; + private final int NUMCORRIDA = 1; + private final int DESCSERVICO = 2; + private final int FECHORSALIDA = 3; + private final int TIPOSERVICIOID = 4; + private final int DESCSERVICIO = 5; + private final int ROLOPERATIVOID = 6; + private final int DESCROLOPERATIVO = 7; + private final int RUTA_ID = 8; + private final int ORIGEMID = 9; + private final int DESCORIGEM = 10; + private final int DESTINOID = 11; + private final int DESCDESTINO = 12; + private final int ORICVEESTADO = 13; + private final int DESCVEESTADO = 14; + private final int CLASESERVICIO_ID = 15; + private final int MARCA_ID = 16; + private final int FECCORRIDA = 17; + private final int EMPRESAID = 18; + + @Override + public List transformList(List list) { + return list; + } + + @Override + public Object transformTuple(Object[] tuple, String[] aliases) { + CorridaVO corrida = new CorridaVO(); + + corrida.setCorridaId(Integer.valueOf(tuple[CORRIDAID] == null ? null : tuple[CORRIDAID].toString())); + corrida.setNumCorrida(tuple[NUMCORRIDA] == null ? null : Integer.valueOf(tuple[NUMCORRIDA].toString())); + corrida.setDescServico(tuple[DESCSERVICO] == null ? null : tuple[DESCSERVICO].toString()); + corrida.setFechorsalida(tuple[FECHORSALIDA] == null ? null : tuple[FECHORSALIDA].toString()); + corrida.setTipoServicioVO(new TipoServicioVO(tuple[TIPOSERVICIOID] == null ? null : Integer.valueOf(tuple[TIPOSERVICIOID].toString()), tuple[DESCSERVICIO] == null ? null : tuple[DESCSERVICIO].toString())); + corrida.setRolOperativoVO(new RolOperativoVO(tuple[ROLOPERATIVOID] == null ? null : Integer.valueOf(tuple[ROLOPERATIVOID].toString()), tuple[DESCROLOPERATIVO] == null ? null : tuple[DESCROLOPERATIVO].toString())); + corrida.setRutaId(tuple[RUTA_ID] == null ? null : Integer.valueOf(tuple[RUTA_ID].toString())); + corrida.setOrigenId(tuple[ORIGEMID] == null ? null : Integer.valueOf(tuple[ORIGEMID].toString())); + corrida.setDescOrigen(tuple[DESCORIGEM] == null ? null : tuple[DESCORIGEM].toString()); + corrida.setDestinoId(tuple[DESTINOID] == null ? null : Integer.valueOf(tuple[DESTINOID].toString())); + corrida.setDescDestino(tuple[DESCDESTINO] == null ? null : tuple[DESCDESTINO].toString()); + corrida.setOricveestado(tuple[ORICVEESTADO] == null ? null : tuple[ORICVEESTADO].toString()); + corrida.setDescveestado(tuple[DESCVEESTADO] == null ? null : tuple[DESCVEESTADO].toString()); + corrida.setClaseServicioId(tuple[CLASESERVICIO_ID] == null ? null : Integer.valueOf(tuple[CLASESERVICIO_ID].toString())); + corrida.setMarcaId(tuple[MARCA_ID] == null ? null : Integer.valueOf(tuple[MARCA_ID].toString())); + corrida.setFeccorrida(tuple[FECCORRIDA] == null ? null : tuple[FECCORRIDA].toString()); + corrida.setEmpresaId(Integer.valueOf(tuple[EMPRESAID] == null ? null : tuple[EMPRESAID].toString())); + corrida.setLsTramoVO(new ArrayList()); + corrida.setLsSecuenciaVO(new ArrayList()); + + return corrida; + } + }); + + query.setInteger("usuarioId", operador); + query.setInteger("empresaId", empresa.getEmpresaId()); + query.setDate("dtIni", new java.sql.Date(dtIni.getTime())); + query.setDate("dtFim", new java.sql.Date(dtFim.getTime())); + + return query.list(); + } + + private List getCorridasResumido(Integer operador, Empresa empresa, Date dtIni, Date dtFim, Boolean retornaTramos) throws Exception { + StringBuilder sb = new StringBuilder(); + start = System.currentTimeMillis(); + + sb.append("select * from (SELECT"); + sb.append(" cor.corrida_id ||';'|| to_char(cor.feccorrida, 'ddMMYYYY') AS chaveCorrida, cor.ruta_id AS rutaId "); + sb.append(" FROM OPERADOR_EMBARCADA OPE "); + sb.append(" JOIN OPERADOR_EMBARCADA_SERVICO OPS ON OPE.OPERADOR_EMBARCADA_ID = OPS.OPERADOR_EMBARCADA_ID AND OPS.ACTIVO = 1 "); + sb.append(" JOIN ESQUEMA_CORRIDA ESQ ON ESQ.ESQUEMACORRIDA_ID = OPS.ESQUEMA_CORRIDA_ID AND ESQ.ACTIVO = 1 "); + sb.append(" JOIN CORRIDA COR ON COR.ESQUEMACORRIDA_ID = ESQ.ESQUEMACORRIDA_ID AND COR.ACTIVO = 1 AND COR.INDSTATUSCORRIDA = 'H' "); + sb.append(" WHERE OPE.USUARIO_ID = :usuarioId "); + sb.append(" AND COR.EMPRESACORRIDA_ID = :empresaId "); + sb.append(" AND COR.FECCORRIDA >= :dtIni "); + sb.append(" AND COR.FECCORRIDA <= :dtFim "); + sb.append(" AND OPE.ACTIVO = 1 "); + sb.append(" ORDER BY "); + sb.append(" COR.FECHORSALIDA, "); + sb.append(" COR.CORRIDA_ID) "); + sb.append(" UNION select * from (SELECT "); + sb.append(" cor.corrida_id ||';'|| to_char(cor.feccorrida, 'ddMMYYYY') AS chaveCorrida, cor.ruta_id AS rutaId "); + sb.append(" FROM OPERADOR_EMBARCADA OPE "); + sb.append(" JOIN OPERADOR_EMBARCADA_LINHA OPL ON OPE.OPERADOR_EMBARCADA_ID = OPL.OPERADOR_EMBARCADA_ID AND OPL.ACTIVO = 1 "); + sb.append(" left join operador_embarcada_servico ops on ops.operador_embarcada_id = ope.operador_embarcada_id AND ops.operador_embarcada_servico_id is null "); + sb.append(" JOIN CORRIDA COR ON COR.ruta_ID = OPL.ruta_ID AND COR.ACTIVO = 1 AND COR.INDSTATUSCORRIDA = 'H' "); + sb.append(" LEFT JOIN ESQUEMA_CORRIDA ESQ ON ESQ.ESQUEMACORRIDA_ID = COR.ESQUEMACORRIDA_ID "); + sb.append(" WHERE OPE.USUARIO_ID = :usuarioId "); + sb.append(" AND COR.EMPRESACORRIDA_ID = :empresaId "); + sb.append(" AND COR.FECCORRIDA >= :dtIni "); + sb.append(" AND COR.FECCORRIDA <= :dtFim "); + sb.append(" AND cor.tiposervicio_id = 2 "); + sb.append(" AND OPE.ACTIVO = 1 "); + sb.append(" ORDER BY "); + sb.append(" COR.FECHORSALIDA, "); + sb.append(" COR.CORRIDA_ID)"); + + Query query = getSession().createSQLQuery(sb.toString()) + .addScalar("chaveCorrida", StringType.INSTANCE) + .addScalar("rutaId", IntegerType.INSTANCE); + + query.setInteger("usuarioId", operador); + query.setInteger("empresaId", empresa.getEmpresaId()); + query.setDate("dtIni", new java.sql.Date(dtIni.getTime())); + query.setDate("dtFim", new java.sql.Date(dtFim.getTime())); + + List list = query.list(); + if( retornaTramos ) { + List corridas = new ArrayList(); + for (Object[] chave : list) { + CorridaVO co = new CorridaVO(); + co.setChaveCorrida((String)chave[0]); + co.setRutaId((Integer)chave[1] ); + + co.setListTramos( obterListaTramo((String)chave[0], (Integer)chave[1]) ); + corridas.add(co); + } + + log.debug( printInfo("getCorridasResumido", start)); + return corridas; + }else { + List corridasString = new ArrayList(); + for (Object[] chave : list) { + corridasString.add( (String)chave[0] ); + } + + log.debug( printInfo("getCorridasResumido", start)); + return corridasString; + } + } + + private List obterListaTramo( String chave, Integer rutaId ) throws Exception{ + start = System.currentTimeMillis(); + StringBuilder sb = new StringBuilder(); + + sb.append(" SELECT"); + sb.append(" TRM.TRAMO_ID "); + sb.append(" FROM RUTA_COMBINACION RC "); + sb.append(" JOIN TRAMO TRM ON TRM.TRAMO_ID = RC.TRAMO_ID AND TRM.activo = 1 "); + sb.append(" JOIN CORRIDA_TRAMO CT ON CT.CORRIDA_ID = :corridaId "); + sb.append(" AND CT.FECCORRIDA = TO_DATE(:feccorrida, 'DDmmYYYY') "); + sb.append(" AND CT.DESTINO_ID = TRM.DESTINO_ID "); + sb.append(" AND CT.activo = 1 "); + sb.append(" WHERE RC.RUTA_ID = :rutaId "); + sb.append(" AND RC.activo = 1 "); + sb.append(" ORDER BY CT.NUMSECUENCIA "); + + Query query = getSession().createSQLQuery(sb.toString()).addScalar("TRAMO_ID", IntegerType.INSTANCE); + + String[] split = chave.split(";"); + + query.setParameter("corridaId", split[0] ); + query.setParameter("feccorrida", split[1] ); + query.setParameter("rutaId", rutaId ); + + List list = query.list(); + log.debug( printInfo("obterListaTramo", start)); + return list; + + } + + private void preencherTramosSequencias(final CorridaVO corrida, PuntoVenta puntoVenta, Empresa empresa) { + boolean isTarifaMinimaHabilitado = Boolean.getBoolean(constanteDAO.buscarPorNomeConstante("isTarifaMinimaHabilitado").getValorconstante()); + CategoriaDescuento categoriaDescuento = categoriaDescuentoDAO.pesquisarPorCategoriaEmpresa(Constantes.CATEGORIA_NORMAL, corrida.getEmpresaId()); + + StringBuilder sb = new StringBuilder(); + + sb.append(" SELECT"); + sb.append(" TRM.TRAMO_ID AS tramoId, "); + sb.append(" TRM.DESCTRAMO AS desctramo, "); + sb.append(" TRM.ORIGEN_ID AS origemId,"); + sb.append(" ORI.DESCPARADA AS descOrigem,"); + sb.append(" ORICID.CIUDAD_ID AS cidadeOrigemId,"); + sb.append(" ORICID.NOMBCIUDAD AS nomeCidadeOrigem,"); + sb.append(" ORIEST.ESTADO_ID AS estadoOrigemId,"); + sb.append(" ORIEST.NOMBESTADO AS nomeEstadoOrigem,"); + sb.append(" ORIEST.CVEESTADO AS cveEstadoOrigem,"); + sb.append(" TRM.DESTINO_ID AS destinoId,"); + sb.append(" DES.DESCPARADA AS descDestino,"); + sb.append(" DESCID.CIUDAD_ID AS cidadeDestinoId,"); + sb.append(" DESCID.NOMBCIUDAD AS nomeCidadeDestino,"); + sb.append(" DESEST.ESTADO_ID AS estadoDestinoId,"); + sb.append(" DESEST.NOMBESTADO AS nomeEstadoDestino,"); + sb.append(" DESEST.CVEESTADO AS cveEstadoDestino,"); + sb.append(" TRM.VIA_ID AS viaId,"); + sb.append(" VIA.NOMBVIA AS nomeVia,"); + sb.append(" CRT.NUMSECUENCIA AS sequencia,"); + sb.append(" TA.IMPORTETAXAEMBARQUE AS importeTaxaEmbarque,"); + sb.append(" TA.IMPORTEPEDAGIO AS importePedagio,"); + sb.append(" TA.IMPORTEOUTROS AS importeOutros,"); + sb.append(" TA.IMPORTESEGURO AS importeSeguro,"); + sb.append(" TA.PRECIO AS precio,"); + sb.append(" TA.RUTA_ID as rutaId, "); + + /* + * Não aplica tarifa minina quando configurado no tipo de passagem ou quando nao tem a constante + * Mantis #10704 & #20931 + */ + if(isTarifaMinimaHabilitado && categoriaDescuento !=null && !categoriaDescuento.getIndnaoaplicatarifaminima()) { + sb.append(" ("); + sb.append(" select IMPORTETARIFA"); + sb.append(" from ("); + sb.append(" select"); + sb.append(" tmx.TARIFAMINIMA_ID as TARIFAMINIMA_ID,"); + sb.append(" tmx.ACTIVO as ACTIVO,"); + sb.append(" tmx.CLASESERVICIO_ID as CLASESERVICIO_ID,"); + sb.append(" tmx.COEFICIENTETARIFA_ID as COEFICIENTETARIFA_ID,"); + sb.append(" tmx.DESTINO_ID as DESTINO_ID,"); + sb.append(" tmx.FECMODIF as FECMODIF,"); + sb.append(" tmx.IMPORTETARIFA as IMPORTETARIFA,"); + sb.append(" tmx.MARCA_ID as MARCA_ID,"); + sb.append(" tmx.MONEDA_ID as MONEDA_ID,"); + sb.append(" tmx.ORGAOCONCEDENTE_ID as ORGAOCONCEDENTE_ID,"); + sb.append(" tmx.ORIGEN_ID as ORIGEN_ID,"); + sb.append(" tmx.PLAZA_ID as PLAZA_ID,"); + sb.append(" tmx.REGIONMETROPOLITANA_ID as REGIONMETROPOLITANA_ID,"); + sb.append(" tmx.RUTA_ID as RUTA_ID,"); + sb.append(" tmx.USUARIO_ID as USUARIO_ID,"); + sb.append(" tmx.VIGENCIATARIFA_ID as VIGENCIATARIFA_ID,"); + sb.append(" ocx.ORGAOCONCEDENTE_ID as orgaoConcedenteId,"); + sb.append(" paradaOrigem.PARADA_ID as paradaOrigemId,"); + sb.append(" paradaDestino.PARADA_ID as paradaDestinoId,"); + sb.append(" ruta.ruta_id as rutaId"); + sb.append(" from TARIFA_MINIMA tmx"); + sb.append(" join marca m on m.marca_id = tmx.marca_id "); + sb.append(" join empresa e on e.empresa_id = m.empresa_id "); + sb.append(" join PARADA paradaOrigem on paradaOrigem.activo = 1"); + sb.append(" join PARADA paradaDestino on paradaDestino.activo = 1"); + sb.append(" join RUTA ruta on ruta.activo = 1"); + sb.append(" left outer join ORGAO_CONCEDENTE ocx on tmx.ORGAOCONCEDENTE_ID=ocx.ORGAOCONCEDENTE_ID "); + sb.append(" left outer join TARIFA_MINIMA_CATEGORIA tmcx on tmx.TARIFAMINIMA_ID=tmcx.TARIFAMINIMA_ID and tmcx.ACTIVO = 1 "); + sb.append(" left outer join VIGENCIA_TARIFA vtx on tmx.VIGENCIATARIFA_ID=vtx.VIGENCIATARIFA_ID "); + sb.append(" left outer join REGION_METROPOLITANA rmx on tmx.REGIONMETROPOLITANA_ID=rmx.REGIONMETROPOLITANA_ID "); + sb.append(" left outer join PARADA prmox on rmx.REGIONMETROPOLITANA_ID=prmox.REGIONMETROPOLITANA_ID "); + sb.append(" left outer join PARADA prmdx on rmx.REGIONMETROPOLITANA_ID=prmdx.REGIONMETROPOLITANA_ID "); + sb.append(" where tmx.ACTIVO=1 "); + sb.append(" and (prmox.PARADA_ID in (paradaOrigem.PARADA_ID, -1) or prmox.PARADA_ID is null) "); + sb.append(" and (prmdx.PARADA_ID in (paradaDestino.PARADA_ID, -1) or prmdx.PARADA_ID is null) "); + sb.append(" and (tmx.ORIGEN_ID in (paradaOrigem.PARADA_ID, -1) or tmx.ORIGEN_ID is null) "); + sb.append(" and (tmx.DESTINO_ID in (paradaDestino.PARADA_ID, -1) or tmx.DESTINO_ID is null) "); + sb.append(" and (tmx.PLAZA_ID in (:plazaId, -1)) "); + sb.append(" and (tmx.CLASESERVICIO_ID in (:claseservicioId, -1)) "); + sb.append(" and (e.EMPRESA_ID in (:empresaId, -1)) "); + sb.append(" and (tmcx.TARIFAMINIMACATEGORIA_ID is null or tmcx.CATEGORIA_ID in (:categoriaId, -1)) "); + sb.append(" and tmx.MONEDA_ID=:moneda"); + sb.append(" and (ocx.ORGAOCONCEDENTE_ID is null or ocx.ORGAOCONCEDENTE_ID=-1 or ocx.ORGAOCONCEDENTE_ID=("); + sb.append(" select distinct rx.ORGAOCONCEDENTE_ID"); + sb.append(" from RUTA rx "); + sb.append(" left outer join RUTA_COMBINACION rcx on rx.RUTA_ID=rcx.RUTA_ID "); + sb.append(" left outer join TRAMO tx on rcx.TRAMO_ID=tx.TRAMO_ID "); + sb.append(" left outer join ORGAO_TRAMO otx on tx.TRAMO_ID=otx.TRAMO_ID "); + sb.append(" where"); + sb.append(" rcx.RUTA_ID=ruta.RUTA_ID"); + sb.append(" and ("); + sb.append(" (tmx.COEFICIENTETARIFA_ID in (otx.COEFICIENTETARIFA1_ID,otx.COEFICIENTETARIFA2_ID,otx.COEFICIENTETARIFA3_ID))"); + sb.append(" and tx.ORIGEN_ID=paradaOrigem.parada_id "); + sb.append(" and tx.DESTINO_ID=paradaDestino.parada_id"); + sb.append(" or tmx.COEFICIENTETARIFA_ID is null"); + sb.append(" )"); + sb.append(" )"); + sb.append(" )"); + sb.append(" and (SYSDATE between vtx.FECINICIOVIGENCIA and vtx.FECFINVIGENCIA)"); + sb.append(" order by"); + sb.append(" tmx.PLAZA_ID desc,"); + sb.append(" tmx.ORIGEN_ID desc,"); + sb.append(" tmx.DESTINO_ID desc,"); + sb.append(" tmx.CLASESERVICIO_ID desc,"); + sb.append(" tmx.MARCA_ID desc"); + sb.append(" )"); + sb.append(" where"); + sb.append(" paradaOrigemId = TRM.ORIGEN_ID"); + sb.append(" and paradaDestinoId = TRM.DESTINO_ID"); + sb.append(" and rutaId = TA.RUTA_ID"); + sb.append(" and rownum = 1"); + sb.append(" ) as tarifaMinima "); + }else { + sb.append(" 0 as tarifaMinima "); + } + + sb.append(" FROM RUTA_COMBINACION RC"); + sb.append(" JOIN TRAMO TRM ON TRM.TRAMO_ID = RC.TRAMO_ID"); + sb.append(" JOIN CORRIDA_TRAMO CRT ON CRT.DESTINO_ID = TRM.DESTINO_ID AND CRT.CORRIDA_ID = :corridaId AND CRT.FECCORRIDA = TO_DATE(:feccorrida,'DD/MM/YYYY HH24:MI:SS')"); + sb.append(" JOIN PARADA ORI ON ORI.PARADA_ID = TRM.ORIGEN_ID"); + sb.append(" JOIN CIUDAD ORICID ON ORICID.CIUDAD_ID = ORI.CIUDAD_ID"); + sb.append(" JOIN ESTADO ORIEST ON ORIEST.ESTADO_ID = ORICID.ESTADO_ID"); + sb.append(" JOIN PARADA DES ON DES.PARADA_ID = TRM.DESTINO_ID"); + sb.append(" JOIN CIUDAD DESCID ON DESCID.CIUDAD_ID = DES.CIUDAD_ID"); + sb.append(" JOIN ESTADO DESEST ON DESEST.ESTADO_ID = DESCID.ESTADO_ID"); + sb.append(" JOIN VIA VIA ON VIA.VIA_ID = TRM.VIA_ID"); + sb.append(" JOIN empresa emp ON emp.empresa_id = :empresaId "); + sb.append(" JOIN marca mar on mar.empresa_id = emp.empresa_id "); + if (empresa.getIndTabelaPrecoEmbarcada() != null && empresa.getIndTabelaPrecoEmbarcada()) { + sb.append(" JOIN TARIFA_EMBARCADA TA ON TA.MARCA_ID = mar.marca_Id AND TA.TRAMO_ID = TRM.TRAMO_ID AND TA.RUTA_ID = RC.RUTA_ID"); + } else { + sb.append(" JOIN TARIFA TA ON TA.MARCA_ID = mar.marca_Id AND TA.TRAMO_ID = TRM.TRAMO_ID AND TA.RUTA_ID = RC.RUTA_ID"); + } + sb.append(" JOIN VIGENCIA_TARIFA VT ON VT.VIGENCIATARIFA_ID = TA.VIGENCIATARIFA_ID"); + sb.append(" WHERE "); + sb.append(" RC.ACTIVO = 1"); + sb.append(" AND TRM.ACTIVO = 1"); + sb.append(" AND CRT.ACTIVO = 1"); + sb.append(" AND VIA.ACTIVO = 1"); + sb.append(" AND TA.ACTIVO = 1"); + sb.append(" AND VT.ACTIVO = 1"); + sb.append(" AND mar.ACTIVO = 1"); + sb.append(" AND coalesce(RC.INDVENTA,0) = 1"); + sb.append(" AND RC.RUTA_ID = :rutaId "); + sb.append(" AND TRM.ORIGEN_ID IN (SELECT X.ORIGEN_ID FROM CORRIDA_TRAMO X WHERE X.CORRIDA_ID = :corridaId AND X.FECCORRIDA = TO_DATE(:feccorrida,'DD/MM/YYYY HH24:MI:SS'))"); + sb.append(" AND TRM.DESTINO_ID IN (SELECT X.DESTINO_ID FROM CORRIDA_TRAMO X WHERE X.CORRIDA_ID = :corridaId AND X.FECCORRIDA = TO_DATE(:feccorrida,'DD/MM/YYYY HH24:MI:SS'))"); + sb.append(" AND (SYSDATE BETWEEN VT.FECINICIOVIGENCIA AND VT.FECFINVIGENCIA AND VT.ACTIVO = 1)"); + + Query query = getSession().createSQLQuery(sb.toString()) + .addScalar("tramoId", IntegerType.INSTANCE) + .addScalar("desctramo", StringType.INSTANCE) + .addScalar("origemId", IntegerType.INSTANCE) + .addScalar("descOrigem", StringType.INSTANCE) + .addScalar("cidadeOrigemId", IntegerType.INSTANCE) + .addScalar("nomeCidadeOrigem", StringType.INSTANCE) + .addScalar("estadoOrigemId", IntegerType.INSTANCE) + .addScalar("nomeEstadoOrigem", StringType.INSTANCE) + .addScalar("cveEstadoOrigem", StringType.INSTANCE) + .addScalar("destinoId", IntegerType.INSTANCE) + .addScalar("descDestino", StringType.INSTANCE) + .addScalar("cidadeDestinoId", IntegerType.INSTANCE) + .addScalar("nomeCidadeDestino", StringType.INSTANCE) + .addScalar("estadoDestinoId", IntegerType.INSTANCE) + .addScalar("nomeEstadoDestino", StringType.INSTANCE) + .addScalar("cveEstadoDestino", StringType.INSTANCE) + .addScalar("viaId", IntegerType.INSTANCE) + .addScalar("nomeVia", StringType.INSTANCE) + .addScalar("sequencia", IntegerType.INSTANCE) + .addScalar("importeTaxaEmbarque", BigDecimalType.INSTANCE) + .addScalar("importePedagio", BigDecimalType.INSTANCE) + .addScalar("importeOutros", BigDecimalType.INSTANCE) + .addScalar("importeSeguro", BigDecimalType.INSTANCE) + .addScalar("precio", BigDecimalType.INSTANCE) + .addScalar("tarifaMinima", BigDecimalType.INSTANCE) + .setResultTransformer(Transformers.aliasToBean(TramoSequenciaVO.class)); + + query.setParameter("empresaId", corrida.getEmpresaId()); + query.setParameter("rutaId", corrida.getRutaId()); + query.setParameter("corridaId", corrida.getCorridaId()); + query.setParameter("feccorrida", corrida.getFeccorrida() + " 00:00:00"); + + if(isTarifaMinimaHabilitado && categoriaDescuento !=null && !categoriaDescuento.getIndnaoaplicatarifaminima()) { + query.setParameter("plazaId", puntoVenta.getColonia().getCiudad().getPlaza().getPlazaId()); + query.setParameter("claseservicioId", corrida.getClaseServicioId()); + query.setParameter("categoriaId", Constantes.CATEGORIA_NORMAL); + query.setParameter("moneda", puntoVenta.getMoneda().getMonedaId()); + } + + List tramosequencia = query.list(); + + HashSet setTramo = new HashSet(); + + List aliasLs = aliasServicoService.buscarPorRuta(corrida.getRutaId()); + + for (TramoSequenciaVO ts : tramosequencia) { + final ParadaVO origem = new ParadaVO( + ts.getOrigemId(), + ts.getDescOrigem(), + ts.getCidadeOrigemId(), + ts.getNomeCidadeOrigem(), + ts.getEstadoOrigemId(), + ts.getNomeEstadoOrigem(), + ts.getCveEstadoOrigem()); + + final ParadaVO destino = new ParadaVO( + ts.getDestinoId(), + ts.getDescDestino(), + ts.getCidadeDestinoId(), + ts.getNomeCidadeDestino(), + ts.getEstadoDestinoId(), + ts.getNomeEstadoDestino(), + ts.getCveEstadoDestino()); + + ViaVO via = new ViaVO( + ts.getViaId(), + ts.getNomeVia()); + + BigDecimal tarifaMinima = ts.getTarifaMinima(); + + TramoVO tramo = new TramoVO( + ts.getTramoId(), + ts.getDesctramo(), + origem, + destino, + via, + ts.getSequencia(), + ts.getPrecio().compareTo(tarifaMinima) < 0 ? tarifaMinima : ts.getPrecio(), + ts.getImporteTaxaEmbarque()!=null?ts.getImporteTaxaEmbarque():BigDecimal.ZERO, + ts.getImporteSeguro()!=null?ts.getImporteSeguro():BigDecimal.ZERO, + ts.getImportePedagio()!=null?ts.getImportePedagio():BigDecimal.ZERO, + ts.getImporteOutros()!=null?ts.getImporteOutros():BigDecimal.ZERO); + + AliasServico aC = null; + try { + aC = (AliasServico) CollectionUtils.find(aliasLs, new Predicate() { + + @Override + public boolean evaluate(Object arg0) { + AliasServico alias = (AliasServico)arg0; + + return alias.getCorridaId() != null && alias.getCorridaId().equals(corrida.getCorridaId()) + && alias.getOrigen().getParadaId().equals(origem.getParadaId()) + && alias.getDestino().getParadaId().equals(destino.getParadaId()); + } + }); + + if(aC == null) { + aC = (AliasServico) CollectionUtils.find(aliasLs, new Predicate() { + + @Override + public boolean evaluate(Object arg0) { + AliasServico alias = (AliasServico)arg0; + + return alias.getOrigen().getParadaId().equals(origem.getParadaId()) + && alias.getDestino().getParadaId().equals(destino.getParadaId()) + && alias.getCorridaId() == null; + } + }); + } + }catch(Throwable th) { + log.error("erro ao carrgar o alias",th); + } + + if (aC != null) { + tramo.setAliasdestinoId(aC.getAliasDestino().getParadaId()); + tramo.setAliasorigenId(aC.getAliasOrigen().getParadaId()); + tramo.setDescAliasdestino(aC.getAliasDestino().getDescparada()); + tramo.setDescAliasorigen(aC.getAliasOrigen().getDescparada()); + } + setTramo.add(tramo); + } + + List lsTramo = new ArrayList(setTramo); + corrida.setLsTramoVO(lsTramo); + } + + public BigDecimal obtenerTarifaMinima(Integer claseServicioId, Integer marcaId, Integer origenConsultaId, + Integer destinoConsultaId, PuntoVenta miPuntoVenta, Integer rutaId, Integer categoriaId, Boolean indnaoaplicatarifaminima) { + BigDecimal tarifaMinima = BigDecimal.ZERO; + + /* + * Não aplica tarifa minina quando configurado no tipo de passagem + * Mantis #10704 + */ + if(indnaoaplicatarifaminima != null && indnaoaplicatarifaminima) { + return tarifaMinima; + } + + //PuntoVenta miPuntoVenta = PuntoVentaDao.getInstance().findById(puntoVentaId); + + StringBuilder hql = new StringBuilder("select tm from TarifaMinima tm ") + .append("left join tm.orgaoConcedente oc ") + .append("left join tm.tarifaMinimaCategorias tmc ") + .append("left join tm.vigenciaTarifa vige ") + .append("left join tm.regionMetropolitana.paradaList ori ") + .append("left join tm.regionMetropolitana.paradaList des ") + .append("where tm.activo = 1 ").append("and tm.plaza.plazaId in (:plazaId, -1) ") + .append("and tm.claseServicio.claseservicioId in (:claseServId, -1) ") + .append("and tm.marca.marcaId in (:marcaId, -1) ") + .append("and (ori.paradaId in (:origenId, -1) or ori.paradaId is null ) ") + .append("and (des.paradaId in (:destinoId,-1) or des.paradaId is null ) ") + .append("and (tm.origem.paradaId in (:origenId, -1) or tm.origem.paradaId is null) ") + .append("and (tm.destino.paradaId in (:destinoId, -1) or tm.destino.paradaId is null) "); + + if (categoriaId != null) { + hql.append("and (tmc is null or tmc.categoria.categoriaId in (:categoriaId, -1)) "); + } + + hql.append("and tm.moneda.monedaId = :monedaId ") + .append("and (oc is null or oc.orgaoConcedenteId = -1 or oc.orgaoConcedenteId = ") + .append("(select distinct r.orgaoConcedente.orgaoConcedenteId from Ruta r") + .append(" left join r.rutaCombinacionList rc") + .append(" left join rc.tramo tr") + .append(" left join tr.lsOrgaoTramo ot") + .append(" where rc.ruta.rutaId = :rutaId") + .append(" and (tm.coeficienteTarifa.coeficienteId in ") + .append(" (ot.coeficienteTarifa1.coeficienteId, ot.coeficienteTarifa2.coeficienteId, ot.coeficienteTarifa3.coeficienteId ) ") + .append(" and tr.origem.paradaId = :origenId ") + .append(" and tr.destino.paradaId = :destinoId ") + .append(" or tm.coeficienteTarifa is null ) )) ") + .append(" and " + DBUtil.getInstance().dbSysdate() + " between vige.feciniciovigencia and vige.fecfinvigencia ") + + .append("order by tm.plaza.plazaId desc, tm.origem.paradaId desc, ") + .append("tm.destino.paradaId desc, tm.claseServicio.claseservicioId desc, ") + .append("tm.marca.marcaId desc"); + + Query miQry = getSession().createQuery(hql.toString()); + miQry.setInteger("plazaId", miPuntoVenta.getColonia().getCiudad().getPlaza().getPlazaId()); + miQry.setInteger("claseServId", claseServicioId); + miQry.setInteger("marcaId", marcaId); + miQry.setInteger("origenId", origenConsultaId); + miQry.setInteger("destinoId", destinoConsultaId); + miQry.setInteger("monedaId", miPuntoVenta.getMoneda().getMonedaId()); + miQry.setInteger("rutaId", rutaId); + + if (categoriaId != null) { + miQry.setInteger("categoriaId", categoriaId); + } + + List listTarifaMinima = miQry.list(); + if (!listTarifaMinima.isEmpty()) { + tarifaMinima = listTarifaMinima.get(0).getImportetarifa(); + } + + return tarifaMinima; + } + + private void preencherSequencias(CorridaVO corrida) { + final int NUMSECUENCIA = 0; + final int ORIGEN_ID = 1; + final int ORIGENCVEPARADA = 2; + final int ORIGENDESCPARADA = 3; + final int ORIGENCIUDAD_ID = 4; + final int ORIGENNOMBCIUDAD = 5; + final int ORIGENESTADO_ID = 6; + final int ORIGENNOMBESTADO = 7; + final int ORIGENCVEESTADO = 8; + final int DESTINO_ID = 9; + final int DESTINOCVEPARADA = 10; + final int DESTINODESCPARADA = 11; + final int DESTINOCIUDAD_ID = 12; + final int DESTINONOMBCIUDAD = 13; + final int DESTINOESTADO_ID = 14; + final int DESTINONOMBESTADO = 15; + final int DESTINOCVEESTADO = 16; + + StringBuilder sb = new StringBuilder(); + + sb.append(" SELECT"); + sb.append(" CT.NUMSECUENCIA,"); + sb.append(" CT.ORIGEN_ID , PO.CVEPARADA as PO_CVEPARADA, PO.DESCPARADA as PO_DESCPARADA, CO.CIUDAD_ID as CO_CIUDAD_ID, CO.NOMBCIUDAD as CO_NOMBCIUDAD, EO.ESTADO_ID as EO_ESTADO_ID, EO.NOMBESTADO as EO_NOMBESTADO, EO.CVEESTADO as EO_CVEESTADO,"); + sb.append(" CT.DESTINO_ID, PD.CVEPARADA as PD_CVEPARADA, PD.DESCPARADA as PD_DESCPARADA, CD.CIUDAD_ID as CD_CIUDAD_ID, CD.NOMBCIUDAD as CD_NOMBCIUDAD, ED.ESTADO_ID as ED_ESTADO_ID, ED.NOMBESTADO as ED_NOMBESTADO, ED.CVEESTADO as ED_CVEESTADO"); + sb.append(" FROM CORRIDA C"); + sb.append(" JOIN CORRIDA_TRAMO CT ON CT.CORRIDA_ID = C.CORRIDA_ID AND CT.FECCORRIDA = C.FECCORRIDA"); + sb.append(" JOIN PARADA PO ON PO.PARADA_ID = CT.ORIGEN_ID"); + sb.append(" JOIN CIUDAD CO ON CO.CIUDAD_ID = PO.CIUDAD_ID"); + sb.append(" JOIN ESTADO EO ON EO.ESTADO_ID = CO.ESTADO_ID"); + sb.append(" JOIN PARADA PD ON PD.PARADA_ID = CT.DESTINO_ID"); + sb.append(" JOIN CIUDAD CD ON CD.CIUDAD_ID = PD.CIUDAD_ID"); + sb.append(" JOIN ESTADO ED ON ED.ESTADO_ID = CD.ESTADO_ID"); + sb.append(" WHERE C.CORRIDA_ID = :corridaId AND C.FECCORRIDA = TO_DATE(:feccorrida,'DD/MM/YYYY HH24:MI:SS') and CT.activo = 1 "); + sb.append(" ORDER BY CT.NUMSECUENCIA"); + + Query query = getSession().createSQLQuery(sb.toString()); + + query.setParameter("corridaId", corrida.getCorridaId()); + query.setParameter("feccorrida", corrida.getFeccorrida() + " 00:00:00"); + + List lsSecuenciaVO = new ArrayList(); + List controle = new ArrayList(0); + + List list = query.list(); + + for (Object[] item : list) { + final Integer origensecuencia = Integer.valueOf(item[NUMSECUENCIA].toString()); + final Integer origen_id = Integer.valueOf(item[ORIGEN_ID].toString()); + item[ORIGENCVEPARADA].toString(); + final String origendescparada = item[ORIGENDESCPARADA].toString(); + final Integer origenciudad_id = Integer.valueOf(item[ORIGENCIUDAD_ID].toString()); + final String origennombciudad = item[ORIGENNOMBCIUDAD].toString(); + final Integer origenestado_id = Integer.valueOf(item[ORIGENESTADO_ID].toString()); + final String origennombestado = item[ORIGENNOMBESTADO].toString(); + final String origencveestado = item[ORIGENCVEESTADO].toString(); + + final Integer destinosecuencia = Integer.valueOf(item[NUMSECUENCIA].toString()) + 1; + final Integer destino_id = Integer.valueOf(item[DESTINO_ID].toString()); + item[DESTINOCVEPARADA].toString(); + final String destinodescparada = item[DESTINODESCPARADA].toString(); + final Integer destinociudad_id = Integer.valueOf(item[DESTINOCIUDAD_ID].toString()); + final String destinonombciudad = item[DESTINONOMBCIUDAD].toString(); + final Integer destinoestado_id = Integer.valueOf(item[DESTINOESTADO_ID].toString()); + final String destinonombestado = item[DESTINONOMBESTADO].toString(); + final String destinocveestado = item[DESTINOCVEESTADO].toString(); + + adicionarSequencia( + controle, + lsSecuenciaVO, + origensecuencia, + origen_id, + origendescparada, + origenciudad_id, + origennombciudad, + origenestado_id, + origennombestado, + origencveestado); + + adicionarSequencia( + controle, + lsSecuenciaVO, + destinosecuencia, + destino_id, + destinodescparada, + destinociudad_id, + destinonombciudad, + destinoestado_id, + destinonombestado, + destinocveestado); + } + + corrida.setLsSecuenciaVO(lsSecuenciaVO); + } + + private void adicionarSequencia(List controle, List lsSecuenciaVO, final Integer numsecuencia, final Integer paradaId, final String descParada, final Integer ciudadId, final String nombCiudad, final Integer estadoId, final String nombEstado, final String cveEstado) { + final String key = numsecuencia.toString() + "|" + paradaId.toString(); + + if (!controle.contains(key)) { + SecuenciaVO sequencia = new SecuenciaVO( + numsecuencia, + new ParadaVO(paradaId, descParada, ciudadId, nombCiudad, estadoId, nombEstado, cveEstado)); + + lsSecuenciaVO.add(sequencia); + + controle.add(key); + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoCancelacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoCancelacionHibernateDAO.java new file mode 100644 index 000000000..e3d17ff8c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoCancelacionHibernateDAO.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.OrgaoCancelacionDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoCancelacion; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +@Repository("orgaoCancelacionDAO") +public class OrgaoCancelacionHibernateDAO extends GenericHibernateDAO implements OrgaoCancelacionDAO { + + @Autowired + public OrgaoCancelacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descOrgao")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodosIds() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.property("orgaoCancelacionId")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscarPorOrgao(OrgaoConcedente orgaoConcedente) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.like("orgao", orgaoConcedente)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoConcedenteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoConcedenteHibernateDAO.java new file mode 100644 index 000000000..dfd2a2c35 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoConcedenteHibernateDAO.java @@ -0,0 +1,70 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.OrgaoConcedenteDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +@SuppressWarnings("unchecked") +@Repository("orgaoConcedenteDAO") +public class OrgaoConcedenteHibernateDAO extends GenericHibernateDAO implements OrgaoConcedenteDAO { + + @Autowired + public OrgaoConcedenteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descOrgao")); + + return c.list(); + } + + public List obtenerTodosExceto(Integer... id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descOrgao")); + c.add(Restrictions.not(Restrictions.in("orgaoConcedenteId", id))); + + return c.list(); + } + + @Override + public List obtenerTodosIds() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.property("orgaoConcedenteId")); + + return c.list(); + } + + @Override + public List buscar(String desc) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.like("descOrgao", desc)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscarListaPorIds(List orgaoConcedenteIds) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.in("orgaoConcedenteId", orgaoConcedenteIds)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoEmpParamHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoEmpParamHibernateDAO.java new file mode 100644 index 000000000..0f86c792c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoEmpParamHibernateDAO.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.OrgaoEmpParamDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoEmpParam; + +@Repository("orgaoEmpParamDAO") +public class OrgaoEmpParamHibernateDAO extends GenericHibernateDAO implements OrgaoEmpParamDAO { + + @Autowired + public OrgaoEmpParamHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obterPorOrgao(Integer orgaoConcedenteId) { + Criteria criteria = createCriteria(); + criteria.add(Restrictions.eq("orgaoConcedente.orgaoConcedenteId", orgaoConcedenteId)); + + return criteria.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List obterPorEmpresa(Integer empresaId) { + Criteria criteria = createCriteria(); + criteria.add(Restrictions.eq("empresa.empresaId", empresaId)); + + return criteria.list(); + } + + @Override + public OrgaoEmpParam obterPorOrgaoEmpresa(Integer orgaoConcedenteId, Integer empresaId) { + Criteria criteria = createCriteria(); + criteria.add(Restrictions.eq("orgaoConcedente.orgaoConcedenteId", orgaoConcedenteId)); + criteria.add(Restrictions.eq("empresa.empresaId", empresaId)); + + return (OrgaoEmpParam) criteria.uniqueResult(); + } + + private Criteria createCriteria() { + Criteria criteria = getSession().createCriteria(getPersistentClass()); + criteria.add(Restrictions.eq("activo", Boolean.TRUE)); + return criteria; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoTramoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoTramoHibernateDAO.java new file mode 100644 index 000000000..93e22e0d2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/OrgaoTramoHibernateDAO.java @@ -0,0 +1,53 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.FetchMode; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.OrgaoTramoDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoTramo; + +@Repository("orgaoTramoDAO") +public class OrgaoTramoHibernateDAO extends GenericHibernateDAO implements OrgaoTramoDAO { + + @Autowired + public OrgaoTramoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public OrgaoTramo buscar(Integer origenId, Integer destinoId, Integer viaId, Integer orgaoConcedenteId, Integer claseServicioId) { + Criteria c = makeCriteria(); + Criteria cTramo = c.createCriteria("tramo"); + cTramo.add(Restrictions.eq("origem.paradaId", origenId)); + cTramo.add(Restrictions.eq("destino.paradaId", destinoId)); + cTramo.add(Restrictions.eq("via.viaId", viaId)); + cTramo.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("orgaoConcedente.orgaoConcedenteId", orgaoConcedenteId)); + c.add(Restrictions.eq("claseServicio.claseservicioId", claseServicioId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.setFetchMode("tramo", FetchMode.SELECT); + + List list = c.list(); + + if (list.size() > 1) { + throw new RuntimeException("Erro ao consultar os dados do coeficiente por trecho. Retornou mais de um resultado"); + } + + if (!list.isEmpty()) { + return list.get(0); + } + + return null; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteConvenioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteConvenioHibernateDAO.java new file mode 100644 index 000000000..b552055e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteConvenioHibernateDAO.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PacoteConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.PacoteConvenio; + +@Repository("pacoteConvenioDAO") +public class PacoteConvenioHibernateDAO extends GenericHibernateDAO implements PacoteConvenioDAO { + + @Autowired + public PacoteConvenioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @SuppressWarnings("unchecked") + public List buscar(String nomconvenio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("nomconvenio", nomconvenio)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteDescontoBilheteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteDescontoBilheteHibernateDAO.java new file mode 100644 index 000000000..dcb16711a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteDescontoBilheteHibernateDAO.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PacoteDescontoBilheteDAO; +import com.rjconsultores.ventaboletos.entidad.PacoteDescontoBilhete; + +@Repository("pacoteDescontoBilheteDAO") +public class PacoteDescontoBilheteHibernateDAO extends GenericHibernateDAO implements PacoteDescontoBilheteDAO { + + private static Logger log = LoggerFactory.getLogger(PacoteDescontoBilheteHibernateDAO.class); + + @Autowired + public PacoteDescontoBilheteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos(Integer pacoteId) { + StringBuilder sb = new StringBuilder(); + sb.append(" from PacoteDescontoBilhete pdb "); + sb.append(" where pdb.pacote.pacoteId = :pacoteId "); + sb.append(" and pdb.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacoteId); + + return query.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteHibernateDAO.java new file mode 100644 index 000000000..ffc59f8d6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteHibernateDAO.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PacoteDAO; +import com.rjconsultores.ventaboletos.entidad.Pacote; + +@Repository("pacoteDAO") +public class PacoteHibernateDAO extends GenericHibernateDAO implements PacoteDAO { + + private static Logger log = org.slf4j.LoggerFactory.getLogger(PacoteHibernateDAO.class); + + @Autowired + public PacoteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos() { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteItemHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteItemHibernateDAO.java new file mode 100644 index 000000000..f60e3856b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteItemHibernateDAO.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +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.PacoteItemDAO; +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteItem; + +@Repository("pacoteItemDAO") +public class PacoteItemHibernateDAO extends GenericHibernateDAO implements PacoteItemDAO { + + @Autowired + public PacoteItemHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public PacoteItem buscaPacoteItem(Pacote pacote, ItemAdicional item) { + + StringBuilder sb = new StringBuilder(); + sb.append(" from PacoteItem pi "); + sb.append(" where pi.pacote.pacoteId = :pacoteId "); + sb.append(" and pi.itemAdicional.itemadicionalId = :itemadicionalId "); + sb.append(" and pi.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacote.getPacoteId()); + query.setInteger("itemadicionalId", item.getItemadicionalId()); + + return (PacoteItem) query.uniqueResult(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaItensPacote(Pacote pacote) { + + StringBuilder sb = new StringBuilder(); + sb.append(" from PacoteItem pi "); + sb.append(" where pi.pacote.pacoteId = :pacoteId "); + sb.append(" and pi.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacote.getPacoteId()); + + return query.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteTarifaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteTarifaHibernateDAO.java new file mode 100644 index 000000000..9521d7d73 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PacoteTarifaHibernateDAO.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +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.PacoteTarifaDAO; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteTarifa; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +@Repository("pacoteTarifaDAO") +public class PacoteTarifaHibernateDAO extends GenericHibernateDAO implements PacoteTarifaDAO { + + @Autowired + public PacoteTarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public PacoteTarifa buscaPacoteTarifa(Pacote pacote, TipoTarifaPacote tipoTarifaPacote) { + + StringBuilder sb = new StringBuilder(); + sb.append(" from PacoteTarifa pt "); + sb.append(" where pt.pacote.pacoteId = :pacoteId "); + sb.append(" and pt.tipoTarifaPacote.tipotarifapacoteId = :tipotarifapacoteId "); + sb.append(" and pt.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacote.getPacoteId()); + query.setInteger("tipotarifapacoteId", tipoTarifaPacote.getTipotarifapacoteId()); + + return (PacoteTarifa) query.uniqueResult(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaTarifasPacote(Pacote pacote) { + + StringBuilder sb = new StringBuilder(); + sb.append(" from PacoteTarifa pt "); + sb.append(" where pt.pacote.pacoteId = :pacoteId "); + sb.append(" and pt.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacote.getPacoteId()); + + return query.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PaisHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PaisHibernateDAO.java new file mode 100644 index 000000000..5ef92d6b0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PaisHibernateDAO.java @@ -0,0 +1,47 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PaisDAO; +import com.rjconsultores.ventaboletos.entidad.Pais; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("paisDAO") +public class PaisHibernateDAO extends GenericHibernateDAO + implements PaisDAO { + + @Autowired + public PaisHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombpais")); + + return c.list(); + } + + public List buscar(String nombpais) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombpais", nombpais)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaCodOrgaoConcedenteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaCodOrgaoConcedenteHibernateDAO.java new file mode 100644 index 000000000..10f83e8af --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaCodOrgaoConcedenteHibernateDAO.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.ParadaCodOrgaoConcedenteDAO; +import com.rjconsultores.ventaboletos.entidad.ParadaCodOrgaoConcedente; + +@Repository("paradaCodOrgaoConcedenteDAO") +public class ParadaCodOrgaoConcedenteHibernateDAO extends GenericHibernateDAO + implements ParadaCodOrgaoConcedenteDAO { + + @Autowired + public ParadaCodOrgaoConcedenteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaEquivalenciaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaEquivalenciaHibernateDAO.java new file mode 100644 index 000000000..5c076d04a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaEquivalenciaHibernateDAO.java @@ -0,0 +1,51 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ParadaEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaEquivalencia; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("paradaEquivalenciaDAO") +public class ParadaEquivalenciaHibernateDAO + extends GenericHibernateDAO + implements ParadaEquivalenciaDAO { + + @Autowired + public ParadaEquivalenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Parada parada, + ComisionistaExterno comisionistaExterno, String equivalencia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("parada", parada)); + c.add(Restrictions.eq("comisionistaExterno", comisionistaExterno)); + c.add(Restrictions.eq("equivalenciaId", equivalencia)); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarEquivalencia(String equivalencia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("equivalenciaId", equivalencia)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java new file mode 100644 index 000000000..42fb3c8a4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java @@ -0,0 +1,166 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ParadaDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Nodo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.RegionMetropolitana; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TipoParada; + +/** + * + * @author Administrador + */ +@SuppressWarnings("unchecked") +@Repository("paradaDAO") +public class ParadaHibernateDAO extends GenericHibernateDAO implements ParadaDAO { + + @Autowired + public ParadaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.addOrder(Order.asc("descparada")); + + return c.list(); + } + + public List buscar(String descparada, String cveparada, Ciudad ciudad, TipoParada tipoParada, Nodo nodo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descparada", descparada)); + c.add(Restrictions.eq("cveparada", cveparada)); + c.add(Restrictions.eq("ciudad", ciudad)); + c.add(Restrictions.eq("tipoParada", tipoParada)); + c.add(Restrictions.eq("nodo", nodo)); + + return c.list(); + } + + public List buscar(String descparada) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descparada", descparada)); + + return c.list(); + } + + public List buscarCVE(String cveparada) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("cveparada", cveparada)); + + return c.list(); + } + + public List buscaLike(String descparada) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.like("descparada", descparada, MatchMode.START)); + + c.addOrder(Order.asc("descparada")); + + return c.list(); + } + + public Long count(TipoParada tipoParada) { + Criteria c = this.makeCriteria(); + + c.add(Restrictions.eq("tipoParada", tipoParada)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.setProjection(Projections.rowCount()); + + return HibernateFix.count(c.list()); + + } + + @Override + public List buscar(Integer codAntt) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("codantt", codAntt)); + + return c.list(); + } + + @Override + public List obtenerOrigenPorRuta(Ruta ruta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.createAlias("tramoOrigemList", "tramo"); + c.createAlias("tramo.rutaCombinacionList", "rutaCombinacion"); + c.createAlias("rutaCombinacion.ruta", "ruta"); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("ruta.rutaId", ruta.getRutaId())); + + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + return c.list(); + } + + @Override + public List obterPossiveisDestinos(Parada origem) { + if (origem == null) { + return null; + } + + String sql = "SELECT DISTINCT " + + "d " + + "FROM Tramo t " + + "JOIN t.destino d " + + "WHERE t.origem = :origem " + + "ORDER BY d.descparada"; + + return getSession().createQuery(sql).setEntity("origem", origem).list(); + } + + public List buscaParadaRegionMetropolitana(RegionMetropolitana regionMetropolitana) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("regionMetropolitana.regionMetropolitanaId", regionMetropolitana.getRegionMetropolitanaId())); + return c.list(); + } + + @Override + public List buscarListaPorIds(List paradaIds) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.in("paradaId", paradaIds)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public Parada buscarPorId(Integer paradaId) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("paradaId", paradaId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (Parada) c.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaMasivoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaMasivoHibernateDAO.java new file mode 100644 index 000000000..980ea657a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaMasivoHibernateDAO.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ParamAcumulaMasivoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaMasivo; + +/** + * + * @author Rafius + */ +@Repository("paramAcumulaMasivoDAO") +public class ParamAcumulaMasivoHibernateDAO extends GenericHibernateDAO + implements ParamAcumulaMasivoDAO { + + @Autowired + public ParamAcumulaMasivoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscar(Empresa emp, Integer min, Integer max, Date fecIni, Date fecFim) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (emp != null) { + c.add(Restrictions.eq("empresa", emp)); + } + if (min != null) { + c.add(Restrictions.ge("minpuntootorga", min)); + } + if (max != null) { + c.add(Restrictions.le("maxpuntootorga", max)); + } + if (fecIni != null) { + c.add(Restrictions.ge("feciniciovigencia", fecIni)); + } + if (fecFim != null) { + c.add(Restrictions.le("fecfinvigencia", fecFim)); + } + + return c.list(); + } + + @Override + public List buscar(ParamAcumulaMasivo paramAcumulaMasivo) { + Criteria c = this.getSession().createCriteria(ParamAcumulaMasivo.class); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ge("fecfinvigencia", paramAcumulaMasivo.getFeciniciovigencia())); + c.add(Restrictions.le("feciniciovigencia", paramAcumulaMasivo.getFecfinvigencia())); + c.add(Restrictions.eq("empresa", paramAcumulaMasivo.getEmpresa())); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaPuntoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaPuntoHibernateDAO.java new file mode 100644 index 000000000..270949863 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamAcumulaPuntoHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ParamAcumulaPuntoDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaPunto; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("paramAcumulaPuntoDAO") +public class ParamAcumulaPuntoHibernateDAO extends GenericHibernateDAO + implements ParamAcumulaPuntoDAO { + + @Autowired + public ParamAcumulaPuntoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Parada origem, Parada destino, Date ini, Date fim) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (origem != null) { + c.add(Restrictions.eq("origem", origem)); + } + + if (destino != null) { + c.add(Restrictions.eq("destino", destino)); + } + if (ini != null) { + c.add(Restrictions.ge("feciniciovigencia", ini)); + } + if (fim != null) { + c.add(Restrictions.le("fecfinvigencia", fim)); + } + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamArticuloHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamArticuloHibernateDAO.java new file mode 100644 index 000000000..fc30f19f6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamArticuloHibernateDAO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +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.ParamArticuloDAO; +import com.rjconsultores.ventaboletos.entidad.ParamArticulo; + +@Repository("paramArticuloDAO") +public class ParamArticuloHibernateDAO extends + GenericHibernateDAO implements ParamArticuloDAO { + + @Autowired + public ParamArticuloHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + // c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCanjePuntoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCanjePuntoHibernateDAO.java new file mode 100644 index 000000000..3347d5dd7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCanjePuntoHibernateDAO.java @@ -0,0 +1,51 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ParamCanjePuntoDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamCanjePunto; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("paramCanjePuntoDAO") +public class ParamCanjePuntoHibernateDAO extends GenericHibernateDAO + implements ParamCanjePuntoDAO { + + @Autowired + public ParamCanjePuntoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Parada origem, Parada destino, Date ini, Date fim) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (origem != null) { + c.add(Restrictions.eq("origem", origem)); + } + if (destino != null) { + c.add(Restrictions.eq("destino", destino)); + } + if (ini != null) { + c.add(Restrictions.ge("feciniciovigencia", ini)); + } + if (fim != null) { + c.add(Restrictions.le("fecfinvigencia", fim)); + } + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCompraPuntoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCompraPuntoHibernateDAO.java new file mode 100644 index 000000000..fe4818a95 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCompraPuntoHibernateDAO.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ParamCompraPuntoDAO; +import com.rjconsultores.ventaboletos.entidad.ParamCompraPunto; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("paramCompraPuntoDAO") +public class ParamCompraPuntoHibernateDAO extends GenericHibernateDAO + implements ParamCompraPuntoDAO { + + @Autowired + public ParamCompraPuntoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(Date ini, Date fim) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (ini != null) { + c.add(Restrictions.ge("feciniciovigencia", ini)); + } + if (fim != null) { + c.add(Restrictions.le("fecfinvigencia", fim)); + } + + return c.list(); + + } + + public List buscar(Date ini, Date fim, Integer cantPuntos, BigDecimal costoPunto) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (ini != null) { + c.add(Restrictions.eq("feciniciovigencia", ini)); + } + if (fim != null) { + c.add(Restrictions.eq("fecfinvigencia", fim)); + } + + if (cantPuntos != null) { + c.add(Restrictions.eq("cantpunto", cantPuntos)); + } + + if (costoPunto != null) { + c.add(Restrictions.eq("valcostopunto", costoPunto)); + } + + return c.list(); + + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamConexionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamConexionHibernateDAO.java new file mode 100644 index 000000000..bff14e960 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamConexionHibernateDAO.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.ParamConexionDAO; +import com.rjconsultores.ventaboletos.entidad.ParamConexion; + +@Repository("paramConexionDAO") +public class ParamConexionHibernateDAO extends GenericHibernateDAO implements ParamConexionDAO { + @Autowired + public ParamConexionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCostoTarjetaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCostoTarjetaHibernateDAO.java new file mode 100644 index 000000000..bbf14d191 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamCostoTarjetaHibernateDAO.java @@ -0,0 +1,41 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ParamCostoTarjetaDAO; +import com.rjconsultores.ventaboletos.entidad.ParamCostoTarjeta; + +/** + * + * @author Rafius + */ +@Repository("paramCostoTarjetaDAO") +public class ParamCostoTarjetaHibernateDAO extends GenericHibernateDAO + implements ParamCostoTarjetaDAO { + + @Autowired + public ParamCostoTarjetaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(ParamCostoTarjeta paramCostoTarjeta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("empresa", paramCostoTarjeta.getEmpresa())); + c.add(Restrictions.eq("valcostoinicial", paramCostoTarjeta.getValcostoinicial())); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamRecoleccionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamRecoleccionHibernateDAO.java new file mode 100644 index 000000000..98e4fd463 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParamRecoleccionHibernateDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ParamRecoleccionDAO; +import com.rjconsultores.ventaboletos.entidad.ParamRecoleccion; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("paramRecoleccionDAO") +public class ParamRecoleccionHibernateDAO extends GenericHibernateDAO + implements ParamRecoleccionDAO { + + @Autowired + public ParamRecoleccionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilFuncionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilFuncionHibernateDAO.java new file mode 100644 index 000000000..e7776d323 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilFuncionHibernateDAO.java @@ -0,0 +1,59 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PerfilFuncionDAO; +import com.rjconsultores.ventaboletos.entidad.PerfilFuncion; + +/** + * + * @author rodrigo + */ +@Repository("perfilFuncionDAO") +public class PerfilFuncionHibernateDAO extends GenericHibernateDAO + implements PerfilFuncionDAO { + + @Autowired + public PerfilFuncionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public boolean usuarioPossuiPermissaoFuncionalidade(Integer usuarioId, String descRuta) { + StringBuilder instrucao = new StringBuilder(); + instrucao.append("select pf.* from perfil_funcion pf "); + instrucao.append("inner join funcion_sistema fs on pf.funcionsistema_id = fs.funcionsistema_id "); + instrucao.append("inner join usuario_perfil up on pf.perfil_id = up.perfil_id "); + instrucao.append("where pf.activo = 1 "); + instrucao.append("and up.usuario_id = :usuarioId "); + instrucao.append("and fs.descruta = :descruta "); + + Query query = getSession().createSQLQuery(instrucao.toString()).addEntity(PerfilFuncion.class); + query.setInteger("usuarioId", usuarioId); + query.setString("descruta", descRuta); + + PerfilFuncion perfilFuncion = (PerfilFuncion)query.uniqueResult(); + + return perfilFuncion != null && !perfilFuncion.getIndLectura(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilHibernateDAO.java new file mode 100644 index 000000000..d42ecb573 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PerfilHibernateDAO.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PerfilDAO; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import com.rjconsultores.ventaboletos.vo.segurida.PerfilJerarquia; + +/** + * + * @author rodrigo + */ +@Repository("perfilDAO") +public class PerfilHibernateDAO extends GenericHibernateDAO + implements PerfilDAO { + + @Autowired + public PerfilHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscaPerfilJerarquia(Perfil perfilUsuario) { + + PerfilJerarquia usuarioJerarquia = perfilUsuario.getIndJerarquia() == null ? PerfilJerarquia.NORMAL : PerfilJerarquia.buscar(perfilUsuario.getIndJerarquia()); + + StringBuilder sb = new StringBuilder(); + sb.append(" from Perfil p "); + sb.append(" where p.activo = 1 "); + + if (!usuarioJerarquia.equals(PerfilJerarquia.ADMIN)) { + if (!usuarioJerarquia.equals(PerfilJerarquia.NORMAL)) { + sb.append(" and (p.indJerarquia >= " + usuarioJerarquia.getValor() + " or p.indJerarquia <=" + PerfilJerarquia.NORMAL.getValor() + " or p.indJerarquia is null ) "); + } else { + sb.append(" and (p.indJerarquia is null or p.indJerarquia <=" + PerfilJerarquia.NORMAL.getValor() + " ) "); + } + } + sb.append(" order by p.descperfil "); + + Query query = getSession().createQuery(sb.toString()); + return query.list(); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.not(Restrictions.eq("descperfil", "RJ"))); + c.addOrder(Order.asc("descperfil")); + + return c.list(); + } + + public List buscar(String dscPerfil) { + + return this.findByCriteria(Restrictions.eq("descperfil", dscPerfil.trim()), Restrictions.eq("activo", Boolean.TRUE)); + + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PeriodoVacacionalHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PeriodoVacacionalHibernateDAO.java new file mode 100644 index 000000000..a76679158 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PeriodoVacacionalHibernateDAO.java @@ -0,0 +1,64 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PeriodoVacacionalDAO; +import com.rjconsultores.ventaboletos.entidad.PeriodoVacacional; + +/** + * + * @author Rafius + */ +@Repository("periodoVacacionalDAO") +public class PeriodoVacacionalHibernateDAO extends GenericHibernateDAO + implements PeriodoVacacionalDAO { + + @Autowired + public PeriodoVacacionalHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscar(Date dataInicio, Date dataFim) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("fecinicio", dataInicio)); + c.add(Restrictions.eq("fecfinal", dataFim)); + + return c.list(); + } + + @Override + public List buscarFechaTraslapa(PeriodoVacacional periodoVacacional) { + + Criteria c = this.getSession().createCriteria(PeriodoVacacional.class); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ge("fecfinal", periodoVacacional.getFecinicio())); + c.add(Restrictions.le("fecinicio", periodoVacacional.getFecfinal())); + + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PlazaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PlazaHibernateDAO.java new file mode 100644 index 000000000..6be8cf105 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PlazaHibernateDAO.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PlazaDAO; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("plazaDAO") +public class PlazaHibernateDAO extends GenericHibernateDAO + implements PlazaDAO { + + @Autowired + public PlazaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombplaza")); + + return c.list(); + } + + public List buscar(String nombplaza) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombplaza", nombplaza)); + + return c.list(); + + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecioFixoPedagioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecioFixoPedagioHibernateDAO.java new file mode 100644 index 000000000..7bef35ca3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecioFixoPedagioHibernateDAO.java @@ -0,0 +1,93 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PrecioFixoPedagioDAO; +import com.rjconsultores.ventaboletos.entidad.PrecioFixoPedagio; + +/** + * + * @author Administrador + */ +@Repository("precoFixoPedagioDAO") +public class PrecioFixoPedagioHibernateDAO extends GenericHibernateDAO implements PrecioFixoPedagioDAO { + + @Autowired + public PrecioFixoPedagioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); +// c.addOrder(Order.asc("descclase")); + + return c.list(); + } + + public List buscarPorEmpresasDoUsuario(String empresasUsuario) { + + String consulta = "SELECT DISTINCT mcs.marcaClaseservicioPK.claseservicio " + + "FROM MarcaClaseServicio mcs " + + "WHERE mcs.marcaClaseservicioPK.marca.empresa.empresaId IN (:empresas) "; + + List ids = new ArrayList(); + for (String empresa : empresasUsuario.split(",")) { + ids.add(new Integer(empresa)); + } + Query query = getSession().createQuery(consulta); + query.setParameterList("empresas", ids); + + List result = (List) query.list(); + return result; + } + + public List buscarPorNome(String nomeClaseServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descclase", nomeClaseServicio)); + + return c.list(); + } + + public List buscarTodosExceto(Integer... idClase) { + Criteria c = this.makeCriteria(); + for (Integer id : idClase) { + c.add(Restrictions.ne("claseservicioId", id)); + } + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descclase")); + + return c.list(); + } + @Override + public List buscarPrecioFixoPedagio(PrecioFixoPedagio obj) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("pracaPedagioId.casetaPeajeId", obj.getPracaPedagioId().getCasetaPeajeId())); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + if(obj.getOrgaoConcedenteId() != null){ + c.add(Restrictions.eq("orgaoConcedenteId.orgaoConcedenteId", obj.getOrgaoConcedenteId().getOrgaoConcedenteId())); + } + if(obj.getClasseId()!= null){ + c.add(Restrictions.eq("classeId.claseservicioId", obj.getClasseId().getClaseservicioId())); + } + + c.setMaxResults(1); + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecioVentajaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecioVentajaHibernateDAO.java new file mode 100644 index 000000000..60f4237fc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecioVentajaHibernateDAO.java @@ -0,0 +1,57 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Query; +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.PrecioVentajaDAO; +import com.rjconsultores.ventaboletos.entidad.PrecioVentaja; + +/** + * + * @author Igor + */ +@SuppressWarnings("unchecked") +@Repository("precioVentajaDAO") +public class PrecioVentajaHibernateDAO extends GenericHibernateDAO + implements PrecioVentajaDAO { + + @Autowired + public PrecioVentajaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarPrecioVentaja(Integer origenId, Integer destinoId, Integer rutaId, Integer corridaId) { + StringBuilder sb = new StringBuilder(); + sb.append(" from PrecioVentaja "); + sb.append(" where activo = 1 "); + + if (origenId != null) { + sb.append(" and origenOriginalId = ").append(origenId); + } + if (destinoId != null) { + sb.append(" and destinoOriginalId = ").append(destinoId); + } + if (rutaId != null) { + sb.append(" and rutaOriginalId = ").append(rutaId); + } + if (corridaId != null) { + sb.append(" and corridaId = ").append(corridaId); + } + + Query query = getSession().createQuery(sb.toString()); + List list = query.list(); + + return list; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecoApanheHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecoApanheHibernateDAO.java new file mode 100644 index 000000000..5def1d8eb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PrecoApanheHibernateDAO.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PrecoApanheDAO; +import com.rjconsultores.ventaboletos.entidad.PrecoApanhe; + +@Repository("precoApanheDAO") +public class PrecoApanheHibernateDAO extends GenericHibernateDAO implements PrecoApanheDAO { + + @Autowired + public PrecoApanheHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @SuppressWarnings("unchecked") + public List buscar(String deschotel, String desccolonia, String nombciudad) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if(StringUtils.isNotBlank(deschotel)) { + c.add(Restrictions.eq("hotel.deschotel", deschotel)); + } + + if(StringUtils.isNotBlank(desccolonia)) { + c.add(Restrictions.eq("colonia.desccolonia", desccolonia)); + } + + if(StringUtils.isNotBlank(nombciudad)) { + c.add(Restrictions.eq("ciudad.nombciudad", nombciudad)); + } + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingAsientoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingAsientoHibernateDAO.java new file mode 100644 index 000000000..7a11301d2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingAsientoHibernateDAO.java @@ -0,0 +1,47 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingAsientoDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingAsiento; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingAsientoDAO") +public class PricingAsientoHibernateDAO extends GenericHibernateDAO + implements PricingAsientoDAO { + + @Autowired + public PricingAsientoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public List obtenerPricingCategoria(Pricing pricing, Integer asiento) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("numeasiento", asiento.toString())); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCategoriaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCategoriaHibernateDAO.java new file mode 100644 index 000000000..4ed618cc1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCategoriaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCategoria; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingCategoriaDAO") +public class PricingCategoriaHibernateDAO extends GenericHibernateDAO + implements PricingCategoriaDAO { + + @Autowired + public PricingCategoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingCategoria(Pricing pricing, Categoria categoria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("categoria", categoria)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClaseHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClaseHibernateDAO.java new file mode 100644 index 000000000..2c21c86a2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClaseHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingClaseDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingClase; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingClaseDAO") +public class PricingClaseHibernateDAO extends GenericHibernateDAO + implements PricingClaseDAO { + + @Autowired + public PricingClaseHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingClase(Pricing pricing, ClaseServicio claseServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClasseTarifariaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClasseTarifariaHibernateDAO.java new file mode 100644 index 000000000..75ca2dde6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingClasseTarifariaHibernateDAO.java @@ -0,0 +1,51 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingClasseTarifariaDAO; +import com.rjconsultores.ventaboletos.entidad.PricingClasseTarifaria; + +@Repository("pricingClasseTarifariaDAO") +public class PricingClasseTarifariaHibernateDAO extends GenericHibernateDAO + implements PricingClasseTarifariaDAO { + + @Autowired + public PricingClasseTarifariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public Boolean validacionSigla(String sigla) { + + StringBuffer hql = new StringBuffer(); + hql.append(" FROM PricingClasseTarifaria pct "); + hql.append(" WHERE pct.sigla = :sigla "); + hql.append(" AND pct.activo = :activo "); + + Query query = getSession().createQuery(hql.toString()); + query.setParameter("activo", Boolean.TRUE); + query.setParameter("sigla", sigla); + + if (query.list().isEmpty()) + return true; + else + return false; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCorridaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCorridaHibernateDAO.java new file mode 100644 index 000000000..fd2868e39 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCorridaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingCorridaDAO; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCorrida; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingCorridaDAO") +public class PricingCorridaHibernateDAO extends GenericHibernateDAO + implements PricingCorridaDAO { + + @Autowired + public PricingCorridaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingCorrida(Pricing pricing, CorridaCtrl corrida) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("corridaCtrl", corrida)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCtrlHibernateDAO.java new file mode 100644 index 000000000..2a2ba56d3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingCtrlHibernateDAO.java @@ -0,0 +1,39 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.PricingCtrl; + +@Repository("pricingCtrlDAO") +public class PricingCtrlHibernateDAO extends GenericHibernateDAO implements PricingCtrlDAO { + + @Autowired + public PricingCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos() { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @Override + public PricingCtrl obtenerPricingCtrl() { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setMaxResults(1); + return (PricingCtrl) c.uniqueResult(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingDiaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingDiaHibernateDAO.java new file mode 100644 index 000000000..d05e8e5b5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingDiaHibernateDAO.java @@ -0,0 +1,96 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingDiaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingDia; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingDiaDAO") +public class PricingDiaHibernateDAO extends GenericHibernateDAO + implements PricingDiaDAO { + + private static Logger log = Logger.getLogger(PricingDiaHibernateDAO.class); + + @Autowired + public PricingDiaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public List buscarTraslapa(PricingDia pricingDia) { + Date horarioinicio = pricingDia.getHorarioinicio(); + Date horariofin = pricingDia.getHorariofin(); + + SimpleDateFormat sf = new SimpleDateFormat("HHmm"); + + StringBuilder hql = new StringBuilder(); + hql.append("select pv from PricingDia pv "); + hql.append(" where pv.activo = 1 "); + hql.append(" and pricing.pricingId = ").append(pricingDia.getPricing().getPricingId()); + // hql.append(" and ( 1=1 or "); + // if (pricingDia.getIndlunes()) { + // hql.append(" pv.indlunes = ").append(pricingDia.getIndlunes()); + // } + // if (pricingDia.getIndmartes()) { + // hql.append(" or pv.indmartes = ").append(pricingDia.getIndmartes()); + // } + // if (pricingDia.getIndmiercoles()) { + // hql.append(" or pv.indmiercoles = ").append(pricingDia.getIndmiercoles()); + // } + // if (pricingDia.getIndjueves()) { + // hql.append(" or pv.indjueves = ").append(pricingDia.getIndjueves()); + // } + // if (pricingDia.getIndviernes()) { + // hql.append(" or pv.indviernes = ").append(pricingDia.getIndviernes()); + // } + // if (pricingDia.getIndsabado()) { + // hql.append(" or pv.indsabado = ").append(pricingDia.getIndsabado()); + // } + // if (pricingDia.getInddomingo()) { + // hql.append(" or pv.inddomingo = ").append(pricingDia.getInddomingo()); + // } + // hql.append(" ) "); + // hql.append(" and ((( to_char('").append(sf.format(horarioinicio)).append("') BETWEEN to_char(pv.horarioinicio, 'HH24MI') AND to_char(pv.horariofin, 'HH24MI') ) "); + // hql.append(" OR (to_char('").append(sf.format(horariofin)).append("') BETWEEN to_char(pv.horarioinicio, 'HH24MI') AND to_char(pv.horariofin, 'HH24MI'))) "); + // hql.append(" OR ((to_char(pv.horarioinicio, 'HH24MI') BETWEEN to_char('").append(sf.format(horarioinicio)).append("') AND to_char('").append(sf.format(horariofin)).append("') ) "); + // hql.append(" OR (to_char(pv.horariofin, 'HH24MI') BETWEEN to_char('").append(sf.format(horarioinicio)).append("') AND to_char('").append(sf.format(horariofin)).append("') ))) "); + + hql.append(" and pv.horariofin >= :horariofin "); + hql.append(" and pv.horarioinicio >= :horarioinicio "); + + log.info("Hora Ini: " + sf.format(horarioinicio)); + log.info("Hora Fin: " + sf.format(horariofin)); + log.info("SQL: " + hql.toString()); + + Query sq = getSession().createQuery(hql.toString()); + sq.setParameter("horariofin", horariofin); + sq.setParameter("horarioinicio", horarioinicio); + + return sq.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoAgenciaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoAgenciaHibernateDAO.java new file mode 100644 index 000000000..b3ea397b0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoAgenciaHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoAgenciaDAO; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoAgencia; + + +@Repository("pricingEspecificoAgenciaDAO") +public class PricingEspecificoAgenciaHibernateDAO extends GenericHibernateDAO implements PricingEspecificoAgenciaDAO { + + @Autowired + public PricingEspecificoAgenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + @SuppressWarnings("unchecked") + @Override + public Boolean isDuplicado(PricingEspecificoAgencia entidad) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("puntoVenta.puntoventaId", entidad.getPuntoVenta().getPuntoventaId())); + + return c.list().isEmpty(); + } +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoCanalVendasHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoCanalVendasHibernateDAO.java new file mode 100644 index 000000000..b10649e8e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoCanalVendasHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoCanalVendasDAO; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCanalVendas; + + +@Repository("pricingEspecificoCanalVendasDAO") +public class PricingEspecificoCanalVendasHibernateDAO extends GenericHibernateDAO implements PricingEspecificoCanalVendasDAO { + + @Autowired + public PricingEspecificoCanalVendasHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + @SuppressWarnings("unchecked") + @Override + public Boolean isDuplicado(PricingEspecificoCanalVendas entidad) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tipoPtovta.tipoptovtaId", entidad.getTipoPtovta().getTipoptovtaId())); + + return c.list().isEmpty(); + } +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoCategoriaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoCategoriaHibernateDAO.java new file mode 100644 index 000000000..8825d3650 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoCategoriaHibernateDAO.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCategoria; + +@Repository("pricingEspecificoCategoriaDAO") +public class PricingEspecificoCategoriaHibernateDAO extends GenericHibernateDAO implements PricingEspecificoCategoriaDAO { + + @Autowired + public PricingEspecificoCategoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public Boolean isDuplicado(PricingEspecificoCategoria entidad) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("categoria.categoriaId", entidad.getCategoria().getCategoriaId())); + + return c.list().isEmpty(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoHibernateDAO.java new file mode 100644 index 000000000..e95532c9f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoHibernateDAO.java @@ -0,0 +1,132 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PricingEspecifico; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingEspecificoDAO") +public class PricingEspecificoHibernateDAO extends GenericHibernateDAO + implements PricingEspecificoDAO { + + @Autowired + public PricingEspecificoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarPorNome(PricingEspecifico pricingEspecifico) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombPricing", pricingEspecifico.getNombPricing())); + + return c.list(); + } + + @Override + public List buscarPorNome(String nome) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombPricing", nome)); + + return c.list(); + } + + @Override + public List buscar(List empresas, List tipoClasses, List origens, List destinos, Date vigenciaInicial, Date vigenciaFinal) { + + StringBuilder hql = new StringBuilder(); + hql.append("SELECT DISTINCT pe "); + hql.append("FROM PricingEspecifico pe "); + hql.append(" WHERE pe.activo = 1 "); + + if (!empresas.isEmpty()) { + hql.append(" AND pe.marca.empresa.empresaId IN ("); + for (Empresa e : empresas) { + hql.append(e.getEmpresaId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if (!tipoClasses.isEmpty()) { + hql.append(" AND pe.claseServicio.claseservicioId IN ("); + for (ClaseServicio c : tipoClasses) { + hql.append(c.getClaseservicioId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if (!origens.isEmpty()) { + hql.append(" AND pe.parada.paradaId IN ("); + for (Parada o : origens) { + hql.append(o.getParadaId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if (!destinos.isEmpty()) { + hql.append(" AND pe.parada1.paradaId IN ("); + for (Parada o : origens) { + hql.append(o.getParadaId() + ","); + } + hql.deleteCharAt(hql.length() - 1); + hql.append(")"); + } + + if (vigenciaInicial != null) { + hql.append(" AND YEAR(pe.fechorinicio) >= YEAR(:vigenciaInicial) "); + hql.append(" AND MONTH(pe.fechorinicio)>= MONTH(:vigenciaInicial) "); + hql.append(" AND DAY(pe.fechorinicio) >= DAY(:vigenciaInicial) "); + } + + if (vigenciaFinal != null) { + hql.append(" AND YEAR(pe.fechorfin) <= YEAR(:vigenciaFinal) "); + hql.append(" AND MONTH(pe.fechorfin) <= MONTH(:vigenciaFinal) "); + hql.append(" AND DAY(pe.fechorfin) <= DAY(:vigenciaFinal) "); + } + + Query query = getSession().createQuery(hql.toString()); + + if (vigenciaInicial != null) { + query.setDate("vigenciaInicial", vigenciaInicial); + } + if (vigenciaFinal != null) { + query.setDate("vigenciaFinal", vigenciaFinal); + } + + return query.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoOcupacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoOcupacionHibernateDAO.java new file mode 100644 index 000000000..5ac0dc514 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingEspecificoOcupacionHibernateDAO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoOcupacionDAO; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoOcupacion; + + +@Repository("pricingEspecificoOcupacionDAO") +public class PricingEspecificoOcupacionHibernateDAO extends GenericHibernateDAO implements PricingEspecificoOcupacionDAO { + + @Autowired + public PricingEspecificoOcupacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingFormapagoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingFormapagoHibernateDAO.java new file mode 100644 index 000000000..b51f067a2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingFormapagoHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.PricingFormapagoDAO; +import com.rjconsultores.ventaboletos.entidad.PricingFormapago; + +@Repository("pricingFormapagoDAO") +public class PricingFormapagoHibernateDAO extends GenericHibernateDAO implements PricingFormapagoDAO { + + @Autowired + public PricingFormapagoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingHibernateDAO.java new file mode 100644 index 000000000..6d03d9084 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingHibernateDAO.java @@ -0,0 +1,159 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.hibernate.type.IntegerType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +/** + * + * @author Rafius + */ +@Repository("pricingDAO") +public class PricingHibernateDAO extends GenericHibernateDAO + implements PricingDAO { + + @Autowired + public PricingHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public List buscar(String nombPricing, Empresa empresa, + Short cantboleto, Integer cantdiasanticipacion, + BigDecimal descuentoporcentaje, BigDecimal descuentoporcredondo) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + c.add(Restrictions.eq("nombPricing", nombPricing)); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("cantboleto", cantboleto)); + c.add(Restrictions.eq("cantdiasanticipacion", cantdiasanticipacion)); + if (descuentoporcentaje != null) { + c.add(Restrictions.eq("descuentoporcentaje", descuentoporcentaje)); + } + if (descuentoporcredondo != null) { + c.add(Restrictions.eq("descuentoporcredondo", descuentoporcredondo)); + } + + return c.list(); + } + + public List buscarPorNombre(String nombPricing) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + c.add(Restrictions.eq("nombPricing", nombPricing)); + + return c.list(); + } + + @Override + public List buscar(Integer pricingId, String nomepricing, Integer empresaId, Date dataViagemInicio, Date dataViagemFim, Integer origemId, Integer destinoId) { + StringBuilder sQuery = new StringBuilder("SELECT p FROM Pricing p WHERE p.activo = 1 "); + + if(pricingId != null) { + sQuery.append("AND p.pricingId = :pricingId "); + } + + if(StringUtils.isNotBlank(nomepricing)) { + sQuery.append("AND p.nombPricing like :nomepricing "); + } + + if(empresaId != null) { + sQuery.append("AND p.empresa.empresaId = :empresaId "); + } + + if(dataViagemInicio != null) { + sQuery.append("AND p.pricingVigenciaList.fecinicioviaje >= :dataViagemInicio "); + } + + if(dataViagemFim != null) { + sQuery.append("AND p.pricingVigenciaList.fecfinviaje <= :dataViagemFim "); + } + + if(origemId != null) { + sQuery.append("AND p.pricingMercadoList.origen.paradaId = :origemId "); + } + + if(destinoId != null) { + sQuery.append("AND p.pricingMercadoList.destino.paradaId = :destinoId "); + } + + Query qr = getSession().createQuery(sQuery.toString()); + if(pricingId != null) { + qr.setParameter("pricingId", pricingId); + } + + if(StringUtils.isNotBlank(nomepricing)) { + qr.setParameter("nomepricing", nomepricing); + } + + if(empresaId != null) { + qr.setParameter("empresaId", empresaId); + } + + if(dataViagemInicio != null) { + qr.setParameter("dataViagemInicio", dataViagemInicio); + } + + if(dataViagemFim != null) { + qr.setParameter("dataViagemFim", dataViagemFim); + } + + if(origemId != null) { + qr.setParameter("origemId", origemId); + } + + if(destinoId != null) { + qr.setParameter("destinoId", destinoId); + } + + return qr.list(); + } + + @Override + public List buscar(Integer diasFimViagem) { + if(diasFimViagem == null || diasFimViagem == 0) { + return null; + } + StringBuilder sQuery = new StringBuilder(); + sQuery.append("SELECT p.pricing_id ") + .append("FROM pricing p ") + .append("JOIN pricing_vigencia pv ON p.pricing_id = pv.pricing_id and pv.activo = 1 ") + .append("WHERE p.activo = 1 ") + .append("HAVING to_date(:dataAtual,'dd/mm/yyyy') - max(pv.fecfinviaje) >= :diasFimViagem ") + .append("GROUP BY p.pricing_id "); + + Query qr = getSession().createSQLQuery(sQuery.toString()).addScalar("pricing_id", IntegerType.INSTANCE); + qr.setParameter("dataAtual", DateUtil.getStringDate(new Date(), "dd/MM/yyyy")); + qr.setParameter("diasFimViagem", diasFimViagem); + return qr.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingImporteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingImporteHibernateDAO.java new file mode 100644 index 000000000..7b980e97b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingImporteHibernateDAO.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingImporteDAO; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingImporte; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingImporteDAO") +public class PricingImporteHibernateDAO extends GenericHibernateDAO + implements PricingImporteDAO { + + @Autowired + public PricingImporteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public List buscarMoneda(PricingImporte pricingImporte, Moneda moneda) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricingImporte.getPricing())); + c.add(Restrictions.eq("moneda", moneda)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMarcaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMarcaHibernateDAO.java new file mode 100644 index 000000000..89759ffaa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMarcaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMarca; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingMarcaDAO") +public class PricingMarcaHibernateDAO extends GenericHibernateDAO + implements PricingMarcaDAO { + + @Autowired + public PricingMarcaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingMarca(Pricing pricing, Marca marca) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("marca", marca)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMercadoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMercadoHibernateDAO.java new file mode 100644 index 000000000..5b6522272 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingMercadoHibernateDAO.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMercado; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingMercadoDAO") +public class PricingMercadoHibernateDAO extends GenericHibernateDAO + implements PricingMercadoDAO { + + @Autowired + public PricingMercadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingMercado(Pricing pricing, Parada origen, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("origen", origen)); + c.add(Restrictions.eq("destino", destino)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingOcupaAntecipaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingOcupaAntecipaHibernateDAO.java new file mode 100644 index 000000000..0393f7151 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingOcupaAntecipaHibernateDAO.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingOcupaAntecipaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; + +/** + * + * @author Rafius + */ +@Repository("pricingOcupacionDAO") +public class PricingOcupaAntecipaHibernateDAO extends GenericHibernateDAO + implements PricingOcupaAntecipaDAO { + + @Autowired + public PricingOcupaAntecipaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + return c.list(); + } + + @Override + public List buscarOcupaAntecipaPricing(Integer pricingId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.or(Restrictions.eq("activo", Pricing.ATIVO), Restrictions.eq("activo", Pricing.INATIVO))); + c.add(Restrictions.eq("pricing.pricingId", pricingId)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingPuntoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingPuntoVentaHibernateDAO.java new file mode 100644 index 000000000..548307cd5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingPuntoVentaHibernateDAO.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingPuntoVentaDAO") +public class PricingPuntoVentaHibernateDAO extends GenericHibernateDAO + implements PricingPuntoVentaDAO { + + @Autowired + public PricingPuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingPuntoVenta(Pricing pricing, PuntoVenta puntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("puntoVenta", puntoVenta)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingRutaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingRutaHibernateDAO.java new file mode 100644 index 000000000..e6bf77ab9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingRutaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingRutaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingRuta; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingRutaDAO") +public class PricingRutaHibernateDAO extends GenericHibernateDAO + implements PricingRutaDAO { + + @Autowired + public PricingRutaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingRuta(Pricing pricing, Ruta ruta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("ruta", ruta)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoPtoVtaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoPtoVtaHibernateDAO.java new file mode 100644 index 000000000..4ef62278c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoPtoVtaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingTipoPtoVtaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("pricingTipoPtoVtaDAO") +public class PricingTipoPtoVtaHibernateDAO extends GenericHibernateDAO + implements PricingTipoPtoVtaDAO { + + @Autowired + public PricingTipoPtoVtaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingTipoPuntoVenta(Pricing pricing, TipoPuntoVenta tipoPuntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("tipoPtovta", tipoPuntoVenta)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoServicioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoServicioHibernateDAO.java new file mode 100644 index 000000000..2d75e7eb1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingTipoServicioHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PricingTipoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; +import com.rjconsultores.ventaboletos.entidad.TipoServicio; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("pricingTipoServicioDAO") +public class PricingTipoServicioHibernateDAO extends GenericHibernateDAO + implements PricingTipoServicioDAO { + + @Autowired + public PricingTipoServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + public Boolean obtenerPricingTipoServicio(Pricing pricing, TipoServicio tipoServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.eq("pricing", pricing)); + c.add(Restrictions.eq("tipoServicio", tipoServicio)); + + if (c.list().size() > 0) { + return true; + } else { + return false; + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingVigenciaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingVigenciaHibernateDAO.java new file mode 100644 index 000000000..315195b09 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PricingVigenciaHibernateDAO.java @@ -0,0 +1,83 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PricingVigenciaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingVigencia; + +/** + * + * @author Rafius + */ +@Repository("pricingVigenciaDAO") +public class PricingVigenciaHibernateDAO extends GenericHibernateDAO + implements PricingVigenciaDAO { + + @Autowired + public PricingVigenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + return c.list(); + } + + @Override + public List buscarPorVigencias(PricingVigencia pv) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + + c.add(Restrictions.eq("pricing", pv.getPricing())); + + Date fecinicioventa = pv.getFecinicioventa(); + Date fecfinventa = pv.getFecfinventa(); + + c.add(Restrictions.or(Restrictions.between("fecinicioventa", fecinicioventa, fecfinventa), + (Restrictions.between("fecfinventa", fecinicioventa, fecfinventa)))); + + return c.list(); + } + + @Override + public Boolean podeSalvar(Pricing pricing, PricingVigencia pricingVigencia, Date inicio, Date fim) { + Calendar fecInicio = Calendar.getInstance(); + fecInicio.setTime(inicio); + fecInicio.set(Calendar.MILLISECOND, 0); + fecInicio.set(Calendar.SECOND, 0); + + Calendar fecFin = Calendar.getInstance(); + fecFin.setTime(fim); + fecFin.set(Calendar.MILLISECOND, 0); + fecFin.set(Calendar.SECOND, 0); + + Criteria c = this.getSession().createCriteria(PricingVigencia.class); + c.add(Restrictions.eq("activo", Pricing.ATIVO)); + c.add(Restrictions.ge("fecfinviaje", fecInicio.getTime())); + c.add(Restrictions.le("fecinicioviaje", fecFin.getTime())); + c.add(Restrictions.eq("pricing", pricing)); + if (pricingVigencia.getPricingvigenciaId() != null) { + c.add(Restrictions.ne("pricingvigenciaId", pricingVigencia.getPricingvigenciaId())); + } + + return c.list().isEmpty(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdClaseServicioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdClaseServicioHibernateDAO.java new file mode 100644 index 000000000..6f7c023e4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdClaseServicioHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdClaseServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ProdClaseServicio; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodClaseServicioDAO") +public class ProdClaseServicioHibernateDAO extends GenericHibernateDAO + implements ProdClaseServicioDAO { + + @Autowired + public ProdClaseServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdFormaPagoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdFormaPagoHibernateDAO.java new file mode 100644 index 000000000..df9354378 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdFormaPagoHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdFormaPagoDAO; +import com.rjconsultores.ventaboletos.entidad.ProdFormaPago; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodFormaPagoDAO") +public class ProdFormaPagoHibernateDAO extends GenericHibernateDAO + implements ProdFormaPagoDAO { + + @Autowired + public ProdFormaPagoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMarcaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMarcaHibernateDAO.java new file mode 100644 index 000000000..df0d6101e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMarcaHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdMarca; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodMarcaDAO") +public class ProdMarcaHibernateDAO extends GenericHibernateDAO + implements ProdMarcaDAO { + + @Autowired + public ProdMarcaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMercadoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMercadoHibernateDAO.java new file mode 100644 index 000000000..4a243c125 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdMercadoHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.ProdMercado; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodMercadoDAO") +public class ProdMercadoHibernateDAO extends GenericHibernateDAO + implements ProdMercadoDAO { + + @Autowired + public ProdMercadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPrecioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPrecioHibernateDAO.java new file mode 100644 index 000000000..0164e1cf9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPrecioHibernateDAO.java @@ -0,0 +1,64 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdPrecioDAO; +import com.rjconsultores.ventaboletos.entidad.AlertaCtrl; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ProdPrecio; +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import java.math.BigDecimal; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("prodPrecioDAO") +public class ProdPrecioHibernateDAO extends GenericHibernateDAO + implements ProdPrecioDAO { + + @Autowired + public ProdPrecioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(Marca marca, ProductoServicio productoservicio) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("productoservicio", productoservicio)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + + return c.list(); + } + + public List buscar(Marca marca) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPuntoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPuntoVentaHibernateDAO.java new file mode 100644 index 000000000..b705c2a6b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdPuntoVentaHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdPuntoVenta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodPuntoVentaDAO") +public class ProdPuntoVentaHibernateDAO extends GenericHibernateDAO + implements ProdPuntoVentaDAO { + + @Autowired + public ProdPuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdRutaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdRutaHibernateDAO.java new file mode 100644 index 000000000..5f63a56c4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdRutaHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdRutaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdRuta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodRutaDAO") +public class ProdRutaHibernateDAO extends GenericHibernateDAO + implements ProdRutaDAO { + + @Autowired + public ProdRutaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdTipoptovtaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdTipoptovtaHibernateDAO.java new file mode 100644 index 000000000..054dcc695 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdTipoptovtaHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdTipoptovtaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdTipoptovta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodTipoptovtaDAO") +public class ProdTipoptovtaHibernateDAO extends GenericHibernateDAO + implements ProdTipoptovtaDAO { + + @Autowired + public ProdTipoptovtaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdVigenciaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdVigenciaHibernateDAO.java new file mode 100644 index 000000000..11bb04c15 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProdVigenciaHibernateDAO.java @@ -0,0 +1,54 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProdVigenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdVigencia; +import com.rjconsultores.ventaboletos.entidad.ReservacionCtrl; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("prodVigenciaDAO") +public class ProdVigenciaHibernateDAO extends GenericHibernateDAO + implements ProdVigenciaDAO { + + @Autowired + public ProdVigenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscarTraslapa(ProdVigencia prodVigencia) { + Criteria c = this.getSession().createCriteria(ProdVigencia.class); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ge("fecvigenciafin", prodVigencia.getFecvigenciainicio())); + c.add(Restrictions.le("fecvigenciainicio", prodVigencia.getFecvigenciafin())); + c.add(Restrictions.eq("productoServicio", prodVigencia.getProductoServicio())); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ProductoServicioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProductoServicioHibernateDAO.java new file mode 100644 index 000000000..11e440cad --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ProductoServicioHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ProductoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("productoServicioDAO") +public class ProductoServicioHibernateDAO extends GenericHibernateDAO + implements ProductoServicioDAO { + + @Autowired + public ProductoServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List obtener(ProductoServicio ps) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descproductoservicio", ps.getDescproductoservicio())); + c.add(Restrictions.eq("empresa", ps.getEmpresa())); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaCheckinHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaCheckinHibernateDAO.java new file mode 100644 index 000000000..ebea27de4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaCheckinHibernateDAO.java @@ -0,0 +1,43 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtoVtaCheckinDAO; +import com.rjconsultores.ventaboletos.entidad.PtoVtaCheckin; + +@Repository("ptoVtaCheckinDAO") +public class PtoVtaCheckinHibernateDAO extends GenericHibernateDAO + implements PtoVtaCheckinDAO { + + @Autowired + public PtoVtaCheckinHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("ptoVtaCheckinId")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("ptoVtaCheckinId", id)); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaSeguroHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaSeguroHibernateDAO.java new file mode 100644 index 000000000..eb196cd4f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaSeguroHibernateDAO.java @@ -0,0 +1,43 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtoVtaSeguroDAO; +import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro; + +@Repository("ptoVtaSeguroDAO") +public class PtoVtaSeguroHibernateDAO extends GenericHibernateDAO + implements PtoVtaSeguroDAO { + + @Autowired + public PtoVtaSeguroHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("ptoVtaSeguroId")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("ptoVtaSeguroId", id)); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaUsuarioBancarioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaUsuarioBancarioHibernateDAO.java new file mode 100644 index 000000000..858509fbb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtoVtaUsuarioBancarioHibernateDAO.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PtoVtaUsuarioBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.PtoVtaUsuarioBancario; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("ptoVtaUsuarioBancarioDAO") +public class PtoVtaUsuarioBancarioHibernateDAO extends GenericHibernateDAO + implements PtoVtaUsuarioBancarioDAO { + + @Autowired + public PtoVtaUsuarioBancarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public void borrarFisico(PtoVtaUsuarioBancario pto2) { + String hql = " delete from PtoVtaUsuarioBancario " + + " where ptovtaUsuarioBancarioID = " + pto2.getPtovtaUsuarioBancarioID(); + Query sq = getSession().createQuery(hql); + sq.executeUpdate(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAgenciaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAgenciaHibernateDAO.java new file mode 100644 index 000000000..d5e62eb67 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAgenciaHibernateDAO.java @@ -0,0 +1,53 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaAgenciaDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaAgencia; +import com.rjconsultores.ventaboletos.entidad.InstiFinanceira; + +@Repository("ptovtaAgenciaBancariaDAO") +public class PtovtaAgenciaHibernateDAO extends GenericHibernateDAO + implements PtovtaAgenciaDAO { + + @Autowired + public PtovtaAgenciaHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("numagencia")); + + return c.list(); + } + + public List buscar(String numagencia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numagencia", numagencia)); + + + return c.list(); + } + + public void borrarFisico(PtovtaAgencia pto) { + String hql = " delete from PtovtaAgencia " + + " where ptovtaAgenciaId = " + pto.getPtovtaAgenciaId(); + Query sq = getSession().createQuery(hql); + sq.executeUpdate(); + } +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAntecipacomissaoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAntecipacomissaoHibernateDAO.java new file mode 100644 index 000000000..699dceaa1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAntecipacomissaoHibernateDAO.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaAntecipacomissaoDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaAntecipacomissao; + +@Repository("ptovtaAntecipacomissaoDAO") +public class PtovtaAntecipacomissaoHibernateDAO extends GenericHibernateDAO + implements PtovtaAntecipacomissaoDAO { + + @Autowired + public PtovtaAntecipacomissaoHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("id", id)); + + + return c.list(); + } + + +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAntifraudeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAntifraudeHibernateDAO.java new file mode 100644 index 000000000..7b2998b78 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaAntifraudeHibernateDAO.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.PtovtaAntifraudeDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaAntifraude; + +@Repository("ptovtaAntifraudeHibernateDAO") +public class PtovtaAntifraudeHibernateDAO extends GenericHibernateDAO implements PtovtaAntifraudeDAO { + + @Autowired + public PtovtaAntifraudeHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaCatIndHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaCatIndHibernateDAO.java new file mode 100644 index 000000000..5ed010c2f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaCatIndHibernateDAO.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.PtovtaCatIndDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd; + +@Repository("ptovtaCatIndDAO") +public class PtovtaCatIndHibernateDAO extends GenericHibernateDAO + implements PtovtaCatIndDAO { + + @Autowired + public PtovtaCatIndHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaComissaoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaComissaoHibernateDAO.java new file mode 100644 index 000000000..b86126df8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaComissaoHibernateDAO.java @@ -0,0 +1,66 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PtovtaComissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +@Repository("ptovtaComissaoDAO") +public class PtovtaComissaoHibernateDAO extends GenericHibernateDAO + implements PtovtaComissaoDAO { + + @Autowired + public PtovtaComissaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("id", id)); + + return c.list(); + } + + public List buscarByPuntaVenta(PuntoVenta puntaVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("puntoventaId", puntaVenta)); + + c.addOrder(Order.asc("empresaId")); + + return c.list(); + } + + @Override + public PtovtaComissao buscarPuntaVentaEmpresa(Integer puntaVentaId, Integer empresaId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("puntoventaId", new PuntoVenta(puntaVentaId))); + c.add(Restrictions.eq("empresaId", new Empresa(empresaId))); + c.setMaxResults(1); + + return (PtovtaComissao) c.uniqueResult(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaContaMDHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaContaMDHibernateDAO.java new file mode 100644 index 000000000..c07809f86 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaContaMDHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaContaMDDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaContaMD; + +@Repository("PtovtaContaMDDAO") +public class PtovtaContaMDHibernateDAO extends GenericHibernateDAO implements PtovtaContaMDDAO { + + + @Autowired + public PtovtaContaMDHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public boolean contemItem(PtovtaContaMD ptovtaContaMD) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("empresaId", ptovtaContaMD.getEmpresaId())); + c.add(Restrictions.eq("contaId", ptovtaContaMD.getContaId())); + c.add(Restrictions.eq("puntoventaId", ptovtaContaMD.getPuntoventaId())); + return !c.list().isEmpty(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaDiversosHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaDiversosHibernateDAO.java new file mode 100644 index 000000000..0a19b69dc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaDiversosHibernateDAO.java @@ -0,0 +1,48 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaDiversosDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaDiversos; + + +@Repository("ptovtaDiversosDAO") +public class PtovtaDiversosHibernateDAO extends GenericHibernateDAO + implements PtovtaDiversosDAO { + + @Autowired + public PtovtaDiversosHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("id", id)); + + + return c.list(); + } + + +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaBloqueadaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaBloqueadaHibernateDAO.java new file mode 100644 index 000000000..dfb524f48 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaBloqueadaHibernateDAO.java @@ -0,0 +1,48 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaDiversosDAO; +import com.rjconsultores.ventaboletos.dao.PtovtaEmpresaBloqueadaDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaDiversos; +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaBloqueada; + +@Repository("ptovtaEmpresaBloqueadaDAO") +public class PtovtaEmpresaBloqueadaHibernateDAO extends GenericHibernateDAO + implements PtovtaEmpresaBloqueadaDAO { + + @Autowired + public PtovtaEmpresaBloqueadaHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("ptovtaempbloqueadaId")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("ptovtaempbloqueadaId", id)); + + + return c.list(); + } + + +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaContaBancariaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaContaBancariaHibernateDAO.java new file mode 100644 index 000000000..d7066dbce --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaContaBancariaHibernateDAO.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaEmpresaContaBancariaDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaContaBancaria; + +/** + * + * @author Desenvolvimento + */ +@Repository("ptovtaEmpresaContaBancariaHibernateDAO") +public class PtovtaEmpresaContaBancariaHibernateDAO extends GenericHibernateDAO implements PtovtaEmpresaContaBancariaDAO { + @Autowired + public PtovtaEmpresaContaBancariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public void borrarFisico(PtovtaEmpresaContaBancaria pto) { + String hql = " delete from PtovtaEmpresaContaBancaria " + + " where ptovtaEmpresaContaBancariaId = " + pto.getPtovtaEmpresaContaBancariaId(); + Query sq = getSession().createQuery(hql); + sq.executeUpdate(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaHibernateDAO.java new file mode 100644 index 000000000..825b89b14 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEmpresaHibernateDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.PtovtaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("ptovtaEmpresaDAO") +public class PtovtaEmpresaHibernateDAO extends GenericHibernateDAO + implements PtovtaEmpresaDAO { + + @Autowired + public PtovtaEmpresaHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(PtovtaEmpresa ptovtaEmpresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("empresa", ptovtaEmpresa.getEmpresa())); + c.add(Restrictions.eq("puntoVenta", ptovtaEmpresa.getPuntoVenta())); + + return c.list(); + } + + public void borrarFisico(PtovtaEmpresa pto) { + String hql = " delete from PtovtaEmpresa " + + " where ptovtaempresaId = " + pto.getPtovtaempresaId(); + Query sq = getSession().createQuery(hql); + sq.executeUpdate(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEstoqueHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEstoqueHibernateDAO.java new file mode 100644 index 000000000..3391138d8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaEstoqueHibernateDAO.java @@ -0,0 +1,48 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaEstoqueDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEstoque; + + +@Repository("ptovtaEstoqueDAO") +public class PtovtaEstoqueHibernateDAO extends GenericHibernateDAO + implements PtovtaEstoqueDAO { + + @Autowired + public PtovtaEstoqueHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("id", id)); + + + return c.list(); + } + + +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaHorarioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaHorarioHibernateDAO.java new file mode 100644 index 000000000..ad42e5a88 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaHorarioHibernateDAO.java @@ -0,0 +1,50 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaEstoqueDAO; +import com.rjconsultores.ventaboletos.dao.PtovtaHorarioDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEstoque; +import com.rjconsultores.ventaboletos.entidad.PtovtaHorario; + + +@Repository("ptovtaHorarioDAO") +public class PtovtaHorarioHibernateDAO extends GenericHibernateDAO + implements PtovtaHorarioDAO { + + @Autowired + public PtovtaHorarioHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("id", id)); + + + return c.list(); + } + + +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTipoEstoqueHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTipoEstoqueHibernateDAO.java new file mode 100644 index 000000000..96dedf72f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTipoEstoqueHibernateDAO.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaTipoEstoqueDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; + +@Repository("ptovtaTipoEstoqueDAO") +public class PtovtaTipoEstoqueHibernateDAO extends GenericHibernateDAO implements PtovtaTipoEstoqueDAO { + + @Autowired + public PtovtaTipoEstoqueHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public PtovtaTipoEstoque buscarTipoSuprimento() { + PtovtaTipoEstoque tipo = buscarTipo(PtovtaTipoEstoque.TIPO_SUMINISTRO); + return tipo; + } + + @Override + public PtovtaTipoEstoque buscarTipoContabilidade() { + PtovtaTipoEstoque tipo = buscarTipo(PtovtaTipoEstoque.TIPO_CONTABILIDAD); + return tipo; + } + + @Override + public PtovtaTipoEstoque buscarTipoNormal() { + PtovtaTipoEstoque tipo = buscarTipo(PtovtaTipoEstoque.TIPO_NORMAL); + return tipo; + } + + private PtovtaTipoEstoque buscarTipo(int tipo) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("ptovtatipoestId", tipo)); + + return (PtovtaTipoEstoque) c.uniqueResult(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTitularHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTitularHibernateDAO.java new file mode 100644 index 000000000..5abd9cbf6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTitularHibernateDAO.java @@ -0,0 +1,49 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaTitularDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaTitular; + + + +@Repository("ptovtaTitularDAO") +public class PtovtaTitularHibernateDAO extends GenericHibernateDAO + implements PtovtaTitularDAO { + + @Autowired + public PtovtaTitularHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("id")); + + return c.list(); + } + + public List buscar(int id) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("id", id)); + + + return c.list(); + } + + +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java new file mode 100644 index 000000000..87c0d99fb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java @@ -0,0 +1,294 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.BooleanType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaTipoEstoqueDAO; +import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer.DatosPuntoVentaResultTransformer; + +/** + * + * @author Administrador + */ +@Repository("puntoVentaDAO") +public class PuntoVentaHibernateDAO extends GenericHibernateDAO + implements PuntoVentaDAO { + + public static final int ID_PUNTO_VENTA_TODOS = -1; + + @Autowired + private PtovtaTipoEstoqueDAO ptovtaTipoEstoqueDAO; + + @Autowired + public PuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.addOrder(Order.asc("nombpuntoventa")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaLike(String strEstacion, boolean sinTodos) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + Criterion cr1 = Restrictions.like("nombpuntoventa", strEstacion, MatchMode.START); + + Criterion crActivo = Restrictions.eq("activo", Boolean.TRUE); + + if (sinTodos) { + Criterion crSinTodos = Restrictions.ne("puntoventaId", ID_PUNTO_VENTA_TODOS); + c.add(crSinTodos); + } + + PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento(); + PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade(); + + Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[] { supr, cont }); + + Criterion pt2 = Restrictions.or(crActivo, suprCont); + + c.add(Restrictions.and(cr1, pt2)); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List busca(String nomPuntoVenta, String numPuntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("nombpuntoventa", nomPuntoVenta)); + c.add(Restrictions.eq("numPuntoVenta", numPuntoVenta)); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaPuntoVenta(String numPuntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numPuntoVenta", numPuntoVenta)); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaPuntoVentaEmpresa(Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa", empresa)); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaPuntoVentaParada(Parada parada) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("parada", parada)); + c.addOrder(Order.asc("nombpuntoventa")); + + return c.list(); + } + + @Override + public List buscaPuntoVentaEmpresaSemECF(Empresa empresa) { + StringBuilder sb = new StringBuilder(); + sb.append(" select "); + sb.append(" DISTINCT "); + sb.append(" pvaux.PUNTOVENTA_ID as puntoventaId, "); + sb.append(" pvaux.NOMBPUNTOVENTA as nombpuntoventa "); + sb.append(" from "); + sb.append(" PUNTO_VENTA pvaux "); + sb.append(" join PTOVTA_EMPRESA PTOVTAE "); + sb.append(" ON (PTOVTAE.PUNTOVENTA_ID = PVAUX.PUNTOVENTA_ID) "); + sb.append(" where "); + sb.append(" pvaux.PUNTOVENTA_ID not in ( "); + sb.append(" SELECT "); + sb.append(" DISTINCT pv.PUNTOVENTA_ID "); + sb.append(" FROM "); + sb.append(" PUNTO_VENTA pv "); + sb.append(" INNER JOIN "); + sb.append(" ESTACION E "); + sb.append(" ON pv.PUNTOVENTA_ID = E .PUNTOVENTA_ID "); + sb.append(" INNER JOIN "); + sb.append(" ESTACION_IMPRESORA ei "); + sb.append(" ON ei.ESTACION_ID = E .ESTACION_ID "); + sb.append(" WHERE "); + sb.append(" ( (ei.TIPOIMPRESSORA = 1 "); + sb.append(" OR ei.TIPOIMPRESSORA = 2) ) "); + sb.append(" AND ei.ACTIVO = 1 "); + sb.append(" AND ei.EMPRESA_ID = :empresa_id "); + sb.append(" /* ORDER BY PUNTOVENTA_ID*/ "); + sb.append(" ) "); + sb.append(" and PTOVTAE.EMPRESA_ID = :empresa_id "); + sb.append(" and PTOVTAE.ACTIVO = 1 "); + sb.append(" AND pvaux.ACTIVO = 1 "); + sb.append(" AND pvaux.PUNTOVENTA_ID <> -1 "); + sb.append(" ORDER BY "); + sb.append(" pvaux.PUNTOVENTA_ID "); + SQLQuery sql = getSession().createSQLQuery(sb.toString()) + .addScalar("puntoventaId", IntegerType.INSTANCE) + .addScalar("nombpuntoventa", StringType.INSTANCE); + sql.setInteger("empresa_id", empresa.getEmpresaId()); + sql.setResultTransformer(new AliasToBeanResultTransformer(PuntoVentaVO.class)); + @SuppressWarnings("unchecked") + List puntosVenta = sql.list(); + return puntosVenta; + + } + + @SuppressWarnings("unchecked") + @Override + public List buscarPuntoVentaSubordinados(PuntoVenta puntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("puntoVentaPadre", puntoVenta)); + + return c.list(); + } + + @Override + public List buscarPuntosVentaMovimentacionBilhetes(List empresas) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + + Criterion crtPtovta = Restrictions.and(Restrictions.eq("activo", Boolean.TRUE), Restrictions.in("empresa", empresas)); + + PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento(); + PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade(); + + Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[] { supr, cont }); + + c.add(Restrictions.or(suprCont, crtPtovta)); + + c.addOrder(Order.asc("nombpuntoventa")); + @SuppressWarnings("unchecked") + List puntosVenta = c.list(); + + // List puntosVenta = geraListaDummy(); + + return puntosVenta; + } + + @Override + public List buscarPuntoVentaPorTipoEstoque(PtovtaTipoEstoque tipoEstoque) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("ptovtaTipoEstoque", tipoEstoque)); + + @SuppressWarnings("unchecked") + List puntosVenta = c.list(); + + return puntosVenta; + } + + @SuppressWarnings("unused") + private List geraListaDummy() { + + Criteria c = getSession().createCriteria(getPersistentClass()); + + PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento(); + PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade(); + + Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[] { supr, cont }); + + Criterion crtPtovta = Restrictions.in("puntoventaId", new Integer[] { 1, 2, 3, 786, 1321, 1722 }); + + c.add(Restrictions.or(suprCont, crtPtovta)); + @SuppressWarnings("unchecked") + List puntosVenta = c.list(); + + return puntosVenta; + } + + @Override + @SuppressWarnings("unchecked") + public List quantidadeECFPorPuntoVenta(Conferencia conferencia) { + + StringBuilder sql = new StringBuilder(); + + sql.append("SELECT imp.NUMSERIE20 "); + sql.append("FROM CAJA c "); + sql.append("INNER JOIN fiscal_impressora imp ON c.serieimpfiscal = imp.numserie "); + sql.append("LEFT JOIN fiscal_r2 r2 ON r2.numserie20 = imp.numserie20 "); + sql.append("AND r2.datamov = to_char(c.feccreacion, 'yyyymmdd') "); + sql.append("LEFT JOIN fiscal_r4 r4 ON c.caja_id = r4.caja_id "); + sql.append("WHERE c.serieimpfiscal IS NOT NULL "); + sql.append(" AND c.PUNTOVENTA_ID =:puntoVentaId and c.EMPRESACORRIDA_ID =:empresaId "); + sql.append(" AND C.FECHORVENTA BETWEEN cast(:dataInicio AS DATE) and cast(:dataFim AS DATE) "); + sql.append("GROUP BY imp.NUMSERIE20 "); + + Query q = getSession().createSQLQuery(sql.toString()); + + q.setInteger("puntoVentaId", conferencia.getPuntoVenta().getPuntoventaId()); + q.setInteger("empresaId", conferencia.getEmpresa().getEmpresaId()); + q.setTimestamp("dataInicio", DateUtil.inicioFecha(conferencia.getDatamovimento())); + q.setTimestamp("dataFim", DateUtil.fimFecha(conferencia.getDatamovimento())); + + return q.list(); + } + + @Override + @SuppressWarnings("unchecked") + public List buscarPuntoVentaPtoVtaComissao(List empresas) { + StringBuilder sQuery = new StringBuilder("SELECT DISTINCT pv.PUNTOVENTA_ID, pv.NOMBPUNTOVENTA, pv.ACTIVO "); + sQuery.append("FROM PTOVTA_COMISSAO ptovta ") + .append("JOIN PUNTO_VENTA pv ON pv.puntoventa_id = ptovta.puntoventa_id ") + .append("JOIN EMPRESA em ON em.empresa_id = ptovta.empresa_id ") + .append("WHERE ptovta.activo = 1 ") + .append("AND pv.activo = 1 ") + .append("AND em.activo = 1 ") + .append("AND em.empresa_id in (:empresas)"); + + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("PUNTOVENTA_ID", IntegerType.INSTANCE) + .addScalar("NOMBPUNTOVENTA", StringType.INSTANCE) + .addScalar("ACTIVO", BooleanType.INSTANCE) + .setResultTransformer(new DatosPuntoVentaResultTransformer()); + + qr.setParameterList("empresas", empresas); + + return qr.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ReceitaDespesaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReceitaDespesaHibernateDAO.java new file mode 100644 index 000000000..5cab7fec1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReceitaDespesaHibernateDAO.java @@ -0,0 +1,421 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.sql.DataSource; + +import org.apache.commons.lang.BooleanUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ReceitaDespesaDAO; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.relatorios.receitaDespesa.RelatorioFinanceiroReceitasDespesasBean; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +@Repository("receitaDespesaDAO") +public class ReceitaDespesaHibernateDAO implements ReceitaDespesaDAO { + + private static Logger log = Logger.getLogger(ReceitaDespesaHibernateDAO.class); + + @Autowired + private DataSource dataSourceRead; + + private Map parametrosFiltro; + + @Override + public List getRelatorioDetalhado(Map parametros) throws BusinessException { + Connection con = null; + try { + con = dataSourceRead.getConnection(); + + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT ") + .append("LISTAGG(fp.cvepago||' /'||CAST(cfp.IMPORTE AS VARCHAR(10)),';') WITHIN GROUP( ORDER BY 1 DESC ) AS descpago,") + .append(" C.FECHORVTA, P.PUNTOVENTA_ID, P.NOMBPUNTOVENTA, P.NUMPUNTOVENTA, TE.TIPOEVENTOEXTRA_ID, TE.DESCTIPOEVENTO, ") + .append(" C.NUMSERIEPREIMPRESA, C.NUMFOLIOPREIMPRESO, E.NUMDOCUMENTO,E.EVENTOEXTRA_ID ") + .append(" FROM CAJA_DIVERSOS C ") + .append(" JOIN EVENTO_EXTRA E ON E.EVENTOEXTRA_ID = C.EVENTOEXTRA_ID ") + .append(" JOIN TIPO_EVENTO_EXTRA TE ON TE.TIPOEVENTOEXTRA_ID = E.TIPOEVENTOEXTRA_ID ") + .append(" JOIN PUNTO_VENTA P ON P.PUNTOVENTA_ID = C.PUNTOVENTA_ID ") + .append(" JOIN CAJA_DIVERSOS_PAGO cfp ON ( c.cajadiversos_id = cfp.cajadiversos_id)") + .append(" JOIN FORMA_PAGO fp ON ( cfp.formapago_id = fp.formapago_id )") + .append(" LEFT JOIN BOLETO B ON B.BOLETO_ID = E.BOLETO_ID ") + .append("WHERE C.ACTIVO = 1 "); + + adicionarFiltros(sql, parametros); + + sql.append(" GROUP BY ") + .append("c.fechorvta, ") + .append("p.puntoventa_id, ") + .append("p.nombpuntoventa, ") + .append("p.numpuntoventa, ") + .append("te.tipoeventoextra_id, ") + .append("te.desctipoevento, ") + .append("c.numseriepreimpresa, ") + .append("c.numfoliopreimpreso, ") + .append("e.numdocumento, ") + .append("e.eventoextra_id "); + + sql.append("ORDER BY C.FECHORVTA, TE.DESCTIPOEVENTO, P.NOMBPUNTOVENTA, P.NUMPUNTOVENTA"); + + NamedParameterStatement stmt = new NamedParameterStatement(con, sql.toString()); + setParametros(stmt); + + ResultSet resultSet = stmt.executeQuery(); + List lsBean = new ArrayList(); + while (resultSet.next()) { + RelatorioFinanceiroReceitasDespesasBean bean = new RelatorioFinanceiroReceitasDespesasBean(); + bean.setDescTipoEvento(resultSet.getString("DESCTIPOEVENTO")); + bean.setFecHorVta(resultSet.getDate("FECHORVTA")); + bean.setTipoEventoExtraId(resultSet.getString("TIPOEVENTOEXTRA_ID")); + bean.setNombPuntoVenta(resultSet.getString("NOMBPUNTOVENTA")); + bean.setNumPuntoVenta(resultSet.getString("NUMPUNTOVENTA")); + bean.setPuntoVentaId(resultSet.getInt("PUNTOVENTA_ID")); + bean.setFormaPagamento(resultSet.getString("DESCPAGO")); + bean.setNumSeriePreImpresa(resultSet.getString("NUMSERIEPREIMPRESA")); + bean.setNumFolioPreImpreso(resultSet.getString("NUMFOLIOPREIMPRESO")); + bean.setNumDocumento(resultSet.getString("NUMDOCUMENTO")); + setFormasDePagamento(bean); + setValorFormaPagamento(bean); + + bean.setIndtipo(MoneyHelper.isMaiorIgual(bean.getPrecio(), BigDecimal.ZERO) ? 1 : 0); + lsBean.add(bean); + } + + return lsBean; + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + }finally { + try { + if (con != null && !con.isClosed()) { + con.close(); + } + } + catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + } + + @Override + public List getRelatorioSintetico(Map parametros) throws BusinessException { + Connection con = null; + try { + con = dataSourceRead.getConnection(); + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT P.PUNTOVENTA_ID, P.NOMBPUNTOVENTA, P.NUMPUNTOVENTA, CDP.IMPORTE ") + .append("FROM CAJA_DIVERSOS C ") + .append("JOIN EVENTO_EXTRA E ON E.EVENTOEXTRA_ID = C.EVENTOEXTRA_ID ") + .append("JOIN TIPO_EVENTO_EXTRA TE ON TE.TIPOEVENTOEXTRA_ID = E.TIPOEVENTOEXTRA_ID ") + .append("JOIN PUNTO_VENTA P ON P.PUNTOVENTA_ID = C.PUNTOVENTA_ID ") + .append("JOIN CAJA_DIVERSOS_PAGO CDP ON CDP.CAJADIVERSOS_ID = C.CAJADIVERSOS_ID ") + .append("LEFT JOIN BOLETO B ON B.BOLETO_ID = E.BOLETO_ID ") + .append("WHERE C.ACTIVO = 1 "); + + adicionarFiltros(sql, parametros); + + sql.append("ORDER BY P.NOMBPUNTOVENTA, P.NUMPUNTOVENTA"); + + NamedParameterStatement stmt = new NamedParameterStatement(con, sql.toString()); + setParametros(stmt); + + ResultSet resultSet = stmt.executeQuery(); + Map map = new HashMap(); + while (resultSet.next()) { + RelatorioFinanceiroReceitasDespesasBean bean = new RelatorioFinanceiroReceitasDespesasBean(); + bean.setPuntoVentaId(resultSet.getInt("PUNTOVENTA_ID")); + bean.setNombPuntoVenta(resultSet.getString("NOMBPUNTOVENTA")); + bean.setNumPuntoVenta(resultSet.getString("NUMPUNTOVENTA")); + + if(map.containsKey(bean.getPuntoVentaId())) { + bean = map.get(bean.getPuntoVentaId()); + } + + BigDecimal precio = resultSet.getBigDecimal("IMPORTE"); + if(MoneyHelper.isMaiorIgual(precio, BigDecimal.ZERO)) { + bean.setReceita(MoneyHelper.somar(bean.getReceita(), precio)); + } else { + bean.setDespesa(MoneyHelper.somar(bean.getDespesa(), precio)); + } + + map.put(bean.getPuntoVentaId(), bean); + } + List lsBean = new ArrayList(map.values()); + + return lsBean; + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + }finally { + try { + if (con != null && !con.isClosed()) { + con.close(); + } + } + catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + } + + @Override + public List getRelatorioAgencia(Map parametros) throws BusinessException { + Connection con = null; + try { + con = dataSourceRead.getConnection(); + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT P.PUNTOVENTA_ID, P.NOMBPUNTOVENTA, P.NUMPUNTOVENTA, TE.TIPOEVENTOEXTRA_ID, TE.DESCTIPOEVENTO, ") + .append("SUM(CDP.IMPORTE) PRECIO ") + .append("FROM CAJA_DIVERSOS C ") + .append("JOIN EVENTO_EXTRA E ON E.EVENTOEXTRA_ID = C.EVENTOEXTRA_ID ") + .append("JOIN TIPO_EVENTO_EXTRA TE ON TE.TIPOEVENTOEXTRA_ID = E.TIPOEVENTOEXTRA_ID ") + .append("JOIN PUNTO_VENTA P ON P.PUNTOVENTA_ID = C.PUNTOVENTA_ID ") + .append("JOIN CAJA_DIVERSOS_PAGO CDP ON CDP.CAJADIVERSOS_ID = C.CAJADIVERSOS_ID ") + .append("LEFT JOIN BOLETO B ON B.BOLETO_ID = E.BOLETO_ID ") + .append("WHERE C.ACTIVO = 1 "); + + adicionarFiltros(sql, parametros); + + sql.append("GROUP BY P.PUNTOVENTA_ID, P.NOMBPUNTOVENTA, P.NUMPUNTOVENTA, TE.TIPOEVENTOEXTRA_ID, TE.DESCTIPOEVENTO ") + .append("ORDER BY P.NOMBPUNTOVENTA, P.NUMPUNTOVENTA, TE.DESCTIPOEVENTO"); + + NamedParameterStatement stmt = new NamedParameterStatement(con, sql.toString()); + setParametros(stmt); + + ResultSet resultSet = stmt.executeQuery(); + List lsBean = new ArrayList(); + while (resultSet.next()) { + RelatorioFinanceiroReceitasDespesasBean bean = new RelatorioFinanceiroReceitasDespesasBean(); + bean.setPuntoVentaId(resultSet.getInt("PUNTOVENTA_ID")); + bean.setNombPuntoVenta(resultSet.getString("NOMBPUNTOVENTA")); + bean.setNumPuntoVenta(resultSet.getString("NUMPUNTOVENTA")); + bean.setPrecio(resultSet.getBigDecimal("PRECIO")); + bean.setIndtipo(MoneyHelper.isMaiorIgual(bean.getPrecio(), BigDecimal.ZERO) ? 1 : 0); + bean.setTipoEventoExtraId(resultSet.getString("TIPOEVENTOEXTRA_ID")); + bean.setDescTipoEvento(resultSet.getString("DESCTIPOEVENTO")); + lsBean.add(bean); + } + + return lsBean; + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + }finally { + try { + if (con != null && !con.isClosed()) { + con.close(); + } + } + catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + } + + @Override + public List getRelatorioEvento(Map parametros) throws BusinessException { + Connection con = null; + try { + con = dataSourceRead.getConnection(); + + StringBuilder sql = new StringBuilder(); + sql.append("SELECT P.PUNTOVENTA_ID, P.NOMBPUNTOVENTA, P.NUMPUNTOVENTA, TE.TIPOEVENTOEXTRA_ID, TE.DESCTIPOEVENTO, ") + .append("SUM(CDP.IMPORTE) PRECIO ") + .append("FROM CAJA_DIVERSOS C ") + .append("JOIN EVENTO_EXTRA E ON E.EVENTOEXTRA_ID = C.EVENTOEXTRA_ID ") + .append("JOIN TIPO_EVENTO_EXTRA TE ON TE.TIPOEVENTOEXTRA_ID = E.TIPOEVENTOEXTRA_ID ") + .append("JOIN PUNTO_VENTA P ON P.PUNTOVENTA_ID = C.PUNTOVENTA_ID ") + .append("JOIN CAJA_DIVERSOS_PAGO CDP ON CDP.CAJADIVERSOS_ID = C.CAJADIVERSOS_ID ") + .append("LEFT JOIN BOLETO B ON B.BOLETO_ID = E.BOLETO_ID ") + .append("WHERE C.ACTIVO = 1 "); + + adicionarFiltros(sql, parametros); + + sql.append("GROUP BY P.PUNTOVENTA_ID, P.NOMBPUNTOVENTA, P.NUMPUNTOVENTA, TE.TIPOEVENTOEXTRA_ID, TE.DESCTIPOEVENTO ") + .append("ORDER BY TE.TIPOEVENTOEXTRA_ID, TE.DESCTIPOEVENTO, P.NOMBPUNTOVENTA"); + + NamedParameterStatement stmt = new NamedParameterStatement(con, sql.toString()); + setParametros(stmt); + + ResultSet resultSet = stmt.executeQuery(); + List lsBean = new ArrayList(); + while (resultSet.next()) { + RelatorioFinanceiroReceitasDespesasBean bean = new RelatorioFinanceiroReceitasDespesasBean(); + bean.setPuntoVentaId(resultSet.getInt("PUNTOVENTA_ID")); + bean.setNombPuntoVenta(resultSet.getString("NOMBPUNTOVENTA")); + bean.setNumPuntoVenta(resultSet.getString("NUMPUNTOVENTA")); + bean.setPrecio(resultSet.getBigDecimal("PRECIO")); + bean.setIndtipo(MoneyHelper.isMaiorIgual(bean.getPrecio(), BigDecimal.ZERO) ? 1 : 0); + bean.setTipoEventoExtraId(resultSet.getString("TIPOEVENTOEXTRA_ID")); + bean.setDescTipoEvento(resultSet.getString("DESCTIPOEVENTO")); + lsBean.add(bean); + } + + return lsBean; + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + }finally { + try { + if (con != null && !con.isClosed()) { + con.close(); + } + } + catch (SQLException e) { + log.error(e.getMessage(), e); + } + } + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private void adicionarFiltros(StringBuilder sql, Map parametros) { + parametrosFiltro = new HashMap(); + sql.append(" AND (E.BOLETO_ID IS NULL OR E.BOLETO_ID = B.BOLETO_ID) "); + + if(parametros.containsKey("empresaId")) { + sql.append("AND E.EMPRESA_ID = :empresaId "); + parametrosFiltro.put("empresaId", parametros.get("empresaId")); + } + + boolean isDataFechamentoCaixa = parametros.get("isDataFechamentoCaixa") != null ? BooleanUtils.toBoolean(parametros.get("isDataFechamentoCaixa").toString()) : false; + + if(isDataFechamentoCaixa) { + if(parametros.containsKey("fecInicio")) { + sql.append("AND C.FECCORTE >= TO_DATE(:fecInicio,'DD/MM/YYYY HH24:MI') "); + parametrosFiltro.put("fecInicio", parametros.get("fecInicio")); + } + + if(parametros.containsKey("fecFinal")) { + sql.append("AND C.FECCORTE <= TO_DATE(:fecFinal,'DD/MM/YYYY HH24:MI') "); + parametrosFiltro.put("fecFinal", parametros.get("fecFinal")); + } + } else { + if(parametros.containsKey("fecInicio")) { + sql.append("AND C.FECHORVTA >= TO_DATE(:fecInicio,'DD/MM/YYYY HH24:MI') "); + parametrosFiltro.put("fecInicio", parametros.get("fecInicio")); + } + + if(parametros.containsKey("fecFinal")) { + sql.append("AND C.FECHORVTA <= TO_DATE(:fecFinal,'DD/MM/YYYY HH24:MI') "); + parametrosFiltro.put("fecFinal", parametros.get("fecFinal")); + } + } + + if(parametros.containsKey("numDocumento")) { + sql.append("AND E.NUMDOCUMENTO = :numDocumento "); + parametrosFiltro.put("numDocumento", parametros.get("numDocumento")); + } + + if(parametros.containsKey("indTipo")) { + sql.append("AND TE.INDTIPO = :indTipo "); + parametrosFiltro.put("indTipo", parametros.get("indTipo")); + } + + if(parametros.containsKey("lsPuntoVenta")) { + List values = parametros.get("lsPuntoVenta") instanceof Collection ? new ArrayList((Collection) parametros.get("lsPuntoVenta")) : new ArrayList(((List) parametros.get("lsPuntoVenta"))); + int size = values.size(); + Integer[] ls = new Integer[size]; + for (int i = 0; i < size; i++) { + ls[i] = Integer.valueOf((values.get(i).toString())); + } + sql.append("AND C.PUNTOVENTA_ID IN (" + StringUtils.join(ls, ',') + ") "); + } + + if(parametros.containsKey("lsEventosExtra")) { + List values = parametros.get("lsEventosExtra") instanceof Collection ? new ArrayList((Collection) parametros.get("lsEventosExtra")) : new ArrayList(((List) parametros.get("lsEventosExtra"))); + int size = values.size(); + Integer[] ls = new Integer[size]; + for (int i = 0; i < size; i++) { + ls[i] = Integer.valueOf((values.get(i).toString())); + } + sql.append("AND TE.TIPOEVENTOEXTRA_ID IN (" + StringUtils.join(ls, ',') + ") "); + } + } + + private void setParametros(NamedParameterStatement stmt) throws SQLException { + for (Entry parametro : parametrosFiltro.entrySet()) { + stmt.setObject(parametro.getKey(), parametro.getValue()); + } + } + + private void setFormasDePagamento(RelatorioFinanceiroReceitasDespesasBean bean) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { + String formasPagamento = bean.getFormaPagamento(); + if (formasPagamento != null) { + + final String[] formaPagamento = formasPagamento.split("\\;") ; + if (formaPagamento.length > 1) { + int contador = 0; + while (contador < formaPagamento.length) { + final Class cls = bean.getClass(); + final String metodo = "setFormaPagamento" + (contador+1); + Method meth = cls.getMethod(metodo, String.class); + meth.invoke(bean, formatarFormaDePagamento(formaPagamento[contador])); + contador++; + } + } else { + bean.setFormaPagamento1(formatarFormaDePagamento(formaPagamento[0])); + } + } + } + + + private void setValorFormaPagamento(RelatorioFinanceiroReceitasDespesasBean bean) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException { + String formasPagamento = bean.getFormaPagamento(); + if (formasPagamento != null) { + + final String[] formaPagamento = formasPagamento.split("\\;") ; + if (formaPagamento.length > 1) { + int contador = 0; + while (contador < formaPagamento.length) { + final Class cls = bean.getClass(); + final String metodo = "setValorFormaPagamento" + (contador+1); + Method meth = cls.getMethod(metodo, BigDecimal.class); + meth.invoke(bean, formatarValorFormaDePagamento(formaPagamento[contador])); + contador++; + } + } else { + bean.setValorFormaPagamento1(formatarValorFormaDePagamento(formaPagamento[0])); + } + } + + bean.setPrecio(MoneyHelper.somar(bean.getValorFormaPagamento1(), bean.getValorFormaPagamento2(), bean.getValorFormaPagamento3())); + } + + private String formatarFormaDePagamento(String formaDePagamento){ + if(formaDePagamento!=null){ + final String[] formaPagamentoAuxilar = formaDePagamento.split("\\/") ; + return formaPagamentoAuxilar[0]; + } + return null; + } + + private BigDecimal formatarValorFormaDePagamento(String formaDePagamento){ + if(formaDePagamento!=null){ + final String[] formaPagamentoAuxilar = formaDePagamento.split("\\/") ; + return formaPagamentoAuxilar.length>1? new BigDecimal(formaPagamentoAuxilar[1].replace(",", ".").trim()):new BigDecimal("0.0"); + } + return null; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoCtrlHibernateDAO.java new file mode 100644 index 000000000..8871712b8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoCtrlHibernateDAO.java @@ -0,0 +1,113 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.RedondeoCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.RedondeoCtrl; +import com.rjconsultores.ventaboletos.entidad.RedondeoMarca; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("redondeoCtrlDAO") +public class RedondeoCtrlHibernateDAO extends GenericHibernateDAO + implements RedondeoCtrlDAO { + + private static Logger log = Logger.getLogger(RedondeoCtrlHibernateDAO.class); + + @Autowired + public RedondeoCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(RedondeoCtrl redondeoCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + List lsShort = new ArrayList(); + for (RedondeoMarca rm : redondeoCtrl.getRedondeoMarcaList()) { + lsShort.add(rm.getMarca().getMarcaId()); + } + c.createCriteria("redondeoMarcaList").add(Restrictions.in("marca.marcaId", lsShort)); + + return c.list(); + + } + + public List buscarTraslapa(Short[] iDMarcas, BigDecimal valorinicial, BigDecimal valorfinal, Boolean indaplicadescuento, + Boolean indaplicapricing, Boolean indaplicaAtersp) { + + String ids = ""; + for (int i = 0; i < iDMarcas.length; i++) { + ids = ids.concat(iDMarcas[i].toString().concat(",")); + } + ids = ids.substring(0, ids.length() - 1); + + + StringBuilder hql = new StringBuilder("select rc from RedondeoCtrl rc "); + hql.append(" join rc.redondeoList r "); + hql.append(" join rc.redondeoMarcaList rm "); + hql.append(" where rc.activo = 1 and r.activo = 1 and rm.activo = 1 "); + if (indaplicaAtersp) { + hql.append(" and rc.indaplicaArtesp = :aplicaArtesp "); + } else if (indaplicadescuento && !indaplicapricing) { + hql.append(" and rc.indaplicadescuento = :aplicaDescuento "); + } else if (!indaplicadescuento && indaplicapricing) { + hql.append(" and rc.indaplicapricing = :aplicaPricing "); + } else if (indaplicadescuento && indaplicapricing) { + hql.append(" and rc.indaplicadescuento = :aplicaDescuento or rc.indaplicapricing = :aplicaPricing "); + } else if (!indaplicadescuento && !indaplicapricing) { + hql.append(" and rc.indaplicadescuento = :aplicaDescuento and rc.indaplicapricing = :aplicaPricing "); + } + hql.append(" and rm.marca.marcaId in (" + ids + ") and "); + hql.append(" (((:vlrIni BETWEEN r.valorinicial AND r.valorfinal) "); + hql.append(" OR (:vlrFin BETWEEN r.valorinicial AND r.valorfinal)) "); + hql.append(" OR ((r.valorinicial BETWEEN :vlrIni AND :vlrFin) "); + hql.append(" OR (r.valorfinal BETWEEN :vlrIni AND :vlrFin))) "); + hql.append(" and r.activo =:activo "); + + log.debug("Select: " + hql.toString()); + Query sq = getSession().createQuery(hql.toString()); + sq.setDouble("vlrIni", valorinicial.doubleValue()); + sq.setDouble("vlrFin", valorfinal.doubleValue()); + sq.setInteger("activo", 1); + + if (indaplicaAtersp) { + sq.setBoolean("aplicaArtesp", indaplicaAtersp); + } else if (indaplicadescuento && !indaplicapricing) { + sq.setBoolean("aplicaDescuento", indaplicadescuento); + } else if (!indaplicadescuento && indaplicapricing) { + sq.setBoolean("aplicaPricing", indaplicapricing); + } else { + sq.setBoolean("aplicaDescuento", indaplicadescuento); + sq.setBoolean("aplicaPricing", indaplicapricing); + } + + + return sq.list(); + + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoHibernateDAO.java new file mode 100644 index 000000000..5da3d67f2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoHibernateDAO.java @@ -0,0 +1,60 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.RedondeoDAO; +import com.rjconsultores.ventaboletos.entidad.Redondeo; +import java.math.BigDecimal; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("redondeoDAO") +public class RedondeoHibernateDAO extends GenericHibernateDAO + implements RedondeoDAO { + + @Autowired + public RedondeoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(BigDecimal valorInicial, BigDecimal valorFinal, + BigDecimal valorRedondeo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("valorinicial", valorInicial)); + c.add(Restrictions.eq("valorfinal", valorFinal)); + c.add(Restrictions.eq("valorredondeo", valorRedondeo)); + + return c.list(); + } + + public List buscar(BigDecimal valorInicial, BigDecimal valorFinal) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.ge("valorinicial", valorInicial)); + c.add(Restrictions.le("valorfinal", valorFinal)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoMarcaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoMarcaHibernateDAO.java new file mode 100644 index 000000000..c701ab081 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RedondeoMarcaHibernateDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.RedondeoMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.RedondeoMarca; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("redondeoMarcaDAO") +public class RedondeoMarcaHibernateDAO extends GenericHibernateDAO + implements RedondeoMarcaDAO { + + @Autowired + public RedondeoMarcaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(Marca marca) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("marca", marca)); + + return c.list(); + } + + public List obtenerTodasMarcas(Short[] iDMarcas) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.in("marca.marcaId", iDMarcas)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RegionMetropolitanaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RegionMetropolitanaHibernateDAO.java new file mode 100644 index 000000000..7b29c3dfa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RegionMetropolitanaHibernateDAO.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.RegionMetropolitanaDAO; +import com.rjconsultores.ventaboletos.entidad.RegionMetropolitana; + +@Repository("regionMetropolitanaDAO") +public class RegionMetropolitanaHibernateDAO extends GenericHibernateDAO + implements RegionMetropolitanaDAO { + + @Autowired + public RegionMetropolitanaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RelatorioAgepanHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RelatorioAgepanHibernateDAO.java new file mode 100644 index 000000000..e85f3eaec --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RelatorioAgepanHibernateDAO.java @@ -0,0 +1,139 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; +import java.util.Map; + +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.BigDecimalType; +import org.hibernate.type.DateType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.orm.hibernate3.support.HibernateDaoSupport; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.RelatorioAgepanDAO; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.OrgaoConcedente.RelatorioGratuidadeAgepanVO; + +@Repository("relatorioAgepanDAO") +public class RelatorioAgepanHibernateDAO extends HibernateDaoSupport implements RelatorioAgepanDAO { + + public static int ORGAOCONCEDENTE_ID_AGEPAN = 4; + + @Autowired + public RelatorioAgepanHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List listar(Map parametros) throws BusinessException { + try { + + String fecInicioVenda = null; + if (parametros.get("fecInicioVenda") != null) { + fecInicioVenda = parametros.get("fecInicioVenda").toString() + " 00:00"; + } + String fecFinalVenda = null; + if (parametros.get("fecFinalVenda") != null) { + fecFinalVenda = parametros.get("fecFinalVenda").toString() + " 23:59"; + } + + String tipGratuIds = parametros.get("tipGratuIds").toString(); + String linhaIds = parametros.get("linhaIds").toString(); + Integer empresa = parametros.get("empresa") != null ? Integer.valueOf(parametros.get("empresa").toString()) : null; + + String sQuery = getSql(fecInicioVenda, fecFinalVenda, linhaIds, tipGratuIds, empresa); + + Query qr = getSession().createSQLQuery(sQuery) + .addScalar("numBpe", StringType.INSTANCE) + .addScalar("fechorventa", DateType.INSTANCE) + .addScalar("origenId", IntegerType.INSTANCE) + .addScalar("puntoventaId", IntegerType.INSTANCE) + .addScalar("origem", StringType.INSTANCE) + .addScalar("destino", StringType.INSTANCE) + .addScalar("dhemb", StringType.INSTANCE) + .addScalar("nombpasajero", StringType.INSTANCE) + .addScalar("desctipodoc", StringType.INSTANCE) + .addScalar("descnumdoc", StringType.INSTANCE) + .addScalar("desctipodoc2", StringType.INSTANCE) + .addScalar("descnumdoc2", StringType.INSTANCE) + .addScalar("corridaextra", StringType.INSTANCE) + .addScalar("tiposervicobpe", StringType.INSTANCE) + .addScalar("fechorviaje", DateType.INSTANCE) + .addScalar("prefixo", StringType.INSTANCE) + .addScalar("numasiento", StringType.INSTANCE) + .addScalar("totalbilhete", BigDecimalType.INSTANCE) + .addScalar("totalbase", BigDecimalType.INSTANCE) + .addScalar("descontobpe", StringType.INSTANCE) + .addScalar("chbpe", StringType.INSTANCE) + .setResultTransformer(new AliasToBeanResultTransformer(RelatorioGratuidadeAgepanVO.class)); + + + qr.setParameter("agepanId", ORGAOCONCEDENTE_ID_AGEPAN); + qr.setParameter("fecInicioVenda", fecInicioVenda); + qr.setParameter("fecFinalVenda", fecFinalVenda); + if (empresa != null){ + qr.setParameter("empresaId", empresa); + } + + List retorno = qr.list(); + if(retorno == null || retorno.isEmpty()) { + throw new BusinessException("MSG.ningunRegistroRelatorio"); + } + + return retorno; + + } catch (BusinessException e) { + throw e; + } catch (Exception e) { + throw new BusinessException(e.getMessage(), e); + } + + } + + private String getSql(String fecInicioVenda, String fecFinalVenda, String linha, String tipoGratu, Integer empresa) { + + StringBuilder sb = new StringBuilder(); + + sb.append("SELECT b.num_bpe numBpe, COALESCE(b.fechorventa_h,b.fechorventa) fechorventa, b.origen_id origenId, b.puntoventa_id puntoventaId, "); + sb.append("ori.descparada origem, des.descparada destino, bpe.dhemb, b.nombpasajero, b.desctipodoc, b.descnumdoc, b.desctipodoc2, b.descnumdoc2, "); + sb.append("CASE WHEN co.tiposervicio_id = 2 THEN '00' ELSE '01' END corridaextra, cs.tiposervicobpe, b.fechorviaje, r.prefixo, "); + sb.append("CASE WHEN b.numasiento like 'P%' THEN '0' ELSE b.numasiento END numasiento, "); + sb.append("NVL(b.preciobase,0) + NVL(b.importetaxaembarque,0) + NVL(b.importeseguro,0) + NVL(b.importeoutros,0) + NVL(b.importepedagio,0) as totalbase, "); + sb.append("NVL(b.preciopagado,0) + NVL(b.importetaxaembarque,0) + NVL(b.importeseguro,0) + NVL(b.importeoutros,0) + NVL(b.importepedagio,0) as totalbilhete, "); + sb.append("cat.descontobpe, bpe.chbpe "); + sb.append("from boleto b "); + sb.append("join bpe bpe on bpe.boleto_id = b.boleto_id "); + sb.append("join parada ori on ori.parada_id = b.origen_id "); + sb.append("join parada des on des.parada_id = b.destino_id "); + sb.append("join corrida co on co.corrida_id = b.corrida_id and co.feccorrida = b.feccorrida "); + sb.append("join clase_servicio cs on cs.claseservicio_id = co.claseservicio_id "); + sb.append("join ruta r on r.ruta_id = co.ruta_id "); + sb.append("join categoria cat on cat.categoria_id = b.categoria_id "); + sb.append("join marca m on m.marca_id = b.marca_id "); + sb.append("WHERE b.activo = 1 "); + sb.append("AND COALESCE(b.fechorventa_h,b.fechorventa) BETWEEN to_date(:fecInicioVenda,'dd/mm/yyyy hh24:mi') AND to_date(:fecFinalVenda,'dd/mm/yyyy hh24:mi') "); + sb.append("AND r.orgaoconcedente_id = :agepanId "); + sb.append("AND b.motivocancelacion_id is null "); + sb.append("AND bpe.codstat in ('100','102','150','-1') "); + + if( tipoGratu != null ) { + sb.append(" AND b.categoria_id in (").append(tipoGratu).append(") "); + } + + if( linha != null && !linha.equals("Todas")) { + sb.append(" AND r.ruta_id in (").append(linha).append(") "); + } + + if (empresa != null){ + sb.append("AND m.empresa_id = :empresaId "); + } + + return sb.toString(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java new file mode 100644 index 000000000..8b9f16ae2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java @@ -0,0 +1,1681 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.sql.Connection; +import java.sql.Statement; +import java.text.DateFormat; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.hibernate.Query; +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.ArquivoRemessa; +import com.rjconsultores.ventaboletos.ArquivoRemessaItem; +import com.rjconsultores.ventaboletos.ArquivoRemessaItemInteface; +import com.rjconsultores.ventaboletos.blocos.DetalheObrigatorio; +import com.rjconsultores.ventaboletos.blocos.RodapeRemessaPadrao; +import com.rjconsultores.ventaboletos.blocos.bancobrasil.ArquivoRemessaBancoBrasil; +import com.rjconsultores.ventaboletos.blocos.bancobrasil.CabecalhoLoteRemessaBancoBrasil; +import com.rjconsultores.ventaboletos.blocos.bancobrasil.CabecalhoRemessaBancoBrasil; +import com.rjconsultores.ventaboletos.blocos.bancobrasil.DetalheObrigatorioDadosPagadorBancoBrasil; +import com.rjconsultores.ventaboletos.blocos.bancobrasil.DetalheObrigatorioDadosTitulosBancoBrasil; +import com.rjconsultores.ventaboletos.blocos.bancobrasil.RodapeRemessaBancoBrasil; +import com.rjconsultores.ventaboletos.blocos.bancobrasil.RodapeRemessaLoteBancoBrasil; +import com.rjconsultores.ventaboletos.blocos.bradesco.ArquivoRemessaBradesco; +import com.rjconsultores.ventaboletos.blocos.bradesco.CabecalhoRemessaBradesco; +import com.rjconsultores.ventaboletos.blocos.bradesco.DetalheObrigatorioBradesco; +import com.rjconsultores.ventaboletos.blocos.caixa.ArquivoRemessaCaixa; +import com.rjconsultores.ventaboletos.blocos.caixa.CabecalhoRemessaCaixa; +import com.rjconsultores.ventaboletos.blocos.caixa.DetalheObrigatorioCaixa; +import com.rjconsultores.ventaboletos.blocos.itau.ArquivoRemessaItau; +import com.rjconsultores.ventaboletos.blocos.itau.CabecalhoRemessaItau; +import com.rjconsultores.ventaboletos.blocos.itau.DetalheObrigatorioItau; +import com.rjconsultores.ventaboletos.blocos.mercantil.ArquivoRemessaMercantil; +import com.rjconsultores.ventaboletos.blocos.mercantil.CabecalhoRemessaMercantil; +import com.rjconsultores.ventaboletos.blocos.mercantil.DetalheObrigatorioMercantil; +import com.rjconsultores.ventaboletos.blocos.santander.ArquivoRemessaSantander; +import com.rjconsultores.ventaboletos.blocos.santander.CabecalhoRemessaSantander; +import com.rjconsultores.ventaboletos.blocos.santander.DetalheObrigatorioSantander; +import com.rjconsultores.ventaboletos.blocos.sicoob.ArquivoRemessaSicoob; +import com.rjconsultores.ventaboletos.blocos.sicoob.CabecalhoLoteRemessaSicoob; +import com.rjconsultores.ventaboletos.blocos.sicoob.CabecalhoRemessaSicoob; +import com.rjconsultores.ventaboletos.blocos.sicoob.DetalheObrigatorioDadosPagadorSicoob; +import com.rjconsultores.ventaboletos.blocos.sicoob.DetalheObrigatorioSicoob; +import com.rjconsultores.ventaboletos.blocos.sicoob.RodapeRemessaLoteSicoob; +import com.rjconsultores.ventaboletos.blocos.sicoob.RodapeRemessaSicoob; +import com.rjconsultores.ventaboletos.dao.RemessaCNABBancosDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoBoleto; +import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enuns.AceiteBB; +import com.rjconsultores.ventaboletos.enuns.BancoLayout; +import com.rjconsultores.ventaboletos.enuns.TipoInscricaoPagador; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; + +@Repository("remessaCNABBancosDAO") +@SuppressWarnings({"unchecked"}) +public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO implements RemessaCNABBancosDAO{ + + private static Logger log = Logger.getLogger(RemessaCNABBancosHibernateDAO.class); + + @Autowired + public RemessaCNABBancosHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public String findBanco(Empresa empresa){ + + StringBuilder sb = new StringBuilder(); + sb.append("SELECT "); + sb.append("DISTINCT fp.BOLETO_BANCO_COD "); + sb.append("FROM "); + sb.append("FECHAMENTO_PARAMGERAL fp "); + sb.append("WHERE fp.activo = 1 AND "); + sb.append("fp.EMPRESA_ID = " + empresa.getEmpresaId()); + + Query query = getSession().createSQLQuery(sb.toString()); + + return (String) query.list().get(0); + } + + public ArquivoRemessa remessaBradesco(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception{ + + StringBuilder sb = new StringBuilder(); + + sb.append("SELECT "); + sb.append("fb.FECHAMENTOBOLETO_ID AS \"id\", "); + sb.append("(NVL(fp.COUNT_REMESSA, 0) + 1) AS \"idRemessa\", "); + sb.append("fp.COD_EMP_BANCO AS \"codEmpresaBanco\", "); + sb.append("emp.NOMBEMPRESA AS \"nomeEmpresa\", "); + sb.append("fp.BOLETO_BANCO_AGENCIA AS \"agencia\", "); + sb.append("fp.BOLETO_BANCO_CONTA AS \"conta\", "); + sb.append("fp.BOLETO_BANCO_CONTA_DIGITO AS \"dac\", "); + sb.append("fp.BOLETO_BANCO_CARTEIRA AS \"carteira\", "); + sb.append("fb.NOSSONUMERO AS \"nossoNumero\", "); + sb.append("fb.FECVENCIMENTO AS \"vencimento\", "); + sb.append("fb.VALORDOCUMENTO AS \"valor\", "); + sb.append("'01' AS \"especieTitulo\", "); + sb.append("fb.FECDOCUMENTO AS \"dataEmissao\", "); + sb.append("'00' AS \"instrucao1\", "); + sb.append("'00' AS \"instrucao2\", "); + sb.append("fb.MORA AS \"valorAtraso\", "); + sb.append("fb.DESCONTOS AS \"valorDesconto\", "); + sb.append("fb.DEDUCOES AS \"valorAbatimento\", "); + sb.append("'cnpj' as \"tipoInscricaoPagador\", "); + sb.append("pv.NUMDOCPUNTOVENTA AS \"numeroInscricaoPagador\", "); + sb.append("pv.NOMBPUNTOVENTA AS \"nomePagador\", "); + sb.append("pv.DIRECCIONCALLE || ', ' || pv.DIRECCIONNUMERO || ', ' || pl.NOMBPLAZA || ', ' || ci.NOMBCIUDAD || ', ' || es.NOMBESTADO AS \"enderecoCompletoPagador\", "); + sb.append("pv.CODPOSTAL AS \"cepPagador\", "); + sb.append("nvl(fb.porc_mora, 0) AS \"porcentagemMora\", "); + sb.append("nvl(fb.porc_multa, 0) AS \"porcentagemMulta\" "); + + writeFROMClause(sb, dataDe != null && dataAte != null, reenviar); + + Query query = getSession().createSQLQuery(sb.toString()); + query.setInteger("empresaId", empresa.getEmpresaId()); + + if(dataDe != null && dataAte != null){ + query.setDate("dataDe", dataDe); + query.setDate("dataAte", dataAte); + } + List list = query.list(); + + ArquivoRemessa arquivoRemessa = new ArquivoRemessa(BancoLayout.BRADESCO_400_Envio); + + String nomeArquivo = "CB" + new SimpleDateFormat("ddMM").format(new Date()); + int variavel = 0; + + ArquivoRemessaItem arquivoRemessaItem = null; + CabecalhoRemessaBradesco cabecalhoRemessaBradesco = null; + + boolean constanteValidacao = ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.IS_VALIDAR_CONSTANTE_REMESSA.getDescricao()); + + for(Object[] tupla : list){ + + Integer idRemessa = Integer.valueOf(tupla[1].toString()); + variavel = idRemessa; + String codEmpresaBanco = tupla[2] != null ? tupla[2].toString() : "0"; + String nomeEmpresa = tupla[3].toString(); + + if(!tupla[8].toString().contains("-")){ + log.error("NossoNumero não está no formato correto: " + tupla[8].toString() + ". Ignorando o registro FechamentoBoletoId = " + tupla[0].toString()); + continue; + } + + if(cabecalhoRemessaBradesco == null){ + cabecalhoRemessaBradesco = new CabecalhoRemessaBradesco(); + cabecalhoRemessaBradesco.setNumeroSequencialRemessa(idRemessa); + cabecalhoRemessaBradesco.setDataGravacao(new Date()); + cabecalhoRemessaBradesco.setCodigoEmpresa(codEmpresaBanco); + cabecalhoRemessaBradesco.setNomeEmpresa(nomeEmpresa); + + arquivoRemessaItem = new ArquivoRemessaBradesco(); + arquivoRemessaItem.setCabecalhoRemessa(cabecalhoRemessaBradesco); + arquivoRemessaItem.setRodapeRemessa(new RodapeRemessaPadrao()); + + arquivoRemessa.addItem(arquivoRemessaItem); + + }else if(!cabecalhoRemessaBradesco.getCodigoEmpresa().equals(codEmpresaBanco)){ + cabecalhoRemessaBradesco = new CabecalhoRemessaBradesco(); + cabecalhoRemessaBradesco.setNumeroSequencialRemessa(idRemessa); + cabecalhoRemessaBradesco.setDataGravacao(new Date()); + cabecalhoRemessaBradesco.setCodigoEmpresa(codEmpresaBanco); + cabecalhoRemessaBradesco.setNomeEmpresa(nomeEmpresa); + + arquivoRemessaItem = new ArquivoRemessaBradesco(); + arquivoRemessaItem.setCabecalhoRemessa(cabecalhoRemessaBradesco); + arquivoRemessaItem.setRodapeRemessa(new RodapeRemessaPadrao()); + + arquivoRemessa.addItem(arquivoRemessaItem); + } + + DetalheObrigatorioBradesco detalhe = new DetalheObrigatorioBradesco(); + + String []doc = tupla[8].toString().split("-"); + + detalhe.setIdBoletoFechamento(Integer.valueOf(tupla[0].toString())); + detalhe.setCarteira(tupla[7].toString()); + detalhe.setAgencia(tupla[4].toString()); + detalhe.setContacorrente(tupla[5].toString()); + detalhe.setDvConta(tupla[6].toString()); + detalhe.setNumeroControleDoParticipante(tupla[0].toString()); + detalhe.setNossoNumeroComDigito(doc[0] + doc[1]); + detalhe.setCodigoDeOcorrencia(0); + detalhe.setDataOcorrencia(null); + detalhe.setNumeroDoDocumento(StringUtils.right(doc[0], 10)); + detalhe.setVencimento((Date) tupla[9]); + detalhe.setValor(new BigDecimal(tupla[10].toString().replaceAll(",", "."))); + detalhe.setEmissao((Date) tupla[12]); + detalhe.setPercentualMulta( (BigDecimal) tupla[24] ); + + if (!constanteValidacao) { + detalhe.setEspecieDeTitulo("01"); + detalhe.setInstrucao1("00"); + detalhe.setInstrucao2("00"); + }else { + detalhe.setEspecieDeTitulo(tupla[11].toString()); + detalhe.setInstrucao1(tupla[13].toString()); + detalhe.setInstrucao2(tupla[14].toString()); + } + + detalhe.setDataLimiteDesconto(null); + detalhe.setValorIOF(BigDecimal.ZERO); + detalhe.setTipoInscricaoPagador(TipoInscricaoPagador.CNPJ); + detalhe.setNomePagador(tupla[20].toString()); + detalhe.setSacador_Avalista_Mensagem2(""); + detalhe.setMensagem1(""); + + try{ + if( tupla[15] != null ) { + detalhe.setValorAtraso(new BigDecimal(tupla[15].toString().replaceAll(",", "."))); + }else if( tupla[23] != null ) { + detalhe.setValorAtraso( calculaValorMora( (BigDecimal) tupla[23], new BigDecimal(tupla[10].toString().replaceAll(",", ".") )) ); + }else { + detalhe.setValorAtraso( BigDecimal.ZERO ); + } + + }catch(Exception e){ + throw new RuntimeException("Erro ao setar o valor de atraso do boleto "+tupla[0]+", favor entrar em contato com o suporte! "); + } + + try{ + detalhe.setValorDesconto(new BigDecimal(tupla[16].toString().replaceAll(",", "."))); + }catch(Exception e){ + } + + try{ + detalhe.setValorAbatimentoConcedido(new BigDecimal(tupla[17].toString().replaceAll(",", "."))); + }catch(Exception e){ + } + + try{ + detalhe.setNumeroInscricaoPagador(tupla[19].toString().replaceAll("[^0-9]+", "")); + }catch(Exception e){ + throw new RuntimeException("O CNPJ do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setEnderecoCompletoPagador(tupla[21].toString()); + }catch(Exception e){ + throw new RuntimeException("O Endereço do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + String cep = tupla[22].toString(); + detalhe.setCEP_Prefixo(cep.substring(0,5)); + detalhe.setCEP_Sufixo(cep.substring(5)); + }catch(Exception e){ + throw new RuntimeException("O CEP do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + arquivoRemessaItem.addTitulo(detalhe); + + arquivoRemessaItem.getRodapeRemessa().setNumeroSequencialRegistro(arquivoRemessa.getItens().size()); + + } + + nomeArquivo = nomeArquivo + new DecimalFormat("##").format(variavel) + ".REM"; + arquivoRemessa.setNomeArquivo(nomeArquivo); + + return arquivoRemessa; + + } + + public ArquivoRemessa remessaSantander(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception{ + + StringBuilder sb = new StringBuilder(); + + sb.append("SELECT "); + sb.append(" fb.FECHAMENTOBOLETO_ID AS \"id\", "); //0 + sb.append(" (NVL(fp.COUNT_REMESSA, 0) + 1) AS \"idRemessa\", "); //1 + sb.append(" fp.COD_EMP_BANCO AS \"codEmpresaBanco\", "); //2 + sb.append(" emp.NOMBEMPRESA AS \"nomeEmpresa\", "); //3 + sb.append(" fp.BOLETO_BANCO_AGENCIA AS \"agencia\", "); //4 + sb.append(" fp.BOLETO_BANCO_CONTA AS \"conta\", "); //5 + sb.append(" fp.BOLETO_BANCO_CONTA_DIGITO AS \"dac\", "); //6 + sb.append(" fp.BOLETO_BANCO_CARTEIRA AS \"carteira\", "); //7 + sb.append(" fb.NOSSONUMERO AS \"nossoNumero\", "); //8 + sb.append(" fb.FECVENCIMENTO AS \"vencimento\", "); //9 + sb.append(" fb.VALORDOCUMENTO AS \"valor\", "); //10 + sb.append(" '01' AS \"especieTitulo\", "); //11 + sb.append(" fb.FECDOCUMENTO AS \"dataEmissao\", ");//12 + sb.append(" '00' AS \"instrucao1\", ");//13 + sb.append(" '00' AS \"instrucao2\", ");//14 + sb.append(" fb.MORA AS \"valorAtraso\", ");//15 + sb.append(" fb.DESCONTOS AS \"valorDesconto\", ");//16 + sb.append(" fb.DEDUCOES AS \"valorAbatimento\", ");//17 + sb.append(" 'cnpj' as \"tipoInscricaoPagador\", ");//18 + sb.append(" pv.NUMDOCPUNTOVENTA AS \"numeroInscricaoPagador\", ");//19 + sb.append(" pv.NOMBPUNTOVENTA AS \"nomePagador\", ");//20 + sb.append(" pv.DIRECCIONCALLE || ', ' || pv.DIRECCIONNUMERO as endereco,");//21 + sb.append(" pl.NOMBPLAZA as bairro, ");//22 + sb.append(" ci.NOMBCIUDAD AS cidade, ");//23 + sb.append(" es.CVEESTADO AS estado, ");//24 + sb.append(" pv.CODPOSTAL AS \"cepPagador\", "); //25 + sb.append(" ecb.NUMINTEGRACION AS \"codigoTransmissao\", "); //26 + sb.append(" fp.BOLETO_BANCO_AGENCIA_DIGITO AS \"agenciaDigito\", "); //27 + sb.append(" emp.CNPJ AS \"numeroInscricaoSacado\", "); //28 + sb.append("nvl(fb.porc_mora, 0) AS \"porcentagemMora\", ");//29 + sb.append("nvl(fb.porc_multa, 0) AS \"porcentagemMulta\" ");//30 + + writeFROMClause(sb, dataDe != null && dataAte != null, reenviar); + + Query query = getSession().createSQLQuery(sb.toString()); + query.setInteger("empresaId", empresa.getEmpresaId()); + + if(dataDe != null && dataAte != null){ + query.setDate("dataDe", dataDe); + query.setDate("dataAte", dataAte); + } + List list = query.list(); + + ArquivoRemessa arquivoRemessa = new ArquivoRemessa(BancoLayout.SANTANDER_400_Envio); + + String nomeArquivo = "CB" + new SimpleDateFormat("ddMM").format(new Date()); + int variavel = 0; + + ArquivoRemessaItem arquivoRemessaItem = null; + CabecalhoRemessaSantander cabecalhoRemessaSantander = null; + + for(Object[] tupla : list){ + + Integer idRemessa = Integer.valueOf(tupla[1].toString()); + variavel = idRemessa; + String codEmpresaBanco = tupla[2] != null ? tupla[2].toString() : "0"; + String nomeEmpresa = tupla[3].toString(); + Integer codigoTransmissao = tupla[26] != null ? Integer.valueOf(tupla[26].toString()) : 0; + + if(!tupla[8].toString().contains("-")){ + log.error("NossoNumero não está no formato correto: " + tupla[8].toString() + ". Ignorando o registro FechamentoBoletoId = " + tupla[0].toString()); + continue; + } + + if(cabecalhoRemessaSantander == null){ + cabecalhoRemessaSantander = new CabecalhoRemessaSantander(); + cabecalhoRemessaSantander.setNumeroSequencialRemessa(idRemessa); + cabecalhoRemessaSantander.setCodigoTransmissao(gerarCodigoTransmissao(tupla[4].toString(), tupla[27].toString(), codEmpresaBanco, tupla[5].toString(), tupla[6].toString())); + cabecalhoRemessaSantander.setDataGravacao(new Date()); + cabecalhoRemessaSantander.setCodigoEmpresa(codEmpresaBanco); + cabecalhoRemessaSantander.setNomeEmpresa(nomeEmpresa); + + arquivoRemessaItem = new ArquivoRemessaSantander(); + arquivoRemessaItem.setCabecalhoRemessa(cabecalhoRemessaSantander); + arquivoRemessaItem.setRodapeRemessa(new RodapeRemessaPadrao()); + + arquivoRemessa.addItem(arquivoRemessaItem); + + }else if(!cabecalhoRemessaSantander.getCodigoEmpresa().equals(codEmpresaBanco)){ + cabecalhoRemessaSantander = new CabecalhoRemessaSantander(); + cabecalhoRemessaSantander.setNumeroSequencialRemessa(idRemessa); + cabecalhoRemessaSantander.setDataGravacao(new Date()); + cabecalhoRemessaSantander.setCodigoEmpresa(codEmpresaBanco); + cabecalhoRemessaSantander.setNomeEmpresa(nomeEmpresa); + + arquivoRemessaItem = new ArquivoRemessaSantander(); + arquivoRemessaItem.setCabecalhoRemessa(cabecalhoRemessaSantander); + arquivoRemessaItem.setRodapeRemessa(new RodapeRemessaPadrao()); + + arquivoRemessa.addItem(arquivoRemessaItem); + } + + DetalheObrigatorioSantander detalhe = new DetalheObrigatorioSantander(); + + String []doc = tupla[8].toString().split("-"); + detalhe.setIdBoletoFechamento(Integer.valueOf(tupla[0].toString())); + detalhe.setTipoInscricao(TipoInscricaoPagador.CNPJ); + detalhe.setCodigoTransmissao(codigoTransmissao.toString()); + + detalhe.setCarteira(tupla[7].toString()); + detalhe.setAgencia(tupla[4].toString()); + detalhe.setAgenciaCobradora(tupla[4].toString()); + detalhe.setContacorrente(tupla[5].toString()); + detalhe.setDvConta(tupla[6].toString()); + detalhe.setNumControleDoParticipante(tupla[0].toString()); + detalhe.setNossoNumeroComDigito(doc[0] + doc[1]); + detalhe.setCodigoDeOcorrencia(0); + detalhe.setDataOcorrencia(null); + detalhe.setNumeroDoDocumento(doc[0] + doc[1]); + detalhe.setVencimento((Date) tupla[9]); + detalhe.setValor(new BigDecimal(tupla[10].toString().replaceAll(",", "."))); + detalhe.setEspecieDeTitulo("01"); + detalhe.setEmissao((Date) tupla[12]); + detalhe.setInstrucao1("00"); + detalhe.setInstrucao2("00"); + detalhe.setDataLimiteDesconto(null); + detalhe.setDvAgencia(tupla[27].toString()); + detalhe.setCodigoEmpresa(codEmpresaBanco); + detalhe.setCodigoTransmissao(gerarCodigoTransmissao(tupla[4].toString(), tupla[27].toString(), codEmpresaBanco, tupla[5].toString(), tupla[6].toString())); + detalhe.setValorIOF(BigDecimal.ZERO); + detalhe.setNomeSacado(tupla[20].toString()); + detalhe.setMensagem1(""); + detalhe.setSacadorAvalista(""); + detalhe.setPercentualMulta( (BigDecimal) tupla[30] ); + + try{ + if( tupla[15] != null ) { + detalhe.setValorAtraso(new BigDecimal(tupla[15].toString().replaceAll(",", "."))); + }else if( tupla[29] != null ) { + detalhe.setValorAtraso( calculaValorMora( (BigDecimal) tupla[29], new BigDecimal(tupla[10].toString().replaceAll(",", ".") )) ); + }else { + detalhe.setValorAtraso( BigDecimal.ZERO ); + } + + }catch(Exception e){ + throw new RuntimeException("Erro ao setar o valor de atraso do boleto "+tupla[0]+", favor entrar em contato com o suporte! "); + } + + try{ + detalhe.setValorDesconto(new BigDecimal(tupla[16].toString().replaceAll(",", "."))); + }catch(Exception e){} + + try{ + detalhe.setValorAbatimentoConcedido(new BigDecimal(tupla[17].toString().replaceAll(",", "."))); + }catch(Exception e){} + + try{ + detalhe.setNumeroInscricao(tupla[19].toString().replaceAll("[^0-9]+", "")); + }catch(Exception e){ + throw new RuntimeException("A inscrição do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setNumeroInscricaoSacado(tupla[28].toString().replaceAll("[^0-9]+", "")); + }catch(Exception e){ + throw new RuntimeException("O CNPJ do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setEnderecoSacado(tupla[21].toString()); + }catch(Exception e){ + throw new RuntimeException("O Endereco do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setBairroSacado(tupla[22].toString()); + }catch(Exception e){ + throw new RuntimeException("O Bairro do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setCidade(tupla[23].toString()); + }catch(Exception e){ + throw new RuntimeException("A Cidade do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setEstado(tupla[24].toString()); + }catch(Exception e){ + throw new RuntimeException("O Estado do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + String cep = tupla[25].toString(); + detalhe.setCepSacado(cep.substring(0,5)); + detalhe.setComplementoCepSacado(cep.substring(5)); + }catch(Exception e){ + throw new RuntimeException("O CEP do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + arquivoRemessaItem.addTitulo(detalhe); + + arquivoRemessaItem.getRodapeRemessa().setNumeroSequencialRegistro(arquivoRemessa.getItens().size()); + } + + nomeArquivo = nomeArquivo + new DecimalFormat("##").format(variavel) + ".REM"; + arquivoRemessa.setNomeArquivo(nomeArquivo); + + return arquivoRemessa; + + } + + public ArquivoRemessa remessaMercantil(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception{ + + StringBuilder sb = new StringBuilder(); + + sb.append(" SELECT "); + sb.append(" fb.FECHAMENTOBOLETO_ID AS \"id\", "); + sb.append(" (NVL(fp.COUNT_REMESSA, 0) + 1) AS \"idRemessa\", "); + sb.append(" fp.COD_EMP_BANCO AS \"codEmpresaBanco\", "); + sb.append(" emp.NOMBEMPRESA AS \"nomeEmpresa\", "); + sb.append(" fp.BOLETO_BANCO_AGENCIA AS \"agencia\", "); + sb.append(" fp.BOLETO_BANCO_CONTA AS \"conta\", "); + sb.append(" fp.BOLETO_BANCO_CONTA_DIGITO AS \"dac\", "); + sb.append(" fp.BOLETO_BANCO_CARTEIRA AS \"carteira\", "); + sb.append(" fb.NOSSONUMERO AS \"nossoNumero\", "); + sb.append(" fb.FECVENCIMENTO AS \"vencimento\", "); + sb.append(" fb.VALORDOCUMENTO AS \"valor\", "); + sb.append(" '01' AS \"especieTitulo\", "); + sb.append(" fb.FECDOCUMENTO AS \"dataEmissao\", "); + sb.append(" '00' AS \"instrucao1\", "); + sb.append(" '00' AS \"instrucao2\", "); + sb.append(" fb.MORA AS \"valorAtraso\", "); + sb.append(" fb.DESCONTOS AS \"valorDesconto\", "); + sb.append(" fb.DEDUCOES AS \"valorAbatimento\", "); + sb.append(" 'cnpj' as \"tipoInscricaoPagador\", "); + sb.append(" pv.NUMDOCPUNTOVENTA AS \"numeroInscricaoPagador\", "); + sb.append(" pv.NOMBPUNTOVENTA AS \"nomePagador\", "); + sb.append(" pv.DIRECCIONCALLE || ', ' || pv.DIRECCIONNUMERO as endereco,"); + sb.append(" pl.NOMBPLAZA as bairro, "); + sb.append(" ci.NOMBCIUDAD AS cidade, "); + sb.append(" es.CVEESTADO AS estado, "); + sb.append(" pv.CODPOSTAL AS \"cepPagador\", "); + sb.append(" ecb.NUMINTEGRACION AS \"numeroContrato\" "); + + writeFROMClause(sb, dataDe != null && dataAte != null, reenviar); + + Query query = getSession().createSQLQuery(sb.toString()); + query.setInteger("empresaId", empresa.getEmpresaId()); + + if(dataDe != null && dataAte != null){ + query.setDate("dataDe", dataDe); + query.setDate("dataAte", dataAte); + } + List list = query.list(); + + ArquivoRemessa arquivoRemessa = new ArquivoRemessa(BancoLayout.MERCANTIL_400_Envio); + + String nomeArquivo = "CB" + new SimpleDateFormat("ddMM").format(new Date()); + int variavel = 0; + + ArquivoRemessaItem arquivoRemessaItem = null; + CabecalhoRemessaMercantil cabecalhoRemessaMercantil = null; + + for(Object[] tupla : list){ + + Integer idRemessa = Integer.valueOf(tupla[1].toString()); + variavel = idRemessa; + String codEmpresaBanco = tupla[2] != null ? tupla[2].toString() : "0"; + String nomeEmpresa = tupla[3].toString(); + + if(!tupla[8].toString().contains("-")){ + log.error("NossoNumero não está no formato correto: " + tupla[8].toString() + ". Ignorando o registro FechamentoBoletoId = " + tupla[0].toString()); + continue; + } + + if(cabecalhoRemessaMercantil == null){ + cabecalhoRemessaMercantil = new CabecalhoRemessaMercantil(); + cabecalhoRemessaMercantil.setNumeroSequencialRemessa(idRemessa); + cabecalhoRemessaMercantil.setAgenciaOrigem(tupla[4].toString()); + cabecalhoRemessaMercantil.setCnpj(Long.valueOf(tupla[19].toString().replaceAll("[^0-9]+", ""))); + cabecalhoRemessaMercantil.setDataGravacao(new Date()); + cabecalhoRemessaMercantil.setCodigoEmpresa(codEmpresaBanco); + cabecalhoRemessaMercantil.setNomeEmpresa(nomeEmpresa); + + arquivoRemessaItem = new ArquivoRemessaMercantil(); + arquivoRemessaItem.setCabecalhoRemessa(cabecalhoRemessaMercantil); + arquivoRemessaItem.setRodapeRemessa(new RodapeRemessaPadrao()); + + arquivoRemessa.addItem(arquivoRemessaItem); + + }else if(!cabecalhoRemessaMercantil.getCodigoEmpresa().equals(codEmpresaBanco)){ + cabecalhoRemessaMercantil = new CabecalhoRemessaMercantil(); + cabecalhoRemessaMercantil.setNumeroSequencialRemessa(idRemessa); + cabecalhoRemessaMercantil.setDataGravacao(new Date()); + cabecalhoRemessaMercantil.setCodigoEmpresa(codEmpresaBanco); + cabecalhoRemessaMercantil.setNomeEmpresa(nomeEmpresa); + + arquivoRemessaItem = new ArquivoRemessaMercantil(); + arquivoRemessaItem.setCabecalhoRemessa(cabecalhoRemessaMercantil); + arquivoRemessaItem.setRodapeRemessa(new RodapeRemessaPadrao()); + + arquivoRemessa.addItem(arquivoRemessaItem); + } + + DetalheObrigatorioMercantil detalhe = new DetalheObrigatorioMercantil(); + + String []doc = tupla[8].toString().split("-"); + detalhe.setIdBoletoFechamento(Integer.valueOf(tupla[0].toString())); + detalhe.setNumeroContrato(Integer.valueOf(tupla[26].toString())); + detalhe.setAgenciaOrigem(tupla[4].toString()); + detalhe.setSeuNumero(Integer.valueOf(tupla[0].toString())); + detalhe.setNossoNumero(doc[0]); + detalhe.setDigitoVerificador(doc[1]); + detalhe.setCodigoDeOcorrencia(0); + detalhe.setDataOcorrencia(null); + detalhe.setNumeroDoDocumento(StringUtils.right(doc[0], 10)); + detalhe.setVencimento((Date) tupla[9]); + detalhe.setValorTitulo(new BigDecimal(tupla[10].toString().replaceAll(",", "."))); + detalhe.setEspecieDeTitulo(tupla[11].toString()); + detalhe.setEmissao((Date) tupla[12]); + detalhe.setInstrucao1(tupla[13].toString()); + detalhe.setInstrucao2(tupla[14].toString()); + detalhe.setDataLimiteDesconto(null); + detalhe.setMensagem1(""); + detalhe.setSacadorAvalistaMensagem2(""); + detalhe.setValorIOF(BigDecimal.ZERO); + detalhe.setNomePagador(tupla[20].toString()); + + try{ + detalhe.setValorAtraso(new BigDecimal(tupla[15].toString().replaceAll(",", "."))); + }catch(Exception e){} + + try{ + detalhe.setValorDesconto(new BigDecimal(tupla[16].toString().replaceAll(",", "."))); + }catch(Exception e){} + + try{ + detalhe.setValorAbatimentoConcedido(new BigDecimal(tupla[17].toString().replaceAll(",", "."))); + }catch(Exception e){} + + + try{ + detalhe.setEnderecoCompletoPagador(tupla[21].toString()); + }catch(Exception e){ + throw new RuntimeException("O Endereço do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setBairro(tupla[22].toString()); + }catch(Exception e){ + throw new RuntimeException("O Bairro do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setCidade(tupla[23].toString()); + }catch(Exception e){ + throw new RuntimeException("A cidade do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setEstado(tupla[24].toString()); + }catch(Exception e){ + throw new RuntimeException("O Estado do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setCnpj(Long.valueOf(tupla[19].toString().replaceAll("[^0-9]+", ""))); + }catch(Exception e){ + throw new RuntimeException("O CNPJ do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + String cep = tupla[25].toString(); + detalhe.setCepPrefixo(cep.substring(0,5)); + detalhe.setCepSufixo(cep.substring(5)); + }catch(Exception e){ + throw new RuntimeException("O CEP do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + arquivoRemessaItem.addTitulo(detalhe); + + arquivoRemessaItem.getRodapeRemessa().setNumeroSequencialRegistro(arquivoRemessa.getItens().size()); + + } + + nomeArquivo = nomeArquivo + new DecimalFormat("##").format(variavel) + ".REM"; + arquivoRemessa.setNomeArquivo(nomeArquivo); + + return arquivoRemessa; + + } + + @Override + public ArquivoRemessa remessaItau(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception { + + StringBuilder sb = new StringBuilder(); + + sb.append("SELECT "); + sb.append("fb.FECHAMENTOBOLETO_ID AS \"id\", "); + sb.append("(NVL(fp.COUNT_REMESSA, 0) + 1) AS \"idRemessa\", "); + sb.append("fp.COD_EMP_BANCO AS \"codEmpresaBanco\", "); + sb.append("emp.CNPJ AS \"cnpj\", "); + sb.append("emp.NOMBEMPRESA AS \"nomeEmpresa\", "); + sb.append("fp.BOLETO_BANCO_AGENCIA AS \"agencia\", "); + sb.append("fp.BOLETO_BANCO_CONTA AS \"conta\", "); + sb.append("fp.BOLETO_BANCO_CONTA_DIGITO AS \"dac\", "); + sb.append("fp.BOLETO_BANCO_CARTEIRA AS \"carteira\", "); + sb.append("fb.NOSSONUMERO AS \"nossoNumero\", "); + sb.append("fb.FECVENCIMENTO AS \"vencimento\", "); + sb.append("fb.VALORDOCUMENTO AS \"valor\", "); + sb.append("99 AS \"especieTitulo\", "); + sb.append("fb.FECDOCUMENTO AS \"dataEmissao\", "); + sb.append("' ' AS \"instrucao1\", "); + sb.append("' ' AS \"instrucao2\", "); + sb.append("fb.MORA AS \"valorAtraso\", "); + sb.append("fb.DESCONTOS AS \"valorDesconto\", "); + sb.append("fb.DEDUCOES AS \"valorAbatimento\", "); + sb.append("'cnpj' as \"tipoInscricaoPagador\", "); + sb.append("pv.NUMDOCPUNTOVENTA AS \"numeroInscricaoPagador\", "); + sb.append("pv.NOMBPUNTOVENTA AS \"nomePagador\", "); + sb.append("pv.DIRECCIONCALLE || ', ' || pv.DIRECCIONNUMERO AS \"logradouroPagador\", "); + sb.append("pl.NOMBPLAZA AS \"bairroPagador\", "); + sb.append("pv.CODPOSTAL AS \"cepPagador\", "); + sb.append("ci.NOMBCIUDAD AS \"cidadePagador\", "); + sb.append("es.cveestado AS \"estadoPagador\" "); + writeFROMClause(sb, dataDe != null && dataAte != null, reenviar); + + Query query = getSession().createSQLQuery(sb.toString()); + query.setInteger("empresaId", empresa.getEmpresaId()); + if(dataDe != null && dataAte != null){ + query.setDate("dataDe", dataDe); + query.setDate("dataAte", dataAte); + } + List list = query.list(); + + ArquivoRemessa arquivoRemessa = new ArquivoRemessa(BancoLayout.ITAU_400_Envio); + + String nomeArquivo = "RE" + new SimpleDateFormat("ddMM").format(new Date()); + int variavel = 0; + int contador = 1; + + ArquivoRemessaItem arquivoRemessaItem = null; + CabecalhoRemessaItau cabecalhoRemessaItau = null; + + for(Object[] tupla : list){ + + Integer idRemessa = Integer.valueOf(tupla[1].toString()); + variavel = idRemessa; + String codEmpresaBanco = tupla[5].toString() + tupla[6].toString(); + String nomeEmpresa = tupla[4].toString(); + + if(cabecalhoRemessaItau == null){ + cabecalhoRemessaItau = new CabecalhoRemessaItau(); + cabecalhoRemessaItau.setNumeroSequencialRemessa(idRemessa); + cabecalhoRemessaItau.setNumeroSequencialRegistro(contador); + cabecalhoRemessaItau.setDataGeracao(new Date()); + cabecalhoRemessaItau.setAgencia(Integer.valueOf(tupla[5].toString())); + cabecalhoRemessaItau.setConta(Integer.valueOf(tupla[6].toString())); + cabecalhoRemessaItau.setDacConta(Integer.valueOf(tupla[7].toString())); + cabecalhoRemessaItau.setNomeEmpresa(nomeEmpresa); + + arquivoRemessaItem = new ArquivoRemessaItau(); + arquivoRemessaItem.setCabecalhoRemessa(cabecalhoRemessaItau); + arquivoRemessaItem.setRodapeRemessa(new RodapeRemessaPadrao()); + + arquivoRemessa.addItem(arquivoRemessaItem); + + }else if(!(cabecalhoRemessaItau.getAgencia().toString() + cabecalhoRemessaItau.getConta().toString()).equals(codEmpresaBanco)){ + cabecalhoRemessaItau = new CabecalhoRemessaItau(); + cabecalhoRemessaItau.setNumeroSequencialRemessa(idRemessa); + cabecalhoRemessaItau.setNumeroSequencialRegistro(contador); + cabecalhoRemessaItau.setDataGeracao(new Date()); + cabecalhoRemessaItau.setAgencia(Integer.valueOf(tupla[5].toString())); + cabecalhoRemessaItau.setConta(Integer.valueOf(tupla[6].toString())); + cabecalhoRemessaItau.setDacConta(Integer.valueOf(tupla[7].toString())); + cabecalhoRemessaItau.setNomeEmpresa(nomeEmpresa); + + arquivoRemessaItem = new ArquivoRemessaItau(); + arquivoRemessaItem.setCabecalhoRemessa(cabecalhoRemessaItau); + arquivoRemessaItem.setRodapeRemessa(new RodapeRemessaPadrao()); + + arquivoRemessa.addItem(arquivoRemessaItem); + } + + + DetalheObrigatorioItau detalhe = new DetalheObrigatorioItau(); + + String []doc = tupla[9].toString().split("-"); + + detalhe.setIdBoletoFechamento(Integer.valueOf(tupla[0].toString())); + detalhe.setNumeroInscricao(Integer.valueOf(codEmpresaBanco)); + detalhe.setAgencia(Integer.valueOf(tupla[5].toString())); + detalhe.setConta(Integer.valueOf(tupla[6].toString())); + detalhe.setDacConta(Integer.valueOf(tupla[7].toString())); + detalhe.setInstrucaoAlegacao(0000); + detalhe.setNossoNumero(Integer.valueOf(doc[0])); + detalhe.setNumCpfCnpj(tupla[3].toString()); + detalhe.setQtdMoeda(BigDecimal.ZERO); + detalhe.setNrCarteira(Integer.valueOf(tupla[8].toString())); + detalhe.setCodigoDeOcorrencia(01); + detalhe.setNumeroDoDocumento(tupla[0].toString()); + detalhe.setVencimento((Date) tupla[10]); + detalhe.setValor(new BigDecimal(tupla[11].toString().replaceAll(",", "."))); + detalhe.setAgenciaCobradora(0); + detalhe.setEspecieDeTitulo("99"); + detalhe.setAceite("A"); + detalhe.setEmissao((Date) tupla[13]); + detalhe.setInstrucao1("05"); + detalhe.setInstrucao1("00"); + detalhe.setDataDesconto(null); + detalhe.setIOF_Devido(BigDecimal.ZERO); + detalhe.setNomeSacado(tupla[21].toString()); + detalhe.setTipoInscricaoSacado(TipoInscricaoPagador.CNPJ); + detalhe.setDataDeMora(null); + detalhe.setPrazo(00); + detalhe.setNumeroSequencialRegistro(++contador); + detalhe.setSacadorAvalista(tupla[21].toString()); + + try{ + detalhe.setJurosDeMora(new BigDecimal(tupla[16].toString().replaceAll(",", "."))); + }catch(Exception e){ + detalhe.setJurosDeMora(BigDecimal.ZERO); + } + + try{ + detalhe.setDescontoConcedido(new BigDecimal(tupla[17].toString().replaceAll(",", "."))); + }catch(Exception e){ + detalhe.setDescontoConcedido(BigDecimal.ZERO); + } + + try{ + detalhe.setAbatimentoConcedido(new BigDecimal(tupla[18].toString().replaceAll(",", "."))); + }catch(Exception e){ + detalhe.setAbatimentoConcedido(BigDecimal.ZERO); + } + + try{ + detalhe.setNumeroInscricaoSacado(Long.valueOf(tupla[20].toString())); + }catch(Exception e){ + throw new RuntimeException("O CNPJ do ponto de venda "+tupla[21]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setLogradouroSacado(tupla[22].toString()); + }catch(Exception e){ + throw new RuntimeException("O Logradouro do ponto de venda "+tupla[21]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setBairroSacado(tupla[23].toString()); + }catch(Exception e){ + throw new RuntimeException("O Bairro do ponto de venda "+tupla[21]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setCepSacado(Integer.valueOf(tupla[24].toString())); + }catch(Exception e){ + throw new RuntimeException("O CEP do ponto de venda "+tupla[21]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setCidade(tupla[25].toString()); + }catch(Exception e){ + throw new RuntimeException("A cidade do ponto de venda "+tupla[21]+" está fora do padrão, favor corrigir"); + } + + try{ + detalhe.setEstado(tupla[26].toString()); + }catch(Exception e){ + throw new RuntimeException("O Estado do ponto de venda "+tupla[21]+" está fora do padrão, favor corrigir"); + } + + arquivoRemessaItem.addTitulo(detalhe); + + arquivoRemessaItem.getRodapeRemessa().setNumeroSequencialRegistro(contador); + } + + nomeArquivo = nomeArquivo + new DecimalFormat("##").format(variavel) + ".REM"; + arquivoRemessa.setNomeArquivo(nomeArquivo); + + return arquivoRemessa; + } + + @Override + public ArquivoRemessa remessaBancoBrasil(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception { + + StringBuilder sb = new StringBuilder(); + + sb.append("SELECT "); + sb.append("fb.FECHAMENTOBOLETO_ID AS \"id\", "); + sb.append("(NVL(fp.COUNT_REMESSA, 0) + 1) AS \"idRemessa\", "); + sb.append("fp.COD_EMP_BANCO AS \"codEmpresaBanco\", "); + sb.append("emp.CNPJ AS \"cnpj\", "); + sb.append("emp.NOMBEMPRESA AS \"nomeEmpresa\", "); + sb.append("fp.BOLETO_BANCO_AGENCIA AS \"agencia\", "); + sb.append("fp.BOLETO_BANCO_CONTA AS \"conta\", "); + sb.append("fp.BOLETO_BANCO_CONTA_DIGITO AS \"dac\", "); + sb.append("fp.BOLETO_BANCO_CARTEIRA AS \"carteira\", "); + sb.append("fb.NOSSONUMERO AS \"nossoNumero\", "); + sb.append("fb.FECVENCIMENTO AS \"vencimento\", "); + sb.append("fb.VALORDOCUMENTO AS \"valor\", "); + sb.append("99 AS \"especieTitulo\", "); + sb.append("fb.FECDOCUMENTO AS \"dataEmissao\", "); + sb.append("' ' AS \"instrucao1\", "); + sb.append("' ' AS \"instrucao2\", "); + sb.append("fb.MORA AS \"valorAtraso\", "); + sb.append("fb.DESCONTOS AS \"valorDesconto\", "); + sb.append("fb.DEDUCOES AS \"valorAbatimento\", "); + sb.append("'cnpj' as \"tipoInscricaoPagador\", "); + sb.append("pv.NUMDOCPUNTOVENTA AS \"numeroInscricaoPagador\", "); + sb.append("pv.NOMBPUNTOVENTA AS \"nomePagador\", "); + sb.append("pv.DIRECCIONCALLE || ', ' || pv.DIRECCIONNUMERO AS \"logradouroPagador\", "); + sb.append("pl.NOMBPLAZA AS \"bairroPagador\", "); + sb.append("pv.CODPOSTAL AS \"cepPagador\", "); + sb.append("ci.NOMBCIUDAD AS \"cidadePagador\", "); + sb.append("es.NOMBESTADO AS \"estadoPagador\", "); + sb.append("fp.BOLETO_BANCO_AGENCIA_DIGITO AS \"digitoAgencia\", "); + sb.append("fp.BOLETO_BANCO_CARTEIRA_VARIAVEL AS \"variavelCarteira\" "); + writeFROMClause(sb, dataDe != null && dataAte != null, reenviar); + + Query query = getSession().createSQLQuery(sb.toString()); + query.setInteger("empresaId", empresa.getEmpresaId()); + if(dataDe != null && dataAte != null){ + query.setDate("dataDe", dataDe); + query.setDate("dataAte", dataAte); + } + List list = query.list(); + + ArquivoRemessa arquivoRemessa = new ArquivoRemessa(BancoLayout.BB_240_Envio); + + String nomeArquivo = "BB" + new SimpleDateFormat("ddMM").format(new Date()); + int variavel = 0; + + + ArquivoRemessaItem arquivoRemessaItem = null; + CabecalhoRemessaBancoBrasil cabecalhoRemessaBancoBrasil = null; + CabecalhoLoteRemessaBancoBrasil cabecalhoLoteRemessaBancoBrasil = null; + RodapeRemessaLoteBancoBrasil rodapeRemessaLoteBancoBrasil = null; + RodapeRemessaBancoBrasil rodapeRemessaBancoBrasil = null; + + for(Object[] tupla : list){ + + Integer idRemessa = Integer.valueOf(tupla[1].toString()); + variavel = idRemessa; + String codEmpresaBanco = ((BigDecimal) tupla[2]).toString(); + codEmpresaBanco = StringUtils.right("000000000" + codEmpresaBanco, 9); + String nomeEmpresa = tupla[4].toString(); + + DateFormat df = new SimpleDateFormat("HHmmss"); + + if(cabecalhoRemessaBancoBrasil == null || + !(cabecalhoRemessaBancoBrasil.getNumConvenio()).equals(codEmpresaBanco)){ + cabecalhoRemessaBancoBrasil = new CabecalhoRemessaBancoBrasil(); + cabecalhoRemessaBancoBrasil.setNumeroSequencialRemessa(idRemessa); + cabecalhoRemessaBancoBrasil.setDataGeracao(new Date()); + cabecalhoRemessaBancoBrasil.setHoraGeracao(Integer.parseInt(df.format(new Date()))); + cabecalhoRemessaBancoBrasil.setCpfCnpj(Integer.parseInt(TipoInscricaoPagador.CNPJ.getId())); + cabecalhoRemessaBancoBrasil.setNumCpfCnpj(tupla[3].toString()); + cabecalhoRemessaBancoBrasil.setDensidadeArquivo("00000"); + cabecalhoRemessaBancoBrasil.setNumAgencia(tupla[5].toString()); + cabecalhoRemessaBancoBrasil.setDigAgencia(((BigDecimal) tupla[27]).toString()); + cabecalhoRemessaBancoBrasil.setDigAgenciaConta(" "); + cabecalhoRemessaBancoBrasil.setNumContaCorrente(tupla[6].toString()); + cabecalhoRemessaBancoBrasil.setDigContaCorrente(tupla[7].toString()); + cabecalhoRemessaBancoBrasil.setNumCarteira(tupla[8].toString()); + cabecalhoRemessaBancoBrasil.setNumVarCarteira(((BigDecimal) tupla[28]).toString()); + cabecalhoRemessaBancoBrasil.setNomeEmpresa(nomeEmpresa); + cabecalhoRemessaBancoBrasil.setNumConvenio(codEmpresaBanco); + + cabecalhoLoteRemessaBancoBrasil = new CabecalhoLoteRemessaBancoBrasil(); + cabecalhoLoteRemessaBancoBrasil.setCpfCnpj(Integer.parseInt(TipoInscricaoPagador.CNPJ.getId())); + cabecalhoLoteRemessaBancoBrasil.setNumCpfCnpj(tupla[3].toString()); + cabecalhoLoteRemessaBancoBrasil.setNumAgencia(tupla[5].toString()); + cabecalhoLoteRemessaBancoBrasil.setDigAgencia(((BigDecimal) tupla[27]).toString()); + cabecalhoLoteRemessaBancoBrasil.setDigAgenciaConta(" "); + cabecalhoLoteRemessaBancoBrasil.setNumContaCorrente(tupla[6].toString()); + cabecalhoLoteRemessaBancoBrasil.setDigContaCorrente(tupla[7].toString()); + cabecalhoLoteRemessaBancoBrasil.setNumCarteira(tupla[8].toString()); + cabecalhoLoteRemessaBancoBrasil.setNumVarCarteira(((BigDecimal) tupla[28]).toString()); + cabecalhoLoteRemessaBancoBrasil.setNomeEmpresa(nomeEmpresa); + cabecalhoLoteRemessaBancoBrasil.setNumConvenio(codEmpresaBanco); + cabecalhoLoteRemessaBancoBrasil.setDataGeracao(new Date()); + cabecalhoLoteRemessaBancoBrasil.setNumeroRemessa(idRemessa); + cabecalhoLoteRemessaBancoBrasil.setRemessaTesteID("TS"); + //cabecalhoLoteRemessaBancoBrasil.setLoteServico(++loteCount); + + cabecalhoRemessaBancoBrasil.setCabecalhoLoteRemessaBancoBrasil(cabecalhoLoteRemessaBancoBrasil); + + arquivoRemessaItem = new ArquivoRemessaBancoBrasil(); + arquivoRemessaItem.setCabecalhoRemessa(cabecalhoRemessaBancoBrasil); + + arquivoRemessa.addItem(arquivoRemessaItem); + } + + String []doc = tupla[9].toString().split("-"); + + DetalheObrigatorioDadosTitulosBancoBrasil titulosBancoBrasil = new DetalheObrigatorioDadosTitulosBancoBrasil(); + titulosBancoBrasil.setIdBoletoFechamento(Integer.valueOf(tupla[0].toString())); + titulosBancoBrasil.setNumAgencia(tupla[5].toString()); + titulosBancoBrasil.setDigAgencia(((BigDecimal) tupla[27]).toString()); + titulosBancoBrasil.setNumContaCorrente(tupla[6].toString()); + titulosBancoBrasil.setDigContaCorrente(tupla[7].toString()); + titulosBancoBrasil.setDigAgenciaConta(" "); + titulosBancoBrasil.setNossoNumeroBB(doc[0]); + titulosBancoBrasil.setCodCarteira(7); + titulosBancoBrasil.setFormaCadTituloBanco(" "); + titulosBancoBrasil.setTipoDocumento(" "); + titulosBancoBrasil.setIdentEmissaoBloqueto(" "); + titulosBancoBrasil.setIdentDistribuicao(" "); + titulosBancoBrasil.setNumeroDoDocumento(tupla[0].toString()); + titulosBancoBrasil.setVencimento((Date) tupla[10]); + titulosBancoBrasil.setValor(new BigDecimal(tupla[11].toString().replaceAll(",", "."))); + titulosBancoBrasil.setAgenciaCobradora(null); + titulosBancoBrasil.setDigAgenciaCobradora(null); + titulosBancoBrasil.setAceite(AceiteBB.NAO_ACEITE); + titulosBancoBrasil.setEmissao((Date) tupla[13]); + try{ + titulosBancoBrasil.setCodMora(1); + titulosBancoBrasil.setJurosDeMora(new BigDecimal(tupla[16].toString().replaceAll(",", "."))); + titulosBancoBrasil.setDataMora((Date) tupla[10]); + }catch(NullPointerException e){ + titulosBancoBrasil.setCodMora(1); + titulosBancoBrasil.setDataMora((Date) tupla[10]); + titulosBancoBrasil.setJurosDeMora(BigDecimal.ZERO); + } + + try{ + titulosBancoBrasil.setCodigoDesconto(1); + titulosBancoBrasil.setDataDesconto((Date) tupla[10]); + titulosBancoBrasil.setDescontoConcedido(new BigDecimal(tupla[17].toString().replaceAll(",", "."))); + }catch(NullPointerException e){ + titulosBancoBrasil.setCodigoDesconto(1); + titulosBancoBrasil.setDataDesconto((Date) tupla[10]); + titulosBancoBrasil.setDescontoConcedido(BigDecimal.ZERO); + } + + titulosBancoBrasil.setIOF_Devido(BigDecimal.ZERO); + try{ + titulosBancoBrasil.setAbatimentoConcedido(new BigDecimal(tupla[18].toString().replaceAll(",", "."))); + }catch(NullPointerException e){ + titulosBancoBrasil.setAbatimentoConcedido(BigDecimal.ZERO); + } + titulosBancoBrasil.setNossoNumeroEmp(tupla[0].toString()); + titulosBancoBrasil.setCodigoProtesto(3); + titulosBancoBrasil.setDiasProtesto(0); + titulosBancoBrasil.setCodigoBaixa(2); + titulosBancoBrasil.setDiasBaixa(0); + titulosBancoBrasil.setNumeroContrato(Integer.parseInt(tupla[0].toString())); + + DetalheObrigatorioDadosPagadorBancoBrasil pagadorBancoBrasil = new DetalheObrigatorioDadosPagadorBancoBrasil(); + pagadorBancoBrasil.setTipoInscricaoSacado(Integer.parseInt(TipoInscricaoPagador.CNPJ.getId())); + pagadorBancoBrasil.setNomeSacado(tupla[21].toString()); + String cep = ""; + try{ + cep = StringUtils.right("00000000" + tupla[24].toString(), 8); + }catch(Exception e){ + cep = "00000000"; + } + int cepPrefix = Integer.parseInt(cep.substring(0, 5)); + int cepSufix = Integer.parseInt(cep.substring(5)); + pagadorBancoBrasil.setCepSacado(cepPrefix); + pagadorBancoBrasil.setSufixoCep(cepSufix); + pagadorBancoBrasil.setNossoNumeroNoBancoCorresp(""); + + try{ + pagadorBancoBrasil.setNumeroInscricaoSacado(tupla[20].toString()); + }catch(Exception e){ + throw new RuntimeException("O CNPJ do ponto de venda "+tupla[21]+" está fora do padrão, favor corrigir"); + } + + try{ + pagadorBancoBrasil.setLogradouroSacado(tupla[22].toString()); + }catch(Exception e){ + throw new RuntimeException("O Logradouro do ponto de venda "+tupla[21]+" está fora do padrão, favor corrigir"); + } + + try{ + pagadorBancoBrasil.setBairroSacado(tupla[23].toString()); + }catch(Exception e){ + throw new RuntimeException("O Bairro do ponto de venda "+tupla[21]+" está fora do padrão, favor corrigir"); + } + + try{ + pagadorBancoBrasil.setCidade(tupla[25].toString()); + }catch(Exception e){ + throw new RuntimeException("A cidade do ponto de venda "+tupla[21]+" está fora do padrão, favor corrigir"); + } + + try{ + pagadorBancoBrasil.setEstado(tupla[26].toString()); + }catch(Exception e){ + throw new RuntimeException("O Estado do ponto de venda "+tupla[21]+" está fora do padrão, favor corrigir"); + } + + titulosBancoBrasil.setDetalheObrigatorioDadosPagadorBancoBrasil(pagadorBancoBrasil); + + arquivoRemessaItem.addTitulo(titulosBancoBrasil); + + } + + if(true && arquivoRemessaItem != null){ + rodapeRemessaLoteBancoBrasil = new RodapeRemessaLoteBancoBrasil(); + //rodapeRemessaLoteBancoBrasil.setLoteServico(loteCount); + + rodapeRemessaBancoBrasil = new RodapeRemessaBancoBrasil(); + //rodapeRemessaBancoBrasil.setLoteServico(9999); + rodapeRemessaBancoBrasil.setQtdContas(0); + + rodapeRemessaBancoBrasil.setRodapeRemessaLoteBancoBrasil(rodapeRemessaLoteBancoBrasil); + + arquivoRemessaItem.setRodapeRemessa(rodapeRemessaBancoBrasil); + } + + nomeArquivo = nomeArquivo + new DecimalFormat("##").format(variavel) + ".REM"; + arquivoRemessa.setNomeArquivo(nomeArquivo); + + return arquivoRemessa; + } + + @Override + public ArquivoRemessa remessaSicoob(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception { + + StringBuilder sb = new StringBuilder(); + + sb.append("SELECT "); + sb.append("fb.FECHAMENTOBOLETO_ID AS \"id\", "); + sb.append("(NVL(fp.COUNT_REMESSA, 0) + 1) AS \"idRemessa\", "); + sb.append("fp.COD_EMP_BANCO AS \"codEmpresaBanco\", "); + sb.append("emp.CNPJ AS \"cnpj\", "); + sb.append("emp.NOMBEMPRESA AS \"nomeEmpresa\", "); + sb.append("fp.BOLETO_BANCO_AGENCIA AS \"agencia\", "); + sb.append("fp.BOLETO_BANCO_CONTA AS \"conta\", "); + sb.append("fp.BOLETO_BANCO_CONTA_DIGITO AS \"dac\", "); + sb.append("fp.BOLETO_BANCO_CARTEIRA AS \"carteira\", "); + sb.append("fb.NOSSONUMERO AS \"nossoNumero\", "); + sb.append("fb.FECVENCIMENTO AS \"vencimento\", "); + sb.append("fb.VALORDOCUMENTO AS \"valor\", "); + sb.append("99 AS \"especieTitulo\", "); + sb.append("fb.FECDOCUMENTO AS \"dataEmissao\", "); + sb.append("' ' AS \"instrucao1\", "); + sb.append("' ' AS \"instrucao2\", "); + sb.append("fb.MORA AS \"valorAtraso\", "); + sb.append("fb.DESCONTOS AS \"valorDesconto\", "); + sb.append("fb.DEDUCOES AS \"valorAbatimento\", "); + sb.append("'cnpj' as \"tipoInscricaoPagador\", "); + sb.append("pv.NUMDOCPUNTOVENTA AS \"numeroInscricaoPagador\", "); + sb.append("pv.NOMBPUNTOVENTA AS \"nomePagador\", "); + sb.append("pv.DIRECCIONCALLE || ', ' || pv.DIRECCIONNUMERO AS \"logradouroPagador\", "); + sb.append("pl.NOMBPLAZA AS \"bairroPagador\", "); + sb.append("pv.CODPOSTAL AS \"cepPagador\", "); + sb.append("ci.NOMBCIUDAD AS \"cidadePagador\", "); + sb.append("es.NOMBESTADO AS \"estadoPagador\", "); + sb.append("fp.BOLETO_BANCO_AGENCIA_DIGITO AS \"digitoAgencia\", "); + sb.append("fp.BOLETO_BANCO_CARTEIRA_VARIAVEL AS \"variavelCarteira\" "); + writeFROMClause(sb, dataDe != null && dataAte != null, reenviar); + + Query query = getSession().createSQLQuery(sb.toString()); + query.setInteger("empresaId", empresa.getEmpresaId()); + if(dataDe != null && dataAte != null){ + query.setDate("dataDe", dataDe); + query.setDate("dataAte", dataAte); + } + List list = query.list(); + + ArquivoRemessa arquivoRemessa = new ArquivoRemessa(BancoLayout.SICOOB_240_Envio); + + String nomeArquivo = "Sicoob" + new SimpleDateFormat("ddMM").format(new Date()); + int variavel = 0; + int seqRegistro = 0; + int qtdeTitulos = 0; + BigDecimal valorTitulos = BigDecimal.ZERO; + + ArquivoRemessaItem arquivoRemessaItem = null; + CabecalhoRemessaSicoob cabecalhoRemessaSicoob = null; + CabecalhoLoteRemessaSicoob cabecalhoLoteRemessaSicoob = null; + RodapeRemessaLoteSicoob rodapeRemessaLoteSicoob = null; + RodapeRemessaSicoob rodapeRemessaSicoob = null; + + for(Object[] tupla : list){ + + Integer idRemessa = Integer.valueOf(tupla[1].toString()); + variavel = idRemessa; + String codEmpresaBanco = tupla[2] == null ? "" : ((BigDecimal) tupla[2]).toString(); + codEmpresaBanco = StringUtils.right("000000000" + codEmpresaBanco, 9); + String nomeEmpresa = tupla[4].toString(); + BigDecimal valor = new BigDecimal(tupla[11].toString().replaceAll(",", ".")); + + qtdeTitulos++; + valorTitulos.add( valor ); + + if(cabecalhoRemessaSicoob == null ){ + cabecalhoRemessaSicoob = new CabecalhoRemessaSicoob(); + + cabecalhoRemessaSicoob.setCpfCnpj(Integer.parseInt(TipoInscricaoPagador.CNPJ.getId())); + cabecalhoRemessaSicoob.setNumCpfCnpj(tupla[3].toString()); + cabecalhoRemessaSicoob.setNumAgencia(tupla[5].toString()); + cabecalhoRemessaSicoob.setDigAgencia(((BigDecimal) tupla[27]).toString()); + cabecalhoRemessaSicoob.setNumContaCorrente(tupla[6].toString()); + cabecalhoRemessaSicoob.setDigContaCorrente(tupla[7].toString()); + cabecalhoRemessaSicoob.setNomeEmpresa(nomeEmpresa); + cabecalhoRemessaSicoob.setNumRemessa(idRemessa); + cabecalhoRemessaSicoob.setDataGravacao(new Date()); + cabecalhoRemessaSicoob.setNumConvenio(codEmpresaBanco); + + cabecalhoLoteRemessaSicoob = new CabecalhoLoteRemessaSicoob(); + cabecalhoLoteRemessaSicoob.setCpfCnpj(Integer.parseInt(TipoInscricaoPagador.CNPJ.getId())); + cabecalhoLoteRemessaSicoob.setNumCpfCnpj(tupla[3].toString()); + cabecalhoLoteRemessaSicoob.setNumAgencia(tupla[5].toString()); + cabecalhoLoteRemessaSicoob.setDigAgencia(((BigDecimal) tupla[27]).toString()); + cabecalhoLoteRemessaSicoob.setNumContaCorrente(tupla[6].toString()); + cabecalhoLoteRemessaSicoob.setDigContaCorrente(tupla[7].toString()); + cabecalhoLoteRemessaSicoob.setNomeEmpresa(nomeEmpresa); + cabecalhoLoteRemessaSicoob.setNumeroRemessa(idRemessa); + cabecalhoLoteRemessaSicoob.setDataGeracao(new Date()); + + cabecalhoRemessaSicoob.setCabecalhoLoteRemessaSicoob(cabecalhoLoteRemessaSicoob); + + arquivoRemessaItem = new ArquivoRemessaSicoob(); + arquivoRemessaItem.setCabecalhoRemessa(cabecalhoRemessaSicoob); + + arquivoRemessa.addItem(arquivoRemessaItem); + }else { + try{ + if( !(cabecalhoRemessaSicoob.getNumConvenio()).equals(codEmpresaBanco)) { + throw new RuntimeException("O codigo de convênio não confere com o codigo do banco \r\n favor entrar em contato com o suporte! "); + } + }catch(Exception e){ + throw new RuntimeException("Houve um erro na montagem do cabeçalho do arquivo de remessa \r\n favor entrar em contato com o suporte! "); + } + } + + String []doc = tupla[9].toString().split("-"); + + DetalheObrigatorioSicoob titulosSicoob = new DetalheObrigatorioSicoob(); + titulosSicoob.setIdBoletoFechamento(Integer.valueOf(tupla[0].toString())); + titulosSicoob.setNumSeqRegistro( seqRegistro++ ); + titulosSicoob.setNumAgencia(tupla[5].toString()); + titulosSicoob.setDigAgencia(((BigDecimal) tupla[27]).toString()); + titulosSicoob.setNumContaCorrente(tupla[6].toString()); + titulosSicoob.setDigContaCorrente(tupla[7].toString()); + titulosSicoob.setNossoNumero(doc[0]); + titulosSicoob.setNumeroDoDocumento(tupla[0].toString()); + titulosSicoob.setVencimento((Date) tupla[10]); + titulosSicoob.setValor( valor ); + titulosSicoob.setEmissao((Date) tupla[13]); + try{ + titulosSicoob.setCodMora(1); + titulosSicoob.setJurosDeMora(new BigDecimal(tupla[16].toString().replaceAll(",", "."))); + titulosSicoob.setDataMora((Date) tupla[10]); + }catch(NullPointerException e){ + titulosSicoob.setCodMora(1); + titulosSicoob.setDataMora((Date) tupla[10]); + titulosSicoob.setJurosDeMora(BigDecimal.ZERO); + } + + try{ + titulosSicoob.setCodigoDesconto(1); + titulosSicoob.setDataDesconto((Date) tupla[10]); + titulosSicoob.setDescontoConcedido(new BigDecimal(tupla[17].toString().replaceAll(",", "."))); + }catch(NullPointerException e){ + titulosSicoob.setCodigoDesconto(1); + titulosSicoob.setDataDesconto((Date) tupla[10]); + titulosSicoob.setDescontoConcedido(BigDecimal.ZERO); + } + + titulosSicoob.setIofDevido(BigDecimal.ZERO); + try{ + titulosSicoob.setAbatimentoConcedido(new BigDecimal(tupla[18].toString().replaceAll(",", "."))); + }catch(NullPointerException e){ + titulosSicoob.setAbatimentoConcedido(BigDecimal.ZERO); + } + titulosSicoob.setNossoNumeroEmp(tupla[0].toString()); + titulosSicoob.setCodigoProtesto(3); + titulosSicoob.setDiasProtesto(0); + titulosSicoob.setCodigoBaixa(2); + titulosSicoob.setDiasBaixa(0); + titulosSicoob.setNumeroContrato(Integer.parseInt(tupla[0].toString())); + + DetalheObrigatorioDadosPagadorSicoob pagadorSicoob = new DetalheObrigatorioDadosPagadorSicoob(); + pagadorSicoob.setNumeroSequencialRegistro( seqRegistro++ ); + pagadorSicoob.setTipoInscricaoSacado(Integer.parseInt(TipoInscricaoPagador.CNPJ.getId())); + pagadorSicoob.setNomeSacado(tupla[21].toString()); + String cep = ""; + try{ + cep = StringUtils.right("00000000" + tupla[24].toString(), 8); + }catch(Exception e){ + cep = "00000000"; + } + int cepPrefix = Integer.parseInt(cep.substring(0, 5)); + int cepSufix = Integer.parseInt(cep.substring(5)); + pagadorSicoob.setCepSacado(cepPrefix); + pagadorSicoob.setSufixoCep(cepSufix); + pagadorSicoob.setCodBancoCorresp(0); + pagadorSicoob.setNossoNumeroNoBancoCorresp(""); + + try{ + pagadorSicoob.setNumeroInscricaoSacado(tupla[20].toString()); + }catch(Exception e){ + throw new RuntimeException("O CNPJ do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + pagadorSicoob.setLogradouroSacado(tupla[22].toString()); + }catch(Exception e){ + throw new RuntimeException("O Logradouro do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + pagadorSicoob.setBairroSacado(tupla[23].toString()); + }catch(Exception e){ + throw new RuntimeException("O Bairro do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + pagadorSicoob.setCidade(tupla[25].toString()); + }catch(Exception e){ + throw new RuntimeException("A cidade do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + try{ + pagadorSicoob.setEstado(tupla[26].toString()); + }catch(Exception e){ + throw new RuntimeException("O Estado do ponto de venda "+tupla[20]+" está fora do padrão, favor corrigir"); + } + + titulosSicoob.setDetalheObrigatorioDadosPagadorSicoob(pagadorSicoob); + + arquivoRemessaItem.addTitulo(titulosSicoob); + + } + + if(arquivoRemessaItem != null){ + rodapeRemessaLoteSicoob = new RodapeRemessaLoteSicoob(); + rodapeRemessaLoteSicoob.setNumeroSequencialRegistro(qtdeTitulos); + rodapeRemessaLoteSicoob.setValorRegistros( valorTitulos ); + + rodapeRemessaSicoob = new RodapeRemessaSicoob(); + rodapeRemessaSicoob.setQtdLotes(1); + rodapeRemessaSicoob.setQtdArquivos(qtdeTitulos); + rodapeRemessaSicoob.setQtdContas(0); + + rodapeRemessaSicoob.setRodapeRemessaLoteSicoob(rodapeRemessaLoteSicoob); + + arquivoRemessaItem.setRodapeRemessa(rodapeRemessaSicoob); + } + + nomeArquivo = nomeArquivo + new DecimalFormat("##").format(variavel) + ".REM"; + arquivoRemessa.setNomeArquivo(nomeArquivo); + + return arquivoRemessa; + } + + @Override + public ArquivoRemessa remessaCaixa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) throws Exception { + + StringBuilder sb = new StringBuilder(); + + sb.append("SELECT "); + sb.append("fb.FECHAMENTOBOLETO_ID AS \"id\", "); + sb.append("(NVL(fp.COUNT_REMESSA, 0) + 1) AS \"idRemessa\", "); + sb.append("fp.COD_EMP_BANCO AS \"codEmpresaBanco\", "); + sb.append("emp.CNPJ AS \"cnpj\", "); + sb.append("emp.NOMBEMPRESA AS \"nomeEmpresa\", "); + sb.append("fp.BOLETO_BANCO_AGENCIA AS \"agencia\", "); + sb.append("fb.NOSSONUMERO AS \"nossoNumero\", "); + sb.append("fb.FECVENCIMENTO AS \"vencimento\", "); + sb.append("fb.VALORDOCUMENTO AS \"valor\", "); + sb.append("fb.FECDOCUMENTO AS \"dataEmissao\", "); + sb.append("(nvl(fb.porc_mora, 0)) AS \"porcMora\", "); + sb.append("fb.DESCONTOS AS \"valorDesconto\", "); + sb.append("fb.DEDUCOES AS \"valorAbatimento\", "); + sb.append("'cnpj' as \"tipoInscricaoPagador\", "); + sb.append("pv.NUMDOCPUNTOVENTA AS \"numeroInscricaoPagador\", "); + sb.append("pv.NOMBPUNTOVENTA AS \"nomePagador\", "); + sb.append("pv.DIRECCIONCALLE || ', ' || pv.DIRECCIONNUMERO AS \"logradouroPagador\", "); + sb.append("pl.NOMBPLAZA AS \"bairroPagador\", "); + sb.append("pv.CODPOSTAL AS \"cepPagador\", "); + sb.append("ci.NOMBCIUDAD AS \"cidadePagador\", "); + sb.append("es.NOMBESTADO AS \"estadoPagador\" "); + writeFROMClause(sb, dataDe != null && dataAte != null, reenviar); + + Query query = getSession().createSQLQuery(sb.toString()); + query.setInteger("empresaId", empresa.getEmpresaId()); + if(dataDe != null && dataAte != null){ + query.setDate("dataDe", dataDe); + query.setDate("dataAte", dataAte); + } + List list = query.list(); + + ArquivoRemessa arquivoRemessa = new ArquivoRemessa(BancoLayout.CAIXA_400_Envio); + + String nomeArquivo = "CEF" + new SimpleDateFormat("ddMM").format(new Date()); + int variavel = 0; + int seqRegistro = 0; + int qtdeTitulos = 0; + + ArquivoRemessaItem arquivoRemessaItem = null; + CabecalhoRemessaCaixa cabecalhoRemessaCaixa = null; + RodapeRemessaPadrao rodape = null; + + for(Object[] tupla : list){ + + Integer idRemessa = Integer.valueOf(tupla[1].toString()); + variavel = idRemessa; + String codEmpresaBanco = tupla[2] == null ? "" : ((BigDecimal) tupla[2]).toString(); + String versao = codEmpresaBanco.length() >6 ?"007":""; + codEmpresaBanco = StringUtils.right("0000000" + codEmpresaBanco, 7); + String nomeEmpresa = tupla[4].toString(); + BigDecimal valor = new BigDecimal(tupla[8].toString().replaceAll(",", ".")); + + qtdeTitulos++; + + if(cabecalhoRemessaCaixa == null ){ + cabecalhoRemessaCaixa = new CabecalhoRemessaCaixa(); + + cabecalhoRemessaCaixa.setAgenciaBeneficiario(tupla[5].toString()); + cabecalhoRemessaCaixa.setCodigoEmpresa(codEmpresaBanco); + cabecalhoRemessaCaixa.setNomeEmpresa(nomeEmpresa); + cabecalhoRemessaCaixa.setDataGravacao(new Date()); + cabecalhoRemessaCaixa.setNumeroSequencialRemessa(idRemessa); + cabecalhoRemessaCaixa.setVersaoLayout(versao); + + arquivoRemessaItem = new ArquivoRemessaCaixa(); + arquivoRemessaItem.setCabecalhoRemessa(cabecalhoRemessaCaixa); + arquivoRemessa.addItem(arquivoRemessaItem); + + } + + DetalheObrigatorioCaixa titulosCaixa = new DetalheObrigatorioCaixa(); + titulosCaixa.setIdBoletoFechamento(Integer.valueOf(tupla[0].toString())); + + titulosCaixa.setNumeroSequencialRegistro( seqRegistro++ ); + titulosCaixa.setNossoNumero(tupla[6].toString()); + titulosCaixa.setNumeroDoDocumento(tupla[0].toString()); + titulosCaixa.setVencimento((Date) tupla[7]); + titulosCaixa.setValor( valor ); + titulosCaixa.setEmissao((Date) tupla[9]); + + try{ + titulosCaixa.setValorAtraso( calculaValorMora( new BigDecimal(tupla[10].toString().replaceAll(",", ".") ), valor )); + }catch(NullPointerException e){ + titulosCaixa.setValorAtraso(BigDecimal.ZERO); + } + + try{ + titulosCaixa.setDataLimiteDesconto((Date) tupla[7]); + titulosCaixa.setValorDesconto(new BigDecimal(tupla[11].toString().replaceAll(",", "."))); + }catch(NullPointerException e){ + titulosCaixa.setDataLimiteDesconto((Date) tupla[7]); + titulosCaixa.setValorDesconto(BigDecimal.ZERO); + } + + titulosCaixa.setValorIOF(BigDecimal.ZERO); + try{ + titulosCaixa.setValorAbatimentoConcedido(new BigDecimal(tupla[12].toString().replaceAll(",", "."))); + }catch(NullPointerException e){ + titulosCaixa.setValorAbatimentoConcedido(BigDecimal.ZERO); + } + + titulosCaixa.setNomeSacado(tupla[15].toString()); + titulosCaixa.setTipoInscricaoPagador(TipoInscricaoPagador.CNPJ); + + try{ + titulosCaixa.setNumeroInscricao(tupla[3].toString().replaceAll("[^0-9]+", "")); + }catch(Exception e){ + throw new RuntimeException("O CNPJ do ponto de venda "+tupla[15]+" está fora do padrão, favor corrigir"); + } + + String cep = ""; + try{ + cep = StringUtils.right("00000000" + tupla[18].toString(), 8); + }catch(Exception e){ + cep = "00000000"; + } + + titulosCaixa.setCepSacado(cep); + + try{ + titulosCaixa.setNumeroInscricaoSacado(tupla[14].toString()); + }catch(Exception e){ + throw new RuntimeException("O CNPJ do ponto de venda "+tupla[15]+" está fora do padrão, favor corrigir"); + } + + try{ + titulosCaixa.setEnderecoSacado(tupla[16].toString()); + }catch(Exception e){ + throw new RuntimeException("O Logradouro do ponto de venda "+tupla[15]+" está fora do padrão, favor corrigir"); + } + + try{ + titulosCaixa.setBairroSacado(tupla[17].toString()); + }catch(Exception e){ + throw new RuntimeException("O Bairro do ponto de venda "+tupla[15]+" está fora do padrão, favor corrigir"); + } + + try{ + titulosCaixa.setCidade(tupla[19].toString()); + }catch(Exception e){ + throw new RuntimeException("A cidade do ponto de venda "+tupla[15]+" está fora do padrão, favor corrigir"); + } + + try{ + titulosCaixa.setEstado(tupla[20].toString()); + }catch(Exception e){ + throw new RuntimeException("O Estado do ponto de venda "+tupla[15]+" está fora do padrão, favor corrigir"); + } + + titulosCaixa.setSacadorAvalista(""); + + arquivoRemessaItem.addTitulo(titulosCaixa); + + } + + if(rodape == null){ + rodape = new RodapeRemessaPadrao(); + rodape.setNumeroSequencialRegistro(qtdeTitulos); + arquivoRemessaItem.setRodapeRemessa(rodape); + } + + nomeArquivo = nomeArquivo + new DecimalFormat("##").format(variavel) + ".REM"; + arquivoRemessa.setNomeArquivo(nomeArquivo); + + return arquivoRemessa; + } + + private void writeFROMClause(StringBuilder sb, boolean hasDate, Boolean reenviar) { + sb.append(" FROM "); + sb.append(" FECHAMENTO_BOLETO fb "); + sb.append(" INNER JOIN FECHAMENTO_CNTCORRENTE fc on fb.FECHAMENTOCNTCORRENTE_ID = fc.FECHAMENTOCNTCORRENTE_ID AND fc.ACTIVO = 1 "); + sb.append(" INNER JOIN PUNTO_VENTA pv on pv.PUNTOVENTA_ID = fc.PUNTOVENTA_ID AND pv.ACTIVO = 1 "); + sb.append(" INNER JOIN EMPRESA emp on emp.EMPRESA_ID = fc.EMPRESA_ID AND emp.ACTIVO = 1 "); + sb.append(" INNER JOIN FECHAMENTO_PARAMGERAL fp on fp.EMPRESA_ID = emp.EMPRESA_ID AND fp.ACTIVO = 1 "); + sb.append(" INNER JOIN FECHAMENTO_PARAMPTOVTA fppv on fppv.EMPRESA_ID = emp.EMPRESA_ID AND fppv.ACTIVO = 1 and pv.PUNTOVENTA_ID = fppv.PUNTOVENTA_ID AND fppv.TIPOPAGAMENTO = 'B' "); + sb.append(" LEFT JOIN INSTI_FINANCEIRA ifi ON ifi.CODIGO = fp.BOLETO_BANCO_COD "); + sb.append(" LEFT JOIN PARADA pa on pa.PARADA_ID = pv.PARADA_ID AND pa.ACTIVO = 1 "); + sb.append(" LEFT JOIN CIUDAD ci on ci.CIUDAD_ID = pa.CIUDAD_ID AND ci.ACTIVO = 1 "); + sb.append(" LEFT JOIN PLAZA pl on pl.PLAZA_ID = ci.PLAZA_ID AND pl.ACTIVO = 1 "); + sb.append(" LEFT JOIN ESTADO es on es.ESTADO_ID = ci.ESTADO_ID AND es.ACTIVO = 1 "); + sb.append(" LEFT JOIN EMPRESA_CONTABANCARIA ecb ON emp.EMPRESA_ID = ecb.EMPRESA_ID AND ifi.INSTIFINANCEIRA_ID = ecb.INSTIFINANCEIRA_ID AND ecb.ACTIVO = 1 "); + sb.append(" WHERE fb.activo = 1 "); + + if(!reenviar){ + sb.append(" AND fb.REMESSA_ID IS NULL "); + } + + sb.append(" AND fp.EMPRESA_ID = :empresaId "); + + if(hasDate){ + sb.append(" AND fb.FECDOCUMENTO BETWEEN :dataDe AND :dataAte "); + } + + sb.append(" ORDER BY "); + sb.append(" fb.FECMODIF, fb.FECDOCUMENTO "); + + } + + @Override + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) { + + StringBuilder sb = new StringBuilder(); + sb.append(" SELECT "); + sb.append(" fb.FECHAMENTOBOLETO_ID AS fechamentoboletoId, "); + sb.append(" fb.nossonumero, "); + sb.append(" fb.FECDOCUMENTO, "); + sb.append(" fb.FECVENCIMENTO, "); + sb.append(" fb.VALORDOCUMENTO, "); + sb.append(" fb.STATUS, "); + sb.append(" fb.REMESSA_ID as remessaId, "); + sb.append(" fc.FECHAMENTOCNTCORRENTE_ID as fcId, "); + sb.append(" emp.NOMBEMPRESA, "); + sb.append(" pv.NOMBPUNTOVENTA, "); + sb.append(" emp.EMPRESA_ID AS codEmpresaBanco, "); + sb.append(" pv.PUNTOVENTA_ID "); + + writeFROMClause(sb, dataDe != null && dataAte != null, reenviar); + + Query query = getSession().createSQLQuery(sb.toString()); + query.setInteger("empresaId", empresa.getEmpresaId()); + + if(dataDe != null && dataAte != null){ + query.setDate("dataDe", dataDe); + query.setDate("dataAte", dataAte); + } + + List list = query.list(); + List retorno = new ArrayList(); + + for(Object[] tupla : list){ + FechamentoBoleto fb = new FechamentoBoleto(); + fb.setFechamentoboletoId( Long.valueOf(tupla[0].toString())); + fb.setNossonumero( tupla[1].toString()); + fb.setFecdocumento( (Date)tupla[2]); + fb.setFecvencimento( (Date)tupla[3]); + fb.setValordocumento( (BigDecimal)tupla[4]); + fb.setStatus( tupla[5].toString() ); + fb.setRemessaId( tupla[6]==null?null:Long.valueOf(tupla[6].toString()) ); + + FechamentoCntcorrente fcc = new FechamentoCntcorrente(); + fcc.setFechamentocntcorrenteId( Long.valueOf(tupla[7].toString())); + + Integer codEmpresaBanco = tupla[10] != null ? Integer.valueOf(tupla[10].toString()) : 0; + fcc.setEmpresa( new Empresa(codEmpresaBanco, tupla[8].toString())); + + Integer codPuntoVenta = tupla[11] != null ? Integer.valueOf(tupla[11].toString()) : 0; + fcc.setPuntoventa( new PuntoVenta(codPuntoVenta, tupla[9].toString())); + + fb.setFechamentoCntcorrente(fcc); + + retorno.add(fb); + } + + + return retorno; + } + + @Override + public Boolean atualizaRemessa(Empresa empresa, ArquivoRemessa arquivoRemessa) throws Exception { + + if(arquivoRemessa == null || arquivoRemessa.getItens() == null) { + return false; + } + + String ids = ""; + int count = 0; + int seqRemessa = 0; + + @SuppressWarnings("deprecation") + Connection con = getSession().connection(); + Statement stmt = con.createStatement(); + con.setAutoCommit(false); + + for(ArquivoRemessaItemInteface ar : arquivoRemessa.getItens()){ + + for(DetalheObrigatorio boleto : ar.getTitulos()){ + + if(count == 50){ + ids = ids.substring(1); + stmt.addBatch("UPDATE FECHAMENTO_BOLETO SET REMESSA_ID = " + seqRemessa + " WHERE FECHAMENTOBOLETO_ID IN ( " + ids + " )"); + count = 0; + ids = ""; + } + + ids += "," + boleto.getIdBoletoFechamento(); + seqRemessa = ar.getCabecalhoRemessa().getNumeroSequencialRemessa(); + + count++; + } + } + + if(count < 50){ + ids = ids.substring(1); + stmt.addBatch("UPDATE FECHAMENTO_BOLETO SET REMESSA_ID = " + seqRemessa + " WHERE FECHAMENTOBOLETO_ID IN ( " + ids + " )"); + count = 0; + ids = ""; + } + + stmt.addBatch("UPDATE FECHAMENTO_PARAMGERAL SET COUNT_REMESSA = " + seqRemessa + " WHERE EMPRESA_ID = " + empresa.getEmpresaId()); + + stmt.executeBatch(); + con.commit(); + stmt.close(); + + + + return Boolean.TRUE; + } + + public String buscarConstante(String nombre) { + StringBuilder HQL = new StringBuilder(); + HQL.append(" select "); + HQL.append(" valorconstante "); + HQL.append(" from "); + HQL.append(" Constante "); + HQL.append(" where "); + HQL.append(" nombconstante = :nombre "); + HQL.append(" and activo = 1 "); + Query query = getSession().createQuery(HQL.toString()); + query.setParameter("nombre", nombre); + return (String) query.uniqueResult(); + } + + @Override + public List getEmpresas() { + + Query query = getSession().createQuery("SELECT param.empresa FROM FechamentoParamgeral param WHERE param.activo = 1 AND param.empresa.activo = 1"); + + return (List) query.list(); + } + + private String gerarCodigoTransmissao(String agencia, String agenciaDigito, String numeroConvenio, String numeroConta, String contaDigito) { + + StringBuilder sb = new StringBuilder(); + sb.append(StringUtils.leftPad(agencia, 4, '0')); + sb.append(StringUtils.leftPad(numeroConvenio, 8, '0')); + sb.append(StringUtils.leftPad(numeroConta.substring(0,numeroConta.length()-1), 8,'0')); // 2271 01152386 01300052 + + + return sb.toString(); + } + + private BigDecimal calculaValorMora( BigDecimal mora, BigDecimal valor ) { + if( mora != null && mora.compareTo(BigDecimal.ZERO) > 0 ) { + BigDecimal valorMora = (valor.multiply(mora)).divide( new BigDecimal("100")); + return valorMora.setScale(2, RoundingMode.HALF_UP); + }else { + return BigDecimal.ZERO; + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RequisicionBoletoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RequisicionBoletoHibernateDAO.java new file mode 100644 index 000000000..ce0bfa8c2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RequisicionBoletoHibernateDAO.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.RequisicionBoletoDAO; +import com.rjconsultores.ventaboletos.entidad.RequisicionBoleto; + +@Repository("requisicionBoletoDAO") +public class RequisicionBoletoHibernateDAO extends GenericHibernateDAO + implements RequisicionBoletoDAO { + + @Autowired + public RequisicionBoletoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservaEspecialClienteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservaEspecialClienteHibernateDAO.java new file mode 100644 index 000000000..872f2af8b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservaEspecialClienteHibernateDAO.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ReservaEspecialClienteDAO; +import com.rjconsultores.ventaboletos.entidad.ReservaEspecialCliente; + +@Repository("reservaEspecialClienteDAO") +public class ReservaEspecialClienteHibernateDAO extends GenericHibernateDAO + implements ReservaEspecialClienteDAO { + + private static final String FIELD_ACTIVO = "activo"; + + @Autowired + public ReservaEspecialClienteHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List bucarReservaEspecialByClienteId(Long clienteId) { + Criteria c = getCriteriaClienteActivo(); + c.add(Restrictions.eq("clienteId", clienteId)); + c.addOrder(Order.asc("reservaEspecialClienteId")); + + return c.list(); + } + + + + private Criteria getCriteriaClienteActivo() { + Criteria criteria = getSession().createCriteria(getPersistentClass()); + criteria.add(Restrictions.eq(FIELD_ACTIVO, Boolean.TRUE)); + return criteria; + } + + @Override + public List bucarReservaEspecialByCorridaId(Long corridaId) { + Criteria c = getCriteriaClienteActivo(); + c.add(Restrictions.eq("corridaId", corridaId)); + c.addOrder(Order.asc("reservaEspecialClienteId")); + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCategoriaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCategoriaHibernateDAO.java new file mode 100644 index 000000000..74ad8a01f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCategoriaHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ReservacionCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionCategoria; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("reservacionCategoriaDAO") +public class ReservacionCategoriaHibernateDAO + extends GenericHibernateDAO + implements ReservacionCategoriaDAO { + + @Autowired + public ReservacionCategoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionClaseHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionClaseHibernateDAO.java new file mode 100644 index 000000000..9ab42bb61 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionClaseHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ReservacionClaseDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionClase; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("reservacionClaseDAO") +public class ReservacionClaseHibernateDAO + extends GenericHibernateDAO + implements ReservacionClaseDAO { + + @Autowired + public ReservacionClaseHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCtrlHibernateDAO.java new file mode 100644 index 000000000..ced580499 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionCtrlHibernateDAO.java @@ -0,0 +1,90 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ReservacionCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionCategoria; +import com.rjconsultores.ventaboletos.entidad.ReservacionCtrl; + +/** + * + * @author Administrador + */ +@Repository("reservacionCtrlDAO") +public class ReservacionCtrlHibernateDAO + extends GenericHibernateDAO + implements ReservacionCtrlDAO { + + @Autowired + public ReservacionCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscar(ReservacionCtrl reservacionCtrl) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descConfig", reservacionCtrl.getDescConfig())); + + return c.list(); + } + + @Override + public List buscarFechaTraslapa(ReservacionCtrl reservacionCtrlt) { + + Calendar fecinicio = Calendar.getInstance(); + fecinicio.setTime(reservacionCtrlt.getFecinicio()); + + Calendar fecfinal = Calendar.getInstance(); + fecfinal.setTime(reservacionCtrlt.getFecfinal()); + String ids = ""; + for (ReservacionCategoria r : reservacionCtrlt.getReservacionCategoriaList()) { + ids = ids + r.getCategoria().getCategoriaId() + " ,"; + } + ids = ids.substring(0, ids.length() - 1); + + StringBuilder hql = new StringBuilder(); + hql.append(" select distinct rc from ReservacionCtrl rc "); + hql.append(" inner join rc.reservacionCategoriaList lsCat "); + hql.append(" where lsCat.categoria.categoriaId in (" + ids + ") "); + hql.append(" and rc.activo = TRUE "); + // vigencia + hql.append(" AND (( rc.fecfinal between :fecfinal and :fecinicio "); + hql.append(" OR rc.fecinicio between :fecfinal and :fecinicio ) "); + hql.append(" OR ( :fecfinal between rc.fecfinal and rc.fecinicio "); + hql.append(" OR :fecinicio between rc.fecfinal and rc.fecinicio ) "); + hql.append(" OR ( rc.fecinicio <= :fecinicio and rc.fecfinal >= :fecfinal ) "); + hql.append(" OR ( :fecinicio <= rc.fecinicio and :fecfinal >= rc.fecfinal ) "); + hql.append(" OR ( rc.fecinicio >= :fecinicio and rc.fecfinal <= :fecfinal ) "); + hql.append(" OR ( :fecinicio >= rc.fecinicio and :fecfinal <= rc.fecfinal )) "); + // vigencia + + Query query = getSession().createQuery(hql.toString()); + query.setDate("fecfinal", fecfinal.getTime()); + query.setDate("fecinicio", fecinicio.getTime()); + + return query.list(); + + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMarcaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMarcaHibernateDAO.java new file mode 100644 index 000000000..426c0a889 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMarcaHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ReservacionMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionMarca; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("reservacionMarcaDAO") +public class ReservacionMarcaHibernateDAO extends GenericHibernateDAO + implements ReservacionMarcaDAO { + + @Autowired + public ReservacionMarcaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMercadoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMercadoHibernateDAO.java new file mode 100644 index 000000000..0b552198b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionMercadoHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ReservacionMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionMercado; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("reservacionMercadoDAO") +public class ReservacionMercadoHibernateDAO + extends GenericHibernateDAO + implements ReservacionMercadoDAO { + + @Autowired + public ReservacionMercadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionPuntoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionPuntoVentaHibernateDAO.java new file mode 100644 index 000000000..dc86be1bd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ReservacionPuntoVentaHibernateDAO.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ReservacionPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionPuntoVenta; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("reservacionPuntoVentaDAO") +public class ReservacionPuntoVentaHibernateDAO extends GenericHibernateDAO + implements ReservacionPuntoVentaDAO { + + @Autowired + public ReservacionPuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RestriccionPagoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RestriccionPagoHibernateDAO.java new file mode 100644 index 000000000..2ab1394a7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RestriccionPagoHibernateDAO.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.RestriccionPagoDAO; +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("restriccionDAO") +public class RestriccionPagoHibernateDAO extends GenericHibernateDAO + implements RestriccionPagoDAO { + + @Autowired + public RestriccionPagoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descrestriccion")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RhPagoConductorHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RhPagoConductorHibernateDAO.java new file mode 100644 index 000000000..22d7f148b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RhPagoConductorHibernateDAO.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.RhPagoConductorDAO; +import com.rjconsultores.ventaboletos.entidad.RhPagoConductor; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("rhPagoConductorDAO") +public class RhPagoConductorHibernateDAO extends GenericHibernateDAO + implements RhPagoConductorDAO { + + @Autowired + public RhPagoConductorHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descrestriccion")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RolOperativoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RolOperativoHibernateDAO.java new file mode 100644 index 000000000..460824217 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RolOperativoHibernateDAO.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.RolOperativoDAO; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; + +/** + * + * @author Rafius + */ +@SuppressWarnings("unchecked") +@Repository("rolOperativoDAO") +public class RolOperativoHibernateDAO extends GenericHibernateDAO + implements RolOperativoDAO { + + @Autowired + public RolOperativoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List pesquisar(DiagramaAutobus diagrama, String rol) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (diagrama != null) { + c.add(Restrictions.eq("diagramaAutobus", diagrama)); + } + if (rol != null) { + c.add(Restrictions.eq("descroloperativo", rol)); + } + return c.list(); + } + + public List buscar(String descroloperativo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descroloperativo", descroloperativo)); + + return c.list(); + } + + @Override + public List buscarListaPorIds(List roloperativoIds) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.in("roloperativoId", roloperativoIds)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCasetaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCasetaHibernateDAO.java new file mode 100644 index 000000000..dfce09e0f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCasetaHibernateDAO.java @@ -0,0 +1,24 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.RutaCasetaDAO; +import com.rjconsultores.ventaboletos.entidad.RutaCaseta; + +@Repository("rutaCasetaDAO") +public class RutaCasetaHibernateDAO extends GenericHibernateDAO +implements RutaCasetaDAO { + + @Autowired + public RutaCasetaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public void deletarRutaCasetasFromRutaSecuenciaId(Integer id){ + this.getSession().createQuery("DELETE from RutaCaseta rc WHERE rc.rutaSecuencia.rutasecuenciaId = "+id+" ").executeUpdate(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCombinacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCombinacionHibernateDAO.java new file mode 100644 index 000000000..ef8a54b3c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCombinacionHibernateDAO.java @@ -0,0 +1,1029 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.RutaCombinacionDAO; +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaGroupVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaOficialEscalaGroupVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaOficialEscalaVO; + +/** + * + * @author Rafius + */ +@Repository("rutaCombinacionDAO") +public class RutaCombinacionHibernateDAO extends GenericHibernateDAO implements RutaCombinacionDAO { + + private static Logger log = LoggerFactory.getLogger(RutaCombinacionHibernateDAO.class); + @Autowired + private TramoDAO tramoDAO; + + @Autowired + public RutaCombinacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public boolean busquedaRutaTramo(Ruta ruta, Tramo tramo, Boolean ativo) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + + if (ativo) { + c.add(Restrictions.eq("activo", Boolean.TRUE)); + } else { + c.add(Restrictions.eq("activo", Boolean.FALSE)); + } + + c.setProjection(Projections.rowCount()); + + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("tramo", tramo)); + + return HibernateFix.count(c.list()) > 0; + } + + public RutaCombinacion busquedaTramoRutaTramo(Ruta ruta, Tramo trBuscaOrigemDestino) { + + StringBuilder hql = new StringBuilder(); + hql.append(" select rc from RutaCombinacion rc, Tramo t "); + hql.append(" where rc.tramo.tramoId = t.tramoId and rc.activo = 0 "); + hql.append(" and rc.ruta.rutaId = ").append(ruta.getRutaId() ); + hql.append(" and t.origem.paradaId = ").append(trBuscaOrigemDestino.getOrigem().getParadaId() ); + hql.append(" and t.destino.paradaId = ").append(trBuscaOrigemDestino.getDestino().getParadaId() ); + Query sq = getSession().createQuery(hql.toString()); + + RutaCombinacion rc = new RutaCombinacion(); + if (sq.list().size() > 0) { + rc = (RutaCombinacion) sq.list().get(sq.list().size() - 1); + } + + return rc; + } + + public Tramo busqueda(Ruta ruta, Parada origen, Parada destino) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + Criteria c2 = c.createCriteria("tramo"); + c2.add(Restrictions.eq("origem", origen)); + c2.add(Restrictions.eq("destino", destino)); + c2.add(Restrictions.eq("activo", Boolean.TRUE)); + + List list = c.list(); + + if (list.size() != 1) { + return null; + } + return list.get(0).getTramo(); + } + + public RutaCombinacion busquedaTramoRutaOrigemDestino(Ruta ruta, Parada origem, Parada destino) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("ruta", ruta)); + + Criteria c2 = c.createCriteria("tramo"); + c2.add(Restrictions.eq("origem", origem)); + c2.add(Restrictions.eq("destino", destino)); + c2.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (c.list().size() > 0) { + return (RutaCombinacion) c.list().get(0); + } + + return null; + + } + + public RutaCombinacion busquedaTramoRutaOrigemDestino(Integer rutaId, Integer origemId, Integer destinoId) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("ruta.rutaId", rutaId)); + + Criteria c2 = c.createCriteria("tramo"); + c2.add(Restrictions.eq("origem.paradaId", origemId)); + c2.add(Restrictions.eq("destino.paradaId", destinoId)); + c2.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (c.list().size() > 0) { + return (RutaCombinacion) c.list().get(0); + } + + return null; + + } + + public List obtenerPorRuta(Ruta ruta) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public boolean buscarRutaCombinacionExisteTramo(Tramo tramo) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (c.list().isEmpty()) { + return false; + } else { + return true; + } + + + } + + @Override + public List tramosFaltantes(Integer rutaId) { + Session session = getSession(); + List lsTramoFaltantes = new ArrayList(); + + StringBuilder sb = new StringBuilder(""); + sb.append(" select t.origen_id, "); + sb.append(" rs.numsecuencia "); + sb.append(" from ruta_secuencia rs "); + sb.append(" inner join tramo t on t.tramo_id = rs.tramo_id "); + sb.append(" where rs.activo = 1 and "); + sb.append(" t.activo = 1 and "); + sb.append(" rs.ruta_id = :rutaId "); + sb.append(" union "); + sb.append(" select t.destino_id, "); + sb.append(" rs.numsecuencia "); + sb.append(" from ruta_secuencia rs "); + sb.append(" inner join tramo t on t.tramo_id = rs.tramo_id "); + sb.append(" where rs.activo = 1 and "); + sb.append(" t.activo = 1 and "); + sb.append(" rs.ruta_id = :rutaId and "); + sb.append(" rs.numsecuencia = "); + sb.append(" (select max(rs.numsecuencia) from "); + sb.append(" ruta_secuencia rs inner join tramo t on "); + sb.append(" t.tramo_id = rs.tramo_id where rs.activo = "); + sb.append(" 1 and t.activo = 1 and rs.ruta_id = :rutaId ) "); + sb.append(" order by 2 "); + + + SQLQuery sqlQuery = session.createSQLQuery(sb.toString()); + sqlQuery.setInteger("rutaId", rutaId); + + List lsParadas = sqlQuery.list(); + Integer origenId = null; + Integer destinoId = null; + for (int i = 0; i < lsParadas.size(); i++) { + origenId = ((BigDecimal) lsParadas.get(i)[0]).intValue(); + for (int j = i + 1; j < lsParadas.size(); j++) { + destinoId = ((BigDecimal) lsParadas.get(j)[0]).intValue(); + + log.debug(origenId + " - " + destinoId); + + sb = new StringBuilder(); + sb.append(" select count(*) "); + sb.append(" from ruta_combinacion rc "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sb.append(" where "); + sb.append(" rc.ruta_id = :rutaId "); + sb.append(" and rc.activo = 1 "); + sb.append(" and t.activo = 1 "); + sb.append(" and t.origen_id = :origenId "); + sb.append(" and t.destino_id = :destinoId "); + + + SQLQuery sqlQueryExists = session.createSQLQuery(sb.toString()); + sqlQueryExists.setInteger("rutaId", rutaId); + sqlQueryExists.setInteger("origenId", origenId); + sqlQueryExists.setInteger("destinoId", destinoId); + + Long count = HibernateFix.count(sqlQueryExists.list()); + + if (count == 0) { + log.info("No existe combinacion " + origenId + " - " + destinoId); + + + Parada paradaOrigem = new Parada(); + paradaOrigem.setParadaId(origenId); + + Parada paradaDestino = new Parada(); + paradaDestino.setParadaId(destinoId); + + List list = tramoDAO.obtenerListPorOrigemDestino(paradaOrigem, paradaDestino); + + if (list.size() == 0) { + log.info("No existe tramo " + origenId + " - " + destinoId); + } else { + lsTramoFaltantes.add(list.get(0)); + } + + } + } + + } + + return lsTramoFaltantes; + } + + public int borrarCombinaciones(Ruta ruta) { + Query query = this.getSession().createQuery("UPDATE RutaCombinacion set activo = false, fecmodif = current_timestamp(), usuarioId= :usuario where ruta = :ruta"); + query.setParameter("ruta", ruta); + query.setParameter("usuario", UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + return query.executeUpdate(); + } + + public void activar(Ruta ruta, Tramo trBuscaOrigemDestino) { + String sql = " select rc.rutacombinacionId from RutaCombinacion rc, Tramo t " + + " where rc.tramo.tramoId = t.tramoId and rc.activo = 0 " + + " and rc.ruta.rutaId = " + ruta.getRutaId() + + " and t.origem.paradaId = " + trBuscaOrigemDestino.getOrigem().getParadaId() + + " and t.destino.paradaId = " + trBuscaOrigemDestino.getDestino().getParadaId(); + + getSession().createQuery("update RutaCombinacion set activo = true where rutacombinacionId in (" + sql + " )").executeUpdate(); + } + + public List pesquisaTarifaObj(List lsMoneda, List lsMarca, List lsClaseServicio, List lsCategoria, List lsEmpresa, List lsRuta, List lsTipoPuntoVenta, List lsVigenciaTarifa, List lsOrgaoConcedente) { + + StringBuilder hql = new StringBuilder(" "); + hql.append(" SELECT "); + hql.append(" T.TARIFA_ID,"); // 0 + hql.append(" TRA.DESCTRAMO, "); // 1 + hql.append(" ORI.DESCPARADA as origem,"); // 2 + hql.append(" DES.DESCPARADA as destino, "); // 3 + hql.append(" R.DESCRUTA,"); // 4 + hql.append(" M.DESCMARCA, "); // 5 + hql.append(" CS.DESCCLASE,"); // 6 + hql.append(" VT.feciniciovigencia, "); // 7 + hql.append(" VT.fecfinvigencia,"); // 8 + hql.append(" MON.descmoneda, "); // 9 + hql.append(" T.preciooriginal, "); // 10 + hql.append(" T.PRECIO,"); // 11 + hql.append(" R.RUTA_ID,"); // 12 + hql.append(" MON.moneda_id,"); // 13 + hql.append(" VT.VIGENCIATARIFA_ID,"); // 14 + hql.append(" M.MARCA_ID, "); // 15 + hql.append(" T.IMPORTEPEDAGIO, "); // 16 + hql.append(" OCONC.DESCORGAO, "); // 17 + hql.append(" T.IMPORTETAXAEMBARQUE, "); // 18 + hql.append(" T.IMPORTESEGURO, "); // 19 + hql.append(" T.IMPORTETPP,"); //20 + hql.append(" R.NUMRUTA, "); // 21 + hql.append(" R.PREFIXO, "); // 22 + hql.append(" R.INDSENTIDOIDA, "); // 23 + hql.append(" RC.INDVENTA, "); // 24 + hql.append(" TRA.ORIGEN_ID ||'-'|| TRA.DESTINO_ID ||'-'|| M.EMPRESA_ID ||'-'|| R.RUTA_ID ||'-'|| CS.CLASESERVICIO_ID, "); // 25 + hql.append(" EMP.INDPRECOPORDEMANDA ");// 26 + + + hql.append(" FROM "); + hql.append(" RUTA_COMBINACION RC "); + hql.append(" inner join RUTA R on (RC.RUTA_ID = R.RUTA_ID) "); + hql.append(" inner join TRAMO TRA on (RC.TRAMO_ID = TRA.TRAMO_ID) "); + hql.append(" inner join ORGAO_CONCEDENTE OCONC on (R.ORGAOCONCEDENTE_ID = OCONC.ORGAOCONCEDENTE_ID) "); + hql.append(" , TARIFA T "); + if (!lsEmpresa.isEmpty()) { + hql.append(" , RUTA_EMPRESA RE "); + } + hql.append(" , MARCA M, EMPRESA EMP, MONEDA MON, VIGENCIA_TARIFA VT "); + hql.append(" , CLASE_SERVICIO CS , PARADA ORI, PARADA DES "); + hql.append(" WHERE T.activo = 1 AND RC.activo = 1 AND R.activo = 1 "); + if (!lsEmpresa.isEmpty()) { + hql.append(" AND RE.activo = 1 AND RC.RUTA_ID = RE.RUTA_ID "); + } + hql.append(" AND T.TRAMO_ID = TRA.TRAMO_ID "); + hql.append(" AND T.MARCA_ID = M.MARCA_ID "); + hql.append(" AND T.MONEDA_ID = MON.MONEDA_ID "); + hql.append(" AND T.VIGENCIATARIFA_ID = VT.VIGENCIATARIFA_ID "); + hql.append(" AND T.CLASESERVICIO_ID = CS.CLASESERVICIO_ID "); + hql.append(" AND T.CLASESERVICIO_ID = R.CLASESERVICIO_ID "); + hql.append(" AND TRA.ORIGEN_ID = ORI.PARADA_ID "); + hql.append(" AND TRA.DESTINO_ID = DES.PARADA_ID "); + hql.append(" AND T.RUTA_ID = R.RUTA_ID "); + hql.append(" AND M.EMPRESA_ID = EMP.EMPRESA_ID "); + + if (!lsVigenciaTarifa.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (VigenciaTarifa vt : lsVigenciaTarifa) { + sb.append(vt.getVigenciatarifaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND VT.VIGENCIATARIFA_ID in (").append(listInt).append(")"); + } + if (!lsEmpresa.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Empresa vt : lsEmpresa) { + sb.append(vt.getEmpresaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND RE.EMPRESA_ID in (").append(listInt).append(") "); + } + if (!lsRuta.isEmpty() && !lsRuta.toString().contains("TODAS")) { + StringBuilder sb = new StringBuilder(""); + for (Ruta vt : lsRuta) { + sb.append(vt.getRutaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND RC.RUTA_ID in (").append(listInt).append(")"); + } + if (!lsMarca.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Marca vt : lsMarca) { + sb.append(vt.getMarcaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND M.MARCA_ID in (").append(listInt).append(") "); + } + if (!lsMoneda.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Moneda vt : lsMoneda) { + sb.append(vt.getMonedaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND MON.MONEDA_ID in (").append(listInt).append(") "); + } + if (!lsClaseServicio.isEmpty() && !lsClaseServicio.toString().contains("TODAS")) { + StringBuilder sb = new StringBuilder(""); + for (ClaseServicio cs : lsClaseServicio) { + sb.append(cs.getClaseservicioId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND CS.CLASESERVICIO_ID in (").append(listInt).append(") "); + } + if (!lsOrgaoConcedente.isEmpty() && !lsOrgaoConcedente.toString().contains("TODOS")) { + StringBuilder sb = new StringBuilder(""); + for (OrgaoConcedente oc : lsOrgaoConcedente) { + sb.append(oc.getOrgaoConcedenteId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND OCONC.ORGAOCONCEDENTE_ID in (").append(listInt).append(") "); + } + + hql.append(" order by R.NUMRUTA, R.RUTA_ID, VT.VIGENCIATARIFA_ID, M.DESCMARCA,ORI.DESCPARADA,DES.DESCPARADA "); + + System.out.println(hql.toString()); + + List lsObj = this.getSession().createSQLQuery(hql.toString()).list(); + + return lsObj; + } + + public List pesquisaTarifaOficialObj(List lsMoneda, List lsMarca, List lsClaseServicio, List lsEmpresa, List lsRuta, List lsVigenciaTarifa) { + + StringBuilder hql = new StringBuilder(" "); + hql.append(" SELECT "); + hql.append(" T.TARIFAOFICIAL_ID, "); + hql.append(" TRA.DESCTRAMO, "); + hql.append(" ORI.DESCPARADA as origem, "); + hql.append(" DES.DESCPARADA as destino, "); + hql.append(" R.DESCRUTA,"); + hql.append(" M.DESCMARCA, "); + hql.append(" CS.DESCCLASE,'' as feciniciovigencia, "); + hql.append(" '' as fecfinvigencia, "); + hql.append(" MON.descmoneda, "); + hql.append(" T.preciooriginal, "); + hql.append(" T.PRECIO,R.RUTA_ID, "); + hql.append(" MON.moneda_id,'' AS VIGENCIATARIFA_ID, "); + hql.append(" M.MARCA_ID, "); + hql.append(" T.IMPORTETAXAEMBARQUE, "); + hql.append(" T.IMPORTESEGURO, "); + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.EXIBE_TPP.getDescricao())) { + hql.append(" T.IMPORTETPP, "); + } + hql.append(" T.IMPORTEPEDAGIO, "); + hql.append("T.IMPORTEOUTROS "); + hql.append(" FROM "); + hql.append(" RUTA_COMBINACION RC "); + hql.append(" inner join RUTA R on (RC.RUTA_ID = R.RUTA_ID) "); + hql.append(" inner join TRAMO TRA on (RC.TRAMO_ID = TRA.TRAMO_ID) "); + hql.append(" , TARIFA_OFICIAL T "); + if (!lsEmpresa.isEmpty()) { + hql.append(" , RUTA_EMPRESA RE "); + } + hql.append(" , MARCA M, MONEDA MON"); + hql.append(" , CLASE_SERVICIO CS , PARADA ORI, PARADA DES "); + hql.append(" WHERE T.activo = 1 AND RC.activo = 1 AND R.activo = 1 "); + if (!lsEmpresa.isEmpty()) { + hql.append(" AND RE.activo = 1 AND RC.RUTA_ID = RE.RUTA_ID "); + } + hql.append(" AND T.TRAMO_ID = TRA.TRAMO_ID "); + hql.append(" AND T.MARCA_ID = M.MARCA_ID "); + hql.append(" AND T.MONEDA_ID = MON.MONEDA_ID "); + hql.append(" AND T.CLASESERVICIO_ID = CS.CLASESERVICIO_ID "); + hql.append(" AND T.CLASESERVICIO_ID = R.CLASESERVICIO_ID "); + hql.append(" AND TRA.ORIGEN_ID = ORI.PARADA_ID "); + hql.append(" AND TRA.DESTINO_ID = DES.PARADA_ID "); + + if (!lsEmpresa.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Empresa vt : lsEmpresa) { + sb.append(vt.getEmpresaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND RE.EMPRESA_ID in (").append(listInt).append(") "); + } + if (!lsRuta.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Ruta vt : lsRuta) { + sb.append(vt.getRutaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + if (!listInt.contains("-1")){ + hql.append(" AND RC.RUTA_ID in (").append(listInt).append(")"); + } + } + if (!lsMarca.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Marca vt : lsMarca) { + sb.append(vt.getMarcaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND M.MARCA_ID in (").append(listInt).append(") "); + } + if (!lsMoneda.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Moneda vt : lsMoneda) { + sb.append(vt.getMonedaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND MON.MONEDA_ID in (").append(listInt).append(") "); + } + if (!lsClaseServicio.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (ClaseServicio cs : lsClaseServicio) { + sb.append(cs.getClaseservicioId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + //Tratando caso de conter opção TODAS + if(!listInt.contains("-1")) { + hql.append(" AND CS.CLASESERVICIO_ID in (").append(listInt).append(") "); + } + } + + hql.append(" order by R.DESCRUTA, R.RUTA_ID, RC.RUTACOMBINACION_ID,t.TARIFAOFICIAL_id "); + + List lsObj = this.getSession().createSQLQuery(hql.toString()).list(); + + return lsObj; + } + + public List pesquisaTarifaGroupObj(List lsMoneda, List lsMarca, List lsClaseServicio, List lsCategoria, List lsEmpresa, List lsRuta, List lsTipoPuntoVenta, List lsVigenciaTarifa) { + + StringBuilder sql = new StringBuilder(" "); + sql.append(" SELECT R.descruta, "); + sql.append(" R.RUTA_ID, "); + sql.append(" MON.moneda_id, "); + sql.append(" '' AS VIGENCIATARIFA_ID, "); + sql.append(" M.MARCA_ID, "); + sql.append(" mon.descmoneda, "); + sql.append(" vt.FECINICIOVIGENCIA, "); + sql.append(" vt.FECFINVIGENCIA, "); + sql.append(" M.descmarca, "); + sql.append(" CS.descclase "); + sql.append(" FROM "); + sql.append(" RUTA_COMBINACION RC "); + sql.append(" inner join RUTA R on (RC.RUTA_ID = R.RUTA_ID) "); + sql.append(" inner join TRAMO TRA on (RC.TRAMO_ID = TRA.TRAMO_ID) "); + sql.append(" , TARIFA_OFICIAL T , "); + sql.append(" RUTA_EMPRESA RE "); + sql.append(" , MARCA M, "); + sql.append(" MONEDA MON,"); + sql.append(" , CLASE_SERVICIO CS , "); + sql.append(" PARADA ORI, "); + sql.append(" PARADA DES "); + sql.append(" WHERE T.activo = 1 AND RC.activo = 1 AND RE.activo = 1 AND R.activo = 1 "); + sql.append(" AND T.TRAMO_ID = TRA.TRAMO_ID "); + sql.append(" AND RC.RUTA_ID = RE.RUTA_ID "); + sql.append(" AND T.MARCA_ID = M.MARCA_ID "); + sql.append(" AND T.MONEDA_ID = MON.MONEDA_ID "); + sql.append(" AND T.CLASESERVICIO_ID = CS.CLASESERVICIO_ID "); + sql.append(" AND T.CLASESERVICIO_ID = R.CLASESERVICIO_ID "); + sql.append(" AND TRA.ORIGEN_ID = ORI.PARADA_ID "); + sql.append(" AND TRA.DESTINO_ID = DES.PARADA_ID "); + + if (!lsEmpresa.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Empresa vt : lsEmpresa) { + sb.append(vt.getEmpresaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + sql.append(" AND RE.EMPRESA_ID in (").append(listInt).append(") "); + } + if (!lsRuta.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Ruta vt : lsRuta) { + sb.append(vt.getRutaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + sql.append(" AND RC.RUTA_ID in (").append(listInt).append(")"); + } + if (!lsMarca.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Marca vt : lsMarca) { + sb.append(vt.getMarcaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + sql.append(" AND M.MARCA_ID in (").append(listInt).append(") "); + } + if (!lsMoneda.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Moneda vt : lsMoneda) { + sb.append(vt.getMonedaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + sql.append(" AND MON.MONEDA_ID in (").append(listInt).append(") "); + } + if (!lsClaseServicio.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (ClaseServicio cs : lsClaseServicio) { + sb.append(cs.getClaseservicioId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + sql.append(" AND CS.CLASESERVICIO_ID in (").append(listInt).append(") "); + } + + sql.append(" GROUP by R.descruta,R.RUTA_ID,MON.moneda_id,VT.VIGENCIATARIFA_ID,M.MARCA_ID,mon.descmoneda,vt.FECINICIOVIGENCIA,vt.FECFINVIGENCIA, M.descmarca,CS.descclase "); + sql.append(" ORDER by R.descruta,R.RUTA_ID,MON.moneda_id,VT.VIGENCIATARIFA_ID,M.MARCA_ID"); + + SQLQuery query = getSession().createSQLQuery(sql.toString()); + query.setResultTransformer(new AliasToBeanResultTransformer(TarifaEscalaGroupVO.class)); + + return query.list(); + } + + public List pesquisaTarifaEscalaObj(String rutaId, String monedaId, String vigenciaId, String marcaId) { + + StringBuilder sql = new StringBuilder(" "); + sql.append("select distinct po.cveparada as cveOrigem,po.descparada as descOrigem, "); + sql.append(" pd.cveparada as cveDestino,pd.descparada as descDestino,tmp.numsecuencia as NUMSECORIGEM,tmp2.numsecuencia as NUMSECDESTINO, "); + sql.append(" ta.PRECIO as precio,ruta.ruta_id as rutaId,ruta.descruta as descruta "); + sql.append("from "); + sql.append(" ruta_combinacion rc "); + sql.append(" inner join ruta on (ruta.ruta_id = rc.ruta_id) "); + sql.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sql.append(" inner join parada po on po.parada_id = t.origen_id "); + sql.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sql.append(" inner join ( "); + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia+1 as numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.destino_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1 "); + sql.append(" and rownum =1 "); + sql.append(" and rs.numsecuencia = (select max(numsecuencia) from ruta_secuencia where activo = 1 and ruta_id = rs.ruta_id)) "); + sql.append(" "); + sql.append(" union "); + + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.origen_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1) "); + sql.append(" ) tmp on tmp.parada_id = po.parada_id "); + + sql.append("left join ( "); + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia+1 as numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.destino_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1 "); + sql.append(" and rs.numsecuencia = (select max(numsecuencia) from ruta_secuencia where activo = 1 and ruta_id = rs.ruta_id)) "); + sql.append(" union "); + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.origen_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1) "); + sql.append(" ) tmp2 on tmp2.parada_id = pd.parada_id "); + sql.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sql.append(" left join tarifa ta on ta.TRAMO_ID = rc.tramo_id and ta.claseservicio_id = r.claseservicio_id and ta.MONEDA_ID = ").append(monedaId).append(" and ta.activo = 1 "); + sql.append(" where "); + sql.append(" rc.ruta_id = ").append(rutaId); + sql.append(" and rc.activo = 1 "); + sql.append(" and ta.MARCA_ID = ").append(marcaId); + sql.append(" and ta.VIGENCIATARIFA_ID = ").append(vigenciaId); + sql.append(" and ta.moneda_id = ").append(monedaId); + sql.append(" order by ruta.ruta_id ,tmp.numsecuencia,tmp2.numsecuencia "); + + + SQLQuery query = getSession().createSQLQuery(sql.toString()); + query.setResultTransformer(new AliasToBeanResultTransformer(TarifaEscalaVO.class)); + + return query.list(); + } + + public List pesquisaTarifaOficialGroupObj(List lsMoneda, List lsMarca, List lsClaseServicio, List lsEmpresa, List lsRuta, List lsVigenciaTarifa) { + + StringBuilder sql = new StringBuilder(" "); + sql.append(" SELECT R.descruta,R.RUTA_ID,MON.moneda_id,M.MARCA_ID,mon.descmoneda, M.descmarca,CS.descclase "); + sql.append(" FROM "); + sql.append(" RUTA_COMBINACION RC "); + sql.append(" inner join RUTA R on (RC.RUTA_ID = R.RUTA_ID) "); + sql.append(" inner join TRAMO TRA on (RC.TRAMO_ID = TRA.TRAMO_ID) "); + sql.append(" , TARIFA_OFICIAL T , RUTA_EMPRESA RE "); + sql.append(" , MARCA M, MONEDA MON"); + sql.append(" , CLASE_SERVICIO CS , PARADA ORI, PARADA DES "); + sql.append(" WHERE T.activo = 1 AND RC.activo = 1 AND RE.activo = 1 AND R.activo = 1 "); + sql.append(" AND T.TRAMO_ID = TRA.TRAMO_ID "); + sql.append(" AND RC.RUTA_ID = RE.RUTA_ID "); + sql.append(" AND T.MARCA_ID = M.MARCA_ID "); + sql.append(" AND T.MONEDA_ID = MON.MONEDA_ID "); + sql.append(" AND T.CLASESERVICIO_ID = CS.CLASESERVICIO_ID "); + sql.append(" AND T.CLASESERVICIO_ID = R.CLASESERVICIO_ID "); + sql.append(" AND TRA.ORIGEN_ID = ORI.PARADA_ID "); + sql.append(" AND TRA.DESTINO_ID = DES.PARADA_ID "); + + if (!lsEmpresa.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Empresa vt : lsEmpresa) { + sb.append(vt.getEmpresaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + if(!listInt.contains("-1")){ + sql.append(" AND RE.EMPRESA_ID in (").append(listInt).append(") "); + } + } + if (!lsRuta.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Ruta vt : lsRuta) { + sb.append(vt.getRutaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + if(!listInt.contains("-1")){ + sql.append(" AND RC.RUTA_ID in (").append(listInt).append(")"); + } + } + if (!lsMarca.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Marca vt : lsMarca) { + sb.append(vt.getMarcaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + if(!listInt.contains("-1")){ + sql.append(" AND M.MARCA_ID in (").append(listInt).append(") "); + } + } + if (!lsMoneda.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Moneda vt : lsMoneda) { + sb.append(vt.getMonedaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + if(!listInt.contains("-1")){ + sql.append(" AND MON.MONEDA_ID in (").append(listInt).append(") "); + } + } + if (!lsClaseServicio.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (ClaseServicio cs : lsClaseServicio) { + sb.append(cs.getClaseservicioId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + if(!listInt.contains("-1")){ + sql.append(" AND CS.CLASESERVICIO_ID in (").append(listInt).append(") "); + } + } + + sql.append(" GROUP by R.descruta,R.RUTA_ID,MON.moneda_id,M.MARCA_ID,mon.descmoneda, M.descmarca,CS.descclase "); + sql.append(" ORDER by R.descruta,R.RUTA_ID,MON.moneda_id,M.MARCA_ID"); + + SQLQuery query = getSession().createSQLQuery(sql.toString()); + query.setResultTransformer(new AliasToBeanResultTransformer(TarifaOficialEscalaGroupVO.class)); + + return query.list(); + } + + public List pesquisaTarifaOficialEscalaObj(String rutaId, String monedaId, String vigenciaId, String marcaId) { + + StringBuilder sql = new StringBuilder(" "); + sql.append("select distinct po.cveparada as cveOrigem,po.descparada as descOrigem, "); + sql.append(" pd.cveparada as cveDestino,pd.descparada as descDestino,tmp.numsecuencia as NUMSECORIGEM,tmp2.numsecuencia as NUMSECDESTINO, "); + sql.append(" ta.PRECIO as precio,IMPORTETAXAEMBARQUE as TAXAEMBARQUE, IMPORTEPEDAGIO AS PEDAGIO,IMPORTEOUTROS AS OUTROS,IMPORTESEGURO AS SEGURO,ruta.ruta_id as rutaId,ruta.descruta as descruta "); + sql.append("from "); + sql.append(" ruta_combinacion rc "); + sql.append(" inner join ruta on (ruta.ruta_id = rc.ruta_id) "); + sql.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sql.append(" inner join parada po on po.parada_id = t.origen_id "); + sql.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sql.append(" inner join ( "); + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia+1 as numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.destino_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1 "); + sql.append(" and rownum =1 "); + sql.append(" and rs.numsecuencia = (select max(numsecuencia) from ruta_secuencia where activo = 1 and ruta_id = rs.ruta_id)) "); + sql.append(" "); + sql.append(" union "); + + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.origen_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1) "); + sql.append(" ) tmp on tmp.parada_id = po.parada_id "); + + sql.append("left join ( "); + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia+1 as numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.destino_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1 "); + sql.append(" and rs.numsecuencia = (select max(numsecuencia) from ruta_secuencia where activo = 1 and ruta_id = rs.ruta_id)) "); + sql.append(" union "); + sql.append(" (SELECT "); + sql.append(" p.parada_id,p.cveparada,rs.numsecuencia,rs.ruta_id "); + sql.append(" FROM "); + sql.append(" ruta_secuencia rs "); + sql.append(" INNER JOIN tramo t ON t.tramo_id = rs.tramo_id "); + sql.append(" INNER JOIN parada p ON p.parada_id = t.origen_id "); + sql.append(" WHERE "); + sql.append(" rs.ruta_id = ").append(rutaId); + sql.append(" AND rs.activo = 1) "); + sql.append(" ) tmp2 on tmp2.parada_id = pd.parada_id "); + sql.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sql.append(" left join tarifa_oficial ta on ta.TRAMO_ID = rc.tramo_id and ta.claseservicio_id = r.claseservicio_id and ta.MONEDA_ID = ").append(monedaId).append(" and ta.activo = 1 "); + sql.append(" where "); + sql.append(" rc.ruta_id = ").append(rutaId); + sql.append(" and rc.activo = 1 "); + sql.append(" and ta.MARCA_ID = ").append(marcaId); + // sql.append(" and ta.VIGENCIATARIFA_ID = ").append(vigenciaId); + sql.append(" and ta.moneda_id = ").append(monedaId); + sql.append(" order by ruta.ruta_id ,tmp.numsecuencia,tmp2.numsecuencia "); + + + SQLQuery query = getSession().createSQLQuery(sql.toString()); + query.setResultTransformer(new AliasToBeanResultTransformer(TarifaOficialEscalaVO.class)); + + return query.list(); + } + @Override + public boolean existeTramo(Tramo tramo) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.rowCount()); + + return HibernateFix.count(c.list()) > 0l; + + } + + @Override + public boolean existeTramo(Tramo tramo, ClaseServicio claseServicio) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.rowCount()); + + Criteria cRuta = c.createCriteria("ruta"); + cRuta.add(Restrictions.eq("claseServicio", claseServicio)); + cRuta.add(Restrictions.eq("activo", Boolean.TRUE)); + + return HibernateFix.count(c.list()) > 0l; + + } + + @Override + public boolean isRutaCombinacionVenda(Integer rutaId, Integer origenId, Integer destinoId) { + if(rutaId == null || origenId == null || destinoId == null) { + return false; + } + + StringBuilder sQuery = new StringBuilder(); + sQuery.append("select rc.rutacombinacion_id ") + .append("from ruta_combinacion rc ") + .append("join tramo t on t.tramo_id = rc.tramo_id ") + .append("where rc.activo = 1 ") + .append("and rc.indventa = 1 ") + .append("and t.activo = 1 ") + .append("and rc.ruta_id = :rutaId ") + .append("and t.origen_id = :origenId ") + .append("and t.destino_id = :destinoId "); + + Query qr = getSession().createSQLQuery(sQuery.toString()); + qr.setParameter("rutaId", rutaId); + qr.setParameter("origenId", origenId); + qr.setParameter("destinoId", destinoId); + + return !qr.list().isEmpty(); + } + + @SuppressWarnings("unchecked") + @Override + public Set rutasCombinacionVenda(List rutas) { + if(rutas == null || rutas.isEmpty()) { + return new HashSet(); + } + + List rutasIN = new ArrayList(); + for(Ruta r : rutas) { + rutasIN.add(r.getRutaId()); + } + + StringBuilder sQuery = new StringBuilder(); + sQuery.append("select rc.ruta_id || '-' || t.origen_id || '-' || t.destino_id ") + .append("from ruta_combinacion rc ") + .append("join tramo t on t.tramo_id = rc.tramo_id ") + .append("where rc.activo = 1 ") + .append("and rc.indventa = 1 ") + .append("and t.activo = 1 ") + .append("and rc.ruta_id in (:rutas) "); + + Query qr = getSession().createSQLQuery(sQuery.toString()); + + qr.setParameterList("rutas", rutasIN); + + List lista = qr.list(); + + return new HashSet(lista); + } + + @Override + public List pesquisaTarifaEmbObj(List lsMoneda, List lsMarca, List lsClaseServicio, List lsCategoria, List lsEmpresa, List lsRuta, List lsTipoPuntoVenta, List lsVigenciaTarifa, List lsOrgaoConcedente) { + + StringBuilder hql = new StringBuilder(" "); + hql.append(" SELECT "); + hql.append(" T.TARIFAEMBARCADA_ID,"); // 0 + hql.append(" TRA.DESCTRAMO, "); // 1 + hql.append(" ORI.DESCPARADA as origem,"); // 2 + hql.append(" DES.DESCPARADA as destino, "); // 3 + hql.append(" R.DESCRUTA,"); // 4 + hql.append(" M.DESCMARCA, "); // 5 + hql.append(" CS.DESCCLASE,"); // 6 + hql.append(" VT.feciniciovigencia, "); // 7 + hql.append(" VT.fecfinvigencia,"); // 8 + hql.append(" MON.descmoneda, "); // 9 + hql.append(" T.preciooriginal, "); // 10 + hql.append(" T.PRECIO,"); // 11 + hql.append(" R.RUTA_ID,"); // 12 + hql.append(" MON.moneda_id,"); // 13 + hql.append(" VT.VIGENCIATARIFA_ID,"); // 14 + hql.append(" M.MARCA_ID, "); // 15 + hql.append(" T.IMPORTEPEDAGIO, "); // 16 + hql.append(" OCONC.DESCORGAO, "); // 17 + hql.append(" T.IMPORTETAXAEMBARQUE, "); // 18 + hql.append(" T.IMPORTESEGURO, "); // 19 + hql.append(" T.IMPORTETPP,"); //20 + hql.append(" R.NUMRUTA, "); // 21 + hql.append(" R.PREFIXO, "); // 22 + hql.append(" R.INDSENTIDOIDA, "); // 23 + hql.append(" RC.INDVENTA, "); // 24 + hql.append(" TRA.ORIGEN_ID ||'-'|| TRA.DESTINO_ID ||'-'|| M.EMPRESA_ID ||'-'|| R.RUTA_ID ||'-'|| CS.CLASESERVICIO_ID, "); // 25 + hql.append(" EMP.INDPRECOPORDEMANDA ");// 26 + + + hql.append(" FROM "); + hql.append(" RUTA_COMBINACION RC "); + hql.append(" inner join RUTA R on (RC.RUTA_ID = R.RUTA_ID) "); + hql.append(" inner join TRAMO TRA on (RC.TRAMO_ID = TRA.TRAMO_ID) "); + hql.append(" inner join ORGAO_CONCEDENTE OCONC on (R.ORGAOCONCEDENTE_ID = OCONC.ORGAOCONCEDENTE_ID) "); + hql.append(" , TARIFA_EMBARCADA T "); + if (!lsEmpresa.isEmpty()) { + hql.append(" , RUTA_EMPRESA RE "); + } + hql.append(" , MARCA M, EMPRESA EMP, MONEDA MON, VIGENCIA_TARIFA VT "); + hql.append(" , CLASE_SERVICIO CS , PARADA ORI, PARADA DES "); + hql.append(" WHERE T.activo = 1 AND RC.activo = 1 AND R.activo = 1 "); + if (!lsEmpresa.isEmpty()) { + hql.append(" AND RE.activo = 1 AND RC.RUTA_ID = RE.RUTA_ID "); + } + hql.append(" AND T.TRAMO_ID = TRA.TRAMO_ID "); + hql.append(" AND T.MARCA_ID = M.MARCA_ID "); + hql.append(" AND T.MONEDA_ID = MON.MONEDA_ID "); + hql.append(" AND T.VIGENCIATARIFA_ID = VT.VIGENCIATARIFA_ID "); + hql.append(" AND T.CLASESERVICIO_ID = CS.CLASESERVICIO_ID "); + hql.append(" AND T.CLASESERVICIO_ID = R.CLASESERVICIO_ID "); + hql.append(" AND TRA.ORIGEN_ID = ORI.PARADA_ID "); + hql.append(" AND TRA.DESTINO_ID = DES.PARADA_ID "); + hql.append(" AND T.RUTA_ID = R.RUTA_ID "); + hql.append(" AND M.EMPRESA_ID = EMP.EMPRESA_ID "); + + if (!lsVigenciaTarifa.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (VigenciaTarifa vt : lsVigenciaTarifa) { + sb.append(vt.getVigenciatarifaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND VT.VIGENCIATARIFA_ID in (").append(listInt).append(")"); + } + if (!lsEmpresa.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Empresa vt : lsEmpresa) { + sb.append(vt.getEmpresaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND RE.EMPRESA_ID in (").append(listInt).append(") "); + } + if (!lsRuta.isEmpty() && !lsRuta.toString().contains("TODAS")) { + StringBuilder sb = new StringBuilder(""); + for (Ruta vt : lsRuta) { + sb.append(vt.getRutaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND RC.RUTA_ID in (").append(listInt).append(")"); + } + if (!lsMarca.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Marca vt : lsMarca) { + sb.append(vt.getMarcaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND M.MARCA_ID in (").append(listInt).append(") "); + } + if (!lsMoneda.isEmpty()) { + StringBuilder sb = new StringBuilder(""); + for (Moneda vt : lsMoneda) { + sb.append(vt.getMonedaId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND MON.MONEDA_ID in (").append(listInt).append(") "); + } + if (!lsClaseServicio.isEmpty() && !lsClaseServicio.toString().contains("TODAS")) { + StringBuilder sb = new StringBuilder(""); + for (ClaseServicio cs : lsClaseServicio) { + sb.append(cs.getClaseservicioId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND CS.CLASESERVICIO_ID in (").append(listInt).append(") "); + } + if (!lsOrgaoConcedente.isEmpty() && !lsOrgaoConcedente.toString().contains("TODOS")) { + StringBuilder sb = new StringBuilder(""); + for (OrgaoConcedente oc : lsOrgaoConcedente) { + sb.append(oc.getOrgaoConcedenteId()).append(","); + } + String listInt = sb.toString().substring(0, sb.toString().length() - 1); + hql.append(" AND OCONC.ORGAOCONCEDENTE_ID in (").append(listInt).append(") "); + } + + hql.append(" order by R.NUMRUTA, R.RUTA_ID, VT.VIGENCIATARIFA_ID, M.DESCMARCA,ORI.DESCPARADA,DES.DESCPARADA "); + + System.out.println(hql.toString()); + + List lsObj = this.getSession().createSQLQuery(hql.toString()).list(); + + return lsObj; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaEmbarqueDesembarqueHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaEmbarqueDesembarqueHibernateDAO.java new file mode 100644 index 000000000..d8c833e53 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaEmbarqueDesembarqueHibernateDAO.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.RutaEmbarqueDesembarqueDAO; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaEmbarqueDesembarque; + +@Repository("rutaEmbarqueDesembarqueHibernateDAO") +public class RutaEmbarqueDesembarqueHibernateDAO extends GenericHibernateDAO implements RutaEmbarqueDesembarqueDAO { + + @Autowired + public RutaEmbarqueDesembarqueHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerPorRuta(Ruta ruta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("ruta", ruta)); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaEmpresaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaEmpresaHibernateDAO.java new file mode 100644 index 000000000..7ce85b732 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaEmpresaHibernateDAO.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.RutaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; + +/** + * + * @author Administrador + */ +@Repository("rutaEmpresaDAO") +public class RutaEmpresaHibernateDAO extends GenericHibernateDAO + implements RutaEmpresaDAO { + + @Autowired + public RutaEmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List obtenerPorEmpresa(Empresa empresa){ + StringBuilder sb = new StringBuilder(); + sb.append("select * from Ruta_Empresa where empresa_Id = :empresaId and activo = 1" ); + + Query qry = getSession().createSQLQuery(sb.toString()); + qry.setInteger("empresaId", empresa.getEmpresaId()); + + return qry.list(); + } + + public List obtenerPorRuta(Ruta ruta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("ruta", ruta)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java new file mode 100644 index 000000000..bda5e3db2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java @@ -0,0 +1,437 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.hibernate.criterion.SimpleExpression; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.LongType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.RutaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.vo.ruta.RutaVO; + +/** + * + * @author Rafius + */ +@SuppressWarnings("unchecked") +@Repository("rutaDAO") +public class RutaHibernateDAO extends GenericHibernateDAO implements RutaDAO { + + @Autowired + public RutaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descruta")); + + return c.list(); + } + + public List buscarPorTramo(Tramo tramo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + Criteria cTipoPuntoVenta = c.createCriteria("rutaCombinacionList"); + cTipoPuntoVenta.add(Restrictions.eq("tramo", tramo)); + + return c.list(); + } + + @Override + public List buscarPorRutaPorEmpresas(List lsEmpresas) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("indRutaCancelada", false)); + Criteria cEmpresa = c.createCriteria("lsRutaEmpresa"); + cEmpresa.add(Restrictions.in("empresa", lsEmpresas)); + cEmpresa.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.addOrder(Order.asc("descruta")); + + List l = c.list(); + for (Ruta r : l) { + r.getLsRutaEmpresa(); + } + return l; + } + + public List buscarPorClaseServicio(ClaseServicio claseServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("claseServicio", claseServicio)); + + c.addOrder(Order.asc("descruta")); + + return c.list(); + } + + public List buscarPorClaseServicioEmpresa(ClaseServicio claseServicio, Empresa empresa) { + StringBuffer hql = new StringBuffer(); + hql.append("SELECT DISTINCT r "); + hql.append("FROM Ruta r INNER JOIN r.lsRutaEmpresa re "); + hql.append("WHERE r.claseServicio.claseservicioId = :idClaseServicio "); + hql.append("AND re.empresa.empresaId = :idEmpresa "); + hql.append("AND r.activo = 1 "); + hql.append("ORDER BY r.descruta"); + + Query sq = getSession().createQuery(hql.toString()); + sq.setParameter("idClaseServicio", claseServicio.getClaseservicioId()); + sq.setParameter("idEmpresa", empresa.getEmpresaId()); + + List lsRuta = sq.list(); + return lsRuta; + } + + public List buscar(String nomeRuta, ClaseServicio claseServicio, + Boolean nomeObrigatorio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + // c.add(Restrictions.eq("descruta", nomeRuta)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("indNombreObligatorio", nomeObrigatorio)); + + return c.list(); + } + + public List obtenerPorEmpresa(Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ne("rutaId", -1)); + + if (empresa.getEmpresaId() != -1) { + c.createCriteria("lsRutaEmpresa").add(Restrictions.eq("empresa", empresa)).add(Restrictions.eq("activo", Boolean.TRUE)); + } + c.addOrder(Order.asc("descruta")); + + return c.list(); + } + + @Override + public Parada buscarOrigen(Ruta ruta) { + Criteria c = this.getSession().createCriteria(RutaSecuencia.class); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.eq("ruta", ruta)); + c.addOrder(Order.asc("numsecuencia")); + c.createAlias("tramo", "tramo") + .setProjection(Projections.property("tramo.origem")); + c.setMaxResults(1); + + return (Parada) c.uniqueResult(); + + } + + @Override + public Parada buscarDestino(Ruta ruta) { + Criteria c = this.getSession().createCriteria(RutaSecuencia.class); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.eq("ruta", ruta)); + c.addOrder(Order.desc("numsecuencia")); + c.createAlias("tramo", "tramo") + .setProjection(Projections.property("tramo.destino")); + c.setMaxResults(1); + + return (Parada) c.uniqueResult(); + } + + public List buscarTodosExceto(Integer... idRuta) { + Criteria c = this.makeCriteria(); + for (Integer id : idRuta) { + c.add(Restrictions.ne("rutaId", id)); + } + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descruta")); + + return c.list(); + } + + public List buscarTodosEstos(Integer[] idRutas) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.in("rutaId", idRutas)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descruta")); + + return c.list(); + } + + public List buscarNumRuta(String numRuta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.eq("numRuta", numRuta)); + + return c.list(); + } + + public List buscaRuta(String palavraPesquisaRuta) { + return buscaRuta(palavraPesquisaRuta, null); + } + + @Override + public List buscaRuta(String palavraPesquisaRuta, OrgaoConcedente orgao) { + StringBuilder hql = new StringBuilder(); + hql.append(" FROM Ruta r"); + hql.append(" WHERE (lower(descruta) like :palavraPesquisaRuta "); + hql.append(" OR lower(prefixo) like :palavraPesquisaRuta "); + hql.append(" OR lower(str(numRuta)) like :palavraPesquisaRuta) and r.activo = 1 "); + if (orgao != null) { + hql.append(" AND r.orgaoConcedente.orgaoConcedenteId = :orgaoId "); + } + + Query sq = getSession().createQuery(hql.toString()); + sq.setParameter("palavraPesquisaRuta", palavraPesquisaRuta.toLowerCase() + '%'); + if (orgao != null) { + sq.setParameter("orgaoId", orgao.getOrgaoConcedenteId()); + } + + return sq.list(); + } + + @Override + public List buscaRutaPorNumeroSemDadoRepetido(String palavraPesquisaRuta) { + StringBuilder sql = new StringBuilder(); + sql.append(" SELECT MAX(R.RUTA_ID) rutaId, "); + sql.append(" R.NUMRUTA numRuta, MAX(R.PREFIXO) prefixo, "); + sql.append(" MAX(R.DESCRUTA) descruta, "); + sql.append(" MAX(ORGAO.DESCORGAO) orgaoConcedente "); + sql.append(" FROM RUTA R "); + sql.append(" INNER JOIN ORGAO_CONCEDENTE ORGAO ON R.ORGAOCONCEDENTE_ID = ORGAO.ORGAOCONCEDENTE_ID "); + sql.append(" WHERE (LOWER(R.DESCRUTA) LIKE :palavraPesquisaRuta "); + sql.append(" OR LOWER(R.PREFIXO) LIKE :palavraPesquisaRuta "); + sql.append(" OR LOWER(R.NUMRUTA) LIKE :palavraPesquisaRuta) "); + sql.append(" GROUP BY R.NUMRUTA "); + + SQLQuery qry = getSession().createSQLQuery(sql.toString()) + .addScalar("rutaId", LongType.INSTANCE) + .addScalar("numRuta", StringType.INSTANCE) + .addScalar("prefixo", StringType.INSTANCE) + .addScalar("descruta", StringType.INSTANCE) + .addScalar("orgaoConcedente", StringType.INSTANCE); + qry.setParameter("palavraPesquisaRuta", palavraPesquisaRuta.toLowerCase() + '%'); + + qry.setResultTransformer(new AliasToBeanResultTransformer(RutaVO.class)); + return qry.list(); + } + + public List buscaRutasFromOrgao(OrgaoConcedente orgao) { // busca rutas e pedágios + StringBuffer hql = new StringBuffer(); + hql.append("select distinct r FROM Ruta r left join r.rutaSecuenciaList rSeqList "); + hql.append(" left join rSeqList.lsRutaCase casRutaList "); + hql.append(" WHERE r.orgaoConcedente.orgaoConcedenteId = :orgaoId and r.activo = 1 and r.indRutaCancelada = 0 "); + hql.append(" order by r.descruta "); + + Query sq = getSession().createQuery(hql.toString()); + sq.setParameter("orgaoId", orgao.getOrgaoConcedenteId()); + + List lsRuta = sq.list(); + return lsRuta; + } + + public List buscaSomenteRutasFromOrgao(OrgaoConcedente orgao) { + StringBuffer hql = new StringBuffer(); + hql.append("select distinct r FROM Ruta r "); + hql.append(" WHERE r.orgaoConcedente.orgaoConcedenteId = :orgaoId and r.activo = 1 and r.indRutaCancelada = 0 "); + hql.append(" order by r.descruta "); + + Query sq = getSession().createQuery(hql.toString()); + sq.setParameter("orgaoId", orgao.getOrgaoConcedenteId()); + + List lsRuta = sq.list(); + return lsRuta; + } + + @Override + public List buscarRutasPorEmpresaOrgaoConcedente(Empresa empresa, OrgaoConcedente orgao) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ne("rutaId", -1)); + + if (empresa != null && empresa.getEmpresaId() != -1) { + c.createCriteria("lsRutaEmpresa").add(Restrictions.eq("empresa", empresa)); + } + + if (orgao != null && orgao.getOrgaoConcedenteId() != -1) { + c.add(Restrictions.eq("orgaoConcedente", orgao)); + } + + c.addOrder(Order.asc("descruta")); + + return c.list(); + } + + @Override + public void updateAsientosVendibles(Ruta ruta, Tramo viejoTramo, Tramo nuevoTramo) { + + try { + getSession().flush(); + + List qryList = new ArrayList(); + StringBuilder qry = new StringBuilder(" update RUTA_COMBINACION set TRAMO_ID = :nuevoTramo, "); + qry.append(" FECMODIF = SYSDATE, USUARIO_ID = :usuario where TRAMO_ID = :viejoTramo and RUTA_ID = :ruta "); + qry.append(" AND ACTIVO = 1 "); + qryList.add(qry.toString()); + + qry = new StringBuilder(" update RUTA_SECUENCIA set TRAMO_ID = :nuevoTramo, "); + qry.append(" FECMODIF = SYSDATE, USUARIO_ID = :usuario where TRAMO_ID = :viejoTramo and RUTA_ID = :ruta "); + qry.append(" AND ACTIVO = 1 "); + qryList.add(qry.toString()); + + for (String strQuery : qryList) { + Query query = getSession().createSQLQuery(strQuery); + query.setInteger("viejoTramo", viejoTramo.getTramoId()); + query.setInteger("nuevoTramo", nuevoTramo.getTramoId()); + query.setInteger("usuario", nuevoTramo.getUsuarioId()); + query.setInteger("ruta", ruta.getRutaId()); + query.executeUpdate(); + } + + try { + // Pode cair na exception caso ja possua tarifa criada para o tramo, e nao é necessaria criar novamente + + qryList = new ArrayList(); + qry = new StringBuilder(" update TARIFA set TRAMO_ID = :nuevoTramo, "); + qry.append(" FECMODIF = SYSDATE, USUARIO_ID = :usuario, ORIGEN_ID =:origen, DESTINO_ID = :destino "); + qry.append(" where TRAMO_ID = :viejoTramo and RUTA_ID = :ruta "); + qry.append(" AND ACTIVO = 1 "); + qryList.add(qry.toString()); + + qry = new StringBuilder(" update TARIFA_OFICIAL set TRAMO_ID = :nuevoTramo, "); + qry.append(" FECMODIF = SYSDATE, USUARIO_ID = :usuario, ORIGEN_ID =:origen, DESTINO_ID = :destino "); + qry.append(" where TRAMO_ID = :viejoTramo and RUTA_ID = :ruta "); + qry.append(" AND ACTIVO = 1 "); + qryList.add(qry.toString()); + + for (String strQuery : qryList) { + Query query = getSession().createSQLQuery(strQuery); + query.setInteger("viejoTramo", viejoTramo.getTramoId()); + query.setInteger("nuevoTramo", nuevoTramo.getTramoId()); + query.setInteger("origen", nuevoTramo.getOrigem().getParadaId()); + query.setInteger("destino", nuevoTramo.getDestino().getParadaId()); + query.setInteger("usuario", nuevoTramo.getUsuarioId()); + query.setInteger("ruta", ruta.getRutaId()); + query.executeUpdate(); + } + + } catch (Exception e) { + } + + qry = new StringBuilder(" update CORRIDA_TRAMO set TRAMO_ID = :nuevoTramo, "); + qry.append(" FECMODIF = SYSDATE, USUARIO_ID = :usuario, ORIGEN_ID =:origen, DESTINO_ID = :destino "); + qry.append(" where TRAMO_ID = :viejoTramo and "); + qry.append(" CORRIDA_ID in (select CORRIDA_ID from CORRIDA_CTRL where RUTA_ID = :ruta ) "); + qry.append(" AND ACTIVO = 1 "); + + Query query = getSession().createSQLQuery(qry.toString()); + query.setInteger("viejoTramo", viejoTramo.getTramoId()); + query.setInteger("nuevoTramo", nuevoTramo.getTramoId()); + query.setInteger("origen", nuevoTramo.getOrigem().getParadaId()); + query.setInteger("destino", nuevoTramo.getDestino().getParadaId()); + query.setInteger("usuario", nuevoTramo.getUsuarioId()); + query.setInteger("ruta", ruta.getRutaId()); + query.executeUpdate(); + + qry = new StringBuilder(" update CORRIDA set FECMODIF = SYSDATE, USUARIO_ID = :usuario, "); + qry.append(" ORIGEN_ID = (case when ORIGEN_ID = :viejaOrigen then :nuevaOrigen else ORIGEN_ID end ), "); + qry.append(" DESTINO_ID = (case when DESTINO_ID = :viejoDestino then :nuevoDestino else DESTINO_ID end ) "); + qry.append(" where RUTA_ID = :ruta "); + + query = getSession().createSQLQuery(qry.toString()); + query.setInteger("viejaOrigen", viejoTramo.getOrigem().getParadaId()); + query.setInteger("nuevaOrigen", nuevoTramo.getOrigem().getParadaId()); + query.setInteger("viejoDestino", viejoTramo.getOrigem().getParadaId()); + query.setInteger("nuevoDestino", nuevoTramo.getDestino().getParadaId()); + query.setInteger("usuario", nuevoTramo.getUsuarioId()); + query.setInteger("ruta", ruta.getRutaId()); + query.executeUpdate(); + + } catch (final Exception ex) { + throw new RuntimeException("", ex); + } + + } + + @Override + public List buscarRutasVendaEmbarcada(List empresasIds, Integer rutaId, String numeroLinha, String descRuta, ClaseServicio classe) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ne("rutaId", -1)); + + if(empresasIds != null && !empresasIds.isEmpty()) { + c.createCriteria("lsRutaEmpresa").add(Restrictions.in("empresa.empresaId", empresasIds)); + } + + if(rutaId != null) { + c.add(Restrictions.eq("rutaId", rutaId)); + } + + if(numeroLinha != null) { + List numRutas = Arrays.asList(numeroLinha.split(",")); + c.add(Restrictions.in("numRuta", numRutas)); + } + + if(descRuta != null && !descRuta.isEmpty()) { + c.add(Restrictions.ilike("descruta", "%" + descRuta.trim().concat("%"))); + } + + if (classe != null && classe.getClaseservicioId() != -1) { + c.add(Restrictions.eq("claseServicio", classe)); + } + + c.add(Restrictions.eq("indRutaCancelada", Boolean.FALSE)); + + c.add(Restrictions.eq("indVendaEmbarcada", Boolean.TRUE)); + + c.addOrder(Order.asc("descruta")); + + return c.list(); + } + + @Override + public List buscaLikeComboBox(String stringConsulta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + final SimpleExpression validaNumRuta = Restrictions.like("numRuta", stringConsulta, MatchMode.START); + final SimpleExpression validaDescruta = Restrictions.like("descruta", stringConsulta, MatchMode.ANYWHERE); + +// c.createAlias("claseServicio", "claseServicio"); + + c.add(Restrictions.or(validaNumRuta, validaDescruta)); +// c.setProjection(Projections.projectionList() +// .add(Projections.groupProperty("numRuta")) +// .add(Projections.property("descruta")) +// .add(Projections.property("claseServicio.descclase"))); + + c.addOrder(Order.asc("numRuta")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaIcmsExcepcionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaIcmsExcepcionHibernateDAO.java new file mode 100644 index 000000000..a8b97b4ea --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaIcmsExcepcionHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.RutaIcmsExcepcionDAO; +import com.rjconsultores.ventaboletos.entidad.RutaIcmsExcepcion; + +@Repository("rutaIcmsExcepcionDAO") +public class RutaIcmsExcepcionHibernateDAO extends GenericHibernateDAO implements RutaIcmsExcepcionDAO { + + @Autowired + public RutaIcmsExcepcionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaSecuenciaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaSecuenciaHibernateDAO.java new file mode 100644 index 000000000..8cc5abe36 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaSecuenciaHibernateDAO.java @@ -0,0 +1,208 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.FetchMode; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.RutaSecuenciaDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@SuppressWarnings("unchecked") +@Repository("rutaSecuenciaDAO") +public class RutaSecuenciaHibernateDAO extends GenericHibernateDAO + implements RutaSecuenciaDAO { + + @Autowired + public RutaSecuenciaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarSecuenciaOrdenado(Ruta ruta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("ruta", ruta)); + c.setFetchMode("lsRutaCase", FetchMode.JOIN); + + c.addOrder(Order.asc("numsecuencia")); + + return c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list(); + } + + public int borrarSecuencias(Ruta ruta) { + Query query = this.getSession().createQuery("UPDATE RutaSecuencia SET activo = 0, fecmodif = current_timestamp(), usuarioId= :usuario where ruta = :ruta"); + query.setParameter("usuario", UsuarioLogado.getUsuarioLogado().getUsuarioId()); + query.setParameter("ruta", ruta); + + return query.executeUpdate(); + } + + @Override + public boolean paradaSecuenciaValida(Ruta ruta, Parada origen, Parada destino) { + Criteria cOrigen = makeCriteria(); + cOrigen.add(Restrictions.eq("activo", Boolean.TRUE)); + cOrigen.add(Restrictions.eq("ruta", ruta)); + cOrigen.setProjection(Projections.property("numsecuencia")); + + Criteria cOrigenTramo = cOrigen.createCriteria("tramo"); + cOrigenTramo.add(Restrictions.eq("origem", origen)); + + + Short numSecOrigen = (Short) cOrigen.uniqueResult(); + + Criteria cDestino = makeCriteria(); + cDestino.add(Restrictions.eq("activo", Boolean.TRUE)); + cDestino.add(Restrictions.eq("ruta", ruta)); + cDestino.setProjection(Projections.property("numsecuencia")); + + Criteria cDestinoTramo = cDestino.createCriteria("tramo"); + cDestinoTramo.add(Restrictions.eq("origem", destino)); + + + Short numSecDestino = (Short) cDestino.uniqueResult(); + boolean destinoFinal = false; + // destino final da ruta + if (numSecDestino == null) { + cDestino = makeCriteria(); + cDestino.add(Restrictions.eq("activo", Boolean.TRUE)); + cDestino.add(Restrictions.eq("ruta", ruta)); + cDestino.setProjection(Projections.property("numsecuencia")); + + cDestinoTramo = cDestino.createCriteria("tramo"); + cDestinoTramo.add(Restrictions.eq("destino", destino)); + + + numSecDestino = (Short) cDestino.uniqueResult(); + + destinoFinal = true;//quando é o destino final (ultima parada da secuencia), o numero da secOrigem pode ser igual ao secDestino + } + + if ((numSecOrigen != null) && (numSecDestino != null)) { + return (destinoFinal)?(numSecOrigen.compareTo(numSecDestino) <= 0):(numSecOrigen.compareTo(numSecDestino) < 0); + } + + return false; + } + + public List obtenerNumRutaSecuenciaPorCorridaOrigemDestino(EsquemaCorrida esquemaCorrida, Parada origem, Parada destino) { + + String queryString = "SELECT rs.numsecuencia " + + "FROM EsquemaCorrida ec " + + "JOIN ec.ruta r " + + "JOIN r.rutaSecuenciaList rs " + + "JOIN rs.tramo t " + + "WHERE (t.origem = :origem OR t.destino = :destino) " + + "AND ec = :esquemaCorrida"; + + Query query = getSession().createQuery(queryString); + query.setParameter("esquemaCorrida", esquemaCorrida); + query.setParameter("origem", origem); + query.setParameter("destino", destino); + + return query.list(); + + } + + public List obtenerNumRutaSecuenciaPorCorridaOrigemDestinoId(EsquemaCorrida esquemaCorrida, Integer origemId, Integer destinoId) { + + StringBuilder queryString = new StringBuilder(""); + + queryString.append("SELECT rs.numsecuencia "); + queryString.append(" FROM EsquemaCorrida ec "); + queryString.append(" JOIN ec.ruta r "); + queryString.append(" JOIN r.rutaSecuenciaList rs "); + queryString.append(" JOIN rs.tramo t "); + queryString.append(" WHERE "); + queryString.append(" (t.origem.paradaId = :origem OR t.destino.paradaId = :destino) "); + queryString.append(" AND ec = :esquemaCorrida"); + queryString.append(" and rs.activo = 1 "); + + Query query = getSession().createQuery(queryString.toString()); + query.setParameter("esquemaCorrida", esquemaCorrida); + query.setParameter("origem", origemId); + query.setParameter("destino", destinoId); + + return query.list(); + + } + + public List obtenerNumRutaSecuenciaOcupadaPorCorridaAsiento(EsquemaCorrida esquemaCorrida, String asiento) { + + String queryString = "SELECT ea.esquemaasientoId, rs.numsecuencia, ea.indvendible, " + + "(SELECT MAX(rs2.numsecuencia) FROM RutaSecuencia rs2 WHERE rs2.ruta = r) " + + "FROM EsquemaAsiento ea " + + "JOIN ea.esquemaCorrida ec " + + "JOIN ec.ruta r " + + "JOIN r.rutaSecuenciaList rs " + + "JOIN rs.tramo t " + + "WHERE ea.numasiento = :asiento " + + "AND (t.origem = ea.parada " + + "OR t.destino = ea.destino) " + + "AND ec = :esquemaCorrida " + + "AND ea.activo = 1 " + + "ORDER BY rs.numsecuencia"; + + Query query = getSession().createQuery(queryString); + query.setParameter("asiento", asiento); + query.setParameter("esquemaCorrida", esquemaCorrida); + + List numSecuenciaOcupada = new ArrayList(); + List resultList = query.list(); + + HashMap> mapObjectsByEsquema = new HashMap>(); + for (Object[] result : resultList) { + Integer esquemaasientoId = (Integer) result[0]; + if (mapObjectsByEsquema.containsKey(esquemaasientoId)) { + mapObjectsByEsquema.get(esquemaasientoId).add(result); + } else { + List numSecuenciaOcupadaList = new ArrayList(); + numSecuenciaOcupadaList.add(result); + mapObjectsByEsquema.put(esquemaasientoId, numSecuenciaOcupadaList); + } + } + + for (Integer esquemaasientoId : mapObjectsByEsquema.keySet()) { + + List listObjects = mapObjectsByEsquema.get(esquemaasientoId); + Short numsecuenciaOrigem = (Short) listObjects.get(0)[1]; + Boolean indvendible = (Boolean) listObjects.get(0)[2]; + Short ultimoNumsecuencia = (Short) listObjects.get(0)[3]; + Short numsecuenciaDestino = numsecuenciaOrigem; + if (Boolean.TRUE.equals(indvendible)) { + numsecuenciaDestino = ultimoNumsecuencia; + } else if (listObjects.size() > 1) { + numsecuenciaDestino = (Short) listObjects.get(1)[1]; + } + + Integer min = Math.min(numsecuenciaOrigem, numsecuenciaDestino); + Integer max = Math.max(numsecuenciaOrigem, numsecuenciaDestino); + for (int j = min; j <= max; j++) { + numSecuenciaOcupada.add(j); + } + + } + + return numSecuenciaOcupada; + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/SapHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/SapHibernateDAO.java new file mode 100644 index 000000000..20245ea4c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/SapHibernateDAO.java @@ -0,0 +1,147 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.hibernate.Query; +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.SapDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO; + +@Repository("sapDAO") +public class SapHibernateDAO extends GenericHibernateDAO implements SapDAO { + + @Autowired + public SapHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) { + + StringBuilder sb = new StringBuilder(); + sb.append(" SELECT "); + sb.append(" fc.fechamentocntcorrente_id, "); + sb.append(" to_char(fc.fecfechamento, 'yyyy-mm-DD'), "); + sb.append(" fc.total, "); + sb.append(" es.cveestado, "); + sb.append(" pv.numpuntoventa, "); + sb.append(" pv.numdocpuntoventa, "); + sb.append(" pv.nombpuntoventa, "); + sb.append(" fc.empresa_id, "); + sb.append(" emp.nombempresa, "); + sb.append(" fc.indintegradosap, "); + sb.append(" to_char(fc.fecfechamento, 'yyyy'), "); + sb.append(" to_char(fc.fecfechamento, 'mm'), "); + sb.append(" CASE to_char(fc.fecfechamento, 'D') "); + sb.append(" WHEN '6' THEN to_char(fc.fecfechamento+3, 'yyyy-mm-DD') "); + sb.append(" WHEN '7' THEN to_char(fc.fecfechamento+2, 'yyyy-mm-DD') "); + sb.append(" ELSE to_char(fc.fecfechamento+1, 'yyyy-mm-DD') END as feclancamento "); + sb.append(" FROM "); + sb.append(" fechamento_cntcorrente fc "); + sb.append(" INNER JOIN punto_venta pv ON pv.puntoventa_id = fc.puntoventa_id AND pv.activo = 1 "); + sb.append(" INNER JOIN empresa emp ON emp.empresa_id = fc.empresa_id AND emp.activo = 1 "); + sb.append(" LEFT JOIN ciudad ci ON ci.ciudad_id = emp.ciudad_id AND ci.activo = 1 "); + sb.append(" LEFT JOIN plaza pl ON pl.plaza_id = ci.plaza_id AND pl.activo = 1 "); + sb.append(" LEFT JOIN estado es ON es.estado_id = ci.estado_id AND es.activo = 1 "); + sb.append(" WHERE "); + sb.append(" fc.activo = 1 "); + sb.append(" AND fc.fecfechamento BETWEEN :dataDe AND :dataAte "); + + if( empresa != null ) { + sb.append(" AND fc.EMPRESA_ID = :empresaId "); + } + + if(!reenviar){ + sb.append(" AND ( fc.indintegradosap IS NULL OR fc.indintegradosap <> 1) "); + } + + sb.append(" ORDER BY "); + sb.append(" pv.nombpuntoventa, fc.fecfechamento "); + + Query query = getSession().createSQLQuery(sb.toString()); + + if( empresa != null ) { + query.setInteger("empresaId", empresa.getEmpresaId()); + } + + if(dataDe != null && dataAte != null){ + query.setDate("dataDe", DateUtil.normalizarToFecha(dataDe)); + query.setDate("dataAte", DateUtil.normalizarToFecha(dataAte)); + } + + @SuppressWarnings("unchecked") + List list = query.list(); + List retorno = new ArrayList(); + + for(Object[] tupla : list){ + + FechamentoCntCorrenteVO fcc = new FechamentoCntCorrenteVO(); + fcc.setFechamentocntcorrenteId( Long.valueOf(tupla[0].toString())); + fcc.setFecfechamento( tupla[1].toString() ); + fcc.setTotal( (BigDecimal)tupla[2] ); + fcc.setUfEmpresa(tupla[3].toString()); + fcc.setNumPuntoVenta(tupla[4].toString()); + + try { + String cnpj = tupla[5].toString().replaceAll("[^0-9]", ""); + fcc.setCnpjPuntoVenta(cnpj); + }catch (Exception e) { + throw new RuntimeException( "CNPJ fora do padrao no ponto de venda: "+tupla[6] ); + } + fcc.setNombpuntoventa(tupla[6].toString()); + + fcc.setEmpresaId( Integer.valueOf( tupla[7].toString() ) ); + fcc.setNombEmpresa( tupla[8].toString()); + + fcc.setIntegradoSap( tupla[9]==null?false:tupla[9].toString().equals("1")?true:false ); + + fcc.setAnofechamento(tupla[10].toString()); + fcc.setMesfechamento(tupla[11].toString()); + fcc.setFeclancamento(tupla[12].toString()); + + //empresa enviada nula apenas no processo automatico + if(empresa == null) { + fcc.setEnviar(true); + } + + retorno.add(fcc); + } + + return retorno; + } + + @Override + public boolean atualizaFechamento(Long fechamentocntcorrenteId) throws Exception { + + if(fechamentocntcorrenteId == null ) { + return false; + } + + //é feito update manualmente porque o hibernate utiliza sco_read e nao tem permissao de escrita no banco + @SuppressWarnings("deprecation") + Connection con = getSession().connection(); + Statement stmt = con.createStatement(); + con.setAutoCommit(false); + + stmt.addBatch("UPDATE FECHAMENTO_CNTCORRENTE SET INDINTEGRADOSAP = 1 WHERE FECHAMENTOCNTCORRENTE_ID = " + fechamentocntcorrenteId); + + stmt.executeBatch(); + con.commit(); + stmt.close(); + + return Boolean.TRUE; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaEmpresaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaEmpresaHibernateDAO.java new file mode 100644 index 000000000..86b04e18f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaEmpresaHibernateDAO.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.HibernateException; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.SecretariaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import com.rjconsultores.ventaboletos.entidad.SecretariaEmpresa; + +@Repository("secretariaEmpresaDAO") +public class SecretariaEmpresaHibernateDAO extends GenericHibernateDAO + implements SecretariaEmpresaDAO { + + @Autowired + public SecretariaEmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarPorSecretaria(Secretaria secretaria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("secretaria", secretaria)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaHibernateDAO.java new file mode 100644 index 000000000..f9dec6e53 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/SecretariaHibernateDAO.java @@ -0,0 +1,79 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.SecretariaDAO; +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("secretariaDAO") +public class SecretariaHibernateDAO extends GenericHibernateDAO + implements SecretariaDAO { + + @Autowired + public SecretariaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String descsecretaria, String cvesecretaria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descsecretaria", descsecretaria)); + c.add(Restrictions.eq("cvesecretaria", cvesecretaria)); + + return c.list(); + } + + public List buscar(String descsecretaria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descsecretaria", descsecretaria)); + + return c.list(); + } + + @Override + public Secretaria buscarSecretariaVoucherRod(Short formaPagoId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("indVoucherRod", Boolean.TRUE)); + c.add(Restrictions.eq("formaPago.formapagoId", formaPagoId)); + + List result = c.list(); + return result.isEmpty() ? null : (Secretaria)result.get(0); + } + + @Override + public List buscaLike(String descsecretaria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.like("descsecretaria", descsecretaria, MatchMode.START)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/SegVKMHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/SegVKMHibernateDAO.java new file mode 100644 index 000000000..6ed8c6ce1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/SegVKMHibernateDAO.java @@ -0,0 +1,111 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.SegVKMDAO; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.SegVKM; + +/** + * + * @author Administrador + */ +@Repository("segVKMDAO") +public class SegVKMHibernateDAO extends GenericHibernateDAO + implements SegVKMDAO { + + @Autowired + public SegVKMHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String serie) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("serie", serie)); + + return c.list(); + } + + public BigDecimal buscarSeguroPorKm(Long km, String serie, Integer orgaoConcedenteId) { + StringBuilder sb = new StringBuilder(); + Query miQry = null; + + sb = new StringBuilder(); + sb.append(" select seg.valor"); + sb.append(" from SegVKm seg"); + sb.append(" where seg.activo = 1 and seg.km >= :km and seg.serie in (" + serie + ") and seg.ORGAOCONCEDENTE_ID = :orgaoconcedenteId"); + sb.append(" order by seg.km"); + + miQry = getSession().createSQLQuery(sb.toString()); + miQry.setLong("km", km); + miQry.setInteger("orgaoconcedenteId", orgaoConcedenteId); + + miQry.setMaxResults(1); + + List list = miQry.list(); + + if (list.isEmpty()) { + sb = new StringBuilder(); + sb.append(" select seg.valor"); + sb.append(" from SegVKm seg"); + sb.append(" where seg.activo = 1 and seg.km >= :km and seg.serie in (" + serie + ") and seg.ORGAOCONCEDENTE_ID is null"); + sb.append(" order by seg.km"); + miQry = getSession().createSQLQuery(sb.toString()); + + // miQry.setMaxResults(1); + + miQry.setLong("km", km); + list = miQry.list(); + } + + return list.isEmpty() ? BigDecimal.ZERO : list.get(0); + } + + public String seriePorEmpresa(Integer empresaId) { + StringBuilder sb = new StringBuilder(); + sb.append(" select serie "); + sb.append(" from SeguradoraEmpresa segEmp"); + sb.append(" where segEmp.activo = 1 and segEmp.empresa = :empresaId"); + + Query q = getSession().createQuery(sb.toString()); + q.setInteger("empresaId", empresaId); + + List res = q.list(); + String series = ""; + for (String serie : res) { + series += "'" + serie + "',"; + } + if (!series.isEmpty()) { + series = series.substring(0, series.length() - 1); + } + + if (StringUtils.isBlank(series)) { + return "-1"; + } + return series; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguradoraEmpresaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguradoraEmpresaHibernateDAO.java new file mode 100644 index 000000000..f0aecdc15 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguradoraEmpresaHibernateDAO.java @@ -0,0 +1,38 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.SeguradoraEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa; + +@Repository("seguradoraEmpresaDAO") +public class SeguradoraEmpresaHibernateDAO extends GenericHibernateDAO implements SeguradoraEmpresaDAO { + + @Autowired + public SeguradoraEmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List obtenerTodos() { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public boolean existe(Empresa empresa, String serie){ + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("serie", serie)); + return !c.list().isEmpty(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroKmHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroKmHibernateDAO.java new file mode 100644 index 000000000..efdd1d9b0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroKmHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.SeguroKmDAO; +import com.rjconsultores.ventaboletos.entidad.SeguroKm; + +@Repository("seguroKmDAO") +public class SeguroKmHibernateDAO extends GenericHibernateDAO implements SeguroKmDAO { + + @Autowired + public SeguroKmHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public boolean existe(Integer orgaoConcedenteId) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("orgaoconcedente.orgaoConcedenteId", orgaoConcedenteId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.rowCount()); + + + return HibernateFix.count(c.list()) > 0; + } + + public List buscarPorOrgao(OrgaoConcedente orgao) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("orgaoconcedente", orgao)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroTarifaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroTarifaHibernateDAO.java new file mode 100644 index 000000000..5d6846d2f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/SeguroTarifaHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +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.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroTarifa; +import java.util.List; + +@Repository("seguroTarifaDAO") +public class SeguroTarifaHibernateDAO extends GenericHibernateDAO implements SeguroTarifaDAO { + + @Autowired + public SeguroTarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public boolean existe(Integer orgaoConcedenteId) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("orgaoconcedente.orgaoConcedenteId", orgaoConcedenteId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.rowCount()); + + + return HibernateFix.count(c.list()) > 0; + } + + public List buscarPorOrgao(OrgaoConcedente orgao) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("orgaoconcedente", orgao)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/SisdapHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/SisdapHibernateDAO.java new file mode 100644 index 000000000..cec4b0048 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/SisdapHibernateDAO.java @@ -0,0 +1,616 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.SQLException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.sql.DataSource; + +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.ResultSetHandler; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.commons.lang.math.NumberUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.SisdapDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.relatorios.MovimentoLinha; +import com.rjconsultores.ventaboletos.relatorios.MovimentoSecoes; +import com.rjconsultores.ventaboletos.relatorios.PrefixoAntt; + +@Repository("sisdapDAO") +public class SisdapHibernateDAO implements SisdapDAO { + + private static String HYPHEN = "-"; + private static Logger log = Logger.getLogger(SisdapHibernateDAO.class); + + @Autowired + private DataSource dataSourceRead; + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public List getMovimentoLinhas(Date fecInicio, Date fecFinal, Integer empresaId) { + + List list = consultaMovimentoLinhas(fecInicio, fecFinal, empresaId); + + List result = new ArrayList(); + + for (MovimentoLinha movimentoLinha : list) { + boolean insert = agrupaMovimentoLinhas(result, movimentoLinha); + if (insert) + result.add(movimentoLinha); + } + + List periodos = new ArrayList(); + for (MovimentoLinha movimentoLinha : result) { + String periodo = movimentoLinha.getAno() + HYPHEN + movimentoLinha.getMes(); + if (!periodos.contains(periodo)) { + periodos.add(periodo); + } + } + + List prefixos = buscaPrefixoEmpresa(empresaId); + + HashMap> periodosPrefixos = new HashMap>(); + for (String pd : periodos) { + periodosPrefixos.put(pd, prefixos); + } + + for (MovimentoLinha movimentoLinha : result) { + String periodo = movimentoLinha.getAno() + HYPHEN + movimentoLinha.getMes(); + + PrefixoAntt prefixoAntt = new PrefixoAntt(); + prefixoAntt.setAntt(movimentoLinha.getAntt()); + prefixoAntt.setPrefixo(movimentoLinha.getPrefixo()); + + if (periodosPrefixos.get(periodo).contains(prefixoAntt)) { + periodosPrefixos.get(periodo).remove(prefixoAntt); + } + } + + for (String key : periodosPrefixos.keySet()) { + String[] periodo = key.split(HYPHEN); + Integer ano = Integer.parseInt(periodo[0]); + Integer mes = Integer.parseInt(periodo[1]); + + for (PrefixoAntt prefixoAntt : periodosPrefixos.get(key)) { + MovimentoLinha linha = new MovimentoLinha(); + linha.setAno(ano); + linha.setMes(mes); + linha.setAntt(prefixoAntt.getAntt()); + linha.setPrefixo(prefixoAntt.getPrefixo()); + linha.setLugaresIda(NumberUtils.INTEGER_ZERO); + linha.setLugaresVolta(NumberUtils.INTEGER_ZERO); + linha.setViagensIda(NumberUtils.INTEGER_ZERO); + linha.setViagensVolta(NumberUtils.INTEGER_ZERO); + + result.add(linha); + } + } + + Collections.sort(result, new Comparator() { + public int compare(Object o1, Object o2) { + MovimentoLinha c1 = (MovimentoLinha) o1; + MovimentoLinha c2 = (MovimentoLinha) o2; + + int result = c1.getAno().compareTo(c2.getAno()); + if (result == 0) { + result = c1.getMes().compareTo(c2.getMes()); + } + if (result == 0) { + result = c1.getAntt().compareToIgnoreCase(c2.getAntt()); + } + if (result == 0) { + return c1.getPrefixo().compareToIgnoreCase(c2.getPrefixo()); + } + return result; + } + }); + + List movimentoLinhas = new ArrayList(); + movimentoLinhas.add("empresa;prefixo;mes;ano;viagem_ida;viagem_volta;lugar_ida;lugar_volta"); + for (MovimentoLinha movimentoLinha : result) { + movimentoLinhas.add(movimentoLinha.toString()); + } + + return movimentoLinhas; + } + + private List consultaMovimentoLinhas(Date fecInicio, Date fecFinal, Integer empresaId) { + + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + StringBuilder sb = new StringBuilder(); + sb.append("select e.codantt antt, r.prefixo prefixo, "); + sb.append(" to_char(c.feccorrida, 'MM') mes, to_char(c.feccorrida, 'yyyy') ano, "); + sb.append(" nvl(case r.indsentidoida when 1 then count(r.prefixo) end, 0) viagensida, "); + sb.append(" nvl(case r.indsentidoida when 0 then count(r.prefixo) end, 0) viagensvolta, "); + sb.append(" nvl(case r.indsentidoida when 1 then sum(da.cantasientos) end, 0) lugaresida, "); + sb.append(" nvl(case r.indsentidoida when 0 then sum(da.cantasientos) end, 0) lugaresvolta "); + sb.append("from ruta_empresa re "); + sb.append(" left join empresa e on e.empresa_id = re.empresa_id "); + sb.append(" left join ruta r on re.ruta_id = r.ruta_id "); + sb.append(" left join corrida c on c.ruta_id = r.ruta_id "); + sb.append(" left outer join rol_operativo ro on c.roloperativo_id = ro.roloperativo_id "); + sb.append(" left outer join diagrama_autobus da on da.diagramaautobus_id = ro.diagramaautobus_id "); + sb.append("where e.empresa_id = ? and re.activo = 1 and r.activo = 1 and e.activo = 1 "); + sb.append(" and r.orgaoconcedente_id = 3 and e.codantt is not null "); + sb.append(" and c.feccorrida between to_date(?, 'DD/MM/YYYY') and "); + sb.append(" to_date(?, 'DD/MM/YYYY') "); + sb.append("group by e.codantt, r.prefixo, r.indsentidoida, "); + sb.append(" to_char(c.feccorrida, 'MM'), to_char(c.feccorrida, 'yyyy') "); + sb.append("order by mes, ano, e.codantt, r.prefixo, viagensida, viagensvolta "); + + QueryRunner queryRunner = new QueryRunner(dataSourceRead); + ResultSetHandler> handler = new BeanListHandler(MovimentoLinha.class); + List returnedList = new ArrayList(); + + try { + returnedList = queryRunner.query(sb.toString(), handler, empresaId, sdf.format(fecInicio), sdf.format(fecFinal)); + } catch (SQLException e) { + log.error("",e); + } + + return returnedList; + } + + private List buscaPrefixoEmpresa(Integer empresaId) { + + StringBuilder sb = new StringBuilder(); + sb.append(" select e.codantt antt, r.prefixo prefixo "); + sb.append(" from ruta_empresa re "); + sb.append(" left join marca m on m.empresa_id = re.empresa_id "); + sb.append(" left join empresa e on m.empresa_id = e.empresa_id "); + sb.append(" left join ruta r on re.ruta_id = r.ruta_id "); + sb.append(" where re.empresa_id = ? and r.orgaoconcedente_id = 3 "); + sb.append(" and re.activo = 1 and r.activo = 1 and e.activo = 1 "); + sb.append(" group by e.codantt, r.prefixo "); + sb.append(" order by e.codantt, r.prefixo "); + + + QueryRunner queryRunner = new QueryRunner(dataSourceRead, true); + ResultSetHandler> handler = new BeanListHandler(PrefixoAntt.class); + List returnedList = new ArrayList(); + + try { + returnedList = queryRunner.query(sb.toString(), handler, empresaId); + } catch (SQLException e) { + log.error("",e); + } + + return returnedList; + } + + private boolean agrupaMovimentoLinhas(List resul, MovimentoLinha movimentoLinha) { + + if (resul.isEmpty()) { + return true; + } else { + for (MovimentoLinha ml : resul) { + if (ml.getPrefixo().equals(movimentoLinha.getPrefixo()) && ml.getMes().equals(movimentoLinha.getMes()) + && ml.getAno().equals(movimentoLinha.getAno())) { + + if (movimentoLinha.getViagensVolta() > 0) { + ml.setLugaresVolta(movimentoLinha.getLugaresVolta()); + ml.setViagensVolta(movimentoLinha.getViagensVolta()); + } + + if (movimentoLinha.getViagensIda() > 0) { + ml.setLugaresIda(movimentoLinha.getLugaresIda()); + ml.setViagensIda(movimentoLinha.getViagensIda()); + } + return false; + } + } + } + + return true; + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public List getMovimentoSecoes(Date fecInicio, Date fecFinal, Integer empresaId, List pesquisaGratuidade, List pesquisaGratuidadeIdoso, List pesquisaDescontoIdoso, List pesquisaDescontoJovem, List pesquisaGratuidadeJovem) { + List listResultConsulta = consultaMovimentoSecoes(fecInicio, fecFinal, empresaId, pesquisaGratuidade, pesquisaDescontoIdoso, pesquisaGratuidadeIdoso, pesquisaDescontoJovem, pesquisaGratuidadeJovem); + List listResultIdaVoltaInvertida = new ArrayList(); + List listVoltasSemIda = new ArrayList(); + + for (MovimentoSecoes ms : listResultConsulta) { + + Boolean achou = Boolean.FALSE; + if(isIda(ms)) { + for (MovimentoSecoes ms2 : listResultConsulta) { + if(ms != null && ms2 != null && ms.getLocalOrigem() != null && ms2.getLocalOrigem() != null && + ms.getLocalOrigem().equals(ms2.getLocalDestino()) && ms2.getLocalOrigem().equals(ms.getLocalDestino()) && !isIda(ms2) && ms2.getPrefixo().equals(ms.getPrefixo())) { + ms.setDescontoIdosoVolta(ms2.getDescontoIdosoVolta()); + ms.setGratuidadeIdosoVolta(ms2.getGratuidadeIdosoVolta()); + ms.setGratuidadePasseLivreVolta(ms2.getGratuidadePasseLivreVolta()); + ms.setPassageirosVolta(ms2.getPassageirosVolta()); + ms.setGratuidadeJovenVolta(ms2.getGratuidadeJovenVolta()); + ms.setDescontoJovenVolta(ms2.getGratuidadeJovenVolta()); + ms.setDescontoJovenVolta(ms2.getGratuidadeJovenVolta()); + listResultIdaVoltaInvertida.add(ms); + achou = Boolean.TRUE; + break; + } + } + + if(!achou) { + listResultIdaVoltaInvertida.add(ms); + } + } else { + listVoltasSemIda.add(ms); + } + } + + for (MovimentoSecoes volta : listVoltasSemIda) { + + Boolean achou = Boolean.FALSE; + + for (MovimentoSecoes idaVolta : listResultIdaVoltaInvertida) { + if(idaVolta != null && idaVolta.getLocalOrigem() != null && volta != null && volta.getLocalOrigem() != null && volta.getPrefixo() != null && + idaVolta.getLocalOrigem().equals(volta.getLocalDestino()) && volta.getLocalOrigem().equals(idaVolta.getLocalDestino()) && volta.getPrefixo().equals(idaVolta.getPrefixo())) { + achou = Boolean.TRUE; + break; + } + } + + if(!achou) { + String origem = volta.getLocalOrigem(); + String destino = volta.getLocalDestino(); + + volta.setLocalDestino(origem); + volta.setLocalOrigem(destino); + listResultIdaVoltaInvertida.add(volta); + } + } + + List periodos = new ArrayList(); + for (MovimentoSecoes ms : listResultIdaVoltaInvertida) { + String periodo = ms.getAno() + HYPHEN + ms.getMes(); + if (!periodos.contains(periodo)) { + periodos.add(periodo); + } + } + + List prefixos = buscaPrefixoEmpresaOrigenDestino(empresaId); + + HashMap> periodosPrefixos = new HashMap>(); + for (String pd : periodos) { + periodosPrefixos.put(pd, prefixos); + } + + for (MovimentoSecoes ms : listResultIdaVoltaInvertida) { + String periodo = ms.getAno() + HYPHEN + ms.getMes(); + + PrefixoAntt prefixoAntt = new PrefixoAntt(); + prefixoAntt.setAntt(ms.getAntt()); + prefixoAntt.setPrefixo(ms.getPrefixo()); + prefixoAntt.setLocalDestino(ms.getLocalDestino()); + prefixoAntt.setLocalOrigem(ms.getLocalOrigem()); + + if (periodosPrefixos.get(periodo).contains(prefixoAntt)) { + periodosPrefixos.get(periodo).remove(prefixoAntt); + } + } + + for (String key : periodosPrefixos.keySet()) { + String[] periodo = key.split(HYPHEN); + Integer ano = Integer.parseInt(periodo[0]); + Integer mes = Integer.parseInt(periodo[1]); + + for (PrefixoAntt prefixoAntt : periodosPrefixos.get(key)) { + MovimentoSecoes ms = new MovimentoSecoes(); + ms.setAno(ano); + ms.setMes(mes); + + ms.setAntt(prefixoAntt.getAntt()); + ms.setPrefixo(prefixoAntt.getPrefixo()); + ms.setLocalDestino(prefixoAntt.getLocalDestino()); + ms.setLocalOrigem(prefixoAntt.getLocalOrigem()); + + ms.setDescontoIdosoIda(NumberUtils.INTEGER_ZERO); + ms.setDescontoIdosoVolta(NumberUtils.INTEGER_ZERO); + ms.setGratuidadeIdosoIda(NumberUtils.INTEGER_ZERO); + ms.setGratuidadeIdosoVolta(NumberUtils.INTEGER_ZERO); + ms.setGratuidadeJovenIda(NumberUtils.INTEGER_ZERO); + ms.setGratuidadeJovenVolta(NumberUtils.INTEGER_ZERO); + ms.setDescontoJovenIda(NumberUtils.INTEGER_ZERO); + ms.setDescontoJovenVolta(NumberUtils.INTEGER_ZERO); + ms.setGratuidadePasseLivreIda(NumberUtils.INTEGER_ZERO); + ms.setGratuidadePasseLivreVolta(NumberUtils.INTEGER_ZERO); + ms.setPassageirosIda(NumberUtils.INTEGER_ZERO); + ms.setPassageirosVolta(NumberUtils.INTEGER_ZERO); + + listResultIdaVoltaInvertida.add(ms); + } + } + + Collections.sort(listResultIdaVoltaInvertida, new Comparator() { + public int compare(Object o1, Object o2) { + MovimentoSecoes c1 = (MovimentoSecoes) o1; + MovimentoSecoes c2 = (MovimentoSecoes) o2; + + int result = c1.getAno().compareTo(c2.getAno()); + if (result == 0) { + result = c1.getMes().compareTo(c2.getMes()); + } + if (result == 0) { + result = c1.getAntt().compareToIgnoreCase(c2.getAntt()); + } + if (result == 0) { + return c1.getPrefixo().compareToIgnoreCase(c2.getPrefixo()); + } + if (result == 0) { + return c1.getLocalOrigem().compareToIgnoreCase(c2.getLocalOrigem()); + } + if (result == 0) { + return c1.getLocalDestino().compareToIgnoreCase(c2.getLocalDestino()); + } + return result; + } + }); + + List movimentosSecoes = new ArrayList(); + movimentosSecoes.add("empresa;prefixo;local_origem;local_destino;mes;ano;passageiro_ida;passageiro_volta;gratuidade_ida;gratuidade_volta;idoso_ida;idoso_volta;desconto_ida;desconto_volta;gratuidade_jovem_ida;gratuidade_jovem_volta;gratuidade_jovem_desconto_ida;gratuidade_jovem_desconto_volta"); + + for (MovimentoSecoes ms : listResultIdaVoltaInvertida) { + movimentosSecoes.add(ms.toString()); + } + + return movimentosSecoes; + } + + private boolean isIda(MovimentoSecoes ms) { + Integer somaVolta = (ms.getDescontoIdosoVolta() + ms.getGratuidadeIdosoVolta() + ms.getGratuidadePasseLivreVolta() + ms.getPassageirosVolta()); + Integer somaIda = (ms.getDescontoIdosoIda() + ms.getGratuidadeIdosoIda() + ms.getGratuidadePasseLivreIda() + ms.getPassageirosIda()); + return (somaVolta.intValue() == 0) && (somaIda.intValue() > 0); + } + + private List consultaMovimentoSecoes(Date fecInicio, Date fecFinal, Integer empresaId, List pesquisaGratuidade, List pesquisaDescontoIdoso, List pesquisaGratuidadeIdoso, List pesquisaDescontoJovem, List pesquisaGratuidadeJovem) { + + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + + String gratuidade = ""; + for (Object categoria : pesquisaGratuidade) { + gratuidade += ((Categoria) categoria).getCategoriaId() + ","; + } + gratuidade = gratuidade.substring(0, gratuidade.length()-1); + + String gratuidadeIdoso = ""; + for (Object categoria : pesquisaGratuidadeIdoso) { + gratuidadeIdoso += ((Categoria) categoria).getCategoriaId() + ","; + } + gratuidadeIdoso = gratuidadeIdoso.substring(0, gratuidadeIdoso.length()-1); + + String descontoIdoso = ""; + for (Object categoria : pesquisaDescontoIdoso) { + descontoIdoso += ((Categoria) categoria).getCategoriaId() + ","; + } + descontoIdoso = descontoIdoso.substring(0, descontoIdoso.length()-1); + + String gratuidadeJovem = ""; + for (Object categoria : pesquisaGratuidadeJovem) { + gratuidadeJovem += ((Categoria) categoria).getCategoriaId() + ","; + } + gratuidadeJovem = gratuidadeJovem.substring(0, gratuidadeJovem.length()-1); + + String descontoJovem = ""; + for (Object categoria : pesquisaDescontoJovem) { + descontoJovem += ((Categoria) categoria).getCategoriaId() + ","; + } + descontoJovem = descontoJovem.substring(0, descontoJovem.length()-1); + + StringBuilder sb = new StringBuilder(); + sb.append("SELECT subAlias.antt, "); + sb.append(" subAlias.prefixo, "); + sb.append(" subAlias.mes, "); + sb.append(" subAlias.ano, "); + sb.append(" po.codantt localOrigem, "); + sb.append(" pd.codantt localDestino, "); + sb.append(" sum(subAlias.passageirosida) as passageirosida, "); + sb.append(" sum(subAlias.passageirosvolta) as passageirosvolta, "); + sb.append(" sum(subAlias.gratuidadepasselivreida) as gratuidadepasselivreida, "); + sb.append(" sum(subAlias.gratuidadepasselivrevolta) as gratuidadepasselivrevolta, "); + sb.append(" sum(subAlias.gratuidadeidosoida) as gratuidadeidosoida, "); + sb.append(" sum(subAlias.gratuidadeidosovolta) as gratuidadeidosovolta, "); + sb.append(" sum(subAlias.descontoidosoida) as descontoidosoida, "); + sb.append(" sum(subAlias.descontoidosovolta) as descontoidosovolta, "); + + sb.append(" sum(subAlias.gratuidadejovenida) as gratuidadejovenida, "); + sb.append(" sum(subAlias.gratuidadejovenvolta) as gratuidadejovenvolta, "); + sb.append(" sum(subAlias.descontojovenida) as descontojovenida, "); + sb.append(" sum(subAlias.descontojovenvolta) as descontojovenvolta "); + + sb.append("FROM (SELECT subResp.antt antt, "); + sb.append(" subResp.prefixo prefixo, "); + sb.append(" subResp.mes mes, "); + sb.append(" subResp.ano ano, "); + sb.append(" coalesce(ase.aliasorigen_id, subResp.localorigem) aliasorigen, "); + sb.append(" coalesce(ase.aliasdestino_id, subResp.localdestino) aliasdestino, "); + sb.append(" subResp.passageirosida passageirosida, "); + sb.append(" subResp.passageirosvolta passageirosvolta, "); + sb.append(" subResp.gratuidadepasselivreida gratuidadepasselivreida, "); + sb.append(" subResp.gratuidadepasselivrevolta gratuidadepasselivrevolta, "); + sb.append(" subResp.gratuidadeidosoida gratuidadeidosoida, "); + sb.append(" subResp.gratuidadeidosovolta gratuidadeidosovolta, "); + sb.append(" subResp.descontoidosoida descontoidosoida, "); + sb.append(" subResp.descontoidosovolta descontoidosovolta, "); + + sb.append(" subResp.gratuidadejovenida gratuidadejovenida, "); + sb.append(" subResp.gratuidadejovenvolta gratuidadejovenvolta, "); + sb.append(" subResp.descontojovenida descontojovenida, "); + sb.append(" subResp.descontojovenvolta descontojovenvolta "); + + sb.append(" FROM (SELECT distinct r.ruta_id ruta_id, "); + sb.append(" e.codantt antt, "); + sb.append(" r.prefixo prefixo, "); + sb.append(" To_char(c.feccorrida, 'MM') mes, "); + sb.append(" To_char(c.feccorrida, 'yyyy') ano, "); + sb.append(" po.parada_id localorigem, "); + sb.append(" pd.parada_id localdestino, "); + + sb.append(" Nvl(CASE WHEN r.indsentidoida = 1 AND b.categoria_id IN (SELECT categoria_id FROM categoria WHERE grupocategoria_id IS NULL) THEN Count(*) END, 0) passageirosida, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 0 AND b.categoria_id IN (SELECT categoria_id FROM categoria WHERE grupocategoria_id IS NULL) THEN Count(*) END, 0) passageirosvolta, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 1 AND b.categoria_id IN ( " + gratuidade + " ) THEN Count(*) END, 0) gratuidadepasselivreida, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 0 AND b.categoria_id IN ( " + gratuidade + " ) THEN Count(*) END, 0) gratuidadepasselivrevolta, "); + + sb.append(" Nvl(CASE WHEN r.indsentidoida = 1 AND b.categoria_id IN ( " + gratuidadeIdoso + " ) THEN Count(*) END, 0) gratuidadeidosoida, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 0 AND b.categoria_id IN ( " + gratuidadeIdoso + " ) THEN Count(*) END, 0) gratuidadeidosovolta, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 1 AND b.categoria_id IN ( " + descontoIdoso + " ) THEN Count(*) END, 0) descontoidosoida, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 0 AND b.categoria_id IN ( " + descontoIdoso + " ) THEN Count(*) END, 0) descontoidosovolta, "); + + sb.append(" Nvl(CASE WHEN r.indsentidoida = 1 AND b.categoria_id IN ( " + gratuidadeJovem + " ) THEN Count(*) END, 0) gratuidadejovenida, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 0 AND b.categoria_id IN ( " + gratuidadeJovem + " ) THEN Count(*) END, 0) gratuidadejovenvolta, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 1 AND b.categoria_id IN ( " + descontoJovem + " ) THEN Count(*) END, 0) descontojovenida, "); + sb.append(" Nvl(CASE WHEN r.indsentidoida = 0 AND b.categoria_id IN ( " + descontoJovem + " ) THEN Count(*) END, 0) descontojovenvolta "); + + sb.append(" FROM ruta_empresa re "); + sb.append(" left join empresa e ON e.empresa_id = re.empresa_id "); + sb.append(" left join ruta r ON re.ruta_id = r.ruta_id "); + sb.append(" left join corrida c ON c.ruta_id = r.ruta_id "); + sb.append(" left outer join boleto b ON c.corrida_id = b.corrida_id AND c.feccorrida = b.feccorrida "); + sb.append(" left outer join parada po ON po.parada_id = b.origen_id "); + sb.append(" left outer join parada pd ON pd.parada_id = b.destino_id "); + + sb.append(" WHERE e.empresa_id = ? "); + sb.append(" AND re.activo = 1 "); + sb.append(" AND r.activo = 1 "); + sb.append(" AND e.activo = 1 "); + sb.append(" AND r.orgaoconcedente_id = 3 "); + sb.append(" AND b.numasiento IS NOT NULL "); + sb.append(" AND b.motivocancelacion_id IS NULL "); + sb.append(" AND b.indstatusoperacion = 'F' "); + sb.append(" AND b.activo = 1 "); + sb.append(" AND e.codantt IS NOT NULL "); + sb.append(" AND c.feccorrida BETWEEN To_date(?, 'dd/MM/yyyy') AND To_date (?, 'dd/MM/yyyy') "); + sb.append(" AND b.categoria_id <> (select valorconstante from constante where NOMBCONSTANTE = 'GRATUIDADE_CRIANCA')"); + sb.append(" GROUP BY e.codantt, "); + sb.append(" r.prefixo, "); + sb.append(" To_char(c.feccorrida, 'MM'), "); + sb.append(" To_char(c.feccorrida, 'yyyy'), "); + sb.append(" po.parada_id, "); + sb.append(" pd.parada_id, "); + sb.append(" r.indsentidoida, "); + sb.append(" b.categoria_id, "); + sb.append(" r.ruta_id "); + sb.append( " ORDER BY e.codantt, "); + sb.append( " r.prefixo) subResp "); + + sb.append(" left join alias_servico ase ON ( subResp.localorigem = ase.origen_id AND subResp.localdestino = ase.destino_id and ase.ruta_id = subResp.ruta_id and ase.activo = 1) "); + + sb.append( " ORDER BY subResp.antt,"); + sb.append( " subResp.prefixo"); + sb.append( " ) subAlias"); + + sb.append(" inner join parada po ON ( subAlias.aliasorigen = po.parada_id ) "); + sb.append(" inner join parada pd ON ( subAlias.aliasdestino = pd.parada_id ) "); + sb.append("GROUP BY mes, "); + sb.append(" ano, "); + sb.append(" antt, "); + sb.append(" prefixo, "); + sb.append(" po.codantt, "); + sb.append(" pd.codantt "); + + sb.append("ORDER BY mes, "); + sb.append(" ano, "); + sb.append(" antt, "); + sb.append(" prefixo, "); + sb.append(" localOrigem, "); + sb.append(" localDestino "); + + QueryRunner queryRunner = new QueryRunner(dataSourceRead, true); + ResultSetHandler> handler = new BeanListHandler(MovimentoSecoes.class); + List returnedList = new ArrayList(); + + try { + returnedList = queryRunner.query(sb.toString(), handler, empresaId, sdf.format(fecInicio), sdf.format(fecFinal)); + + } catch (SQLException e) { + log.error("",e); + } + + return returnedList; + } + + private List buscaPrefixoEmpresaOrigenDestino(Integer empresaId) { + + StringBuilder sb = new StringBuilder(); + + sb.append(" SELECT DISTINCT "); + sb.append(" subAlias.antt, "); + sb.append(" subAlias.prefixo, "); + sb.append(" CASE WHEN subAlias.indIda = 1 THEN po.codantt ELSE pd.codantt END localOrigem, "); + sb.append(" CASE WHEN subAlias.indIda = 1 THEN pd.codantt ELSE po.codantt END localDestino "); + sb.append(" FROM (SELECT distinct subResp.antt antt, "); + sb.append(" subResp.prefixo prefixo, "); + sb.append(" ase.aliasorigen_id aliasorigen, "); + sb.append(" ase.aliasdestino_id aliasdestino, "); + sb.append(" subResp.indIda indIda "); + + sb.append(" FROM (SELECT distinct r.ruta_id ruta_id, "); + sb.append(" e.codantt antt, "); + sb.append(" r.prefixo prefixo, "); + sb.append(" po.parada_id localorigem, "); + sb.append(" pd.parada_id localdestino, "); + sb.append(" r.INDSENTIDOIDA indIda "); + sb.append(" FROM ruta_empresa re "); + sb.append(" join empresa e ON re.empresa_id = e.empresa_id "); + sb.append(" join ruta r ON re.ruta_id = r.ruta_id "); + sb.append(" join RUTA_COMBINACION rc on rc.RUTA_ID = r.ruta_id "); + sb.append(" join tramo tr on tr.TRAMO_ID = rc.TRAMO_ID "); + sb.append(" join parada po ON po.parada_id = tr.origen_id "); + sb.append(" join parada pd ON pd.parada_id = tr.destino_id "); + + sb.append(" WHERE e.empresa_id = ? "); + sb.append(" AND re.activo = 1 "); + sb.append(" AND r.activo = 1 "); + sb.append(" AND r.orgaoconcedente_id = 3 "); + sb.append(" AND e.codantt IS NOT NULL "); + sb.append(" GROUP BY e.codantt, "); + sb.append(" r.prefixo, "); + sb.append(" po.parada_id, "); + sb.append(" pd.parada_id, "); + sb.append(" r.ruta_id, "); + sb.append(" r.INDSENTIDOIDA "); + sb.append(" ORDER BY e.codantt, "); + sb.append(" r.prefixo) subResp "); + + sb.append(" join alias_servico ase ON ( subResp.localorigem = ase.origen_id AND subResp.localdestino = ase.destino_id and ase.ruta_id = subResp.ruta_id) "); + + sb.append(" ORDER BY subResp.antt, "); + sb.append(" subResp.prefixo ) subAlias "); + + sb.append(" join parada po ON ( subAlias.aliasorigen = po.parada_id ) "); + sb.append(" join parada pd ON ( subAlias.aliasdestino = pd.parada_id ) "); + + sb.append(" WHERE po.codantt <> pd.codantt "); + + sb.append(" GROUP BY antt, "); + sb.append(" prefixo, "); + sb.append(" po.codantt, "); + sb.append(" pd.codantt , "); + sb.append(" indIda "); + sb.append(" ORDER BY antt, "); + sb.append(" prefixo, "); + sb.append(" localOrigem, "); + sb.append(" localDestino "); + + QueryRunner queryRunner = new QueryRunner(dataSourceRead, true); + ResultSetHandler> handler = new BeanListHandler(PrefixoAntt.class); + + List returnedList = new ArrayList(); + + try { + returnedList = queryRunner.query(sb.toString(), handler, empresaId); + } catch (SQLException e) { + log.error("",e); + } + return returnedList; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/SistemaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/SistemaHibernateDAO.java new file mode 100644 index 000000000..c454f506e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/SistemaHibernateDAO.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.SistemaDAO; +import com.rjconsultores.ventaboletos.entidad.Sistema; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("sistemaDAO") +public class SistemaHibernateDAO extends GenericHibernateDAO + implements SistemaDAO { + + @Autowired + public SistemaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombsistema")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaCategoriaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaCategoriaHibernateDAO.java new file mode 100644 index 000000000..4e737d0e8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaCategoriaHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TarifaCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.TarifaCategoria; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("tarifaCategoriaDAO") +public class TarifaCategoriaHibernateDAO + extends GenericHibernateDAO + implements TarifaCategoriaDAO { + + @Autowired + public TarifaCategoriaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarPorCategoria(Categoria categoria) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("categoria", categoria)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaEmbarcadaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaEmbarcadaHibernateDAO.java new file mode 100644 index 000000000..e22f23c47 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaEmbarcadaHibernateDAO.java @@ -0,0 +1,215 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TarifaEmbarcadaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.entidad.TarifaEmbarcada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Repository("tarifaEmbarcadaDAO") +public class TarifaEmbarcadaHibernateDAO extends GenericHibernateDAO implements TarifaEmbarcadaDAO { + + private static Logger log = Logger.getLogger(TarifaEmbarcadaHibernateDAO.class); + + @Autowired + public TarifaEmbarcadaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } + + @Override + public void excluirTodasTarifas(Moneda moneda, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Parada origem, + Parada destino, Ruta ruta, Via via, Boolean vende) { + StringBuilder hql = new StringBuilder(); + hql.append(" update TarifaEmbarcada set activo = 0 where tarifaembarcadaId in ("); + hql.append(" select t.tarifaembarcadaId from TarifaEmbarcada t "); + + if (vende != null) { + hql.append(" inner join t.ruta.rutaCombinacionList AS rutaCombinacionList" ); + } + + hql.append(" where 0 = 0 "); + + if (moneda != null) { + hql.append(" and t.moneda.monedaId = " + moneda.getMonedaId()); + } + + if (marca != null) { + hql.append(" and t.marca.marcaId = " + marca.getMarcaId()); + } + + if (claseServicio != null) { + hql.append(" and t.claseServicio.claseservicioId = " + claseServicio.getClaseservicioId()); + } + + if (vigenciaTarifa != null) { + hql.append(" and t.vigenciaTarifa.vigenciatarifaId = " + vigenciaTarifa.getVigenciatarifaId()); + } + + if (origem != null) { + hql.append(" and t.origen.paradaId = " + origem.getParadaId()); + } + + if (destino != null) { + hql.append(" and t.destino.paradaId = " + destino.getParadaId()); + } + + if (ruta != null) { + hql.append(" and t.ruta.rutaId = " + ruta.getRutaId()); + } + + if (via != null) { + hql.append(" and t.tramo.via.viaId = " + via.getViaId()); + } + + if (vende != null) { + hql.append(" and rutaCombinacionList.indventa = " + vende); + } + + hql.append(")"); + + Query sq = getSession().createQuery(hql.toString()); + sq.executeUpdate(); + } + + public void updateTarifa(TarifaEmbarcada entity) { + Session session = getSessionFactory().getCurrentSession(); + session.update(entity); + } + + public TarifaEmbarcada buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("marca", marca)); + + Criteria cTramo = c.createCriteria("tramo"); + cTramo.add(Restrictions.eq("activo", true)); + + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("vigenciaTarifa", vigenciaTarifa)); + c.add(Restrictions.eq("moneda", moneda)); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (TarifaEmbarcada) c.uniqueResult(); + } + + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException { + try { + StringBuilder sQuery = null; + if (excluirTarifasDestino) { + sQuery = new StringBuilder("DELETE FROM TARIFA_EMBARCADA WHERE VIGENCIATARIFA_ID = :VIGENCIATARIFAID "); + SQLQuery qrUpdate = getSession().createSQLQuery(sQuery.toString()); + qrUpdate.setParameter("VIGENCIATARIFAID", vigenciaTarifaDestino.getVigenciatarifaId()); + qrUpdate.executeUpdate(); + } + + sQuery = new StringBuilder("INSERT INTO TARIFA_EMBARCADA( "); + sQuery.append("TARIFAEMBARCADA_ID,PRECIO,PRECIOREDABIERTO,TRAMO_ID,MARCA_ID,CLASESERVICIO_ID,PRECIOORIGINAL,MONEDA_ID,VIGENCIATARIFA_ID,STATUSTARIFA,ACTIVO,FECMODIF,") + .append("USUARIO_ID,IMPORTETAXAEMBARQUE,IMPORTEPEDAGIO,IMPORTEOUTROS,IMPORTESEGURO,ORGAOCONCEDENTE_ID,RUTA_ID,ORIGEN_ID,DESTINO_ID,IMPORTETPP) ") + .append(" SELECT " + + "TARIFA_EMBARCADA_SEQ.NEXTVAL, " + + "PRECIO, " + + "PRECIOREDABIERTO, " + + "TRAMO_ID, " + + "tarifa.MARCA_ID, " + + "CLASESERVICIO_ID, " + + "PRECIOORIGINAL, " + + "MONEDA_ID, " + + ":VIGENCIATARIFAIDDESTINO, " + + "STATUSTARIFA, " + + "1, " + + "sysdate, " + + ":USUARIOID, " + + "IMPORTETAXAEMBARQUE, " + + "IMPORTEPEDAGIO, " + + "IMPORTEOUTROS, " + + "IMPORTESEGURO, " + + "ORGAOCONCEDENTE_ID, " + + "RUTA_ID, " + + "ORIGEN_ID, " + + "DESTINO_ID, " + + "IMPORTETPP " + + + "FROM TARIFA_EMBARCADA tarifa " + + "INNER JOIN MARCA marca ON marca.MARCA_ID = tarifa.MARCA_ID " + + "WHERE tarifa.ACTIVO = 1 AND VIGENCIATARIFA_ID = :VIGENCIATARIFAIDORIGEM"); + + if (!excluirTarifasDestino) { + sQuery.append(" AND NOT EXISTS(SELECT" + + " tDestino.TRAMO_ID," + + " tDestino.MARCA_ID," + + " tDestino.CLASESERVICIO_ID," + + " tDestino.MONEDA_ID," + + " tDestino.ORGAOCONCEDENTE_ID," + + " tDestino.RUTA_ID" + + " FROM TARIFA_EMBARCADA tDestino" + + " WHERE" + + " tDestino.TRAMO_ID = tarifa.TRAMO_ID" + + " AND tDestino.MARCA_ID = tarifa.MARCA_ID" + + " AND tDestino.CLASESERVICIO_ID = tarifa.CLASESERVICIO_ID" + + " AND tDestino.MONEDA_ID = tarifa.MONEDA_ID" + + " AND tDestino.ORGAOCONCEDENTE_ID = tarifa.ORGAOCONCEDENTE_ID" + + " AND tDestino.RUTA_ID = tarifa.RUTA_ID" + + " AND tdestino.ACTIVO = 1" + + " AND VIGENCIATARIFA_ID = :VIGENCIATARIFAIDDESTINO)"); + } + + if (empresa != null && empresa.getEmpresaId() != -1) { + sQuery.append(" AND marca.EMPRESA_ID = :EMPRESA_ID"); + } + + SQLQuery qrInsert = getSession().createSQLQuery(sQuery.toString()); + qrInsert.setParameter("VIGENCIATARIFAIDORIGEM", vigenciaTarifaOrigem.getVigenciatarifaId()); + qrInsert.setParameter("VIGENCIATARIFAIDDESTINO", vigenciaTarifaDestino.getVigenciatarifaId()); + qrInsert.setParameter("USUARIOID", UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + if (empresa != null && empresa.getEmpresaId() != -1) { + qrInsert.setParameter("EMPRESA_ID", empresa.getEmpresaId()); + } + qrInsert.executeUpdate(); + + } catch (Exception e) { + log.error(e.getMessage()); + throw new BusinessException(e.getMessage(), e.getCause()); + } + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaEmbarcadaHistHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaEmbarcadaHistHibernateDAO.java new file mode 100644 index 000000000..03c9b6ae5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaEmbarcadaHistHibernateDAO.java @@ -0,0 +1,35 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TarifaEmbarcadaHistDAO; +import com.rjconsultores.ventaboletos.entidad.TarifaEmbarcadaHist; + +@Repository("tarifaEmbarcadaHistDAO") +public class TarifaEmbarcadaHistHibernateDAO extends GenericHibernateDAO implements TarifaEmbarcadaHistDAO { + + @Autowired + public TarifaEmbarcadaHistHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHibernateDAO.java new file mode 100644 index 000000000..3b16a134a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHibernateDAO.java @@ -0,0 +1,484 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.commons.lang.Validate; +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.Transformers; +import org.hibernate.type.BigDecimalType; +import org.hibernate.type.DateType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TarifaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.comissao.TarifaVO; + +/** + * + * @author rodrigo + */ +@SuppressWarnings("unchecked") +@Repository("tarifaDAO") +public class TarifaHibernateDAO extends GenericHibernateDAO implements TarifaDAO { + + private static Logger log = Logger.getLogger(TarifaHibernateDAO.class); + + @Autowired + public TarifaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public boolean existe(Marca marca, Tramo tramo, Moneda moneda, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Ruta ruta, OrgaoConcedente orgaoConcedente) { + + Validate.notNull(marca); + Validate.notNull(tramo); + Validate.notNull(moneda); + Validate.notNull(claseServicio); + Validate.notNull(vigenciaTarifa); + Validate.notNull(ruta); + Validate.notNull(orgaoConcedente); + + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("moneda", moneda)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("vigenciaTarifa", vigenciaTarifa)); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("orgaoConcedente", orgaoConcedente)); + + c.setProjection(Projections.rowCount()); + + return (HibernateFix.count(c.list()) > 0); + } + + public List pesquisar(Marca marca, Parada origem, Parada destino, Moneda moneda, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Categoria categoria, TipoPuntoVenta tipoPuntoVenta) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + Criteria cCategoria = null; + if (categoria != null) { + cCategoria = c.createCriteria("lsTarifaCategoria"); + cCategoria.add(Restrictions.eq("categoria", categoria)); + cCategoria.add(Restrictions.eq("activo", Boolean.TRUE)); + } + + Criteria cTipoPuntoVenta = null; + if (tipoPuntoVenta != null) { + cTipoPuntoVenta = c.createCriteria("lsTarifaTipoptovta"); + cTipoPuntoVenta.add(Restrictions.eq("tipoPuntoVenta", tipoPuntoVenta)); + cTipoPuntoVenta.add(Restrictions.eq("activo", Boolean.TRUE)); + } + + if (marca != null) { + c.add(Restrictions.eq("marca", marca)); + } + + Criteria cTramo = c.createCriteria("tramo"); + if (origem != null) { + cTramo.add(Restrictions.eq("origem", origem)); + } + + if (destino != null) { + cTramo.add(Restrictions.eq("destino", destino)); + } + + if (moneda != null) { + c.add(Restrictions.eq("moneda", moneda)); + } + + if (claseServicio != null) { + c.add(Restrictions.eq("claseServicio", claseServicio)); + } + + if (vigenciaTarifa != null) { + c.add(Restrictions.eq("vigenciaTarifa", vigenciaTarifa)); + } + + return c.list(); + } + + public Tarifa buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("marca", marca)); + + Criteria cTramo = c.createCriteria("tramo"); + cTramo.add(Restrictions.eq("activo", true)); + + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("vigenciaTarifa", vigenciaTarifa)); + c.add(Restrictions.eq("moneda", moneda)); + c.add(Restrictions.eq("ruta", ruta)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (Tarifa) c.uniqueResult(); + } + + public List buscarTarifasAtivasInativasPorVigencia(VigenciaTarifa vigencia, Empresa empresa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + if (vigencia != null) { + c.add(Restrictions.eq("vigenciaTarifa", vigencia)); + } + if (empresa != null && empresa.getEmpresaId() != -1) { + c.createCriteria("marca").add(Restrictions.eq("empresa", empresa)); + } + + return c.list(); + } + + public List buscarTarifasAtivasPorVigencia(VigenciaTarifa vigenciaTarifa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("vigenciaTarifa", vigenciaTarifa)); + + return c.list(); + } + + public boolean buscarTarifaExisteTramo(Tramo tramo) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.setProjection(Projections.rowCount()); + + return (HibernateFix.count(c.list()) > 0); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException { + try { + StringBuilder sQuery = null; + if (excluirTarifasDestino) { + sQuery = new StringBuilder("DELETE FROM TARIFA WHERE VIGENCIATARIFA_ID = :VIGENCIATARIFAID "); + SQLQuery qrUpdate = getSession().createSQLQuery(sQuery.toString()); + qrUpdate.setParameter("VIGENCIATARIFAID", vigenciaTarifaDestino.getVigenciatarifaId()); + qrUpdate.executeUpdate(); + } + + sQuery = new StringBuilder("INSERT INTO TARIFA( "); + sQuery.append("TARIFA_ID,PRECIO,PRECIOREDABIERTO,TRAMO_ID,MARCA_ID,CLASESERVICIO_ID,PRECIOORIGINAL,MONEDA_ID,VIGENCIATARIFA_ID,STATUSTARIFA,ACTIVO,FECMODIF,") + .append("USUARIO_ID,IMPORTETAXAEMBARQUE,IMPORTEPEDAGIO,IMPORTEOUTROS,IMPORTESEGURO,ORGAOCONCEDENTE_ID,RUTA_ID,ORIGEN_ID,DESTINO_ID,IMPORTETPP) ") + .append(" SELECT " + + "TARIFA_SEQ.NEXTVAL, " + + "PRECIO, " + + "PRECIOREDABIERTO, " + + "TRAMO_ID, " + + "tarifa.MARCA_ID, " + + "CLASESERVICIO_ID, " + + "PRECIOORIGINAL, " + + "MONEDA_ID, " + + ":VIGENCIATARIFAIDDESTINO, " + + "STATUSTARIFA, " + + "1, " + + "sysdate, " + + ":USUARIOID, " + + "IMPORTETAXAEMBARQUE, " + + "IMPORTEPEDAGIO, " + + "IMPORTEOUTROS, " + + "IMPORTESEGURO, " + + "ORGAOCONCEDENTE_ID, " + + "RUTA_ID, " + + "ORIGEN_ID, " + + "DESTINO_ID, " + + "IMPORTETPP " + + + "FROM TARIFA tarifa " + + "INNER JOIN MARCA marca ON marca.MARCA_ID = tarifa.MARCA_ID " + + "WHERE tarifa.ACTIVO = 1 AND VIGENCIATARIFA_ID = :VIGENCIATARIFAIDORIGEM"); + + if (!excluirTarifasDestino) { + sQuery.append(" AND NOT EXISTS(SELECT" + + " tDestino.TRAMO_ID," + + " tDestino.MARCA_ID," + + " tDestino.CLASESERVICIO_ID," + + " tDestino.MONEDA_ID," + + " tDestino.ORGAOCONCEDENTE_ID," + + " tDestino.RUTA_ID" + + " FROM TARIFA tDestino" + + " WHERE" + + " tDestino.TRAMO_ID = tarifa.TRAMO_ID" + + " AND tDestino.MARCA_ID = tarifa.MARCA_ID" + + " AND tDestino.CLASESERVICIO_ID = tarifa.CLASESERVICIO_ID" + + " AND tDestino.MONEDA_ID = tarifa.MONEDA_ID" + + " AND tDestino.ORGAOCONCEDENTE_ID = tarifa.ORGAOCONCEDENTE_ID" + + " AND tDestino.RUTA_ID = tarifa.RUTA_ID" + + " AND tdestino.ACTIVO = 1" + + " AND VIGENCIATARIFA_ID = :VIGENCIATARIFAIDDESTINO)"); + } + + if (empresa != null && empresa.getEmpresaId() != -1) { + sQuery.append(" AND marca.EMPRESA_ID = :EMPRESA_ID"); + } + + SQLQuery qrInsert = getSession().createSQLQuery(sQuery.toString()); + qrInsert.setParameter("VIGENCIATARIFAIDORIGEM", vigenciaTarifaOrigem.getVigenciatarifaId()); + qrInsert.setParameter("VIGENCIATARIFAIDDESTINO", vigenciaTarifaDestino.getVigenciatarifaId()); + qrInsert.setParameter("USUARIOID", UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + if (empresa != null && empresa.getEmpresaId() != -1) { + qrInsert.setParameter("EMPRESA_ID", empresa.getEmpresaId()); + } + qrInsert.executeUpdate(); + + } catch (Exception e) { + log.error(e.getMessage()); + throw new BusinessException(e.getMessage(), e.getCause()); + } + } + + @Override + public boolean existeTarifas(VigenciaTarifa vigenciaTarifa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("vigenciaTarifa", vigenciaTarifa)); + c.setProjection(Projections.rowCount()); + return (HibernateFix.count(c.list()) > 0); + } + + @Override + public void excluirTodasTarifas(Moneda moneda, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Parada origem, + Parada destino, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via, Boolean vende, Integer usuarioModifId) { + StringBuilder hql = new StringBuilder(); + hql.append(" update Tarifa set activo = 0, fecmodif = sysdate(), usuarioId = ").append(usuarioModifId).append(" where tarifaId in ("); + hql.append(" select t.tarifaId from Tarifa t "); + + if (vende != null) { + hql.append(" inner join t.ruta.rutaCombinacionList AS rutaCombinacionList" ); + } + + if (categoria == null && tipoPuntoVenta == null) { + hql.append(" where 0 = 0 "); + } + + if (categoria != null) { + hql.append(" inner join t.lsTarifaCategoria as tarifascategoria "); + hql.append(" where 0 = 0 and tarifascategoria.categoria.categoriaId = " + categoria.getCategoriaId()); + } + + if (tipoPuntoVenta != null) { + hql.append(" inner join t.lsTarifaTipoptovta as tarifastipoptovta "); + if (categoria == null) { + hql.append(" where 0 = 0 and tarifastipoptovta.tipoPuntoVenta.tipoptovtaId = " + tipoPuntoVenta.getTipoptovtaId()); + } else { + hql.append(" and tarifastipoptovta.tipoPuntoVenta.tipoptovtaId = " + tipoPuntoVenta.getTipoptovtaId()); + } + } + + if (moneda != null) { + hql.append(" and t.moneda.monedaId = " + moneda.getMonedaId()); + } + + if (marca != null) { + hql.append(" and t.marca.marcaId = " + marca.getMarcaId()); + } + + if (claseServicio != null) { + hql.append(" and t.claseServicio.claseservicioId = " + claseServicio.getClaseservicioId()); + } + + if (vigenciaTarifa != null) { + hql.append(" and t.vigenciaTarifa.vigenciatarifaId = " + vigenciaTarifa.getVigenciatarifaId()); + } + + if (origem != null) { + hql.append(" and t.origen.paradaId = " + origem.getParadaId()); + } + + if (destino != null) { + hql.append(" and t.destino.paradaId = " + destino.getParadaId()); + } + + if (ruta != null) { + hql.append(" and t.ruta.rutaId = " + ruta.getRutaId()); + } + + if (via != null) { + hql.append(" and t.tramo.via.viaId = " + via.getViaId()); + } + + if (vende != null) { + hql.append(" and rutaCombinacionList.indventa = " + vende); + } + + hql.append(")"); + + Query sq = getSession().createQuery(hql.toString()); + sq.executeUpdate(); + + } + + + + @Override + public List obterTarifaOficialPorFiltroVO(Moneda moneda, Marca marca, List lsMarcas, Parada origem, Parada destino, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via, Boolean vende) { + + StringBuilder sql = new StringBuilder(" SELECT "); + sql.append(" t.tarifa_id tarifaid,"); + sql.append(" t.PRECIO precio,"); + sql.append(" t.PRECIOORIGINAL preciooriginal,"); + sql.append(" t.IMPORTEPEDAGIO importepedagio,"); + sql.append(" t.IMPORTETAXAEMBARQUE importetaxaembarque,"); + sql.append(" t.IMPORTESEGURO importeseguro,"); + sql.append(" t.IMPORTETPP importetpp,"); + sql.append(" t.IMPORTEOUTROS importeoutros,"); + sql.append(" t.STATUSTARIFA statustarifa,"); + sql.append(" origem.DESCPARADA descparadaOrigem,"); + sql.append(" destino.DESCPARADA descparadaDestino,"); + sql.append(" via.NOMBVIA nomeVia,"); + sql.append(" ma.DESCMARCA descMarca,"); + sql.append(" v.FECINICIOVIGENCIA feciniciovigencia,"); + sql.append(" v.FECFINVIGENCIA fecfimvigencia,"); + sql.append(" cl.DESCCLASE descclasse,"); + sql.append(" oc.DESCORGAO descorgao,"); + sql.append(" r.prefixo rutaprefixo,"); + sql.append(" r.numruta numruta"); + sql.append(" FROM TARIFA t"); + sql.append(" LEFT JOIN TRAMO tr on (tr.TRAMO_ID = t.TRAMO_ID)"); + sql.append(" LEFT JOIN VIA via on (VIA.VIA_ID=tr.VIA_ID)"); + sql.append(" LEFT JOIN PARADA origem on (origem.PARADA_ID=tr.ORIGEN_ID)"); + sql.append(" LEFT JOIN PARADA destino on (destino.PARADA_ID=tr.DESTINO_ID)"); + sql.append(" LEFT JOIN MARCA ma on (ma.MARCA_ID = t.MARCA_ID)"); + sql.append(" LEFT JOIN VIGENCIA_TARIFA v on (v.VIGENCIATARIFA_ID = t.VIGENCIATARIFA_ID)"); + sql.append(" LEFT JOIN ruta r ON ( r.ruta_id = t.ruta_id )"); + sql.append(" LEFT JOIN CLASE_SERVICIO cl ON (cl.CLASESERVICIO_ID=t.CLASESERVICIO_ID)"); + sql.append(" LEFT JOIN ORGAO_CONCEDENTE oc ON (oc.ORGAOCONCEDENTE_ID=t.ORGAOCONCEDENTE_ID)"); + if (categoria != null) { + sql.append(" LEFT JOIN TARIFA_CATEGORIA tc on (tc.TARIFA_ID = t.TARIFA_ID) "); + } + if (tipoPuntoVenta != null) { + sql.append("LEFT JOIN TARIFA_TIPOPTOVTA tt on (tt.TARIFA_ID = t.TARIFA_ID)"); + } + + if(vende!=null){ + sql.append(" LEFT JOIN RUTA_COMBINACION rc on (rc.tramo_id = tr.tramo_id)"); + } + sql.append(" WHERE "); + sql.append(" t.activo=1 "); + if (moneda != null) { + sql.append(" and t.moneda_id=" + moneda.getMonedaId()); + } + if (marca != null) { + sql.append(" and t.marca_id=" + marca.getMarcaId()); + } else { + String stringMarca =" and t.marca_id in ("; + int contador =0; + for(Marca m:lsMarcas){ + if(contador==0){ + stringMarca=stringMarca+m.getMarcaId().toString(); + }else{ + stringMarca=stringMarca+","+m.getMarcaId(); + } + contador++; + if(lsMarcas.size()==contador){ + stringMarca=stringMarca+")"; + } + } + sql.append(stringMarca); + + } + if(ruta!=null){ + sql.append(" and t.ruta_id=" + ruta.getRutaId()); + } + if (origem != null) { + sql.append(" and origem.parada_id=" + origem.getParadaId()); + } + if (destino != null) { + sql.append(" and destino.parada_id=" + destino.getParadaId()); + } + if (claseServicio != null) { + sql.append(" and t.claseservicio_id=" + claseServicio.getClaseservicioId()); + } + if (vigenciaTarifa != null) { + sql.append(" and t.vigenciatarifa_id=" + vigenciaTarifa.getVigenciatarifaId()); + } + if (categoria != null) { + sql.append(" and tc.categoria_id=" + categoria.getCategoriaId()); + } + if (vigenciaTarifa != null) { + sql.append(" and t.vigenciatarifa_id=" + vigenciaTarifa.getVigenciatarifaId()); + } + if (via != null) { + sql.append(" and via.via_id=" + via.getViaId()); + } + if (tipoPuntoVenta != null) { + sql.append(" and tt.tipoptovta_id=" +tipoPuntoVenta.getTipoptovtaId()); + } + if(vende!=null){ + int simNao=vende?1:0; + sql.append(" and rc.tramo_id=t.tramo_id and rc.ruta_id=t.ruta_id and rc.activo=1 and rc.INDVENTA="+simNao); + } + + Query qr = getSession().createSQLQuery(sql.toString()) + .addScalar("tarifaid", IntegerType.INSTANCE) + .addScalar("precio", BigDecimalType.INSTANCE) + .addScalar("preciooriginal", BigDecimalType.INSTANCE) + .addScalar("importepedagio", BigDecimalType.INSTANCE) + .addScalar("importetaxaembarque", BigDecimalType.INSTANCE) + .addScalar("importeseguro", BigDecimalType.INSTANCE) + .addScalar("importetpp", BigDecimalType.INSTANCE) + .addScalar("importeoutros", BigDecimalType.INSTANCE) + .addScalar("statustarifa", StringType.INSTANCE) + .addScalar("descparadaOrigem", StringType.INSTANCE) + .addScalar("descparadaDestino", StringType.INSTANCE) + .addScalar("nomeVia", StringType.INSTANCE) + .addScalar("descMarca", StringType.INSTANCE) + .addScalar("feciniciovigencia", DateType.INSTANCE) + .addScalar("fecfimvigencia", DateType.INSTANCE) + .addScalar("descclasse", StringType.INSTANCE) + .addScalar("descorgao", StringType.INSTANCE) + .addScalar("rutaprefixo", StringType.INSTANCE) + .addScalar("numruta", StringType.INSTANCE) + .setResultTransformer(Transformers.aliasToBean(TarifaVO.class)); + qr.setMaxResults(5000); + return (List) qr.list(); + + } + + public void updateTarifa(Tarifa entity) { + Session session = getSessionFactory().getCurrentSession(); + session.update(entity); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHistHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHistHibernateDAO.java new file mode 100644 index 000000000..2e3602395 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaHistHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TarifaHistDAO; +import com.rjconsultores.ventaboletos.entidad.TarifaHist; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("tarifaHistDAO") +public class TarifaHistHibernateDAO extends GenericHibernateDAO + implements TarifaHistDAO { + + @Autowired + public TarifaHistHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaKmHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaKmHibernateDAO.java new file mode 100644 index 000000000..ec049792f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaKmHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TarifaKmDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TarifaKm; + +/** +* +* @author daniel.zauli +*/ +@Repository("tarifaKmDAO") +public class TarifaKmHibernateDAO extends GenericHibernateDAO +implements TarifaKmDAO { + + @Autowired + public TarifaKmHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarPorOrgaoAndClasse(OrgaoConcedente orgaoconcedenteId, ClaseServicio claseId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("orgaoconcedenteId", orgaoconcedenteId)); + if( claseId.getClaseservicioId() != -1){ + c.add(Restrictions.eq("claseServicio", claseId)); + } + + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaMinimaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaMinimaHibernateDAO.java new file mode 100644 index 000000000..a0aa46106 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaMinimaHibernateDAO.java @@ -0,0 +1,297 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.math.BigDecimal; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Criterion; +import org.hibernate.criterion.Disjunction; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TarifaMinimaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.TarifaMinima; +import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria; + +/** + * + * @author rodrigo + */ +@SuppressWarnings("unchecked") +@Repository("tarifaMinimaDAO") +public class TarifaMinimaHibernateDAO extends GenericHibernateDAO + implements TarifaMinimaDAO { + + @Autowired + public TarifaMinimaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List pesquisar(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Moneda moneda) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (marca != null) { + c.add(Restrictions.eq("marca", marca)); + } + + if (origem != null) { + c.add(Restrictions.eq("origem", origem)); + } + + if (destino != null) { + c.add(Restrictions.eq("destino", destino)); + } + + if (claseServicio != null) { + c.add(Restrictions.eq("claseServicio", claseServicio)); + } + + if (moneda != null) { + c.add(Restrictions.eq("moneda", moneda)); + } + + return c.list(); + } + + public List pesquisarPlaza(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Plaza plaza) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (marca != null) { + c.add(Restrictions.eq("marca", marca)); + } + + if (origem != null) { + c.add(Restrictions.eq("origem", origem)); + } + + if (destino != null) { + c.add(Restrictions.eq("destino", destino)); + } + + if (claseServicio != null) { + c.add(Restrictions.eq("claseServicio", claseServicio)); + } + + if (plaza != null) { + c.add(Restrictions.eq("plaza", plaza)); + } + + return c.list(); + } + + public List buscarPorPlaza(Plaza plaza) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("plaza", plaza)); + + return c.list(); + } + + public List pesquisar(BigDecimal valor, Moneda moneda, + Plaza plaza, Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("importetarifa", valor)); + c.add(Restrictions.eq("moneda", moneda)); + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("plaza", plaza)); + + return c.list(); + } + + public List pesquisar(TarifaMinima tarifaMinima) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + // c.add(Restrictions.eq("importetarifa", valor)); + c.add(Restrictions.eq("moneda", tarifaMinima.getMoneda())); + c.add(Restrictions.eq("marca", tarifaMinima.getMarca())); + c.add(Restrictions.eq("origem", tarifaMinima.getOrigem())); + c.add(Restrictions.eq("destino", tarifaMinima.getDestino())); + c.add(Restrictions.eq("claseServicio", tarifaMinima.getClaseServicio())); + c.add(Restrictions.eq("plaza", tarifaMinima.getPlaza())); + c.add(Restrictions.eq("orgaoConcedente", tarifaMinima.getOrgaoConcedente())); + + c.add(Restrictions.eq("vigenciaTarifa", tarifaMinima.getVigenciaTarifa())); + + if(tarifaMinima.getRuta() != null){ + c.add(Restrictions.eq("ruta", tarifaMinima.getRuta())); + } + if(tarifaMinima.getRegionMetropolitana() != null){ + c.add(Restrictions.eq("regionMetropolitana", tarifaMinima.getRegionMetropolitana())); + } + if(tarifaMinima.getCoeficienteTarifa() != null){ + c.add(Restrictions.eq("coeficienteTarifa", tarifaMinima.getCoeficienteTarifa())); + } + + return c.list(); + } + + public List pesquisarOrigemDestinoTodos(Marca marca, Parada origem, Parada destino, ClaseServicio claseServicio, Moneda moneda) { + + Criteria criterioBusca = getSession().createCriteria(getPersistentClass()); + + Disjunction disjunctionOrigem = Restrictions.disjunction(); + Criterion cOrigem = Restrictions.eq("origem", origem); + Criterion cOrigemTodos = Restrictions.eq("origem.paradaId", Parada.ID_PARADA_TODOS); + disjunctionOrigem.add(cOrigem); + disjunctionOrigem.add(cOrigemTodos); + criterioBusca.add(disjunctionOrigem); + + Disjunction disjunctionDestino = Restrictions.disjunction(); + Criterion cDestino = Restrictions.eq("destino", destino); + Criterion cDestinoTodos = Restrictions.eq("destino.paradaId", Parada.ID_PARADA_TODOS); + disjunctionDestino.add(cDestino); + disjunctionDestino.add(cDestinoTodos); + criterioBusca.add(disjunctionDestino); + + criterioBusca.add(Restrictions.eq("activo", Boolean.TRUE)); + criterioBusca.add(Restrictions.eq("moneda", moneda)); + + criterioBusca.add(Restrictions.or(Restrictions.eq("marca", marca), Restrictions.eq("marca.marcaId", (short) -1))); + criterioBusca.add(Restrictions.or(Restrictions.eq("claseServicio", claseServicio), Restrictions.eq("claseServicio.claseservicioId", -1))); + + return criterioBusca.list(); + } + + public List buscarPorMarcaMoneda(Marca marca, Moneda moneda) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("marca", marca)); + c.add(Restrictions.eq("moneda", moneda)); + + return c.list(); + } + + public List buscarPorClaseServicioMoneda( + ClaseServicio claseServicio, Moneda moneda) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("claseServicio", claseServicio)); + c.add(Restrictions.eq("moneda", moneda)); + + return c.list(); + } + + public List buscarPorPlazaMoneda(Plaza plaza, Moneda moneda) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("plaza", plaza)); + c.add(Restrictions.eq("moneda", moneda)); + + return c.list(); + } + + @Override + @Transactional + public TarifaMinimaCategoria adicionarTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria) { + getSession().save(tarifaMinimaCategoria); + return tarifaMinimaCategoria; + } + + @Override + @Transactional + public void removerTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria) { + getSession().merge(tarifaMinimaCategoria); + } + + @Override + @Transactional + public BigDecimal obtenerTarifaMinima(Integer claseServicioId, Integer marcaId, Integer origenConsultaId, + Integer destinoConsultaId, Integer plazaId, Integer monedaId, Integer rutaId, Integer categoriaId ) { + BigDecimal tarifaMinima = BigDecimal.ZERO; + + StringBuilder hql = new StringBuilder("select tm from TarifaMinima tm ") + .append("left join tm.orgaoConcedente oc ") + .append("left join tm.tarifaMinimaCategorias tmc ") + .append("left join tm.vigenciaTarifa vige ") + .append("left join tm.regionMetropolitana.paradaList ori ") + .append("left join tm.regionMetropolitana.paradaList des ") + .append("where tm.activo = 1 ") + .append("and tm.plaza.plazaId in (:plazaId, -1) ") + .append("and tm.claseServicio.claseservicioId in (:claseServId, -1) ") + .append("and tm.marca.marcaId in (:marcaId, -1) ") + .append("and (ori.paradaId in (:origenId, -1) or ori.paradaId is null ) ") + .append("and (des.paradaId in (:destinoId,-1) or des.paradaId is null ) ") + .append("and (tm.origem.paradaId in (:origenId, -1) or tm.origem.paradaId is null) ") + .append("and (tm.destino.paradaId in (:destinoId, -1) or tm.destino.paradaId is null) ") + .append("and (tm.ruta.rutaId is null or tm.ruta.rutaId in (:rutaId, -1)) "); + + if (categoriaId != null) { + hql.append("and (tmc is null or tmc.categoria.categoriaId in (:categoriaId, -1)) "); + } + + hql.append(" and tm.moneda.monedaId = :monedaId ") + .append(" and (oc is null or oc.orgaoConcedenteId = -1 or oc.orgaoConcedenteId = ") + .append(" (select distinct r.orgaoConcedente.orgaoConcedenteId from Ruta r") + .append(" left join r.rutaCombinacionList rc") + .append(" left join rc.tramo tr") + .append(" left join tr.lsOrgaoTramo ot") + .append(" where rc.ruta.rutaId = :rutaId") + .append(" and (tm.coeficienteTarifa.coeficienteId in ") + .append(" (ot.coeficienteTarifa1.coeficienteId, ot.coeficienteTarifa2.coeficienteId, ot.coeficienteTarifa3.coeficienteId ) ") + .append(" and tr.origem = :origenId ") + .append(" and tr.destino = :destinoId ") + .append(" or tm.coeficienteTarifa is null ) )) ") + .append(" and sysdate between vige.feciniciovigencia and vige.fecfinvigencia ") + + .append(" order by tm.plaza.plazaId desc, tm.origem.paradaId desc, ") + .append(" tm.destino.paradaId desc, tm.claseServicio.claseservicioId desc, ") + .append(" tm.marca.marcaId desc"); + + Query miQry = getSession().createQuery(hql.toString()); + miQry.setInteger("plazaId", plazaId); + miQry.setInteger("claseServId", claseServicioId); + miQry.setInteger("marcaId", marcaId); + miQry.setInteger("origenId", origenConsultaId); + miQry.setInteger("destinoId", destinoConsultaId); + miQry.setInteger("monedaId", monedaId); + miQry.setInteger("rutaId", rutaId); + + if (categoriaId != null) { + miQry.setInteger("categoriaId", categoriaId); + } + + List listTarifaMinima = miQry.list(); + if (!listTarifaMinima.isEmpty()) { + tarifaMinima = listTarifaMinima.get(0).getImportetarifa(); + } + + return tarifaMinima; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaOficialHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaOficialHibernateDAO.java new file mode 100644 index 000000000..6be85e4b7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaOficialHibernateDAO.java @@ -0,0 +1,522 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.List; +import java.util.Map; + +import org.hibernate.Hibernate; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.transform.Transformers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.constantes.TipoSeguro; +import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TarifaOficial; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; +import com.rjconsultores.ventaboletos.vo.comissao.TarifaOficialVO; + +@Repository("tarifaOficialDAO") +public class TarifaOficialHibernateDAO extends GenericHibernateDAO implements TarifaOficialDAO { + + private static Logger log = LoggerFactory.getLogger(TarifaOficialHibernateDAO.class); + + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public TarifaOficialHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public Integer gerarTarifaPorCoeficiente(Integer rutaId, Integer usuarioId, OrgaoConcedente orgaoConcedente, List idsEmpresas) { + + String sql = sqlBuilder.getSQLGerarTarifaOficial(rutaId, usuarioId, orgaoConcedente, idsEmpresas); + + int qtd = getSession().createSQLQuery(sql).executeUpdate(); + + return qtd; + } + + @Override + public Integer gerarTarifaArtesp(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas) { + + String sql = sqlBuilder.getSQLGerarTarifaOficialArtesp(rutaId, usuarioId, orgaoConcedenteId, idsEmpresas); + + int qtd = getSession().createSQLQuery(sql).executeUpdate(); + + return qtd; + } + + @Override + public Integer gerarTabelaZerada(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas) { + + String sql = sqlBuilder.getSQLGerarTabelaZerada(rutaId, usuarioId, orgaoConcedenteId, idsEmpresas); + + int qtd = getSession().createSQLQuery(sql).executeUpdate(); + + return qtd; + } + + @Override + public Integer atualizarTarifaCoeficiente(Integer rutaId, Integer usuarioId, OrgaoConcedente orgaoConcedente) { + + String sql = sqlBuilder.getSQLAtualizarTarifaOficial(rutaId, usuarioId, orgaoConcedente); + + int qtd = getSession().createSQLQuery(sql).executeUpdate(); + + return qtd; + } + + @Override + public void limparTarifasOficiais(List lsEmpresaSelected) { + + String query = "DELETE FROM TarifaOficial "; + if (lsEmpresaSelected != null && !lsEmpresaSelected.isEmpty()) { + query += "WHERE tarifaOficialId IN ( "; + query += " SELECT t.tarifaOficialId FROM TarifaOficial t WHERE t.marca.empresa.empresaId IN ("; + for (Empresa e : lsEmpresaSelected) { + query += e.getEmpresaId() + ","; + } + query = query.substring(0, query.length() - 1); + query += "))"; + } + Query q = getSession().createQuery(query); + q.executeUpdate(); + } + + private void apagarTarifasInativas(VigenciaTarifa vigenciaTarifa, Empresa empresa, OrgaoConcedente orgao) { + StringBuilder sb = new StringBuilder(""); + sb.append("select "); + sb.append(" tar.tarifaId "); + sb.append("from "); + sb.append(" Tarifa tar,TarifaOficial tao "); + sb.append("where "); + sb.append(" tar.activo=0 "); + sb.append(" and tao.activo = 1 "); + sb.append(" and tar.tramo=tao.tramo "); + sb.append(" and tar.marca=tao.marca "); + sb.append(" and tar.claseServicio =tao.claseServicio "); + sb.append(" and tar.moneda=tao.moneda "); + sb.append(" and tar.orgaoConcedente=tao.orgaoConcedente "); + sb.append(" and tar.ruta=tao.ruta "); + sb.append(" and tar.vigenciaTarifa.vigenciatarifaId = :vigenciaId "); + + if (orgao != null) { + sb.append(" and tar.orgaoConcedente = :orgao "); + } + if (empresa != null) { + sb.append(" and tar.marca.empresa = :empresa "); + } + + Query query = getSession().createQuery("DELETE FROM TarifaTipoptovta WHERE tarifa.tarifaId in (" + sb.toString() + ")"); + query.setParameter("vigenciaId", vigenciaTarifa.getVigenciatarifaId()); + + if (orgao != null) { + query.setParameter("orgao", orgao); + } + if (empresa != null) { + query.setParameter("empresa", empresa); + } + + int qtd = query.executeUpdate(); + log.info("qtd TarifaTipoptovta apagada = " + qtd); + + query = getSession().createQuery("DELETE FROM TarifaCategoria WHERE tarifa.tarifaId in (" + sb.toString() + ")"); + query.setParameter("vigenciaId", vigenciaTarifa.getVigenciatarifaId()); + if (orgao != null) { + query.setParameter("orgao", orgao); + } + if (empresa != null) { + query.setParameter("empresa", empresa); + } + + qtd = query.executeUpdate(); + log.info("qtd TarifaCategoria apagada = " + qtd); + + query = getSession().createQuery("DELETE FROM Tarifa WHERE activo = 0 and tarifaId in (" + sb.toString() + ")"); + query.setParameter("vigenciaId", vigenciaTarifa.getVigenciatarifaId()); + if (orgao != null) { + query.setParameter("orgao", orgao); + } + if (empresa != null) { + query.setParameter("empresa", empresa); + } + + qtd = query.executeUpdate(); + log.info("qtd Tarifa apagada = " + qtd); + } + + @SuppressWarnings("unchecked") + @Override + public void copiarParaTarifa(VigenciaTarifa vigenciaTarifa, Integer usuarioId, Boolean calculaPegagio, Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP, Boolean calculaEmbarcada, Empresa empresa, OrgaoConcedente orgaoConcedente) { + // Apago antes as tarifas que podem estar como activo =0 + apagarTarifasInativas(vigenciaTarifa, empresa, orgaoConcedente); + + // Insiro as tarifas que não existem + SQLQuery querySQL = getSession().createSQLQuery(sqlBuilder.getSQLInserirTarifaPelaTarifaOficial(vigenciaTarifa.getVigenciatarifaId(), usuarioId, empresa, orgaoConcedente)); + querySQL.executeUpdate(); + // Atualizo o preço e o componente dos preços que já existem + querySQL = getSession().createSQLQuery(sqlBuilder.getSQLSelecionarTarifaPorTarifaOficalParaAtualizar(vigenciaTarifa.getVigenciatarifaId(), empresa, orgaoConcedente)); + querySQL.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP); + List> dados = querySQL.list(); + for (Map dado : dados) { + querySQL = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarTarifaPorTarifaOfical(dado, usuarioId, calculaPegagio, calculaTarifa, calculaTaxaEmbarque, calculaSeguro, calculaTPP)); + querySQL.executeUpdate(); + } + + if (Boolean.TRUE.equals(calculaEmbarcada)) { + copiarParaTarifaEmbarcada(vigenciaTarifa, usuarioId, calculaPegagio, calculaTarifa, calculaTaxaEmbarque, calculaSeguro, calculaTPP, calculaEmbarcada, empresa, orgaoConcedente); + } + } + + @SuppressWarnings("unchecked") + private void copiarParaTarifaEmbarcada(VigenciaTarifa vigenciaTarifa, Integer usuarioId, Boolean calculaPegagio, Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP, Boolean calculaEmbarcada, Empresa empresa, OrgaoConcedente orgaoConcedente) { + // Apago antes as tarifas embarcadas que podem estar como activo =0 + apagarTarifasEmbarcadasInativas(vigenciaTarifa, empresa, orgaoConcedente); + + // Insiro as tarifas embarcadas que não existem + SQLQuery querySQL = getSession().createSQLQuery(sqlBuilder.getSQLInserirTarifaEmbarcadaPelaTarifaOficial(vigenciaTarifa.getVigenciatarifaId(), usuarioId, empresa, orgaoConcedente)); + querySQL.executeUpdate(); + + // Atualizo o preço e o componente dos preços que já existem + querySQL = getSession().createSQLQuery(sqlBuilder.getSQLSelecionarTarifaEmbarcadaPorTarifaOficalParaAtualizar(vigenciaTarifa.getVigenciatarifaId(), empresa, orgaoConcedente)); + querySQL.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP); + + List> dados = querySQL.list(); + + for (Map dado : dados) { + querySQL = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarTarifaEmbarcadaPorTarifaOfical(dado, usuarioId, calculaPegagio, calculaTarifa, calculaTaxaEmbarque, calculaSeguro, calculaTPP)); + querySQL.executeUpdate(); + } + } + + @Override + public void atualizarTaxaEmbarque(List lsRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas) { + + 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 + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getAtualizarTaxaEmbarquePorKmParada(rutaId, usuarioId, orgaoConcedenteId, idsEmpresas)); + query.executeUpdate(); + + // Atualizo a taxa de embarque de acordo a km do orgao + query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarTaxaEmbarquePorKmOrgao(rutaId, usuarioId, orgaoConcedenteId, idsEmpresas)); + query.executeUpdate(); + + // Atualizo a taxa de embarque de acordo a parada e valor fixo + query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarTaxaEmbarquePorParadaFixo(rutaId, usuarioId, orgaoConcedenteId, idsEmpresas)); + query.executeUpdate(); + x--; + } while (x > 0); + } + + @Override + public void atualizarSeguroPorKm(Integer rutaId, Integer orgaoId, Integer usuarioId, TipoSeguro tipoSeguro) { + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarSeguroPorKm(rutaId, usuarioId, orgaoId, tipoSeguro)); + query.executeUpdate(); + } + + @Override + public void atualizarPrecioPorTPP(Integer rutaId, Integer orgaoId, Integer usuarioId, TipoSeguro tipoSeguro) { + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarPrecioPorTPP(rutaId, usuarioId, orgaoId, tipoSeguro)); + query.executeUpdate(); + } + + @Override + public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId, Integer usuarioId) { + SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLAtualizarSeguroPorTarifa(rutaId, usuarioId, orgaoId)); + query.executeUpdate(); + } + + @Override + public long obtenerCount(List lsEmpresaSelected) { + String query = " select count(*) from TarifaOficial "; + if (lsEmpresaSelected != null && !lsEmpresaSelected.isEmpty()) { + query += "WHERE tarifaOficialId IN ( "; + query += " SELECT t.tarifaOficialId FROM TarifaOficial t WHERE t.marca.empresa.empresaId IN ("; + for (Empresa e : lsEmpresaSelected) { + query += e.getEmpresaId() + ","; + } + query = query.substring(0, query.length() - 1); + query += "))"; + } + + long qtd = 0; + Query q = getSession().createQuery(query); + + qtd = (Long) q.list().get(0); + + return qtd; + } + + @Override + public void aplicarArredondamentoTarifa(Integer orgaoConcedenteId, Integer usuarioId, Boolean taxaEmbarque) { + StringBuilder sql = new StringBuilder(); + sql.append(" UPDATE TarifaOficial tao "); + sql.append(" SET tao.precio = FN_ARREDONDAMENTO_TARIFA(tao.precio,tao.orgaoConcedente.orgaoConcedenteId,tao.importeseguro,tao.importetaxaembarque,tao.importepedagio,tao.importeoutros,:txEmbarque), "); + sql.append(" tao.activo = true , "); + sql.append(" tao.fecmodif= CURRENT_TIMESTAMP(), "); + sql.append(" tao.usuarioId =:usuarioId "); + + if (orgaoConcedenteId != null) { + sql.append(" WHERE tao.orgaoConcedente.orgaoConcedenteId = :orgao "); + } + + Query query = getSession().createQuery(sql.toString()); + if (orgaoConcedenteId != null) { + query.setParameter("orgao", orgaoConcedenteId); + } + query.setInteger("txEmbarque", taxaEmbarque ? 1 : 0); + query.setParameter("usuarioId", usuarioId); + query.executeUpdate(); + } + + @Override + @SuppressWarnings("deprecation") + public void atualizarPedagio() { + StringBuilder sql = new StringBuilder(); + + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.ARTESP_PEDAGIO_IDA_VOLTA_DIV_POR2.getDescricao())) { + sql.append(" merge into tarifa_oficial "); + sql.append(" using "); + sql.append(" ( "); + sql.append(" WITH tarifas_ofic as ( "); + sql.append(" select tarifaoficial_id, ORGAOCONCEDENTE_ID, ruta_id , origen_id , DESTINO_ID from tarifa_oficial where activo = 1"); + sql.append(" ), "); + + sql.append(" noArtesp as (select p.destino_id dest, p.origen_id as orig , p.ruta_id as idruta ,p.orgaoconcedente_id as idorgao, "); + sql.append(" p.importepeaje as importe , p.activo as actv from peaje p inner join tarifas_ofic tof on "); + sql.append(" p.ORGAOCONCEDENTE_ID = tof.ORGAOCONCEDENTE_ID and p.ruta_id = tof.ruta_id "); + sql.append(" and p.ORIGEN_ID = tof.ORIGEN_ID and p.DESTINO_ID = tof.DESTINO_ID and p.activo = 1), "); + + sql.append(" linha as ( select * from ruta where ruta_id in (select ruta_id from tarifas_ofic ) ) , "); + sql.append(" linha_voltaId as (select ru.ruta_id rutavolta_id, t_1.ruta_id as ida from ruta ru "); + sql.append(" inner join linha t_1 on ru.prefixo like t_1.prefixo "); + sql.append(" and ru.orgaoconcedente_id = t_1.orgaoconcedente_id "); + sql.append(" and ru.indsentidoIda <> t_1.indsentidoIda "); + sql.append(" and ( (ru.numruta like t_1.numruta) or (ru.numruta like (to_char(to_Number(t_1.numruta)+1))) ) "); + sql.append(" and ru.ruta_id <> t_1.ruta_id "); + sql.append(" and ru.claseservicio_id = t_1.claseservicio_id "); + sql.append(" where ru.activo = 1), "); + + sql.append(" artesp as ( "); + sql.append(" SELECT * "); + sql.append(" FROM peaje p "); + sql.append(" INNER JOIN tarifas_ofic tof "); + sql.append(" ON p.ORGAOCONCEDENTE_ID = tof.ORGAOCONCEDENTE_ID "); + sql.append(" AND p.ruta_id = tof.ruta_id "); + sql.append(" AND p.ORIGEN_ID = tof.ORIGEN_ID "); + sql.append(" AND p.DESTINO_ID = tof.DESTINO_ID "); + sql.append(" AND p.activo = 1 "); + + sql.append(" union "); + + sql.append(" SELECT * "); + sql.append(" FROM peaje p "); + sql.append(" INNER JOIN tarifas_ofic tof "); + sql.append(" ON p.ORGAOCONCEDENTE_ID = tof.ORGAOCONCEDENTE_ID "); + sql.append(" AND p.ruta_id = (select rutavolta_id from linha_voltaId where linha_voltaId.ida = tof.ruta_id) "); + sql.append(" AND p.DESTINO_ID = tof.ORIGEN_ID "); + sql.append(" AND p.ORIGEN_ID = tof.DESTINO_ID "); + sql.append(" AND p.activo = 1 "); + sql.append(" AND p.ruta_id = (select rutavolta_id from linha_voltaId where linha_voltaId.ida = tof.ruta_id) "); + sql.append(" ) , "); + sql.append(" resultado as ( "); + sql.append(" select distinct tof.tarifaoficial_id tarifaoficial_id, tof.ruta_id as ruta, "); + sql.append(" ( case tof.orgaoconcedente_id "); + sql.append(" when 21 then ( select (sum(round(importepeaje,2))/2) from artesp ar where ar.tarifaoficial_id = tof.tarifaoficial_id ) "); + sql.append(" else ( select distinct sum(noar.importe) from noArtesp noar where noar.idorgao = tof.ORGAOCONCEDENTE_ID and noar.idruta = tof.ruta_id "); + sql.append(" and noar.ORIG = tof.ORIGEN_ID and noar.DEST = tof.DESTINO_ID and noar.actv = 1 ) "); + sql.append(" end ) importepeaje from tarifas_ofic tof "); + sql.append(" ), "); + sql.append(" peaje_tarifas as ( select * from resultado ) "); + sql.append(" select pf.tarifaoficial_id , sum(round(importepeaje,2)) as soma from peaje_tarifas pf Group by pf.tarifaoficial_id "); + sql.append(" "); + sql.append(" ) tarifa_importe "); + sql.append(" on (tarifa_oficial.tarifaoficial_id = tarifa_importe.tarifaoficial_id) "); + sql.append(" when matched then "); + sql.append(" update set "); + sql.append(" importepedagio = tarifa_importe.soma "); + } else { + sql.append(" merge into tarifa_oficial "); + sql.append(" using "); + sql.append(" ( "); + sql.append(" WITH tarifas_ofic as ( "); + sql.append(" select tarifaoficial_id, ORGAOCONCEDENTE_ID, ruta_id , origen_id , DESTINO_ID from tarifa_oficial "); + sql.append(" ), "); + sql.append(" peaje_tarifas as ( "); + sql.append(" select * from peaje p inner join tarifas_ofic tof on "); + sql.append(" p.ORGAOCONCEDENTE_ID = tof.ORGAOCONCEDENTE_ID and p.ruta_id = tof.ruta_id "); + sql.append(" and p.ORIGEN_ID = tof.ORIGEN_ID and p.DESTINO_ID = tof.DESTINO_ID and p.activo = 1 "); + sql.append(" ) "); + sql.append(" select pf.tarifaoficial_id , sum(round(importepeaje,2)) as soma from peaje_tarifas pf Group by pf.tarifaoficial_id "); + sql.append(" "); + sql.append(" ) tarifa_importe "); + sql.append(" on (tarifa_oficial.tarifaoficial_id = tarifa_importe.tarifaoficial_id) "); + sql.append(" when matched then "); + sql.append(" update set "); + sql.append(" importepedagio = tarifa_importe.soma "); + } + + Connection conn = getSession().connection(); + Statement stmt; + try { + stmt = conn.createStatement(); + stmt.executeUpdate(sql.toString()); + } catch (SQLException e) { + e.printStackTrace(); + log.error("Erro na atualização do pedágio"); + } + } + + @Override + public List obterTarifaOficialPorFiltroVO(Moneda moneda, Marca marca, List lsMarcas, Parada origem, Parada destino, ClaseServicio claseServicio, Ruta ruta, String numRuta, Boolean vende) { + // TODO Auto-generated method stub + + StringBuilder sql = new StringBuilder(" SELECT "); + sql.append(" t.tarifaoficial_id tarifaoficialid,"); + sql.append(" t.PRECIO precio,"); + sql.append(" t.PRECIOORIGINAL preciooriginal,"); + sql.append(" t.IMPORTEPEDAGIO importepedagio,"); + sql.append(" t.IMPORTETAXAEMBARQUE importetaxaembarque,"); + sql.append(" t.IMPORTESEGURO importeseguro,"); + sql.append(" t.IMPORTETPP importetpp,"); + sql.append(" t.IMPORTEOUTROS importeoutros,"); + sql.append(" origem.DESCPARADA descparadaOrigem,"); + sql.append(" destino.DESCPARADA descparadaDestino,"); + sql.append(" via.NOMBVIA nomeVia,"); + sql.append(" ma.DESCMARCA descMarca,"); + sql.append(" cl.DESCCLASE descclasse,"); + sql.append(" oc.DESCORGAO descorgao,"); + sql.append(" r.prefixo rutaprefixo,"); + sql.append(" r.numruta numruta"); + sql.append(" FROM TARIFA_OFICIAL t"); + sql.append(" LEFT JOIN TRAMO tr on (tr.TRAMO_ID = t.TRAMO_ID)"); + sql.append(" LEFT JOIN ruta r ON ( r.ruta_id = t.ruta_id )"); + sql.append(" LEFT JOIN VIA via on (VIA.VIA_ID=tr.VIA_ID)"); + sql.append(" LEFT JOIN PARADA origem on (origem.PARADA_ID=tr.ORIGEN_ID)"); + sql.append(" LEFT JOIN PARADA destino on (destino.PARADA_ID=tr.DESTINO_ID)"); + sql.append(" LEFT JOIN MARCA ma on (ma.MARCA_ID = t.MARCA_ID)"); + sql.append(" LEFT JOIN CLASE_SERVICIO cl ON (cl.CLASESERVICIO_ID=t.CLASESERVICIO_ID)"); + sql.append(" LEFT JOIN ORGAO_CONCEDENTE oc ON (oc.ORGAOCONCEDENTE_ID=t.ORGAOCONCEDENTE_ID)"); + + if (vende != null) { + sql.append(" LEFT JOIN RUTA_COMBINACION rc on (rc.tramo_id = tr.tramo_id)"); + } + sql.append(" WHERE "); + sql.append(" t.activo=1 "); + if (moneda != null) { + sql.append(" and t.moneda_id=" + moneda.getMonedaId()); + } + if (marca != null) { + sql.append(" and t.marca_id=" + marca.getMarcaId()); + } else { + String stringMarca =" and t.marca_id in ("; + int contador =0; + for(Marca m:lsMarcas){ + if(contador==0){ + stringMarca=stringMarca+m.getMarcaId().toString(); + }else{ + stringMarca=stringMarca+","+m.getMarcaId(); + } + contador++; + if(lsMarcas.size()==contador){ + stringMarca=stringMarca+")"; + } + } + sql.append(stringMarca); + + } + if (ruta != null) { + sql.append(" and t.ruta_id=" + ruta.getRutaId()); + } + if (numRuta != null) { + sql.append(" and r.numruta=" + numRuta); + } + if (origem != null) { + sql.append(" and origem.parada_id=" + origem.getParadaId()); + } + if (destino != null) { + sql.append(" and destino.parada_id=" + destino.getParadaId()); + } + if (claseServicio != null) { + sql.append(" and t.claseservicio_id=" + claseServicio.getClaseservicioId()); + } + + if (vende != null) { + int simNao = vende ? 1 : 0; + sql.append(" and rc.tramo_id=t.tramo_id and rc.ruta_id=t.ruta_id and rc.activo=1 and rc.INDVENTA=" + simNao); + } + + Query qr = getSession().createSQLQuery(sql.toString()).addScalar("tarifaoficialid", Hibernate.INTEGER).addScalar("precio", Hibernate.BIG_DECIMAL).addScalar("preciooriginal", Hibernate.BIG_DECIMAL).addScalar("importepedagio", Hibernate.BIG_DECIMAL).addScalar("importetaxaembarque", Hibernate.BIG_DECIMAL).addScalar("importeseguro", Hibernate.BIG_DECIMAL).addScalar("importetpp", Hibernate.BIG_DECIMAL).addScalar("importeoutros", Hibernate.BIG_DECIMAL).addScalar("descparadaorigem", Hibernate.STRING).addScalar("descparadadestino", Hibernate.STRING).addScalar("nomevia", Hibernate.STRING).addScalar("descmarca", Hibernate.STRING).addScalar("descclasse", Hibernate.STRING).addScalar("descorgao", Hibernate.STRING).addScalar("rutaprefixo", Hibernate.STRING).addScalar("numruta", Hibernate.STRING).setResultTransformer(Transformers.aliasToBean(TarifaOficialVO.class)); + + return (List) qr.list(); + } + + private void apagarTarifasEmbarcadasInativas(VigenciaTarifa vigenciaTarifa, Empresa empresa, OrgaoConcedente orgao) { + StringBuilder sb = new StringBuilder(""); + sb.append("select "); + sb.append(" tar.tarifaembarcadaId "); + sb.append("from "); + sb.append(" TarifaEmbarcada tar,TarifaOficial tao "); + sb.append("where "); + sb.append(" tar.activo=0 "); + sb.append(" and tao.activo = 1 "); + sb.append(" and tar.tramo=tao.tramo "); + sb.append(" and tar.marca=tao.marca "); + sb.append(" and tar.claseServicio =tao.claseServicio "); + sb.append(" and tar.moneda=tao.moneda "); + sb.append(" and tar.orgaoConcedente=tao.orgaoConcedente "); + sb.append(" and tar.ruta=tao.ruta "); + sb.append(" and tar.vigenciaTarifa.vigenciatarifaId = :vigenciaId "); + + if (orgao != null) { + sb.append(" and tar.orgaoConcedente = :orgao "); + } + if (empresa != null) { + sb.append(" and tar.marca.empresa = :empresa "); + } + + Query query = getSession().createQuery("DELETE FROM TarifaEmbarcada WHERE activo = 0 and tarifaembarcadaId in (" + sb.toString() + ")"); + query.setParameter("vigenciaId", vigenciaTarifa.getVigenciatarifaId()); + if (orgao != null) { + query.setParameter("orgao", orgao); + } + if (empresa != null) { + query.setParameter("empresa", empresa); + } + + int qtd = query.executeUpdate(); + log.info("qtd Tarifa Embarcada apagada = " + qtd); + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaTipoptovtaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaTipoptovtaHibernateDAO.java new file mode 100644 index 000000000..f31e20391 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaTipoptovtaHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TarifaTipoptovtaDAO; +import com.rjconsultores.ventaboletos.entidad.TarifaTipoptovta; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("tarifaTipoptovtaDAO") +public class TarifaTipoptovtaHibernateDAO + extends GenericHibernateDAO + implements TarifaTipoptovtaDAO { + + @Autowired + public TarifaTipoptovtaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaCreditoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaCreditoHibernateDAO.java new file mode 100644 index 000000000..6a308e892 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaCreditoHibernateDAO.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TarjetaCreditoDAO; +import com.rjconsultores.ventaboletos.entidad.TarjetaCredito; + +@Repository("tarjetaCreditoDAO") +public class TarjetaCreditoHibernateDAO extends GenericHibernateDAO + implements TarjetaCreditoDAO { + + @Autowired + public TarjetaCreditoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descTarjetaCredito")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaFidelidadHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaFidelidadHibernateDAO.java new file mode 100644 index 000000000..465e0a43d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaFidelidadHibernateDAO.java @@ -0,0 +1,93 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TarjetaFidelidadDAO; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidadCuenta; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.ProjectionList; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("tarjetaFidelidadDAO") +public class TarjetaFidelidadHibernateDAO extends GenericHibernateDAO + implements TarjetaFidelidadDAO { + + @Autowired + public TarjetaFidelidadHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + + return c.list(); + } + + public TarjetaFidelidad obtenerNumTarjeta(Integer numTarjeta){ + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("numTarjeta", numTarjeta)); + return (TarjetaFidelidad)c.list().get(0); + } + + public List obtenerCantDesc() { + + /*Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + ProjectionList projList = Projections.projectionList(); + projList.add(Projections.groupProperty("descGeneracion")); + projList.add(Projections.rowCount()); + c.setProjection(projList); + List list = c.list(); + + List list1 =list; + list.get(0); + list.get(1); //el la descripcion + //list.get( 0 )[1] //el la cantidad + + return list; + + */ + List sumatarjetas = new ArrayList(); + + String hql = "select count(*),descGeneracion" + + " from TarjetaFidelidad where activo = 1 group by descGeneracion"; + + Query qry = getSession().createQuery(hql); + + for (Iterator it = qry.iterate(); it.hasNext();) { + Object[] row = (Object[]) it.next(); + TarjetaFidelidadCuenta item = new TarjetaFidelidadCuenta(); + + item.setDescGeneracion((String) row[1]); + item.setCantidad(HibernateFix.count(row[0]).intValue()); + sumatarjetas.add(item); + } + return sumatarjetas; + + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaRecaudacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaRecaudacionHibernateDAO.java new file mode 100644 index 000000000..70da4125c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaRecaudacionHibernateDAO.java @@ -0,0 +1,39 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TarjetaRecaudacionDAO; +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacion; +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacionPK; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tarjetaRecaudacionDAO") +public class TarjetaRecaudacionHibernateDAO + extends GenericHibernateDAO + implements TarjetaRecaudacionDAO { + + @Autowired + public TarjetaRecaudacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaViajeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaViajeHibernateDAO.java new file mode 100644 index 000000000..4e3d41995 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarjetaViajeHibernateDAO.java @@ -0,0 +1,139 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.zkoss.zul.Comboitem; + +import com.rjconsultores.ventaboletos.dao.TarjetaViajeDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.TarjetaViaje; +import java.util.Calendar; +import java.util.GregorianCalendar; +import org.hibernate.criterion.Order; + +@Repository("tarjetaViajeDAO") +public class TarjetaViajeHibernateDAO extends GenericHibernateDAO implements TarjetaViajeDAO { + + @Autowired + public TarjetaViajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List buscarTarjetaPorFiltros(Integer autoIni, Integer autoFin, Date dataIni, Date dataFin, Comboitem empresa) { + String hql = " select tv from TarjetaViaje tv " + + " where tv.tarjetaviajeId > 0 and activo = 1 "; + StringBuilder sb = new StringBuilder(); + if (autoIni != null && autoFin != null) { + sb.append(" and cast(tv.autobus.numautobus as int) <= ").append(autoFin); + sb.append(" and cast(tv.autobus.numautobus as int) >= ").append(autoIni); + } + if (dataFin != null && dataIni != null) { + sb.append(" and tv.fecHorSalida >= :dataIni"); + sb.append(" and tv.fecHorSalida <= :dataFin"); + } + if (empresa != null) { + Empresa e = (Empresa) empresa.getValue(); + if (e.getEmpresaId() != -1) { + sb.append(" and tv.empresa.empresaId = ").append(e.getEmpresaId()); + } + } + + sb.append(" order by cast(tv.autobus.numautobus as int), tv.fecHorSalida, tv.origen, tv.conductor.conductorId asc "); + + hql += sb.toString(); + + Query sq = getSession().createQuery(hql); + if (dataFin != null && dataIni != null) { + sq.setTimestamp("dataIni", dataIni); + sq.setTimestamp("dataFin", dataFin); + } + List lsTarjetas = sq.list(); + + return lsTarjetas; + } + + @Override + public List buscarTarjetaPorFiltros(TarjetaViaje tarjeta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.or(Restrictions.eq("autobus", tarjeta.getAutobus()), Restrictions.eq("conductor", tarjeta.getConductor()))); + c.add(Restrictions.eq("origen", tarjeta.getOrigen())); + return c.list(); + } + + @Override + public boolean buscarTarjetaExisteVolta(TarjetaViaje tarjeta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.or(Restrictions.eq("autobus", tarjeta.getAutobus()), Restrictions.eq("conductor", tarjeta.getConductor()))); + c.add(Restrictions.ge("fecHorSalida", tarjeta.getFecHorSalida())); + c.add(Restrictions.not(Restrictions.eq("tarjetaviajeId", tarjeta.getTarjetaviajeId()))); + c.addOrder(Order.asc("fecHorSalida")); + + c.setMaxResults(1); + + if (!c.list().isEmpty()) { + + TarjetaViaje tVResult = (TarjetaViaje) c.uniqueResult(); + if (tVResult.getOrigen().equals(tarjeta.getDestino()) + && tVResult.getDestino().equals(tarjeta.getOrigen())) { + return true; + } + } + + Criteria c1 = getSession().createCriteria(getPersistentClass()); + c1.add(Restrictions.eq("activo", true)); + c1.add(Restrictions.or(Restrictions.eq("autobus", tarjeta.getAutobus()), Restrictions.eq("conductor", tarjeta.getConductor()))); + c1.add(Restrictions.le("fecHorSalida", tarjeta.getFecHorSalida())); + c1.add(Restrictions.not(Restrictions.eq("tarjetaviajeId", tarjeta.getTarjetaviajeId()))); + c1.addOrder(Order.desc("fecHorSalida")); + c1.setMaxResults(1); + if (!c1.list().isEmpty()) { + TarjetaViaje tVResult = (TarjetaViaje) c1.uniqueResult(); + if (tVResult.getOrigen().equals(tarjeta.getDestino()) + && tVResult.getDestino().equals(tarjeta.getOrigen())) { + return true; + } + } + + + return false; + } + + @Override + public List buscarTarjetasParaEnvioNomina(Date fecIni, Date fecFin) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", true)); + c.add(Restrictions.isNull("fecenvionomina")); + + GregorianCalendar gAux = new GregorianCalendar(); + gAux.setTime(fecIni); + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(fecIni); + gcalendar.set(Calendar.HOUR_OF_DAY, 0); + gcalendar.set(Calendar.MINUTE, 0); + gcalendar.set(Calendar.SECOND, 0); + gcalendar.set(Calendar.MILLISECOND, 0); + fecIni = gcalendar.getTime(); + + GregorianCalendar gcalendarFim = new GregorianCalendar(); + gcalendarFim.setTime(fecFin); + gcalendarFim.set(Calendar.HOUR_OF_DAY, 23); + gcalendarFim.set(Calendar.MINUTE, 59); + gcalendarFim.set(Calendar.SECOND, 59); + gcalendarFim.set(Calendar.MILLISECOND, 59); + fecFin = gcalendarFim.getTime(); + + c.add(Restrictions.between("fecHorSalida", fecIni, fecFin)); + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbLevanteCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbLevanteCtrlHibernateDAO.java new file mode 100644 index 000000000..b38cba763 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbLevanteCtrlHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.TaxaEmbLevanteCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbLevanteCtrl; + +@Repository("taxaEmbLevanteCtrlDAO") +public class TaxaEmbLevanteCtrlHibernateDAO extends GenericHibernateDAO + implements TaxaEmbLevanteCtrlDAO { + + @Autowired + public TaxaEmbLevanteCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueKmHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueKmHibernateDAO.java new file mode 100644 index 000000000..dd603f4f3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueKmHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TaxaEmbarqueKmDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueKm; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Desenvolvimento + */ +@Repository("taxaEmbarqueKmDAO") +public class TaxaEmbarqueKmHibernateDAO extends GenericHibernateDAO + implements TaxaEmbarqueKmDAO { + + @Autowired + public TaxaEmbarqueKmHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarPorOrgao(OrgaoConcedente orgaoconcedenteId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("orgaoconcedenteId", orgaoconcedenteId)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueParadaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueParadaHibernateDAO.java new file mode 100644 index 000000000..10ed8b613 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TaxaEmbarqueParadaHibernateDAO.java @@ -0,0 +1,108 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TaxaEmbarqueParadaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.TaxaEmbarqueW2i; +import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement; + +/** + * + * @author Desenvolvimento + */ +@Repository("taxaEmbarqueParadaDAO") +public class TaxaEmbarqueParadaHibernateDAO extends GenericHibernateDAO + implements TaxaEmbarqueParadaDAO { + + @Autowired + public TaxaEmbarqueParadaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarPorLocalidade(Parada parada) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("paradaId", parada)); + + return c.list(); + } + + public List buscarEstoqueTaxaEmbarque(Parada origem, Empresa empresa, String txtKm, OrgaoConcedente orgao, Categoria categoria) throws SQLException { + List listaEstoqueAux = new ArrayList(); + + StringBuilder sql = new StringBuilder(); + + sql.append(" SELECT "); + sql.append(" C.TAXPOLC_ID taxpolc_id, EMP.NOMBEMPRESA nomeEmpresa, COALESCE(CS.DESCCATEGORIA, 'TODAS') categoria, P.cveParada, OC.DESCORGAO orgaoConcedente, C.KM km, "); + sql.append(" (SELECT COUNT(*) FROM TAXPOL E WHERE E.ACTIVO = 1 AND E.TAXPOLC_ID = C.TAXPOLC_ID ) quantidadeEstoque "); + sql.append(" FROM "); + sql.append(" TAXPOLC C INNER JOIN "); + sql.append(" EMPRESA EMP ON C.EMPRESA_ID = EMP.EMPRESA_ID INNER JOIN "); + sql.append(" PARADA P ON C.LOCALIDADE_ID = P.PARADA_ID LEFT JOIN "); + sql.append(" CATEGORIA CS ON C.CATEGORIA_ID = CS.CATEGORIA_ID INNER JOIN "); + sql.append(" ORGAO_CONCEDENTE OC ON C.ORGAOCONCEDENTE_ID = OC.ORGAOCONCEDENTE_ID "); + sql.append(" WHERE "); + sql.append(" C.ACTIVO = 1 AND "); + + if(empresa != null) { + sql.append(" C.EMPRESA_ID = ").append(empresa.getEmpresaId()).append(" AND "); + } + + if(StringUtils.isNotBlank(txtKm)) { + sql.append(" C.KM >= ").append(txtKm).append(" AND "); + } + + if(categoria != null) { + sql.append(" (C.CATEGORIA_ID = ").append(categoria.getCategoriaId()).append(" OR C.CATEGORIA_ID IS NULL) AND "); + } + + if(orgao != null) { + sql.append(" C.ORGAOCONCEDENTE_ID = ").append(orgao.getOrgaoConcedenteId()).append(" AND "); + } + + sql.append(" C.LOCALIDADE_ID = ").append(origem.getParadaId()); + + sql.append(" ORDER BY "); + sql.append(" C.TAXPOLC_ID "); + + NamedParameterStatement stmt = new NamedParameterStatement(getSession().connection(), sql.toString()); + ResultSet rset = stmt.executeQuery(); + + while (rset.next()) { + TaxaEmbarqueW2i taxa = new TaxaEmbarqueW2i(); + + taxa.setTaxpolc_id(rset.getLong("taxpolc_id")); + taxa.setNomeEmpresa( rset.getString("nomeEmpresa")); + taxa.setCategoria(rset.getString("categoria")); + taxa.setCveParada(rset.getString("cveParada")); + taxa.setOrgaoConcedente(rset.getString("orgaoConcedente")); + taxa.setKm(rset.getLong("km")); + taxa.setQuantidadeEstoque(rset.getLong("quantidadeEstoque")); + + listaEstoqueAux.add(taxa); + } + + return listaEstoqueAux; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCiudadHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCiudadHibernateDAO.java new file mode 100644 index 000000000..f639f60fa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCiudadHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoCambioCiudadDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCambioCiudad; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoCambioCiudadDAO") +public class TipoCambioCiudadHibernateDAO extends GenericHibernateDAO + implements TipoCambioCiudadDAO { + + @Autowired + public TipoCambioCiudadHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCtrlHibernateDAO.java new file mode 100644 index 000000000..5ab521926 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCambioCtrlHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoCambioCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCambioCtrl; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoCambioCtrlDAO") +public class TipoCambioCtrlHibernateDAO extends GenericHibernateDAO + implements TipoCambioCtrlDAO { + + @Autowired + public TipoCambioCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoConvenioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoConvenioHibernateDAO.java new file mode 100644 index 000000000..a5cc27361 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoConvenioHibernateDAO.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; +import java.io.Serializable; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("tipoConvenioDAO") +public class TipoConvenioHibernateDAO extends GenericHibernateDAO + implements TipoConvenioDAO { + + @Autowired + public TipoConvenioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCorteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCorteHibernateDAO.java new file mode 100644 index 000000000..947525aff --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCorteHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoCorteDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCorte; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoCorteDAO") +public class TipoCorteHibernateDAO extends GenericHibernateDAO + implements TipoCorteDAO { + + @Autowired + public TipoCorteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String desctipo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("desctipo", desctipo)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaDescuentoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaDescuentoHibernateDAO.java new file mode 100644 index 000000000..c71a25a2e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaDescuentoHibernateDAO.java @@ -0,0 +1,83 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoCortesiaDescuentoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import com.rjconsultores.ventaboletos.entidad.TipoCortesiaDescuento; +import java.math.BigDecimal; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Shiro + */ +@Repository("tipoCortesiaDescuentoDAO") +public class TipoCortesiaDescuentoHibernateDAO + extends GenericHibernateDAO + implements TipoCortesiaDescuentoDAO { + + @Autowired + public TipoCortesiaDescuentoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List pesquisar(TipoCortesia tipoCortesia) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (tipoCortesia != null) { + c.add(Restrictions.eq("tipoCortesia", tipoCortesia)); + } + return c.list(); + } + + public List Onchangue(TipoCortesia tp) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + + if (tp != null) { + c.add(Restrictions.eq("tipoCortesia", tp)); + } + return c.list(); + } + + public List buscar(BigDecimal porcentaje, + TipoCortesia tipoCortesia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("porcdescuento", porcentaje)); + c.add(Restrictions.eq("tipoCortesia", tipoCortesia)); + + return c.list(); + } + + public List obtenerTipoCortesia(int i) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tipoCortesia.tipocortesiaId", new Integer(i).shortValue())); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaHibernateDAO.java new file mode 100644 index 000000000..9b42023b1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoCortesiaHibernateDAO.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoCortesiaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("tipoCortesiaDAO") +public class TipoCortesiaHibernateDAO extends GenericHibernateDAO + implements TipoCortesiaDAO { + + @Autowired + public TipoCortesiaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String descTipo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desctipo", descTipo)); + + return c.list(); + } + + public List obtenerGrupoCortesia(int i) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("grupoCortesia.grupocortesiaId", new Integer(i).shortValue())); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDocAutobusHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDocAutobusHibernateDAO.java new file mode 100644 index 000000000..bbe99aa63 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDocAutobusHibernateDAO.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.TipoDocAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.TipoDocAutobus; + +@Repository("tipoDocAutobusDAO") +public class TipoDocAutobusHibernateDAO extends GenericHibernateDAO +implements TipoDocAutobusDAO { + @Autowired + public TipoDocAutobusHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDomicilioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDomicilioHibernateDAO.java new file mode 100644 index 000000000..c73b57929 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoDomicilioHibernateDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoDomicilioDAO; +import com.rjconsultores.ventaboletos.entidad.TipoDomicilio; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoDomicilioDAO") +public class TipoDomicilioHibernateDAO extends GenericHibernateDAO + implements TipoDomicilioDAO { + + @Autowired + public TipoDomicilioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String desctipo, String cvetipodomicilio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("desctipo", desctipo)); + c.add(Restrictions.eq("cvetipodomicilio", cvetipodomicilio)); + + return c.list(); + } + + public List buscarClave(String cvetipodomicilio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("cvetipodomicilio", cvetipodomicilio)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEmpleadoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEmpleadoHibernateDAO.java new file mode 100644 index 000000000..955acce24 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEmpleadoHibernateDAO.java @@ -0,0 +1,42 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoEmpleadoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEmpleado; + +/** + * + * @author Shiro + */ +@Repository("tipoEmpleadoDAO") +public class TipoEmpleadoHibernateDAO extends GenericHibernateDAO +implements TipoEmpleadoDAO{ + + + @Autowired + public TipoEmpleadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraEmpresaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraEmpresaHibernateDAO.java new file mode 100644 index 000000000..1289b8ea0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraEmpresaHibernateDAO.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoEventoExtraEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraEmpresa; + +@Repository("tipoEventoExtraEmpresaDAO") +public class TipoEventoExtraEmpresaHibernateDAO extends GenericHibernateDAO implements +TipoEventoExtraEmpresaDAO { + + @Autowired + public TipoEventoExtraEmpresaHibernateDAO ( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + + return c.list(); + } + + @Override + public List buscarPorTipoEventoExtra(TipoEventoExtra tipoeventoextra) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("tipoeventoextra", tipoeventoextra)); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraHibernateDAO.java new file mode 100644 index 000000000..77e46726c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoEventoExtraDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; + +@Repository("tipoEventoExtraDAO") +public class TipoEventoExtraHibernateDAO extends + GenericHibernateDAO implements + TipoEventoExtraDAO { + + @Autowired + public TipoEventoExtraHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscar(String nombIngreso) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descTipoEvento", nombIngreso)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraPtovtaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraPtovtaHibernateDAO.java new file mode 100644 index 000000000..69e2705e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoEventoExtraPtovtaHibernateDAO.java @@ -0,0 +1,31 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +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.TipoEventoExtraPtovtaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraPtoVta; + +@Repository("tipoEventoExtraPtovtaDAO") +public class TipoEventoExtraPtovtaHibernateDAO extends GenericHibernateDAO implements +TipoEventoExtraPtovtaDAO { + + @Autowired + public TipoEventoExtraPtovtaHibernateDAO ( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoIdentificacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoIdentificacionHibernateDAO.java new file mode 100644 index 000000000..35a623e9b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoIdentificacionHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.TipoIdentificacionDAO; +import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion; + +@Repository("tipoIdentificacionDAO") +public class TipoIdentificacionHibernateDAO extends GenericHibernateDAO implements TipoIdentificacionDAO { + + @Autowired + public TipoIdentificacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoInformativoComissaoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoInformativoComissaoHibernateDAO.java new file mode 100644 index 000000000..1fd92f6c2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoInformativoComissaoHibernateDAO.java @@ -0,0 +1,45 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoInformativoComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoInformativoComissao; + +@Repository("tipoInformativoComissaoDAO") +public class TipoInformativoComissaoHibernateDAO extends GenericHibernateDAO + implements TipoInformativoComissaoDAO { + + @Autowired + public TipoInformativoComissaoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public Boolean existeTipoInformativo(TipoInformativoComissao tipo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("desctipo", tipo.getDesctipo())); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (tipo.getTipoinformativoId() != null) { + c.add(Restrictions.ne("tipoinformativoId", tipo.getTipoinformativoId())); + } + + return c.list().isEmpty(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimentacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimentacionHibernateDAO.java new file mode 100644 index 000000000..b7a093d7a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimentacionHibernateDAO.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoMovimentacionDAO; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +@Repository("tipoMovimentacionDAO") +public class TipoMovimentacionHibernateDAO extends GenericHibernateDAO implements TipoMovimentacionDAO { + + @Autowired + public TipoMovimentacionHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + @Override + public TipoMovimentacion buscarTipoMovimentacio(int tipoMovimentacion) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tipomovimentacionId", tipoMovimentacion)); + + return (TipoMovimentacion) c.uniqueResult(); + + } + + @Override + public List obtenerTiposMovimetacionPuntoVenta() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.in("tipomovimentacionId", new Integer[]{TipoMovimentacion.TIPO_ENVIO, TipoMovimentacion.TIPO_TRANSFERENCIA, TipoMovimentacion.TIPO_VOLVER})); + + return c.list(); + } + + + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimientoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimientoHibernateDAO.java new file mode 100644 index 000000000..29851bd86 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimientoHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoMovimientoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoMovimiento; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoMovimientoDAO") +public class TipoMovimientoHibernateDAO extends GenericHibernateDAO + implements TipoMovimientoDAO { + + @Autowired + public TipoMovimientoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String descmovimiento) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descmovimiento", descmovimiento)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoOcupacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoOcupacionHibernateDAO.java new file mode 100644 index 000000000..c7e47be47 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoOcupacionHibernateDAO.java @@ -0,0 +1,56 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoOcupacionDAO; +import com.rjconsultores.ventaboletos.entidad.TipoOcupacion; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoOcupacionDAO") +public class TipoOcupacionHibernateDAO extends GenericHibernateDAO + implements TipoOcupacionDAO { + + @Autowired + public TipoOcupacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String desctipo, String cvetipoocupacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("desctipo", desctipo)); + c.add(Restrictions.eq("cvetipoocupacion", cvetipoocupacion)); + + return c.list(); + } + + public List buscarClave(String cvetipoocupacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("cvetipoocupacion", cvetipoocupacion)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoParadaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoParadaHibernateDAO.java new file mode 100644 index 000000000..4204f6f44 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoParadaHibernateDAO.java @@ -0,0 +1,47 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoParadaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoParada; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoParadaDAO") +public class TipoParadaHibernateDAO extends GenericHibernateDAO + implements TipoParadaDAO { + + @Autowired + public TipoParadaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctipo")); + + return c.list(); + } + + public List buscar(String desctipo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desctipo", desctipo)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoPuntoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoPuntoVentaHibernateDAO.java new file mode 100644 index 000000000..cd0468577 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoPuntoVentaHibernateDAO.java @@ -0,0 +1,58 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tipoPuntoVentaDAO") +public class TipoPuntoVentaHibernateDAO extends GenericHibernateDAO implements TipoPuntoVentaDAO { + + @Autowired + public TipoPuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctipo")); + + return c.list(); + } + + public List buscar(String desctipo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desctipo", desctipo)); + + return c.list(); + } + + @Override + public List obtenerTodosExceto(Short... id) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctipo")); + c.add(Restrictions.not(Restrictions.in("tipoptovtaId", id))); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoServicioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoServicioHibernateDAO.java new file mode 100644 index 000000000..47241307f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoServicioHibernateDAO.java @@ -0,0 +1,59 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.TipoServicio; + +/** + * + * @author Rafius + */ +@SuppressWarnings("unchecked") +@Repository("tipoServicioDAO") +public class TipoServicioHibernateDAO extends GenericHibernateDAO + implements TipoServicioDAO { + + @Autowired + public TipoServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("descservicio")); + + return c.list(); + } + + public List buscar(String descservicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("descservicio", descservicio)); + + return c.list(); + } + + @Override + public List buscarListaPorIds(List tiposervicioIds) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.in("tiposervicioId", tiposervicioIds)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoTarifaPacoteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoTarifaPacoteHibernateDAO.java new file mode 100644 index 000000000..1a67293f1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoTarifaPacoteHibernateDAO.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoTarifaPacoteDAO; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +@Repository("tipoTarifaPacoteDAO") +public class TipoTarifaPacoteHibernateDAO extends GenericHibernateDAO + implements TipoTarifaPacoteDAO { + + @Autowired + public TipoTarifaPacoteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctipotarifa")); + + return c.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscaTipoTarifaPacote(Pacote pacote) { + + StringBuilder sb = new StringBuilder(); + sb.append(" select pt.tipoTarifaPacote "); + sb.append(" from PacoteTarifa pt "); + sb.append(" where pt.pacote.pacoteId = :pacoteId "); + sb.append(" and pt.activo = 1 "); + + Query query = getSession().createQuery(sb.toString()); + query.setInteger("pacoteId", pacote.getPacoteId()); + + return query.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoVentaHibernateDAO.java new file mode 100644 index 000000000..06fe38964 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoVentaHibernateDAO.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TipoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoVenta; +import com.rjconsultores.ventaboletos.vo.segurida.PerfilJerarquia; + +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("tipoVentaDAO") +public class TipoVentaHibernateDAO extends GenericHibernateDAO + implements TipoVentaDAO { + + @Autowired + public TipoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctipoventa")); + + return c.list(); + } + + public List buscar(String desctipoventa) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("desctipoventa", desctipoventa)); + + return c.list(); + } + + public TipoVenta obtenerID(Short tipoventaId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.add(Restrictions.eq("tipoventaId", tipoventaId)); + + return (TipoVenta) c.uniqueResult(); + } + + @SuppressWarnings("unchecked") + public List obterTiposVentaIntegracao() { + StringBuilder sb = new StringBuilder(); + sb.append(" from TipoVenta x "); + sb.append(" where x.activo = 1 and x.tipoventaId in (1,12,99)"); + sb.append(" order by x.desctipoventa "); + + Query query = getSession().createQuery(sb.toString()); + + return query.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoHibernateDAO.java new file mode 100644 index 000000000..9b8d74fd6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoHibernateDAO.java @@ -0,0 +1,288 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.FetchMode; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.Transformers; +import org.hibernate.type.BigDecimalType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.OrgaoTramo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.vo.tramo.TramoVO; + +/** + * + * @author Administrador + */ +@SuppressWarnings("unchecked") +@Repository("tramoDAO") +public class TramoHibernateDAO extends GenericHibernateDAO + implements TramoDAO { + + @Autowired + public TramoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctramo")); + + return c.list(); + } + + public List obtenerTramosServiciosPorTramo(Tramo t){ + return obtenerID(t.getTramoId()).getTramoServicioList(); + } + + public Tramo obtenerPorOrigemDestino(Parada origem, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + Tramo t = new Tramo(); + if (c.list().size() > 0) { + t = (Tramo) c.list().get(0); + } + + return t; + } + + public Tramo obtenerTramotPorOrigemDestinoVia(Parada origem, Parada destino, Via via) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("via", via)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (Tramo) c.uniqueResult(); + } + + public List obtenerListPorOrigemDestino(Parada origem, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctramo")); + + return c.list(); + } + + public List obtenerPorOrigemDestinoFetchLazy(Parada origem, Parada destino) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctramo")); + + c.setFetchMode("origem", FetchMode.SELECT); + c.setFetchMode("destino", FetchMode.SELECT); + c.setFetchMode("lsTramoTiempo", FetchMode.SELECT); + c.setFetchMode("rutaSecuenciaList", FetchMode.SELECT); + c.setFetchMode("rutaCombinacionList", FetchMode.SELECT); + c.setFetchMode("tramoServicioList", FetchMode.SELECT); + c.setFetchMode("tramoKms", FetchMode.SELECT); + + return c.list(); + } + + // Obtener Vias Possiveis + public List obtenerViasOrigemDestino(Parada origem, Parada destino) { + Criteria c = makeCriteria(); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("desctramo")); + + c.setProjection(Projections.property("via")); + + return c.list(); + } + + public Tramo busca(Parada origem, Parada destino, Via via) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("via", via)); + + return (Tramo) c.uniqueResult(); + } + + public List buscarCveParada(String origen, String destino, String via) { + Criteria c = getSession().createCriteria(getPersistentClass()); + + c.createCriteria("origem").add(Restrictions.eq("paradaId", Integer.parseInt(origen))); + c.createCriteria("destino").add(Restrictions.eq("paradaId", Integer.parseInt(destino))); + c.createCriteria("via").add(Restrictions.eq("viaId", Integer.parseInt(via))); + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public Tramo obtenerTramoUnicoRuta(Parada origem, Parada destino, Via via, + ClaseServicio claseServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("origem", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("via", via)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.setFetchMode("origem", FetchMode.SELECT); + c.setFetchMode("destino", FetchMode.SELECT); + c.setFetchMode("lsTramoTiempo", FetchMode.SELECT); + c.setFetchMode("rutaSecuenciaList", FetchMode.SELECT); + c.setFetchMode("rutaCombinacionList", FetchMode.SELECT); + c.setFetchMode("tramoServicioList", FetchMode.SELECT); + c.setFetchMode("tramoKms", FetchMode.SELECT); + + Criteria c2 = c.createCriteria("tramoServicioList"); + c2.add(Restrictions.eq("claseServicio", claseServicio)); + c2.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.setMaxResults(1); + List result = c.list(); + + if (result.isEmpty()) { + return null; + } + + return result.get(0); + } + + public Long count(Via via) { + Criteria c = this.makeCriteria(); + + c.add(Restrictions.eq("via", via)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.setProjection(Projections.rowCount()); + + return HibernateFix.count(c.list()); + } + + public List getLsOrgaoTramo(Tramo tramo){ + return obtenerID(tramo.getTramoId()).getLsOrgaoTramo(); + } + + @Override + public List buscarListaPorIds(List tramoIds) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.in("tramoId", tramoIds)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscarListaPorIds(List tramoIds, String chaveCorrida, boolean tarifaEmbarcada ) throws Exception { + StringBuilder sql = new StringBuilder(); + + sql.append(" SELECT "); + sql.append(" trm.tramo_id AS tramoid, "); + sql.append(" trm.desctramo AS desctramo, "); + sql.append(" trm.origen_id AS origemId, "); + sql.append(" trm.destino_id AS destinoId, "); + sql.append(" ta.moneda_id AS monedaId, "); + sql.append(" coalesce(ta.importetaxaembarque, 0) AS valorTaxa, "); + sql.append(" coalesce(ta.importepedagio, 0) AS valorPedagio, "); + sql.append(" coalesce(ta.importeoutros, 0) AS valorOutros, "); + sql.append(" coalesce(ta.importeseguro, 0) AS valorSeguro, "); + sql.append(" coalesce(ta.precio, 0) AS valorTarifa, "); + sql.append(" 0 AS tarifaMinima, "); + sql.append(" emp.empresa_id AS empresaId "); + sql.append(" FROM "); + sql.append(" ruta_combinacion rc "); + sql.append(" JOIN tramo trm ON trm.tramo_id = rc.tramo_id AND trm.activo = 1 "); + sql.append(" JOIN corrida_tramo crt ON crt.destino_id = trm.destino_id "); + sql.append(" AND crt.corrida_id = :corridaId "); + sql.append(" AND crt.feccorrida = to_date(:fecCorrida,'ddMMyyyy') "); + sql.append(" AND crt.activo = 1 "); + sql.append(" JOIN corrida co ON co.corrida_id = crt.corrida_id "); + sql.append(" AND crt.feccorrida = co.feccorrida "); + sql.append(" and rc.ruta_id = co.ruta_id "); + sql.append(" JOIN empresa emp ON emp.empresa_id = co.empresacorrida_id "); + sql.append(" JOIN marca mar ON mar.empresa_id = emp.empresa_id AND mar.activo = 1 "); + if (tarifaEmbarcada) { + sql.append(" JOIN TARIFA_EMBARCADA ta ON ta.marca_id = mar.marca_id "); + sql.append(" AND ta.tramo_id = trm.tramo_id "); + sql.append(" AND ta.ruta_id = rc.ruta_id "); + sql.append(" AND ta.activo = 1 "); + } else { + sql.append(" JOIN tarifa ta ON ta.marca_id = mar.marca_id "); + sql.append(" AND ta.tramo_id = trm.tramo_id "); + sql.append(" AND ta.ruta_id = rc.ruta_id "); + sql.append(" AND ta.activo = 1 "); + } + sql.append(" JOIN vigencia_tarifa vt ON vt.vigenciatarifa_id = ta.vigenciatarifa_id AND vt.activo = 1 "); + sql.append(" AND sysdate BETWEEN vt.feciniciovigencia AND vt.fecfinvigencia "); + sql.append(" WHERE "); + sql.append(" rc.activo = 1 "); + sql.append(" AND coalesce(rc.indventa, 0) = 1 "); + sql.append(" AND trm.origen_id IN ( "); + sql.append(" SELECT x.origen_id "); + sql.append(" FROM corrida_tramo x "); + sql.append(" WHERE x.corrida_id = co.corrida_id "); + sql.append(" AND x.feccorrida = co.feccorrida "); + sql.append(" ) "); + sql.append(" AND trm.destino_id IN ( "); + sql.append(" SELECT x.destino_id "); + sql.append(" FROM corrida_tramo x "); + sql.append(" WHERE x.corrida_id = co.corrida_id "); + sql.append(" AND x.feccorrida = co.feccorrida "); + sql.append(" ) "); + sql.append(" and trm.tramo_id in ( :tramoIds ) "); + sql.append(" ORDER BY crt.numsecuencia "); + + Query query = getSession().createSQLQuery(sql.toString()) + .addScalar("tramoId", IntegerType.INSTANCE) + .addScalar("desctramo", StringType.INSTANCE) + .addScalar("origemId", IntegerType.INSTANCE) + .addScalar("destinoId", IntegerType.INSTANCE) + .addScalar("monedaId", IntegerType.INSTANCE) + .addScalar("valorTaxa", BigDecimalType.INSTANCE) + .addScalar("valorPedagio", BigDecimalType.INSTANCE) + .addScalar("valorOutros", BigDecimalType.INSTANCE) + .addScalar("valorSeguro", BigDecimalType.INSTANCE) + .addScalar("valorTarifa", BigDecimalType.INSTANCE) + .addScalar("tarifaMinima", BigDecimalType.INSTANCE) + .addScalar("empresaId", IntegerType.INSTANCE) + + .setResultTransformer(Transformers.aliasToBean(TramoVO.class)); + + String[] split = chaveCorrida.split(";"); + String corridaId = split[0].trim(); + String fecha = split[1].trim(); + + query.setParameter("corridaId", Integer.parseInt(corridaId) ); + query.setString("fecCorrida", fecha); + query.setParameterList("tramoIds", tramoIds); + + return query.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoKmServicioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoKmServicioHibernateDAO.java new file mode 100644 index 000000000..8d2ad8483 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoKmServicioHibernateDAO.java @@ -0,0 +1,44 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TramoKmServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoKmServicio; +import com.rjconsultores.ventaboletos.entidad.Via; + +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("tramoKmServicioDAO") +public class TramoKmServicioHibernateDAO extends GenericHibernateDAO + implements TramoKmServicioDAO { + + @Autowired + public TramoKmServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscar(TramoKmServicio tramoKmServicio) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tramo", tramoKmServicio.getTramo())); + c.add(Restrictions.eq("claseServicio", tramoKmServicio.getClaseServicio())); + c.add(Restrictions.eq("empresa", tramoKmServicio.getEmpresa())); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoServicioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoServicioHibernateDAO.java new file mode 100644 index 000000000..eedbf39e1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoServicioHibernateDAO.java @@ -0,0 +1,162 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TramoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.Via; + +/** + * + * @author Rafius + */ +@SuppressWarnings("unchecked") +@Repository("tramoServicioDAO") +public class TramoServicioHibernateDAO extends GenericHibernateDAO + implements TramoServicioDAO { + + private static Logger log = Logger.getLogger(TramoServicioHibernateDAO.class); + + @Autowired + public TramoServicioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + + @Override + public TramoServicio suscribir(TramoServicio entity) { + + log.info(String.format("suscribir TramoServicio: %s " , entity.toStringComplete())); + + return super.suscribir(entity); + } + + public List buscarPorTramo(Tramo tramo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tramo", tramo)); + + return c.list(); + } + + public List buscarPorTramo(Tramo tramo, ClaseServicio clase) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("claseServicio", clase)); + + return c.list(); + } + + @Override + public TramoServicio buscar(Parada origen, Parada destino, Via via, ClaseServicio clase) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + Criteria cTramo = c.createCriteria("tramo"); + cTramo.add(Restrictions.eq("origem", origen)); + cTramo.add(Restrictions.eq("destino", destino)); + cTramo.add(Restrictions.eq("via", via)); + cTramo.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("claseServicio", clase)); + + /** + * FIXME: O trecho de código abaixo foi adicionado para tentar identificar um problema de duplicidade no + * tramoServicio. + * + * Deve ser temporario. + */ + + List list = c.list(); + if (list.size() > 1){ + + for(TramoServicio ts : list){ + log.error(String.format("Erro tramoServicio duplicado:%s", ts.toStringComplete() )); + } + + } + + return list.isEmpty()?null:list.get(0); + + } + + @Override + public boolean existenTiemposTramosEsquema(Integer esquemaCorridaId) { + + Query query = getSession().createQuery("select count(*) from EsquemaTramo ct where ct.activo = 1 and ct.esquemaCorrida.esquemacorridaId = :esquemaCorrida"); + query.setParameter("esquemaCorrida", esquemaCorridaId); + Long cantTramos = HibernateFix.count(query.uniqueResult()); + + StringBuilder sb = new StringBuilder(""); + sb.append("select count(*) "); + sb.append("from "); + sb.append("esquema_corrida ec "); + sb.append("inner join esquema_tramo et on et.esquemacorrida_id = ec.esquemacorrida_id "); + sb.append("inner join tramo_servicio ts on ts.tramo_id = et.tramo_id and ts.CLASESERVICIO_ID = ec.CLASESERVICIO_ID "); + sb.append("where "); + sb.append("et.activo = 1 "); + sb.append("and ts.activo = 1 "); + sb.append("and ec.esquemacorrida_id = :esquemaCorrida"); + + Query query2 = getSession().createSQLQuery(sb.toString()); + query2.setParameter("esquemaCorrida", esquemaCorridaId); + + Long cantTramosTiempos = HibernateFix.count(query2.uniqueResult()); + + return cantTramos.equals(cantTramosTiempos); + } + + @Override + @Transactional + public void limparInconsistenciasTramo() { + + StringBuilder sql = new StringBuilder(500); + sql.append("update "); + sql.append(" tramo_servicio set activo = 0 "); + sql.append("WHERE "); + sql.append(" rowid in ( select rid from ( "); + sql.append(" select rowid rid,row_number() "); + sql.append(" over (partition by CLASESERVICIO_ID,TRAMO_ID order by rowid) rn "); + sql.append(" from tramo_servicio "); + sql.append(" where activo = 1) "); + sql.append(" where rn <> 1 ) "); + sql.append(" and activo =1 "); + Query query = getSession().createSQLQuery(sql.toString()); + int tramoServicoAtualizado = query.executeUpdate(); + log.info(" Rotina limparInconsistenciasTramo: "+tramoServicoAtualizado+" TramoServicio atualizados" ); + + sql = new StringBuilder(500); + sql.append("update "); + sql.append(" orgao_tramo set activo = 0 "); + sql.append("WHERE "); + sql.append(" rowid in ( select rid from ( "); + sql.append(" select rowid rid,row_number() "); + sql.append(" over (partition by CLASESERVICIO_ID,ORGAOCONCEDENTE_ID,TRAMO_ID order by rowid) rn "); + sql.append(" from orgao_tramo "); + sql.append(" where activo = 1) "); + sql.append(" where rn <> 1 ) "); + sql.append(" and activo =1 "); + + Query query2 = getSession().createSQLQuery(sql.toString()); + int orgaoTramoAtualizado = query2.executeUpdate(); + log.info(" Rotina limparInconsistenciasTramo: "+orgaoTramoAtualizado+" OrgaoTramo atualizados" ); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoTiempoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoTiempoHibernateDAO.java new file mode 100644 index 000000000..45d7dad92 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TramoTiempoHibernateDAO.java @@ -0,0 +1,95 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TramoTiempoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoTiempo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("tramoTiempoDAO") +public class TramoTiempoHibernateDAO extends GenericHibernateDAO implements TramoTiempoDAO { + + @Autowired + public TramoTiempoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscarPorTramo(Tramo tramo) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tramo", tramo)); + + return c.list(); + } + + public List buscarPorTramo(Tramo tramo, ClaseServicio clase) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("claseServicio", clase)); + + return c.list(); + } + + @Override + public List buscar(Tramo tramo, ClaseServicio clase, Date horaIni, Date horaFin) { + + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tramo", tramo)); + c.add(Restrictions.eq("claseServicio", clase)); + + Calendar tmpIni = Calendar.getInstance(); + tmpIni.setTime(horaIni); + + Calendar tmpFin = Calendar.getInstance(); + tmpFin.setTime(horaFin); + + Calendar fecInicio = DateUtil.getFecInicio(); + fecInicio.set(Calendar.HOUR_OF_DAY, tmpIni.get(Calendar.HOUR_OF_DAY)); + fecInicio.set(Calendar.MINUTE, tmpIni.get(Calendar.MINUTE)); + + Calendar fecFin = DateUtil.getFecInicio(); + fecFin.set(Calendar.HOUR_OF_DAY, tmpFin.get(Calendar.HOUR_OF_DAY)); + fecFin.set(Calendar.MINUTE, tmpFin.get(Calendar.MINUTE)); + + if (fecFin.compareTo(fecInicio) < 0){// se a data fin é menor que a data inicio (considerando a hora), é porque é no dia seguinte. Ex.: Intervalo 23:00 à 00:00 + fecFin.add(Calendar.DATE, 1); + } + + c.add(Restrictions.ge("horafin",fecInicio.getTime())); + c.add(Restrictions.le("horainicio",fecFin.getTime())); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TurnoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TurnoHibernateDAO.java new file mode 100644 index 000000000..bdfb2260c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TurnoHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.TurnoDAO; +import com.rjconsultores.ventaboletos.entidad.Turno; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("turnoDAO") +public class TurnoHibernateDAO extends GenericHibernateDAO + implements TurnoDAO { + + @Autowired + public TurnoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List buscar(String descturno) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("descturno", descturno)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioBancarioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioBancarioHibernateDAO.java new file mode 100644 index 000000000..c78fee960 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioBancarioHibernateDAO.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.UsuarioBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.UsuarioBancario; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("usuarioBancarioDAO") +public class UsuarioBancarioHibernateDAO extends GenericHibernateDAO + implements UsuarioBancarioDAO { + + @Autowired + public UsuarioBancarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioEmpresaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioEmpresaHibernateDAO.java new file mode 100644 index 000000000..06e103edb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioEmpresaHibernateDAO.java @@ -0,0 +1,75 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.ArrayList; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.UsuarioEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa; + + +@Repository("usuarioEmpresaDAO") +public class UsuarioEmpresaHibernateDAO extends GenericHibernateDAO + implements UsuarioEmpresaDAO { + + @Autowired + public UsuarioEmpresaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List obtenerPorUsuario(Usuario usuario) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("usuarioLog", usuario)); + + return c.list(); + } + + public Boolean obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("usuarioLog", usuario)); + if(!c.list().isEmpty()){ + return true; + }else{ + return false; + } + } + + public List obtenerEmpresa(Usuario usuario) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("usuarioLog", usuario)); + List usuarioEmpresaList = c.list(); + List empresaList = new ArrayList(); + if(!usuarioEmpresaList.isEmpty()){ + for(UsuarioEmpresa ue : usuarioEmpresaList){ + empresaList.add(ue.getEmpresa()); + } + } + return empresaList; + } + + + + +} + diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioHibernateDAO.java new file mode 100644 index 000000000..0a5737fec --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioHibernateDAO.java @@ -0,0 +1,253 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SQLQuery; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.transform.Transformers; +import org.hibernate.type.IntegerType; +import org.hibernate.type.LongType; +import org.hibernate.type.StringType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.UsuarioDAO; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.vo.caja.UsuarioActivoVO; +import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO; + +/** + * + * @author rodrigo + */ +@Repository("usuarioDAO") +public class UsuarioHibernateDAO extends GenericHibernateDAO implements UsuarioDAO { + @Autowired + private SQLBuilder sqlBuilder; + + @Autowired + public UsuarioHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @SuppressWarnings("unchecked") + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @SuppressWarnings("unchecked") + public List buscarPeloNome(String nome) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("nombusuario", nome)); + c.addOrder(Order.asc("nombusuario")); + + return c.list(); + } + + public Usuario buscarPeloNomeSenha(String stUsuario, String senha) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("claveUsuario", stUsuario)); + c.add(Restrictions.eq("senha", senha)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (Usuario) c.uniqueResult(); + } + + @SuppressWarnings("unchecked") + public List buscarPorEmpleado(Empleado empleado) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.eq("empleado", empleado)); + + return c.list(); + } + + @SuppressWarnings("unchecked") + public List buscarPelaCveUsuario(String cveUsuario) { + Query query = getSession().createQuery("select u from Usuario u where u.activo =1 and u.claveUsuario = :clave order by u.claveUsuario"); + query.setParameter("clave", cveUsuario); + + return query.list(); + } + + @SuppressWarnings("unchecked") + public List buscarUsuariosActivo() { + String sqlBuscarUsuariosActivo = sqlBuilder.getSQLBuscarUsuariosActivo(); + + SQLQuery sql = getSession().createSQLQuery(sqlBuscarUsuariosActivo) + .addScalar("usuarioId", IntegerType.INSTANCE) + .addScalar("cveusuario", StringType.INSTANCE) + .addScalar("nombusuario", StringType.INSTANCE); + + sql.setResultTransformer(new AliasToBeanResultTransformer(UsuarioActivoVO.class)); + + return sql.list(); + } + + @Override + @SuppressWarnings("unchecked") + public List buscarPeloNomeLike(String nome) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.add(Restrictions.like("nombusuario", nome, MatchMode.START)); + c.addOrder(Order.asc("nombusuario")); + + return c.list(); + } + + @Override + public Usuario buscarPeloId(Integer usuarioId) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("usuarioId", usuarioId)); + + return (Usuario) c.uniqueResult(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscarPorFuncionSistema(Long funcionSistemaId){ + StringBuilder sQuery = new StringBuilder(); + sQuery.append("select u.usuario_Id as usuarioId, u as nome, u.cveusuario as cveusuario, u.desccontrasena as senha, null as email from usuario u "); + sQuery.append("where "); + sQuery.append(" u.activo = 1 "); + sQuery.append(" and u.usuario_id in ( "); + sQuery.append(" select up.usuario_id "); + sQuery.append(" from usuario_perfil up "); + sQuery.append(" join perfil_funcion pf on pf.perfil_id = up.perfil_id "); + sQuery.append(" where pf.funcionsistema_id = :funcionSistemaId AND pf.activo = 1 and up.activo = 1 "); + sQuery.append(" ) "); + + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("usuarioId", new LongType()) + .addScalar("nome", new StringType()) + .addScalar("cveusuario", new StringType()) + .addScalar("senha", new StringType()) + .addScalar("email", new StringType()) + .setResultTransformer(Transformers.aliasToBean(UsuarioEmbarcadaVO.class)); + + qr.setLong("funcionSistemaId", funcionSistemaId); + return (List)qr.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscarUsuarioPorPontoVenda(Long puntoVentaId){ + + StringBuilder sQuery = new StringBuilder(); + sQuery.append("select u.usuario_id as usuarioId, u.nombusuario as nome, u.cveusuario as cveusuario from usuario u "); + sQuery.append(" left join usuario_ubicacion uu on uu.usuario_id = u.usuario_id "); + sQuery.append(" where "); + sQuery.append(" uu.puntoventa_id = :puntoVentaId "); + sQuery.append(" and u.activo = 1 "); + sQuery.append(" and uu.activo = 1 "); + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("usuarioId", new LongType()) + .addScalar("nome", new StringType()) + .addScalar("cveusuario", new StringType()) + .setResultTransformer(Transformers.aliasToBean(UsuarioEmbarcadaVO.class)); + + qr.setLong("puntoVentaId", puntoVentaId); + return (List)qr.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscarUsuarioPorDispositivo(Long dispositivoEmbarcadaId){ + + StringBuilder sQuery = new StringBuilder(); + sQuery.append("select u.usuario_id as usuarioId, u.nombusuario as nome, u.cveusuario as cveusuario from usuario u "); + sQuery.append(" left join embarcada_disp_operador embdispop on embdispop.usuario_id = u.usuario_id "); + sQuery.append(" where "); + sQuery.append(" embdispop.dispositivoembarcada_id = :dispositivoEmbarcadaId "); + sQuery.append(" and u.activo = 1 "); + sQuery.append(" and embdispop.activo = 1 "); + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("usuarioId", new LongType()) + .addScalar("nome", new StringType()) + .addScalar("cveusuario", new StringType()) + .setResultTransformer(Transformers.aliasToBean(UsuarioEmbarcadaVO.class)); + + qr.setLong("dispositivoEmbarcadaId", dispositivoEmbarcadaId); + return (List)qr.list(); + } + + @SuppressWarnings("unchecked") + @Override + public List buscarUsuarioEmbarcadaPorUsuariosIds(List usuariosIdList) { + StringBuilder sQuery = new StringBuilder(); + sQuery.append(" select u.usuario_id as usuarioId, " ); + sQuery.append(" u.nombusuario as nome, " ); + sQuery.append(" u.cveusuario as cveusuario, "); + sQuery.append(" desccontrasena as senha, "); + sQuery.append(" desccorreo as email "); + sQuery.append(" from usuario u "); + sQuery.append(" where "); + sQuery.append(" u.usuario_id in (:usuariosIdList) "); + sQuery.append(" and u.activo = 1 "); + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("usuarioId", new LongType()) + .addScalar("nome", new StringType()) + .addScalar("cveusuario", new StringType()) + .addScalar("senha", new StringType()) + .addScalar("email", new StringType()) + .setResultTransformer(Transformers.aliasToBean(UsuarioEmbarcadaVO.class)); + + qr.setParameterList("usuariosIdList", usuariosIdList); + return (List)qr.list(); + } + + + @SuppressWarnings("unchecked") + @Override + public List buscaUsuariosDoPuntoVenta(Long puntoventaId){ + StringBuilder sQuery = new StringBuilder(); + sQuery.append(" select distinct u.usuario_id as usuarioId, " ); + sQuery.append(" u.nombusuario as nome, " ); + sQuery.append(" u.cveusuario as cveusuario, "); + sQuery.append(" desccontrasena as senha, "); + sQuery.append(" desccorreo as email "); + sQuery.append(" from usuario u "); + sQuery.append(" left join usuario_ubicacion uu on (uu.usuario_id = u.usuario_id) "); + sQuery.append(" join OPERADOR_EMBARCADA operEmb ON (u.USUARIO_ID = operEmb.USUARIO_ID) "); + sQuery.append(" where "); + sQuery.append(" uu.puntoventa_id = :puntoventaId "); + sQuery.append(" and uu.activo = 1 "); + sQuery.append(" and u.activo = 1 "); + sQuery.append(" and operEmb.activo = 1 "); + Query qr = getSession().createSQLQuery(sQuery.toString()) + .addScalar("usuarioId", new LongType()) + .addScalar("nome", new StringType()) + .addScalar("cveusuario", new StringType()) + .addScalar("senha", new StringType()) + .addScalar("email", new StringType()) + .setResultTransformer(Transformers.aliasToBean(UsuarioEmbarcadaVO.class)); + + qr.setLong("puntoventaId", puntoventaId); + return (List)qr.list(); + + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioPerfilHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioPerfilHibernateDAO.java new file mode 100644 index 000000000..15b32f0c7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioPerfilHibernateDAO.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.UsuarioPerfilDAO; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Rafius + */ +@Repository("usuarioPerfilDAO") +public class UsuarioPerfilHibernateDAO extends GenericHibernateDAO + implements UsuarioPerfilDAO { + + @Autowired + public UsuarioPerfilHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + public List obtenerPorUsuario(Usuario usuario) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("usuario", usuario)); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioSesionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioSesionHibernateDAO.java new file mode 100644 index 000000000..2cdb2a0c5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioSesionHibernateDAO.java @@ -0,0 +1,55 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.apache.log4j.Logger; +import org.hibernate.Criteria; +import org.hibernate.Query; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.UsuarioSesionDAO; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioSesion; + +/** + * + * @author RJ Consultores + */ +@Repository("usuarioSesionDAO") +public class UsuarioSesionHibernateDAO extends GenericHibernateDAO implements UsuarioSesionDAO { + private static Logger log = Logger.getLogger(UsuarioSesionHibernateDAO.class); + + @Autowired + public UsuarioSesionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscar(Usuario usuario) { + return this.findByCriteria(Restrictions.eq("usuario", usuario),Restrictions.eq("activo", Boolean.TRUE)); + } + + @Override + public void liberarUsuario(Usuario usuario) { + Query query = getSession().createQuery("UPDATE UsuarioSesion set indFirmado = false where usuario =:usuario"); + query.setParameter("usuario", usuario); + int i = query.executeUpdate(); + log.info("qtdLiberada="+i); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioUbicacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioUbicacionHibernateDAO.java new file mode 100644 index 000000000..4d36b62ed --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioUbicacionHibernateDAO.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.UsuarioUbicacionDAO; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Property; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author rodrigo + */ +@Repository("usuarioUbicacionDAO") +public class UsuarioUbicacionHibernateDAO extends GenericHibernateDAO + implements UsuarioUbicacionDAO { + + @Autowired + public UsuarioUbicacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List buscarPorUsuario(Usuario usuario) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("usuario", usuario)); + + return c.list(); + } + + @Override + public List buscarPuntoVentaPorUsuario(Usuario usuario) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("usuario", usuario)); + c.setProjection(Property.forName("puntoVenta")); + c.createAlias("puntoVenta", "ptovta"); + c.addOrder(Order.asc("ptovta.nombpuntoventa")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/VendaPacoteHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/VendaPacoteHibernateDAO.java new file mode 100644 index 000000000..21cb29e4a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/VendaPacoteHibernateDAO.java @@ -0,0 +1,45 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.VendaPacoteDAO; +import com.rjconsultores.ventaboletos.entidad.VendaPacote; + +@Repository("vendaPacoteDAO") +public class VendaPacoteHibernateDAO extends GenericHibernateDAO implements VendaPacoteDAO { + + @Autowired + public VendaPacoteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + @SuppressWarnings("unchecked") + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + return c.list(); + } + + @Override + @Transactional + public VendaPacote suscribir(VendaPacote entidad) { + entidad.setFecmodif(new Date()); + return super.suscribir(entidad); + } + + @Override + @Transactional + public VendaPacote actualizacion(VendaPacote entidad) { + entidad.setFecmodif(new Date()); + return super.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ViaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ViaHibernateDAO.java new file mode 100644 index 000000000..1c19dd3bc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ViaHibernateDAO.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import com.rjconsultores.ventaboletos.dao.ViaDAO; +import com.rjconsultores.ventaboletos.entidad.Via; +import java.util.List; +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +/** + * + * @author Administrador + */ +@Repository("viaDAO") +public class ViaHibernateDAO extends GenericHibernateDAO + implements ViaDAO { + + @Autowired + public ViaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.addOrder(Order.asc("nombvia")); + + return c.list(); + } + + public List buscar(String nombvia) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("nombvia", nombvia)); + c.addOrder(Order.asc("nombvia")); + + return c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/VigenciaTarifaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/VigenciaTarifaHibernateDAO.java new file mode 100644 index 000000000..d8d62f5a5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/VigenciaTarifaHibernateDAO.java @@ -0,0 +1,76 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.VigenciaTarifaDAO; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; + +/** + * + * @author rodrigo + */ +@Repository("vigenciaTarifaDAO") +public class VigenciaTarifaHibernateDAO extends + GenericHibernateDAO implements + VigenciaTarifaDAO { + + @Autowired + public VigenciaTarifaHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + c.addOrder(Order.asc("feciniciovigencia")); + + return c.list(); + } + + @Override + public List pesquisar(Date inicio, Date fim) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if (inicio != null) { + c.add(Restrictions.eq("feciniciovigencia", inicio)); + } + + if (fim != null) { + c.add(Restrictions.eq("fecfinvigencia", fim)); + } + return c.list(); + } + + @Override + public List buscarVigenciasIntervalo(VigenciaTarifa vt) { + Criteria c = this.getSession().createCriteria(VigenciaTarifa.class); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ge("fecfinvigencia", vt.getFeciniciovigencia())); + c.add(Restrictions.le("feciniciovigencia", vt.getFecfinvigencia())); + + if (vt.getVigenciatarifaId() != null) { + c.add(Restrictions.ne("vigenciatarifaId", vt.getVigenciatarifaId())); + } + + c.addOrder(Order.asc("feciniciovigencia")); + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/sqlfunction/FnArredondamentoTarifa.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/sqlfunction/FnArredondamentoTarifa.java new file mode 100644 index 000000000..7caaf1097 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/sqlfunction/FnArredondamentoTarifa.java @@ -0,0 +1,49 @@ +package com.rjconsultores.ventaboletos.dao.hibernate.sqlfunction; + +import java.util.List; + +import org.hibernate.QueryException; +import org.hibernate.dialect.function.SQLFunction; +import org.hibernate.engine.Mapping; +import org.hibernate.engine.SessionFactoryImplementor; +import org.hibernate.type.IntegerType; +import org.hibernate.type.Type; + +import com.rjconsultores.ventaboletos.dao.util.DBUtil; + +public class FnArredondamentoTarifa implements SQLFunction { + + @Override + public Type getReturnType(Type arg0, Mapping arg1) throws QueryException { + return new IntegerType(); + } + + @Override + public boolean hasArguments() { + return true; + } + + @Override + public boolean hasParenthesesIfNoArguments() { + return true; + } + + + public String render(List args, SessionFactoryImplementor arg1) throws QueryException { + if (args.size() != 6) { + throw new QueryException("Para o arredondamento de preço são necessário 6 parametros"); + } + + if (DBUtil.getInstance().isOracle()){ + return " FN_ARREDONDAMENTO_TARIFA(" + args.get(0) + ", " + args.get(1) + ", " + args.get(2) +", " + args.get(3) +", " + args.get(4) +", " + args.get(5) + ")"; + } + + throw new QueryException("Ainda não existe a traduação da função de arredondamento para o banco usado"); + + } + + + public String render(Type arg0, List arg1, SessionFactoryImplementor arg2) throws QueryException { + return render(arg1, arg2); + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLBuilder.java b/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLBuilder.java new file mode 100644 index 000000000..15dd7dea9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLBuilder.java @@ -0,0 +1,128 @@ +package com.rjconsultores.ventaboletos.dao.sqlbuilder; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.constantes.TipoSeguro; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +/** + * Interface que indica quais são os SQL nativos da aplicação. + * + * Cada método representa um SQL nativo que deve ser implementado de acordo com a base de dados. + * + * O padrão para a clase é retornar o SQL nativo para o conjunto de parametros + * + * + * @author gleimar + * + */ +public interface SQLBuilder { + + public String getSQLGerarTarifaOficial(Integer codRuta, Integer usuarioId, OrgaoConcedente orgaoConcedente, List idsEmpresas); + + public String getSQLGerarTabelaZerada(Integer codRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + public String getSQLAtualizarTarifaOficial(Integer rutaId, Integer usuarioId, OrgaoConcedente orgaoConcedente); + + public String getSQLGerarTarifaOficialArtesp(Integer codRuta, Integer usuarioId, + Integer orgaoConcedenteId, List idsEmpresas); + + public String getAtualizarTaxaEmbarquePorKmParada(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + public String getSQLAtualizarTaxaEmbarquePorKmOrgao(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + + public String getSQLAtualizarTaxaEmbarquePorParadaFixo(Integer rutaId, Integer usuarioId,Integer orgaoConcedenteId, List idsEmpresas); + + public String getSQLAtualizarSeguroPorKm(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, TipoSeguro tipoSeguro); + + public String getSQLAtualizarSeguroPorTarifa(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId); + + public String getSQLSelecionarTarifaPorTarifaOficalParaAtualizar(Integer vigenciaTarifaId, Empresa empresa, OrgaoConcedente orgao); + + public String getSQLAtualizarTarifaPorTarifaOfical(Map dados, Integer usuarioId, Boolean calculaPegagio, Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP); + + public String getSQLInserirTarifaPelaTarifaOficial(Integer vigenciaTarifaId, Integer usuarioId, Empresa empresa, OrgaoConcedente orgao); + + public String getSQLActualizarCorridaFecHusoFecVerano(); + + public String getSQLActualizarCorridaTramoFecHusoFecVerano(); + + public String getSQLBuscarCajaFecha(boolean yaCerrado, Date fechaDesde, Date fechaHasta); + + public String getSQLBuscarUsuariosCajaCerrado(Date fecha, String cveusuario, String turnoid); + + public String getSQLBuscarCajaCerrado(Integer usuarioId, Date fecha, String turnoid); + + public String getSQLBuscarReceitasDespesasCaja(Integer usuarioId, Date fec); + + public String getSQLBuscarUsuariosActivo(); + + public String getSQLAtualizarPrecioPorTPP(final Integer rutaId, final Integer usuarioId, + final Integer orgaoConcedenteId, TipoSeguro tipoSeguro); + + /** + * Venda Embarcada + * @return Retorna a Query para a inserção dos valores da venda na tabela de Caja + */ + public String getSQLInserirCajaVendaEmbarcada(); + + /** + * Venda Embarcada + * @return Retorna a Query para a inserção dos valores da venda na tabela de CajaFormaPago + */ + public String getSQLInserirCajaFormaPagoVendaEmbarcada(); + + /** + * Venda Embarcada + * + * @return Retorna a Query para a inserção dos valores da venda na tabela de Boleto + */ + public String getSQLInserirBoletoVendaEmbarcada(); + + /** + * Venda Embarcada + * @return Retorna a Query para a inserção dos valores da venda na tabela de BoletoFormaPago + */ + public String getSQLInserirBoletoFormaPagoVendaEmbarcada(); + + /** + * + * @return Retorna o valor gerado pela sequence para a tabela BoletoFormaPago + */ + public String getSQLObterSequenceBoletoFormaPago(); + + /** + * + * @return Retorna o valor gerado pela sequence para a tabela CajaFormaPago + */ + public String getSQLObterSequenceCajaFormaPago(); + + /** + * + * @return Retorna o valor gerado pela sequence da tabela Boleto + */ + public String getSQLObterSequenceBoleto(); + + /** + * + * @return Retorna o valor gerado pela sequence da tabela Caja + */ + public String getSQLObterSequenceCaja(); + + /** + * + * @return Retorna o valor gerado pela sequence do Numero de Operacao + */ + public String getSQLObterSequenciaNumOperacion(); + + public String getSQLBuscarDatosCaja(Date fechaDesde, Date fechaHasta, Boolean sembilhetesPacote); + + public String getSQLInserirTarifaEmbarcadaPelaTarifaOficial(Integer vigenciaTarifaId, Integer usuarioId, Empresa empresa, OrgaoConcedente orgao); + + public String getSQLSelecionarTarifaEmbarcadaPorTarifaOficalParaAtualizar(Integer vigenciaTarifaId, Empresa empresa, OrgaoConcedente orgao); + + public String getSQLAtualizarTarifaEmbarcadaPorTarifaOfical(Map dados, Integer usuarioId, Boolean calculaPegagio, Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLFactory.java b/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLFactory.java new file mode 100644 index 000000000..3edcb991c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLFactory.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.dao.sqlbuilder; + +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.dao.sqlbuilder.impl.SQLBuilderOracle; +import com.rjconsultores.ventaboletos.dao.util.DBUtil; + +public class SQLFactory { + private static Logger log = Logger.getLogger(SQLFactory.class); + + public SQLBuilder getBuilder() { + if (DBUtil.getInstance().isOracle()) { + return new SQLBuilderOracle(); + } + + throw new RuntimeException("Não foi localizado a classe que traduz SQL Nativos"); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java b/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java new file mode 100644 index 000000000..c0e553e4c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java @@ -0,0 +1,1423 @@ +package com.rjconsultores.ventaboletos.dao.sqlbuilder.impl; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.constantes.TipoSeguro; +import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; +import com.rjconsultores.ventaboletos.dao.util.DBUtil; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.enums.TipoFormapago; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; + +public class SQLBuilderOracle implements SQLBuilder { + private static final Integer SELECAO_TODOS = -1; + private static final Integer HORAS_NO_DIA = Integer.valueOf(24); + private static final Integer RED_PAGO_FORMAPAGO_ID = Integer.valueOf(95); + private static final String RED_PAGO_EMISSOR_TARJETA = "RDP"; + private static final String RED_PAGO_FORMA_PAGO = "CR"; + private static final Integer DER_PR = 2; + + @Override + public String getSQLGerarTabelaZerada(final Integer codRuta, final Integer usuarioId,final Integer orgaoConcedenteId, final List idsEmpresas){ + + StringBuilder sb = new StringBuilder(); + sb.append("INSERT "); + sb.append("INTO "); + sb.append(" TARIFA_OFICIAL "); + sb.append(" ( "); + sb.append(" TARIFAOFICIAL_ID, "); + sb.append(" PRECIO, "); + sb.append(" PRECIOORIGINAL, "); + sb.append(" TRAMO_ID, "); + sb.append(" MARCA_ID, "); + sb.append(" CLASESERVICIO_ID, "); + sb.append(" PRECIOREDABIERTO, "); + sb.append(" MONEDA_ID, "); + sb.append(" VIGENCIATARIFA_ID, "); + sb.append(" STATUSTARIFA, "); + sb.append(" IMPORTETAXAEMBARQUE, "); + sb.append(" IMPORTEPEDAGIO, "); + sb.append(" IMPORTEOUTROS, "); + sb.append(" IMPORTESEGURO, "); + sb.append(" ORGAOCONCEDENTE_ID, "); + sb.append(" RUTA_ID, "); + sb.append(" ACTIVO, "); + sb.append(" FECMODIF, "); + sb.append(" USUARIO_ID, "); + sb.append(" ORIGEN_ID, "); + sb.append(" DESTINO_ID "); + sb.append(" ) "); + sb.append(" select "); + sb.append(" "); + sb.append(" TARIFA_OFICIAL_SEQ.NEXTVAL, "); + sb.append(" 0, "); + sb.append(" 0, "); + sb.append(" t.tramo_id, "); + sb.append(" mc.marca_id, "); + sb.append(" r.CLASESERVICIO_ID, "); + sb.append(" null, "); + sb.append(" m.moneda_id, "); + sb.append(" null, "); + sb.append(" 'A', "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" oc.orgaoconcedente_id, "); + sb.append(" r.ruta_id, "); + sb.append(" 1, "); + sb.append(" ").append(DBUtil.getInstance().dbSysdate()).append(", "); + sb.append(" ").append(usuarioId).append(", "); + sb.append(" po.parada_id, "); + sb.append(" pd.parada_id "); + sb.append(" "); + sb.append("from "); + sb.append(" ruta_combinacion rc "); + sb.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sb.append(" inner join ruta_empresa re on r.ruta_id = re.ruta_id "); + sb.append(" inner join marca ma on ma.empresa_id = re.empresa_id "); + sb.append(" inner join orgao_concedente oc on oc.orgaoconcedente_id =r.orgaoconcedente_id "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sb.append(" inner join parada po on po.parada_id = t.origen_id "); + sb.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sb.append(" inner join ciudad c on c.ciudad_id = po.ciudad_id "); + sb.append(" inner join estado e on e.estado_id = c.estado_id "); + sb.append(" inner join MARCA_CLASESERVICIO mc on "); + sb.append(" mc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and ma.marca_id = mc.marca_id, "); + sb.append(" moneda m "); + sb.append(" "); + sb.append("where "); + sb.append(" rc.activo = 1 "); + if (codRuta != null) { + sb.append(" and r.ruta_id = ").append(codRuta); + } + sb.append(" and r.activo = 1 "); + sb.append(" and mc.marca_id <> -1 "); + sb.append(" and mc.activo = 1 "); + sb.append(" and re.activo = 1 "); + if (idsEmpresas != null) { + sb.append(" and re.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + } + sb.append(" and m.moneda_id = 1 "); + if (orgaoConcedenteId != null) { + sb.append(" and oc.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + sb.append(" and "); + sb.append(" (t.tramo_id, "); + sb.append(" mc.marca_id, "); + sb.append(" r.CLASESERVICIO_ID, "); + sb.append(" m.moneda_id, "); + sb.append(" oc.orgaoconcedente_id, r.ruta_id) "); + sb.append(" not in (select tao.tramo_id,tao.marca_id,tao.CLASESERVICIO_ID, "); + sb.append(" tao.moneda_id,tao.orgaoconcedente_id, tao.ruta_id "); + sb.append(" from tarifa_oficial tao where tao.activo = 1) "); + + return sb.toString(); + } + + @Override + public String getSQLGerarTarifaOficialArtesp(final Integer codRuta, final Integer usuarioId, + final Integer orgaoConcedenteId, final List idsEmpresas) + { + StringBuilder sb = new StringBuilder(); + sb.append(" INSERT "); + sb.append(" INTO "); + sb.append(" TARIFA_OFICIAL "); + sb.append(" ( "); + sb.append(" TARIFAOFICIAL_ID, "); + sb.append(" PRECIO, "); + sb.append(" PRECIOORIGINAL, "); + sb.append(" TRAMO_ID, "); + sb.append(" MARCA_ID, "); + sb.append(" CLASESERVICIO_ID, "); + sb.append(" PRECIOREDABIERTO, "); + sb.append(" MONEDA_ID, "); + sb.append(" VIGENCIATARIFA_ID, "); + sb.append(" STATUSTARIFA, "); + sb.append(" IMPORTETAXAEMBARQUE, "); + sb.append(" IMPORTEPEDAGIO, "); + sb.append(" IMPORTEOUTROS, "); + sb.append(" IMPORTESEGURO, "); + sb.append(" ORGAOCONCEDENTE_ID, "); + sb.append(" RUTA_ID, "); + sb.append(" ACTIVO, "); + sb.append(" FECMODIF, "); + sb.append(" USUARIO_ID, "); + sb.append(" ORIGEN_ID, "); + sb.append(" DESTINO_ID "); + sb.append(" ) "); + sb.append(" select "); + sb.append(" "); + sb.append(" TARIFA_OFICIAL_SEQ.NEXTVAL, "); + + sb.append(" ROUND( "); + sb.append(" ("); + sb.append(" "); + sb.append(" case ( coalesce((select min( tkm.valortaxa ) from Tarifa_km tkm where tkm.kmate >= t.cantkmreal and r.CLASESERVICIO_ID = tkm.CLASESERVICIO_ID and tkm.activo = 1) , 0 )) when 0 then"); + sb.append(" (select max( tkm.valortaxa ) from Tarifa_km tkm where tkm.CLASESERVICIO_ID = r.CLASESERVICIO_ID and tkm.activo = 1)"); + sb.append(" else"); + sb.append(" (select min( tkm.valortaxa ) from Tarifa_km tkm where tkm.kmate >= t.cantkmreal and r.CLASESERVICIO_ID = tkm.CLASESERVICIO_ID and tkm.activo = 1) end"); + sb.append(" ) "); + sb.append(" ,2), "); + + sb.append(" ROUND( "); + sb.append(" ("); + sb.append(" "); + sb.append(" case ( coalesce((select min( tkm.valortaxa ) from Tarifa_km tkm where tkm.kmate >= t.cantkmreal and r.CLASESERVICIO_ID = tkm.CLASESERVICIO_ID and tkm.activo = 1) , 0 )) when 0 then"); + sb.append(" (select max( tkm.valortaxa ) from Tarifa_km tkm where tkm.CLASESERVICIO_ID = r.CLASESERVICIO_ID and tkm.activo = 1)"); + sb.append(" else"); + sb.append(" (select min( tkm.valortaxa ) from Tarifa_km tkm where tkm.kmate >= t.cantkmreal and r.CLASESERVICIO_ID = tkm.CLASESERVICIO_ID and tkm.activo = 1) end"); + sb.append(" ) "); + sb.append(" ,2), "); + + sb.append(" t.tramo_id, "); + sb.append(" mc.marca_id, "); + sb.append(" r.CLASESERVICIO_ID, "); + sb.append(" null, "); + sb.append(" m.moneda_id, "); + sb.append(" null, "); + sb.append(" 'A', "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" oc.orgaoconcedente_id, "); + sb.append(" r.ruta_id, "); + sb.append(" 1, "); + sb.append(" ").append(DBUtil.getInstance().dbSysdate()).append(", "); + sb.append(" ").append(usuarioId).append(", "); + sb.append(" po.parada_id, "); + sb.append(" pd.parada_id "); + sb.append(" "); + sb.append("from "); + sb.append(" ruta_combinacion rc "); + sb.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sb.append(" inner join ruta_empresa re on r.ruta_id = re.ruta_id "); + sb.append(" inner join marca ma on ma.empresa_id = re.empresa_id "); + sb.append(" inner join orgao_concedente oc on oc.orgaoconcedente_id =r.orgaoconcedente_id "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id and t.activo =1");//adicionei isso t.activo =1"); + sb.append(" inner join parada po on po.parada_id = t.origen_id "); + sb.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sb.append(" inner join ciudad c on c.ciudad_id = po.ciudad_id "); + sb.append(" inner join estado e on e.estado_id = c.estado_id "); + sb.append(" inner join MARCA_CLASESERVICIO mc on "); + sb.append(" mc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and ma.marca_id = mc.marca_id, "); + sb.append(" moneda m "); + sb.append(" "); + sb.append("where "); + + sb.append(" rc.activo = 1 "); + if (codRuta != null) { + sb.append(" and r.ruta_id = ").append(codRuta); + } + sb.append(" and r.activo = 1 "); + sb.append(" and mc.marca_id <> -1 "); + sb.append(" and mc.activo = 1 "); + sb.append(" and re.activo = 1 "); + sb.append(" and r.orgaoconcedente_id = 21 "); + if (idsEmpresas != null) { + sb.append(" and re.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + } + sb.append(" and m.moneda_id = 1 "); + if (orgaoConcedenteId != null) { + sb.append(" and oc.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + sb.append(" and "); + sb.append(" (t.tramo_id, "); + sb.append(" mc.marca_id, "); + sb.append(" r.CLASESERVICIO_ID, "); + sb.append(" m.moneda_id, "); + sb.append(" oc.orgaoconcedente_id, r.ruta_id) "); + sb.append(" not in (select tao.tramo_id,tao.marca_id,tao.CLASESERVICIO_ID, "); + sb.append(" tao.moneda_id,tao.orgaoconcedente_id, tao.ruta_id "); + sb.append(" from tarifa_oficial tao where tao.activo = 1) "); + + return sb.toString(); + } + + @Override + public String getSQLGerarTarifaOficial(final Integer codRuta, final Integer usuarioId, + final OrgaoConcedente orgaoConcedente, final List idsEmpresas) { + + StringBuilder sb = new StringBuilder(); + sb.append(" INSERT "); + sb.append(" INTO "); + sb.append(" TARIFA_OFICIAL "); + sb.append(" ( "); + sb.append(" TARIFAOFICIAL_ID, "); + sb.append(" PRECIO, "); + sb.append(" PRECIOORIGINAL, "); + sb.append(" TRAMO_ID, "); + sb.append(" MARCA_ID, "); + sb.append(" CLASESERVICIO_ID, "); + sb.append(" PRECIOREDABIERTO, "); + sb.append(" MONEDA_ID, "); + sb.append(" VIGENCIATARIFA_ID, "); + sb.append(" STATUSTARIFA, "); + sb.append(" IMPORTETAXAEMBARQUE, "); + sb.append(" IMPORTEPEDAGIO, "); + sb.append(" IMPORTEOUTROS, "); + sb.append(" IMPORTESEGURO, "); + sb.append(" ORGAOCONCEDENTE_ID, "); + sb.append(" RUTA_ID, "); + sb.append(" ACTIVO, "); + sb.append(" FECMODIF, "); + sb.append(" USUARIO_ID, "); + sb.append(" ORIGEN_ID, "); + sb.append(" DESTINO_ID "); + sb.append(" ) "); + sb.append(" select "); + sb.append(" "); + sb.append(" TARIFA_OFICIAL_SEQ.NEXTVAL, "); + //>> SE ORGAO FOR DER-PR E SE O COEFICIENTE DA CLASSE NAO ESTA NULL + sb.append(" CASE R.ORGAOCONCEDENTE_ID WHEN "+DER_PR+" THEN CASE WHEN cl.COEFICIENTETARIFA IS NOT NULL THEN " ); + sb.append(" trunc(((coalesce(ct1.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente1,0) + 350,0.27)*16160 )) ) * COALESCE(tc.kmcoeficiente1,0)) * cl.COEFICIENTETARIFA " ); + sb.append(" + ((coalesce(ct2.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente2,0) + 350,0.27)*13470 )) ) * COALESCE(tc.kmcoeficiente2,0)) * cl.COEFICIENTETARIFA,2) " ); + sb.append(" ELSE " ); + //< COEFICIENTE DA CLASSE ESTA NULL + sb.append(" ROUND( "); + sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + "); + sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + "); + sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * "); + if (orgaoConcedente != null && orgaoConcedente.getIndUtilizaICMS() != null && orgaoConcedente.getIndUtilizaICMS()) { + sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2) "); + } else { + sb.append(" 1, 2 ) "); + } + // + sb.append(" end else " ); + //< ORGAO NAO EH DER-PR + sb.append(" ROUND( "); + sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + "); + sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + "); + sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * "); + if (orgaoConcedente != null && orgaoConcedente.getIndUtilizaICMS() != null && orgaoConcedente.getIndUtilizaICMS()) { + sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2) "); + } else { + sb.append(" 1, 2 ) "); + } + sb.append(" end , " ); + // + //>> SE ORGAO FOR DER-PR E SE O COEFICIENTE DA CLASSE NAO ESTA NULL + sb.append(" CASE R.ORGAOCONCEDENTE_ID WHEN "+DER_PR+" THEN CASE WHEN cl.COEFICIENTETARIFA IS NOT NULL THEN " ); + sb.append(" trunc(((coalesce(ct1.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente1,0) + 350,0.27)*16160 )) ) * COALESCE(tc.kmcoeficiente1,0)) * cl.COEFICIENTETARIFA " ); + sb.append(" + ((coalesce(ct2.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente2,0) + 350,0.27)*13470 )) ) * COALESCE(tc.kmcoeficiente2,0)) * cl.COEFICIENTETARIFA,2) " ); + sb.append(" ELSE " ); + //< COEFICIENTE DA CLASSE ESTA NULL + sb.append(" ROUND( "); + sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + "); + sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + "); + sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * "); + if (orgaoConcedente != null && orgaoConcedente.getIndUtilizaICMS() != null && orgaoConcedente.getIndUtilizaICMS()) { + sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2) "); + } else { + sb.append(" 1, 2 ) "); + } + // + sb.append(" end else " ); + //< ORGAO NAO EH DER-PR + sb.append(" ROUND( "); + sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + "); + sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + "); + sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * "); + if (orgaoConcedente != null && orgaoConcedente.getIndUtilizaICMS() != null && orgaoConcedente.getIndUtilizaICMS()) { + sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2) "); + } else { + sb.append(" 1, 2 ) "); + } + sb.append(" end , " ); + // + sb.append(" t.tramo_id, "); + sb.append(" mc.marca_id, "); + sb.append(" r.CLASESERVICIO_ID, "); + sb.append(" null, "); + sb.append(" m.moneda_id, "); + sb.append(" null, "); + sb.append(" 'A', "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" null, "); + sb.append(" oc.orgaoconcedente_id, "); + sb.append(" r.ruta_id, "); + sb.append(" 1, "); + sb.append(" ").append(DBUtil.getInstance().dbSysdate()).append(", "); + sb.append(" ").append(usuarioId).append(", "); + sb.append(" po.parada_id, "); + sb.append(" pd.parada_id "); + sb.append(" "); + sb.append("from "); + sb.append(" ruta_combinacion rc "); + sb.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sb.append(" inner join ruta_empresa re on r.ruta_id = re.ruta_id "); + sb.append(" inner join marca ma on ma.empresa_id = re.empresa_id "); + sb.append(" inner join orgao_tramo tc on tc.tramo_id = rc.tramo_id "); + sb.append(" and tc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and tc.activo =1 "); + sb.append(" inner join orgao_concedente oc on "); + sb.append(" oc.orgaoconcedente_id = tc.orgaoconcedente_id "); + sb.append(" and oc.orgaoconcedente_id =r.orgaoconcedente_id "); + sb.append(" inner join coeficiente_tarifa ct1 on ct1.coeficientetarifa_id = tc.coeficientetarifa1_id "); + sb.append(" left join coeficiente_tarifa ct2 on ct2.coeficientetarifa_id = tc.coeficientetarifa2_id "); + sb.append(" left join coeficiente_tarifa ct3 on ct3.coeficientetarifa_id = tc.coeficientetarifa3_id "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sb.append(" inner join parada po on po.parada_id = t.origen_id "); + sb.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sb.append(" inner join ciudad c on c.ciudad_id = po.ciudad_id "); + sb.append(" inner join estado e on e.estado_id = c.estado_id "); + sb.append(" inner join MARCA_CLASESERVICIO mc on "); + sb.append(" mc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and ma.marca_id = mc.marca_id "); + sb.append(" inner join CLASE_SERVICIO cl on cl.claseservicio_id = r.CLASESERVICIO_ID, "); + sb.append(" moneda m "); + sb.append(" "); + sb.append("where "); + sb.append(" rc.activo = 1 "); + if (codRuta != null) { + sb.append(" and r.ruta_id = ").append(codRuta); + } + sb.append(" and r.activo = 1 "); + sb.append(" and tc.activo = 1 "); + sb.append(" and mc.marca_id <> -1 "); + sb.append(" and mc.activo = 1 "); + sb.append(" and re.activo = 1 "); + sb.append(" and r.orgaoconcedente_id <> 21 "); + if(ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CRIAR_TARIFA_APENAS_TRECHO_VENDIDO.getDescricao())){ + sb.append(" and rc.indventa = 1 "); + } + if (idsEmpresas != null) { + sb.append(" and re.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + } + sb.append(" and m.moneda_id = 1 "); + if (orgaoConcedente != null && orgaoConcedente.getOrgaoConcedenteId() != null && orgaoConcedente.getOrgaoConcedenteId() != SELECAO_TODOS) { + sb.append(" and oc.orgaoconcedente_id = ").append(orgaoConcedente.getOrgaoConcedenteId()); + } + sb.append(" and "); + sb.append(" (t.tramo_id, "); + sb.append(" mc.marca_id, "); + sb.append(" r.CLASESERVICIO_ID, "); + sb.append(" m.moneda_id, "); + sb.append(" oc.orgaoconcedente_id, r.ruta_id) "); + sb.append(" not in (select tao.tramo_id,tao.marca_id,tao.CLASESERVICIO_ID, "); + sb.append(" tao.moneda_id,tao.orgaoconcedente_id, tao.ruta_id "); + sb.append(" from tarifa_oficial tao where tao.activo = 1) "); + + return sb.toString(); + } + + @Override + public String getSQLAtualizarTarifaOficial(final Integer rutaId, final Integer usuarioId, + final OrgaoConcedente orgaoConcedente) { + StringBuilder sb = new StringBuilder(""); + + sb.append("UPDATE TARIFA_OFICIAL SET PRECIO = "); + sb.append("( "); + sb.append("select "); + sb.append(" "); + sb.append(" ROUND( "); + sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + "); + sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + "); + sb.append(" coalesce(ct3.coeficiente,0) * coalesce(tc.kmcoeficiente3,0)) * "); + sb.append(" case when e.icms is null then 1 else (1/(1-e.icms/100)) end ,2)"); + sb.append(" "); + sb.append("from "); + sb.append(" ruta_combinacion rc "); + sb.append(" inner join ruta r on r.ruta_id = rc.ruta_id "); + sb.append(" inner join orgao_tramo tc on "); + sb.append(" tc.tramo_id = rc.tramo_id and tc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and tc.activo =1 "); + sb.append(" inner join orgao_concedente oc on "); + sb.append(" oc.orgaoconcedente_id = tc.orgaoconcedente_id "); + sb.append(" and oc.orgaoconcedente_id =r.orgaoconcedente_id "); + sb.append(" inner join coeficiente_tarifa ct1 on ct1.coeficientetarifa_id = tc.coeficientetarifa1_id "); + sb.append(" left join coeficiente_tarifa ct2 on ct2.coeficientetarifa_id = tc.coeficientetarifa2_id "); + sb.append(" left join coeficiente_tarifa ct3 on ct3.coeficientetarifa_id = tc.coeficientetarifa3_id "); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id "); + sb.append(" inner join parada po on po.parada_id = t.origen_id "); + sb.append(" inner join parada pd on pd.parada_id = t.destino_id "); + sb.append(" inner join ciudad c on c.ciudad_id = po.ciudad_id "); + sb.append(" inner join estado e on e.estado_id = c.estado_id "); + sb.append(" inner join MARCA_CLASESERVICIO mc on mc.CLASESERVICIO_ID = r.CLASESERVICIO_ID, "); + sb.append(" moneda m "); + sb.append(" "); + sb.append("where "); + sb.append(" rc.activo = 1 "); + sb.append(" and r.activo = 1 "); + sb.append(" and mc.marca_id <> -1 "); + sb.append(" and tc.activo = 1 "); + sb.append(" and m.moneda_id = 1 "); + if (orgaoConcedente != null && orgaoConcedente.getOrgaoConcedenteId() != null) { + sb.append(" and oc.orgaoconcedente_id = ").append(orgaoConcedente.getOrgaoConcedenteId()); + } + sb.append(" and t.tramo_id = TARIFA_OFICIAL.tramo_id "); + sb.append(" and mc.marca_id = TARIFA_OFICIAL.marca_id "); + sb.append(" and r.CLASESERVICIO_ID = TARIFA_OFICIAL.CLASESERVICIO_ID "); + sb.append(" and m.moneda_id = TARIFA_OFICIAL.moneda_id "); + sb.append(" and oc.orgaoconcedente_id = TARIFA_OFICIAL.orgaoconcedente_id "); + sb.append(" and r.ruta_id = TARIFA_OFICIAL.ruta_id "); + sb.append(") "); + sb.append(" "); + sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); + sb.append(" "); + sb.append("where "); + sb.append(" activo = 1 "); + if (rutaId != null) { + sb.append(" and ruta_id = ").append(rutaId); + } + if (orgaoConcedente != null && orgaoConcedente.getOrgaoConcedenteId() != null) { + sb.append(" and orgaoconcedente_id = ").append(orgaoConcedente.getOrgaoConcedenteId()); + } + + return sb.toString(); + } + + @Override + public String getAtualizarTaxaEmbarquePorKmParada(final Integer rutaId, final Integer usuarioId,final Integer orgaoConcedenteId, List idsEmpresas) { + StringBuilder sb = new StringBuilder(""); + sb.append("update tarifa_oficial set IMPORTETAXAEMBARQUE = "); + sb.append("( "); + sb.append("select "); + sb.append(" tepKm.valorTaxa "); + sb.append(" "); + sb.append(" "); + sb.append("from "); + sb.append(" tarifa_oficial tao "); + sb.append(" inner join tramo t on t.tramo_id = tao.tramo_id "); + sb.append(" inner join TAXA_EMBARQUE_PARADA tepKm on "); + sb.append(" tepKm.parada_id = t.origen_id and tepKm.KMATE >= "); + sb.append(" t.CANTKMREAL and tepKm.activo = 1 and tepKm.indtipo = 'K' and tepKm.empresa_id in (-1, ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + sb.append(" inner join marca m on m.marca_id = tao.marca_id "); + sb.append("where "); + sb.append(" tepKm.kmate= "); + sb.append(" (select min(tepKm1.KMATE) "); + sb.append(" from "); + sb.append(" TAXA_EMBARQUE_PARADA tepKm1 "); + sb.append(" where "); + sb.append(" tepKm1.parada_id = t.origen_id and tepKm1.KMATE >= t.CANTKMREAL and tepKm1.activo = 1 and tepKm1.orgaoconcedente_id = tao.orgaoconcedente_id and tepKm1.empresa_id in (-1, ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length() - 1)).append(" ) "); + sb.append(" ) "); + sb.append(" and tao.marca_id = tarifa_oficial.marca_id "); + sb.append(" and tao.orgaoconcedente_id = tarifa_oficial.orgaoconcedente_id "); + sb.append(" and tao.orgaoconcedente_id = tepKm.orgaoconcedente_id "); + sb.append(" and tao.claseservicio_id=tarifa_oficial.claseservicio_id "); + sb.append(" and tao.moneda_id = tarifa_oficial.moneda_id "); + sb.append(" and tao.ruta_id = tarifa_oficial.ruta_id "); + sb.append(" and tao.tramo_id = tarifa_oficial.tramo_id "); + sb.append(" and tepKm.orgaoconcedente_id = tarifa_oficial.orgaoconcedente_id "); + if (idsEmpresas != null) { + sb.append(" and m.empresa_id in (-1,").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + } + sb.append(") "); + sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); + sb.append(" "); + sb.append("where "); + sb.append(" tarifa_oficial.activo = 1 "); + if (rutaId != null) { + sb.append(" and tarifa_oficial.ruta_id = ").append(rutaId); + } + if (orgaoConcedenteId != null) { + sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + + + return sb.toString(); + } + + @Override + public String getSQLAtualizarTaxaEmbarquePorKmOrgao(final Integer rutaId, final Integer usuarioId,final Integer orgaoConcedenteId, List idsEmpresas) { + StringBuilder sb = new StringBuilder(""); + sb.append("update tarifa_oficial set IMPORTETAXAEMBARQUE = "); + sb.append("coalesce( "); + sb.append("( "); + sb.append("select "); + sb.append(" tek.valorTaxa "); + sb.append(" "); + sb.append("from "); + sb.append(" tarifa_oficial tao "); + sb.append(" inner join tramo t on t.tramo_id = tao.tramo_id "); + sb.append(" inner join taxa_embarque_km tek on "); + sb.append(" tek.orgaoconcedente_id = tao.ORGAOCONCEDENTE_ID "); + sb.append(" and tek.activo = 1 and t.CANTKMREAL <= tek.kmate "); + sb.append(" inner join marca m on tao.marca_id = m.marca_id "); + sb.append("where "); + sb.append(" tek.kmate= "); + sb.append(" (select min(tek1.KMATE) "); + sb.append(" from "); + sb.append(" taxa_embarque_km tek1 "); + sb.append(" where "); + sb.append(" tek1.orgaoconcedente_id = tao.ORGAOCONCEDENTE_ID "); + sb.append(" and t.CANTKMREAL <= tek1.kmate and tek1.activo = 1 "); + sb.append(" ) "); + sb.append(" "); + sb.append(" and tao.marca_id = tarifa_oficial.marca_id "); + sb.append(" and tao.orgaoconcedente_id = tarifa_oficial.orgaoconcedente_id "); + sb.append(" and tao.orgaoconcedente_id = tek.orgaoconcedente_id "); + sb.append(" and tao.claseservicio_id=tarifa_oficial.claseservicio_id "); + sb.append(" and tao.moneda_id = tarifa_oficial.moneda_id "); + sb.append(" and tao.ruta_id = tarifa_oficial.ruta_id "); + sb.append(" and tao.tramo_id = tarifa_oficial.tramo_id "); + + if (idsEmpresas != null) { + sb.append(" and m.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + } + + sb.append("),IMPORTETAXAEMBARQUE) "); + sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); + sb.append(" "); + sb.append("where "); + sb.append(" tarifa_oficial.activo = 1 "); + + if (rutaId != null) { + sb.append(" and tarifa_oficial.ruta_id = ").append(rutaId); + } + + if (orgaoConcedenteId != null) { + sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + return sb.toString(); + } + + @Override + public String getSQLAtualizarTaxaEmbarquePorParadaFixo(final Integer rutaId, final Integer usuarioId,final Integer orgaoConcedenteId, List idsEmpresas) { + StringBuilder sb = new StringBuilder(""); + + sb.append("update tarifa_oficial set IMPORTETAXAEMBARQUE = "); + sb.append("coalesce( "); + sb.append("( "); + sb.append("select distinct "); + sb.append(" tepFixo.valorTaxa "); + sb.append(" "); + sb.append("from "); + sb.append(" tarifa_oficial tao "); + sb.append(" inner join tramo t on t.tramo_id = tao.tramo_id "); + sb.append(" inner join TAXA_EMBARQUE_PARADA tepFixo on "); + sb.append(" tepFixo.parada_id = t.origen_id and tepFixo.empresa_id in ("+obtemEmpresas(idsEmpresas)+" ) "); + sb.append(" and tepFixo.indtipo = 'F' and tepFixo.activo = 1 "); + sb.append(" inner join marca m on m.marca_id = tao.marca_id "); + sb.append("where "); + sb.append(" tao.marca_id = tarifa_oficial.marca_id "); + sb.append(" and (tao.orgaoconcedente_id = tepFixo.orgaoconcedente_id or tepFixo.orgaoconcedente_id in (-1, ").append(orgaoConcedenteId).append(")) "); + sb.append(" and tao.orgaoconcedente_id = tarifa_oficial.orgaoconcedente_id "); + sb.append(" and tao.claseservicio_id=tarifa_oficial.claseservicio_id "); + sb.append(" and tao.moneda_id = tarifa_oficial.moneda_id "); + sb.append(" and tao.ruta_id = tarifa_oficial.ruta_id "); + sb.append(" and tao.tramo_id = tarifa_oficial.tramo_id "); + sb.append(" and m.empresa_id in ("+obtemEmpresas(idsEmpresas)+" ) and tao.activo = 1 "); + sb.append("),IMPORTETAXAEMBARQUE) "); + sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); + sb.append(" "); + sb.append("where "); + sb.append(" tarifa_oficial.activo = 1 "); + if (rutaId != null) { + sb.append(" and tarifa_oficial.ruta_id = ").append(rutaId); + } + if (orgaoConcedenteId != null) { + sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + sb.append(" and tarifa_oficial.MARCA_ID in (select m2.marca_id from marca m2 where m2.activo = 1 and m2.empresa_id in (" +obtemEmpresas(idsEmpresas)+ " ) ) "); + return sb.toString(); + } + + private String obtemEmpresas(List idsEmpresas) { + if (idsEmpresas == null || idsEmpresas.contains(SELECAO_TODOS)) { + return Integer.toString(SELECAO_TODOS); + } + return idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1); + } + + @Override + public String getSQLAtualizarSeguroPorKm(final Integer rutaId, final Integer usuarioId, + final Integer orgaoConcedenteId, TipoSeguro tipoSeguro) { + StringBuilder sb = new StringBuilder(""); + if (tipoSeguro.equals(TipoSeguro.SEGURO)) { + sb.append("update tarifa_oficial set IMPORTESEGURO = "); + } else { + sb.append("update tarifa_oficial set IMPORTETPP = "); + } + sb.append("( "); + sb.append("select "); + sb.append(" sk.VALORTAXA "); + sb.append("from "); + sb.append(" tarifa_oficial tao "); + sb.append(" inner join tramo t on t.tramo_id = tao.tramo_id "); + sb.append(" inner join seguro_km sk on "); + sb.append(" sk.KMATE >= t.CANTKMREAL and sk.activo = 1 "); + sb.append(" and tao.ORGAOCONCEDENTE_ID = sk.ORGAOCONCEDENTE_ID "); + sb.append("where "); + sb.append(" sk.tipo_seguro = '").append(tipoSeguro).append("' and "); + sb.append(" sk.kmate= "); + sb.append(" (select min(sk1.KMATE) "); + sb.append(" from "); + sb.append(" seguro_km sk1 "); + sb.append(" where "); + sb.append(" sk1.KMATE >= t.CANTKMREAL and sk1.activo = 1 "); + sb.append(" and sk1.tipo_seguro = '").append(tipoSeguro).append("' "); + sb.append(" and tao.ORGAOCONCEDENTE_ID = sk1.ORGAOCONCEDENTE_ID "); + sb.append(" ) "); + sb.append(" and tao.marca_id = tarifa_oficial.marca_id "); + sb.append(" and tao.orgaoconcedente_id = tarifa_oficial.orgaoconcedente_id "); + sb.append(" and tao.claseservicio_id=tarifa_oficial.claseservicio_id "); + sb.append(" and tao.moneda_id = tarifa_oficial.moneda_id "); + sb.append(" and tao.ruta_id = tarifa_oficial.ruta_id "); + sb.append(" and tao.tramo_id = tarifa_oficial.tramo_id "); + sb.append(") "); + sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); + sb.append(" "); + sb.append("where "); + sb.append(" tarifa_oficial.activo = 1 "); + if (rutaId != null) { + sb.append(" and tarifa_oficial.ruta_id = ").append(rutaId); + } + if (orgaoConcedenteId != null) { + sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + + return sb.toString(); + } + + @Override + public String getSQLAtualizarPrecioPorTPP(final Integer rutaId, final Integer usuarioId, + final Integer orgaoConcedenteId, TipoSeguro tipoSeguro) { + StringBuilder sb = new StringBuilder(""); + sb.append("update tarifa_oficial set PRECIO = PRECIO + nvl(IMPORTETPP,0) "); + sb.append(" where "); + sb.append(" tarifa_oficial.activo = 1 "); + if (rutaId != null) { + sb.append(" and tarifa_oficial.ruta_id = ").append(rutaId); + } + if (orgaoConcedenteId != null) { + sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + + return sb.toString(); + } + + @Override + public String getSQLAtualizarSeguroPorTarifa(final Integer rutaId, final Integer usuarioId, + final Integer orgaoConcedenteId) { + StringBuilder sb = new StringBuilder(""); + sb.append("update tarifa_oficial set IMPORTESEGURO = "); + sb.append("( "); + sb.append("select "); + sb.append(" st.VALORTAXA "); + sb.append("from "); + sb.append(" tarifa_oficial tao "); + sb.append(" inner join seguro_tarifa st on "); + sb.append(" st.VALORTARIFAATE >= tao.precio and st.activo = 1 "); + sb.append(" and tao.ORGAOCONCEDENTE_ID = st.ORGAOCONCEDENTE_ID "); + sb.append("where "); + sb.append(" st.VALORTARIFAATE= "); + sb.append(" (select min(st1.VALORTARIFAATE) "); + sb.append(" from "); + sb.append(" seguro_tarifa st1 "); + sb.append(" where "); + sb.append(" st1.VALORTARIFAATE >= tao.precio and st1.activo = 1 "); + sb.append(" and tao.ORGAOCONCEDENTE_ID = st1.ORGAOCONCEDENTE_ID "); + sb.append(" ) "); + sb.append(" and tao.marca_id = tarifa_oficial.marca_id "); + sb.append(" and tao.orgaoconcedente_id = tarifa_oficial.orgaoconcedente_id "); + sb.append(" and tao.claseservicio_id=tarifa_oficial.claseservicio_id "); + sb.append(" and tao.moneda_id = tarifa_oficial.moneda_id "); + sb.append(" and tao.ruta_id = tarifa_oficial.ruta_id "); + sb.append(" and tao.tramo_id = tarifa_oficial.tramo_id "); + sb.append(") "); + sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); + sb.append(" "); + sb.append("where "); + sb.append(" tarifa_oficial.activo = 1 "); + + if (rutaId != null) { + sb.append(" and tarifa_oficial.ruta_id = ").append(rutaId); + } + if (orgaoConcedenteId != null) { + sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); + } + + return sb.toString(); + } + + @Override + public String getSQLSelecionarTarifaPorTarifaOficalParaAtualizar(final Integer vigenciaTarifaId, Empresa empresa, OrgaoConcedente orgao) { + StringBuilder sb = new StringBuilder(""); + + sb.append("SELECT tao.IMPORTEPEDAGIO AS \"taoimportepedagio\", "); + sb.append(" tao.PRECIO AS \"taoprecio\", "); + sb.append(" tao.PRECIOORIGINAL AS \"taopreciooriginal\", "); + sb.append(" tao.IMPORTETAXAEMBARQUE AS \"taoimportetaxaembarque\", "); + sb.append(" tao.IMPORTESEGURO AS \"taoimporteseguro\", "); + sb.append(" tao.IMPORTETPP AS \"taoimportetpp\", "); + sb.append(" tao.IMPORTEOUTROS AS \"taoimporteoutros\", "); + sb.append(" ta.TARIFA_ID AS \"tarifaId\" "); + + sb.append("FROM TARIFA_OFICIAL tao " ); + sb.append("INNER JOIN TARIFA ta ON (tao.MARCA_ID = ta.MARCA_ID "); + sb.append(" AND tao.CLASESERVICIO_ID = ta.CLASESERVICIO_ID "); + sb.append(" AND tao.TRAMO_ID = ta.TRAMO_ID "); + sb.append(" AND tao.MONEDA_ID = ta.MONEDA_ID "); + sb.append(" AND tao.RUTA_ID = ta.RUTA_ID "); + sb.append(" AND tao.ORGAOCONCEDENTE_ID = ta.ORGAOCONCEDENTE_ID "); + sb.append(" )"); + sb.append("INNER JOIN MARCA mTa ON tao.MARCA_ID = mTa.MARCA_ID "); + sb.append("INNER JOIN MARCA mTao ON ta.MARCA_ID = mTao.MARCA_ID "); + + sb.append("WHERE ta.VIGENCIATARIFA_ID = ").append(vigenciaTarifaId); + + if(orgao != null){ + sb.append(" AND tao.ORGAOCONCEDENTE_ID = ").append(orgao.getOrgaoConcedenteId()); + } + if(empresa != null){ + sb.append(" AND mTa.EMPRESA_ID = ").append(empresa.getEmpresaId()); + sb.append(" AND mTao.EMPRESA_ID = ").append(empresa.getEmpresaId()); + } + + return sb.toString(); + } + + @Override + public String getSQLAtualizarTarifaPorTarifaOfical(Map dados, Integer usuarioId, Boolean calculaPegagio, + Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP){ + + StringBuilder sb = new StringBuilder(""); + sb.append("UPDATE TARIFA SET "); + + if(calculaPegagio){ + sb.append("IMPORTEPEDAGIO=").append(dados.get("taoimportepedagio")).append(","); + } + if(calculaTarifa){ + sb.append("PRECIO=").append(dados.get("taoprecio")).append(",PRECIOORIGINAL=").append(dados.get("taopreciooriginal")).append(","); + } + if(calculaTaxaEmbarque){ + sb.append("IMPORTETAXAEMBARQUE=").append(dados.get("taoimportetaxaembarque")).append(","); + } + if(calculaSeguro){ + sb.append("IMPORTESEGURO=").append(dados.get("taoimporteseguro")).append(","); + } + if(calculaTPP){ + sb.append("IMPORTETPP=").append(dados.get("taoimportetpp")).append(","); + } + sb.append("IMPORTEOUTROS=").append(dados.get("taoimporteoutros")).append(","); + sb.append("FECMODIF= current_timestamp, USUARIO_ID=").append(usuarioId); + sb.append(" WHERE TARIFA_ID = ").append(dados.get("tarifaId")); + + return sb.toString(); + } + + @Override + public String getSQLInserirTarifaPelaTarifaOficial(final Integer vigenciaTarifaId, final Integer usuarioId, Empresa empresa, OrgaoConcedente orgao) { + StringBuilder sb = new StringBuilder(""); + sb.append(" insert "); + sb.append(" into "); + sb.append(" TARIFA "); + sb.append(" ( TARIFA_ID, PRECIO, PRECIOREDABIERTO, TRAMO_ID, "); + sb.append(" MARCA_ID, CLASESERVICIO_ID, PRECIOORIGINAL, MONEDA_ID, "); + sb.append(" VIGENCIATARIFA_ID, STATUSTARIFA, ACTIVO, FECMODIF, "); + sb.append(" USUARIO_ID, IMPORTETAXAEMBARQUE, IMPORTEPEDAGIO, IMPORTEOUTROS, "); + sb.append(" IMPORTESEGURO, IMPORTETPP, ORGAOCONCEDENTE_ID, RUTA_ID, ORIGEN_ID, DESTINO_ID ) "); + sb.append(" select "); + sb.append(" TARIFA_SEQ.nextval, "); + sb.append(" tao.PRECIO , "); + sb.append(" tao.PRECIOREDABIERTO , "); + sb.append(" tao.TRAMO_ID , "); + sb.append(" tao.MARCA_ID , "); + sb.append(" tao.CLASESERVICIO_ID , "); + sb.append(" tao.PRECIOORIGINAL , "); + sb.append(" tao.MONEDA_ID , "); + sb.append(" v.VIGENCIATARIFA_ID , "); + sb.append(" tao.STATUSTARIFA , "); + sb.append(" tao.ACTIVO , "); + sb.append(" current_timestamp , "); + sb.append(" ").append(usuarioId).append(", "); + sb.append(" tao.IMPORTETAXAEMBARQUE , "); + sb.append(" tao.IMPORTEPEDAGIO , "); + sb.append(" tao.IMPORTEOUTROS , "); + sb.append(" tao.IMPORTESEGURO , "); + sb.append(" tao.IMPORTETPP , "); + sb.append(" tao.ORGAOCONCEDENTE_ID , "); + sb.append(" tao.RUTA_ID , "); + sb.append(" tao.ORIGEN_ID , "); + sb.append(" tao.DESTINO_ID "); + sb.append(" from "); + sb.append(" TARIFA_OFICIAL tao, "); + sb.append(" VIGENCIA_TARIFA v, "); + sb.append(" MARCA m "); + sb.append(" where "); + sb.append(" m.MARCA_ID=tao.MARCA_ID "); + sb.append(" and tao.ACTIVO=1 "); + sb.append(" and v.VIGENCIATARIFA_ID=").append(vigenciaTarifaId).append(" "); + + if (orgao != null) { + sb.append(" and tao.ORGAOCONCEDENTE_ID=").append(orgao.getOrgaoConcedenteId()).append(" "); + } + if (empresa != null) { + sb.append(" and m.EMPRESA_ID=").append(empresa.getEmpresaId()).append(" "); + } + + sb.append(" and not (exists (select "); + sb.append(" tar.TARIFA_ID "); + sb.append(" from "); + sb.append(" TARIFA tar "); + sb.append(" where "); + sb.append(" tar.ACTIVO=1 "); + sb.append(" and tar.TRAMO_ID=tao.TRAMO_ID "); + sb.append(" and tar.MARCA_ID=tao.MARCA_ID "); + sb.append(" and tar.CLASESERVICIO_ID=tao.CLASESERVICIO_ID "); + sb.append(" and tar.MONEDA_ID=tao.MONEDA_ID "); + sb.append(" and tar.ORGAOCONCEDENTE_ID=tao.ORGAOCONCEDENTE_ID "); + sb.append(" and tar.RUTA_ID=tao.RUTA_ID "); + sb.append(" and tar.VIGENCIATARIFA_ID=").append(vigenciaTarifaId).append("))"); + + return sb.toString(); + } + + @Override + public String getSQLActualizarCorridaFecHusoFecVerano() { + + StringBuilder sb = new StringBuilder(); + + sb.append(" update Corrida cq "); + sb.append(" set cq.fechorSalidaOriginalH = "); + sb.append(" ( "); + sb.append(" select "); + sb.append(" c.fechorSalidaOriginal "); + sb.append(" + nvl((c.origem.ciudad.estado.tiempoHorHuso/").append(HORAS_NO_DIA).append("), 0) "); + sb.append(" + nvl( case when "); + sb.append(" c.fechorSalidaOriginal between "); + sb.append(" c.origem.ciudad.estado.fecInicioHorVerano "); + sb.append(" and c.origem.ciudad.estado.fecFinoHorVerano "); + sb.append(" then (c.origem.ciudad.estado.tiempoHorVerano/").append(HORAS_NO_DIA).append(") "); + sb.append(" else 0 end, 0) "); + sb.append(" from Corrida c "); + sb.append(" where c.id.corridaId in ( :corridaId ) "); + sb.append(" and c.id.feccorrida in ( :feccorrida ) "); + sb.append(" and c.id.corridaId = cq.id.corridaId "); + sb.append(" and c.id.feccorrida = cq.id.feccorrida "); + sb.append(" ) "); + sb.append(" where cq.id.corridaId in ( :corridaId ) "); + sb.append(" and cq.id.feccorrida in ( :feccorrida ) "); + + return sb.toString(); + } + + @Override + public String getSQLActualizarCorridaTramoFecHusoFecVerano() { + StringBuilder sb = new StringBuilder(); + + sb.append(" update CorridaTramo ctq "); + sb.append(" set ctq.fechorSalidaOriginalH = :fechorSalidaOriginalH, ctq.fechorsalidaH = :fechorsalidaH, ctq.fechorllegadaH = :fechorllegadaH"); + sb.append(" where ctq.corridatramoId = :corridatramoId "); + + return sb.toString(); + } + + @Override + public String getSQLBuscarCajaFecha(boolean yaCerrado, Date fechaDesde, Date fechaHasta) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + StringBuilder sb = new StringBuilder(""); + sb.append(" select "); + sb.append(" "); + sb.append(" c.CAJA_ID as \"cajaId\", "); + sb.append(" c.NUMASIENTO as \"numAsiento\", "); + sb.append(" c.CATEGORIA_ID as \"categoriaId\", "); + sb.append(" c.NUMFOLIOSISTEMA as \"numFolioSistema\", "); + sb.append(" c.CLASESERVICIO_ID as \"claseServicioId\", "); + sb.append(" c.MARCA_ID as \"marcaId\", "); + sb.append(" c.ORIGEN_ID as \"origenId\", "); + sb.append(" c.DESTINO_ID as \"destinoId\", "); + sb.append(" c.CORRIDA_ID as \"corridaId\", "); + sb.append(" c.FECCORRIDA as \"fecCorrida\", "); + sb.append(" c.NOMBPASAJERO as \"nombPasajero\", "); + sb.append(" c.PRECIOBASE as \"precioBase\", "); + sb.append(" c.PRECIOPAGADO as \"precioPagado\", "); + sb.append(" c.TIPOVENTA_ID as \"tipoVentaId\", "); + sb.append(" c.NUMSERIEPREIMPRESA as \"numSeriePreimpresa\", "); + sb.append(" c.NUMFOLIOPREIMPRESO as \"numFolioPreImpreso\", "); + sb.append(" c.FECHORVIAJE as \"fecHorViaje\", "); + sb.append(" c.FECHORVENTA as \"fecHorVenta\", "); + sb.append(" c.PUNTOVENTA_ID as \"puntoVentaId\", "); + sb.append(" pv.numpuntoventa as \"numPuntoVenta\", "); + sb.append(" c.NUMKMVIAJE as \"numKmViaje\", "); + sb.append(" c.NUMOPERACION as \"numOperacion\", "); + sb.append(" c.MOTIVOCANCELACION_ID as \"motivoCancelacionId\", "); + sb.append(" c.EMPRESAPUNTOVENTA_ID as \"empresaPuntoVentaId\", "); + sb.append(" c.EMPRESACORRIDA_ID as \"empresaCorridaId\", "); + sb.append(" c.TURNO_ID as \"turnoId\", "); + sb.append(" c.IMPORTETAXAEMBARQUE as \"importeTaxaEmbarque\", "); + sb.append(" c.IMPORTEPEDAGIO as \"importePedagio\", "); + sb.append(" c.IMPORTEOUTROS as \"importeOutros\", "); + sb.append(" c.IMPORTESEGURO as \"importeSeguro\", "); + sb.append(" co.ruta_id as \"rutaId\", "); + sb.append(" c.usuario_id as \"usuarioId\", "); + sb.append(" ct.numautorizacion as \"numAutorizacion\", "); + sb.append(" (case when cfp.formapago_id = 11 then cdp.numdocumento else null end) as \"ordenSevicio\" "); + sb.append(" "); + sb.append(" from "); + sb.append(" caja c "); + sb.append(" left join corrida co on co.corrida_id = c.corrida_id and co.feccorrida = c.feccorrida "); + sb.append(" left join caja_formapago cfp on cfp.caja_id = c.caja_id "); + sb.append(" left join caja_det_pago cdp on cdp.cajaformapago_id = cfp.cajaformapago_id "); + sb.append(" left join caja_tarjeta ct on ct.cajadetpago_id = cdp.cajadetpago_id "); + sb.append(" left join punto_venta pv on pv.puntoventa_id = c.puntoventa_id "); + sb.append(" "); + sb.append(" where "); + sb.append(" trunc(fechorventa) between to_date('").append(sdf.format(fechaDesde)).append("','yyyy-MM-dd') and ").append(" to_date('").append(sdf.format(fechaHasta)).append("','yyyy-MM-dd')"); + sb.append(" and c.feccorte ").append(yaCerrado ? " is not null" : " is null "); + sb.append(" "); + sb.append(" order by c.fechorventa,c.usuario_id,c.caja_id asc "); + + return sb.toString(); + } + + @Override + public String getSQLBuscarDatosCaja(Date fechaDesde, Date fechaHasta, Boolean sembilhetesPacote) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + StringBuilder sb = new StringBuilder(""); + + sb.append(" select "); + sb.append(" "); + sb.append(" c.CAJA_ID as \"cajaId\", "); + sb.append(" c.NUMASIENTO as \"numAsiento\", "); + sb.append(" c.CATEGORIA_ID as \"categoriaId\", "); + sb.append(" c.NUMFOLIOSISTEMA as \"numFolioSistema\", "); + sb.append(" c.CLASESERVICIO_ID as \"claseServicioId\", "); + sb.append(" c.MARCA_ID as \"marcaId\", "); + sb.append(" c.ORIGEN_ID as \"origenId\", "); + sb.append(" c.DESTINO_ID as \"destinoId\", "); + sb.append(" c.CORRIDA_ID as \"corridaId\", "); + sb.append(" c.FECCORRIDA as \"fecCorrida\", "); + sb.append(" c.NOMBPASAJERO as \"nombPasajero\", "); + sb.append(" c.PRECIOBASE as \"precioBase\", "); + sb.append(" c.PRECIOPAGADO as \"precioPagado\", "); + sb.append(" c.TIPOVENTA_ID as \"tipoVentaId\", "); + sb.append(" c.NUMSERIEPREIMPRESA as \"numSeriePreimpresa\", "); + sb.append(" c.NUMFOLIOPREIMPRESO as \"numFolioPreImpreso\", "); + sb.append(" c.FECHORVIAJE as \"fecHorViaje\", "); + sb.append(" c.FECHORVENTA as \"fecHorVenta\", "); + sb.append(" c.PUNTOVENTA_ID as \"puntoVentaId\", "); + sb.append(" pv.numpuntoventa as \"numPuntoVenta\", "); + sb.append(" c.NUMKMVIAJE as \"numKmViaje\", "); + sb.append(" c.NUMOPERACION as \"numOperacion\", "); + sb.append(" c.MOTIVOCANCELACION_ID as \"motivoCancelacionId\", "); + sb.append(" c.EMPRESAPUNTOVENTA_ID as \"empresaPuntoVentaId\", "); + sb.append(" c.EMPRESACORRIDA_ID as \"empresaCorridaId\", "); + sb.append(" c.TURNO_ID as \"turnoId\", "); + sb.append(" c.IMPORTETAXAEMBARQUE as \"importeTaxaEmbarque\", "); + sb.append(" c.IMPORTEPEDAGIO as \"importePedagio\", "); + sb.append(" c.IMPORTEOUTROS as \"importeOutros\", "); + sb.append(" c.IMPORTESEGURO as \"importeSeguro\", "); + sb.append(" co.ruta_id as \"rutaId\", "); + sb.append(" c.usuario_id as \"usuarioId\", "); + sb.append(" ct.numautorizacion as \"numAutorizacion\", "); + sb.append(" ct.tipotarjeta as \"tipotarjeta\", "); + sb.append(" ct.cantparcelas as \"cantparcelas\", "); + sb.append(" ct.numtarjeta as \"numtarjeta\", "); + sb.append(" ct.fecoperacion as \"fecoperacion\", "); + sb.append(" ct.nombtitular as \"nombtitular\", "); + sb.append(" fp.DESCPAGO as \"descPago\", "); + sb.append(" fp.formapago_id as \"formaPagoId\", "); + sb.append(" cfp.importe as \"vlrFormaPago\", "); + sb.append(" ca.CVECATEGORIA as \"cveCategoria\", "); + sb.append(" mc.DESCMOTIVO as \"descMotivo\", "); + sb.append(" (case when cfp.formapago_id = 11 then cdp.numdocumento else null end) as \"ordenSevicio\", "); + sb.append(" C.TRANSACAO_ID as \"transacaoId\", C.TRANSACAOORIGINAL_ID as \"transacaooriginalId\", "); + sb.append(" C.DESCNUMDOC as \"descnumdoc\", C.DESCNUMDOC2 as \"descnumdoc2\", C.DESCTIPODOC as \"desctipodoc\", "); + sb.append(" C.DESCTIPODOC2 as \"desctipodoc2\", C.DESCTELEFONO as \"desctelefono\", "); + sb.append(" ocd.ocd_id as \"ocdId\", ocd.numoperacion as \"numoperacionOcd\", "); + sb.append(" cdp.notacreditovendapacote_id as \"notacreditovendapacoteId\", "); + sb.append(" ct.descoperadoracartao as \"operadoracartao\", "); + sb.append(" sec.cvesecretaria as \"cvesecretaria\", "); + sb.append(" fp.tipo_pago as \"tipoPago\", "); + sb.append(" NVL(c.INDENCARGOVENTA,0) as \"indEncargoVenta\", "); + sb.append(" con.cveconvenio as \"cveconvenio\", "); + sb.append(" con.descconvenio as \"descconvenio\", "); + sb.append(" sec.descsecretaria as \"descsecretaria\" "); + sb.append(" from "); + sb.append(" caja c "); + sb.append(" left join corrida co on co.corrida_id = c.corrida_id and co.feccorrida = c.feccorrida "); + sb.append(" left join caja_formapago cfp on cfp.caja_id = c.caja_id "); + sb.append(" left join caja_det_pago cdp on cdp.cajaformapago_id = cfp.cajaformapago_id "); + sb.append(" left join caja_tarjeta ct on ct.cajadetpago_id = cdp.cajadetpago_id "); + sb.append(" left join punto_venta pv on pv.puntoventa_id = c.puntoventa_id "); + sb.append(" inner join forma_pago fp on fp.formapago_id = cfp.FORMAPAGO_ID "); + sb.append(" inner join categoria ca on ca.categoria_id = c.categoria_id "); + sb.append(" left join motivo_cancelacion mc on mc.motivocancelacion_id = c.motivocancelacion_id "); + sb.append(" left join ocd ocd on ocd.ocd_id = cdp.ocd_id "); + sb.append(" left join secretaria sec on sec.secretaria_id = cdp.opcional1 "); + sb.append(" left join convenio_det cDet on cDet.conveniodet_id = c.conveniodet_id "); + sb.append(" left join convenio con on con.convenio_id = cDet.convenio_id "); + sb.append(" "); + sb.append(" where "); + sb.append(" trunc(fechorventa) between to_date('").append(sdf.format(fechaDesde)).append("','yyyy-MM-dd') and ").append(" to_date('").append(sdf.format(fechaHasta)).append("','yyyy-MM-dd')"); + + if (sembilhetesPacote != null && sembilhetesPacote) { + sb.append("and fp.tipo_pago != ") + .append(TipoFormapago.PACOTE.getValor()) + .append("and (c.motivocancelacion_id is null or c.motivocancelacion_id != ") + .append(Constantes.MVO_CANCEL_VENDA_PACOTE.intValue()) + .append(" ) "); + } + + sb.append(" order by c.fechorventa,c.usuario_id,c.caja_id asc "); + + return sb.toString(); + } + + @Override + public String getSQLBuscarUsuariosCajaCerrado(Date fecha, String cveusuario, String turnoid) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + StringBuilder sb = new StringBuilder(""); + sb.append(" select distinct "); + sb.append(" "); + sb.append(" u.usuario_id as \"usuarioId\", "); + sb.append(" u.cveusuario as \"cveusuario\", "); + sb.append(" c.PUNTOVENTA_ID as \"puntoVentaId\", "); + sb.append(" pv.numpuntoventa as \"numPuntoVenta\", "); + sb.append(" c.FECCORTE as \"fecCorte\", "); + sb.append(" c.TURNO_ID as \"turnoId\", "); + sb.append(" (select sum(importe) from conta_corrente_ptovta ccpv where ccpv.puntoventa_id = c.puntoventa_id and ccpv.usuario_id = c.usuario_id and ccpv.feccorte = c.feccorte and ccpv.turno_id = c.turno_id) as \"importeTotal\""); + sb.append(" "); + sb.append(" from "); + sb.append(" caja c "); + sb.append(" left join usuario u on c.usuario_id = u.usuario_id "); + sb.append(" left join punto_venta pv on pv.puntoventa_id = c.puntoventa_id "); + sb.append(" "); + sb.append(" where "); + sb.append(" trunc(c.feccorte) = to_date('").append(sdf.format(fecha)).append("','yyyy-MM-dd')"); + + if (!cveusuario.equals("*")) { + sb.append(" and u.cveusuario like '" + cveusuario + "'"); + } + + if (!turnoid.equals("*")) { + sb.append(" and c.turno_id in(" + turnoid + ")"); + } else { + sb.append(" and c.turno_id is not null"); + } + + return sb.toString(); + } + + @Override + public String getSQLBuscarCajaCerrado(Integer usuarioId, Date fecha, String turnoid) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + + StringBuilder sb = new StringBuilder(""); + sb.append(" select "); + sb.append(" c.CAJA_ID as \"cajaId\", "); + sb.append(" c.NUMFOLIOSISTEMA as \"numFolioSistema\", "); + sb.append(" ori.descparada as \"origen\", "); + sb.append(" des.descparada as \"destino\", "); + sb.append(" c.CORRIDA_ID as \"corridaId\", "); + sb.append(" (case when c.motivocancelacion_id is null then cfp.importe else cfp.importe * -1 end) as \"precioPagado\", "); + sb.append(" c.FECHORVENTA as \"fecHorVenta\", "); + sb.append(" (case when c.motivocancelacion_id is null then c.IMPORTETAXAEMBARQUE else c.IMPORTETAXAEMBARQUE * -1 end) as \"importeTaxaEmbarque\", "); + sb.append(" ru.descruta as \"ruta\", "); + sb.append(" nvl(ct.numautorizacion, c.numoperacion) as \"numAutorizacion\", "); + sb.append(" (case when cfp.formapago_id = 11 then cdp.numdocumento else null end) as \"ordenSevicio\", "); + sb.append(" s.descsecretaria as \"secretaria\", "); + sb.append(" s.CVESECRETARIA as \"cvesecretaria\", "); + sb.append(" (case when fp.formapago_id = " + RED_PAGO_FORMAPAGO_ID).append(" then '" + RED_PAGO_EMISSOR_TARJETA + "' else ct.tipotarjeta end) as \"emissorTarjeta\", "); + sb.append(" cat.DESCCATEGORIA as \"tipoPasaje\", "); + sb.append(" (case when fp.formapago_id = " + RED_PAGO_FORMAPAGO_ID).append(" then '" + RED_PAGO_FORMA_PAGO + "' else fp.cvepago end) as \"formaPago\" "); + sb.append(" from "); + sb.append(" caja c "); + sb.append(" left join caja_formapago cfp on cfp.caja_id = c.caja_id "); + sb.append(" left outer join forma_pago fp on fp.formapago_id = cfp.formapago_id "); + sb.append(" left join caja_det_pago cdp on cdp.cajaformapago_id = cfp.cajaformapago_id "); + sb.append(" left join caja_tarjeta ct on ct.cajadetpago_id = cdp.cajadetpago_id "); + sb.append(" left join categoria cat on cat.categoria_id = c.categoria_id "); + sb.append(" left join secretaria s on s.secretaria_id = cdp.opcional1 "); + sb.append(" left join ruta ru on ru.ruta_id = c.ruta_id "); + sb.append(" left join parada ori on ori.parada_id = c.origen_id "); + sb.append(" left join parada des on des.parada_id = c.destino_id "); + sb.append(" where "); + sb.append(" trunc(c.feccorte) = to_date('").append(sdf.format(fecha)).append("','yyyy-MM-dd')"); + sb.append(" and c.usuario_id = ").append(usuarioId); + if (!turnoid.equals("*")) { + sb.append(" and c.turno_id in(" + turnoid + ")"); + } else { + sb.append(" and c.turno_id is not null"); + } + sb.append(" and c.indreimpresion = 0"); + sb.append(" order by c.CAJA_ID"); + + return sb.toString(); + } + + @Override + public String getSQLBuscarReceitasDespesasCaja(Integer usuarioId, Date fec) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + StringBuilder sb = new StringBuilder(""); + sb.append(" select "); + sb.append(" "); + sb.append(" c.precio as \"precio\", "); + sb.append(" t.desctipoevento as \"tipoEvento\" "); + sb.append(" "); + sb.append(" from "); + sb.append(" caja_diversos c "); + sb.append(" left join evento_extra e on c.eventoextra_id = e.eventoextra_id "); + sb.append(" left join tipo_evento_extra t on t.tipoeventoextra_id = e.tipoeventoextra_id "); + sb.append(" "); + sb.append(" where "); + sb.append(" c.feccorte = to_date('").append(sdf.format(fec)).append("','yyyy-MM-dd')"); + sb.append(" and c.turno_id is not null and c.usuario_id = ").append(usuarioId); + + return sb.toString(); + } + + @Override + public String getSQLBuscarUsuariosActivo() { + StringBuilder sb = new StringBuilder(""); + + sb.append(" select distinct"); + sb.append(" u.usuario_id as \"usuarioId\","); + sb.append(" u.cveusuario as \"cveusuario\","); + sb.append(" u.NOMBUSUARIO||' '||u.NOMBPATERNO||' '||u.NOMBMATERNO as \"nombusuario\""); + sb.append(" from"); + sb.append(" usuario u"); + sb.append(" where"); + sb.append(" u.activo = 1"); + sb.append(" order by"); + sb.append(" u.usuario_id"); + + return sb.toString(); + } + + @Override + public String getSQLInserirCajaVendaEmbarcada() { + StringBuilder sb = new StringBuilder(); + + sb.append("insert into caja "); + sb.append("(caja_id, numasiento, categoria_id,numfoliosistema,claseservicio_id, marca_id, origen_id, destino_id, corrida_id, feccorrida,nombpasajero, preciobase, "); + sb.append("preciopagado,descuentoamparado, tipoventa_id, numseriepreimpresa, numfoliopreimpreso, fechorviaje, fechorventa, puntoventa_id,numkmviaje, numoperacion,"); + sb.append("indstatusoperacion,motivocancelacion_id, motivoreimpresion_id, cantpuntos, empresapuntoventa_id, empresacorrida_id, numreservacion, turno_id,"); + sb.append("indstatusboleto,indcancelacion, indreimpresion,indviajeredondo, feccorte, indextraviado, paridad, feccreacion, conveniodet_id, moneda_id, estacion_id,"); + sb.append("indreplica, usuarioautorizacion_id, tipoidentificacion_id, numidentificacion,clientefidelidad_id, opcional1, opcional2, opcional3, preciocargoextra,"); + sb.append("preciopricing, cajaoriginal_id, usuarioremoto_id, puntoventaremoto_id, numdocdescuento, canttransferencia,activo, fecmodif, usuario_id, nodo_id,"); + sb.append("porccategoria,importecategoria, cliente_id, pagorecaudacion_id, pagorecaudacion2_id, importetaxaembarque, importepedagio, importeoutros,"); + sb.append("importeseguro, indconexion, levante_id, ruta_id, serieimpfiscal, fecintegracion, ptovtaventa_id, indremotoinverso, fecnacimiento)"); + sb.append("values ("); + sb.append(":cajaId,:numAsiento,:categoriaId,null,:claseServicioId,:marcaId,:origemId,:destinoId,:corridaId,:fecCorrida,null,:precioBase,"); + sb.append(":precioPagado,null, :tipoVentaId, null, :numFolioPreimpresso, :fechorViaje, :fechorVenta, :puntoVentaId,null, :numOperacion,"); + sb.append("'F',null, null, null, :empresaPuntoVentaId, :empresaCorridaId, null, null,"); + sb.append("'V', 0, 0, 0, null, 0, null, :fecCreacion, null, null, :estacionId,"); + sb.append("0, null, null, null,null, null, null, null, null,"); + sb.append("null, null, null, null, null, null, 1, :fecModIf, :usuarioId, 1,"); + sb.append("null, null, null, null, null, :importeTaxaEmbarque, :importePedagio, :importeOutros,"); + sb.append(":importeSeguro, 0, null, :rutaId, :serieImpFiscal, null, null, 0, null)"); + + return sb.toString(); + } + + @Override + public String getSQLInserirCajaFormaPagoVendaEmbarcada() { + StringBuilder sb = new StringBuilder(); + + sb.append("insert into caja_formapago "); + sb.append("(formapago_id, caja_id, importe, activo, fecmodif, usuario_id, indreplica, nodo_id, cajaformapago_id) values "); + sb.append("(:formaPagoId, :cajaId, :importe, 1, :fecModIf, :usuarioId, null, 1, :cajaFormaPagoId)"); + + return sb.toString(); + } + + @Override + public String getSQLInserirBoletoVendaEmbarcada() { + StringBuilder sb = new StringBuilder(); + + sb.append("insert into boleto "); + sb.append("(empresacorrida_id, destino_id, tipoventa_id, categoria_id, motivoreimpresion_id, claseservicio_id, corrida_id, feccorrida, puntoventa_id,"); + sb.append("empresapuntoventa_id, turno_id, motivocancelacion_id, origen_id, marca_id, conveniodet_id, cliente_id, numasiento, numfoliosistema,"); + sb.append("nombpasajero,fecnacimiento,preciopagado,paridad, numseriepreimpresa, numfoliopreimpreso, fechorviaje, fechorventa, numkmviaje, numoperacion,"); + sb.append("indstatusoperacion, cantpuntos, numreservacion, indstatusboleto, indcancelacion, indreimpresion, indviajeredondo, feccreacion, activo,"); + sb.append("indconexion, fecmodif, usuario_id, usuarioautorizacion_id, tipoidentificacion_id, numidentificacion, indextraviado, preciobase, entregaboleto_id,"); + sb.append("opcional1,opcional2, opcional3, descuentoamparado, moneda_id, estacion_id, usuarioremoto_id, puntoventaremoto_id, preciocargoextra, nodo_id,"); + sb.append("indreplica, numdocdescuento, canttransferencia, porccategoria, preciopricing, importecategoria, boletooriginal_id, importetaxaembarque,"); + sb.append("importepedagio, importeoutros, importeseguro, desctipodoc, desctipodoc2, descnumdoc, descnumdoc2, tipoidentificaciondoc_id, descorgaodoc,"); + sb.append("NUMFIDELIDAD, INFOPASAJERO, LEVANTE_ID, ESTADOFOLIO_ID, RUTA_ID, DESCCORREO, DESCTELEFONO, SERIEIMPFISCAL,NUMASIENTOVINCULADO, BOLETO_ID) values "); + + sb.append("(:empresaCorridaId, :destinoId, :tipoVentaId, :categoriaId, null, :claseServicioId, :corridaId, :fecCorrida, :puntoVentaId, "); + sb.append(":empresaPuntoVentaId, null, null, :origemId, :marcaId, null, null, :numAsiento, null,"); + sb.append("null,null,:precioPagado,null,null, :numFolioPreimpresso, :fechorViaje, :fechorVenta, null, :numOperacion,"); + sb.append("'F', null, null, 'V', 0, 0, 0, null, 1,"); + sb.append("0, :fecModIf, :usuarioId,null, null, null, 0, :precioBase, null,"); + sb.append("null,null, null, null, null, :estacionId, null, null, null,1,"); + sb.append("0, null, null, null, :precioPricing, null, null, :importeTaxaEmbarque,"); + sb.append(":importePedagio, :importeOutros, :importeSeguro, null, null, null, null, null, null,"); + sb.append("null, null, null, null, :rutaId, null, null, :serieImpFiscal, null, :boletoId)"); + + return sb.toString(); + } + + @Override + public String getSQLInserirBoletoFormaPagoVendaEmbarcada() { + StringBuilder sb = new StringBuilder(); + + sb.append("insert into boleto_formapago "); + sb.append("(formapago_id, boleto_id, importe, fecmodif, usuario_id, activo, indreplica, nodo_id, boletoformapago_id) values "); + sb.append("(:formaPagoId, :boletoId, :importe, :fecModIf, :usuarioId, 1, 0, 1,:boletoFormaPagoId)"); + + return sb.toString(); + } + + @Override + public String getSQLObterSequenceBoletoFormaPago() { + return "select boleto_formapago_seq.nextval from dual"; + } + + @Override + public String getSQLObterSequenceCajaFormaPago() { + return "select caja_formapago_seq.nextval from dual"; + } + + @Override + public String getSQLObterSequenceBoleto() { + return "select boleto_seq.nextval from dual"; + } + + @Override + public String getSQLObterSequenceCaja() { + return "select caja_seq.nextval from dual"; + } + + @Override + public String getSQLObterSequenciaNumOperacion() { + return "select numeoperacion_seq.nextval from dual"; + } + + @Override + public String getSQLInserirTarifaEmbarcadaPelaTarifaOficial(final Integer vigenciaTarifaId, final Integer usuarioId, Empresa empresa, OrgaoConcedente orgao) { + StringBuilder sb = new StringBuilder(""); + sb.append(" insert "); + sb.append(" into "); + sb.append(" TARIFA_EMBARCADA "); + sb.append(" ( TARIFAEMBARCADA_ID, PRECIO, PRECIOREDABIERTO, TRAMO_ID, "); + sb.append(" MARCA_ID, CLASESERVICIO_ID, PRECIOORIGINAL, MONEDA_ID, "); + sb.append(" VIGENCIATARIFA_ID, STATUSTARIFA, ACTIVO, FECMODIF, "); + sb.append(" USUARIO_ID, IMPORTETAXAEMBARQUE, IMPORTEPEDAGIO, IMPORTEOUTROS, "); + sb.append(" IMPORTESEGURO, IMPORTETPP, ORGAOCONCEDENTE_ID, RUTA_ID, ORIGEN_ID, DESTINO_ID ) "); + sb.append(" select "); + sb.append(" TARIFA_EMBARCADA_SEQ.nextval, "); + sb.append(" tao.PRECIO , "); + sb.append(" tao.PRECIOREDABIERTO , "); + sb.append(" tao.TRAMO_ID , "); + sb.append(" tao.MARCA_ID , "); + sb.append(" tao.CLASESERVICIO_ID , "); + sb.append(" tao.PRECIOORIGINAL , "); + sb.append(" tao.MONEDA_ID , "); + sb.append(" v.VIGENCIATARIFA_ID , "); + sb.append(" tao.STATUSTARIFA , "); + sb.append(" tao.ACTIVO , "); + sb.append(" current_timestamp , "); + sb.append(" ").append(usuarioId).append(", "); + sb.append(" tao.IMPORTETAXAEMBARQUE , "); + sb.append(" tao.IMPORTEPEDAGIO , "); + sb.append(" tao.IMPORTEOUTROS , "); + sb.append(" tao.IMPORTESEGURO , "); + sb.append(" tao.IMPORTETPP , "); + sb.append(" tao.ORGAOCONCEDENTE_ID , "); + sb.append(" tao.RUTA_ID , "); + sb.append(" tao.ORIGEN_ID , "); + sb.append(" tao.DESTINO_ID "); + sb.append(" from "); + sb.append(" TARIFA_OFICIAL tao, "); + sb.append(" VIGENCIA_TARIFA v, "); + sb.append(" MARCA m "); + sb.append(" where "); + sb.append(" m.MARCA_ID=tao.MARCA_ID "); + sb.append(" and tao.ACTIVO=1 "); + sb.append(" and v.VIGENCIATARIFA_ID=").append(vigenciaTarifaId).append(" "); + + if (orgao != null) { + sb.append(" and tao.ORGAOCONCEDENTE_ID=").append(orgao.getOrgaoConcedenteId()).append(" "); + } + if (empresa != null) { + sb.append(" and m.EMPRESA_ID=").append(empresa.getEmpresaId()).append(" "); + } + + sb.append(" and not (exists (select "); + sb.append(" tar.TARIFAEMBARCADA_ID "); + sb.append(" from "); + sb.append(" TARIFA_EMBARCADA tar "); + sb.append(" where "); + sb.append(" tar.ACTIVO=1 "); + sb.append(" and tar.TRAMO_ID=tao.TRAMO_ID "); + sb.append(" and tar.MARCA_ID=tao.MARCA_ID "); + sb.append(" and tar.CLASESERVICIO_ID=tao.CLASESERVICIO_ID "); + sb.append(" and tar.MONEDA_ID=tao.MONEDA_ID "); + sb.append(" and tar.ORGAOCONCEDENTE_ID=tao.ORGAOCONCEDENTE_ID "); + sb.append(" and tar.RUTA_ID=tao.RUTA_ID "); + sb.append(" and tar.VIGENCIATARIFA_ID=").append(vigenciaTarifaId).append("))"); + + return sb.toString(); + } + + @Override + public String getSQLSelecionarTarifaEmbarcadaPorTarifaOficalParaAtualizar(final Integer vigenciaTarifaId, Empresa empresa, OrgaoConcedente orgao) { + StringBuilder sb = new StringBuilder(""); + + sb.append("SELECT tao.IMPORTEPEDAGIO AS \"taoimportepedagio\", "); + sb.append(" tao.PRECIO AS \"taoprecio\", "); + sb.append(" tao.PRECIOORIGINAL AS \"taopreciooriginal\", "); + sb.append(" tao.IMPORTETAXAEMBARQUE AS \"taoimportetaxaembarque\", "); + sb.append(" tao.IMPORTESEGURO AS \"taoimporteseguro\", "); + sb.append(" tao.IMPORTETPP AS \"taoimportetpp\", "); + sb.append(" tao.IMPORTEOUTROS AS \"taoimporteoutros\", "); + sb.append(" ta.TARIFAEMBARCADA_ID AS \"tarifaId\" "); + + sb.append("FROM TARIFA_OFICIAL tao " ); + sb.append("INNER JOIN TARIFA_EMBARCADA ta ON (tao.MARCA_ID = ta.MARCA_ID "); + sb.append(" AND tao.CLASESERVICIO_ID = ta.CLASESERVICIO_ID "); + sb.append(" AND tao.TRAMO_ID = ta.TRAMO_ID "); + sb.append(" AND tao.MONEDA_ID = ta.MONEDA_ID "); + sb.append(" AND tao.RUTA_ID = ta.RUTA_ID "); + sb.append(" AND tao.ORGAOCONCEDENTE_ID = ta.ORGAOCONCEDENTE_ID "); + sb.append(" )"); + sb.append("INNER JOIN MARCA mTa ON tao.MARCA_ID = mTa.MARCA_ID "); + sb.append("INNER JOIN MARCA mTao ON ta.MARCA_ID = mTao.MARCA_ID "); + + sb.append("WHERE ta.VIGENCIATARIFA_ID = ").append(vigenciaTarifaId); + + if(orgao != null){ + sb.append(" AND tao.ORGAOCONCEDENTE_ID = ").append(orgao.getOrgaoConcedenteId()); + } + if(empresa != null){ + sb.append(" AND mTa.EMPRESA_ID = ").append(empresa.getEmpresaId()); + sb.append(" AND mTao.EMPRESA_ID = ").append(empresa.getEmpresaId()); + } + + return sb.toString(); + } + + @Override + public String getSQLAtualizarTarifaEmbarcadaPorTarifaOfical(Map dados, Integer usuarioId, Boolean calculaPegagio, + Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP){ + + StringBuilder sb = new StringBuilder(""); + sb.append("UPDATE TARIFA_EMBARCADA SET "); + + if(calculaPegagio){ + sb.append("IMPORTEPEDAGIO=").append(dados.get("taoimportepedagio")).append(","); + } + if(calculaTarifa){ + sb.append("PRECIO=").append(dados.get("taoprecio")).append(",PRECIOORIGINAL=").append(dados.get("taopreciooriginal")).append(","); + } + if(calculaTaxaEmbarque){ + sb.append("IMPORTETAXAEMBARQUE=").append(dados.get("taoimportetaxaembarque")).append(","); + } + if(calculaSeguro){ + sb.append("IMPORTESEGURO=").append(dados.get("taoimporteseguro")).append(","); + } + if(calculaTPP){ + sb.append("IMPORTETPP=").append(dados.get("taoimportetpp")).append(","); + } + sb.append("IMPORTEOUTROS=").append(dados.get("taoimporteoutros")).append(","); + sb.append("FECMODIF= current_timestamp, USUARIO_ID=").append(usuarioId); + sb.append(" WHERE TARIFAEMBARCADA_ID = ").append(dados.get("tarifaId")); + + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/util/AidfGenerator.java b/src/com/rjconsultores/ventaboletos/dao/util/AidfGenerator.java new file mode 100644 index 000000000..9a969eb61 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/util/AidfGenerator.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.dao.util; + +import java.io.Serializable; + +import org.apache.log4j.Logger; +import org.hibernate.HibernateException; +import org.hibernate.engine.SessionImplementor; +import org.hibernate.id.IdentifierGenerator; +/** + * Classe que trata a geração do ID da tabela Aidf. + * + * Foi abandonado o uso da sequence pois existiam lacunas nos numeros e já havia atingido o tamanho máximo de 3 dígitos, com isso + * sendo necessário aproveitar os número que não haviam sido utilizados + * + * @author gleimar + * + */ +public class AidfGenerator implements IdentifierGenerator { + + private static Logger log = Logger.getLogger(AidfGenerator.class); + + @Override + public Serializable generate(SessionImplementor session, Object object) throws HibernateException { + + log.info("Inicio geração Idaidf"); + Serializable nextId = IdAidfStore.getInstance().getNextId(session.connection()); + log.info("Fim geração Idaidf:" + nextId); + + return nextId; + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/util/ClaseServicioGenerator.java b/src/com/rjconsultores/ventaboletos/dao/util/ClaseServicioGenerator.java new file mode 100644 index 000000000..37bea37dd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/util/ClaseServicioGenerator.java @@ -0,0 +1,23 @@ +package com.rjconsultores.ventaboletos.dao.util; + +import java.io.Serializable; + +import org.apache.log4j.Logger; +import org.hibernate.HibernateException; +import org.hibernate.engine.SessionImplementor; +import org.hibernate.id.IdentifierGenerator; + +public class ClaseServicioGenerator implements IdentifierGenerator { + private static Logger log = Logger.getLogger(ClaseServicioGenerator.class); + + @Override + public Serializable generate(SessionImplementor session, Object object) throws HibernateException { + // TODO Auto-generated method stub + log.info("Inicio geração ClaseServicioID"); + Serializable nextId = ClaseServicioStore.getInstance().getNextId(session.connection()); + log.info("Fim geração ClaseServicioID:" + nextId); + + return nextId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/util/ClaseServicioStore.java b/src/com/rjconsultores/ventaboletos/dao/util/ClaseServicioStore.java new file mode 100644 index 000000000..016a8cc21 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/util/ClaseServicioStore.java @@ -0,0 +1,54 @@ +package com.rjconsultores.ventaboletos.dao.util; + +import java.io.Serializable; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.log4j.Logger; +import org.hibernate.HibernateException; + +public class ClaseServicioStore { + + private static Logger log = Logger.getLogger(ClaseServicioStore.class); + private static ClaseServicioStore INSTANCE = new ClaseServicioStore(); + protected int qtdMaxima = 99; + + private ClaseServicioStore() { + + } + + public static ClaseServicioStore getInstance() { + return INSTANCE; + } + + public synchronized Serializable getNextId(Connection connection) throws HibernateException { + + log.info(String.format("qtdMaxima:%s", qtdMaxima)); + Integer idEncontrado = 0; + PreparedStatement ps; + + try { + ps = connection.prepareStatement("select min(a.CLASESERVICIO_ID) as idEncontrado from CLASE_SERVICIO a left join CLASE_SERVICIO b on b.CLASESERVICIO_ID = (a.CLASESERVICIO_ID +1) where b.CLASESERVICIO_ID is null and a.CLASESERVICIO_ID<>-1"); + ResultSet rs = ps.executeQuery(); + rs.next(); + idEncontrado = rs.getInt("idEncontrado"); + if (idEncontrado == null) + idEncontrado = 1; + + } catch (SQLException e) { + log.error("erro ao buscar id clase_servicio", e); + throw new HibernateException(e); + } + + log.info("indiceAtual=" + idEncontrado); + idEncontrado = idEncontrado + 1; + log.info("idEncontrado=" + idEncontrado); + if (idEncontrado > qtdMaxima) { + throw new HibernateException("A qtd de IDs permitidos para clase_servicio foi atingido:" + qtdMaxima); + } + return idEncontrado; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/util/DBUtil.java b/src/com/rjconsultores/ventaboletos/dao/util/DBUtil.java new file mode 100644 index 000000000..415606d9c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/util/DBUtil.java @@ -0,0 +1,86 @@ +package com.rjconsultores.ventaboletos.dao.util; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import org.apache.log4j.Logger; +import org.hibernate.SessionFactory; +import org.springframework.core.io.ClassPathResource; + +public class DBUtil { + + private static Logger log = Logger.getLogger(DBUtil.class); + private static DBUtil INSTANCE; + private static Properties p; + private SessionFactory sessionFactory; + + public static DBUtil getInstance() { + if (INSTANCE == null) { + INSTANCE = new DBUtil(); + } + return INSTANCE; + } + + private DBUtil() { + p = new Properties(); + InputStream is; + try { + is = new ClassPathResource("/com/rjconsultores/ventaboletos/web/cliente/conf/database.properties").getInputStream(); + + p.load(is); + is.close(); + } catch (IOException e) { + log.error("Erro ao carregar o properties do banco de dados", e); + } + } + + public boolean isOracle() { + return p.getProperty("database.dialect").toUpperCase().contains("ORACLE"); + } + + public boolean isSQLServer() { + return p.getProperty("database.dialect").toUpperCase().contains("SQLSERVER"); + } + + public boolean isRDS() { + return Boolean.valueOf(p.getProperty("database.rds", "false")); + } + + public String dbSysdate() { + if (isOracle()) { + if (isRDS()) { + return "DATETIME_RDS()"; + } else { + return "SYSDATE"; + } + } + if (isSQLServer()) { + return "GETDATE()"; + } + return ""; + } + + public SessionFactory getSessionFactory() { + return sessionFactory; + } + + public void setSessionFactory(SessionFactory sessionFactory) { + this.sessionFactory = sessionFactory; + } + + // private String getDefaultSchema(){ + // return p.getProperty("database.default_schema").toUpperCase(); + // } + + // public String agregarDefaulSchema(String objBaseDados){ + // String [] array = objBaseDados.split("\\."); + // + // if (array.length == 1){ + // return getDefaultSchema() + "." + array[0]; + // }else if (array.length == 2){ + // return getDefaultSchema() + "." + array[1]; + // } + // return objBaseDados; + // } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/util/FormaPagoGenerator.java b/src/com/rjconsultores/ventaboletos/dao/util/FormaPagoGenerator.java new file mode 100644 index 000000000..1c2e6d201 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/util/FormaPagoGenerator.java @@ -0,0 +1,26 @@ +package com.rjconsultores.ventaboletos.dao.util; + +import java.io.Serializable; + +import org.apache.log4j.Logger; +import org.hibernate.HibernateException; +import org.hibernate.engine.SessionImplementor; +import org.hibernate.id.IdentifierGenerator; + +/** + * Trata a geração do ID da forma de pagamento data tabela forma de pagamento, pois não pode ultrapassar 2 digitos + * + * @author Guilherme Lopes + */ +public class FormaPagoGenerator implements IdentifierGenerator { + + private static Logger log = Logger.getLogger(FormaPagoGenerator.class); + + @Override + public Short generate(SessionImplementor session, Object object) throws HibernateException { + log.info("Inicio geração IdFormaPago"); + Serializable nextId = IdFormaPagoStore.getInstance().getNextId(session.connection()); + log.info("Fim geração IdFormaPago:" + nextId); + return Short.parseShort(nextId.toString()); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/util/IdAidfStore.java b/src/com/rjconsultores/ventaboletos/dao/util/IdAidfStore.java new file mode 100644 index 000000000..72d6a50c9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/util/IdAidfStore.java @@ -0,0 +1,125 @@ +package com.rjconsultores.ventaboletos.dao.util; + +import java.io.Serializable; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.hibernate.HibernateException; +/** + * Classe que trata a geração do ID da tabela Aidf. + * + * Foi abandonado o uso da sequence pois existiam lacunas nos numeros e já havia atingido o tamanho máximo de 3 dígitos, com isso + * sendo necessário aproveitar os número que não haviam sido utilizados + * + * @author gleimar + * + */ +public class IdAidfStore { + + private static Logger log = Logger.getLogger(IdAidfStore.class); + + private static final String LIMITE_ID_AIDF = "LIMITE_ID_AIDF"; + + private static IdAidfStore INSTANCE = new IdAidfStore(); + + private int indiceAtual = 1; + + private IdAidfStore(){ + + } + + public static IdAidfStore getInstance(){ + return INSTANCE; + } + + /** + * Buscar novo limite de aidf. + * + * Por padrão é 999. Com o intuito de ativar de forma gradual, foi criado uma constante para essa função + * @param connection + * @return + */ + private int buscarLimiteAidf(Connection connection){ + int qtdMaxima = 999; + PreparedStatement ps; + + log.info("buscando constante limite aidf ..."); + + try { + + ps = connection.prepareStatement("select VALORCONSTANTE from constante where NOMBCONSTANTE = :1"); + ps.setString(1, LIMITE_ID_AIDF); + + ResultSet rs = ps.executeQuery(); + + if (rs.next()){ + + String tmp = rs.getString("VALORCONSTANTE"); + + if (StringUtils.isNotBlank(tmp)){ + qtdMaxima = Integer.parseInt(tmp); + + log.info(String.format("constante encontrada : %s",tmp)); + } + }else{ + log.info("constante não parametrizada"); + } + + rs.close(); + ps.close(); + + }catch(Throwable e){ + log.error("erro buscar constante",e); + } + + return qtdMaxima; + } + + public synchronized Serializable getNextId(Connection connection) throws HibernateException { + + int qtdMaxima = this.buscarLimiteAidf(connection); + + log.info(String.format("qtdMaxima:%s",qtdMaxima)); + + long idEncontrado = -1; + + PreparedStatement ps; + + try { + + ps = connection.prepareStatement("select count(*) as qtd from aidf where aidf_id = :1"); + + for(; (idEncontrado == -1) && (indiceAtual <= qtdMaxima);indiceAtual++){ + ps.setInt(1, indiceAtual); + ResultSet rs = ps.executeQuery(); + rs.next(); + int qtd = rs.getInt("qtd"); + + if (qtd == 0){ + idEncontrado = indiceAtual; + } + } + + } catch (SQLException e) { + log.error("erro ao buscar id aidf",e); + throw new HibernateException(e); + } + + log.info("indiceAtual="+indiceAtual); + log.info("idEncontrado="+idEncontrado); + + if (indiceAtual > qtdMaxima && (idEncontrado != qtdMaxima) ){ + throw new HibernateException("A qtd de IDs permitidos para AIDF foi atingido:"+qtdMaxima); + } + + if (idEncontrado == -1){ + throw new HibernateException("Houve algum erro ao buscar um novo ID para AIDF"); + } + return idEncontrado; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/util/IdFormaPagoStore.java b/src/com/rjconsultores/ventaboletos/dao/util/IdFormaPagoStore.java new file mode 100644 index 000000000..701cdec27 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/util/IdFormaPagoStore.java @@ -0,0 +1,121 @@ +package com.rjconsultores.ventaboletos.dao.util; + +import java.io.Serializable; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.hibernate.HibernateException; + +/** + * Trata a geração do ID da forma de pagamento data tabela forma de pagamento, pois não pode ultrapassar 2 digitos + * + * @author Guilherme Lopes + */ +public class IdFormaPagoStore { + + private static Logger log = Logger.getLogger(IdFormaPagoStore.class); + + private static final String LIMITE_ID_FORMA_PAGTO = "LIMITE_ID_FORMA_PAGTO"; + + private static IdFormaPagoStore INSTANCE = new IdFormaPagoStore(); + + private int indiceAtual = 1; + + private IdFormaPagoStore() { + } + + public static IdFormaPagoStore getInstance() { + return INSTANCE; + } + + public synchronized Serializable getNextId(Connection connection) throws HibernateException { + + int qtdMaxima = this.buscarLimiteFormaPago(connection); + + log.info(String.format("qtdMaxima:%s", qtdMaxima)); + + long idEncontrado = -1; + + PreparedStatement ps; + + try { + + ps = connection.prepareStatement("SELECT COUNT(*) AS qtd FROM FORMA_PAGO WHERE FORMAPAGO_ID = :1"); + + for (; (idEncontrado == -1) && (indiceAtual <= qtdMaxima); indiceAtual++) { + ps.setInt(1, indiceAtual); + ResultSet rs = ps.executeQuery(); + rs.next(); + int qtd = rs.getInt("qtd"); + + if (qtd == 0) { + idEncontrado = indiceAtual; + } + } + + } catch (SQLException e) { + log.error("erro ao buscar id IdFormaPago", e); + throw new HibernateException(e); + } + + log.info("indiceAtual=" + indiceAtual); + log.info("idEncontrado=" + idEncontrado); + + if (indiceAtual > qtdMaxima && (idEncontrado != qtdMaxima)) { + throw new HibernateException("A qtd de IDs permitidos para IdFormaPago foi atingido:" + qtdMaxima); + } + + if (idEncontrado == -1) { + throw new HibernateException("Houve algum erro ao buscar um novo ID para IdFormaPago !"); + } + return idEncontrado; + } + + /** + * Buscar novo limite de IdFormaPago. + * + * Por padrão é 99. Com o intuito de ativar de forma gradual, foi criado uma constante para essa função + * + * @param connection + * @return + */ + private int buscarLimiteFormaPago(Connection connection) { + int qtdMaxima = 99; + PreparedStatement ps; + + log.info("buscando constante limite IdFormaPago ..."); + + try { + + ps = connection.prepareStatement("SELECT VALORCONSTANTE FROM CONSTANTE WHERE NOMBCONSTANTE = :1"); + ps.setString(1, LIMITE_ID_FORMA_PAGTO); + + ResultSet rs = ps.executeQuery(); + + if (rs.next()) { + + String tmp = rs.getString("VALORCONSTANTE"); + + if (StringUtils.isNotBlank(tmp)) { + qtdMaxima = Integer.parseInt(tmp); + + log.info(String.format("constante encontrada : %s", tmp)); + } + } else { + log.info("constante não parametrizada"); + } + + rs.close(); + ps.close(); + + } catch (Throwable e) { + log.error("erro buscar constante", e); + } + + return qtdMaxima; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/util/IdTipoParadaStore.java b/src/com/rjconsultores/ventaboletos/dao/util/IdTipoParadaStore.java new file mode 100644 index 000000000..ede9c7a4e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/util/IdTipoParadaStore.java @@ -0,0 +1,121 @@ +package com.rjconsultores.ventaboletos.dao.util; + +import java.io.Serializable; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.hibernate.HibernateException; + +/** + * Trata a geração do ID da forma de pagamento data tabela forma de pagamento, pois não pode ultrapassar 2 digitos + * + * @author Wallace + */ +public class IdTipoParadaStore { + + private static Logger log = Logger.getLogger(IdTipoParadaStore.class); + + private static final String LIMITE_ID_TIPO_PARADA = "LIMITE_ID_TIPO_PARADA"; + + private static IdTipoParadaStore INSTANCE = new IdTipoParadaStore(); + + private int indiceAtual = 1; + + private IdTipoParadaStore() { + } + + public static IdTipoParadaStore getInstance() { + return INSTANCE; + } + + public synchronized Serializable getNextId(Connection connection) throws HibernateException { + + int qtdMaxima = this.buscarLimiteTipoParada(connection); + + log.info(String.format("qtdMaxima:%s", qtdMaxima)); + + long idEncontrado = -1; + + PreparedStatement ps; + + try { + + ps = connection.prepareStatement("SELECT COUNT(*) AS qtd FROM TIPO_PARADA WHERE TIPOPARADA_ID = :1"); + + for (; (idEncontrado == -1) && (indiceAtual <= qtdMaxima); indiceAtual++) { + ps.setInt(1, indiceAtual); + ResultSet rs = ps.executeQuery(); + rs.next(); + int qtd = rs.getInt("qtd"); + + if (qtd == 0) { + idEncontrado = indiceAtual; + } + } + + } catch (SQLException e) { + log.error("erro ao buscar id IdTipoParada", e); + throw new HibernateException(e); + } + + log.info("indiceAtual=" + indiceAtual); + log.info("idEncontrado=" + idEncontrado); + + if (indiceAtual > qtdMaxima && (idEncontrado != qtdMaxima)) { + throw new HibernateException("A qtd de IDs permitidos para IdTipoParadafoi atingido:" + qtdMaxima); + } + + if (idEncontrado == -1) { + throw new HibernateException("Houve algum erro ao buscar um novo ID para IdTipoParada !"); + } + return idEncontrado; + } + + /** + * Buscar novo limite de IdTipoParada. + * + * Por padrão é 127. Com o intuito de ativar de forma gradual, foi criado uma constante para essa função + * + * @param connection + * @return + */ + private int buscarLimiteTipoParada(Connection connection) { + int qtdMaxima = 127; + PreparedStatement ps; + + log.info("buscando constante limite IdTipoParada ..."); + + try { + + ps = connection.prepareStatement("SELECT VALORCONSTANTE FROM CONSTANTE WHERE NOMBCONSTANTE = :1"); + ps.setString(1, LIMITE_ID_TIPO_PARADA); + + ResultSet rs = ps.executeQuery(); + + if (rs.next()) { + + String tmp = rs.getString("VALORCONSTANTE"); + + if (StringUtils.isNotBlank(tmp)) { + qtdMaxima = Integer.parseInt(tmp); + + log.info(String.format("constante encontrada : %s", tmp)); + } + } else { + log.info("constante não parametrizada"); + } + + rs.close(); + ps.close(); + + } catch (Throwable e) { + log.error("erro buscar constante", e); + } + + return qtdMaxima; + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/util/TipoParadaGenerator.java b/src/com/rjconsultores/ventaboletos/dao/util/TipoParadaGenerator.java new file mode 100644 index 000000000..d8088e2f0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/util/TipoParadaGenerator.java @@ -0,0 +1,26 @@ +package com.rjconsultores.ventaboletos.dao.util; + +import java.io.Serializable; + +import org.apache.log4j.Logger; +import org.hibernate.HibernateException; +import org.hibernate.engine.SessionImplementor; +import org.hibernate.id.IdentifierGenerator; + +/** + * Trata a geração do ID da tipo parada data tabela tipo parada + * + * @author Wallace + */ +public class TipoParadaGenerator implements IdentifierGenerator { + + private static Logger log = Logger.getLogger(TipoParadaGenerator.class); + + @Override + public Short generate(SessionImplementor session, Object object) throws HibernateException { + log.info("Inicio geração IdTipoParada"); + Serializable nextId = IdTipoParadaStore.getInstance().getNextId(session.connection()); + log.info("Fim geração IdTipoParada:" + nextId); + return Short.parseShort(nextId.toString()); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AbastoBoleto.java b/src/com/rjconsultores/ventaboletos/entidad/AbastoBoleto.java new file mode 100644 index 000000000..487bb3e9b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AbastoBoleto.java @@ -0,0 +1,282 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ABASTO_BOLETO_SEQ", sequenceName = "ABASTO_BOLETO_SEQ", allocationSize = 1) +@Table(name = "ABASTO_BOLETO") +public class AbastoBoleto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ABASTO_BOLETO_SEQ") + @Column(name = "ABASTOBOLETO_ID") + private Integer abastoboletoId; + @Column(name = "NUMSERVIDOR") + private Integer numservidor; + @Column(name = "NUMREQUISICION") + private Long numrequisicion; + @Column(name = "FECHORREQ") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorreq; + @Column(name = "USUARIOREQ_ID") + private Integer usuarioreqId; + @Column(name = "CANTFAJILLA") + private Long cantfajilla; + @Column(name = "FECHORGENERACION") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorgeneracion; + @Column(name = "USUARIOGENERACION_ID") + private Integer usuariogeneracionId; + @Column(name = "STATUSFIRMA") + private Integer statusfirma; + @Column(name = "STATUSENVIO") + private Integer statusEnvio; + @Column(name = "FECHORFIRMA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorfirma; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTACENTRAL_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventacentral; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventa; + @JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID") + @ManyToOne + private Estacion estacion; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "CLASIFICACION_ID", referencedColumnName = "CLASIFICACION_ID") + @ManyToOne + private Clasificacion clasificacion; + @JoinColumn(name = "ARTICULO_ID", referencedColumnName = "ARTICULO_ID") + @ManyToOne + private Articulo articulo; + @OneToMany(mappedBy = "abastoBoleto", cascade = CascadeType.ALL) + private List detAbastoBoletoList; + + public Integer getAbastoboletoId() { + return abastoboletoId; + } + + public void setAbastoboletoId(Integer abastoboletoId) { + this.abastoboletoId = abastoboletoId; + } + + public Integer getNumservidor() { + return numservidor; + } + + public void setNumservidor(Integer numservidor) { + this.numservidor = numservidor; + } + + public Long getNumrequisicion() { + return numrequisicion; + } + + public void setNumrequisicion(Long numrequisicion) { + this.numrequisicion = numrequisicion; + } + + public Date getFechorreq() { + return fechorreq; + } + + public void setFechorreq(Date fechorreq) { + this.fechorreq = fechorreq; + } + + public Integer getUsuarioreqId() { + return usuarioreqId; + } + + public void setUsuarioreqId(Integer usuarioreqId) { + this.usuarioreqId = usuarioreqId; + } + + public Long getCantfajilla() { + return cantfajilla; + } + + public void setCantfajilla(Long cantfajilla) { + this.cantfajilla = cantfajilla; + } + + public Date getFechorgeneracion() { + return fechorgeneracion; + } + + public void setFechorgeneracion(Date fechorgeneracion) { + this.fechorgeneracion = fechorgeneracion; + } + + public Integer getUsuariogeneracionId() { + return usuariogeneracionId; + } + + public void setUsuariogeneracionId(Integer usuariogeneracionId) { + this.usuariogeneracionId = usuariogeneracionId; + } + + public Integer getStatusfirma() { + return statusfirma; + } + + public void setStatusfirma(Integer statusfirma) { + this.statusfirma = statusfirma; + } + + public Integer getStatusEnvio() { + return statusEnvio; + } + + public void setStatusEnvio(Integer statusEnvio) { + this.statusEnvio = statusEnvio; + } + + public Date getFechorfirma() { + return fechorfirma; + } + + public void setFechorfirma(Date fechorfirma) { + this.fechorfirma = fechorfirma; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoventacentral() { + return puntoventacentral; + } + + public void setPuntoventacentral(PuntoVenta puntoventacentral) { + this.puntoventacentral = puntoventacentral; + } + + public PuntoVenta getPuntoventa() { + return puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Clasificacion getClasificacion() { + return clasificacion; + } + + public void setClasificacion(Clasificacion clasificacion) { + this.clasificacion = clasificacion; + } + + public Articulo getArticulo() { + return articulo; + } + + public void setArticulo(Articulo articulo) { + this.articulo = articulo; + } + + public List getDetAbastoBoletoList() { + return detAbastoBoletoList; + } + + public void setDetAbastoBoletoList(List detAbastoBoletoList) { + this.detAbastoBoletoList = detAbastoBoletoList; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((abastoboletoId == null) ? 0 : abastoboletoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + AbastoBoleto other = (AbastoBoleto) obj; + if (abastoboletoId == null) { + if (other.abastoboletoId != null) + return false; + } else if (!abastoboletoId.equals(other.abastoboletoId)) + return false; + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.AbastoBoleto [abastoboletoId=" + abastoboletoId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AbastoCentral.java b/src/com/rjconsultores/ventaboletos/entidad/AbastoCentral.java new file mode 100644 index 000000000..e8b4c2d63 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AbastoCentral.java @@ -0,0 +1,150 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AbastoCentral generated by hbm2java + */ +@Entity +@Table(name = "ABASTO_CENTRAL") +public class AbastoCentral implements java.io.Serializable { + + private Long abastocentralId; + private Aidf aidf; + private String numseriepreimpresa; + private String numfoliopreimpreso; + private String numsubseriepreimpreso; + private PuntoVenta puntoventa; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private Estacion estacion; + + public AbastoCentral() { + } + + public AbastoCentral(Aidf _aidf, String _numseriepreimpresa, String _numfoliopreimpreso, String _numsubseriepreimpreso, + PuntoVenta _puntoventa, Boolean _activo, Date _fecmodif, Integer _usuarioId) { + aidf = _aidf; + numseriepreimpresa = _numseriepreimpresa; + numfoliopreimpreso = _numfoliopreimpreso; + numsubseriepreimpreso = _numsubseriepreimpreso; + puntoventa = _puntoventa; + activo = _activo; + fecmodif = _fecmodif; + usuarioId = _usuarioId; + } + + @SequenceGenerator(name = "ABASTO_HISTO_SEQ", sequenceName = "ABASTO_HISTO_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ABASTO_HISTO_SEQ") + @Column(name = "ABASTOCENTRAL_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getAbastocentralId() { + return this.abastocentralId; + } + + public void setAbastocentralId(Long abastocentralId) { + this.abastocentralId = abastocentralId; + } + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "AIDF_ID") + public Aidf getAidf() { + return this.aidf; + } + + public void setAidf(Aidf aidf) { + this.aidf = aidf; + } + + @Column(name = "NUMSERIEPREIMPRESA", length = 10) + public String getNumseriepreimpresa() { + return this.numseriepreimpresa; + } + + public void setNumseriepreimpresa(String numseriepreimpresa) { + this.numseriepreimpresa = numseriepreimpresa; + } + + @Column(name = "NUMFOLIOPREIMPRESO", length = 12) + public String getNumfoliopreimpreso() { + return this.numfoliopreimpreso; + } + + public void setNumfoliopreimpreso(String numfoliopreimpreso) { + this.numfoliopreimpreso = numfoliopreimpreso; + } + + @Column(name = "NUMSUBSERIEPREIMPRESO", length = 10) + public String getNumsubseriepreimpreso() { + return this.numsubseriepreimpreso; + } + + public void setNumsubseriepreimpreso(String numsubseriepreimpreso) { + this.numsubseriepreimpreso = numsubseriepreimpreso; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoventa() { + return this.puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @ManyToOne + @JoinColumn(name = "ESTACION_ID") + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AbastoHisto.java b/src/com/rjconsultores/ventaboletos/entidad/AbastoHisto.java new file mode 100644 index 000000000..d2a705f25 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AbastoHisto.java @@ -0,0 +1,189 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AbastoHisto generated by hbm2java + */ +@Entity +@Table(name = "ABASTO_HISTO") +public class AbastoHisto implements java.io.Serializable { + + private Long abastohistoId; + private TipoMovimentacion tipoMovimentacion; + private Aidf aidf; + private String numseriepreimpresa; + private String numfoliopreimpreso; + private String numsubseriepreimpreso; + private Date fechorhisto; + private PuntoVenta puntoventa; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private Estacion estacion; + + public AbastoHisto() { + } + + public AbastoHisto(AbastoCentral bilhete, TipoMovimentacion _tipoMovimentacion, Date _fechorhisto, Boolean _activo, Date _fecmodif, Integer _usuarioId) { + tipoMovimentacion = _tipoMovimentacion; + aidf = bilhete.getAidf(); + numseriepreimpresa = bilhete.getNumseriepreimpresa(); + numfoliopreimpreso = bilhete.getNumfoliopreimpreso(); + numsubseriepreimpreso = bilhete.getNumsubseriepreimpreso(); + estacion = bilhete.getEstacion(); + fechorhisto = _fechorhisto; + puntoventa = bilhete.getPuntoventa(); + activo = _activo; + fecmodif = _fecmodif; + usuarioId = _usuarioId; + } + + public AbastoHisto(TipoMovimentacion _tipoMovimentacion, Aidf _aidf, String _numseriepreimpresa, String _numfoliopreimpreso, + String _numsubseriepreimpreso, Date _fechorhisto, PuntoVenta _puntoventa, Boolean _activo, Date _fecmodif, Integer _usuarioId, Estacion _estacion) { + tipoMovimentacion = _tipoMovimentacion; + aidf = _aidf; + numseriepreimpresa = _numseriepreimpresa; + numfoliopreimpreso = _numfoliopreimpreso; + numsubseriepreimpreso = _numsubseriepreimpreso; + fechorhisto = _fechorhisto; + puntoventa = _puntoventa; + activo = _activo; + fecmodif = _fecmodif; + usuarioId = _usuarioId; + estacion = _estacion; + } + + @SequenceGenerator(name = "ABASTO_HISTO_SEQ", sequenceName = "ABASTO_HISTO_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ABASTO_HISTO_SEQ") + @Column(name = "ABASTOHISTO_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getAbastohistoId() { + return this.abastohistoId; + } + + public void setAbastohistoId(Long abastohistoId) { + this.abastohistoId = abastohistoId; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "TIPOMOVIMENTACION_ID") + public TipoMovimentacion getTipoMovimentacion() { + return this.tipoMovimentacion; + } + + public void setTipoMovimentacion(TipoMovimentacion tipoMovimentacion) { + this.tipoMovimentacion = tipoMovimentacion; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "AIDF_ID") + public Aidf getAidf() { + return this.aidf; + } + + public void setAidf(Aidf aidf) { + this.aidf = aidf; + } + + @Column(name = "NUMSERIEPREIMPRESA", length = 10) + public String getNumseriepreimpresa() { + return this.numseriepreimpresa; + } + + public void setNumseriepreimpresa(String numseriepreimpresa) { + this.numseriepreimpresa = numseriepreimpresa; + } + + @Column(name = "NUMFOLIOPREIMPRESO", length = 12) + public String getNumfoliopreimpreso() { + return this.numfoliopreimpreso; + } + + public void setNumfoliopreimpreso(String numfoliopreimpreso) { + this.numfoliopreimpreso = numfoliopreimpreso; + } + + @Column(name = "NUMSUBSERIEPREIMPRESO", length = 10) + public String getNumsubseriepreimpreso() { + return this.numsubseriepreimpreso; + } + + public void setNumsubseriepreimpreso(String numsubseriepreimpreso) { + this.numsubseriepreimpreso = numsubseriepreimpreso; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECHORHISTO", length = 7) + public Date getFechorhisto() { + return this.fechorhisto; + } + + public void setFechorhisto(Date fechorhisto) { + this.fechorhisto = fechorhisto; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoventa() { + return this.puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @ManyToOne + @JoinColumn(name = "ESTACION_ID") + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AgrupamentoParada.java b/src/com/rjconsultores/ventaboletos/entidad/AgrupamentoParada.java new file mode 100644 index 000000000..eaf189660 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AgrupamentoParada.java @@ -0,0 +1,106 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "AGRUPAMENTOPARADA_SEQ", sequenceName = "AGRUPAMENTOPARADA_SEQ", allocationSize = 1) +@Table(name = "AGRUPAMENTO_PARADA") +public class AgrupamentoParada implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AGRUPAMENTOPARADA_SEQ") + @Column(name = "AGRUPAMENTOPARADA_ID") + private Integer agrupamentoParadaId; + @Basic(optional = false) + @Column(name = "DESCAGRUPAMENTOPARADA") + private String descAgrupamentoParada; + @Column(name = "CVEAGRUPAMENTOPARADA") + private String cveAgrupamentoParada; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getAgrupamentoParadaId() { + return agrupamentoParadaId; + } + + public void setAgrupamentoParadaId(Integer agrupamentoParadaId) { + this.agrupamentoParadaId = agrupamentoParadaId; + } + + public String getDescAgrupamentoParada() { + return descAgrupamentoParada; + } + + public void setDescAgrupamentoParada(String descAgrupamentoParada) { + this.descAgrupamentoParada = descAgrupamentoParada; + } + + public String getCveAgrupamentoParada() { + return cveAgrupamentoParada; + } + + public void setCveAgrupamentoParada(String cveAgrupamentoParada) { + this.cveAgrupamentoParada = cveAgrupamentoParada; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof AgrupamentoParada)) { + return false; + } + AgrupamentoParada other = (AgrupamentoParada) object; + if ((this.getAgrupamentoParadaId() == null && other.getAgrupamentoParadaId() != null) || (this.getAgrupamentoParadaId() != null && !this.getAgrupamentoParadaId().equals(other.getAgrupamentoParadaId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDescAgrupamentoParada(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Aidf.java b/src/com/rjconsultores/ventaboletos/entidad/Aidf.java new file mode 100644 index 000000000..b958e6e5d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Aidf.java @@ -0,0 +1,293 @@ +package com.rjconsultores.ventaboletos.entidad; + +/// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.GenericGenerator; + +/** + * Aidf generated by hbm2java + */ +@Entity +@Table(name = "AIDF") +public class Aidf implements java.io.Serializable { + + private static final long serialVersionUID = 1L; + + private Long aidfId; + private AidfTipo aidfTipo; + private AidfEspecie aidfEspecie; + private PuntoVenta puntoVenta; + private Estado estado; + private String docfiscal; + private String acfiscal; + private String serie; + private String subserie; + private String forminicial; + private String formfinal; + private Date fecadquisicion; + private Date fecvencimiento; + private String inscestadual; + private Empresa empresa; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private String cnpj; + private String tipoValidaVenta; + + public Aidf() { + } + + public Aidf(AidfTipo aidfTipo, PuntoVenta puntoVenta, AidfEspecie aidfEspecie, Estado estado, String docfiscal, String acfiscal, + String serie, String subserie, String forminicial, String formfinal, Date fecadquisicion, Date fecvencimiento, + String inscestadual, Empresa empresa, Boolean activo, Date fecmodif, Integer usuarioId) { + this.aidfTipo = aidfTipo; + this.puntoVenta = puntoVenta; + this.aidfEspecie = aidfEspecie; + this.estado = estado; + this.docfiscal = docfiscal; + this.acfiscal = acfiscal; + this.serie = serie; + this.subserie = subserie; + this.forminicial = forminicial; + this.formfinal = formfinal; + this.fecadquisicion = fecadquisicion; + this.fecvencimiento = fecvencimiento; + this.inscestadual = inscestadual; + this.empresa = empresa; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + + } + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "PUNTOVENTA_ID") + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (aidfId != null ? aidfId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Aidf)) + return false; + + Aidf other = (Aidf) object; + if ((this.aidfId == null && other.aidfId != null) || (this.aidfId != null && !this.aidfId.equals(other.aidfId))) { + return false; + } + return true; + } + + @Id + @GenericGenerator(name = "aidfgen_id", strategy = "com.rjconsultores.ventaboletos.dao.util.AidfGenerator") + @GeneratedValue(generator = "aidfgen_id") + @Column(name = "AIDF_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getAidfId() { + return aidfId; + } + + public void setAidfId(Long aidfId) { + this.aidfId = aidfId; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "AIDFTIPO_ID") + public AidfTipo getAidfTipo() { + return aidfTipo; + } + + public void setAidfTipo(AidfTipo aidfTipo) { + this.aidfTipo = aidfTipo; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "AIDFESP_ID") + public AidfEspecie getAidfEspecie() { + return aidfEspecie; + } + + public void setAidfEspecie(AidfEspecie aidfEspecie) { + this.aidfEspecie = aidfEspecie; + } + + @JoinColumn(name = "ESTADO_ID") + @ManyToOne + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + @Column(name = "DOCFISCAL", length = 20) + public String getDocfiscal() { + return docfiscal; + } + + public void setDocfiscal(String docfiscal) { + this.docfiscal = docfiscal; + } + + @Column(name = "ACFISCAL", length = 20) + public String getAcfiscal() { + return acfiscal; + } + + public void setAcfiscal(String acfiscal) { + this.acfiscal = acfiscal; + } + + @Column(name = "SERIE", length = 20) + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + @Column(name = "SUBSERIE", length = 20) + public String getSubserie() { + return subserie; + } + + public void setSubserie(String subserie) { + this.subserie = subserie; + } + + @Column(name = "FORMINICIAL", length = 12) + public String getForminicial() { + return forminicial; + } + + public void setForminicial(String forminicial) { + this.forminicial = forminicial; + } + + @Column(name = "FORMFINAL", length = 12) + public String getFormfinal() { + return formfinal; + } + + public void setFormfinal(String formfinal) { + this.formfinal = formfinal; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECADQUISICION", length = 7) + public Date getFecadquisicion() { + return fecadquisicion; + } + + public void setFecadquisicion(Date fecadquisicion) { + this.fecadquisicion = fecadquisicion; + } + + @Column(name = "CNPJ", length = 20) + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECVENCIMIENTO", length = 7) + public Date getFecvencimiento() { + return fecvencimiento; + } + + public void setFecvencimiento(Date fecvencimiento) { + this.fecvencimiento = fecvencimiento; + } + + @Column(name = "INSCESTADUAL", length = 20) + public String getInscestadual() { + return inscestadual; + } + + public void setInscestadual(String inscestadual) { + this.inscestadual = inscestadual; + } + + @JoinColumn(name = "EMPRESA_ID") + @ManyToOne + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Column(name = "TIPOVALIDAVENTA") + public String getTipoValidaVenta() { + return tipoValidaVenta; + } + + public void setTipoValidaVenta(String tipoValidaVenta) { + this.tipoValidaVenta = tipoValidaVenta; + } + + @Override + public String toString() { + return String.format("%s - %s", this.getAidfId(), (this.getSerie() == null ? "" : this.getSerie() + + this.getSubserie() == null ? "" : this.getSubserie())); + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/AidfEspecie.java b/src/com/rjconsultores/ventaboletos/entidad/AidfEspecie.java new file mode 100644 index 000000000..1fa19b125 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AidfEspecie.java @@ -0,0 +1,115 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AidfEspecie generated by hbm2java + */ +@Entity +@Table(name = "AIDF_ESPECIE") +public class AidfEspecie implements java.io.Serializable { + + private static final long serialVersionUID = 1L; + + private Integer aidfespId; + private String decespecie; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public AidfEspecie() { + } + + public AidfEspecie(Integer aidfespId) { + this.aidfespId = aidfespId; + } + + @Override + public String toString() { + return decespecie; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (aidfespId != null ? aidfespId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AidfEspecie)) + return false; + + AidfEspecie other = (AidfEspecie) object; + if ((this.aidfespId == null && other.aidfespId != null) || (this.aidfespId != null && !this.aidfespId.equals(other.aidfespId))) { + return false; + } + return true; + } + + public AidfEspecie(Integer aidfespId, String decespecie, Boolean activo, Date fecmodif, Integer usuarioId) { + this.aidfespId = aidfespId; + this.decespecie = decespecie; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + @Id + @Column(name = "AIDFESP_ID", unique = true, nullable = false, precision = 4, scale = 0) + public Integer getAidfespId() { + return this.aidfespId; + } + + public void setAidfespId(Integer aidfespId) { + this.aidfespId = aidfespId; + } + + @Column(name = "DECESPECIE", length = 20) + public String getDecespecie() { + return this.decespecie; + } + + public void setDecespecie(String decespecie) { + this.decespecie = decespecie; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AidfTipo.java b/src/com/rjconsultores/ventaboletos/entidad/AidfTipo.java new file mode 100644 index 000000000..7cc664558 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AidfTipo.java @@ -0,0 +1,113 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AidfTipo generated by hbm2java + */ +@Entity +@Table(name = "AIDF_TIPO") +public class AidfTipo implements java.io.Serializable { + + private Integer aidftipoId; + private String desctipo; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public AidfTipo() { + } + + public AidfTipo(Integer aidftipoId) { + this.aidftipoId = aidftipoId; + } + + @Override + public String toString() { + return desctipo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (aidftipoId != null ? aidftipoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AidfTipo)) + return false; + + AidfTipo other = (AidfTipo) object; + if ((this.aidftipoId == null && other.aidftipoId != null) || (this.aidftipoId != null && !this.aidftipoId.equals(other.aidftipoId))) { + return false; + } + return true; + } + + public AidfTipo(Integer aidftipoId, String desctipo, Boolean activo, Date fecmodif, Integer usuarioId) { + this.aidftipoId = aidftipoId; + this.desctipo = desctipo; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + @Id + @Column(name = "AIDFTIPO_ID", unique = true, nullable = false, precision = 4, scale = 0) + public Integer getAidftipoId() { + return this.aidftipoId; + } + + public void setAidftipoId(Integer aidftipoId) { + this.aidftipoId = aidftipoId; + } + + @Column(name = "DESCTIPO", length = 20) + public String getDesctipo() { + return this.desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AjusteEventoExtra.java b/src/com/rjconsultores/ventaboletos/entidad/AjusteEventoExtra.java new file mode 100644 index 000000000..2b6c00b66 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AjusteEventoExtra.java @@ -0,0 +1,208 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "AJUSTE_EVENTO_EXTRA") +@SequenceGenerator(name = "AJUSTE_EVENTO_EXTRA_SEQ", sequenceName = "AJUSTE_EVENTO_EXTRA_SEQ", allocationSize = 1) +public class AjusteEventoExtra implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AJUSTE_EVENTO_EXTRA_SEQ") + @Column(name = "AJUSTEEVENTOEXTRA_ID") + private Long ajusteeventoextraId; + @Column(name = "TIPOEVENTOEXTRA_ID") + private Integer tipoeventoextraId; + @Column(name = "FECHORINGRESO") + @Temporal(TemporalType.TIMESTAMP) + private Date fechoringreso; + @Column(name = "CORTETURNO_ID") + private Integer corteturnoId; + @Column(name = "IMPINGRESO") + private BigDecimal impingreso; + @Column(name = "NUMDOCUMENTO") + private String numdocumento; + @Column(name = "IMPORTEIVA") + private BigDecimal importeiva; + @Column(name = "PUNTOVENTA_ID") + private Integer puntoventaId; + @Column(name = "DEPOSITOBANCARIO_ID") + private Integer depositobancarioId; + @Column(name = "EMPRESA_ID") + private Integer empresaId; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "STATUSAJUSTE") + private Short statusajuste; + + public AjusteEventoExtra() { + } + + public AjusteEventoExtra(Long ajusteeventoextraId) { + this.ajusteeventoextraId = ajusteeventoextraId; + } + + public Long getAjusteeventoextraId() { + return ajusteeventoextraId; + } + + public void setAjusteeventoextraId(Long ajusteeventoextraId) { + this.ajusteeventoextraId = ajusteeventoextraId; + } + + public Integer getTipoeventoextraId() { + return tipoeventoextraId; + } + + public void setTipoeventoextraId(Integer tipoeventoextraId) { + this.tipoeventoextraId = tipoeventoextraId; + } + + public Date getFechoringreso() { + return fechoringreso; + } + + public void setFechoringreso(Date fechoringreso) { + this.fechoringreso = fechoringreso; + } + + public Integer getCorteturnoId() { + return corteturnoId; + } + + public void setCorteturnoId(Integer corteturnoId) { + this.corteturnoId = corteturnoId; + } + + public BigDecimal getImpingreso() { + return impingreso; + } + + public void setImpingreso(BigDecimal impingreso) { + this.impingreso = impingreso; + } + + public String getNumdocumento() { + return numdocumento; + } + + public void setNumdocumento(String numdocumento) { + this.numdocumento = numdocumento; + } + + public BigDecimal getImporteiva() { + return importeiva; + } + + public void setImporteiva(BigDecimal importeiva) { + this.importeiva = importeiva; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Integer getDepositobancarioId() { + return depositobancarioId; + } + + public void setDepositobancarioId(Integer depositobancarioId) { + this.depositobancarioId = depositobancarioId; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Short getStatusajuste() { + return statusajuste; + } + + public void setStatusajuste(Short statusajuste) { + this.statusajuste = statusajuste; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ajusteeventoextraId != null ? ajusteeventoextraId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AjusteEventoExtra)) { + return false; + } + AjusteEventoExtra other = (AjusteEventoExtra) object; + if ((this.ajusteeventoextraId == null && other.ajusteeventoextraId != null) || (this.ajusteeventoextraId != null && !this.ajusteeventoextraId.equals(other.ajusteeventoextraId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.AjusteEventoExtra[ajusteeventoextraId=" + ajusteeventoextraId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AlertaCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/AlertaCtrl.java new file mode 100644 index 000000000..7eaf082be --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AlertaCtrl.java @@ -0,0 +1,276 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "ALERTA_CTRL_SEQ", sequenceName = "ALERTA_CTRL_SEQ", allocationSize = 1) +@Table(name = "ALERTA_CTRL") +public class AlertaCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ALERTA_CTRL_SEQ") + @Basic(optional = false) + @Column(name = "ALERTACTRL_ID") + private Integer alertactrlId; + @Column(name = "PORCALTA") + private BigDecimal porcalta; + @Column(name = "PORCBAJA") + private BigDecimal porcbaja; + @Column(name = "TIEMPOALTA") + private Integer tiempoalta; + @Column(name = "TIEMPOBAJA") + private Integer tiempobaja; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "INDLUNES") + private Boolean indlunes; + @Column(name = "INDMARTES") + private Boolean indmartes; + @Column(name = "INDMIERCOLES") + private Boolean indmiercoles; + @Column(name = "INDJUEVES") + private Boolean indjueves; + @Column(name = "INDVIERNES") + private Boolean indviernes; + @Column(name = "INDSABADO") + private Boolean indsabado; + @Column(name = "INDDOMINGO") + private Boolean inddomingo; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @OneToOne + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + private Parada origem; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @OneToOne + @JoinColumns({ + @JoinColumn(name = "CORRIDA_ID", referencedColumnName = "CORRIDA_ID"), + @JoinColumn(name = "FECCORRIDA", referencedColumnName = "FECCORRIDA") }) + private Corrida corrida; + + public AlertaCtrl() { + } + + public AlertaCtrl(Integer alertactrlId) { + this.alertactrlId = alertactrlId; + } + + public Integer getAlertactrlId() { + return alertactrlId; + } + + public void setAlertactrlId(Integer alertactrlId) { + this.alertactrlId = alertactrlId; + } + + public BigDecimal getPorcalta() { + return porcalta; + } + + public void setPorcalta(BigDecimal porcalta) { + this.porcalta = porcalta; + } + + public BigDecimal getPorcbaja() { + return porcbaja; + } + + public void setPorcbaja(BigDecimal porcbaja) { + this.porcbaja = porcbaja; + } + + public Boolean getInddomingo() { + return inddomingo; + } + + public void setInddomingo(Boolean inddomingo) { + this.inddomingo = inddomingo; + } + + public Boolean getIndjueves() { + return indjueves; + } + + public void setIndjueves(Boolean indjueves) { + this.indjueves = indjueves; + } + + public Boolean getIndlunes() { + return indlunes; + } + + public void setIndlunes(Boolean indlunes) { + this.indlunes = indlunes; + } + + public Boolean getIndmartes() { + return indmartes; + } + + public void setIndmartes(Boolean indmartes) { + this.indmartes = indmartes; + } + + public Boolean getIndmiercoles() { + return indmiercoles; + } + + public void setIndmiercoles(Boolean indmiercoles) { + this.indmiercoles = indmiercoles; + } + + public Boolean getIndsabado() { + return indsabado; + } + + public void setIndsabado(Boolean indsabado) { + this.indsabado = indsabado; + } + + public Boolean getIndviernes() { + return indviernes; + } + + public void setIndviernes(Boolean indviernes) { + this.indviernes = indviernes; + } + + public Integer getTiempoalta() { + return tiempoalta; + } + + public void setTiempoalta(Integer tiempoalta) { + this.tiempoalta = tiempoalta; + } + + public Integer getTiempobaja() { + return tiempobaja; + } + + public void setTiempobaja(Integer tiempobaja) { + this.tiempobaja = tiempobaja; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Corrida getCorrida() { + return corrida; + } + + public void setCorrida(Corrida corrida) { + this.corrida = corrida; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (alertactrlId != null ? alertactrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof AlertaCtrl)) { + return false; + } + AlertaCtrl other = (AlertaCtrl) object; + if ((this.alertactrlId == null && other.alertactrlId != null) || (this.alertactrlId != null && !this.alertactrlId.equals(other.alertactrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.AlertaCtrl[alertactrlId=" + alertactrlId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AliasServico.java b/src/com/rjconsultores/ventaboletos/entidad/AliasServico.java new file mode 100644 index 000000000..bc59dfb3a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AliasServico.java @@ -0,0 +1,174 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ALIAS_SERVICO_SEQ", sequenceName = "ALIAS_SERVICO_SEQ", allocationSize = 1) +@Table(name = "ALIAS_SERVICO") +public class AliasServico implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ALIAS_SERVICO_SEQ") + @Column(name = "ALIASSERVICO_ID") + private Integer aliasServicoId; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origen; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @Column(name = "CORRIDA_ID") + private Integer corridaId; + @OneToOne + @JoinColumn(name = "ALIASORIGEN_ID") + private Parada aliasOrigen; + @OneToOne + @JoinColumn(name = "ALIASDESTINO_ID") + private Parada aliasDestino; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "INDIDALIASORIGINAL") + private Boolean indIdAliasOriginal; + + public AliasServico() { + super(); + this.indIdAliasOriginal = false; + } + + public Integer getAliasServicoId() { + return aliasServicoId; + } + + public void setAliasServicoId(Integer aliasServicoId) { + this.aliasServicoId = aliasServicoId; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Parada getAliasOrigen() { + return aliasOrigen; + } + + public void setAliasOrigen(Parada aliasOrigen) { + this.aliasOrigen = aliasOrigen; + } + + public Parada getAliasDestino() { + return aliasDestino; + } + + public void setAliasDestino(Parada aliasDestino) { + this.aliasDestino = aliasDestino; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getIndIdAliasOriginal() { + return indIdAliasOriginal; + } + + public void setIndIdAliasOriginal(Boolean indIdAliasOriginal) { + this.indIdAliasOriginal = indIdAliasOriginal; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((aliasServicoId == null) ? 0 : aliasServicoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + AliasServico other = (AliasServico) obj; + if (aliasServicoId == null) { + if (other.aliasServicoId != null) + return false; + } else if (!aliasServicoId.equals(other.aliasServicoId)) + return false; + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AliquotaEstadoDestino.java b/src/com/rjconsultores/ventaboletos/entidad/AliquotaEstadoDestino.java new file mode 100644 index 000000000..1010077f9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AliquotaEstadoDestino.java @@ -0,0 +1,123 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ALIQUOTAESTADODESTINO_SEQ", sequenceName = "ALIQUOTAESTADODESTINO_SEQ", allocationSize = 1) +@Table(name = "ALIQUOTA_ESTADO_DESTINO") +public class AliquotaEstadoDestino implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ALIQUOTAESTADODESTINO_SEQ") + @Basic(optional = false) + @Column(name = "ALIQUOTAESTADODESTINO_ID") + private Integer aliquotaEstadoDestinoId; + + @OneToOne + @JoinColumn(name = "ESTADO_ID") + private Estado estado; + + @Column(name = "ALIQUOTA") + private BigDecimal aliquota; + + @JoinColumn(name = "EMPRESAIMPOSTO_ID", referencedColumnName = "EMPRESAIMPOSTO_ID") + @ManyToOne + private EmpresaImposto empresaImposto; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + + @Override + public boolean equals(Object object) { + if (!(object instanceof AliquotaEstadoDestino)) { + return false; + } + AliquotaEstadoDestino other = (AliquotaEstadoDestino) object; + if ((this.getAliquotaEstadoDestinoId() == null && other.getAliquotaEstadoDestinoId() != null) || (this.getAliquotaEstadoDestinoId() != null && !this.getAliquotaEstadoDestinoId().equals(other.getAliquotaEstadoDestinoId()))) { + return false; + } + return true; + } + + public Integer getAliquotaEstadoDestinoId() { + return aliquotaEstadoDestinoId; + } + + public void setAliquotaEstadoDestinoId(Integer aliquotaEstadoDestinoId) { + this.aliquotaEstadoDestinoId = aliquotaEstadoDestinoId; + } + + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + public BigDecimal getAliquota() { + return aliquota; + } + + public void setAliquota(BigDecimal aliquota) { + this.aliquota = aliquota; + } + + public EmpresaImposto getEmpresaImposto() { + return empresaImposto; + } + + public void setEmpresaImposto(EmpresaImposto empresaImposto) { + this.empresaImposto = empresaImposto; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Articulo.java b/src/com/rjconsultores/ventaboletos/entidad/Articulo.java new file mode 100644 index 000000000..5e3c65b64 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Articulo.java @@ -0,0 +1,164 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "ARTICULO_SEQ", sequenceName = "ARTICULO_SEQ", allocationSize = 1) +@Table(name = "ARTICULO") +public class Articulo implements Serializable { + + public static final Integer TIPO_VENDA = 1; + public static final Integer TIPO_OUTRO = 2; + public static final Integer TIPO_VENDA_MANUAL = 3; + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ARTICULO_SEQ") + @Column(name = "ARTICULO_ID") + private Integer articuloId; + @Column(name = "DESCARTICULO") + private String descarticulo; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "articulo") + private List abastoBoletoList; + @OneToMany(mappedBy = "articulo") + private List requisicionBoletoList; + @OneToOne(mappedBy = "articulo") + private Clasificacion clasificacion; + + public Articulo() { + } + + public Articulo(Integer articuloId) { + this.articuloId = articuloId; + } + + public Integer getArticuloId() { + return articuloId; + } + + public void setArticuloId(Integer articuloId) { + this.articuloId = articuloId; + } + + public String getDescarticulo() { + return descarticulo; + } + + public void setDescarticulo(String descarticulo) { + this.descarticulo = descarticulo; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getAbastoBoletoList() { + return abastoBoletoList; + } + + public void setAbastoBoletoList(List abastoBoletoList) { + this.abastoBoletoList = abastoBoletoList; + } + + public List getRequisicionBoletoList() { + return requisicionBoletoList; + } + + public void setRequisicionBoletoList(List requisicionBoletoList) { + this.requisicionBoletoList = requisicionBoletoList; + } + + public Clasificacion getClasificacion() { + return clasificacion; + } + + public void setClasificacion(Clasificacion clasificacion) { + this.clasificacion = clasificacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (articuloId != null ? articuloId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Articulo)) { + return false; + } + Articulo other = (Articulo) object; + if ((this.articuloId == null && other.articuloId != null) || (this.articuloId != null && !this.articuloId.equals(other.articuloId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Articulo[articuloId=" + articuloId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AsientoExclusivo.java b/src/com/rjconsultores/ventaboletos/entidad/AsientoExclusivo.java new file mode 100644 index 000000000..cac7ec89f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AsientoExclusivo.java @@ -0,0 +1,193 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "ASIENTO_EXCLUSIVO_SEQ", sequenceName = "ASIENTO_EXCLUSIVO_SEQ", allocationSize = 1) +@Table(name = "ASIENTO_EXCLUSIVO") +public class AsientoExclusivo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "ASIENTOEXCLUSIVO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ASIENTO_EXCLUSIVO_SEQ") + private Long asientoexclusivoId; + @Basic(optional = false) + @Column(name = "NUMASIENTO") + private String numasiento; + @Column(name = "VENDIBLE") + private Boolean vendible; + @Column(name = "TIEMPOLIBERACION") + private Integer tiempoLiberacion; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "MOTIVOBLOQUEO") + private String motivobloqueo; + @OneToOne + @JoinColumn(name = "NODO_ID") + private Nodo nodo; + @OneToOne + @JoinColumns({ + @JoinColumn(name = "CORRIDA_ID"), + @JoinColumn(name = "FECCORRIDA")}) + private Corrida corrida; + @OneToOne + @JoinColumn(name = "DESTINO_ID",referencedColumnName = "PARADA_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "PARADA_ID") + private Parada parada; + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public AsientoExclusivo() { + } + + public Long getAsientoexclusivoId() { + return asientoexclusivoId; + } + + public void setAsientoexclusivoId(Long asientoexclusivoId) { + this.asientoexclusivoId = asientoexclusivoId; + } + + public String getNumasiento() { + return numasiento; + } + + public void setNumasiento(String numasiento) { + this.numasiento = numasiento; + } + + public Boolean getVendible() { + return vendible; + } + + public void setVendible(Boolean vendible) { + this.vendible = vendible; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getMotivobloqueo() { + return motivobloqueo; + } + + public void setMotivobloqueo(String motivobloqueo) { + this.motivobloqueo = motivobloqueo; + } + + public Corrida getCorrida() { + return corrida; + } + + public void setCorrida(Corrida corrida) { + this.corrida = corrida; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Nodo getNodo() { + return nodo; + } + + public void setNodo(Nodo nodo) { + this.nodo = nodo; + } + + public Integer getTiempoLiberacion() { + return tiempoLiberacion; + } + + public void setTiempoLiberacion(Integer tiempoLiberacion) { + this.tiempoLiberacion = tiempoLiberacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (asientoexclusivoId != null ? asientoexclusivoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AsientoExclusivo)) { + return false; + } + AsientoExclusivo other = (AsientoExclusivo) object; + if ((this.asientoexclusivoId == null && other.asientoexclusivoId != null) || (this.asientoexclusivoId != null && !this.asientoexclusivoId.equals(other.asientoexclusivoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.AsientoExclusivo[asientoexclusivoId=" + asientoexclusivoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AuditLog.java b/src/com/rjconsultores/ventaboletos/entidad/AuditLog.java new file mode 100644 index 000000000..6d8335ec6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AuditLog.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Transient; + +@Entity +@SequenceGenerator(name = "AUDITLOG_SEQ", sequenceName = "AUDIT_LOG_SEQ", allocationSize = 1) +@Table(name = "AUDIT_LOG") +public class AuditLog implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "AUDITLOG_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AUDITLOG_SEQ") + private Long auditLogId; + + @Column(name = "AUDITACTION_ID") + private Integer action; + + @Column(name = "ENTITY_DETAIL") + private String entityDetail; + + @Column(name = "ENTITY_NAME") + private String entityName; + + @Column(name = "CREATED_DATE") + private Date createdDate; + + @JoinColumn(name = "SISTEMA_ID", referencedColumnName = "SISTEMA_ID") + @ManyToOne + private Sistema sistema; + + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuario; + + @JoinColumn(name = "AUDITSERVICE_ID", referencedColumnName = "AUDITSERVICE_ID") + @ManyToOne + private AuditService service; + + @Transient + private Date dataInicio; + + @Transient + private Date dataFim; + + public Long getAuditLogId() { + return auditLogId; + } + + public void setAuditLogId(Long auditLogId) { + this.auditLogId = auditLogId; + } + + public Integer getAction() { + return action; + } + + public void setAction(Integer action) { + this.action = action; + } + + public Sistema getSistema() { + return sistema; + } + + public void setSistema(Sistema sistema) { + this.sistema = sistema; + } + + public String getEntityDetail() { + return entityDetail; + } + + public void setEntityDetail(String entityDetail) { + this.entityDetail = entityDetail; + } + + public String getEntityName() { + return entityName; + } + + public void setEntityName(String entityName) { + this.entityName = entityName; + } + + public Date getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public AuditService getService() { + return service; + } + + public void setService(AuditService service) { + this.service = service; + } + + @Override + public String toString() { + return createdDate.toString() + sistema.toString(); + } + + public Date getDataFim() { + return dataFim; + } + + public void setDataFim(Date dataFim) { + this.dataFim = dataFim; + } + + public Date getDataInicio() { + return dataInicio; + } + + public void setDataInicio(Date dataInicio) { + this.dataInicio = dataInicio; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AuditModule.java b/src/com/rjconsultores/ventaboletos/entidad/AuditModule.java new file mode 100644 index 000000000..131ab0e10 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AuditModule.java @@ -0,0 +1,54 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "AUDIT_MODULE") +public class AuditModule implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "AUDITMODULE_ID") + private Long auditModuleId; + + @Column(name = "NAMEMODULE") + private String nameModule; + + @Column(name = "INDAUDITABLE") + private Boolean indAuditable; + + public Long getAuditModuleId() { + return auditModuleId; + } + + public void setAuditModuleId(Long auditModuleId) { + this.auditModuleId = auditModuleId; + } + + public Boolean getIndAuditable() { + return indAuditable; + } + + public String getNameModule() { + return nameModule; + } + + public void setNameModule(String nameModule) { + this.nameModule = nameModule; + } + + public void setIndAuditable(Boolean indAuditable) { + this.indAuditable = indAuditable; + } + + @Override + public String toString() { + return nameModule; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AuditService.java b/src/com/rjconsultores/ventaboletos/entidad/AuditService.java new file mode 100644 index 000000000..15e601250 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AuditService.java @@ -0,0 +1,64 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "AUDIT_SERVICE") +public class AuditService implements Serializable{ + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "AUDITSERVICE_ID") + private Long auditServiceId; + + @Column(name = "NAMESERVICE") + private String nameService; + + @JoinColumn(name = "FUNCIONSISTEMA_ID", referencedColumnName = "FUNCIONSISTEMA_ID") + @ManyToOne + private FuncionSistema funcionSistema; + + @JoinColumn(name = "AUDITMODULE_ID", referencedColumnName = "AUDITMODULE_ID") + @ManyToOne + private AuditModule module; + + public Long getAuditServiceId() { + return auditServiceId; + } + + public void setAuditServiceId(Long auditServiceId) { + this.auditServiceId = auditServiceId; + } + + public String getNameService() { + return nameService; + } + + public void setNameService(String nameService) { + this.nameService = nameService; + } + + public AuditModule getModule() { + return module; + } + + public void setModule(AuditModule module) { + this.module = module; + } + + public FuncionSistema getFuncionSistema() { + return funcionSistema; + } + + public void setFuncionSistema(FuncionSistema funcionSistema) { + this.funcionSistema = funcionSistema; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Autobus.java b/src/com/rjconsultores/ventaboletos/entidad/Autobus.java new file mode 100644 index 000000000..9003969a9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Autobus.java @@ -0,0 +1,330 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "AUTOBUS_SEQ", sequenceName = "AUTOBUS_SEQ", allocationSize = 1) +@Table(name = "AUTOBUS") +public class Autobus implements Serializable, Auditavel { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "AUTOBUS_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AUTOBUS_SEQ") + private Integer autobusId; + + @Column(name = "NUMAUTOBUS") + private String numautobus; + @Column(name = "CANTPARADOS") + private Integer cantparados; + @Column(name = "DESCMODELO") + private String descmodelo; + @Column(name = "ANO") + private Integer ano; + @Column(name = "INDBANO") + private Boolean indbano; + @Column(name = "INDVIDEO") + private Boolean indvideo; + @Column(name = "INDAIRE") + private Boolean indaire; + @Column(name = "NUMMATRICULA") + private String nummatricula; + @Column(name = "PATRON") + private String patron; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "DIAGRAMAAUTOBUS_ID", referencedColumnName = "DIAGRAMAAUTOBUS_ID") + @ManyToOne + private DiagramaAutobus diagramaAutobus; + @JoinColumn(name = "DIAGRAMAAUTOBUS2_ID", referencedColumnName = "DIAGRAMAAUTOBUS_ID") + @ManyToOne + private DiagramaAutobus diagramaAutobusPiso; + @OneToMany(mappedBy = "autobus") + private List corridaList; + @JoinColumn(name = "MARCAAUTOBUS_ID", referencedColumnName = "MARCAAUTOBUS_ID") + @ManyToOne + private MarcaAutobus marcaAutobus; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "CIUDAD_ID", referencedColumnName = "CIUDAD_ID") + @ManyToOne + private Ciudad ciudad; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @OneToMany(mappedBy = "autobus", cascade = CascadeType.ALL) + private List autobusDocList; + @Column(name = "NUMVAGON") + private String numvagon; + + @Transient + @NaoAuditar + private Autobus autobusClone; + + public Autobus() { + } + + public Autobus(Integer autobusId) { + this.autobusId = autobusId; + } + + public Integer getAutobusId() { + return autobusId; + } + + public void setAutobusId(Integer autobusId) { + this.autobusId = autobusId; + } + + public String getNumautobus() { + return numautobus; + } + + public void setNumautobus(String numautobus) { + this.numautobus = numautobus; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public DiagramaAutobus getDiagramaAutobus() { + return diagramaAutobus; + } + + public void setDiagramaAutobus(DiagramaAutobus diagramaAutobus) { + this.diagramaAutobus = diagramaAutobus; + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + public DiagramaAutobus getDiagramaAutobusPiso() { + return diagramaAutobusPiso; + } + + public void setDiagramaAutobusPiso(DiagramaAutobus diagramaAutobusPiso) { + this.diagramaAutobusPiso = diagramaAutobusPiso; + } + + public Integer getCantparados() { + return cantparados; + } + + public void setCantparados(Integer cantparados) { + this.cantparados = cantparados; + } + + public String getDescmodelo() { + return descmodelo; + } + + public void setDescmodelo(String descmodelo) { + this.descmodelo = descmodelo; + } + + public Integer getAno() { + return ano; + } + + public void setAno(Integer ano) { + this.ano = ano; + } + + public Boolean getIndbano() { + return indbano; + } + + public void setIndbano(Boolean indbano) { + this.indbano = indbano; + } + + public Boolean getIndvideo() { + return indvideo; + } + + public void setIndvideo(Boolean indvideo) { + this.indvideo = indvideo; + } + + public Boolean getIndaire() { + return indaire; + } + + public void setIndaire(Boolean indaire) { + this.indaire = indaire; + } + + public String getNummatricula() { + return nummatricula; + } + + public void setNummatricula(String nummatricula) { + this.nummatricula = nummatricula; + } + + public String getPatron() { + return patron; + } + + public void setPatron(String patron) { + this.patron = patron; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getAutobusId() != null ? getAutobusId().hashCode() : 0); + return hash; + } + + public MarcaAutobus getMarcaAutobus() { + return marcaAutobus; + } + + public void setMarcaAutobus(MarcaAutobus marcaAutobus) { + this.marcaAutobus = marcaAutobus; + } + + public List getAutobusDocList() { + return autobusDocList; + } + + public void setAutobusDocList(List autobusDocList) { + this.autobusDocList = autobusDocList; + } + + public void addDoc(AutobusDoc doc){ + this.autobusDocList.add(doc); + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public void removeDoc(AutobusDoc doc){ + this.autobusDocList.remove(doc); + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Autobus)) { + return false; + } + Autobus other = (Autobus) object; + if ((this.getAutobusId() == null && other.getAutobusId() != null) || (this.getAutobusId() != null && !this.getAutobusId().equals(other.getAutobusId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNumautobus(); + } + + public String getNumvagon() { + return numvagon; + } + + public void setNumvagon(String numvagon) { + this.numvagon = numvagon; + } + + @Override + public void clonar() throws CloneNotSupportedException { + autobusClone = (Autobus) this.clone(); + } + + @Override + public Autobus getCloneObject() throws CloneNotSupportedException { + return autobusClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("AutobusID [%s]", getAutobusId()); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AutobusDoc.java b/src/com/rjconsultores/ventaboletos/entidad/AutobusDoc.java new file mode 100644 index 000000000..dea19e0ee --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AutobusDoc.java @@ -0,0 +1,100 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "AUTOBUS_DOC_SEQ", sequenceName = "AUTOBUS_DOC_SEQ", allocationSize = 1) +@Table(name = "AUTOBUS_DOC") +public class AutobusDoc { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "AUTOBUSDOC_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AUTOBUS_DOC_SEQ") + private Integer autobusDocId; + @ManyToOne + @JoinColumn(name = "AUTOBUS_ID", referencedColumnName = "AUTOBUS_ID") + private Autobus autobus; + @JoinColumn(name = "TIPODOCAUTOBUS_ID", referencedColumnName = "TIPODOCAUTOBUS_ID") + @ManyToOne + private TipoDocAutobus tipoDocAutobus; + @Column(name = "FECHACADUCIDAD") + private Date fechaCaducidad; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + public Integer getAutobusDocId() { + return autobusDocId; + } + public void setAutobusDocId(Integer autobusDocId) { + this.autobusDocId = autobusDocId; + } + public Autobus getAutobus() { + return autobus; + } + public void setAutobus(Autobus autobus) { + this.autobus = autobus; + } + public TipoDocAutobus getTipoDocAutobus() { + return tipoDocAutobus; + } + public void setTipoDocAutobus(TipoDocAutobus tipoDocAutobus) { + this.tipoDocAutobus = tipoDocAutobus; + } + public Date getFechaCaducidad() { + return fechaCaducidad; + } + public void setFechaCaducidad(Date fechaCaducidad) { + this.fechaCaducidad = fechaCaducidad; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AutobusDoc)) { + return false; + } + AutobusDoc other = (AutobusDoc) object; + if ((this.autobusDocId == null && other.autobusDocId != null) || (this.autobusDocId != null && !this.autobusDocId.equals(other.autobusDocId))) { + return false; + } + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Autorizacion.java b/src/com/rjconsultores/ventaboletos/entidad/Autorizacion.java new file mode 100644 index 000000000..26f7d7313 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Autorizacion.java @@ -0,0 +1,126 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "AUTORIZACION_SEQ", sequenceName = "AUTORIZACION_SEQ", allocationSize = 1) +@Table(name = "AUTORIZACION") +public class Autorizacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AUTORIZACION_SEQ") + @Column(name = "AUTORIZACION_ID") + private Integer autorizacionId; + @Column(name = "NOMBAUTORIZACION") + private String nombautorizacion; + @Column(name = "DESCAUTORIZACION") + private String descautorizacion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Autorizacion() { + } + + public Autorizacion(Integer autorizacionId) { + this.autorizacionId = autorizacionId; + } + + public Integer getAutorizacionId() { + return autorizacionId; + } + + public void setAutorizacionId(Integer autorizacionId) { + this.autorizacionId = autorizacionId; + } + + public String getNombautorizacion() { + return nombautorizacion; + } + + public void setNombautorizacion(String nombautorizacion) { + this.nombautorizacion = nombautorizacion; + } + + public String getDescautorizacion() { + return descautorizacion; + } + + public void setDescautorizacion(String descautorizacion) { + this.descautorizacion = descautorizacion; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (autorizacionId != null ? autorizacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Autorizacion)) { + return false; + } + Autorizacion other = (Autorizacion) object; + if ((this.autorizacionId == null && other.autorizacionId != null) || (this.autorizacionId != null && !this.autorizacionId.equals(other.autorizacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNombautorizacion(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AutorizacionPerfil.java b/src/com/rjconsultores/ventaboletos/entidad/AutorizacionPerfil.java new file mode 100644 index 000000000..fc5b966f6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AutorizacionPerfil.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "AUTORIZACION_PERFIL_SEQ", sequenceName = "AUTORIZACION_PERFIL_SEQ", allocationSize = 1) +@Table(name = "AUTORIZACION_PERFIL") +public class AutorizacionPerfil implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AUTORIZACION_PERFIL_SEQ") + @Column(name = "AUTORIZACIONPERFIL_ID") + private Integer autorizacionperfilId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "AUTORIZACION_ID") + private Autorizacion autorizacion; + @OneToOne + @JoinColumn(name = "PERFIL_ID") + private Perfil perfil; + + public AutorizacionPerfil() { + } + + public AutorizacionPerfil(Integer autorizacionperfilId) { + this.autorizacionperfilId = autorizacionperfilId; + } + + public Integer getAutorizacionperfilId() { + return autorizacionperfilId; + } + + public void setAutorizacionperfilId(Integer autorizacionperfilId) { + this.autorizacionperfilId = autorizacionperfilId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Autorizacion getAutorizacion() { + return autorizacion; + } + + public void setAutorizacion(Autorizacion autorizacion) { + this.autorizacion = autorizacion; + } + + public Perfil getPerfil() { + return perfil; + } + + public void setPerfil(Perfil perfil) { + this.perfil = perfil; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (autorizacionperfilId != null ? autorizacionperfilId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AutorizacionPerfil)) { + return false; + } + AutorizacionPerfil other = (AutorizacionPerfil) object; + if ((this.autorizacionperfilId == null && other.autorizacionperfilId != null) || (this.autorizacionperfilId != null && !this.autorizacionperfilId.equals(other.autorizacionperfilId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.AutorizacionPerfil[autorizacionperfilId=" + autorizacionperfilId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Banco.java b/src/com/rjconsultores/ventaboletos/entidad/Banco.java new file mode 100644 index 000000000..eb2ccfd5d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Banco.java @@ -0,0 +1,172 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "BANCO") +@SequenceGenerator(name = "BANCO_SEQ", sequenceName = "BANCO_SEQ", allocationSize = 1) +public class Banco implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "BANCO_SEQ") + @Column(name = "BANCO_ID") + private Integer bancoId; + @Column(name = "REFCONTRATO") + private String refcontrato; + @Column(name = "NOMBBANCO") + private String nombbanco; + @Column(name = "NUMCUENTA") + private BigDecimal numcuenta; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "MONEDA_ID", referencedColumnName = "MONEDA_ID") + @ManyToOne + private Moneda moneda; + + public Banco() { + } + + public Banco(Integer bancoId) { + this.bancoId = bancoId; + } + + public Integer getBancoId() { + return bancoId; + } + + public void setBancoId(Integer bancoId) { + this.bancoId = bancoId; + } + + public String getRefcontrato() { + return refcontrato; + } + + public void setRefcontrato(String refcontrato) { + this.refcontrato = refcontrato; + } + + public String getNombbanco() { + return nombbanco; + } + + public void setNombbanco(String nombbanco) { + this.nombbanco = nombbanco; + } + + public BigDecimal getNumcuenta() { + return numcuenta; + } + + public void setNumcuenta(BigDecimal numcuenta) { + this.numcuenta = numcuenta; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (bancoId != null ? bancoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Banco)) { + return false; + } + Banco other = (Banco) object; + if ((this.bancoId == null && other.bancoId != null) || (this.bancoId != null && !this.bancoId.equals(other.bancoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Banco[bancoId=" + bancoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Boleto.java b/src/com/rjconsultores/ventaboletos/entidad/Boleto.java new file mode 100644 index 000000000..753640b41 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Boleto.java @@ -0,0 +1,1252 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * Boleto generated by hbm2java + */ +@Entity +@Table(name = "BOLETO", schema = "VTABOL") +public class Boleto implements java.io.Serializable { + + private static final long serialVersionUID = 6202773630000194534L; + + @Id + @Column(name = "BOLETO_ID", unique = true, nullable = false, precision = 15, scale = 0) + private Long boletoId; + + @Column(name = "NUMASIENTO", length = 12) + private String numasiento; + + @Column(name = "CATEGORIA_ID", precision = 7, scale = 0) + private Integer categoriaId; + + @Column(name = "NUMFOLIOSISTEMA", length = 36) + private String numfoliosistema; + + @Column(name = "CLASESERVICIO_ID", precision = 2, scale = 0) + private Byte claseservicioId; + + @Column(name = "MARCA_ID", precision = 3, scale = 0) + private Short marcaId; + + @Column(name = "ORIGEN_ID", precision = 7, scale = 0) + private Integer origenId; + + @Column(name = "DESTINO_ID", precision = 7, scale = 0) + private Integer destinoId; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + + @Column(name = "CORRIDA_ID", precision = 7, scale = 0) + private Integer corridaId; + + @Temporal(TemporalType.DATE) + @Column(name = "FECCORRIDA", length = 7) + private Date feccorrida; + + @Column(name = "NOMBPASAJERO", length = 180) + private String nombpasajero; + + @Column(name = "PRECIOBASE", precision = 7) + private BigDecimal preciobase; + + @Column(name = "PRECIOPAGADO", precision = 7) + private BigDecimal preciopagado; + + @Column(name = "DESCUENTOAMPARADO", precision = 7) + private BigDecimal descuentoamparado; + + @Column(name = "TIPOVENTA_ID", precision = 2, scale = 0) + private Byte tipoventaId; + + @Column(name = "NUMSERIEPREIMPRESA", length = 30) + private String numseriepreimpresa; + + @Column(name = "NUMFOLIOPREIMPRESO", length = 36) + private String numfoliopreimpreso; + + @Temporal(TemporalType.DATE) + @Column(name = "FECHORVIAJE", length = 7) + private Date fechorviaje; + + @Temporal(TemporalType.DATE) + @Column(name = "FECHORVENTA", length = 7) + private Date fechorventa; + + @Temporal(TemporalType.DATE) + @Column(name = "FECHORVENTA_H", length = 7) + private Date fechorventaH; + + @Column(name = "NUMKMVIAJE", precision = 7) + private BigDecimal numkmviaje; + + @Column(name = "NUMOPERACION", length = 36) + private String numoperacion; + + @Column(name = "INDSTATUSOPERACION", length = 3) + private String indstatusoperacion; + + @Column(name = "MOTIVOCANCELACION_ID", precision = 2, scale = 0) + private Byte motivocancelacionId; + + @Column(name = "MOTIVOREIMPRESION_ID", precision = 2, scale = 0) + private Byte motivoreimpresionId; + + @Column(name = "CANTPUNTOS", precision = 6, scale = 0) + private Integer cantpuntos; + + @Column(name = "EMPRESAPUNTOVENTA_ID", precision = 7, scale = 0) + private Integer empresapuntoventaId; + + @Column(name = "EMPRESACORRIDA_ID", precision = 7, scale = 0) + private Integer empresacorridaId; + + @Column(name = "NUMRESERVACION", length = 36) + private String numreservacion; + + @Column(name = "TURNO_ID", precision = 2, scale = 0) + private Byte turnoId; + + @Column(name = "INDSTATUSBOLETO", length = 3) + private String indstatusboleto; + + @Column(name = "INDCANCELACION", precision = 1, scale = 0) + private Boolean indcancelacion; + + @Column(name = "INDREIMPRESION", precision = 1, scale = 0) + private Boolean indreimpresion; + + @Column(name = "INDVIAJEREDONDO", precision = 1, scale = 0) + private Boolean indviajeredondo; + + @Column(name = "INDEXTRAVIADO", precision = 1, scale = 0) + private Boolean indextraviado; + + @Column(name = "PARIDAD", precision = 7) + private BigDecimal paridad; + + @Column(name = "CONVENIODET_ID", precision = 7, scale = 0) + private Integer conveniodetId; + + @Temporal(TemporalType.DATE) + @Column(name = "FECCREACION", length = 7) + private Date feccreacion; + + @Column(name = "MONEDA_ID", precision = 7, scale = 0) + private Integer monedaId; + + @Column(name = "ESTACION_ID", precision = 7, scale = 0) + private Integer estacionId; + + @Column(name = "INDREPLICA", precision = 1, scale = 0) + private Boolean indreplica; + + @Column(name = "USUARIOAUTORIZACION_ID", precision = 7, scale = 0) + private Integer usuarioautorizacionId; + + @Column(name = "TIPOIDENTIFICACION_ID", precision = 2, scale = 0) + private Byte tipoidentificacionId; + + @Column(name = "NUMIDENTIFICACION", length = 60) + private String numidentificacion; + + @Column(name = "CLIENTEFIDELIDAD_ID", precision = 15, scale = 0) + private Long clientefidelidadId; + + @Column(name = "OPCIONAL1", precision = 7, scale = 0) + private Integer opcional1; + + @Column(name = "OPCIONAL2", precision = 7, scale = 0) + private Integer opcional2; + + @Column(name = "OPCIONAL3", length = 60) + private String opcional3; + + @Column(name = "PRECIOCARGOEXTRA", precision = 7) + private BigDecimal preciocargoextra; + + @Column(name = "PORCCATEGORIA", precision = 7) + private BigDecimal porccategoria; + + @Column(name = "PRECIOPRICING", precision = 7) + private BigDecimal preciopricing; + + @Column(name = "USUARIOREMOTO_ID", precision = 7, scale = 0) + private Integer usuarioremotoId; + + @Column(name = "PUNTOVENTAREMOTO_ID", precision = 7, scale = 0) + private Integer puntoventaremotoId; + + @Column(name = "CANTTRANSFERENCIA", precision = 2, scale = 0) + private Byte canttransferencia; + + @Column(name = "NUMDOCDESCUENTO", length = 30) + private String numdocdescuento; + + @Column(name = "ACTIVO", precision = 1, scale = 0) + private Boolean activo; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + private Date fecmodif; + + @OneToOne + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + private Usuario usuario; + + @Column(name = "NODO_ID", precision = 2, scale = 0) + private Byte nodoId; + + @Column(name = "ENTREGABOLETO_ID", precision = 10, scale = 0) + private Long entregaboletoId; + + @Column(name = "IMPORTECATEGORIA", precision = 7) + private BigDecimal importecategoria; + + @Column(name = "CLIENTE_ID", precision = 7, scale = 0) + private Integer clienteId; + + @Column(name = "BOLETOORIGINAL_ID", precision = 15, scale = 0) + private Long boletooriginalId; + + @Column(name = "IMPORTETAXAEMBARQUE", precision = 7) + private BigDecimal importetaxaembarque; + + @Column(name = "IMPORTEPEDAGIO", precision = 7) + private BigDecimal importepedagio; + + @Column(name = "IMPORTEOUTROS", precision = 7) + private BigDecimal importeoutros; + + @Column(name = "IMPORTESEGURO", precision = 7) + private BigDecimal importeseguro; + + @Column(name = "DESCORGAODOC", length = 15) + private String descorgaodoc; + + @Column(name = "DESCTIPODOC", length = 15) + private String desctipodoc; + + @Column(name = "DESCNUMDOC", length = 45) + private String descnumdoc; + + @Column(name = "NUMFIDELIDAD", length = 90) + private String numfidelidad; + + @Column(name = "INFOPASAJERO", length = 300) + private String infopasajero; + + @Column(name = "INDCONEXION", precision = 1, scale = 0) + private Boolean indconexion; + + @Column(name = "RUTA_ID", precision = 7, scale = 0) + private Integer rutaId; + + @Column(name = "LEVANTE_ID", precision = 7, scale = 0) + private Integer levanteId; + + @Column(name = "TIPOIDENTIFICACIONDOC_ID", precision = 7, scale = 0) + private Integer tipoidentificaciondocId; + + @Column(name = "ESTADOFOLIO_ID", precision = 7, scale = 0) + private Integer estadofolioId; + + @Column(name = "SERIEIMPFISCAL", length = 6) + private String serieimpfiscal; + + @Column(name = "DESCCORREO", length = 100) + private String desccorreo; + + @Column(name = "DESCTELEFONO", length = 15) + private String desctelefono; + + @Column(name = "NUMASIENTOVINCULADO", length = 12) + private String numasientovinculado; + + @Column(name = "DESCTIPODOC2", length = 15) + private String desctipodoc2; + + @Column(name = "DESCNUMDOC2", length = 45) + private String descnumdoc2; + + @Temporal(TemporalType.DATE) + @Column(name = "FECNACIMIENTO", length = 7) + private Date fecnacimiento; + + @Column(name = "INDSEGUNDAVIAIMPRESSA", precision = 1, scale = 0) + private Boolean indsegundaviaimpressa; + + @Column(name = "DISPOSITIVOEMBARCADA", length = 15) + private String dispositivoembarcada; + + @Column(name = "NUMEROBILHETEEMBARCADA", precision = 15, scale = 0) + private Long numerobilheteembarcada; + + @Column(name = "PTOVTAVENTA_ID", precision = 7, scale = 0) + private Integer ptovtaventaId; + + @Column(name = "CCF", length = 6) + private String ccf; + + @Column(name = "RMD_ID", precision = 15, scale = 0) + private Long rmdId; + + @Column(name = "SERIEIMPFISCALORIGINAL", length = 6) + private String serieimpfiscaloriginal; + + @Column(name = "BOLETOANTERIOR_ID", precision = 15, scale = 0) + private Long boletoanteriorId; + + @Column(name = "AIDF_ID", precision = 15, scale = 0) + private Long aidfId; + + @Column(name = "NACIONALIDAD", length = 30) + private String nacionalidad; + + @Column(name = "SEXO", length = 1) + private String sexo; + + @Column(name = "ESTADOCIVIL_ID", precision = 2, scale = 0) + private Byte estadocivilId; + + @Column(name = "IMEI_DISPOSITIVO_EMBARCADA", length = 20) + private String imeiDispositivoEmbarcada; + + @Column(name = "TEMPORESERVAFIDELIDADE", length = 7) + private Integer temporeservafidelidade; + + + public Boleto() { + } + + public Boleto(long boletoId) { + this.boletoId = boletoId; + } + + public Boleto(long boletoId, String numasiento, Integer categoriaId, String numfoliosistema, Byte claseservicioId, + Short marcaId, Integer origenId, Integer destinoId, PuntoVenta puntoVenta, Integer corridaId, + Date feccorrida, String nombpasajero, BigDecimal preciobase, BigDecimal preciopagado, + BigDecimal descuentoamparado, Byte tipoventaId, String numseriepreimpresa, String numfoliopreimpreso, + Date fechorviaje, Date fechorventa, BigDecimal numkmviaje, String numoperacion, String indstatusoperacion, + Byte motivocancelacionId, Byte motivoreimpresionId, Integer cantpuntos, Integer empresapuntoventaId, + Integer empresacorridaId, String numreservacion, Byte turnoId, String indstatusboleto, + Boolean indcancelacion, Boolean indreimpresion, Boolean indviajeredondo, Boolean indextraviado, + BigDecimal paridad, Integer conveniodetId, Date feccreacion, Integer monedaId, Integer estacionId, + Boolean indreplica, Integer usuarioautorizacionId, Byte tipoidentificacionId, String numidentificacion, + Long clientefidelidadId, Integer opcional1, Integer opcional2, String opcional3, + BigDecimal preciocargoextra, BigDecimal porccategoria, BigDecimal preciopricing, Integer usuarioremotoId, + Integer puntoventaremotoId, Byte canttransferencia, String numdocdescuento, Boolean activo, Date fecmodif, + Usuario usuario, Byte nodoId, Long entregaboletoId, BigDecimal importecategoria, Integer clienteId, + Long boletooriginalId, BigDecimal importetaxaembarque, BigDecimal importepedagio, BigDecimal importeoutros, + BigDecimal importeseguro, String descorgaodoc, String desctipodoc, String descnumdoc, String numfidelidad, + String infopasajero, Boolean indconexion, Integer rutaId, Integer levanteId, + Integer tipoidentificaciondocId, Integer estadofolioId, String serieimpfiscal, String desccorreo, + String desctelefono, String numasientovinculado, String desctipodoc2, String descnumdoc2, + Date fecnacimiento, Boolean indsegundaviaimpressa, String dispositivoembarcada, Long numerobilheteembarcada, + Integer ptovtaventaId, String ccf, Long rmdId, String serieimpfiscaloriginal, Long boletoanteriorId, + Long aidfId, String nacionalidad, String sexo, Byte estadocivilId) { + this.boletoId = boletoId; + this.numasiento = numasiento; + this.categoriaId = categoriaId; + this.numfoliosistema = numfoliosistema; + this.claseservicioId = claseservicioId; + this.marcaId = marcaId; + this.origenId = origenId; + this.destinoId = destinoId; + this.puntoVenta = puntoVenta; + this.corridaId = corridaId; + this.feccorrida = feccorrida; + this.nombpasajero = nombpasajero; + this.preciobase = preciobase; + this.preciopagado = preciopagado; + this.descuentoamparado = descuentoamparado; + this.tipoventaId = tipoventaId; + this.numseriepreimpresa = numseriepreimpresa; + this.numfoliopreimpreso = numfoliopreimpreso; + this.fechorviaje = fechorviaje; + this.fechorventa = fechorventa; + this.numkmviaje = numkmviaje; + this.numoperacion = numoperacion; + this.indstatusoperacion = indstatusoperacion; + this.motivocancelacionId = motivocancelacionId; + this.motivoreimpresionId = motivoreimpresionId; + this.cantpuntos = cantpuntos; + this.empresapuntoventaId = empresapuntoventaId; + this.empresacorridaId = empresacorridaId; + this.numreservacion = numreservacion; + this.turnoId = turnoId; + this.indstatusboleto = indstatusboleto; + this.indcancelacion = indcancelacion; + this.indreimpresion = indreimpresion; + this.indviajeredondo = indviajeredondo; + this.indextraviado = indextraviado; + this.paridad = paridad; + this.conveniodetId = conveniodetId; + this.feccreacion = feccreacion; + this.monedaId = monedaId; + this.estacionId = estacionId; + this.indreplica = indreplica; + this.usuarioautorizacionId = usuarioautorizacionId; + this.tipoidentificacionId = tipoidentificacionId; + this.numidentificacion = numidentificacion; + this.clientefidelidadId = clientefidelidadId; + this.opcional1 = opcional1; + this.opcional2 = opcional2; + this.opcional3 = opcional3; + this.preciocargoextra = preciocargoextra; + this.porccategoria = porccategoria; + this.preciopricing = preciopricing; + this.usuarioremotoId = usuarioremotoId; + this.puntoventaremotoId = puntoventaremotoId; + this.canttransferencia = canttransferencia; + this.numdocdescuento = numdocdescuento; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuario = usuario; + this.nodoId = nodoId; + this.entregaboletoId = entregaboletoId; + this.importecategoria = importecategoria; + this.clienteId = clienteId; + this.boletooriginalId = boletooriginalId; + this.importetaxaembarque = importetaxaembarque; + this.importepedagio = importepedagio; + this.importeoutros = importeoutros; + this.importeseguro = importeseguro; + this.descorgaodoc = descorgaodoc; + this.desctipodoc = desctipodoc; + this.descnumdoc = descnumdoc; + this.numfidelidad = numfidelidad; + this.infopasajero = infopasajero; + this.indconexion = indconexion; + this.rutaId = rutaId; + this.levanteId = levanteId; + this.tipoidentificaciondocId = tipoidentificaciondocId; + this.estadofolioId = estadofolioId; + this.serieimpfiscal = serieimpfiscal; + this.desccorreo = desccorreo; + this.desctelefono = desctelefono; + this.numasientovinculado = numasientovinculado; + this.desctipodoc2 = desctipodoc2; + this.descnumdoc2 = descnumdoc2; + this.fecnacimiento = fecnacimiento; + this.indsegundaviaimpressa = indsegundaviaimpressa; + this.dispositivoembarcada = dispositivoembarcada; + this.numerobilheteembarcada = numerobilheteembarcada; + this.ptovtaventaId = ptovtaventaId; + this.ccf = ccf; + this.rmdId = rmdId; + this.serieimpfiscaloriginal = serieimpfiscaloriginal; + this.boletoanteriorId = boletoanteriorId; + this.aidfId = aidfId; + this.nacionalidad = nacionalidad; + this.sexo = sexo; + this.estadocivilId = estadocivilId; + } + + public long getBoletoId() { + return this.boletoId; + } + + public void setBoletoId(long boletoId) { + this.boletoId = boletoId; + } + + public String getNumasiento() { + return this.numasiento; + } + + public void setNumasiento(String numasiento) { + this.numasiento = numasiento; + } + + public Integer getCategoriaId() { + return this.categoriaId; + } + + public void setCategoriaId(Integer categoriaId) { + this.categoriaId = categoriaId; + } + + public String getNumfoliosistema() { + return this.numfoliosistema; + } + + public void setNumfoliosistema(String numfoliosistema) { + this.numfoliosistema = numfoliosistema; + } + + public Byte getClaseservicioId() { + return this.claseservicioId; + } + + public void setClaseservicioId(Byte claseservicioId) { + this.claseservicioId = claseservicioId; + } + + public Short getMarcaId() { + return this.marcaId; + } + + public void setMarcaId(Short marcaId) { + this.marcaId = marcaId; + } + + public Integer getOrigenId() { + return this.origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return this.destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Integer getCorridaId() { + return this.corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Date getFeccorrida() { + return this.feccorrida; + } + + public void setFeccorrida(Date feccorrida) { + this.feccorrida = feccorrida; + } + + public String getNombpasajero() { + return this.nombpasajero; + } + + public void setNombpasajero(String nombpasajero) { + this.nombpasajero = nombpasajero; + } + + public BigDecimal getPreciobase() { + return this.preciobase; + } + + public void setPreciobase(BigDecimal preciobase) { + this.preciobase = preciobase; + } + + public BigDecimal getPreciopagado() { + return this.preciopagado; + } + + public void setPreciopagado(BigDecimal preciopagado) { + this.preciopagado = preciopagado; + } + + public BigDecimal getDescuentoamparado() { + return this.descuentoamparado; + } + + public void setDescuentoamparado(BigDecimal descuentoamparado) { + this.descuentoamparado = descuentoamparado; + } + + public Byte getTipoventaId() { + return this.tipoventaId; + } + + public void setTipoventaId(Byte tipoventaId) { + this.tipoventaId = tipoventaId; + } + + public String getNumseriepreimpresa() { + return this.numseriepreimpresa; + } + + public void setNumseriepreimpresa(String numseriepreimpresa) { + this.numseriepreimpresa = numseriepreimpresa; + } + + public String getNumfoliopreimpreso() { + return this.numfoliopreimpreso; + } + + public void setNumfoliopreimpreso(String numfoliopreimpreso) { + this.numfoliopreimpreso = numfoliopreimpreso; + } + + public Date getFechorviaje() { + return this.fechorviaje; + } + + public void setFechorviaje(Date fechorviaje) { + this.fechorviaje = fechorviaje; + } + + public Date getFechorventa() { + return this.fechorventa; + } + + public void setFechorventa(Date fechorventa) { + this.fechorventa = fechorventa; + } + + public BigDecimal getNumkmviaje() { + return this.numkmviaje; + } + + public void setNumkmviaje(BigDecimal numkmviaje) { + this.numkmviaje = numkmviaje; + } + + public String getNumoperacion() { + return this.numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public String getIndstatusoperacion() { + return this.indstatusoperacion; + } + + public void setIndstatusoperacion(String indstatusoperacion) { + this.indstatusoperacion = indstatusoperacion; + } + + public Byte getMotivocancelacionId() { + return this.motivocancelacionId; + } + + public void setMotivocancelacionId(Byte motivocancelacionId) { + this.motivocancelacionId = motivocancelacionId; + } + + public Byte getMotivoreimpresionId() { + return this.motivoreimpresionId; + } + + public void setMotivoreimpresionId(Byte motivoreimpresionId) { + this.motivoreimpresionId = motivoreimpresionId; + } + + public Integer getCantpuntos() { + return this.cantpuntos; + } + + public void setCantpuntos(Integer cantpuntos) { + this.cantpuntos = cantpuntos; + } + + public Integer getEmpresapuntoventaId() { + return this.empresapuntoventaId; + } + + public void setEmpresapuntoventaId(Integer empresapuntoventaId) { + this.empresapuntoventaId = empresapuntoventaId; + } + + public Integer getEmpresacorridaId() { + return this.empresacorridaId; + } + + public void setEmpresacorridaId(Integer empresacorridaId) { + this.empresacorridaId = empresacorridaId; + } + + public String getNumreservacion() { + return this.numreservacion; + } + + public void setNumreservacion(String numreservacion) { + this.numreservacion = numreservacion; + } + + public Byte getTurnoId() { + return this.turnoId; + } + + public void setTurnoId(Byte turnoId) { + this.turnoId = turnoId; + } + + public String getIndstatusboleto() { + return this.indstatusboleto; + } + + public void setIndstatusboleto(String indstatusboleto) { + this.indstatusboleto = indstatusboleto; + } + + public Boolean getIndcancelacion() { + return this.indcancelacion; + } + + public void setIndcancelacion(Boolean indcancelacion) { + this.indcancelacion = indcancelacion; + } + + public Boolean getIndreimpresion() { + return this.indreimpresion; + } + + public void setIndreimpresion(Boolean indreimpresion) { + this.indreimpresion = indreimpresion; + } + + public Boolean getIndviajeredondo() { + return this.indviajeredondo; + } + + public void setIndviajeredondo(Boolean indviajeredondo) { + this.indviajeredondo = indviajeredondo; + } + + public Boolean getIndextraviado() { + return this.indextraviado; + } + + public void setIndextraviado(Boolean indextraviado) { + this.indextraviado = indextraviado; + } + + public BigDecimal getParidad() { + return this.paridad; + } + + public void setParidad(BigDecimal paridad) { + this.paridad = paridad; + } + + public Integer getConveniodetId() { + return this.conveniodetId; + } + + public void setConveniodetId(Integer conveniodetId) { + this.conveniodetId = conveniodetId; + } + + public Date getFeccreacion() { + return this.feccreacion; + } + + public void setFeccreacion(Date feccreacion) { + this.feccreacion = feccreacion; + } + + public Integer getMonedaId() { + return this.monedaId; + } + + public void setMonedaId(Integer monedaId) { + this.monedaId = monedaId; + } + + public Integer getEstacionId() { + return this.estacionId; + } + + public void setEstacionId(Integer estacionId) { + this.estacionId = estacionId; + } + + public Boolean getIndreplica() { + return this.indreplica; + } + + public void setIndreplica(Boolean indreplica) { + this.indreplica = indreplica; + } + + public Integer getUsuarioautorizacionId() { + return this.usuarioautorizacionId; + } + + public void setUsuarioautorizacionId(Integer usuarioautorizacionId) { + this.usuarioautorizacionId = usuarioautorizacionId; + } + + public Byte getTipoidentificacionId() { + return this.tipoidentificacionId; + } + + public void setTipoidentificacionId(Byte tipoidentificacionId) { + this.tipoidentificacionId = tipoidentificacionId; + } + + public String getNumidentificacion() { + return this.numidentificacion; + } + + public void setNumidentificacion(String numidentificacion) { + this.numidentificacion = numidentificacion; + } + + public Long getClientefidelidadId() { + return this.clientefidelidadId; + } + + public void setClientefidelidadId(Long clientefidelidadId) { + this.clientefidelidadId = clientefidelidadId; + } + + public Integer getOpcional1() { + return this.opcional1; + } + + public void setOpcional1(Integer opcional1) { + this.opcional1 = opcional1; + } + + public Integer getOpcional2() { + return this.opcional2; + } + + public void setOpcional2(Integer opcional2) { + this.opcional2 = opcional2; + } + + public String getOpcional3() { + return this.opcional3; + } + + public void setOpcional3(String opcional3) { + this.opcional3 = opcional3; + } + + public BigDecimal getPreciocargoextra() { + return this.preciocargoextra; + } + + public void setPreciocargoextra(BigDecimal preciocargoextra) { + this.preciocargoextra = preciocargoextra; + } + + public BigDecimal getPorccategoria() { + return this.porccategoria; + } + + public void setPorccategoria(BigDecimal porccategoria) { + this.porccategoria = porccategoria; + } + + public BigDecimal getPreciopricing() { + return this.preciopricing; + } + + public void setPreciopricing(BigDecimal preciopricing) { + this.preciopricing = preciopricing; + } + + public Integer getUsuarioremotoId() { + return this.usuarioremotoId; + } + + public void setUsuarioremotoId(Integer usuarioremotoId) { + this.usuarioremotoId = usuarioremotoId; + } + + public Integer getPuntoventaremotoId() { + return this.puntoventaremotoId; + } + + public void setPuntoventaremotoId(Integer puntoventaremotoId) { + this.puntoventaremotoId = puntoventaremotoId; + } + + public Byte getCanttransferencia() { + return this.canttransferencia; + } + + public void setCanttransferencia(Byte canttransferencia) { + this.canttransferencia = canttransferencia; + } + + public String getNumdocdescuento() { + return this.numdocdescuento; + } + + public void setNumdocdescuento(String numdocdescuento) { + this.numdocdescuento = numdocdescuento; + } + + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public Byte getNodoId() { + return this.nodoId; + } + + public void setNodoId(Byte nodoId) { + this.nodoId = nodoId; + } + + public Long getEntregaboletoId() { + return this.entregaboletoId; + } + + public void setEntregaboletoId(Long entregaboletoId) { + this.entregaboletoId = entregaboletoId; + } + + public BigDecimal getImportecategoria() { + return this.importecategoria; + } + + public void setImportecategoria(BigDecimal importecategoria) { + this.importecategoria = importecategoria; + } + + public Integer getClienteId() { + return this.clienteId; + } + + public void setClienteId(Integer clienteId) { + this.clienteId = clienteId; + } + + public Long getBoletooriginalId() { + return this.boletooriginalId; + } + + public void setBoletooriginalId(Long boletooriginalId) { + this.boletooriginalId = boletooriginalId; + } + + public BigDecimal getImportetaxaembarque() { + return this.importetaxaembarque; + } + + public void setImportetaxaembarque(BigDecimal importetaxaembarque) { + this.importetaxaembarque = importetaxaembarque; + } + + public BigDecimal getImportepedagio() { + return this.importepedagio; + } + + public void setImportepedagio(BigDecimal importepedagio) { + this.importepedagio = importepedagio; + } + + public BigDecimal getImporteoutros() { + return this.importeoutros; + } + + public void setImporteoutros(BigDecimal importeoutros) { + this.importeoutros = importeoutros; + } + + public BigDecimal getImporteseguro() { + return this.importeseguro; + } + + public void setImporteseguro(BigDecimal importeseguro) { + this.importeseguro = importeseguro; + } + + public String getDescorgaodoc() { + return this.descorgaodoc; + } + + public void setDescorgaodoc(String descorgaodoc) { + this.descorgaodoc = descorgaodoc; + } + + public String getDesctipodoc() { + return this.desctipodoc; + } + + public void setDesctipodoc(String desctipodoc) { + this.desctipodoc = desctipodoc; + } + + public String getDescnumdoc() { + return this.descnumdoc; + } + + public void setDescnumdoc(String descnumdoc) { + this.descnumdoc = descnumdoc; + } + + public String getNumfidelidad() { + return this.numfidelidad; + } + + public void setNumfidelidad(String numfidelidad) { + this.numfidelidad = numfidelidad; + } + + public String getInfopasajero() { + return this.infopasajero; + } + + public void setInfopasajero(String infopasajero) { + this.infopasajero = infopasajero; + } + + public Boolean getIndconexion() { + return this.indconexion; + } + + public void setIndconexion(Boolean indconexion) { + this.indconexion = indconexion; + } + + public Integer getRutaId() { + return this.rutaId; + } + + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + + public Integer getLevanteId() { + return this.levanteId; + } + + public void setLevanteId(Integer levanteId) { + this.levanteId = levanteId; + } + + public Integer getTipoidentificaciondocId() { + return this.tipoidentificaciondocId; + } + + public void setTipoidentificaciondocId(Integer tipoidentificaciondocId) { + this.tipoidentificaciondocId = tipoidentificaciondocId; + } + + public Integer getEstadofolioId() { + return this.estadofolioId; + } + + public void setEstadofolioId(Integer estadofolioId) { + this.estadofolioId = estadofolioId; + } + + public String getSerieimpfiscal() { + return this.serieimpfiscal; + } + + public void setSerieimpfiscal(String serieimpfiscal) { + this.serieimpfiscal = serieimpfiscal; + } + + public String getDesccorreo() { + return this.desccorreo; + } + + public void setDesccorreo(String desccorreo) { + this.desccorreo = desccorreo; + } + + public String getDesctelefono() { + return this.desctelefono; + } + + public void setDesctelefono(String desctelefono) { + this.desctelefono = desctelefono; + } + + public String getNumasientovinculado() { + return this.numasientovinculado; + } + + public void setNumasientovinculado(String numasientovinculado) { + this.numasientovinculado = numasientovinculado; + } + + public String getDesctipodoc2() { + return this.desctipodoc2; + } + + public void setDesctipodoc2(String desctipodoc2) { + this.desctipodoc2 = desctipodoc2; + } + + public String getDescnumdoc2() { + return this.descnumdoc2; + } + + public void setDescnumdoc2(String descnumdoc2) { + this.descnumdoc2 = descnumdoc2; + } + + public Date getFecnacimiento() { + return this.fecnacimiento; + } + + public void setFecnacimiento(Date fecnacimiento) { + this.fecnacimiento = fecnacimiento; + } + + public Boolean getIndsegundaviaimpressa() { + return this.indsegundaviaimpressa; + } + + public void setIndsegundaviaimpressa(Boolean indsegundaviaimpressa) { + this.indsegundaviaimpressa = indsegundaviaimpressa; + } + + public String getDispositivoembarcada() { + return this.dispositivoembarcada; + } + + public void setDispositivoembarcada(String dispositivoembarcada) { + this.dispositivoembarcada = dispositivoembarcada; + } + + public Long getNumerobilheteembarcada() { + return this.numerobilheteembarcada; + } + + public void setNumerobilheteembarcada(Long numerobilheteembarcada) { + this.numerobilheteembarcada = numerobilheteembarcada; + } + + public Integer getPtovtaventaId() { + return this.ptovtaventaId; + } + + public void setPtovtaventaId(Integer ptovtaventaId) { + this.ptovtaventaId = ptovtaventaId; + } + + public String getCcf() { + return this.ccf; + } + + public void setCcf(String ccf) { + this.ccf = ccf; + } + + public Long getRmdId() { + return this.rmdId; + } + + public void setRmdId(Long rmdId) { + this.rmdId = rmdId; + } + + public String getSerieimpfiscaloriginal() { + return this.serieimpfiscaloriginal; + } + + public void setSerieimpfiscaloriginal(String serieimpfiscaloriginal) { + this.serieimpfiscaloriginal = serieimpfiscaloriginal; + } + + public Long getBoletoanteriorId() { + return this.boletoanteriorId; + } + + public void setBoletoanteriorId(Long boletoanteriorId) { + this.boletoanteriorId = boletoanteriorId; + } + + public Long getAidfId() { + return this.aidfId; + } + + public void setAidfId(Long aidfId) { + this.aidfId = aidfId; + } + + public String getNacionalidad() { + return this.nacionalidad; + } + + public void setNacionalidad(String nacionalidad) { + this.nacionalidad = nacionalidad; + } + + public String getSexo() { + return this.sexo; + } + + public void setSexo(String sexo) { + this.sexo = sexo; + } + + public Byte getEstadocivilId() { + return this.estadocivilId; + } + + public void setEstadocivilId(Byte estadocivilId) { + this.estadocivilId = estadocivilId; + } + + public String getImeiDispositivoEmbarcada() { + return imeiDispositivoEmbarcada; + } + + public void setImeiDispositivoEmbarcada(String imeiDispositivoEmbarcada) { + this.imeiDispositivoEmbarcada = imeiDispositivoEmbarcada; + } + + public Integer getTemporeservafidelidade() { + return temporeservafidelidade; + } + + public void setTemporeservafidelidade(Integer temporeservafidelidade) { + this.temporeservafidelidade = temporeservafidelidade; + } + + public Date getFechorventaH() { + return fechorventaH; + } + + public void setFechorventaH(Date fechorventaH) { + this.fechorventaH = fechorventaH; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Caja.java b/src/com/rjconsultores/ventaboletos/entidad/Caja.java new file mode 100644 index 000000000..a2677706d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Caja.java @@ -0,0 +1,1248 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "CAJA") +public class Caja implements java.io.Serializable { + + private static final long serialVersionUID = -4352546555190468104L; + + @Id + @Column(name = "CAJA_ID", unique = true, nullable = false, precision = 15, scale = 0) + private Long cajaId; + + @Column(name = "NUMASIENTO", length = 12) + private String numasiento; + + @Column(name = "CATEGORIA_ID") + private Integer categoriaId; + + @Column(name = "NUMFOLIOSISTEMA", length = 36) + private String numfoliosistema; + + @Column(name = "CLASESERVICIO_ID", precision = 2, scale = 0) + private Byte claseservicioId; + + @Column(name = "MARCA_ID", precision = 3, scale = 0) + private Short marcaId; + + @Column(name = "ORIGEN_ID", precision = 7, scale = 0) + private Integer origenId; + + @Column(name = "DESTINO_ID", precision = 7, scale = 0) + private Integer destinoId; + + @Column(name = "CORRIDA_ID", precision = 7, scale = 0) + private Integer corridaId; + + @Temporal(TemporalType.DATE) + @Column(name = "FECCORRIDA", length = 7) + private Date feccorrida; + + @Column(name = "NOMBPASAJERO", length = 180) + private String nombpasajero; + + @Column(name = "PRECIOBASE", precision = 7) + private BigDecimal preciobase; + + @Column(name = "PRECIOPAGADO", precision = 7) + private BigDecimal preciopagado; + + @Column(name = "DESCUENTOAMPARADO", precision = 7) + private BigDecimal descuentoamparado; + + @Column(name = "TIPOVENTA_ID", precision = 2, scale = 0) + private Byte tipoventaId; + + @Column(name = "NUMSERIEPREIMPRESA", length = 30) + private String numseriepreimpresa; + + @Column(name = "NUMFOLIOPREIMPRESO", length = 36) + private String numfoliopreimpreso; + + @Temporal(TemporalType.DATE) + @Column(name = "FECHORVIAJE", length = 7) + private Date fechorviaje; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECHORVENTA") + private Date fechorventa; + + @Column(name = "PUNTOVENTA_ID", precision = 7, scale = 0) + private Integer puntoventaId; + + @Column(name = "NUMKMVIAJE", precision = 7) + private BigDecimal numkmviaje; + + @Column(name = "NUMOPERACION", length = 36) + private String numoperacion; + + @Column(name = "INDSTATUSOPERACION", length = 3) + private String indstatusoperacion; + + @Column(name = "MOTIVOCANCELACION_ID", precision = 2, scale = 0) + private Byte motivocancelacionId; + + @Column(name = "MOTIVOREIMPRESION_ID", precision = 2, scale = 0) + private Byte motivoreimpresionId; + + @Column(name = "CANTPUNTOS", precision = 6, scale = 0) + private Integer cantpuntos; + + @Column(name = "EMPRESAPUNTOVENTA_ID", precision = 7, scale = 0) + private Integer empresapuntoventaId; + + @Column(name = "EMPRESACORRIDA_ID", precision = 7, scale = 0) + private Integer empresacorridaId; + + @Column(name = "NUMRESERVACION", length = 36) + private String numreservacion; + + @Column(name = "TURNO_ID", precision = 2, scale = 0) + private Byte turnoId; + + @Column(name = "INDSTATUSBOLETO", length = 3) + private String indstatusboleto; + + @Column(name = "INDCANCELACION", precision = 1, scale = 0) + private Boolean indcancelacion; + + @Column(name = "INDREIMPRESION", precision = 1, scale = 0) + private Boolean indreimpresion; + + @Column(name = "INDVIAJEREDONDO", precision = 1, scale = 0) + private Boolean indviajeredondo; + + @Temporal(TemporalType.DATE) + @Column(name = "FECCORTE", length = 7) + private Date feccorte; + + @Column(name = "INDEXTRAVIADO", precision = 1, scale = 0) + private Boolean indextraviado; + + @Column(name = "PARIDAD", precision = 7) + private BigDecimal paridad; + + @Temporal(TemporalType.DATE) + @Column(name = "FECCREACION", length = 7) + private Date feccreacion; + + @Column(name = "CONVENIODET_ID", precision = 7, scale = 0) + private Integer conveniodetId; + + @Column(name = "MONEDA_ID", precision = 7, scale = 0) + private Integer monedaId; + + @Column(name = "ESTACION_ID", precision = 7, scale = 0) + private Integer estacionId; + + @Column(name = "INDREPLICA", precision = 1, scale = 0) + private Boolean indreplica; + + @Column(name = "USUARIOAUTORIZACION_ID", precision = 7, scale = 0) + private Integer usuarioautorizacionId; + + @Column(name = "TIPOIDENTIFICACION_ID", precision = 2, scale = 0) + private Byte tipoidentificacionId; + + @Column(name = "NUMIDENTIFICACION", length = 60) + private String numidentificacion; + + @Column(name = "CLIENTEFIDELIDAD_ID", precision = 15, scale = 0) + private Long clientefidelidadId; + + @Column(name = "OPCIONAL1", precision = 7, scale = 0) + private Integer opcional1; + + @Column(name = "OPCIONAL2", precision = 7, scale = 0) + private Integer opcional2; + + @Column(name = "OPCIONAL3", length = 60) + private String opcional3; + + @Column(name = "PRECIOCARGOEXTRA", precision = 7) + private BigDecimal preciocargoextra; + + @Column(name = "PRECIOPRICING", precision = 7) + private BigDecimal preciopricing; + + @Column(name = "CAJAORIGINAL_ID", precision = 15, scale = 0) + private Long cajaoriginalId; + + @Column(name = "USUARIOREMOTO_ID", precision = 7, scale = 0) + private Integer usuarioremotoId; + + @Column(name = "PUNTOVENTAREMOTO_ID", precision = 7, scale = 0) + private Integer puntoventaremotoId; + + @Column(name = "NUMDOCDESCUENTO", length = 30) + private String numdocdescuento; + + @Column(name = "CANTTRANSFERENCIA", precision = 2, scale = 0) + private Byte canttransferencia; + + @Column(name = "ACTIVO", precision = 1, scale = 0) + private Boolean activo; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + private Date fecmodif; + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + private Integer usuarioId; + + @Column(name = "NODO_ID", precision = 2, scale = 0) + private Byte nodoId; + + @Column(name = "PORCCATEGORIA", precision = 7) + private BigDecimal porccategoria; + + @Column(name = "IMPORTECATEGORIA", precision = 7) + private BigDecimal importecategoria; + + @Column(name = "CLIENTE_ID", precision = 7, scale = 0) + private Integer clienteId; + + @Column(name = "PAGORECAUDACION_ID", precision = 7, scale = 0) + private Integer pagorecaudacionId; + + @Column(name = "PAGORECAUDACION2_ID", precision = 7, scale = 0) + private Integer pagorecaudacion2Id; + + @Column(name = "IMPORTETAXAEMBARQUE", precision = 7) + private BigDecimal importetaxaembarque; + + @Column(name = "IMPORTEPEDAGIO", precision = 7) + private BigDecimal importepedagio; + + @Column(name = "IMPORTEOUTROS", precision = 7) + private BigDecimal importeoutros; + + @Column(name = "IMPORTESEGURO", precision = 7) + private BigDecimal importeseguro; + + @Column(name = "INDCONEXION", precision = 1, scale = 0) + private Boolean indconexion; + + @Column(name = "LEVANTE_ID", precision = 7, scale = 0) + private Integer levanteId; + + @Column(name = "RUTA_ID", precision = 7, scale = 0) + private Integer rutaId; + + @Column(name = "SERIEIMPFISCAL", length = 6) + private String serieimpfiscal; + + @Temporal(TemporalType.DATE) + @Column(name = "FECINTEGRACION", length = 7) + private Date fecintegracion; + + @Column(name = "PTOVTAVENTA_ID", precision = 7, scale = 0) + private Integer ptovtaventaId; + + @Column(name = "INDREMOTOINVERSO", precision = 1, scale = 0) + private Boolean indremotoinverso; + + @Temporal(TemporalType.DATE) + @Column(name = "FECNACIMIENTO", length = 7) + private Date fecnacimiento; + + @Column(name = "DISPOSITIVOEMBARCADA", length = 15) + private String dispositivoembarcada; + + @Column(name = "NUMEROBILHETEEMBARCADA", precision = 15, scale = 0) + private Long numerobilheteembarcada; + + @Column(name = "NUMASIENTOVINCULADO", length = 3) + private String numasientovinculado; + + @Column(name = "CCF", length = 6) + private String ccf; + + @Temporal(TemporalType.DATE) + @Column(name = "FECHORVENTA_H") + private Date fechorventaH; + + @Column(name = "SERIEIMPFISCALORIGINAL", length = 6) + private String serieimpfiscaloriginal; + + @Column(name = "INDINTEGRADOAG", precision = 1, scale = 0) + private Boolean indintegradoag; + + @Column(name = "TRANSACAO_ID", precision = 15, scale = 0) + private Long transacaoId; + + @Column(name = "TRANSACAOORIGINAL_ID", precision = 15, scale = 0) + private Long transacaooriginalId; + + @Column(name = "DESCNUMDOC", length = 45) + private String descnumdoc; + + @Column(name = "DESCNUMDOC2", length = 45) + private String descnumdoc2; + + @Column(name = "DESCTIPODOC", length = 15) + private String desctipodoc; + + @Column(name = "DESCTIPODOC2", length = 15) + private String desctipodoc2; + + @Column(name = "DESCTELEFONO", length = 15) + private String desctelefono; + + @Column(name = "AIDF_ID", precision = 15, scale = 0) + private Long aidfId; + + @Column(name = "NACIONALIDAD", length = 30) + private String nacionalidad; + + @Column(name = "SEXO", length = 1) + private String sexo; + + @OneToMany(mappedBy = "caja") + private List cajaFormaPago; + + @Column(name = "INTEGRADOTOTVS", precision = 1, scale = 0) + private Integer integradoTotvs; + + @Column(name = "ERRO", precision = 1, scale = 0) + private String erro; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECHORINTEGRADOTOTVS") + private Date fechorIntegradoTotvs; + + @Column(name = "CONTADORINTEGRADOTOTVS", precision = 7, scale = 0) + private Integer contadorIntegradoTotvs; + + + public Caja() { + } + + public Caja(Long cajaId, boolean indintegradoag) { + this.cajaId = cajaId; + this.indintegradoag = indintegradoag; + } + + public Caja(Long cajaId, String numasiento, Integer categoriaId, String numfoliosistema, Byte claseservicioId, + Short marcaId, Integer origenId, Integer destinoId, Integer corridaId, Date feccorrida, String nombpasajero, + BigDecimal preciobase, BigDecimal preciopagado, BigDecimal descuentoamparado, Byte tipoventaId, + String numseriepreimpresa, String numfoliopreimpreso, Date fechorviaje, Date fechorventa, + Integer puntoventaId, BigDecimal numkmviaje, String numoperacion, String indstatusoperacion, + Byte motivocancelacionId, Byte motivoreimpresionId, Integer cantpuntos, Integer empresapuntoventaId, + Integer empresacorridaId, String numreservacion, Byte turnoId, String indstatusboleto, + Boolean indcancelacion, Boolean indreimpresion, Boolean indviajeredondo, Date feccorte, + Boolean indextraviado, BigDecimal paridad, Date feccreacion, Integer conveniodetId, Integer monedaId, + Integer estacionId, Boolean indreplica, Integer usuarioautorizacionId, Byte tipoidentificacionId, + String numidentificacion, Long clientefidelidadId, Integer opcional1, Integer opcional2, String opcional3, + BigDecimal preciocargoextra, BigDecimal preciopricing, Long cajaoriginalId, Integer usuarioremotoId, + Integer puntoventaremotoId, String numdocdescuento, Byte canttransferencia, Boolean activo, Date fecmodif, + Integer usuarioId, Byte nodoId, BigDecimal porccategoria, BigDecimal importecategoria, Integer clienteId, + Integer pagorecaudacionId, Integer pagorecaudacion2Id, BigDecimal importetaxaembarque, + BigDecimal importepedagio, BigDecimal importeoutros, BigDecimal importeseguro, Boolean indconexion, + Integer levanteId, Integer rutaId, String serieimpfiscal, Date fecintegracion, Integer ptovtaventaId, + Boolean indremotoinverso, Date fecnacimiento, String dispositivoembarcada, Long numerobilheteembarcada, + String numasientovinculado, String ccf, Date fechorventaH, String serieimpfiscaloriginal, + Boolean indintegradoag, Long transacaoId, Long transacaooriginalId, String descnumdoc, String descnumdoc2, + String desctipodoc, String desctipodoc2, String desctelefono, Long aidfId, String nacionalidad, + String sexo) { + this.cajaId = cajaId; + this.numasiento = numasiento; + this.categoriaId = categoriaId; + this.numfoliosistema = numfoliosistema; + this.claseservicioId = claseservicioId; + this.marcaId = marcaId; + this.origenId = origenId; + this.destinoId = destinoId; + this.corridaId = corridaId; + this.feccorrida = feccorrida; + this.nombpasajero = nombpasajero; + this.preciobase = preciobase; + this.preciopagado = preciopagado; + this.descuentoamparado = descuentoamparado; + this.tipoventaId = tipoventaId; + this.numseriepreimpresa = numseriepreimpresa; + this.numfoliopreimpreso = numfoliopreimpreso; + this.fechorviaje = fechorviaje; + this.fechorventa = fechorventa; + this.puntoventaId = puntoventaId; + this.numkmviaje = numkmviaje; + this.numoperacion = numoperacion; + this.indstatusoperacion = indstatusoperacion; + this.motivocancelacionId = motivocancelacionId; + this.motivoreimpresionId = motivoreimpresionId; + this.cantpuntos = cantpuntos; + this.empresapuntoventaId = empresapuntoventaId; + this.empresacorridaId = empresacorridaId; + this.numreservacion = numreservacion; + this.turnoId = turnoId; + this.indstatusboleto = indstatusboleto; + this.indcancelacion = indcancelacion; + this.indreimpresion = indreimpresion; + this.indviajeredondo = indviajeredondo; + this.feccorte = feccorte; + this.indextraviado = indextraviado; + this.paridad = paridad; + this.feccreacion = feccreacion; + this.conveniodetId = conveniodetId; + this.monedaId = monedaId; + this.estacionId = estacionId; + this.indreplica = indreplica; + this.usuarioautorizacionId = usuarioautorizacionId; + this.tipoidentificacionId = tipoidentificacionId; + this.numidentificacion = numidentificacion; + this.clientefidelidadId = clientefidelidadId; + this.opcional1 = opcional1; + this.opcional2 = opcional2; + this.opcional3 = opcional3; + this.preciocargoextra = preciocargoextra; + this.preciopricing = preciopricing; + this.cajaoriginalId = cajaoriginalId; + this.usuarioremotoId = usuarioremotoId; + this.puntoventaremotoId = puntoventaremotoId; + this.numdocdescuento = numdocdescuento; + this.canttransferencia = canttransferencia; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.nodoId = nodoId; + this.porccategoria = porccategoria; + this.importecategoria = importecategoria; + this.clienteId = clienteId; + this.pagorecaudacionId = pagorecaudacionId; + this.pagorecaudacion2Id = pagorecaudacion2Id; + this.importetaxaembarque = importetaxaembarque; + this.importepedagio = importepedagio; + this.importeoutros = importeoutros; + this.importeseguro = importeseguro; + this.indconexion = indconexion; + this.levanteId = levanteId; + this.rutaId = rutaId; + this.serieimpfiscal = serieimpfiscal; + this.fecintegracion = fecintegracion; + this.ptovtaventaId = ptovtaventaId; + this.indremotoinverso = indremotoinverso; + this.fecnacimiento = fecnacimiento; + this.dispositivoembarcada = dispositivoembarcada; + this.numerobilheteembarcada = numerobilheteembarcada; + this.numasientovinculado = numasientovinculado; + this.ccf = ccf; + this.fechorventaH = fechorventaH; + this.serieimpfiscaloriginal = serieimpfiscaloriginal; + this.indintegradoag = indintegradoag; + this.transacaoId = transacaoId; + this.transacaooriginalId = transacaooriginalId; + this.descnumdoc = descnumdoc; + this.descnumdoc2 = descnumdoc2; + this.desctipodoc = desctipodoc; + this.desctipodoc2 = desctipodoc2; + this.desctelefono = desctelefono; + this.aidfId = aidfId; + this.nacionalidad = nacionalidad; + this.sexo = sexo; + } + + public Long getCajaId() { + return this.cajaId; + } + + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + + public String getNumasiento() { + return this.numasiento; + } + + public void setNumasiento(String numasiento) { + this.numasiento = numasiento; + } + + public Integer getCategoriaId() { + return this.categoriaId; + } + + public void setCategoriaId(Integer categoriaId) { + this.categoriaId = categoriaId; + } + + public String getNumfoliosistema() { + return this.numfoliosistema; + } + + public void setNumfoliosistema(String numfoliosistema) { + this.numfoliosistema = numfoliosistema; + } + + public Byte getClaseservicioId() { + return this.claseservicioId; + } + + public void setClaseservicioId(Byte claseservicioId) { + this.claseservicioId = claseservicioId; + } + + public Short getMarcaId() { + return this.marcaId; + } + + public void setMarcaId(Short marcaId) { + this.marcaId = marcaId; + } + + public Integer getOrigenId() { + return this.origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return this.destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public Integer getCorridaId() { + return this.corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Date getFeccorrida() { + return this.feccorrida; + } + + public void setFeccorrida(Date feccorrida) { + this.feccorrida = feccorrida; + } + + public String getNombpasajero() { + return this.nombpasajero; + } + + public void setNombpasajero(String nombpasajero) { + this.nombpasajero = nombpasajero; + } + + public BigDecimal getPreciobase() { + return this.preciobase; + } + + public void setPreciobase(BigDecimal preciobase) { + this.preciobase = preciobase; + } + + public BigDecimal getPreciopagado() { + return this.preciopagado; + } + + public void setPreciopagado(BigDecimal preciopagado) { + this.preciopagado = preciopagado; + } + + public BigDecimal getDescuentoamparado() { + return this.descuentoamparado; + } + + public void setDescuentoamparado(BigDecimal descuentoamparado) { + this.descuentoamparado = descuentoamparado; + } + + public Byte getTipoventaId() { + return this.tipoventaId; + } + + public void setTipoventaId(Byte tipoventaId) { + this.tipoventaId = tipoventaId; + } + + public String getNumseriepreimpresa() { + return this.numseriepreimpresa; + } + + public void setNumseriepreimpresa(String numseriepreimpresa) { + this.numseriepreimpresa = numseriepreimpresa; + } + + public String getNumfoliopreimpreso() { + return this.numfoliopreimpreso; + } + + public void setNumfoliopreimpreso(String numfoliopreimpreso) { + this.numfoliopreimpreso = numfoliopreimpreso; + } + + public Date getFechorviaje() { + return this.fechorviaje; + } + + public void setFechorviaje(Date fechorviaje) { + this.fechorviaje = fechorviaje; + } + + public Date getFechorventa() { + return this.fechorventa; + } + + public void setFechorventa(Date fechorventa) { + this.fechorventa = fechorventa; + } + + public Integer getPuntoventaId() { + return this.puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public BigDecimal getNumkmviaje() { + return this.numkmviaje; + } + + public void setNumkmviaje(BigDecimal numkmviaje) { + this.numkmviaje = numkmviaje; + } + + public String getNumoperacion() { + return this.numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public String getIndstatusoperacion() { + return this.indstatusoperacion; + } + + public void setIndstatusoperacion(String indstatusoperacion) { + this.indstatusoperacion = indstatusoperacion; + } + + public Byte getMotivocancelacionId() { + return this.motivocancelacionId; + } + + public void setMotivocancelacionId(Byte motivocancelacionId) { + this.motivocancelacionId = motivocancelacionId; + } + + public Byte getMotivoreimpresionId() { + return this.motivoreimpresionId; + } + + public void setMotivoreimpresionId(Byte motivoreimpresionId) { + this.motivoreimpresionId = motivoreimpresionId; + } + + public Integer getCantpuntos() { + return this.cantpuntos; + } + + public void setCantpuntos(Integer cantpuntos) { + this.cantpuntos = cantpuntos; + } + + public Integer getEmpresapuntoventaId() { + return this.empresapuntoventaId; + } + + public void setEmpresapuntoventaId(Integer empresapuntoventaId) { + this.empresapuntoventaId = empresapuntoventaId; + } + + public Integer getEmpresacorridaId() { + return this.empresacorridaId; + } + + public void setEmpresacorridaId(Integer empresacorridaId) { + this.empresacorridaId = empresacorridaId; + } + + public String getNumreservacion() { + return this.numreservacion; + } + + public void setNumreservacion(String numreservacion) { + this.numreservacion = numreservacion; + } + + public Byte getTurnoId() { + return this.turnoId; + } + + public void setTurnoId(Byte turnoId) { + this.turnoId = turnoId; + } + + public String getIndstatusboleto() { + return this.indstatusboleto; + } + + public void setIndstatusboleto(String indstatusboleto) { + this.indstatusboleto = indstatusboleto; + } + + public Boolean getIndcancelacion() { + return this.indcancelacion; + } + + public void setIndcancelacion(Boolean indcancelacion) { + this.indcancelacion = indcancelacion; + } + + public Boolean getIndreimpresion() { + return this.indreimpresion; + } + + public void setIndreimpresion(Boolean indreimpresion) { + this.indreimpresion = indreimpresion; + } + + public Boolean getIndviajeredondo() { + return this.indviajeredondo; + } + + public void setIndviajeredondo(Boolean indviajeredondo) { + this.indviajeredondo = indviajeredondo; + } + + public Date getFeccorte() { + return this.feccorte; + } + + public void setFeccorte(Date feccorte) { + this.feccorte = feccorte; + } + + public Boolean getIndextraviado() { + return this.indextraviado; + } + + public void setIndextraviado(Boolean indextraviado) { + this.indextraviado = indextraviado; + } + + public BigDecimal getParidad() { + return this.paridad; + } + + public void setParidad(BigDecimal paridad) { + this.paridad = paridad; + } + + public Date getFeccreacion() { + return this.feccreacion; + } + + public void setFeccreacion(Date feccreacion) { + this.feccreacion = feccreacion; + } + + public Integer getConveniodetId() { + return this.conveniodetId; + } + + public void setConveniodetId(Integer conveniodetId) { + this.conveniodetId = conveniodetId; + } + + public Integer getMonedaId() { + return this.monedaId; + } + + public void setMonedaId(Integer monedaId) { + this.monedaId = monedaId; + } + + public Integer getEstacionId() { + return this.estacionId; + } + + public void setEstacionId(Integer estacionId) { + this.estacionId = estacionId; + } + + public Boolean getIndreplica() { + return this.indreplica; + } + + public void setIndreplica(Boolean indreplica) { + this.indreplica = indreplica; + } + + public Integer getUsuarioautorizacionId() { + return this.usuarioautorizacionId; + } + + public void setUsuarioautorizacionId(Integer usuarioautorizacionId) { + this.usuarioautorizacionId = usuarioautorizacionId; + } + + public Byte getTipoidentificacionId() { + return this.tipoidentificacionId; + } + + public void setTipoidentificacionId(Byte tipoidentificacionId) { + this.tipoidentificacionId = tipoidentificacionId; + } + + public String getNumidentificacion() { + return this.numidentificacion; + } + + public void setNumidentificacion(String numidentificacion) { + this.numidentificacion = numidentificacion; + } + + public Long getClientefidelidadId() { + return this.clientefidelidadId; + } + + public void setClientefidelidadId(Long clientefidelidadId) { + this.clientefidelidadId = clientefidelidadId; + } + + public Integer getOpcional1() { + return this.opcional1; + } + + public void setOpcional1(Integer opcional1) { + this.opcional1 = opcional1; + } + + public Integer getOpcional2() { + return this.opcional2; + } + + public void setOpcional2(Integer opcional2) { + this.opcional2 = opcional2; + } + + public String getOpcional3() { + return this.opcional3; + } + + public void setOpcional3(String opcional3) { + this.opcional3 = opcional3; + } + + public BigDecimal getPreciocargoextra() { + return this.preciocargoextra; + } + + public void setPreciocargoextra(BigDecimal preciocargoextra) { + this.preciocargoextra = preciocargoextra; + } + + public BigDecimal getPreciopricing() { + return this.preciopricing; + } + + public void setPreciopricing(BigDecimal preciopricing) { + this.preciopricing = preciopricing; + } + + public Long getCajaoriginalId() { + return this.cajaoriginalId; + } + + public void setCajaoriginalId(Long cajaoriginalId) { + this.cajaoriginalId = cajaoriginalId; + } + + public Integer getUsuarioremotoId() { + return this.usuarioremotoId; + } + + public void setUsuarioremotoId(Integer usuarioremotoId) { + this.usuarioremotoId = usuarioremotoId; + } + + public Integer getPuntoventaremotoId() { + return this.puntoventaremotoId; + } + + public void setPuntoventaremotoId(Integer puntoventaremotoId) { + this.puntoventaremotoId = puntoventaremotoId; + } + + public String getNumdocdescuento() { + return this.numdocdescuento; + } + + public void setNumdocdescuento(String numdocdescuento) { + this.numdocdescuento = numdocdescuento; + } + + public Byte getCanttransferencia() { + return this.canttransferencia; + } + + public void setCanttransferencia(Byte canttransferencia) { + this.canttransferencia = canttransferencia; + } + + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Byte getNodoId() { + return this.nodoId; + } + + public void setNodoId(Byte nodoId) { + this.nodoId = nodoId; + } + + public BigDecimal getPorccategoria() { + return this.porccategoria; + } + + public void setPorccategoria(BigDecimal porccategoria) { + this.porccategoria = porccategoria; + } + + public BigDecimal getImportecategoria() { + return this.importecategoria; + } + + public void setImportecategoria(BigDecimal importecategoria) { + this.importecategoria = importecategoria; + } + + public Integer getClienteId() { + return this.clienteId; + } + + public void setClienteId(Integer clienteId) { + this.clienteId = clienteId; + } + + public Integer getPagorecaudacionId() { + return this.pagorecaudacionId; + } + + public void setPagorecaudacionId(Integer pagorecaudacionId) { + this.pagorecaudacionId = pagorecaudacionId; + } + + public Integer getPagorecaudacion2Id() { + return this.pagorecaudacion2Id; + } + + public void setPagorecaudacion2Id(Integer pagorecaudacion2Id) { + this.pagorecaudacion2Id = pagorecaudacion2Id; + } + + public BigDecimal getImportetaxaembarque() { + return this.importetaxaembarque; + } + + public void setImportetaxaembarque(BigDecimal importetaxaembarque) { + this.importetaxaembarque = importetaxaembarque; + } + + public BigDecimal getImportepedagio() { + return this.importepedagio; + } + + public void setImportepedagio(BigDecimal importepedagio) { + this.importepedagio = importepedagio; + } + + public BigDecimal getImporteoutros() { + return this.importeoutros; + } + + public void setImporteoutros(BigDecimal importeoutros) { + this.importeoutros = importeoutros; + } + + public BigDecimal getImporteseguro() { + return this.importeseguro; + } + + public void setImporteseguro(BigDecimal importeseguro) { + this.importeseguro = importeseguro; + } + + public Boolean getIndconexion() { + return this.indconexion; + } + + public void setIndconexion(Boolean indconexion) { + this.indconexion = indconexion; + } + + public Integer getLevanteId() { + return this.levanteId; + } + + public void setLevanteId(Integer levanteId) { + this.levanteId = levanteId; + } + + public Integer getRutaId() { + return this.rutaId; + } + + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + + public String getSerieimpfiscal() { + return this.serieimpfiscal; + } + + public void setSerieimpfiscal(String serieimpfiscal) { + this.serieimpfiscal = serieimpfiscal; + } + + public Date getFecintegracion() { + return this.fecintegracion; + } + + public void setFecintegracion(Date fecintegracion) { + this.fecintegracion = fecintegracion; + } + + public Integer getPtovtaventaId() { + return this.ptovtaventaId; + } + + public void setPtovtaventaId(Integer ptovtaventaId) { + this.ptovtaventaId = ptovtaventaId; + } + + public Boolean getIndremotoinverso() { + return this.indremotoinverso; + } + + public void setIndremotoinverso(Boolean indremotoinverso) { + this.indremotoinverso = indremotoinverso; + } + + public Date getFecnacimiento() { + return this.fecnacimiento; + } + + public void setFecnacimiento(Date fecnacimiento) { + this.fecnacimiento = fecnacimiento; + } + + public String getDispositivoembarcada() { + return this.dispositivoembarcada; + } + + public void setDispositivoembarcada(String dispositivoembarcada) { + this.dispositivoembarcada = dispositivoembarcada; + } + + public Long getNumerobilheteembarcada() { + return this.numerobilheteembarcada; + } + + public void setNumerobilheteembarcada(Long numerobilheteembarcada) { + this.numerobilheteembarcada = numerobilheteembarcada; + } + + public String getNumasientovinculado() { + return this.numasientovinculado; + } + + public void setNumasientovinculado(String numasientovinculado) { + this.numasientovinculado = numasientovinculado; + } + + public String getCcf() { + return this.ccf; + } + + public void setCcf(String ccf) { + this.ccf = ccf; + } + + public Date getFechorventaH() { + return this.fechorventaH; + } + + public void setFechorventaH(Date fechorventaH) { + this.fechorventaH = fechorventaH; + } + + public String getSerieimpfiscaloriginal() { + return this.serieimpfiscaloriginal; + } + + public void setSerieimpfiscaloriginal(String serieimpfiscaloriginal) { + this.serieimpfiscaloriginal = serieimpfiscaloriginal; + } + + public Boolean isIndintegradoag() { + return this.indintegradoag; + } + + public void setIndintegradoag(Boolean indintegradoag) { + this.indintegradoag = indintegradoag; + } + + public Long getTransacaoId() { + return this.transacaoId; + } + + public void setTransacaoId(Long transacaoId) { + this.transacaoId = transacaoId; + } + + public Long getTransacaooriginalId() { + return this.transacaooriginalId; + } + + public void setTransacaooriginalId(Long transacaooriginalId) { + this.transacaooriginalId = transacaooriginalId; + } + + public String getDescnumdoc() { + return this.descnumdoc; + } + + public void setDescnumdoc(String descnumdoc) { + this.descnumdoc = descnumdoc; + } + + public String getDescnumdoc2() { + return this.descnumdoc2; + } + + public void setDescnumdoc2(String descnumdoc2) { + this.descnumdoc2 = descnumdoc2; + } + + public String getDesctipodoc() { + return this.desctipodoc; + } + + public void setDesctipodoc(String desctipodoc) { + this.desctipodoc = desctipodoc; + } + + public String getDesctipodoc2() { + return this.desctipodoc2; + } + + public void setDesctipodoc2(String desctipodoc2) { + this.desctipodoc2 = desctipodoc2; + } + + public String getDesctelefono() { + return this.desctelefono; + } + + public void setDesctelefono(String desctelefono) { + this.desctelefono = desctelefono; + } + + public Long getAidfId() { + return this.aidfId; + } + + public void setAidfId(Long aidfId) { + this.aidfId = aidfId; + } + + public String getNacionalidad() { + return this.nacionalidad; + } + + public void setNacionalidad(String nacionalidad) { + this.nacionalidad = nacionalidad; + } + + public String getSexo() { + return this.sexo; + } + + public void setSexo(String sexo) { + this.sexo = sexo; + } + + public List getCajaFormaPago() { + return cajaFormaPago; + } + + public void setCajaFormaPago(List cajaFormaPago) { + this.cajaFormaPago = cajaFormaPago; + } + + public Integer getIntegradoTotvs() { + return integradoTotvs; + } + + public void setIntegradoTotvs(Integer integradoTotvs) { + this.integradoTotvs = integradoTotvs; + } + + public String getErro() { + return erro; + } + + public void setErro(String erro) { + this.erro = erro; + } + + public Date getFechorIntegradoTotvs() { + return fechorIntegradoTotvs; + } + + public void setFechorIntegradoTotvs(Date fechorIntegradoTotvs) { + this.fechorIntegradoTotvs = fechorIntegradoTotvs; + } + + public Integer getContadorIntegradoTotvs() { + return contadorIntegradoTotvs; + } + + public void setContadorIntegradoTotvs(Integer contadorIntegradoTotvs) { + this.contadorIntegradoTotvs = contadorIntegradoTotvs; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CajaDetPago.java b/src/com/rjconsultores/ventaboletos/entidad/CajaDetPago.java new file mode 100644 index 000000000..39f10c058 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CajaDetPago.java @@ -0,0 +1,249 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "CAJA_DET_PAGO") +public class CajaDetPago implements java.io.Serializable { + + private static final long serialVersionUID = 7865266026539127982L; + + @Id + @Column(name = "CAJADETPAGO_ID", unique = true, nullable = false, precision = 15, scale = 0) + private Long cajaDetPagoId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CAJAFORMAPAGO_ID") + private CajaFormaPago cajaFormaPago; + + @Column(name = "NUMOPERACION", length = 36) + private String numoperacion; + + @OneToOne + @JoinColumn(name = "FORMAPAGO_ID") + private FormaPago formaPago; + + @Column(name = "NUMDOCUMENTO", length = 60) + private String numdocumento; + + @Column(name = "OPCIONAL1", length = 60) + private String opcional1; + + @Column(name = "OPCIONAL2", length = 60) + private String opcional2; + + @Column(name = "OPCIONAL3", length = 60) + private String opcional3; + + @Column(name = "IMPORTE1", precision = 8) + private BigDecimal importe1; + + @Column(name = "IMPORTE2", precision = 8) + private BigDecimal importe2; + + @Column(name = "INDREPLICA", precision = 1, scale = 0) + private Boolean indreplica; + + @Column(name = "ACTIVO", precision = 1, scale = 0) + private Boolean activo; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + private Date fecmodif; + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + private Integer usuarioId; + + @Column(name = "NODO_ID", precision = 2, scale = 0) + private Byte nodoId; + + @ManyToOne + @JoinColumn(name = "CAJA_ID") + private Caja caja; + + @ManyToOne + @JoinColumn(name = "OCD_ID") + private OCD ocd; + + @Column(name = "NOTACREDITOVENDAPACOTE_ID", precision = 7, scale = 0) + private Integer notacreditovendapacoteId; + + @OneToOne(mappedBy = "cajaDetPago") + private CajaTarjeta cajaTarjetas; + + @Column(name = "SERIESUBSERIE", length = 30) + private String serieSubSerie; + + public Long getCajaDetPagoId() { + return cajaDetPagoId; + } + + public void setCajaDetPagoId(Long cajaDetPagoId) { + this.cajaDetPagoId = cajaDetPagoId; + } + + public CajaFormaPago getCajaFormaPago() { + return cajaFormaPago; + } + + public void setCajaFormaPago(CajaFormaPago cajaFormaPago) { + this.cajaFormaPago = cajaFormaPago; + } + + public String getNumoperacion() { + return numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + public String getNumdocumento() { + return numdocumento; + } + + public void setNumdocumento(String numdocumento) { + this.numdocumento = numdocumento; + } + + public String getOpcional1() { + return opcional1; + } + + public void setOpcional1(String opcional1) { + this.opcional1 = opcional1; + } + + public String getOpcional2() { + return opcional2; + } + + public void setOpcional2(String opcional2) { + this.opcional2 = opcional2; + } + + public String getOpcional3() { + return opcional3; + } + + public void setOpcional3(String opcional3) { + this.opcional3 = opcional3; + } + + public BigDecimal getImporte1() { + return importe1; + } + + public void setImporte1(BigDecimal importe1) { + this.importe1 = importe1; + } + + public BigDecimal getImporte2() { + return importe2; + } + + public void setImporte2(BigDecimal importe2) { + this.importe2 = importe2; + } + + public Boolean getIndreplica() { + return indreplica; + } + + public void setIndreplica(Boolean indreplica) { + this.indreplica = indreplica; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Byte getNodoId() { + return nodoId; + } + + public void setNodoId(Byte nodoId) { + this.nodoId = nodoId; + } + + public Caja getCaja() { + return caja; + } + + public void setCaja(Caja caja) { + this.caja = caja; + } + + public OCD getOcd() { + return ocd; + } + + public void setOcd(OCD ocd) { + this.ocd = ocd; + } + + public Integer getNotacreditovendapacoteId() { + return notacreditovendapacoteId; + } + + public void setNotacreditovendapacoteId(Integer notacreditovendapacoteId) { + this.notacreditovendapacoteId = notacreditovendapacoteId; + } + + public CajaTarjeta getCajaTarjetas() { + return cajaTarjetas; + } + + public void setCajaTarjetas(CajaTarjeta cajaTarjetas) { + this.cajaTarjetas = cajaTarjetas; + } + + public String getSerieSubSerie() { + return serieSubSerie; + } + + public void setSerieSubSerie(String serieSubSerie) { + this.serieSubSerie = serieSubSerie; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CajaDiversos.java b/src/com/rjconsultores/ventaboletos/entidad/CajaDiversos.java new file mode 100644 index 000000000..2ab056349 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CajaDiversos.java @@ -0,0 +1,432 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "CAJA_DIVERSOS") +public class CajaDiversos implements java.io.Serializable { + + private static final long serialVersionUID = -3120518309581568769L; + + @Id + @Column(name = "CAJADIVERSOS_ID", nullable = false, precision = 15, scale = 0) + private Long cajaDiversosId; + + @Column(name = "NUMOPERACION", length = 36) + private String numoperacion; + + @Column(name = "NUMOPERACIONDIVERSOS", length = 36) + private String numoperaciondiversos; + + @Column(name = "PRODUCTOSERVICIO_ID", precision = 7, scale = 0) + private Integer productoservicioId; + + @Column(name = "FECHORVTA", length = 7) + private Date fechorvta; + + @Column(name = "PRECIO", precision = 7) + private BigDecimal precio; + + @Column(name = "MONEDA_ID", precision = 7, scale = 0) + private Integer monedaId; + + @Column(name = "PARIDAD", precision = 7) + private BigDecimal paridad; + + @Column(name = "CARGOEXTRA", precision = 7) + private BigDecimal cargoextra; + + @Column(name = "NUMFOLIOPREIMPRESO", length = 36) + private String numfoliopreimpreso; + + @Column(name = "NUMSERIEPREIMPRESA", length = 30) + private String numseriepreimpresa; + + @Column(name = "NUMOPCIONAL1", precision = 15, scale = 0) + private Long numopcional1; + + @Column(name = "NUMOPCIONAL2", precision = 15, scale = 0) + private Long numopcional2; + + @Column(name = "DESCOPCIONAL1", length = 45) + private String descopcional1; + + @Column(name = "DESCOPCIONAL2", length = 45) + private String descopcional2; + + @Column(name = "NODO_ID", precision = 2, scale = 0) + private Byte nodoId; + + @Column(name = "INDREPLICA", precision = 1, scale = 0) + private Boolean indreplica; + + @Column(name = "FECCORTE", length = 7) + private Date feccorte; + + @Column(name = "TURNO_ID", precision = 2, scale = 0) + private Byte turnoId; + + @Column(name = "INDCANCELACION", precision = 1, scale = 0) + private Boolean indcancelacion; + + @Column(name = "NUMFOLIOSISTEMA", length = 36) + private String numfoliosistema; + + @ManyToOne + @JoinColumn(name = "TIPOVENTA_ID") + private TipoVenta tipoVenta; + + @Column(name = "PUNTOVENTAREMOTO_ID", precision = 7, scale = 0) + private Integer puntoventaremotoId; + + @Column(name = "USUARIOREMOTO_ID", precision = 7, scale = 0) + private Integer usuarioremotoId; + + @Column(name = "ESTACION_ID", precision = 7, scale = 0) + private Integer estacionId; + + @Column(name = "ACTIVO", precision = 1, scale = 0) + private Boolean activo; + + @Column(name = "FECMODIF", length = 7) + private Date fecmodif; + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + private Integer usuarioId; + + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + @Column(name = "INDREIMPRESION", precision = 1, scale = 0) + private Boolean indreimpresion; + + @Column(name = "EVENTOEXTRA_ID", precision = 10, scale = 0) + private Long eventoextraId; + + @Column(name = "MOTIVOCANCELACION_ID", precision = 2, scale = 0) + private Byte motivocancelacionId; + + @Column(name = "FECINTEGRACION", length = 7) + private Date fecintegracion; + + @Column(name = "VENDAPACOTE_ID", precision = 7, scale = 0) + private Integer vendapacoteId; + + @Column(name = "FECHORVTA_H", length = 7) + private Date fechorvtaH; + + @ManyToOne + @JoinColumn(name = "NOTACREDITOVENDAPACOTE_ID", insertable = false, updatable = false) + private NotaCreditoVendaPacote notaCreditoVendaPacote; + + @OneToMany(mappedBy = "cajaDiversos") + private List cajaDiversosPagosList; + + public Long getCajaDiversosId() { + return cajaDiversosId; + } + + public void setCajaDiversosId(Long cajaDiversosId) { + this.cajaDiversosId = cajaDiversosId; + } + + public String getNumoperacion() { + return numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public String getNumoperaciondiversos() { + return numoperaciondiversos; + } + + public void setNumoperaciondiversos(String numoperaciondiversos) { + this.numoperaciondiversos = numoperaciondiversos; + } + + public Integer getProductoservicioId() { + return productoservicioId; + } + + public void setProductoservicioId(Integer productoservicioId) { + this.productoservicioId = productoservicioId; + } + + public Date getFechorvta() { + return fechorvta; + } + + public void setFechorvta(Date fechorvta) { + this.fechorvta = fechorvta; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public Integer getMonedaId() { + return monedaId; + } + + public void setMonedaId(Integer monedaId) { + this.monedaId = monedaId; + } + + public BigDecimal getParidad() { + return paridad; + } + + public void setParidad(BigDecimal paridad) { + this.paridad = paridad; + } + + public BigDecimal getCargoextra() { + return cargoextra; + } + + public void setCargoextra(BigDecimal cargoextra) { + this.cargoextra = cargoextra; + } + + public String getNumfoliopreimpreso() { + return numfoliopreimpreso; + } + + public void setNumfoliopreimpreso(String numfoliopreimpreso) { + this.numfoliopreimpreso = numfoliopreimpreso; + } + + public String getNumseriepreimpresa() { + return numseriepreimpresa; + } + + public void setNumseriepreimpresa(String numseriepreimpresa) { + this.numseriepreimpresa = numseriepreimpresa; + } + + public Long getNumopcional1() { + return numopcional1; + } + + public void setNumopcional1(Long numopcional1) { + this.numopcional1 = numopcional1; + } + + public Long getNumopcional2() { + return numopcional2; + } + + public void setNumopcional2(Long numopcional2) { + this.numopcional2 = numopcional2; + } + + public String getDescopcional1() { + return descopcional1; + } + + public void setDescopcional1(String descopcional1) { + this.descopcional1 = descopcional1; + } + + public String getDescopcional2() { + return descopcional2; + } + + public void setDescopcional2(String descopcional2) { + this.descopcional2 = descopcional2; + } + + public Byte getNodoId() { + return nodoId; + } + + public void setNodoId(Byte nodoId) { + this.nodoId = nodoId; + } + + public Boolean getIndreplica() { + return indreplica; + } + + public void setIndreplica(Boolean indreplica) { + this.indreplica = indreplica; + } + + public Date getFeccorte() { + return feccorte; + } + + public void setFeccorte(Date feccorte) { + this.feccorte = feccorte; + } + + public Byte getTurnoId() { + return turnoId; + } + + public void setTurnoId(Byte turnoId) { + this.turnoId = turnoId; + } + + public Boolean getIndcancelacion() { + return indcancelacion; + } + + public void setIndcancelacion(Boolean indcancelacion) { + this.indcancelacion = indcancelacion; + } + + public String getNumfoliosistema() { + return numfoliosistema; + } + + public void setNumfoliosistema(String numfoliosistema) { + this.numfoliosistema = numfoliosistema; + } + + public TipoVenta getTipoVenta() { + return tipoVenta; + } + + public void setTipoVenta(TipoVenta tipoVenta) { + this.tipoVenta = tipoVenta; + } + + public Integer getPuntoventaremotoId() { + return puntoventaremotoId; + } + + public void setPuntoventaremotoId(Integer puntoventaremotoId) { + this.puntoventaremotoId = puntoventaremotoId; + } + + public Integer getUsuarioremotoId() { + return usuarioremotoId; + } + + public void setUsuarioremotoId(Integer usuarioremotoId) { + this.usuarioremotoId = usuarioremotoId; + } + + public Integer getEstacionId() { + return estacionId; + } + + public void setEstacionId(Integer estacionId) { + this.estacionId = estacionId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Boolean getIndreimpresion() { + return indreimpresion; + } + + public void setIndreimpresion(Boolean indreimpresion) { + this.indreimpresion = indreimpresion; + } + + public Long getEventoextraId() { + return eventoextraId; + } + + public void setEventoextraId(Long eventoextraId) { + this.eventoextraId = eventoextraId; + } + + public Byte getMotivocancelacionId() { + return motivocancelacionId; + } + + public void setMotivocancelacionId(Byte motivocancelacionId) { + this.motivocancelacionId = motivocancelacionId; + } + + public Date getFecintegracion() { + return fecintegracion; + } + + public void setFecintegracion(Date fecintegracion) { + this.fecintegracion = fecintegracion; + } + + public Integer getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Integer vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + + public Date getFechorvtaH() { + return fechorvtaH; + } + + public void setFechorvtaH(Date fechorvtaH) { + this.fechorvtaH = fechorvtaH; + } + + public NotaCreditoVendaPacote getNotaCreditoVendaPacote() { + return notaCreditoVendaPacote; + } + + public void setNotaCreditoVendaPacote(NotaCreditoVendaPacote notaCreditoVendaPacote) { + this.notaCreditoVendaPacote = notaCreditoVendaPacote; + } + + public List getCajaDiversosPagosList() { + return cajaDiversosPagosList; + } + + public void setCajaDiversosPagosList(List listCajaDiversosPagos) { + this.cajaDiversosPagosList = listCajaDiversosPagos; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CajaDiversosPago.java b/src/com/rjconsultores/ventaboletos/entidad/CajaDiversosPago.java new file mode 100644 index 000000000..8c859a87e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CajaDiversosPago.java @@ -0,0 +1,136 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "CAJA_DIVERSOS_PAGO") +public class CajaDiversosPago implements java.io.Serializable { + + private static final long serialVersionUID = 591550428860169139L; + + @Id + @Column(name = "CAJADIVERSOSPAGO_ID", unique = true, nullable = false, precision = 15, scale = 0) + private Long cajaDiversosPagoId; + + @ManyToOne + @JoinColumn(name = "CAJATARJETA_ID") + private CajaTarjeta cajaTarjeta; + + @ManyToOne + @JoinColumn(name = "CAJADIVERSOS_ID") + private CajaDiversos cajaDiversos; + + @ManyToOne + @JoinColumn(name = "FORMAPAGO_ID") + private FormaPago formaPago; + + @Column(name = "IMPORTE", precision = 7) + private BigDecimal importe; + + @Column(name = "NODO_ID", precision = 2, scale = 0) + private Byte nodoId; + + @Column(name = "INDREPLICA", precision = 1, scale = 0) + private Boolean indreplica; + + @Column(name = "ACTIVO", precision = 1, scale = 0) + private Boolean activo; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + private Date fecmodif; + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + private Integer usuarioId; + + public Long getCajaDiversosPagoId() { + return cajaDiversosPagoId; + } + + public void setCajaDiversosPagoId(Long cajaDiversosPagoId) { + this.cajaDiversosPagoId = cajaDiversosPagoId; + } + + public CajaTarjeta getCajaTarjeta() { + return cajaTarjeta; + } + + public void setCajaTarjeta(CajaTarjeta cajaTarjeta) { + this.cajaTarjeta = cajaTarjeta; + } + + public CajaDiversos getCajaDiversos() { + return cajaDiversos; + } + + public void setCajaDiversos(CajaDiversos cajaDiversos) { + this.cajaDiversos = cajaDiversos; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public Byte getNodoId() { + return nodoId; + } + + public void setNodoId(Byte nodoId) { + this.nodoId = nodoId; + } + + public Boolean getIndreplica() { + return indreplica; + } + + public void setIndreplica(Boolean indreplica) { + this.indreplica = indreplica; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CajaFormaPago.java b/src/com/rjconsultores/ventaboletos/entidad/CajaFormaPago.java new file mode 100644 index 000000000..a3fc2082c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CajaFormaPago.java @@ -0,0 +1,136 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "CAJA_FORMAPAGO") +public class CajaFormaPago implements java.io.Serializable { + + private static final long serialVersionUID = -2927885703968812837L; + + @Id + @Column(name = "CAJAFORMAPAGO_ID", unique = true, nullable = false, precision = 15, scale = 0) + private Long cajaFormaPagoId; + + @ManyToOne + @JoinColumn(name = "CAJA_ID") + private Caja caja; + + @ManyToOne + @JoinColumn(name = "FORMAPAGO_ID") + private FormaPago formapago; + + @Column(name = "IMPORTE", precision = 8) + private BigDecimal importe; + + @Column(name = "INDREPLICA", precision = 1, scale = 0) + private Boolean indreplica; + + @Column(name = "ACTIVO", precision = 1, scale = 0) + private Boolean activo; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + private Date fecmodif; + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + private Integer usuarioId; + + @Column(name = "NODO_ID", precision = 2, scale = 0) + private Byte nodoId; + + @OneToOne(mappedBy = "cajaFormaPago") + private CajaDetPago cajaDetPago; + + public Long getCajaFormaPagoId() { + return cajaFormaPagoId; + } + + public void setCajaFormaPagoId(Long cajaFormaPagoId) { + this.cajaFormaPagoId = cajaFormaPagoId; + } + + public Caja getCaja() { + return caja; + } + + public void setCaja(Caja caja) { + this.caja = caja; + } + + public FormaPago getFormapago() { + return formapago; + } + + public void setFormapago(FormaPago formapago) { + this.formapago = formapago; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public Boolean getIndreplica() { + return indreplica; + } + + public void setIndreplica(Boolean indreplica) { + this.indreplica = indreplica; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Byte getNodoId() { + return nodoId; + } + + public void setNodoId(Byte nodoId) { + this.nodoId = nodoId; + } + + public CajaDetPago getCajaDetPago() { + return cajaDetPago; + } + + public void setCajaDetPago(CajaDetPago cajaDetPago) { + this.cajaDetPago = cajaDetPago; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CajaTarjeta.java b/src/com/rjconsultores/ventaboletos/entidad/CajaTarjeta.java new file mode 100644 index 000000000..29301f309 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CajaTarjeta.java @@ -0,0 +1,260 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.sql.Clob; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "CAJA_TARJETA") +public class CajaTarjeta implements java.io.Serializable { + + private static final long serialVersionUID = 5807160178691935393L; + + @Id + @Column(name = "CAJATARJETA_ID", unique = true, nullable = false, precision = 10, scale = 0) + private Long cajaTarjetaId; + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CAJADETPAGO_ID") + private CajaDetPago cajaDetPago; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CAJADIVERSOSPAGO_ID") + private CajaDiversosPago cajaDiversosPago; + + @Column(name = "NOMBTITULAR", length = 180) + private String nombtitular; + + @Column(name = "TIPOTARJETA", length = 66) + private String tipotarjeta; + + @Column(name = "NUMTARJETA", length = 48) + private String numtarjeta; + + @Column(name = "NUMAUTORIZACION", length = 45) + private String numautorizacion; + + @Column(name = "INDREPLICA", precision = 1, scale = 0) + private Boolean indreplica; + + @Column(name = "ACTIVO", precision = 1, scale = 0) + private Boolean activo; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + private Date fecmodif; + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + private Integer usuarioId; + + @Column(name = "NODO_ID", precision = 2, scale = 0) + private Byte nodoId; + + @Column(name = "DESCOPERACION", length = 90) + private String descoperacion; + + @Temporal(TemporalType.DATE) + @Column(name = "FECOPERACION", length = 7) + private Date fecoperacion; + + @Column(name = "VOUCHERCLIENTE") + private Clob vouchercliente; + + @Column(name = "VOUCHERCOMERCIO") + private Clob vouchercomercio; + + @Column(name = "NSU", length = 45) + private String nsu; + + @Column(name = "NSUHOST", length = 45) + private String nsuhost; + + @Column(name = "IMPORTE", precision = 11) + private BigDecimal importe; + + @Column(name = "CANTPARCELAS", precision = 2, scale = 0) + private Byte cantparcelas; + + @Column(name = "DESCOPERADORACARTAO", length = 50) + private String descoperadoracartao; + + public Long getCajaTarjetaId() { + return cajaTarjetaId; + } + + public void setCajaTarjetaId(Long cajaTarjetaId) { + this.cajaTarjetaId = cajaTarjetaId; + } + + public CajaDetPago getCajaDetPago() { + return cajaDetPago; + } + + public void setCajaDetPago(CajaDetPago cajaDetPago) { + this.cajaDetPago = cajaDetPago; + } + + public CajaDiversosPago getCajaDiversosPago() { + return cajaDiversosPago; + } + + public void setCajaDiversosPago(CajaDiversosPago cajaDiversosPago) { + this.cajaDiversosPago = cajaDiversosPago; + } + + public String getNombtitular() { + return nombtitular; + } + + public void setNombtitular(String nombtitular) { + this.nombtitular = nombtitular; + } + + public String getTipotarjeta() { + return tipotarjeta; + } + + public void setTipotarjeta(String tipotarjeta) { + this.tipotarjeta = tipotarjeta; + } + + public String getNumtarjeta() { + return numtarjeta; + } + + public void setNumtarjeta(String numtarjeta) { + this.numtarjeta = numtarjeta; + } + + public String getNumautorizacion() { + return numautorizacion; + } + + public void setNumautorizacion(String numautorizacion) { + this.numautorizacion = numautorizacion; + } + + public Boolean getIndreplica() { + return indreplica; + } + + public void setIndreplica(Boolean indreplica) { + this.indreplica = indreplica; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Byte getNodoId() { + return nodoId; + } + + public void setNodoId(Byte nodoId) { + this.nodoId = nodoId; + } + + public String getDescoperacion() { + return descoperacion; + } + + public void setDescoperacion(String descoperacion) { + this.descoperacion = descoperacion; + } + + public Date getFecoperacion() { + return fecoperacion; + } + + public void setFecoperacion(Date fecoperacion) { + this.fecoperacion = fecoperacion; + } + + public Clob getVouchercliente() { + return vouchercliente; + } + + public void setVouchercliente(Clob vouchercliente) { + this.vouchercliente = vouchercliente; + } + + public Clob getVouchercomercio() { + return vouchercomercio; + } + + public void setVouchercomercio(Clob vouchercomercio) { + this.vouchercomercio = vouchercomercio; + } + + public String getNsu() { + return nsu; + } + + public void setNsu(String nsu) { + this.nsu = nsu; + } + + public String getNsuhost() { + return nsuhost; + } + + public void setNsuhost(String nsuhost) { + this.nsuhost = nsuhost; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public Byte getCantparcelas() { + return cantparcelas; + } + + public void setCantparcelas(Byte cantparcelas) { + this.cantparcelas = cantparcelas; + } + + public String getDescoperadoracartao() { + return descoperadoracartao; + } + + public void setDescoperadoracartao(String descoperadoracartao) { + this.descoperadoracartao = descoperadoracartao; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CancelacionCargo.java b/src/com/rjconsultores/ventaboletos/entidad/CancelacionCargo.java new file mode 100644 index 000000000..388da6aa8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CancelacionCargo.java @@ -0,0 +1,160 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "CANCELACION_CARGO_SEQ", sequenceName = "CANCELACION_CARGO_SEQ", allocationSize = 1) +@Table(name = "CANCELACION_CARGO") +public class CancelacionCargo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CANCELACION_CARGO_SEQ") + @Column(name = "CANCELACIONCARGO_ID") + private Integer cancelacioncargoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "PORCCARGO") + private BigDecimal porccargo; + @Column(name = "IMPORTECARGO") + private BigDecimal importecargo; + @Column(name = "TIEMPOMINIMO") + private BigDecimal tiempominimo; + @Column(name = "TIEMPOMAXIMO") + private BigDecimal tiempomaximo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CANCELACIONCTRL_ID", referencedColumnName = "CANCELACIONCTRL_ID") + @ManyToOne + private CancelacionCtrl cancelacionCtrl; + + public CancelacionCargo() { + } + + public CancelacionCargo(Integer cancelacioncargoId) { + this.cancelacioncargoId = cancelacioncargoId; + } + + public Integer getCancelacioncargoId() { + return cancelacioncargoId; + } + + public void setCancelacioncargoId(Integer cancelacioncargoId) { + this.cancelacioncargoId = cancelacioncargoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public BigDecimal getPorccargo() { + return porccargo; + } + + public void setPorccargo(BigDecimal porccargo) { + this.porccargo = porccargo; + } + + public BigDecimal getImportecargo() { + return importecargo; + } + + public void setImportecargo(BigDecimal importecargo) { + this.importecargo = importecargo; + } + + public BigDecimal getTiempomaximo() { + return tiempomaximo; + } + + public void setTiempomaximo(BigDecimal tiempomaximo) { + this.tiempomaximo = tiempomaximo; + } + + public BigDecimal getTiempominimo() { + return tiempominimo; + } + + public void setTiempominimo(BigDecimal tiempominimo) { + this.tiempominimo = tiempominimo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public CancelacionCtrl getCancelacionCtrl() { + return cancelacionCtrl; + } + + public void setCancelacionCtrl(CancelacionCtrl cancelacionCtrl) { + this.cancelacionCtrl = cancelacionCtrl; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cancelacioncargoId != null ? cancelacioncargoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CancelacionCargo)) { + return false; + } + CancelacionCargo other = (CancelacionCargo) object; + if ((this.cancelacioncargoId == null && other.cancelacioncargoId != null) || (this.cancelacioncargoId != null && !this.cancelacioncargoId.equals(other.cancelacioncargoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.dao.CancelacionCargo[cancelacioncargoId=" + cancelacioncargoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CancelacionCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/CancelacionCtrl.java new file mode 100644 index 000000000..20a089663 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CancelacionCtrl.java @@ -0,0 +1,222 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "CANCELACION_CTRL_SEQ", sequenceName = "CANCELACION_CTRL_SEQ", allocationSize = 1) +@Table(name = "CANCELACION_CTRL") +public class CancelacionCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CANCELACION_CTRL_SEQ") + @Column(name = "CANCELACIONCTRL_ID") + private Integer cancelacionctrlId; + @Column(name = "TIEMPOPREVSALIDA") + @Temporal(TemporalType.TIME) + private Date tiempoprevsalida; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaOrigem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaDestino; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @ManyToOne + @JoinColumn(name = "MOTIVOCANCELACION_ID", referencedColumnName = "MOTIVOCANCELACION_ID") + private MotivoCancelacion motivoCancelacion; + @OneToMany(mappedBy = "cancelacionCtrl", cascade = CascadeType.ALL) + private List cancelacionCargoList; + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + + public CancelacionCtrl() { + } + + public CancelacionCtrl(Integer cancelacionctrlId) { + this.cancelacionctrlId = cancelacionctrlId; + } + + public Integer getCancelacionctrlId() { + return cancelacionctrlId; + } + + public void setCancelacionctrlId(Integer cancelacionctrlId) { + this.cancelacionctrlId = cancelacionctrlId; + } + + public Date getTiempoprevsalida() { + return tiempoprevsalida; + } + + public void setTiempoprevsalida(Date tiempoprevsalida) { + this.tiempoprevsalida = tiempoprevsalida; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Parada getParadaDestino() { + return paradaDestino; + } + + public void setParadaDestino(Parada paradaDestino) { + this.paradaDestino = paradaDestino; + } + + public Parada getParadaOrigem() { + return paradaOrigem; + } + + public void setParadaOrigem(Parada paradaOrigem) { + this.paradaOrigem = paradaOrigem; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public MotivoCancelacion getMotivoCancelacion() { + return motivoCancelacion; + } + + public void setMotivoCancelacion(MotivoCancelacion motivoCancelacion) { + this.motivoCancelacion = motivoCancelacion; + } + + public List getCancelacionCargoList() { + List tmp = new ArrayList(); + if (cancelacionCargoList != null) { + for (CancelacionCargo cc : this.cancelacionCargoList) { + if (cc.getActivo()) { + tmp.add(cc); + } + } + } + + return tmp; + } + + public void setCancelacionCargoList(List cancelacionCargoList) { + this.cancelacionCargoList = cancelacionCargoList; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cancelacionctrlId != null ? cancelacionctrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof CancelacionCtrl)) { + return false; + } + CancelacionCtrl other = (CancelacionCtrl) object; + if ((this.cancelacionctrlId == null && other.cancelacionctrlId != null) || (this.cancelacionctrlId != null && !this.cancelacionctrlId.equals(other.cancelacionctrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CancelacionCtrl[cancelacionctrlId=" + cancelacionctrlId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CasetaPeaje.java b/src/com/rjconsultores/ventaboletos/entidad/CasetaPeaje.java new file mode 100644 index 000000000..04a636e97 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CasetaPeaje.java @@ -0,0 +1,172 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; +import org.hibernate.annotations.Where; + +@Entity +@SequenceGenerator(name = "CASETA_PEAJE_SEQ", sequenceName = "CASETA_PEAJE_SEQ", allocationSize = 1) +@Table(name = "CASETA_PEAJE") +public class CasetaPeaje implements Serializable, Comparable, Cloneable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CASETA_PEAJE_SEQ") + @Column(name = "CASETAPEAJE_ID") + private Integer casetaPeajeId; + @Column(name = "DESCCASETA") + private String desccaseta; + @Column(name = "IMPORTEIDA") + private BigDecimal importeIda; + @Column(name = "IMPORTEVUELTA") + private BigDecimal importeVuelta; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "casetaPeaje", fetch=FetchType.EAGER, cascade=CascadeType.ALL) + @Where(clause="ACTIVO=1") + @Fetch(value = FetchMode.SELECT) + private List lsCasetaPeajeExcepcion = new ArrayList(); + @ManyToMany(fetch=FetchType.EAGER) + @JoinTable(name = "RUTA_CASETA", joinColumns = { @JoinColumn(name = "CASETAPEAJE_ID") }, + inverseJoinColumns = { @JoinColumn(name = "RUTASECUENCIA_ID") }) + private List lsRutaSecuencia; + + @OneToMany(mappedBy = "pracaPedagioId", cascade=CascadeType.ALL) + @LazyCollection(LazyCollectionOption.FALSE) + @Where(clause="ACTIVO=1") + private List lsPrecoFixoPedagio; + + + @Override + public int hashCode() { + int hash = 0; + hash += casetaPeajeId != null ? casetaPeajeId.hashCode() : 0; + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof CasetaPeaje)) { + return false; + } + CasetaPeaje other = (CasetaPeaje) object; + if ((this.casetaPeajeId == null && other.casetaPeajeId != null) || (this.casetaPeajeId != null && !this.casetaPeajeId.equals(other.casetaPeajeId))) { + return false; + } + return true; + } + + public CasetaPeaje(){ + lsRutaSecuencia = new ArrayList(); + } + + public Integer getCasetaPeajeId() { + return casetaPeajeId; + } + public void setCasetaPeajeId(Integer casetaPeajeId) { + this.casetaPeajeId = casetaPeajeId; + } + public String getDesccaseta() { + return desccaseta; + } + public void setDesccaseta(String desccaseta) { + this.desccaseta = desccaseta; + } + public BigDecimal getImporteIda() { + return importeIda; + } + public void setImporteIda(BigDecimal importeIda) { + this.importeIda = importeIda; + } + public BigDecimal getImporteVuelta() { + return importeVuelta; + } + public void setImporteVuelta(BigDecimal importeVuelta) { + this.importeVuelta = importeVuelta; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return getCasetaPeajeId() + " - " +getDesccaseta(); + } + + @Override + public int compareTo(CasetaPeaje caseta) { + return this.getDesccaseta().compareTo(caseta.getDesccaseta()); + } + + public List getLsRutaSecuencia() { + return lsRutaSecuencia; + } + + public void setLsRutaSecuencia(List lsRutaSecuencia) { + this.lsRutaSecuencia = lsRutaSecuencia; + } + + public List getLsCasetaPeajeExcepcion() { + return lsCasetaPeajeExcepcion; + } + + public void setLsCasetaPeajeExcepcion(List lsCasetaPeajeExcepcion) { + this.lsCasetaPeajeExcepcion = lsCasetaPeajeExcepcion; + } + + public List getLsPrecoFixoPedagio() { + return lsPrecoFixoPedagio; + } + + public void setLsPrecoFixoPedagio(List lsPrecoFixoPedagio) { + this.lsPrecoFixoPedagio = lsPrecoFixoPedagio; + } + + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/CasetaPeajeExcepcion.java b/src/com/rjconsultores/ventaboletos/entidad/CasetaPeajeExcepcion.java new file mode 100644 index 000000000..4bef61b57 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CasetaPeajeExcepcion.java @@ -0,0 +1,203 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CASETA_PEAJE_EXCEPCION_SEQ", sequenceName = "CASETA_PEAJE_EXCEPCION_SEQ", allocationSize = 1) +@Table(name = "CASETA_PEAJE_EXCEPCION") +public class CasetaPeajeExcepcion implements Serializable, Comparable { + +private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @Column(name = "CASETAPEAJEEXCEPCION_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CASETA_PEAJE_EXCEPCION_SEQ") + private Integer casetaPeajeExcepcionId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToOne + @JoinColumn(name = "CASETAPEAJE_ID" , referencedColumnName = "CASETAPEAJE_ID") + private CasetaPeaje casetaPeaje; + @Column(name = "FECHAVENTAINI") + @Temporal(TemporalType.TIMESTAMP) + private java.util.Date fecVentaIni; + @Column(name = "FECHAVENTAFIN") + @Temporal(TemporalType.TIMESTAMP) + private java.util.Date fecVentaFin; + @Column(name = "FECHORINICIO") + @Temporal(TemporalType.TIME) + private Date horaIni; + @Column(name = "FECHORFINAL") + @Temporal(TemporalType.TIME) + private Date horaFin; + @Column(name = "INDLUNES") + private Boolean INDLUNES; + @Column(name = "INDMARTES") + private Boolean INDMARTES; + @Column(name = "INDMIERCOLES") + private Boolean INDMIERCOLES; + @Column(name = "INDJUEVES") + private Boolean INDJUEVES; + @Column(name = "INDVIERNES") + private Boolean INDVIERNES; + @Column(name = "INDSABADO") + private Boolean INDSABADO; + @Column(name = "INDDOMINGO") + private Boolean INDDOMINGO; + @Column(name = "PRECIO") + private BigDecimal precio; + + + public Integer getCasetaPeajeExcepcionId() { + return casetaPeajeExcepcionId; + } + public void setCasetaPeajeExcepcionId(Integer casetaPeajeExcepcionId) { + this.casetaPeajeExcepcionId = casetaPeajeExcepcionId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public CasetaPeaje getCasetaPeaje() { + return casetaPeaje; + } + public void setCasetaPeaje(CasetaPeaje casetaPeaje) { + this.casetaPeaje = casetaPeaje; + } + public java.util.Date getFecVentaIni() { + return fecVentaIni; + } + public void setFecVentaIni(java.util.Date fecVentaIni) { + this.fecVentaIni = fecVentaIni; + } + public java.util.Date getFecVentaFin() { + return fecVentaFin; + } + public void setFecVentaFin(java.util.Date fecVentaFin) { + this.fecVentaFin = fecVentaFin; + } + public Date getHoraIni() { + return horaIni; + } + public void setHoraIni(Date horaIni) { + this.horaIni = horaIni; + } + public Date getHoraFin() { + return horaFin; + } + public void setHoraFin(Date horaFin) { + this.horaFin = horaFin; + } + public Boolean getINDLUNES() { + return INDLUNES; + } + public void setINDLUNES(Boolean iNDLUNES) { + INDLUNES = iNDLUNES; + } + public Boolean getINDMARTES() { + return INDMARTES; + } + public void setINDMARTES(Boolean iNDMARTES) { + INDMARTES = iNDMARTES; + } + public Boolean getINDMIERCOLES() { + return INDMIERCOLES; + } + public void setINDMIERCOLES(Boolean iNDMIERCOLES) { + INDMIERCOLES = iNDMIERCOLES; + } + public Boolean getINDJUEVES() { + return INDJUEVES; + } + public void setINDJUEVES(Boolean iNDJUEVES) { + INDJUEVES = iNDJUEVES; + } + public Boolean getINDVIERNES() { + return INDVIERNES; + } + public void setINDVIERNES(Boolean iNDVIERNES) { + INDVIERNES = iNDVIERNES; + } + public Boolean getINDSABADO() { + return INDSABADO; + } + public void setINDSABADO(Boolean iNDSABADO) { + INDSABADO = iNDSABADO; + } + public Boolean getINDDOMINGO() { + return INDDOMINGO; + } + public void setINDDOMINGO(Boolean iNDDOMINGO) { + INDDOMINGO = iNDDOMINGO; + } + public BigDecimal getPrecio() { + return precio; + } + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + @Override + public int compareTo(CasetaPeajeExcepcion o) { + if(o.getCasetaPeajeExcepcionId() != null){ + return this.getCasetaPeajeExcepcionId().intValue() - o.getCasetaPeajeExcepcionId().intValue(); + }else{ + return -1; + } + } + + @Override + public int hashCode() { + int hash = 0; + hash += casetaPeajeExcepcionId != null ? casetaPeajeExcepcionId.hashCode() : 0; + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof CasetaPeajeExcepcion)) { + return false; + } + CasetaPeajeExcepcion other = (CasetaPeajeExcepcion) object; + if ((this.casetaPeajeExcepcionId == null && other.casetaPeajeExcepcionId != null) || (this.casetaPeajeExcepcionId != null && !this.casetaPeajeExcepcionId.equals(other.casetaPeajeExcepcionId))) { + return false; + } + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Categoria.java b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java new file mode 100644 index 000000000..4584e5ae6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java @@ -0,0 +1,292 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.rjconsultores.ventaboletos.enums.TipoDescontoBPe; +import com.rjconsultores.ventaboletos.enums.TipoDescontoMonitrip; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_SEQ", sequenceName = "CATEGORIA_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA") +public class Categoria implements Serializable { + public static Integer CATEGORIA_NORMAL = 1; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_SEQ") + @Column(name = "CATEGORIA_ID") + private Integer categoriaId; + @Column(name = "DESCCATEGORIA") + private String desccategoria; + @Column(name = "ACTIVO") + private Boolean activo; + // CAmpos retirados + // @Column(name = "INDVENDEINTERNET") + // private Boolean vendeInternet; + // @Column(name = "INDVENDEAGENCIAWEB") + // private Boolean vendeAgenciaWeb; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "categoria", cascade = CascadeType.ALL) + private List categoriaDescuentoList; + @OneToMany(mappedBy = "categoria", cascade = CascadeType.ALL) + private List reservacionCategoriaList; + + @JoinColumn(name = "GRUPOCATEGORIA_ID", referencedColumnName = "GRUPOCATEGORIA_ID") + @ManyToOne() + private GrupoCategoria grupoCategoria; + + @OneToMany(mappedBy = "categoria", cascade = CascadeType.ALL) + private List orgaosConcedentes; + + @Column(name = "INDCONFERENCIAFISICACOMISSAO") + private Boolean indconferenciafisicacomissao; + + @Column(name = "INDEMITETERMORECUSA") + private Boolean indemitetermorecusa; + + @Column(name = "CVECATEGORIA") + private String cvecategoria; + + @Column(name = "DESCIMPRESIONGRATUIDADE") + private String descImpresionGratuidade; + + @Column(name = "INDNAOUSAASSENTO") + private Boolean indnaousaassento; + + @Column(name = "CVESISTEMA") + private String cvesistema; + + @Enumerated(EnumType.STRING) + @Column(name = "desconto_monitrip") + private TipoDescontoMonitrip tipoDescontoMonitrip; + + @Enumerated(EnumType.STRING) + @Column(name = "DESCONTOBPE") + private TipoDescontoBPe tipoDescontoBPe; + + @Column(name = "INDVENDEAPI") + private Boolean indvendeapi; + + public Categoria() { + } + + public Categoria(Integer categoriaId) { + this.categoriaId = categoriaId; + } + + public Integer getCategoriaId() { + return categoriaId; + } + + public void setCategoriaId(Integer categoriaId) { + this.categoriaId = categoriaId; + } + + public String getDesccategoria() { + return desccategoria; + } + + public void setDesccategoria(String desccategoria) { + this.desccategoria = desccategoria; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public GrupoCategoria getGrupoCategoria() { + return grupoCategoria; + } + + public void setGrupoCategoria(GrupoCategoria grupoCategoria) { + this.grupoCategoria = grupoCategoria; + } + + public List getCategoriaDescuentoList() { + // return categoriaDescuentoList; + List rcList = new ArrayList(); + for (CategoriaDescuento rc : this.categoriaDescuentoList) { + if (rc.getActivo() == Boolean.TRUE) { + rcList.add(rc); + } + } + return rcList; + } + + public void setCategoriaDescuentoList(List categoriaDescuentoList) { + this.categoriaDescuentoList = categoriaDescuentoList; + } + + public List getReservacionCategoriaList() { + // return reservacionCategoriaList; + List rcList = new ArrayList(); + for (ReservacionCategoria rc : this.reservacionCategoriaList) { + if (rc.getActivo() == Boolean.TRUE) { + rcList.add(rc); + } + } + return rcList; + } + + public void setReservacionCategoriaList(List reservacionCategoriaList) { + this.reservacionCategoriaList = reservacionCategoriaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (categoriaId != null ? categoriaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof Categoria)) { + return false; + } + Categoria other = (Categoria) object; + if ((this.categoriaId == null && other.categoriaId != null) || (this.categoriaId != null && !this.categoriaId.equals(other.categoriaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDesccategoria(); + } + + public Boolean getIndconferenciafisicacomissao() { + return indconferenciafisicacomissao; + } + + public void setIndconferenciafisicacomissao(Boolean indconferenciafisicacomissao) { + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + } + + public Boolean getIndemitetermorecusa() { + return indemitetermorecusa; + } + + public void setIndemitetermorecusa(Boolean indemitetermorecusa) { + this.indemitetermorecusa = indemitetermorecusa; + } + + public String getCvecategoria() { + return cvecategoria; + } + + public void setCvecategoria(String cvecategoria) { + this.cvecategoria = cvecategoria; + } + + public String getDescImpresionGratuidade() { + return descImpresionGratuidade; + } + + public void setDescImpresionGratuidade(String descImpresionGratuidade) { + this.descImpresionGratuidade = descImpresionGratuidade; + } + + public Boolean getIndnaousaassento() { + return indnaousaassento; + } + + public void setIndnaousaassento(Boolean indnaousaassento) { + this.indnaousaassento = indnaousaassento; + } + + public List getOrgaosConcedentes() { + return orgaosConcedentes; + } + + public void setOrgaosConcedentes(List orgaosConcedentes) { + this.orgaosConcedentes = orgaosConcedentes; + } + + public String getCvesistema() { + return cvesistema; + } + + public void setCvesistema(String cvesistema) { + this.cvesistema = cvesistema; + } + + public TipoDescontoMonitrip getTipoDescontoMonitrip() { + return tipoDescontoMonitrip; + } + + public void setTipoDescontoMonitrip(TipoDescontoMonitrip tipoDescontoMonitrip) { + this.tipoDescontoMonitrip = tipoDescontoMonitrip; + } + + public TipoDescontoBPe getTipoDescontoBPe() { + return tipoDescontoBPe; + } + + public void setTipoDescontoBPe(TipoDescontoBPe tipoDescontoBPe) { + this.tipoDescontoBPe = tipoDescontoBPe; + } + + public Boolean getIndvendeapi() { + return indvendeapi; + } + + public void setIndvendeapi(Boolean indvendeapi) { + this.indvendeapi = indvendeapi; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java new file mode 100644 index 000000000..56aca4b8b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.entidad; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "CAT_BLOQ_IMPPOSTERIOR_SEQ", sequenceName = "CAT_BLOQ_IMPPOSTERIOR_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_BLOQ_IMPPOSTERIOR") +public class CategoriaBloqueioImpPosterior { + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CAT_BLOQ_IMPPOSTERIOR_SEQ") + @Column(name = "CATBLOQUEIOIMPPOSTERIOR_ID") + private Integer categoriaBloqueioImpPosteriorId; + @ManyToOne() + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoventa; + @ManyToOne() + @JoinColumn(name = "CATEGORIA_ID") + private Categoria categoria; + public Integer getCategoriaBloqueioImpPosteriorId() { + return categoriaBloqueioImpPosteriorId; + } + public void setCategoriaBloqueioImpPosteriorId(Integer categoriaBloqueioImpPosteriorId) { + this.categoriaBloqueioImpPosteriorId = categoriaBloqueioImpPosteriorId; + } + public PuntoVenta getPuntoventa() { + return puntoventa; + } + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + public Categoria getCategoria() { + return categoria; + } + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (categoriaBloqueioImpPosteriorId != null ? categoriaBloqueioImpPosteriorId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof CategoriaBloqueioImpPosterior)) { + return false; + } + CategoriaBloqueioImpPosterior other = (CategoriaBloqueioImpPosterior) object; + if ((this.categoriaBloqueioImpPosteriorId == null && other.categoriaBloqueioImpPosteriorId != null) || (this.categoriaBloqueioImpPosteriorId != null && !this.categoriaBloqueioImpPosteriorId.equals(other.categoriaBloqueioImpPosteriorId))) { + return false; + } + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaClase.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaClase.java new file mode 100644 index 000000000..903cfa681 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaClase.java @@ -0,0 +1,135 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_CLASE_SEQ", sequenceName = "CATEGORIA_CLASE_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_CLASE") +public class CategoriaClase implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_CLASE_SEQ") + @Column(name = "CATEGORIACLASE_ID") + private Integer categoriaclaseId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne + private CategoriaCtrl categoriaCtrl; + + public CategoriaClase() { + } + + public CategoriaClase(Integer categoriaclaseId) { + this.categoriaclaseId = categoriaclaseId; + } + + public Integer getCategoriaclaseId() { + return categoriaclaseId; + } + + public void setCategoriaclaseId(Integer categoriaclaseId) { + this.categoriaclaseId = categoriaclaseId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaClase other = (CategoriaClase) obj; + if (this.claseServicio != other.claseServicio && (this.claseServicio == null || !this.claseServicio.equals(other.claseServicio))) { + return false; + } + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 59 * hash + (this.claseServicio != null ? this.claseServicio.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaClase[categoriaclaseId=" + categoriaclaseId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaCorrida.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaCorrida.java new file mode 100644 index 000000000..261eee1e8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaCorrida.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_CORRIDA_SEQ", sequenceName = "CATEGORIA_CORRIDA_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_CORRIDA") +public class CategoriaCorrida implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_CORRIDA_SEQ") + @Column(name = "CATEGORIA_CORRIDA") + private Integer categoriaCorrida; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CORRIDA_ID", referencedColumnName = "CORRIDA_ID") + @ManyToOne + @NotFound(action=NotFoundAction.IGNORE) + private CorridaCtrl corridaCtrl; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne + @NotFound(action=NotFoundAction.IGNORE) + private CategoriaCtrl categoriaCtrl; + + public CategoriaCorrida() { + } + + public CategoriaCorrida(Integer categoriaCorrida) { + this.categoriaCorrida = categoriaCorrida; + } + + public Integer getCategoriaCorrida() { + return categoriaCorrida; + } + + public void setCategoriaCorrida(Integer categoriaCorrida) { + this.categoriaCorrida = categoriaCorrida; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public CorridaCtrl getCorridaCtrl() { + return corridaCtrl; + } + + public void setCorridaCtrl(CorridaCtrl corridaCtrl) { + this.corridaCtrl = corridaCtrl; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaCorrida other = (CategoriaCorrida) obj; + if (this.corridaCtrl != other.corridaCtrl && (this.corridaCtrl == null || !this.corridaCtrl.equals(other.corridaCtrl))) { + return false; + } + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 97 * hash + (this.corridaCtrl != null ? this.corridaCtrl.hashCode() : 0); + hash = 97 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaCorrida[categoriaCorrida=" + categoriaCorrida + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaCtrl.java new file mode 100644 index 000000000..c62270b78 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaCtrl.java @@ -0,0 +1,371 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_CTRL_SEQ", sequenceName = "CATEGORIA_CTRL_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_CTRL") +public class CategoriaCtrl implements Serializable, Cloneable { + + public final static Integer[] idsCategoriasNoVisible = {1}; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_CTRL_SEQ") + @Column(name = "CATEGORIACTRL_ID") + private Integer categoriactrlId; + @JoinColumn(name = "EMPRESA_ID") + @OneToOne + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "DESCRICAO") + private String descricao; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "categoriaCtrl", cascade = CascadeType.ALL) + private List categoriaDescuentoList; + @OneToMany(mappedBy = "categoriaCtrl", cascade = CascadeType.ALL) + private List categoriaClaseList; + @OneToMany(mappedBy = "categoriaCtrl", cascade = CascadeType.ALL) + private List categoriaMarcaList; + @OneToMany(mappedBy = "categoriaCtrl", cascade = CascadeType.ALL) + @NotFound(action=NotFoundAction.IGNORE) + private List categoriaCorridaList; + @OneToMany(mappedBy = "categoriaCtrl", cascade = CascadeType.ALL) + private List categoriaMercadoList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "categoriaCtrl") + private List categoriaOrgaoList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "categoriaCtrl") + private List categoriaRutaList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "categoriaCtrl") + private List categoriaRutaExcecaoList; + public CategoriaCtrl() { + + } + + public CategoriaCtrl(Integer categoriactrlId) { + this.categoriactrlId = categoriactrlId; + } + + public CategoriaCtrl(Integer categoriactrlId, Date fecmodif) { + this.categoriactrlId = categoriactrlId; + this.fecmodif = fecmodif; + } + + public Integer getCategoriactrlId() { + return categoriactrlId; + } + + public void setCategoriactrlId(Integer categoriactrlId) { + this.categoriactrlId = categoriactrlId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public List getCategoriaDescuentoList() { + List tmp = new ArrayList(); + if (categoriaDescuentoList != null) { + for (CategoriaDescuento cm : this.categoriaDescuentoList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaDescuentoList(List categoriaDescuentoList) { + this.categoriaDescuentoList = categoriaDescuentoList; + } + + public List getCategoriaClaseList() { + //return categoriaClaseList; + List tmp = new ArrayList(); + if (categoriaClaseList != null) { + for (CategoriaClase cm : this.categoriaClaseList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaClaseList(List categoriaClaseList) { + this.categoriaClaseList = categoriaClaseList; + } + + public List getCategoriaOrgaoList() { + //return categoriaMarcaList; + List tmp = new ArrayList(); + if (categoriaMercadoList != null) { + for (CategoriaOrgao cm : this.categoriaOrgaoList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public List getCategoriaRutaList() { + List tmp = new ArrayList(); + if (categoriaRutaList != null) { + for (CategoriaRuta cm : this.categoriaRutaList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public List getCategoriaRutaExcecaoList() { + List tmp = new ArrayList(); + if (categoriaRutaExcecaoList != null) { + for (CategoriaRutaExcecao cm : categoriaRutaExcecaoList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaorgaoList(List categoriaOrgaoList) { + this.categoriaOrgaoList = categoriaOrgaoList; + } + + public void setCategoriarutaList(List categoriaRutaList) { + this.categoriaRutaList = categoriaRutaList; + } + + public void setCategoriarutaExcecaoList(List categoriaRutaExcecaoList) { + this.categoriaRutaExcecaoList = categoriaRutaExcecaoList; + } + + public List getCategoriaMarcaList() { + //return categoriaMarcaList; + List tmp = new ArrayList(); + if (categoriaMercadoList != null) { + for (CategoriaMarca cm : this.categoriaMarcaList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaMarcaList(List categoriaMarcaList) { + this.categoriaMarcaList = categoriaMarcaList; + } + + public List getCategoriaCorridaList() { + //return categoriaCorridaList; + List tmp = new ArrayList(); + if (categoriaCorridaList != null) { + for (CategoriaCorrida cm : this.categoriaCorridaList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaCorridaList(List categoriaCorridaList) { + this.categoriaCorridaList = categoriaCorridaList; + } + + public List getCategoriaMercadoList() { + List tmp = new ArrayList(); + if (categoriaMercadoList != null) { + for (CategoriaMercado cm : this.categoriaMercadoList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaMercadoList(List categoriaMercadoList) { + this.categoriaMercadoList = categoriaMercadoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (categoriactrlId != null ? categoriactrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CategoriaCtrl)) { + return false; + } + CategoriaCtrl other = (CategoriaCtrl) object; + if ((this.categoriactrlId == null && other.categoriactrlId != null) || (this.categoriactrlId != null && !this.categoriactrlId.equals(other.categoriactrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaCtrl[categoriactrlId=" + categoriactrlId + "]"; + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + public List addNuevoCloneCategoriaMarca(List lsCategoriaMarca, CategoriaCtrl nuevo) { + + for (CategoriaMarca categoriaMarca : lsCategoriaMarca) { + categoriaMarca.setCategoriaCtrl(nuevo); + categoriaMarca.setCategoriamarcaId(null); + } + return lsCategoriaMarca; + } + + public List addNuevoCloneCategoriaOrgao(List lsCategoriaOrgao, CategoriaCtrl nuevo) { + + for (CategoriaOrgao categoriaOrgao : lsCategoriaOrgao) { + categoriaOrgao.setCategoriaCtrl(nuevo); + categoriaOrgao.setCategoriaorgaoId(null); + } + return lsCategoriaOrgao; + } + + public List addNuevoCloneCategoriaRuta(List lsCategoriaRuta, CategoriaCtrl nuevo) { + for (CategoriaRuta categoriaRuta : lsCategoriaRuta) { + categoriaRuta.setCategoriaCtrl(nuevo); + categoriaRuta.setCategoriarutaId(null); + } + return lsCategoriaRuta; + } + + public List addNuevoCloneCategoriaRutaExcecao(List lsCategoriaRutaExcecao, CategoriaCtrl nuevo) { + for (CategoriaRutaExcecao categoriaRutaExcecao : lsCategoriaRutaExcecao) { + categoriaRutaExcecao.setCategoriaCtrl(nuevo); + categoriaRutaExcecao.setCategoriaRutaExcecaoId(null); + } + return lsCategoriaRutaExcecao; + } + + public List addNuevoCloneCategoriaCorrida(List lsCategoriaCorrida, CategoriaCtrl nuevo) { + for (CategoriaCorrida categoriaCorrida : lsCategoriaCorrida) { + categoriaCorrida.setCategoriaCtrl(nuevo); + categoriaCorrida.setCategoriaCorrida(null); + } + return lsCategoriaCorrida; + } + + public List addNuevoCloneCategoriaClase(List lsCategoriaClase, CategoriaCtrl nuevo) { + for (CategoriaClase categoriaClase : lsCategoriaClase) { + categoriaClase.setCategoriaCtrl(nuevo); + categoriaClase.setCategoriaclaseId(null); + } + return lsCategoriaClase; + } + + public List addNuevoCloneCategoriaDescuento(List lsCategoriaDescuento, CategoriaCtrl nuevo) { + for (CategoriaDescuento categoriaDescuento : lsCategoriaDescuento) { + categoriaDescuento.setCategoriaCtrl(nuevo); + categoriaDescuento.setCategoriadescuentoId(null); + } + return lsCategoriaDescuento; + } + + public List addNuevoCloneCategoriaMercado(List lsCategoriaMercado, CategoriaCtrl nuevo) { + for (CategoriaMercado categoriaMercado : lsCategoriaMercado) { + categoriaMercado.setCategoriaCtrl(nuevo); + categoriaMercado.setCategoriamercadoId(null); + } + return lsCategoriaMercado; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaDescuento.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaDescuento.java new file mode 100644 index 000000000..5a4fb4d0b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaDescuento.java @@ -0,0 +1,972 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang.BooleanUtils; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.enums.HorarioLiberacaoVendaPassagem; +import com.rjconsultores.ventaboletos.enums.TipoPassagemCores; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_DESCUENTO_SEQ", sequenceName = "CATEGORIA_DESCUENTO_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_DESCUENTO") +public class CategoriaDescuento implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_DESCUENTO_SEQ") + @Column(name = "CATEGORIADESCUENTO_ID") + private Integer categoriadescuentoId; + @Column(name = "CANTAUTORIZADA") + private Integer cantautorizada; + @Column(name = "DESCUENTOPORC") + private BigDecimal descuentoporc; + @Column(name = "DESCUENTOIMPORTE") + private BigDecimal descuentoimporte; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne(cascade = CascadeType.ALL) + private CategoriaCtrl categoriaCtrl; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + @OneToMany(mappedBy = "categoriaDescuento", cascade = CascadeType.ALL, fetch=FetchType.EAGER) + private List categoriaPeriodoList; + @Column(name = "INDIMPRIMEBOLETO") + private Boolean indImprimeBoleto; + @Column(name = "INDCUOTA") + private Boolean indCuota; + @Column(name = "INDCUOTATRAMO") + private Boolean indCuotaTramo; + @Column(name = "INDCUOTANUNCALIBERAR") + private Boolean indCuotaNuncaLiberar; + @Column(name = "TIEMPOCUOTA") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoCuota; + @Column(name = "INDAPLICAFERIADO") + private String indAplicaFeriado; + @Column(name = "INDIMPORTEOUTROS") + private Boolean indImporteOutros; + @Column(name = "INDIMPORTESEGURO") + private Boolean indImporteSeguro; + @Column(name = "INDIMPORTETXEMBARQUE") + private Boolean indImporteTxEmbarque; + @Column(name = "INDIMPORTEPEDAGIO") + private Boolean indImportePedagio; + @Column(name = "TIEMPOACTIVAR") + private Integer tiempoActivar; + @Column(name = "TIEMPODESACTIVAR") + private Integer tiempoDesactivar; + @Column(name = "INDVENTAABIERTO") + private Boolean indVentaAbierto; + @Column(name = "INDVENTASOLAMENTERESERVA") + private Boolean indVentaSolamenteReserva; + @Column(name = "INDLIBERACIONSOLAMENTEENVASADO") + private Boolean indLiberacionSolamenteEnvasado; + @Column(name = "ASIENTOSRESERVADOS") + private String asientosReservados; + + @Column(name = "INDEXIGENOMBPASAJERO") + private Boolean indexigenombpasajero; + @Column(name = "INDEXIGEDOCPASAJERO") + private Boolean indexigedocpasajero; + @Column(name = "INDEXIGETELEFONOPASAJERO") + private Boolean indexigetelefonopasajero; + @Column(name = "INDEXIGEFECNACIMIENTOPASAJERO") + private Boolean indexigefecnacimientopasajero; + @Column(name = "INDEXIGEDOC2PASSAGEIRO") + private Boolean indExigeDoc2Passageiro; + @Column(name = "INDEXIGEENDERECOPASSAGEIRO") + private Boolean indExigeEnderecoPassageiro; + @Column(name = "INDEXIGEEMAILPASSAGEIRO") + private Boolean indExigeEmailPassageiro; + + @Column(name = "INDSEGUNDA") + private Boolean indSegunda; + @Column(name = "INDTERCA") + private Boolean indTerca; + @Column(name = "INDQUARTA") + private Boolean indQuarta; + @Column(name = "INDQUINTA") + private Boolean indQuinta; + @Column(name = "INDSEXTA") + private Boolean indSexta; + @Column(name = "INDSABADO") + private Boolean indSabado; + @Column(name = "INDDOMINGO") + private Boolean indDomingo; + + @Enumerated(EnumType.ORDINAL) + @Column(name = "HORARIOLIBERACAOVENDAPESSAGEM") + private HorarioLiberacaoVendaPassagem horarioLiberacaoVendaPassagem; + + @Column(name = "TIPODESCCOMPPRECO") + private Integer tipodesccomppreco; + + @Column(name = "DESCCOMPPRECO") + private BigDecimal desccomppreco; + + @Enumerated(EnumType.STRING) + @Column(name = "CORPOLTRONA") + private TipoPassagemCores corpoltrona; + + @Column(name = "INDNAOPERMITEVDAMESMODOCVIAGEM") + private Boolean indnaopermitevdamesmodocviagem; + + @Column(name = "INDNAOPERMITEVENDADUASGRAT") + private Boolean indNaoPermiteVendaDuasGrat; + + @Column(name = "INDNAOAPLICATARIFAMINIMA") + private Boolean indnaoaplicatarifaminima; + + @Column(name = "INDTIPOOCUPACAO") + private boolean indtipoocupacao; + + @Column(name = "INDEMITESOMENTECUPOMEMBARQUE") + private Boolean indEmiteSomenteCupomEmbarque; + + @Column(name = "QTDE_VIAS_CUPOM_EMBARQUE") + private Integer qtdeViasCupomEmbarque; + + @Column(name = "INDVENDAANTECIPADAPORKM") + private Boolean indVendaAntecipadaPorKM; + + @Column(name = "KMVENDAANTECIPADA") + private Integer kmVendaAntecipada; + + @Column(name = "TEMPOLIBERACAOATEKM") + private Date tempoLiberacaoAteKM; + + @Column(name = "TEMPOLIBERACAODEPOISKM") + private Date tempoLiberacaoDepoisKM; + + @Column(name = "QTDE_LIMITE_NAO_EMBARQUE") + private Integer qtdeLimiteNaoEmbarque; + + @Column(name = "INDCLIENTEPCD") + private Boolean indClientePcd; + + @Column(name = "INDCHECKINAUTOMATICO") + private Boolean indCheckinAutomatico; + + //Comportamento geral + @Column(name = "INDPERMITETROCA") + private Boolean indPermiteTroca; + + @Column(name = "INDPERMITETRANSFERENCIA") + private Boolean indPermiteTransferencia; + + @Column(name = "INDPERMITECANCELAR") + private Boolean indPermiteCancelar; + + @Column(name = "INDPERMITEDEVOLVER") + private Boolean indPermiteDevolver; + + @Column(name = "INDPERMITECANCELAREMERGENCIAL") + private Boolean indPermiteCancelarEmergencial; + + @Column(name = "INDPERMITETROCATITULARIDADE") + private Boolean indPermiteTrocaTitularidade; + + @Column(name = "INDPERMITEREATIVAR") + private Boolean indPermiteReativar; + + //Comportamento em Aberto + @Column(name = "INDCANCELAEMABERTO") + private Boolean indCancelaEmAberto; + + @Column(name = "INDDEVOLVEEMABERTO") + private Boolean indDevolveEmAberto; + + @Column(name = "INDCANCELAEMERGENCIALAEMABERTO") + private Boolean indCancelaEmergencialEmAberto; + + @Column(name = "INDTROCAEMABERTO") + private Boolean indTrocaEmAberto; + + @Column(name = "INDTROCATITULARIDADEEMABERTO") + private Boolean indTrocaTitularidadeEmAberto; + + @JoinColumn(name = "CATEGORIAINTERAGE_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne(cascade = CascadeType.ALL) + private Categoria categoriaInterage; + + public enum DisponibilidadeFeriado { + // Declaração dos enum + GERARSEMPRE("SEMPRE", "S"), + + GERARQUANDOFERIADO("SÓ QUANDO FOR FERIADO", "F"), + + GERARQUANDONAOFERIADO("QUANDO NÃO FOR FERIADO", "N"); + + // Definição das constantes + public final String valor; + public final String descricao; + + public String valor() { + return this.valor; + } + + public String descricao() { + return this.descricao; + } + + private DisponibilidadeFeriado(String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + } + + public enum TipoDescontoComponentePreco { + + DESCONTO_COMPONENTE_PRECO_PERC(1), + DESCONTO_COMPONENTE_PRECO_VALOR(2); + + public final Integer valor; + + public Integer getValor() { + return valor; + } + + private TipoDescontoComponentePreco(Integer valor) { + this.valor = valor; + } + + } + + public CategoriaDescuento() { + this.indSegunda = true; + this.indTerca = true; + this.indQuarta = true; + this.indQuinta = true; + this.indSexta = true; + this.indSabado = true; + this.indDomingo = true; + + } + + public CategoriaDescuento(Integer categoriadescuentoId) { + this.categoriadescuentoId = categoriadescuentoId; + + this.indSegunda = true; + this.indTerca = true; + this.indQuarta = true; + this.indQuinta = true; + this.indSexta = true; + this.indSabado = true; + this.indDomingo = true; + } + + public CategoriaDescuento(Integer categoriadescuentoId, Date fecmodif) { + this.categoriadescuentoId = categoriadescuentoId; + this.fecmodif = fecmodif; + + this.indSegunda = true; + this.indTerca = true; + this.indQuarta = true; + this.indQuinta = true; + this.indSexta = true; + this.indSabado = true; + this.indDomingo = true; + } + + public Integer getCategoriadescuentoId() { + return categoriadescuentoId; + } + + public void setCategoriadescuentoId(Integer categoriadescuentoId) { + this.categoriadescuentoId = categoriadescuentoId; + } + + public Integer getCantautorizada() { + return cantautorizada; + } + + public void setCantautorizada(Integer cantautorizada) { + this.cantautorizada = cantautorizada; + } + + public BigDecimal getDescuentoporc() { + return descuentoporc; + } + + public void setDescuentoporc(BigDecimal descuentoporc) { + this.descuentoporc = descuentoporc; + } + + public BigDecimal getDescuentoimporte() { + return descuentoimporte; + } + + public void setDescuentoimporte(BigDecimal descuentoimporte) { + this.descuentoimporte = descuentoimporte; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + @Transactional + public List getCategoriaPeriodoList() { + List tmp = new ArrayList(); +// Hibernate.initialize(categoriaPeriodoList); + if (categoriaPeriodoList != null) { + for (CategoriaPeriodo cp : this.categoriaPeriodoList) { + if (cp.getActivo()) { + tmp.add(cp); + } + } + } + + return tmp; + } + + public void setCategoriaPeriodoList(List categoriaPeriodoList) { + this.categoriaPeriodoList = categoriaPeriodoList; + } + + public Boolean getIndImprimeBoleto() { + return indImprimeBoleto; + } + + public void setIndImprimeBoleto(Boolean indImprimeBoleto) { + this.indImprimeBoleto = indImprimeBoleto; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaDescuento other = (CategoriaDescuento) obj; + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + if (this.categoria != other.categoria && (this.categoria == null || !this.categoria.equals(other.categoria))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 53 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0); + hash = 53 * hash + (this.categoria != null ? this.categoria.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaDescuento[categoriadescuentoId=" + categoriadescuentoId + "]"; + } + + public Boolean getIndCuota() { + return indCuota; + } + + public void setIndCuota(Boolean indCuota) { + this.indCuota = indCuota; + } + + public Boolean getIndCuotaTramo() { + return indCuotaTramo; + } + + public void setIndCuotaTramo(Boolean indCuotaTramo) { + this.indCuotaTramo = indCuotaTramo; + } + + public Boolean getIndCuotaNuncaLiberar() { + return indCuotaNuncaLiberar; + } + + public void setIndCuotaNuncaLiberar(Boolean indCuotaNuncaLiberar) { + this.indCuotaNuncaLiberar = indCuotaNuncaLiberar; + } + + public Date getTiempoCuota() { + return tiempoCuota; + } + + public void setTiempoCuota(Date tiempoCuota) { + this.tiempoCuota = tiempoCuota; + } + + public String getIndAplicaFeriado() { + return indAplicaFeriado; + } + + public void setIndAplicaFeriado(String indAplicaFeriado) { + this.indAplicaFeriado = indAplicaFeriado; + } + + public Boolean getIndImporteOutros() { + return indImporteOutros; + } + + public void setIndImporteOutros(Boolean indImporteOutros) { + this.indImporteOutros = indImporteOutros; + } + + public Boolean getIndImporteSeguro() { + return indImporteSeguro; + } + + public void setIndImporteSeguro(Boolean indImporteSeguro) { + this.indImporteSeguro = indImporteSeguro; + } + + public Boolean getIndImporteTxEmbarque() { + return indImporteTxEmbarque; + } + + public void setIndImporteTxEmbarque(Boolean indImporteTxEmbarque) { + this.indImporteTxEmbarque = indImporteTxEmbarque; + } + + public Boolean getIndImportePedagio() { + return indImportePedagio; + } + + public void setIndImportePedagio(Boolean indImportePedagio) { + this.indImportePedagio = indImportePedagio; + } + + public Integer getTiempoActivar() { + return tiempoActivar; + } + + public void setTiempoActivar(Integer hora, Integer minuto) { + setTiempoDesactivar(null); + hora = (hora == null) ? 0 : hora; + minuto = (minuto == null) ? 0 : minuto; + + int totalMinutos = (hora * 60) + minuto; + setTiempoActivar((totalMinutos == 0) ? null : totalMinutos); + } + + public void setTiempoActivar(Integer tiempoActivar) { + this.tiempoActivar = tiempoActivar; + } + + public Integer getTiempoDesactivar() { + return tiempoDesactivar; + } + + public void setTiempoDesactivar(Integer hora, Integer minuto) { + setTiempoActivar(null); + hora = (hora == null) ? 0 : hora; + minuto = (minuto == null) ? 0 : minuto; + + int totalMinutos = (hora * 60) + minuto; + setTiempoDesactivar((totalMinutos == 0) ? null : totalMinutos); + } + + public void setTiempoDesactivar(Integer tiempoDesactivar) { + this.tiempoDesactivar = tiempoDesactivar; + } + + public Boolean getIndVentaAbierto() { + return indVentaAbierto; + } + + public void setIndVentaAbierto(Boolean indVentaAbierto) { + this.indVentaAbierto = indVentaAbierto; + } + + public Boolean getIndVentaSolamenteReserva() { + return indVentaSolamenteReserva; + } + + public void setIndVentaSolamenteReserva(Boolean indVentaSolamenteReserva) { + this.indVentaSolamenteReserva = indVentaSolamenteReserva; + } + + public Boolean getIndLiberacionSolamenteEnvasado() { + return indLiberacionSolamenteEnvasado; + } + + public void setIndLiberacionSolamenteEnvasado(Boolean indLiberacionSolamenteEnvasado) { + this.indLiberacionSolamenteEnvasado = indLiberacionSolamenteEnvasado; + } + + public String getAsientosReservados() { + return asientosReservados; + } + + public void setAsientosReservados(String asientosReservados) { + this.asientosReservados = asientosReservados; + } + + public Boolean getIndexigenombpasajero() { + return indexigenombpasajero; + } + + public void setIndexigenombpasajero(Boolean indexigenombpasajero) { + this.indexigenombpasajero = indexigenombpasajero; + } + + public Boolean getIndexigedocpasajero() { + return indexigedocpasajero; + } + + public void setIndexigedocpasajero(Boolean indexigedocpasajero) { + this.indexigedocpasajero = indexigedocpasajero; + } + + public Boolean getIndexigetelefonopasajero() { + return indexigetelefonopasajero; + } + + public void setIndexigetelefonopasajero(Boolean indexigetelefonopasajero) { + this.indexigetelefonopasajero = indexigetelefonopasajero; + } + + public Boolean getIndexigefecnacimientopasajero() { + return indexigefecnacimientopasajero; + } + + public void setIndexigefecnacimientopasajero(Boolean indexigefecnacimientopasajero) { + this.indexigefecnacimientopasajero = indexigefecnacimientopasajero; + } + + public Boolean getIndExigeDoc2Passageiro() { + return indExigeDoc2Passageiro; + } + + public void setIndExigeDoc2Passageiro(Boolean indExigeDoc2Passageiro) { + this.indExigeDoc2Passageiro = indExigeDoc2Passageiro; + } + + @Transactional + public String getExigeCamposPasajeroVenta() { + + StringBuilder sCampos = new StringBuilder(); + + if(getIndexigenombpasajero() != null && getIndexigenombpasajero()) { + sCampos.append("NO"); + } + + if(getIndexigedocpasajero() != null && getIndexigedocpasajero()) { + if(sCampos.length() > 0) { + sCampos.append(","); + } + sCampos.append("DO"); + } + if(getIndexigetelefonopasajero() != null && getIndexigetelefonopasajero()) { + if(sCampos.length() > 0) { + sCampos.append(","); + } + sCampos.append("TL"); + } + if(getIndexigefecnacimientopasajero() != null && getIndexigefecnacimientopasajero()) { + if(sCampos.length() > 0) { + sCampos.append(","); + } + sCampos.append("DT"); + } + if(getIndExigeDoc2Passageiro() != null && getIndExigeDoc2Passageiro()) { + if(sCampos.length() > 0) { + sCampos.append(","); + } + sCampos.append("DOC2"); + } + return sCampos.toString(); + } + + public HorarioLiberacaoVendaPassagem getHorarioLiberacaoVendaPassagem() { + return horarioLiberacaoVendaPassagem; + } + + public void setHorarioLiberacaoVendaPassagem(HorarioLiberacaoVendaPassagem horarioLiberacaoVendaPassagem) { + this.horarioLiberacaoVendaPassagem = horarioLiberacaoVendaPassagem; + } + + public Integer getTipodesccomppreco() { + return tipodesccomppreco; + } + + public void setTipodesccomppreco(Integer tipodesccomppreco) { + this.tipodesccomppreco = tipodesccomppreco; + } + + public BigDecimal getDesccomppreco() { + return desccomppreco; + } + + public void setDesccomppreco(BigDecimal desccomppreco) { + this.desccomppreco = desccomppreco; + } + + public Boolean getIndSegunda() { + return indSegunda; + } + + public void setIndSegunda(Boolean indSegunda) { + this.indSegunda = indSegunda; + } + + public Boolean getIndTerca() { + return indTerca; + } + + public void setIndTerca(Boolean indTerca) { + this.indTerca = indTerca; + } + + public Boolean getIndQuarta() { + return indQuarta; + } + + public void setIndQuarta(Boolean indQuarta) { + this.indQuarta = indQuarta; + } + + public Boolean getIndQuinta() { + return indQuinta; + } + + public void setIndQuinta(Boolean indQuinta) { + this.indQuinta = indQuinta; + } + + public Boolean getIndSexta() { + return indSexta; + } + + public void setIndSexta(Boolean indSexta) { + this.indSexta = indSexta; + } + + public Boolean getIndSabado() { + return indSabado; + } + + public void setIndSabado(Boolean indSabado) { + this.indSabado = indSabado; + } + + public Boolean getIndDomingo() { + return indDomingo; + } + + public void setIndDomingo(Boolean indDomingo) { + this.indDomingo = indDomingo; + } + + public TipoPassagemCores getCorpoltrona() { + return corpoltrona; + } + + public void setCorpoltrona(TipoPassagemCores corpoltrona) { + this.corpoltrona = corpoltrona; + } + + public Boolean getIndnaopermitevdamesmodocviagem() { + return indnaopermitevdamesmodocviagem; + } + + public void setIndnaopermitevdamesmodocviagem(Boolean indnaopermitevdamesmodocviagem) { + this.indnaopermitevdamesmodocviagem = indnaopermitevdamesmodocviagem; + } + + public Boolean getIndnaoaplicatarifaminima() { + return indnaoaplicatarifaminima != null ? indnaoaplicatarifaminima : Boolean.FALSE; + } + + public void setIndnaoaplicatarifaminima(Boolean indnaoaplicatarifaminima) { + this.indnaoaplicatarifaminima = indnaoaplicatarifaminima; + } + + public Boolean getIndExigeEnderecoPassageiro() { + return indExigeEnderecoPassageiro; + } + + public void setIndExigeEnderecoPassageiro(Boolean indExigeEnderecoPassageiro) { + this.indExigeEnderecoPassageiro = indExigeEnderecoPassageiro; + } + + public Boolean getIndExigeEmailPassageiro() { + return indExigeEmailPassageiro; + } + + public void setIndExigeEmailPassageiro(Boolean indExigeEmailPassageiro) { + this.indExigeEmailPassageiro = indExigeEmailPassageiro; + } + + public boolean getIndtipoocupacao() { + return indtipoocupacao; + } + + public void setIndtipoocupacao(boolean indtipoocupacao) { + this.indtipoocupacao = indtipoocupacao; + } + + public Boolean getIndNaoPermiteVendaDuasGrat() { + return indNaoPermiteVendaDuasGrat == null ? false : indNaoPermiteVendaDuasGrat; + } + + public void setIndNaoPermiteVendaDuasGrat(Boolean indNaoPermiteVendaDuasGrat) { + this.indNaoPermiteVendaDuasGrat = indNaoPermiteVendaDuasGrat; + } + + public Boolean getIndEmiteSomenteCupomEmbarque() { + return BooleanUtils.toBoolean(indEmiteSomenteCupomEmbarque); + } + + public void setIndEmiteSomenteCupomEmbarque(Boolean indEmiteSomenteCupomEmbarque) { + this.indEmiteSomenteCupomEmbarque = indEmiteSomenteCupomEmbarque; + } + + public Integer getQtdeViasCupomEmbarque() { + return qtdeViasCupomEmbarque; + } + + public void setQtdeViasCupomEmbarque(Integer qtdeViasCupomEmbarque) { + this.qtdeViasCupomEmbarque = qtdeViasCupomEmbarque; + } + + public Boolean isIndVendaAntecipadaPorKM() { + return indVendaAntecipadaPorKM; + } + + public void setIndVendaAntecipadaPorKM(Boolean indVendaAntecipadaPorKM) { + this.indVendaAntecipadaPorKM = indVendaAntecipadaPorKM; + } + + public Integer getKmVendaAntecipada() { + return kmVendaAntecipada; + } + + public void setKmVendaAntecipada(Integer kmVendaAntecipada) { + this.kmVendaAntecipada = kmVendaAntecipada; + } + + public Date getTempoLiberacaoAteKM() { + return tempoLiberacaoAteKM; + } + + public void setTempoLiberacaoAteKM(Date tempoLiberacaoAteKM) { + this.tempoLiberacaoAteKM = tempoLiberacaoAteKM; + } + + public Date getTempoLiberacaoDepoisKM() { + return tempoLiberacaoDepoisKM; + } + + public void setTempoLiberacaoDepoisKM(Date tempoLiberacaoDepoisKM) { + this.tempoLiberacaoDepoisKM = tempoLiberacaoDepoisKM; + } + + public Boolean getIndVendaAntecipadaPorKM() { + return BooleanUtils.toBoolean(indVendaAntecipadaPorKM); + } + + public Integer getQtdeLimiteNaoEmbarque() { + return qtdeLimiteNaoEmbarque; + } + + public void setQtdeLimiteNaoEmbarque(Integer qtdeLimiteNaoEmbarque) { + this.qtdeLimiteNaoEmbarque = qtdeLimiteNaoEmbarque; + } + + public Boolean getIndClientePcd() { + return BooleanUtils.toBoolean(indClientePcd); + } + + public void setIndClientePcd(Boolean indClientePcd) { + this.indClientePcd = indClientePcd; + } + + public Boolean getIndCancelaEmAberto() { + return indCancelaEmAberto == null ? true : indCancelaEmAberto; + } + + public void setIndCancelaEmAberto(Boolean indCancelaEmAberto) { + this.indCancelaEmAberto = indCancelaEmAberto; + } + + public Boolean getIndDevolveEmAberto() { + return indDevolveEmAberto == null ? true : indDevolveEmAberto ; + } + + public void setIndDevolveEmAberto(Boolean indDevolveEmAberto) { + this.indDevolveEmAberto = indDevolveEmAberto; + } + + public Boolean getIndCancelaEmergencialEmAberto() { + return indCancelaEmergencialEmAberto == null ? true : indCancelaEmergencialEmAberto; + } + + public void setIndCancelaEmergencialEmAberto(Boolean indCancelaEmergencialEmAberto) { + this.indCancelaEmergencialEmAberto = indCancelaEmergencialEmAberto; + } + + public Boolean getIndTrocaEmAberto() { + return indTrocaEmAberto == null ? true : indTrocaEmAberto; + } + + public void setIndTrocaEmAberto(Boolean indTrocaEmAberto) { + this.indTrocaEmAberto = indTrocaEmAberto; + } + + public Boolean getIndTrocaTitularidadeEmAberto() { + return indTrocaTitularidadeEmAberto == null ? true : indTrocaTitularidadeEmAberto; + } + + public void setIndTrocaTitularidadeEmAberto(Boolean indTrocaTitularidadeEmAberto) { + this.indTrocaTitularidadeEmAberto = indTrocaTitularidadeEmAberto; + } + + public Boolean getIndPermiteCancelar() { + return indPermiteCancelar == null ? true : indPermiteCancelar; + } + + public void setIndPermiteCancelar(Boolean indPermiteCancelar) { + this.indPermiteCancelar = indPermiteCancelar; + } + + public Boolean getIndPermiteDevolver() { + return indPermiteDevolver == null ? true : indPermiteDevolver; + } + + public void setIndPermiteDevolver(Boolean indPermiteDevolver) { + this.indPermiteDevolver = indPermiteDevolver; + } + + public Boolean getIndPermiteCancelarEmergencial() { + return indPermiteCancelarEmergencial == null ? true : indPermiteCancelarEmergencial ; + } + + public void setIndPermiteCancelarEmergencial(Boolean indPermiteCancelarEmergencial) { + this.indPermiteCancelarEmergencial = indPermiteCancelarEmergencial; + } + + public Boolean getIndPermiteTrocaTitularidade() { + return indPermiteTrocaTitularidade == null ? true : indPermiteTrocaTitularidade; + } + + public void setIndPermiteTrocaTitularidade(Boolean indPermiteTrocaTitularidade) { + this.indPermiteTrocaTitularidade = indPermiteTrocaTitularidade; + } + + public Boolean getIndPermiteReativar() { + return indPermiteReativar == null ? true : indPermiteReativar; + } + + public void setIndPermiteReativar(Boolean indPermiteReativar) { + this.indPermiteReativar = indPermiteReativar; + } + + public Boolean getIndCheckinAutomatico() { + return indCheckinAutomatico; + } + + public void setIndCheckinAutomatico(Boolean indCheckinAutomatico) { + this.indCheckinAutomatico = indCheckinAutomatico; + } + + public Boolean getIndPermiteTroca() { + return indPermiteTroca == null ? true : indPermiteTroca; + } + + public void setIndPermiteTroca(Boolean indPermiteTroca) { + this.indPermiteTroca = indPermiteTroca; + } + + public Boolean getIndPermiteTransferencia() { + return indPermiteTransferencia == null ? true : indPermiteTransferencia; + } + + public void setIndPermiteTransferencia(Boolean indPermiteTransferencia) { + this.indPermiteTransferencia = indPermiteTransferencia; + } + + public Categoria getCategoriaInterage() { + return categoriaInterage; + } + + public void setCategoriaInterage(Categoria categoriaInterage) { + this.categoriaInterage = categoriaInterage; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaMarca.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaMarca.java new file mode 100644 index 000000000..c56c1c4e4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaMarca.java @@ -0,0 +1,136 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_MARCA_SEQ", sequenceName = "CATEGORIA_MARCA_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_MARCA") +public class CategoriaMarca implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_MARCA_SEQ") + @Column(name = "CATEGORIAMARCA_ID") + private Integer categoriamarcaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne + private CategoriaCtrl categoriaCtrl; + + public CategoriaMarca() { + } + + public CategoriaMarca(Integer categoriamarcaId) { + this.categoriamarcaId = categoriamarcaId; + } + + public Integer getCategoriamarcaId() { + return categoriamarcaId; + } + + public void setCategoriamarcaId(Integer categoriamarcaId) { + this.categoriamarcaId = categoriamarcaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaMarca other = (CategoriaMarca) obj; + if (this.marca != other.marca && (this.marca == null || !this.marca.equals(other.marca))) { + return false; + } + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (this.marca != null ? this.marca.hashCode() : 0); + hash = 97 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaMarca[categoriamarcaId=" + categoriamarcaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaMercado.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaMercado.java new file mode 100644 index 000000000..93d186f21 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaMercado.java @@ -0,0 +1,147 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_MERCADO_SEQ", sequenceName = "CATEGORIA_MERCADO_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_MERCADO") +public class CategoriaMercado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_MERCADO_SEQ") + @Column(name = "CATEGORIAMERCADO_ID") + private Integer categoriamercadoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne + private CategoriaCtrl categoriaCtrl; + + public CategoriaMercado() { + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + public Integer getCategoriamercadoId() { + return categoriamercadoId; + } + + public void setCategoriamercadoId(Integer categoriamercadoId) { + this.categoriamercadoId = categoriamercadoId; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaMercado other = (CategoriaMercado) obj; + if (this.destino != other.destino && (this.destino == null || !this.destino.equals(other.destino))) { + return false; + } + if (this.origem != other.origem && (this.origem == null || !this.origem.equals(other.origem))) { + return false; + } + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 11 * hash + (this.destino != null ? this.destino.hashCode() : 0); + hash = 11 * hash + (this.origem != null ? this.origem.hashCode() : 0); + hash = 11 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaMercado[categoriamercadoId=" + categoriamercadoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java new file mode 100644 index 000000000..62b23c495 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java @@ -0,0 +1,133 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CATEGORIA_ORGAO_SEQ", sequenceName = "CATEGORIA_ORGAO_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_ORGAO") +public class CategoriaOrgao implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_ORGAO_SEQ") + @Column(name = "CATEGORIAORGAO_ID") + private Integer categoriaorgaoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgao; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne + private CategoriaCtrl categoriaCtrl; + + public CategoriaOrgao() { + } + + public CategoriaOrgao(Integer categoriaorgaoId) { + this.categoriaorgaoId = categoriaorgaoId; + } + + + + public Integer getCategoriaorgaoId() { + return categoriaorgaoId; + } + + public void setCategoriaorgaoId(Integer categoriaorgaoId) { + this.categoriaorgaoId = categoriaorgaoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + + public OrgaoConcedente getOrgao() { + return orgao; + } + + public void setOrgao(OrgaoConcedente orgao) { + this.orgao = orgao; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaOrgao other = (CategoriaOrgao) obj; + if (this.orgao != other.orgao && (this.orgao == null || !this.orgao.equals(other.orgao))) { + return false; + } + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (this.orgao != null ? this.orgao.hashCode() : 0); + hash = 97 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaOrgao[categoriaorgaoId=" + categoriaorgaoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaPeriodo.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaPeriodo.java new file mode 100644 index 000000000..0fe015d8c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaPeriodo.java @@ -0,0 +1,157 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_PERIODO_SEQ", sequenceName = "CATEGORIA_PERIODO_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_PERIODO") +public class CategoriaPeriodo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_PERIODO_SEQ") + @Column(name = "CATEGORIAPERIODO_ID") + private Integer categoriaperiodoId; + @Column(name = "FECINICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecinicio; + @Column(name = "FECFIN") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfin; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CATEGORIADESCUENTO_ID", referencedColumnName = "CATEGORIADESCUENTO_ID") + @ManyToOne + private CategoriaDescuento categoriaDescuento; + + public CategoriaPeriodo() { + } + + public CategoriaPeriodo(Integer categoriaperiodoId) { + this.categoriaperiodoId = categoriaperiodoId; + } + + public CategoriaPeriodo(Integer categoriaperiodoId, Date fecmodif) { + this.categoriaperiodoId = categoriaperiodoId; + this.fecmodif = fecmodif; + } + + public Integer getCategoriaperiodoId() { + return categoriaperiodoId; + } + + public void setCategoriaperiodoId(Integer categoriaperiodoId) { + this.categoriaperiodoId = categoriaperiodoId; + } + + public Date getFecinicio() { + return fecinicio; + } + + public void setFecinicio(Date fecinicio) { + this.fecinicio = fecinicio; + } + + public Date getFecfin() { + return fecfin; + } + + public void setFecfin(Date fecfin) { + this.fecfin = fecfin; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public CategoriaDescuento getCategoriaDescuento() { + return categoriaDescuento; + } + + public void setCategoriaDescuento(CategoriaDescuento categoriaDescuento) { + this.categoriaDescuento = categoriaDescuento; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaPeriodo other = (CategoriaPeriodo) obj; + if (this.fecinicio != other.fecinicio && (this.fecinicio == null || !this.fecinicio.equals(other.fecinicio))) { + return false; + } + if (this.fecfin != other.fecfin && (this.fecfin == null || !this.fecfin.equals(other.fecfin))) { + return false; + } + if (this.categoriaDescuento != other.categoriaDescuento && (this.categoriaDescuento == null || !this.categoriaDescuento.equals(other.categoriaDescuento))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 19 * hash + (this.fecinicio != null ? this.fecinicio.hashCode() : 0); + hash = 19 * hash + (this.fecfin != null ? this.fecfin.hashCode() : 0); + hash = 19 * hash + (this.categoriaDescuento != null ? this.categoriaDescuento.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo[categoriaperiodoId=" + categoriaperiodoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaRuta.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaRuta.java new file mode 100644 index 000000000..2056bcf0e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaRuta.java @@ -0,0 +1,162 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CATEGORIA_RUTA_SEQ", sequenceName = "CATEGORIA_RUTA_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_RUTA") +public class CategoriaRuta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_RUTA_SEQ") + @Column(name = "CATEGORIARUTA_ID") + private Integer categoriarutaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "QTD_POLTRONA_AUTORIZADA") + private Integer qtdPoltronasAutorizadas; + @Column(name = "VALOR_DESCONTO") + private BigDecimal valorDesconto; + @Column(name = "PORCENTAGEM_DESCONTO") + private BigDecimal porcentagemDesconto; + + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne + private CategoriaCtrl categoriaCtrl; + + public CategoriaRuta() { + } + + public CategoriaRuta(Integer categoriarutaId) { + this.categoriarutaId = categoriarutaId; + } + + public Integer getCategoriarutaId() { + return categoriarutaId; + } + + public void setCategoriarutaId(Integer categoriarutaId) { + this.categoriarutaId = categoriarutaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + public Integer getQtdPoltronasAutorizadas() { + return qtdPoltronasAutorizadas; + } + + public void setQtdPoltronasAutorizadas(Integer qtdPoltronasAutorizadas) { + this.qtdPoltronasAutorizadas = qtdPoltronasAutorizadas; + } + + public BigDecimal getValorDesconto() { + return valorDesconto; + } + + public void setValorDesconto(BigDecimal valorDesconto) { + this.valorDesconto = valorDesconto; + } + + public BigDecimal getPorcentagemDesconto() { + return porcentagemDesconto; + } + + public void setPorcentagemDesconto(BigDecimal porcentagemDesconto) { + this.porcentagemDesconto = porcentagemDesconto; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaRuta other = (CategoriaRuta) obj; + if (this.ruta != other.ruta && (this.ruta == null || !this.ruta.equals(other.ruta))) { + return false; + } + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (this.ruta != null ? this.ruta.hashCode() : 0); + hash = 97 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaOrgao[categoriaorgaoId=" + categoriarutaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaRutaExcecao.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaRutaExcecao.java new file mode 100644 index 000000000..21e0d9f46 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaRutaExcecao.java @@ -0,0 +1,131 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CATEGORIA_RUTA_EXCECAO_SEQ", sequenceName = "CATEGORIA_RUTA_EXCECAO_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_RUTA_EXCECAO") +public class CategoriaRutaExcecao implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_RUTA_EXCECAO_SEQ") + @Column(name = "CATEGORIARUTAEXCECAO_ID") + private Integer categoriaRutaExcecaoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") + @ManyToOne + private CategoriaCtrl categoriaCtrl; + + public CategoriaRutaExcecao() { + } + + public CategoriaRutaExcecao(Integer categoriaRutaExcecaoId) { + this.categoriaRutaExcecaoId = categoriaRutaExcecaoId; + } + + public Integer getCategoriaRutaExcecaoId() { + return categoriaRutaExcecaoId; + } + + public void setCategoriaRutaExcecaoId(Integer categoriaRutaExcecaoId) { + this.categoriaRutaExcecaoId = categoriaRutaExcecaoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public CategoriaCtrl getCategoriaCtrl() { + return categoriaCtrl; + } + + public void setCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + this.categoriaCtrl = categoriaCtrl; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaRutaExcecao other = (CategoriaRutaExcecao) obj; + if (this.ruta != other.ruta && (this.ruta == null || !this.ruta.equals(other.ruta))) { + return false; + } + if (this.categoriaCtrl != other.categoriaCtrl && (this.categoriaCtrl == null || !this.categoriaCtrl.equals(other.categoriaCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 97 * hash + (this.ruta != null ? this.ruta.hashCode() : 0); + hash = 97 * hash + (this.categoriaCtrl != null ? this.categoriaCtrl.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaRutaExcecao[categoriaRutaExcecaoId=" + categoriaRutaExcecaoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaTipoPtoVta.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaTipoPtoVta.java new file mode 100644 index 000000000..62887adad --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaTipoPtoVta.java @@ -0,0 +1,150 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@SequenceGenerator(name = "CATEGORIA_TIPOPTOVTA_SEQ", sequenceName = "CATEGORIA_TIPOPTOVTA_SEQ", allocationSize = 1) +@Table(name = "CATEGORIA_TIPOPTOVTA") +public class CategoriaTipoPtoVta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CATEGORIA_TIPOPTOVTA_SEQ") + @Column(name = "CATEGORIATIPOPTOVTA_ID") + private Integer categoriatipoptovtaId; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private int usuarioId; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") + @ManyToOne + private TipoPuntoVenta tipoPuntoVenta; + + public CategoriaTipoPtoVta() { + } + + public CategoriaTipoPtoVta(Integer categoriatipoptovtaId) { + this.categoriatipoptovtaId = categoriatipoptovtaId; + } + + public CategoriaTipoPtoVta(Integer categoriatipoptovtaId, Boolean activo, Date fecmodif, int usuarioId) { + this.categoriatipoptovtaId = categoriatipoptovtaId; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Integer getCategoriatipoptovtaId() { + return categoriatipoptovtaId; + } + + public void setCategoriatipoptovtaId(Integer categoriatipoptovtaId) { + this.categoriatipoptovtaId = categoriatipoptovtaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + public TipoPuntoVenta getTipoPuntoVenta() { + return tipoPuntoVenta; + } + + public void setTipoPuntoVenta(TipoPuntoVenta tipoPuntoVenta) { + this.tipoPuntoVenta = tipoPuntoVenta; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final CategoriaTipoPtoVta other = (CategoriaTipoPtoVta) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.categoria != other.categoria && (this.categoria == null || !this.categoria.equals(other.categoria))) { + return false; + } + if (this.tipoPuntoVenta != other.tipoPuntoVenta && (this.tipoPuntoVenta == null || !this.tipoPuntoVenta.equals(other.tipoPuntoVenta))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 61 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 61 * hash + (this.categoria != null ? this.categoria.hashCode() : 0); + hash = 61 * hash + (this.tipoPuntoVenta != null ? this.tipoPuntoVenta.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CategoriaTipoptovta[categoriatipoptovtaId=" + categoriatipoptovtaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Ciudad.java b/src/com/rjconsultores/ventaboletos/entidad/Ciudad.java new file mode 100644 index 000000000..4d86f8005 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Ciudad.java @@ -0,0 +1,204 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "CIUDAD_SEQ", sequenceName = "CIUDAD_SEQ", allocationSize = 1) +@Table(name = "CIUDAD") +public class Ciudad implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CIUDAD_SEQ") + @Column(name = "CIUDAD_ID") + private Integer ciudadId; + @Column(name = "NOMBCIUDAD") + private String nombciudad; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "ESTADO_ID", referencedColumnName = "ESTADO_ID") + @ManyToOne + private Estado estado; + @OneToOne + @JoinColumn(name = "PLAZA_ID") + private Plaza plaza; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "INDZONAHORARIA") + private Integer zonaHoraria; + @OneToMany(mappedBy = "coloniaId") + private List lsColonia; + @Column(name = "CODMUNICIPIO") + private Integer codmunicipio; + @Column(name = "CODIBGE") + private Integer codibge; + + public Ciudad() { + } + + public Ciudad(Integer ciudadId) { + this.ciudadId = ciudadId; + } + + public Integer getCiudadId() { + return ciudadId; + } + + public void setCiudadId(Integer ciudadId) { + this.ciudadId = ciudadId; + } + + public String getNombciudad() { + return nombciudad; + } + + public void setNombciudad(String nombciudad) { + this.nombciudad = nombciudad; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + public Plaza getPlaza() { + return plaza; + } + + public void setPlaza(Plaza plaza) { + this.plaza = plaza; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Integer getZonaHoraria() { + return zonaHoraria; + } + + public void setZonaHoraria(Integer zonaHoraria) { + this.zonaHoraria = zonaHoraria; + } + + public Integer getCodmunicipio() { + return codmunicipio; + } + + public void setCodmunicipio(Integer codmunicipio) { + this.codmunicipio = codmunicipio; + } + @Override + public int hashCode() { + int hash = 0; + hash += (ciudadId != null ? ciudadId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Ciudad)) { + return false; + } + Ciudad other = (Ciudad) object; + if ((this.getCiudadId() == null && other.getCiudadId() != null) || (this.getCiudadId() != null && !this.getCiudadId().equals(other.getCiudadId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getNombciudad() + ", " + this.getEstado().getNombestado(); + } + + /** + * @return the lsColonia + */ + public List getLsColonia() { + return lsColonia; + } + + /** + * @param lsColonia the lsColonia to set + */ + public void setLsColonia(List lsColonia) { + this.lsColonia = lsColonia; + } + + public Integer getCodibge() { + return codibge; + } + + public void setCodibge(Integer codibge) { + this.codibge = codibge; + } + + public String getUF(){ + return estado != null ? estado.getCveestado() : ""; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java b/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java new file mode 100644 index 000000000..3e7e8aa86 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java @@ -0,0 +1,274 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.annotations.GenericGenerator; + +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CLASE_SERVICIO_SEQ", sequenceName = "CLASE_SERVICIO_SEQ", allocationSize = 1) +@Table(name = "CLASE_SERVICIO") +public class ClaseServicio implements Serializable, Auditavel { + + public final static short TODOS = -1; + + private static final long serialVersionUID = 1L; + + @Id + @GenericGenerator(name = "claseservicioIdgen", strategy = "com.rjconsultores.ventaboletos.dao.util.ClaseServicioGenerator") + @GeneratedValue(generator = "claseservicioIdgen") + @Column(name = "CLASESERVICIO_ID") + private Integer claseservicioId; + + @Column(name = "DESCCLASE") + private String descclase; + @Column(name = "TIPOSERVICOBPE") + private Integer tipoServicoBPe; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "claseServicio") + private List categoriaClaseList; + @OneToMany(mappedBy = "claseServicio") + private List reservacionClaseList; + @OneToMany(mappedBy = "claseServicio") + private List tramoTiempoList; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "EQUIVALENCIAELEKTRA_ID") + private String equivalenciaElektraId; + @OneToMany(mappedBy = "claseServicio") + private List tarifaHistList; + @OneToMany(mappedBy = "claseServicio") + private List corridaList; + @Column(name = "COEFICIENTETARIFA") + private BigDecimal coeficiente; + + @Column(name = "INDNAOVENDESEGUROOPCIONAL") + private Boolean indNaoVendeSeguroOpcional; + + @Transient + @NaoAuditar + private ClaseServicio claseServicioClone; + + public ClaseServicio() { + } + + public ClaseServicio(Integer claseservicioId) { + this.claseservicioId = claseservicioId; + } + + public ClaseServicio(Integer claseservicioId, Date fecmodif) { + this.claseservicioId = claseservicioId; + this.fecmodif = fecmodif; + } + + public Integer getClaseservicioId() { + return claseservicioId; + } + + public void setClaseservicioId(Integer claseservicioId) { + this.claseservicioId = claseservicioId; + } + + public String getDescclase() { + return descclase; + } + + public void setDescclase(String descclase) { + this.descclase = descclase; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getCategoriaClaseList() { + List tmp = new ArrayList(); + if (categoriaClaseList != null) { + for (CategoriaClase cc : this.categoriaClaseList) { + if (cc.getActivo()) { + tmp.add(cc); + } + } + } + + return tmp; + } + + public void setCategoriaClaseList(List categoriaClaseList) { + this.categoriaClaseList = categoriaClaseList; + } + + public List getReservacionClaseList() { + List tmp = new ArrayList(); + for (ReservacionClase rc : this.reservacionClaseList) { + if (rc.getActivo()) { + tmp.add(rc); + } + } + + return tmp; + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + public void setReservacionClaseList(List reservacionClaseList) { + this.reservacionClaseList = reservacionClaseList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getClaseservicioId() != null ? getClaseservicioId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ClaseServicio)) { + return false; + } + ClaseServicio other = (ClaseServicio) object; + if ((this.getClaseservicioId() == null && other.getClaseservicioId() != null) || (this.getClaseservicioId() != null && !this.getClaseservicioId().equals(other.getClaseservicioId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDescclase(); + } + + public List getTramoTiempoList() { + return tramoTiempoList; + } + + public void setTramoTiempoList(List tramoTiempoList) { + this.tramoTiempoList = tramoTiempoList; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public List getTarifaHistList() { + return tarifaHistList; + } + + public void setTarifaHistList(List tarifaHistList) { + this.tarifaHistList = tarifaHistList; + } + + public String getEquivalenciaElektraId() { + return equivalenciaElektraId; + } + + public void setEquivalenciaElektraId(String equivalenciaElektraId) { + this.equivalenciaElektraId = equivalenciaElektraId; + } + + public Integer getTipoServicoBPe() { + return tipoServicoBPe; + } + + public void setTipoServicoBPe(Integer tipoServicoBPe) { + this.tipoServicoBPe = tipoServicoBPe; + } + + public BigDecimal getCoeficiente() { + return coeficiente; + } + + public void setCoeficiente(BigDecimal coeficiente) { + this.coeficiente = coeficiente; + } + + @Override + public void clonar() throws CloneNotSupportedException { + claseServicioClone = new ClaseServicio(); + claseServicioClone = (ClaseServicio) this.clone(); + } + + @Override + public ClaseServicio getCloneObject() throws CloneNotSupportedException { + return claseServicioClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ClaseServicioID [%s]", getClaseservicioId()); + } + + public Boolean getIndNaoVendeSeguroOpcional() { + return indNaoVendeSeguroOpcional != null ? indNaoVendeSeguroOpcional : false; + } + + public void setIndNaoVendeSeguroOpcional(Boolean indNaoVendeSeguroOpcional) { + this.indNaoVendeSeguroOpcional = indNaoVendeSeguroOpcional; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/ClaseservicioEquivalencia.java b/src/com/rjconsultores/ventaboletos/entidad/ClaseservicioEquivalencia.java new file mode 100644 index 000000000..67c195690 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ClaseservicioEquivalencia.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CLASESERVICIO_EQUIVALENCIA_SEQ", sequenceName = "CLASESERVICIO_EQUIVALENCIA_SEQ", allocationSize = 1) +@Table(name = "CLASESERVICIO_EQUIVALENCIA") +public class ClaseservicioEquivalencia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLASESERVICIO_EQUIVALENCIA_SEQ") + @Column(name = "CLASESERVICIOEQUIVALENCIA_ID") + private Integer claseservicioequivalenciaId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + private ClaseServicio claseservicio; + @OneToOne + @JoinColumn(name = "COMISIONISTAEXTERNO_ID") + private ComisionistaExterno comisionistaExterno; + + public ClaseservicioEquivalencia() { + } + + public ClaseservicioEquivalencia(Integer claseservicioequivalenciaId) { + this.claseservicioequivalenciaId = claseservicioequivalenciaId; + } + + public Integer getClaseservicioequivalenciaId() { + return claseservicioequivalenciaId; + } + + public void setClaseservicioequivalenciaId(Integer claseservicioequivalenciaId) { + this.claseservicioequivalenciaId = claseservicioequivalenciaId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ComisionistaExterno getComisionistaExterno() { + return comisionistaExterno; + } + + public void setComisionistaExterno(ComisionistaExterno comisionistaExterno) { + this.comisionistaExterno = comisionistaExterno; + } + + public ClaseServicio getClaseservicio() { + return claseservicio; + } + + public void setClaseservicio(ClaseServicio claseservicio) { + this.claseservicio = claseservicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (claseservicioequivalenciaId != null ? claseservicioequivalenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ClaseservicioEquivalencia)) { + return false; + } + ClaseservicioEquivalencia other = (ClaseservicioEquivalencia) object; + if ((this.claseservicioequivalenciaId == null && other.claseservicioequivalenciaId != null) || (this.claseservicioequivalenciaId != null && !this.claseservicioequivalenciaId.equals(other.claseservicioequivalenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ClaseservicioEquivalencia[ claseservicioequivalenciaId=" + claseservicioequivalenciaId + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Clasificacion.java b/src/com/rjconsultores/ventaboletos/entidad/Clasificacion.java new file mode 100644 index 000000000..23e51d641 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Clasificacion.java @@ -0,0 +1,149 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CLASIFICACION_SEQ", sequenceName = "CLASIFICACION_SEQ", allocationSize = 1) +@Table(name = "CLASIFICACION") +public class Clasificacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLASIFICACION_SEQ") + @Column(name = "CLASIFICACION_ID") + private Integer clasificacionId; + @Column(name = "DESCCLASIFICACION") + private String descclasificacion; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "ARTICULO_ID", referencedColumnName = "ARTICULO_ID") + @OneToOne + private Articulo articulo; + @OneToMany(mappedBy = "clasificacion", cascade = CascadeType.ALL) + private List abastoBoletoList; + @OneToMany(mappedBy = "clasificacion", cascade = CascadeType.ALL) + private List requisicionBoletoList; + + public Integer getClasificacionId() { + return clasificacionId; + } + + public void setClasificacionId(Integer clasificacionId) { + this.clasificacionId = clasificacionId; + } + + public String getDescclasificacion() { + return descclasificacion; + } + + public void setDescclasificacion(String descclasificacion) { + this.descclasificacion = descclasificacion; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Articulo getArticulo() { + return articulo; + } + + public void setArticulo(Articulo articulo) { + this.articulo = articulo; + } + + public List getAbastoBoletoList() { + return abastoBoletoList; + } + + public void setAbastoBoletoList(List abastoBoletoList) { + this.abastoBoletoList = abastoBoletoList; + } + + public List getRequisicionBoletoList() { + return requisicionBoletoList; + } + + public void setRequisicionBoletoList(List requisicionBoletoList) { + this.requisicionBoletoList = requisicionBoletoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (clasificacionId != null ? clasificacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Pricing)) { + return false; + } + Clasificacion other = (Clasificacion) object; + if ((this.clasificacionId == null && other.clasificacionId != null) || (this.clasificacionId != null && !this.clasificacionId.equals(other.clasificacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Clasificacion[clasificacionId=" + clasificacionId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ClasseIndicePeaje.java b/src/com/rjconsultores/ventaboletos/entidad/ClasseIndicePeaje.java new file mode 100644 index 000000000..0778c7d0c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ClasseIndicePeaje.java @@ -0,0 +1,94 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +import org.apache.commons.lang.builder.EqualsBuilder; + +@Entity +@SequenceGenerator(name = "CLASSE_INDICE_PEAJE_SEQ", sequenceName = "CLASSE_INDICE_PEAJE_SEQ", initialValue = 1) +@Table(name = "CLASSE_INDICE_PEAJE") +public class ClasseIndicePeaje implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "CLASSE_INDICE_PEAJE_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLASSE_INDICE_PEAJE_SEQ") + private Long id; + + @Column + private Boolean activo; + + @OneToOne + @JoinColumn(name = "CLASSE_SERVICIO_ID") + private ClaseServicio classeServicio; + + @ManyToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + + @Column(name = "INDICE_PEAJE") + private BigDecimal indicePeaje; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public ClaseServicio getClasseServicio() { + return classeServicio; + } + + public void setClasseServicio(ClaseServicio classeServicio) { + this.classeServicio = classeServicio; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public BigDecimal getIndicePeaje() { + return indicePeaje; + } + + public void setIndicePeaje(BigDecimal indicePeaje) { + this.indicePeaje = indicePeaje; + } + + @Override + public boolean equals(Object obj) { + return new EqualsBuilder().append(this.id, ((ClasseIndicePeaje) obj).getId()).isEquals(); + } + + @Override + public String toString() { + return classeServicio.getDescclase() + " " + indicePeaje.toString(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Cliente.java b/src/com/rjconsultores/ventaboletos/entidad/Cliente.java new file mode 100644 index 000000000..5f72d4d6e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Cliente.java @@ -0,0 +1,556 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.Where; + +/** + * + * @author RJ + */ +@Entity +@SequenceGenerator(name = "CLIENTE_SEQ", sequenceName = "CLIENTE_SEQ", allocationSize = 1) +@Table(name = "CLIENTE") +public class Cliente implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLIENTE_SEQ") + @Column(name = "CLIENTE_ID") + private Integer clienteId; + @Column(name = "NOMBCLIENTE") + private String nombcliente; + @Column(name = "APELLIDOPATERNO") + private String apellidopaterno; + @Column(name = "APELLIDOMATERNO") + private String apellidomaterno; + @Column(name = "FECNACIMIENTO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecnacimiento; + @Column(name = "NUMRFC") + private String numrfc; + @Column(name = "NUMTELEFONO") + private String numtelefono; + @Column(name = "NUMTELEFONODOS") + private String numtelefonodos; + @Column(name = "NUMFAX") + private String numfax; + @Column(name = "NUMEXTENSION") + private String numextension; + @Column(name = "NUMEXTENSIONDOS") + private String numextensiondos; + @JoinColumn(name = "TIPOOCUPACION_ID") + @OneToOne(cascade = CascadeType.ALL) + private TipoOcupacion tipoocupacionId; + @Column(name = "MEDIOINFORMATIVO_ID") + private Integer medioinformativoId; + @JoinColumn(name = "MOTIVOVIAJE_ID") + @OneToOne(cascade = CascadeType.ALL) + private MotivoViaje motivoviajeId; + @Column(name = "INDSEXO") + private String indsexo; + @Column(name = "NUMCURP") + private String numcurp; + @Column(name = "CANTHIJOS") + private Integer canthijos; + @Column(name = "DESCCORREO") + private String desccorreo; + @Column(name = "EDAD") + private Integer edad; + @Column(name = "ESTADOCIVIL_ID") + private Integer estadocivilId; + @Column(name = "GRADOESTUDIO_ID") + private Integer gradoestudioId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "DESCCONTRASENA") + private String desccontrasena; + @Column(name = "NUMLADA") + private String numlada; + @Column(name = "INDCAMBIOCONTRASENA") + private Integer indcambiocontrasena; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "clienteId") + private List lsClienteDireccion; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + @Where(clause = "activo=1") + private List listClienteFidelidad; + @Column(name = "NUMIDENTIFICAUNO") + private String numIdentificaUno; + @Column(name = "NUMIDENTIFICADOS") + private String numIdentificaDos; + @Column(name = "INDBLOQUEO") + private Boolean indBloqueo; + @JoinColumn(name = "TIPOIDENTIFICAUNO_ID") + @OneToOne + private TipoIdentificacion tipoIdentificacionUno; + @JoinColumn(name = "TIPOIDENTIFICADOS_ID") + @OneToOne + private TipoIdentificacion tipoIdentificacionDos; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + private List lsClienteDescuento; + + @ManyToMany + @JoinTable(name = "CLIENTE_CURSO", joinColumns = { @JoinColumn(name = "CLIENTE_ID") }, inverseJoinColumns = { @JoinColumn(name = "CURSO_ID") }) + private List cursoList; + + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "ESCOLA_ID", referencedColumnName = "ESCOLA_ID") + private Escola escola; + + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + private Empresa empresaCadastro; + + @Column(name = "FECCADASTRO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecCadastro; + + @Column(name = "INDCLIENTEPCD") + private Boolean indClientePcd; + + @Column(name = "FECBLOQUEIOPCD") + @Temporal(TemporalType.DATE) + private Date fecbloqueiopcd; + + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + @Where(clause = "activo=1") + private List listReservaEspecialCliente; + + public List getListReservaEspecialCliente() { + return listReservaEspecialCliente; + } + + public void setListReservaEspecialCliente(List listReservaEspecialCliente) { + this.listReservaEspecialCliente = listReservaEspecialCliente; + } + + public Cliente() { + } + + public Cliente(Integer clienteId) { + this.clienteId = clienteId; + } + + public Integer getClienteId() { + return clienteId; + } + + public void setClienteId(Integer clienteId) { + this.clienteId = clienteId; + } + + public String getNombcliente() { + return nombcliente; + } + + public void setNombcliente(String nombcliente) { + this.nombcliente = nombcliente; + } + + public String getApellidopaterno() { + return apellidopaterno; + } + + public void setApellidopaterno(String apellidopaterno) { + this.apellidopaterno = apellidopaterno; + } + + public String getApellidomaterno() { + return apellidomaterno; + } + + public void setApellidomaterno(String apellidomaterno) { + this.apellidomaterno = apellidomaterno; + } + + public Date getFecnacimiento() { + return fecnacimiento; + } + + public void setFecnacimiento(Date fecnacimiento) { + this.fecnacimiento = fecnacimiento; + } + + public String getNumrfc() { + return numrfc; + } + + public void setNumrfc(String numrfc) { + this.numrfc = numrfc; + } + + public String getNumtelefono() { + return numtelefono; + } + + public void setNumtelefono(String numtelefono) { + this.numtelefono = numtelefono; + } + + public String getNumtelefonodos() { + return numtelefonodos; + } + + public void setNumtelefonodos(String numtelefonodos) { + this.numtelefonodos = numtelefonodos; + } + + public String getNumfax() { + return numfax; + } + + public void setNumfax(String numfax) { + this.numfax = numfax; + } + + public String getNumextension() { + return numextension; + } + + public void setNumextension(String numextension) { + this.numextension = numextension; + } + + public String getNumextensiondos() { + return numextensiondos; + } + + public void setNumextensiondos(String numextensiondos) { + this.numextensiondos = numextensiondos; + } + + public TipoOcupacion getTipoocupacionId() { + return tipoocupacionId; + } + + public void setTipoocupacionId(TipoOcupacion tipoocupacionId) { + this.tipoocupacionId = tipoocupacionId; + } + + public Integer getMedioinformativoId() { + return medioinformativoId; + } + + public void setMedioinformativoId(Integer medioinformativoId) { + this.medioinformativoId = medioinformativoId; + } + + public MotivoViaje getMotivoviajeId() { + return motivoviajeId; + } + + public void setMotivoviajeId(MotivoViaje motivoviajeId) { + this.motivoviajeId = motivoviajeId; + } + + public String getIndsexo() { + return indsexo; + } + + public void setIndsexo(String indsexo) { + this.indsexo = indsexo; + } + + public String getNumcurp() { + return numcurp; + } + + public void setNumcurp(String numcurp) { + this.numcurp = numcurp; + } + + public Integer getCanthijos() { + return canthijos; + } + + public void setCanthijos(Integer canthijos) { + this.canthijos = canthijos; + } + + public String getDesccorreo() { + return desccorreo; + } + + public void setDesccorreo(String desccorreo) { + this.desccorreo = desccorreo; + } + + public Integer getEdad() { + return edad; + } + + public void setEdad(Integer edad) { + this.edad = edad; + } + + public Integer getEstadocivilId() { + return estadocivilId; + } + + public void setEstadocivilId(Integer estadocivilId) { + this.estadocivilId = estadocivilId; + } + + public Integer getGradoestudioId() { + return gradoestudioId; + } + + public void setGradoestudioId(Integer gradoestudioId) { + this.gradoestudioId = gradoestudioId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getDesccontrasena() { + return desccontrasena; + } + + public void setDesccontrasena(String desccontrasena) { + this.desccontrasena = desccontrasena; + } + + public String getNumlada() { + return numlada; + } + + public void setNumlada(String numlada) { + this.numlada = numlada; + } + + public Integer getIndcambiocontrasena() { + return indcambiocontrasena; + } + + public void setIndcambiocontrasena(Integer indcambiocontrasena) { + this.indcambiocontrasena = indcambiocontrasena; + } + + public List getLsClienteDireccion() { + return lsClienteDireccion; + } + + public void setLsClienteDireccion(List lsClienteDireccion) { + this.lsClienteDireccion = lsClienteDireccion; + } + + public List getListClienteFidelidad() { + return listClienteFidelidad; + } + + public void setListClienteFidelidad(List listClienteFidelidad) { + this.listClienteFidelidad = listClienteFidelidad; + } + + public String getNumIdentificaUno() { + return numIdentificaUno; + } + + public void setNumIdentificaUno(String numIdentificaUno) { + this.numIdentificaUno = numIdentificaUno; + } + + public String getNumIdentificaDos() { + return numIdentificaDos; + } + + public void setNumIdentificaDos(String numIdentificaDos) { + this.numIdentificaDos = numIdentificaDos; + } + + public Boolean getIndBloqueo() { + return indBloqueo; + } + + public void setIndBloqueo(Boolean indBloqueo) { + this.indBloqueo = indBloqueo; + } + + public TipoIdentificacion getTipoIdentificacionUno() { + return tipoIdentificacionUno; + } + + public void setTipoIdentificacionUno(TipoIdentificacion tipoIdentificacionUno) { + this.tipoIdentificacionUno = tipoIdentificacionUno; + } + + public TipoIdentificacion getTipoIdentificacionDos() { + return tipoIdentificacionDos; + } + + public void setTipoIdentificacionDos(TipoIdentificacion tipoIdentificacionDos) { + this.tipoIdentificacionDos = tipoIdentificacionDos; + } + + public List getLsClienteDescuento() { + return lsClienteDescuento; + } + + public void setLsClienteDescuento(List lsClienteDescuento) { + this.lsClienteDescuento = lsClienteDescuento; + } + + public List getCursoList() { + + List aux = new ArrayList(); + if (cursoList == null) { + return aux; + } + + for (Curso curso : cursoList) { + if (curso.getActivo()) { + aux.add(curso); + } + } + + return aux; + } + + public void setCursoList(List cursoList) { + this.cursoList = cursoList; + } + + public Escola getEscola() { + return escola; + } + + public void setEscola(Escola escola) { + this.escola = escola; + } + + public Empresa getEmpresaCadastro() { + return empresaCadastro; + } + + public void setEmpresaCadastro(Empresa empresaCadastro) { + this.empresaCadastro = empresaCadastro; + } + + public Date getFecCadastro() { + return fecCadastro; + } + + public void setFecCadastro(Date fecCadastro) { + this.fecCadastro = fecCadastro; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (clienteId != null ? clienteId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Cliente)) { + return false; + } + Cliente other = (Cliente) object; + if ((this.clienteId == null && other.clienteId != null) || (this.clienteId != null && !this.clienteId.equals(other.clienteId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Cliente[ clienteId=" + clienteId + " ]"; + } + + //Removida a annotação Trasient pois getListClienteFidelidad() é um persistionbag + public List getListClienteFidelidadActivos() { + List lsActivos = new ArrayList(); + + if (getListClienteFidelidad() != null) + for (ClienteFidelidad clienteFidelidad : getListClienteFidelidad()) { + if (clienteFidelidad.getActivo() && clienteFidelidad.getTarjetaFidelidad().getActivo()) { + lsActivos.add(clienteFidelidad); + } + } + + return lsActivos; + } + + public Boolean getIndClientePcd() { + return indClientePcd; + } + + public void setIndClientePcd(Boolean indClientePcd) { + this.indClientePcd = indClientePcd; + } + + public Date getFecbloqueiopcd() { + return fecbloqueiopcd; + } + + public void setFecbloqueiopcd(Date fecbloqueiopcd) { + this.fecbloqueiopcd = fecbloqueiopcd; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ClienteCurso.java b/src/com/rjconsultores/ventaboletos/entidad/ClienteCurso.java new file mode 100644 index 000000000..876f9f7d8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ClienteCurso.java @@ -0,0 +1,93 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CLIENTE_CURSO_SEQ", sequenceName = "CLIENTE_CURSO_SEQ", allocationSize = 1) +@Table(name = "CLIENTE_CURSO") +public class ClienteCurso implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLIENTE_CURSO_SEQ") + @Column(name = "CLIENTECURSO_ID") + private Integer clientecursoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @JoinColumn(name = "CURSO_ID", referencedColumnName = "CURSO_ID") + @ManyToOne + private Curso curso; + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + @ManyToOne + private Cliente cliente; + + public Integer getClientecursoId() { + return clientecursoId; + } + + public void setClientecursoId(Integer clientecursoId) { + this.clientecursoId = clientecursoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Curso getCurso() { + return curso; + } + + public void setCurso(Curso curso) { + this.curso = curso; + } + + public Cliente getCliente() { + return cliente; + } + + public void setCliente(Cliente cliente) { + this.cliente = cliente; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ClienteDescuento.java b/src/com/rjconsultores/ventaboletos/entidad/ClienteDescuento.java new file mode 100644 index 000000000..b4b3c1018 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ClienteDescuento.java @@ -0,0 +1,241 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CLIENTE_DESCUENTO_SEQ", sequenceName = "CLIENTE_DESCUENTO_SEQ", allocationSize = 1) +@Table(name = "CLIENTE_DESCUENTO") +public class ClienteDescuento implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLIENTE_DESCUENTO_SEQ") + @Column(name = "CLIENTEDESCUENTO_ID") + private Integer clienteDescuentoId; + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + @ManyToOne + private Cliente cliente; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @Column(name = "CANTMAXMES") + private Integer cantMaxMes; + @Column(name = "INDVENDER1PORCORRIDA") + private Boolean INDVENDER1PORCORRIDA; + @Column(name = "INDLUNES") + private Boolean INDLUNES; + @Column(name = "INDMARTES") + private Boolean INDMARTES; + @Column(name = "INDMIERCOLES") + private Boolean INDMIERCOLES; + @Column(name = "INDJUEVES") + private Boolean INDJUEVES; + @Column(name = "INDVIERNES") + private Boolean INDVIERNES; + @Column(name = "INDSABADO") + private Boolean INDSABADO; + @Column(name = "INDDOMINGO") + private Boolean INDDOMINGO; + @Column(name = "INDFORMAVALIDACIONESTUDIANTE") + private String indFormaValidacionEstudiante; + @Column(name = "FECINI") + @Temporal(TemporalType.DATE) + private Date fecIni; + @Column(name = "FECFIN") + @Temporal(TemporalType.DATE) + private Date FecFin; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getClienteDescuentoId() { + return clienteDescuentoId; + } + + public void setClienteDescuentoId(Integer clienteDescuentoId) { + this.clienteDescuentoId = clienteDescuentoId; + } + + public Cliente getCliente() { + return cliente; + } + + public void setCliente(Cliente cliente) { + this.cliente = cliente; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Integer getCantMaxMes() { + return cantMaxMes; + } + + public void setCantMaxMes(Integer cantMaxMes) { + this.cantMaxMes = cantMaxMes; + } + + public Boolean getINDVENDER1PORCORRIDA() { + return INDVENDER1PORCORRIDA; + } + + public void setINDVENDER1PORCORRIDA(Boolean iNDVENDER1PORCORRIDA) { + INDVENDER1PORCORRIDA = iNDVENDER1PORCORRIDA; + } + + public Boolean getINDLUNES() { + return INDLUNES; + } + + public void setINDLUNES(Boolean iNDLUNES) { + INDLUNES = iNDLUNES; + } + + public Boolean getINDMARTES() { + return INDMARTES; + } + + public void setINDMARTES(Boolean iNDMARTES) { + INDMARTES = iNDMARTES; + } + + public Boolean getINDMIERCOLES() { + return INDMIERCOLES; + } + + public void setINDMIERCOLES(Boolean iNDMIERCOLES) { + INDMIERCOLES = iNDMIERCOLES; + } + + public Boolean getINDJUEVES() { + return INDJUEVES; + } + + public void setINDJUEVES(Boolean iNDJUEVES) { + INDJUEVES = iNDJUEVES; + } + + public Boolean getINDVIERNES() { + return INDVIERNES; + } + + public void setINDVIERNES(Boolean iNDVIERNES) { + INDVIERNES = iNDVIERNES; + } + + public Boolean getINDSABADO() { + return INDSABADO; + } + + public void setINDSABADO(Boolean iNDSABADO) { + INDSABADO = iNDSABADO; + } + + public Boolean getINDDOMINGO() { + return INDDOMINGO; + } + + public void setINDDOMINGO(Boolean iNDDOMINGO) { + INDDOMINGO = iNDDOMINGO; + } + + public Date getFecIni() { + return fecIni; + } + + public void setFecIni(Date fecIni) { + this.fecIni = fecIni; + } + + public Date getFecFin() { + return FecFin; + } + + public void setFecFin(Date fecFin) { + FecFin = fecFin; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getIndFormaValidacionEstudiante() { + return indFormaValidacionEstudiante; + } + + public void setIndFormaValidacionEstudiante(String indFormaValidacionEstudiante) { + this.indFormaValidacionEstudiante = indFormaValidacionEstudiante; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ClienteDescuento[ clienteDescuentoId=" + clienteDescuentoId + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ClienteDireccion.java b/src/com/rjconsultores/ventaboletos/entidad/ClienteDireccion.java new file mode 100644 index 000000000..e5f6fc178 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ClienteDireccion.java @@ -0,0 +1,294 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * + * @author RJ + */ +@Entity + +@SequenceGenerator(name = "CLIENTE_DIRECCION_SEQ", sequenceName = "CLIENTE_DIRECCION_SEQ", allocationSize = 1) +@Table(name = "CLIENTE_DIRECCION") + +public class ClienteDireccion implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLIENTE_DIRECCION_SEQ") + @Column(name = "CLIENTEDIRECCION_ID") + private Integer clientedireccionId; + + @Column(name = "DESCCALLE") + private String desccalle; + + @Column(name = "DESCCALLECOMP") + private String desccallecomp; + + @Column(name = "DESCDELEGACION") + private String descdelegacion; + + @JoinColumn(name = "TIPODOMICILIO_ID") + @OneToOne(cascade=CascadeType.ALL) + private TipoDomicilio tipodomicilioId; + + @Column(name = "DESCPLANO") + private String descplano; + + @Column(name = "DESCCOORDENADA") + private String desccoordenada; + + @Column(name = "FECHORINICIOENTREGA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorinicioentrega; + + @Column(name = "FECHORFINENTREGA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorfinentrega; + + @Column(name = "COLONIA_ID") + private Integer coloniaId; + + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "NUMINTERIOR") + private String numinterior; + @Column(name = "NUMEXTERIOR") + private String numexterior; + @Column(name = "DESCCOLONIA") + private String desccolonia; + @Column(name = "CODPOSTAL") + private String codpostal; + @Column(name = "DESCIUDAD") + private String desciudad; + @Column(name = "DESESTADO") + private String desestado; + + + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + @ManyToOne + private Cliente clienteId; + + + public ClienteDireccion() { + + } + + public ClienteDireccion(Integer clientedireccionId) { + this.clientedireccionId = clientedireccionId; + } + + public Integer getClientedireccionId() { + return clientedireccionId; + } + + public void setClientedireccionId(Integer clientedireccionId) { + this.clientedireccionId = clientedireccionId; + } + + + public Cliente getClienteId() { + return clienteId; + } + + public void setClienteId(Cliente clienteId) { + this.clienteId = clienteId; + } + + public String getDesccalle() { + return desccalle; + } + + public void setDesccalle(String desccalle) { + this.desccalle = desccalle; + } + + public String getDesccallecomp() { + return desccallecomp; + } + + public void setDesccallecomp(String desccallecomp) { + this.desccallecomp = desccallecomp; + } + + public String getDescdelegacion() { + return descdelegacion; + } + + public void setDescdelegacion(String descdelegacion) { + this.descdelegacion = descdelegacion; + } + + public TipoDomicilio getTipodomicilioId() { + return tipodomicilioId; + } + + public void setTipodomicilioId(TipoDomicilio tipodomicilioId) { + this.tipodomicilioId = tipodomicilioId; + } + + public String getDescplano() { + return descplano; + } + + public void setDescplano(String descplano) { + this.descplano = descplano; + } + + public String getDesccoordenada() { + return desccoordenada; + } + + public void setDesccoordenada(String desccoordenada) { + this.desccoordenada = desccoordenada; + } + + public Date getFechorinicioentrega() { + return fechorinicioentrega; + } + + public void setFechorinicioentrega(Date fechorinicioentrega) { + this.fechorinicioentrega = fechorinicioentrega; + } + + public Date getFechorfinentrega() { + return fechorfinentrega; + } + + public void setFechorfinentrega(Date fechorfinentrega) { + this.fechorfinentrega = fechorfinentrega; + } + + public Integer getColoniaId() { + return coloniaId; + } + + public void setColoniaId(Integer coloniaId) { + this.coloniaId = coloniaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getNuminterior() { + return numinterior; + } + + public void setNuminterior(String numinterior) { + this.numinterior = numinterior; + } + + public String getNumexterior() { + return numexterior; + } + + public void setNumexterior(String numexterior) { + this.numexterior = numexterior; + } + + public String getDesccolonia() { + return desccolonia; + } + + public void setDesccolonia(String desccolonia) { + this.desccolonia = desccolonia; + } + + public String getCodpostal() { + return codpostal; + } + + public void setCodpostal(String codpostal) { + this.codpostal = codpostal; + } + + public String getDesciudad() { + return desciudad; + } + + public void setDesciudad(String desciudad) { + this.desciudad = desciudad; + } + + public String getDesestado() { + return desestado; + } + + public void setDesestado(String desestado) { + this.desestado = desestado; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (clientedireccionId != null ? clientedireccionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ClienteDireccion)) { + return false; + } + ClienteDireccion other = (ClienteDireccion) object; + if ((this.clientedireccionId == null && other.clientedireccionId != null) || (this.clientedireccionId != null && !this.clientedireccionId.equals(other.clientedireccionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ClienteDireccion[ clientedireccionId=" + clientedireccionId + " ]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ClienteFidelidad.java b/src/com/rjconsultores/ventaboletos/entidad/ClienteFidelidad.java new file mode 100644 index 000000000..7ccc50b51 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ClienteFidelidad.java @@ -0,0 +1,129 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CLIENTE_FIDELIDAD_SEQ", sequenceName = "CLIENTE_FIDELIDAD_SEQ", allocationSize = 1) +@Table(name = "CLIENTE_FIDELIDAD") +public class ClienteFidelidad implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CLIENTE_FIDELIDAD_SEQ") + @Column(name = "CLIENTEFIDELIDAD_ID") + private Integer clienteFidelidadId; + @OneToOne + @JoinColumn(name = "CLIENTE_ID") + private Cliente cliente; + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "TARJETAFIDELIDAD_ID") + private TarjetaFidelidad tarjetaFidelidad; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getClienteFidelidadId() { + return clienteFidelidadId; + } + + public void setClienteFidelidadId(Integer clienteFidelidadId) { + this.clienteFidelidadId = clienteFidelidadId; + } + + public TarjetaFidelidad getTarjetaFidelidad() { + return tarjetaFidelidad; + } + + public void setTarjetaFidelidad(TarjetaFidelidad tarjetaFidelidad) { + this.tarjetaFidelidad = tarjetaFidelidad; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Cliente getCliente() { + return cliente; + } + + public void setCliente(Cliente cliente) { + this.cliente = cliente; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((clienteFidelidadId == null) ? 0 : clienteFidelidadId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ClienteFidelidad other = (ClienteFidelidad) obj; + if (clienteFidelidadId == null) { + if (other.clienteFidelidadId != null) + return false; + } else if (!clienteFidelidadId.equals(other.clienteFidelidadId)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ClientePacote.java b/src/com/rjconsultores/ventaboletos/entidad/ClientePacote.java new file mode 100644 index 000000000..fb9f112cc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ClientePacote.java @@ -0,0 +1,189 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +import com.rjconsultores.ventaboletos.enums.TipoPessoa; + +@Entity +@SequenceGenerator(name = "CLIENTE_PACOTE_SEQ", sequenceName = "CLIENTE_PACOTE_SEQ", allocationSize = 1) +@Table(name = "CLIENTE_PACOTE") +public class ClientePacote implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "CLIENTEPACOTE_ID") + private Long clientepacoteId; + + @Column(name = "RAZAO_SOCIAL") + private String razaoSocial; + + @Column(name = "CPF_CNPJ") + private String cpfCnpj; + + @Column(name = "TIPO_PESSOA") + @Enumerated(EnumType.ORDINAL) + private TipoPessoa tipoPessoa; + + @Column(name = "DESCEMAIL") + private String descemail; + + @Column(name = "DESCTELEFONE") + private String desctelefone; + + @Column(name = "DESCFAX") + private String descfax; + + @Column(name = "CEP") + private String cep; + + @Column(name = "ENDERECO") + private String endereco; + + @Column(name = "NUMERO") + private String numero; + + @Column(name = "COMPLEMENTO") + private String complemento; + + @Column(name = "PAIS") + private String pais; + + @Column(name = "ESTADO") + private String estado; + + @Column(name = "CIDADE") + private String cidade; + + @Column(name = "BAIRRO") + private String bairro; + + public Long getClientepacoteId() { + return clientepacoteId; + } + + public void setClientepacoteId(Long clientepacoteId) { + this.clientepacoteId = clientepacoteId; + } + + public String getRazaoSocial() { + return razaoSocial; + } + + public void setRazaoSocial(String razaoSocial) { + this.razaoSocial = razaoSocial; + } + + public String getDescemail() { + return descemail; + } + + public void setDescemail(String descemail) { + this.descemail = descemail; + } + + public String getDesctelefone() { + return desctelefone; + } + + public void setDesctelefone(String desctelefone) { + this.desctelefone = desctelefone; + } + + public String getDescfax() { + return descfax; + } + + public void setDescfax(String descfax) { + this.descfax = descfax; + } + + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + public String getEndereco() { + return endereco; + } + + public void setEndereco(String endereco) { + this.endereco = endereco; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getPais() { + return pais; + } + + public void setPais(String pais) { + this.pais = pais; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getCidade() { + return cidade; + } + + public void setCidade(String cidade) { + this.cidade = cidade; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public String getCpfCnpj() { + return cpfCnpj; + } + + public void setCpfCnpj(String cpfCnpj) { + this.cpfCnpj = cpfCnpj; + } + + public TipoPessoa getTipoPessoa() { + return tipoPessoa; + } + + public void setTipoPessoa(TipoPessoa tipoPessoa) { + this.tipoPessoa = tipoPessoa; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java new file mode 100644 index 000000000..5a3dfffee --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java @@ -0,0 +1,319 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * @author vjcor + * + */ +@Entity +@SequenceGenerator(name = "COBRANCA_ADC_SEQ", sequenceName = "COBRANCA_ADC_SEQ", allocationSize = 1) +@Table(name = "COBRANCA_ADC_PUNTO_VENTA") +public class CobrancaAdcPuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COBRANCA_ADC_SEQ") + @Column(name = "COBRANCAADDPUNTOVENTA_ID") + private Integer cobrancaAddPuntoVenta_id; + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + + @Column(name = "DESCRICAO") + private String descricao; + + @Column(name = "VALOR") + private BigDecimal valor; + + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "DIARIO") + private Boolean diario; + + @Column(name = "SEMANAL") + private Boolean semanal; + + @Column(name = "MENSAL") + private Boolean mensal; + + @Column(name = "SEGUNDA") + private Boolean segunda; + + @Column(name = "TERCA") + private Boolean terca; + + @Column(name = "QUARTA") + private Boolean quarta; + + @Column(name = "QUINTA") + private Boolean quinta; + + @Column(name = "SEXTA") + private Boolean sexta; + + @Column(name = "PRIMEIRO_DIA_UTIL") + private Boolean primeiroDiaUtil; + + @Column(name = "ULTIMO_DIA_UTIL") + private Boolean ultimoDiaUtil; + + @Column(name = "DESCONTO_PROXIMO_CICLO") + private Boolean descontarProximoCiclo; + + @Column(name = "DESCONTO_PROXIMO_DIA") + private Boolean descontarProximoDia; + + @Column(name = "DATAINICIAL") + @Temporal(TemporalType.TIMESTAMP) + private Date dataInicial; + + @Column(name = "DATAFINAL") + @Temporal(TemporalType.TIMESTAMP) + private Date dataFinal; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + private Boolean getBoolean(Boolean valor) { + return valor == null ? false : valor; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + public Integer getCobrancaAddPuntoVenta_id() { + return cobrancaAddPuntoVenta_id; + } + + public void setCobrancaAddPuntoVenta_id(Integer cobrancaAddPuntoVenta_id) { + this.cobrancaAddPuntoVenta_id = cobrancaAddPuntoVenta_id; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getDiario() { + return getBoolean(diario); + } + + public void setDiario(Boolean diario) { + this.diario = diario; + } + + public Boolean getSemanal() { + return getBoolean(semanal); + } + + public void setSemanal(Boolean semanal) { + this.semanal = semanal; + } + + public Boolean getMensal() { + return getBoolean(mensal); + } + + public void setMensal(Boolean mensal) { + this.mensal = mensal; + } + + public Boolean getSegunda() { + return getBoolean(segunda); + } + + public void setSegunda(Boolean segunda) { + this.segunda = segunda; + } + + public Boolean getTerca() { + return getBoolean(terca); + } + + public void setTerca(Boolean terca) { + this.terca = terca; + } + + public Boolean getQuarta() { + return getBoolean(quarta); + } + + public void setQuarta(Boolean quarta) { + this.quarta = quarta; + } + + public Boolean getQuinta() { + return getBoolean(quinta); + } + + public void setQuinta(Boolean quinta) { + this.quinta = quinta; + } + + public Boolean getSexta() { + return getBoolean(sexta); + } + + public void setSexta(Boolean sexta) { + this.sexta = sexta; + } + + public Boolean getPrimeiroDiaUtil() { + return getBoolean(primeiroDiaUtil); + } + + public void setPrimeiroDiaUtil(Boolean primeiroDiaUtil) { + this.primeiroDiaUtil = primeiroDiaUtil; + } + + public Boolean getUltimoDiaUtil() { + return getBoolean(ultimoDiaUtil); + } + + public void setUltimoDiaUtil(Boolean ultimoDiaUtil) { + this.ultimoDiaUtil = ultimoDiaUtil; + } + + public Boolean getActivo() { + return getBoolean(activo); + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getDescontarProximoCiclo() { + return descontarProximoCiclo; + } + + public void setDescontarProximoCiclo(Boolean descontarProximoCiclo) { + this.descontarProximoCiclo = descontarProximoCiclo; + } + + public Boolean getDescontarProximoDia() { + return descontarProximoDia; + } + + public void setDescontarProximoDia(Boolean descontarProximoDia) { + this.descontarProximoDia = descontarProximoDia; + } + + public Date getDataInicial() { + return dataInicial; + } + + public void setDataInicial(Date dataInicial) { + this.dataInicial = dataInicial; + } + + public Date getDataFinal() { + return dataFinal; + } + + public void setDataFinal(Date dataFinal) { + this.dataFinal = dataFinal; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((cobrancaAddPuntoVenta_id == null) ? 0 : cobrancaAddPuntoVenta_id.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CobrancaAdcPuntoVenta other = (CobrancaAdcPuntoVenta) obj; + if (cobrancaAddPuntoVenta_id == null) { + if (other.cobrancaAddPuntoVenta_id != null) + return false; + } else if (!cobrancaAddPuntoVenta_id.equals(other.cobrancaAddPuntoVenta_id)) + return false; + return true; + } + + @Override + public String toString() { + return this.getDescricao(); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdicionalHistorico.java b/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdicionalHistorico.java new file mode 100644 index 000000000..a8f5e913b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdicionalHistorico.java @@ -0,0 +1,167 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * @author vjcor + * + */ +@Entity +@SequenceGenerator(name = "COBRANCA_ADC_HIST_SEQ", sequenceName = "COBRANCA_ADC_HIST_SEQ", allocationSize = 1) +@Table(name = "COBRANCA_ADICIONAL_HISTORICO") +public class CobrancaAdicionalHistorico implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COBRANCA_ADC_HIST_SEQ") + @Column(name = "COBRANCAADICIONALHISTORICO_ID") + private Long cobrancaAdicionalHistoricoID; + + @JoinColumn(name = "COBRANCAADDPUNTOVENTA_ID") + @ManyToOne + private CobrancaAdcPuntoVenta cobrancaAdicional; + + @Column(name = "CONTACORRENTEPTOVTA_ID") + private Long contaCorrentePtoVtaId; + + @Column(name = "PUNTOVENTA_ID") + private Integer puntoVentaId; + + @Column(name = "VALOR_COBRANCA") + private BigDecimal valorCobranca; + + @Column(name = "VALOR_ACUMULADO") + private BigDecimal valorAcumulado; + + @Column(name = "VALOR_APLICADO") + private BigDecimal valorAplicado; + + @Column(name = "COBRANCA_EFETUADA") + private Boolean cobrancaEfetuada; + + @Column(name = "FREQUENCIA_NA_DATA") + private String frequenciaNaData; + + @Column(name = "DATA_REGISTRO") + @Temporal(TemporalType.TIMESTAMP) + private Date dataRegistro; + + @Column(name = "MOTIVO") + private String motivo; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getCobrancaAdicionalHistoricoID() { + return cobrancaAdicionalHistoricoID; + } + + public void setCobrancaAdicionalHistoricoID(Long cobrancaAdicionalHistoricoID) { + this.cobrancaAdicionalHistoricoID = cobrancaAdicionalHistoricoID; + } + + public CobrancaAdcPuntoVenta getCobrancaAdicional() { + return cobrancaAdicional; + } + + public void setCobrancaAdicional(CobrancaAdcPuntoVenta cobrancaAdicional) { + this.cobrancaAdicional = cobrancaAdicional; + } + + public Long getContaCorrentePtoVtaId() { + return contaCorrentePtoVtaId; + } + + public void setContaCorrentePtoVtaId(Long contaCorrentePtoVtaId) { + this.contaCorrentePtoVtaId = contaCorrentePtoVtaId; + } + + public Integer getPuntoVentaId() { + return puntoVentaId; + } + + public void setPuntoVentaId(Integer puntoVentaId) { + this.puntoVentaId = puntoVentaId; + } + + public BigDecimal getValorCobranca() { + return valorCobranca; + } + + public void setValorCobranca(BigDecimal valorCobranca) { + this.valorCobranca = valorCobranca; + } + + public BigDecimal getValorAcumulado() { + return valorAcumulado; + } + + public void setValorAcumulado(BigDecimal valorAcumulado) { + this.valorAcumulado = valorAcumulado; + } + + public BigDecimal getValorAplicado() { + return valorAplicado; + } + + public void setValorAplicado(BigDecimal valorAplicado) { + this.valorAplicado = valorAplicado; + } + + public Boolean getCobrancaEfetuada() { + return cobrancaEfetuada == null ? false : cobrancaEfetuada; + } + + public void setCobrancaEfetuada(Boolean cobrancaEfetuada) { + this.cobrancaEfetuada = cobrancaEfetuada; + } + + public String getFrequenciaNaData() { + return frequenciaNaData; + } + + public void setFrequenciaNaData(String frequenciaNaData) { + this.frequenciaNaData = frequenciaNaData; + } + + public Date getDataRegistro() { + return dataRegistro; + } + + public void setDataRegistro(Date dataRegistro) { + this.dataRegistro = dataRegistro; + } + + public String getMotivo() { + return motivo; + } + + public void setMotivo(String motivo) { + this.motivo = motivo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java b/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java new file mode 100644 index 000000000..b2240a830 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java @@ -0,0 +1,118 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COEFICIENTE_TARIFA_SEQ", sequenceName = "COEFICIENTE_TARIFA_SEQ", allocationSize = 1) +@Table(name = "COEFICIENTE_TARIFA") +public class CoeficienteTarifa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COEFICIENTE_TARIFA_SEQ") + @Column(name = "COEFICIENTETARIFA_ID") + private Integer coeficienteId; + @Column(name = "DESCCOEFICIENTE") + private String descCoeficiente; + @Column(name = "COEFICIENTE") + private BigDecimal coeficiente; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getCoeficienteId() { + return coeficienteId; + } + + public void setCoeficienteId(Integer coeficienteId) { + this.coeficienteId = coeficienteId; + } + + public String getDescCoeficiente() { + return descCoeficiente; + } + + public void setDescCoeficiente(String descCoeficiente) { + this.descCoeficiente = descCoeficiente; + } + + public BigDecimal getCoeficiente() { + return coeficiente; + } + + public void setCoeficiente(BigDecimal coeficiente) { + this.coeficiente = coeficiente; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return descCoeficiente + " - " + coeficiente; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((coeficienteId == null) ? 0 : coeficienteId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CoeficienteTarifa other = (CoeficienteTarifa) obj; + if (coeficienteId == null) { + if (other.coeficienteId != null) + return false; + } else if (!coeficienteId.equals(other.coeficienteId)) + return false; + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Colonia.java b/src/com/rjconsultores/ventaboletos/entidad/Colonia.java new file mode 100644 index 000000000..93cdb5032 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Colonia.java @@ -0,0 +1,163 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "COLONIA_SEQ", sequenceName = "COLONIA_SEQ", allocationSize = 1) +@Table(name = "COLONIA") +public class Colonia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COLONIA_SEQ") + @Column(name = "COLONIA_ID") + private Integer coloniaId; + @Column(name = "DESCCOLONIA") + private String desccolonia; + @Column(name = "CODPOSTAL") + private String codpostal; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "CIUDAD_ID") + private Ciudad ciudad; + + public Colonia() { + } + + public Colonia(Integer coloniaId) { + this.coloniaId = coloniaId; + } + + public Integer getColoniaId() { + return coloniaId; + } + + public void setColoniaId(Integer coloniaId) { + this.coloniaId = coloniaId; + } + + public String getDesccolonia() { + return desccolonia; + } + + public void setDesccolonia(String desccolonia) { + this.desccolonia = desccolonia; + } + + public String getCodpostal() { + return codpostal; + } + + public void setCodpostal(String codpostal) { + this.codpostal = codpostal; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (coloniaId != null ? coloniaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Colonia)) { + return false; + } + Colonia other = (Colonia) object; + if ((this.getColoniaId() == null && other.getColoniaId() != null) || (this.getColoniaId() != null && !this.getColoniaId().equals(other.getColoniaId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.desccolonia; + } + + public String getBairro(){ + return desccolonia; + } + + public String getUF(){ + return ciudad != null ? ciudad.getUF() : ""; + } + + public String getCidade(){ + return ciudad != null ? ciudad.getCodibge().toString().substring(2) : ""; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ComEmpCategoria.java b/src/com/rjconsultores/ventaboletos/entidad/ComEmpCategoria.java new file mode 100644 index 000000000..788d94ab3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ComEmpCategoria.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COM_EMP_CATEGORIA_SEQ", sequenceName = "COM_EMP_CATEGORIA_SEQ", allocationSize = 1) +@Table(name = "COM_EMP_CATEGORIA") +public class ComEmpCategoria implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COM_EMP_CATEGORIA_SEQ") + @Column(name = "COMEMPCATEGORIA_ID") + private Long comempcategoriaId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CATEGORIA_ID") + private Categoria categoria; + + @Column(name = "ACTIVO") + private boolean activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + public Long getComempcategoriaId() { + return comempcategoriaId; + } + + public void setComempcategoriaId(Long comempcategoriaId) { + this.comempcategoriaId = comempcategoriaId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((comempcategoriaId == null) ? 0 : comempcategoriaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + ComEmpCategoria other = (ComEmpCategoria) obj; + if (comempcategoriaId == null) { + if (other.comempcategoriaId != null) + return false; + } else if (!comempcategoriaId.equals(other.comempcategoriaId)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ComEmpConferencia.java b/src/com/rjconsultores/ventaboletos/entidad/ComEmpConferencia.java new file mode 100644 index 000000000..db7b48321 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ComEmpConferencia.java @@ -0,0 +1,232 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COM_EMP_CONFERENCIA_SEQ", sequenceName = "COM_EMP_CONFERENCIA_SEQ", allocationSize = 1) +@Table(name = "COM_EMP_CONFERENCIA") +public class ComEmpConferencia implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COM_EMP_CONFERENCIA_SEQ") + @Column(name = "COMEMPCONFERENCIA_ID") + private Long comempconferenciaId; + + @Column(name = "INDBILHETEMANUAL") + private Boolean indbilhetemanual; + + @Column(name = "INDBILHETEVENDIDO") + private Boolean indbilhetevendido; + + @Column(name = "INDBILHETECANCELADO") + private Boolean indbilhetecancelado; + + @Column(name = "INDBILHETEDEVOLVIDO") + private Boolean indbilhetedevolvido; + + @Column(name = "INDGAPVENDIDO") + private Boolean indgapvendido; + + @Column(name = "INDGAPCANCELADO") + private Boolean indgapcancelado; + + @Column(name = "INDGAPDEVOLVIDO") + private Boolean indgapdevolvido; + + @Column(name = "INDEVENTOSFINANCEIROS") + private Boolean indeventosfinanceiros; + + @Column(name = "INDOCD") + private Boolean indocd; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "INDTIPO_DEB_CRED") + private Integer tipoDebitoCredito; + + @Column(name = "ACTIVO") + private boolean activo; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + public ComEmpConferencia() { + super(); + setIndbilhetecancelado(Boolean.FALSE); + setIndbilhetevendido(Boolean.FALSE); + setIndbilhetedevolvido(Boolean.FALSE); + setIndgapcancelado(Boolean.FALSE); + setIndgapdevolvido(Boolean.FALSE); + setIndgapvendido(Boolean.FALSE); + setIndeventosfinanceiros(Boolean.FALSE); + setIndocd(Boolean.FALSE); + } + + public Long getComempconferenciaId() { + return comempconferenciaId; + } + + public void setComempconferenciaId(Long comempconferenciaId) { + this.comempconferenciaId = comempconferenciaId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getComempconferenciaId() == null) ? 0 : getComempconferenciaId().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ComEmpConferencia)) + return false; + ComEmpConferencia other = (ComEmpConferencia) obj; + if (getComempconferenciaId() == null) { + if (other.getComempconferenciaId() != null) + return false; + } else if (!getComempconferenciaId().equals(other.getComempconferenciaId())) + return false; + return true; + } + + public Boolean getIndbilhetemanual() { + return indbilhetemanual; + } + + public void setIndbilhetemanual(Boolean indbilhetemanual) { + this.indbilhetemanual = indbilhetemanual; + } + + public Boolean getIndbilhetevendido() { + return indbilhetevendido; + } + + public void setIndbilhetevendido(Boolean indbilhetevendido) { + this.indbilhetevendido = indbilhetevendido; + } + + public Boolean getIndbilhetecancelado() { + return indbilhetecancelado; + } + + public void setIndbilhetecancelado(Boolean indbilhetecancelado) { + this.indbilhetecancelado = indbilhetecancelado; + } + + public Boolean getIndbilhetedevolvido() { + return indbilhetedevolvido; + } + + public void setIndbilhetedevolvido(Boolean indbilhetedevolvido) { + this.indbilhetedevolvido = indbilhetedevolvido; + } + + public Boolean getIndgapvendido() { + return indgapvendido; + } + + public void setIndgapvendido(Boolean indgapvendido) { + this.indgapvendido = indgapvendido; + } + + public Boolean getIndgapcancelado() { + return indgapcancelado; + } + + public void setIndgapcancelado(Boolean indgapcancelado) { + this.indgapcancelado = indgapcancelado; + } + + public Boolean getIndgapdevolvido() { + return indgapdevolvido; + } + + public void setIndgapdevolvido(Boolean indgapdevolvido) { + this.indgapdevolvido = indgapdevolvido; + } + + public Boolean getIndeventosfinanceiros() { + return indeventosfinanceiros; + } + + public void setIndeventosfinanceiros(Boolean indeventosfinanceiros) { + this.indeventosfinanceiros = indeventosfinanceiros; + } + + public Boolean getIndocd() { + return indocd; + } + + public void setIndocd(Boolean indocd) { + this.indocd = indocd; + } + + public Integer getTipoDebitoCredito() { + return tipoDebitoCredito; + } + + public void setTipoDebitoCredito(int tipoDebitoCredito) { + this.tipoDebitoCredito = tipoDebitoCredito; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ComEmpFormapago.java b/src/com/rjconsultores/ventaboletos/entidad/ComEmpFormapago.java new file mode 100644 index 000000000..2e9839aac --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ComEmpFormapago.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COM_EMP_FORMAPAGO_SEQ", sequenceName = "COM_EMP_FORMAPAGO_SEQ", allocationSize = 1) +@Table(name = "COM_EMP_FORMAPAGO") +public class ComEmpFormapago implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "COMEMPFORMAPAGO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COM_EMP_FORMAPAGO_SEQ") + private Long comempformapagoId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "FORMAPAGO_ID") + private FormaPago formaPago; + + @Column(name = "ACTIVO") + private boolean activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + public Long getComempformapagoId() { + return comempformapagoId; + } + + public void setComempformapagoId(Long comempformapagoId) { + this.comempformapagoId = comempformapagoId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((comempformapagoId == null) ? 0 : comempformapagoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + ComEmpFormapago other = (ComEmpFormapago) obj; + if (comempformapagoId == null) { + if (other.comempformapagoId != null) + return false; + } else if (!comempformapagoId.equals(other.comempformapagoId)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ComEmpTipoEventoExtra.java b/src/com/rjconsultores/ventaboletos/entidad/ComEmpTipoEventoExtra.java new file mode 100644 index 000000000..368cf4b53 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ComEmpTipoEventoExtra.java @@ -0,0 +1,116 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COM_EMP_TIPOEVENTOEXTRA_SEQ", sequenceName = "COM_EMP_TIPOEVENTOEXTRA_SEQ", allocationSize = 1) +@Table(name = "COM_EMP_TIPOEVENTOEXTRA") +public class ComEmpTipoEventoExtra implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "COMEMPTIPOEVENTOEXTRA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COM_EMP_TIPOEVENTOEXTRA_SEQ") + private Long comemptipoeventoextraId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "TIPOEVENTOEXTRA_ID") + private TipoEventoExtra tipoEventoExtra; + + @Column(name = "ACTIVO") + private boolean activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + public Long getComemptipoeventoextraId() { + return comemptipoeventoextraId; + } + + public void setComemptipoeventoextraId(Long comemptipoeventoextraId) { + this.comemptipoeventoextraId = comemptipoeventoextraId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public TipoEventoExtra getTipoEventoExtra() { + return tipoEventoExtra; + } + + public void setTipoEventoExtra(TipoEventoExtra tipoEventoExtra) { + this.tipoEventoExtra = tipoEventoExtra; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((comemptipoeventoextraId == null) ? 0 : comemptipoeventoextraId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + ComEmpTipoEventoExtra other = (ComEmpTipoEventoExtra) obj; + if (comemptipoeventoextraId == null) { + if (other.comemptipoeventoextraId != null) + return false; + } else if (!comemptipoeventoextraId.equals(other.comemptipoeventoextraId)) + return false; + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ComisionistaExterno.java b/src/com/rjconsultores/ventaboletos/entidad/ComisionistaExterno.java new file mode 100644 index 000000000..501ab7e7b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ComisionistaExterno.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "COMISIONISTA_EXTERNO_SEQ", sequenceName = "COMISIONISTA_EXTERNO_SEQ", allocationSize = 1) +@Table(name = "COMISIONISTA_EXTERNO") +public class ComisionistaExterno implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COMISIONISTA_EXTERNO_SEQ") + @Basic(optional = false) + @Column(name = "COMISIONISTAEXTERNO_ID") + private Short comisionistaexternoId; + @Column(name = "DESCCOMISIONISTA") + private String desccomisionista; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public ComisionistaExterno() { + } + + public ComisionistaExterno(Short comisionistaexternoId) { + this.comisionistaexternoId = comisionistaexternoId; + } + + public Short getComisionistaexternoId() { + return comisionistaexternoId; + } + + public void setComisionistaexternoId(Short comisionistaexternoId) { + this.comisionistaexternoId = comisionistaexternoId; + } + + public String getDesccomisionista() { + return desccomisionista; + } + + public void setDesccomisionista(String desccomisionista) { + this.desccomisionista = desccomisionista; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (comisionistaexternoId != null ? comisionistaexternoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ComisionistaExterno)) { + return false; + } + ComisionistaExterno other = (ComisionistaExterno) object; + if ((this.comisionistaexternoId == null && other.comisionistaexternoId != null) || (this.comisionistaexternoId != null && !this.comisionistaexternoId.equals(other.comisionistaexternoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDesccomisionista(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Comissao.java b/src/com/rjconsultores/ventaboletos/entidad/Comissao.java new file mode 100644 index 000000000..348358937 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Comissao.java @@ -0,0 +1,374 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COMISSAO_SEQ", sequenceName = "COMISSAO_SEQ", allocationSize = 1) +@Table(name = "COMISSAO") +public class Comissao implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COMISSAO_SEQ") + @Column(name = "COMISSAO_ID") + private Integer comissaoId; + + @Column(name = "COMPETENCIA") + private String competencia; + + @Column(name = "DATAPAGAMENTO") + @Temporal(TemporalType.TIMESTAMP) + private Date dataPagamento; + + @Column(name = "INDPAGO") + private Boolean indPago; + + @Column(name = "COMISSAO_BPR") + private BigDecimal comissaoBpr; + + @Column(name = "RECEITA_EXCESSOBAGAGEM") + private BigDecimal receitaExcessobagagem; + + @Column(name = "RECEITA_SEGUROOPCIONAL") + private BigDecimal receitaSeguroopcional; + + @Column(name = "RECEITA_SEGURO") + private BigDecimal receitaSeguro; + + @Column(name = "RECEITA_OUTROS") + private BigDecimal receitaOutros; + + @Column(name = "DESCONTOS_FIXOS") + private BigDecimal descontosFixos; + + @Column(name = "DESCONTOS_EVENTUAIS") + private BigDecimal descontosEventuais; + + @Column(name = "ROYATIES") + private BigDecimal royaties; + + @Column(name = "ISS_RETIDO") + private BigDecimal issRetido; + + @Column(name = "BONIFICACAO_METAS") + private BigDecimal bonificacaoMetas; + + @Column(name = "ENTREGAS_PASSAGEM") + private BigDecimal entregasPassagem; + + @Column(name = "USUARIOPAGAMENTO_ID") + private Integer usuarioPagamentoId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + @Column(name = "EMPRESA_ID") + private Integer empresaId; + + @Column(name = "RECEITA_BPR") + private BigDecimal receitaBPR; + + @Column(name = "DEVOLVIDOS") + private BigDecimal devolvidos; + + @Column(name = "RECEITA_BRUTA_EXCESSOBAGAGEM") + private BigDecimal receitaBrutaExcessoBagagem; + + @Column(name = "RECEITA_BRUTA_SEGURO") + private BigDecimal receitaBrutaSeguro; + + @Column(name = "RECEITA_BRUTA_SEGUROOPCIONAL") + private BigDecimal receitaBrutaSeguroopcional; + + @Column(name = "DATA_INICIAL") + @Temporal(TemporalType.DATE) + private Date dataInicial; + + @Column(name = "DATA_FINAL") + @Temporal(TemporalType.DATE) + private Date dataFinal; + + @Column(name = "RECEITA_GAP") + private BigDecimal receitaGAP; + + public Comissao() { + super(); + setComissaoBpr(BigDecimal.ZERO); + setReceitaExcessobagagem(BigDecimal.ZERO); + setReceitaSeguroopcional(BigDecimal.ZERO); + setReceitaOutros(BigDecimal.ZERO); + setDescontosFixos(BigDecimal.ZERO); + setDescontosEventuais(BigDecimal.ZERO); + setRoyaties(BigDecimal.ZERO); + setIssRetido(BigDecimal.ZERO); + setBonificacaoMetas(BigDecimal.ZERO); + setEntregasPassagem(BigDecimal.ZERO); + setReceitaBPR(BigDecimal.ZERO); + setDevolvidos(BigDecimal.ZERO); + setReceitaBrutaExcessoBagagem(BigDecimal.ZERO); + setReceitaBrutaSeguroopcional(BigDecimal.ZERO); + setReceitaGAP(BigDecimal.ZERO); + } + + public Integer getComissaoId() { + return comissaoId; + } + + public void setComissaoId(Integer comissaoId) { + this.comissaoId = comissaoId; + } + + public String getCompetencia() { + return competencia; + } + + public void setCompetencia(String competencia) { + this.competencia = competencia; + } + + public Date getDataPagamento() { + return dataPagamento; + } + + public void setDataPagamento(Date dataPagamento) { + this.dataPagamento = dataPagamento; + } + + public Boolean getIndPago() { + return indPago; + } + + public void setIndPago(Boolean indPago) { + this.indPago = indPago; + } + + public BigDecimal getComissaoBpr() { + return comissaoBpr; + } + + public void setComissaoBpr(BigDecimal comissaoBpr) { + this.comissaoBpr = comissaoBpr; + } + + public BigDecimal getReceitaExcessobagagem() { + return receitaExcessobagagem; + } + + public void setReceitaExcessobagagem(BigDecimal receitaExcessobagagem) { + this.receitaExcessobagagem = receitaExcessobagagem; + } + + public BigDecimal getReceitaSeguroopcional() { + return receitaSeguroopcional; + } + + public void setReceitaSeguroopcional(BigDecimal receitaSeguroopcional) { + this.receitaSeguroopcional = receitaSeguroopcional; + } + + public BigDecimal getReceitaSeguro() { + return receitaSeguro; + } + + public void setReceitaSeguro(BigDecimal receitaSeguro) { + this.receitaSeguro = receitaSeguro; + } + + public BigDecimal getDescontosFixos() { + return descontosFixos; + } + + public void setDescontosFixos(BigDecimal descontosFixos) { + this.descontosFixos = descontosFixos; + } + + public BigDecimal getDescontosEventuais() { + return descontosEventuais; + } + + public void setDescontosEventuais(BigDecimal descontosEventuais) { + this.descontosEventuais = descontosEventuais; + } + + public BigDecimal getRoyaties() { + return royaties; + } + + public void setRoyaties(BigDecimal royaties) { + this.royaties = royaties; + } + + public BigDecimal getIssRetido() { + return issRetido; + } + + public void setIssRetido(BigDecimal issRetido) { + this.issRetido = issRetido; + } + + public BigDecimal getBonificacaoMetas() { + return bonificacaoMetas; + } + + public void setBonificacaoMetas(BigDecimal bonificacaoMetas) { + this.bonificacaoMetas = bonificacaoMetas; + } + + public BigDecimal getEntregasPassagem() { + return entregasPassagem; + } + + public void setEntregasPassagem(BigDecimal entregasPassagem) { + this.entregasPassagem = entregasPassagem; + } + + public Integer getUsuarioPagamentoId() { + return usuarioPagamentoId; + } + + public void setUsuarioPagamentoId(Integer usuarioPagamentoId) { + this.usuarioPagamentoId = usuarioPagamentoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public BigDecimal getReceitaOutros() { + return receitaOutros; + } + + public void setReceitaOutros(BigDecimal receitaOutros) { + this.receitaOutros = receitaOutros; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public BigDecimal getReceitaBPR() { + return receitaBPR; + } + + public void setReceitaBPR(BigDecimal receitaBPR) { + this.receitaBPR = receitaBPR; + } + + public BigDecimal getDevolvidos() { + return devolvidos; + } + + public void setDevolvidos(BigDecimal devolvidos) { + this.devolvidos = devolvidos; + } + + public BigDecimal getReceitaBrutaExcessoBagagem() { + return receitaBrutaExcessoBagagem; + } + + public void setReceitaBrutaExcessoBagagem(BigDecimal receitaBrutaExcessoBagagem) { + this.receitaBrutaExcessoBagagem = receitaBrutaExcessoBagagem; + } + + public BigDecimal getReceitaBrutaSeguroopcional() { + return receitaBrutaSeguroopcional; + } + + public void setReceitaBrutaSeguroopcional(BigDecimal receitaBrutaSeguroopcional) { + this.receitaBrutaSeguroopcional = receitaBrutaSeguroopcional; + } + + public Date getDataInicial() { + return dataInicial; + } + + public void setDataInicial(Date dataInicial) { + this.dataInicial = dataInicial; + } + + public Date getDataFinal() { + return dataFinal; + } + + public void setDataFinal(Date dataFinal) { + this.dataFinal = dataFinal; + } + + public BigDecimal getReceitaGAP() { + return receitaGAP; + } + + public void setReceitaGAP(BigDecimal receitaGAP) { + this.receitaGAP = receitaGAP; + } + + public BigDecimal getReceitaBrutaSeguro() { + return receitaBrutaSeguro; + } + + public void setReceitaBrutaSeguro(BigDecimal receitaBrutaSeguro) { + this.receitaBrutaSeguro = receitaBrutaSeguro; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ComissaoLog.java b/src/com/rjconsultores/ventaboletos/entidad/ComissaoLog.java new file mode 100644 index 000000000..683f39a35 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ComissaoLog.java @@ -0,0 +1,195 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COMISSAO_LOG_SEQ", sequenceName = "COMISSAO_LOG_SEQ", allocationSize = 1) +@Table(name = "COMISSAO_LOG") +public class ComissaoLog implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COMISSAO_LOG_SEQ") + @Column(name = "COMISSAOLOG_ID") + private Long comissaologId; + + @Column(name = "PUNTOVENTA_ID") + private Integer puntoventaId; + + @Column(name = "EMPRESA_ID") + private Integer empresaId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "FECCORTE") + @Temporal(TemporalType.DATE) + private Date feccorte; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "TURNO_ID") + private Integer turnoId; + + @Column(name = "CAJA_ID") + private Long cajaId; + + @Column(name = "CAJADIVERSOS_ID") + private Long cajadiversosId; + + @Column(name = "PORC_COMISSAO") + private BigDecimal porcComissao; + + @Column(name = "VALOR_BASE") + private BigDecimal valorBase; + + @Column(name = "VALOR_COMISSAO") + private BigDecimal valorComissao; + + @Column(name = "ORIGEM") + private String origem; + + @Column(name = "TEXTO") + private String texto; + + public Long getComissaologId() { + return comissaologId; + } + + public void setComissaologId(Long comissaologId) { + this.comissaologId = comissaologId; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Date getFeccorte() { + return feccorte; + } + + public void setFeccorte(Date feccorte) { + this.feccorte = feccorte; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getTurnoId() { + return turnoId; + } + + public void setTurnoId(Integer turnoId) { + this.turnoId = turnoId; + } + + public Long getCajaId() { + return cajaId; + } + + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + + public Long getCajadiversosId() { + return cajadiversosId; + } + + public void setCajadiversosId(Long cajadiversosId) { + this.cajadiversosId = cajadiversosId; + } + + public BigDecimal getPorcComissao() { + return porcComissao; + } + + public void setPorcComissao(BigDecimal porcComissao) { + this.porcComissao = porcComissao; + } + + public BigDecimal getValorBase() { + return valorBase; + } + + public void setValorBase(BigDecimal valorBase) { + this.valorBase = valorBase; + } + + public BigDecimal getValorComissao() { + return valorComissao; + } + + public void setValorComissao(BigDecimal valorComissao) { + this.valorComissao = valorComissao; + } + + public String getOrigem() { + return origem; + } + + public void setOrigem(String origem) { + this.origem = origem; + } + + public String getTexto() { + return texto; + } + + public void setTexto(String texto) { + this.texto = texto; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ComissaoReceita.java b/src/com/rjconsultores/ventaboletos/entidad/ComissaoReceita.java new file mode 100644 index 000000000..80f731029 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ComissaoReceita.java @@ -0,0 +1,401 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "COMISSAO_RECEITA_SEQ", sequenceName = "COMISSAO_RECEITA_SEQ", allocationSize = 1) +@Table(name = "COMISSAO_RECEITA") +public class ComissaoReceita implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COMISSAO_RECEITA_SEQ") + @Column(name = "COMISSAORECEITA_ID") + private Integer comissaoreceitaId; + + @Column(name = "DATAMOVIMENTO") + @Temporal(TemporalType.DATE) + private Date datamovimento; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "BPR") + private BigDecimal bpr; + + @Column(name = "GAP") + private BigDecimal gap; + + @Column(name = "IMPGAP") + private BigDecimal impgap; + + @Column(name = "INTERNET") + private BigDecimal internet; + + @Column(name = "CANCELADOS") + private BigDecimal cancelados; + + @Column(name = "CANCELGAP") + private BigDecimal cancelgap; + + @Column(name = "DEVOLVIDOS") + private BigDecimal devolvidos; + + @Column(name = "DEVOLVIDOS_ORIGEM") + private BigDecimal devolvidosOrigem; + + @Column(name = "DEVOLVIDOS_ORIGEM_GAP") + private BigDecimal devolvidosOrigemGap; + + @Column(name = "DEVGAP") + private BigDecimal devgap; + + @Column(name = "EXCESSO_BAGAGEM") + private BigDecimal excessoBagagem; + + @Column(name = "SEG_OPCIONAL") + private BigDecimal segOpcional; + + @Column(name = "SEG_OBRIGATORIO") + private BigDecimal segObrigatorio; + + @Column(name = "RECEITA_OUTROS") + private BigDecimal receitaOutros; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "COMISSAO_BPR") + private BigDecimal comissaoBpr; + + @Column(name = "COMISSAO_ENTREGA_PASSAGEM") + private BigDecimal comissaoEntregaPassagem; + + @Column(name = "COMISSAO_ENTREGA_BAGAGEM") + private BigDecimal comissaoExcessoBagagem; + + @Column(name = "COMISSAO_SEG_OPCIONAL") + private BigDecimal comissaoSegOpcional; + + @Column(name = "COMISSAO_OUTROS") + private BigDecimal comissaoOutros; + + @Column(name = "COMISSAO_SEG_OBRIGATORIO") + private BigDecimal comissaoSegObrigatorio; + + @Column(name = "QTDE_IMPGAP") + private Integer qtdeImpgap; + + public ComissaoReceita() { + super(); + } + + public ComissaoReceita(com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita comissaoReceitaVO) { + this(); + this.activo = Boolean.TRUE; + this.fecmodif = new Date(); + this.datamovimento = comissaoReceitaVO.getData(); + this.bpr = comissaoReceitaVO.getReceitaBPR(); + this.gap = comissaoReceitaVO.getReceitaGAP(); + this.impgap = comissaoReceitaVO.getGapImpressa(); + this.qtdeImpgap = comissaoReceitaVO.getContImpressa(); + this.internet = comissaoReceitaVO.getInternet(); + this.cancelados = comissaoReceitaVO.getCancelados(); + this.cancelgap = comissaoReceitaVO.getCanceladosGAP(); + this.devolvidos = comissaoReceitaVO.getDevolvidos(); + this.devgap = comissaoReceitaVO.getDevolvidosGAP(); + this.excessoBagagem = comissaoReceitaVO.getReceitaExcessoBagagem(); + this.segObrigatorio = comissaoReceitaVO.getReceitaSeguro(); + this.segOpcional = comissaoReceitaVO.getReceitaSeguroOpcional(); + this.receitaOutros = comissaoReceitaVO.getReceitaSeguroOutros(); + this.devolvidosOrigem = comissaoReceitaVO.getDevolucoesOrigem(); + this.devolvidosOrigemGap = comissaoReceitaVO.getDevolucoesOrigemGAP(); + + this.comissaoBpr = comissaoReceitaVO.getComissaoBPRDiaria(); + this.comissaoEntregaPassagem = comissaoReceitaVO.getComissaoEntregaPassagemDiaria(); + this.comissaoExcessoBagagem = comissaoReceitaVO.getComissaoExcessoBagagemDiaria(); + this.comissaoSegOpcional = comissaoReceitaVO.getComissaoSegOpcionalDiaria(); + this.comissaoOutros = comissaoReceitaVO.getComissaoOutrosDiaria(); + this.comissaoSegObrigatorio = comissaoReceitaVO.getComissaoSeguroObrigatorioDiaria(); + } + + public Integer getComissaoreceitaId() { + return comissaoreceitaId; + } + + public void setComissaoreceitaId(Integer comissaoreceitaId) { + this.comissaoreceitaId = comissaoreceitaId; + } + + public Date getDatamovimento() { + return datamovimento; + } + + public void setDatamovimento(Date datamovimento) { + this.datamovimento = datamovimento; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public BigDecimal getBpr() { + return bpr; + } + + public void setBpr(BigDecimal bpr) { + this.bpr = bpr; + } + + public BigDecimal getGap() { + return gap; + } + + public void setGap(BigDecimal gap) { + this.gap = gap; + } + + public BigDecimal getImpgap() { + return impgap; + } + + public void setImpgap(BigDecimal impgap) { + this.impgap = impgap; + } + + public BigDecimal getInternet() { + return internet; + } + + public void setInternet(BigDecimal internet) { + this.internet = internet; + } + + public BigDecimal getCancelados() { + return cancelados; + } + + public void setCancelados(BigDecimal cancelados) { + this.cancelados = cancelados; + } + + public BigDecimal getCancelgap() { + return cancelgap; + } + + public void setCancelgap(BigDecimal cancelgap) { + this.cancelgap = cancelgap; + } + + public BigDecimal getDevolvidos() { + return devolvidos; + } + + public void setDevolvidos(BigDecimal devolvidos) { + this.devolvidos = devolvidos; + } + + public BigDecimal getDevgap() { + return devgap; + } + + public void setDevgap(BigDecimal devgap) { + this.devgap = devgap; + } + + public BigDecimal getExcessoBagagem() { + return excessoBagagem; + } + + public void setExcessoBagagem(BigDecimal excessoBagagem) { + this.excessoBagagem = excessoBagagem; + } + + public BigDecimal getSegOpcional() { + return segOpcional; + } + + public void setSegOpcional(BigDecimal segOpcional) { + this.segOpcional = segOpcional; + } + + public BigDecimal getReceitaOutros() { + return receitaOutros; + } + + public void setReceitaOutros(BigDecimal receitaOutros) { + this.receitaOutros = receitaOutros; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public BigDecimal getDevolvidosOrigem() { + return devolvidosOrigem; + } + + public void setDevolvidosOrigem(BigDecimal devolvidosOrigem) { + this.devolvidosOrigem = devolvidosOrigem; + } + + public BigDecimal getDevolvidosOrigemGap() { + return devolvidosOrigemGap; + } + + public void setDevolvidosOrigemGap(BigDecimal devolvidosOrigemGap) { + this.devolvidosOrigemGap = devolvidosOrigemGap; + } + + public BigDecimal getComissaoBpr() { + return comissaoBpr; + } + + public void setComissaoBpr(BigDecimal comissaoBpr) { + this.comissaoBpr = comissaoBpr; + } + + public BigDecimal getComissaoEntregaPassagem() { + return comissaoEntregaPassagem; + } + + public void setComissaoEntregaPassagem(BigDecimal comissaoEntregaPassagem) { + this.comissaoEntregaPassagem = comissaoEntregaPassagem; + } + + public BigDecimal getComissaoExcessoBagagem() { + return comissaoExcessoBagagem; + } + + public void setComissaoExcessoBagagem(BigDecimal comissaoExcessoBagagem) { + this.comissaoExcessoBagagem = comissaoExcessoBagagem; + } + + public BigDecimal getComissaoSegOpcional() { + return comissaoSegOpcional; + } + + public void setComissaoSegOpcional(BigDecimal comissaoSegOpcional) { + this.comissaoSegOpcional = comissaoSegOpcional; + } + + public BigDecimal getComissaoOutros() { + return comissaoOutros; + } + + public void setComissaoOutros(BigDecimal comissaoOutros) { + this.comissaoOutros = comissaoOutros; + } + + public Integer getQtdeImpgap() { + return qtdeImpgap; + } + + public void setQtdeImpgap(Integer qtdeImpgap) { + this.qtdeImpgap = qtdeImpgap; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((comissaoreceitaId == null) ? 0 : comissaoreceitaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ComissaoReceita)) + return false; + ComissaoReceita other = (ComissaoReceita) obj; + if (comissaoreceitaId == null) { + if (other.comissaoreceitaId != null) + return false; + } else if (!comissaoreceitaId.equals(other.comissaoreceitaId)) + return false; + return true; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public BigDecimal getComissaoSegObrigatorio() { + return comissaoSegObrigatorio; + } + + public void setComissaoSegObrigatorio(BigDecimal comissaoSegObrigatorio) { + this.comissaoSegObrigatorio = comissaoSegObrigatorio; + } + + public BigDecimal getSegObrigatorio() { + return segObrigatorio != null ? segObrigatorio : BigDecimal.ZERO ; + } + + public void setSegObrigatorio(BigDecimal segObrigatorio) { + this.segObrigatorio = segObrigatorio; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CompaniaBancaria.java b/src/com/rjconsultores/ventaboletos/entidad/CompaniaBancaria.java new file mode 100644 index 000000000..0907f958a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CompaniaBancaria.java @@ -0,0 +1,180 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "COMPANIA_BANCARIA_SEQ", sequenceName = "COMPANIA_BANCARIA_SEQ", allocationSize = 1) +@Table(name = "COMPANIA_BANCARIA") +public class CompaniaBancaria implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "COMPANIABANCARIA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COMPANIA_BANCARIA_SEQ") + private Integer companiabancariaId; + @Column(name = "CVECOMPANIA") + private String cvecompania; + @Column(name = "CVESUCURSAL") + private String cvesucursal; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "companiaBancaria") + private List merchantBancarioList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "companiaBancaria") + private List usuarioBancarioList; + + + + public CompaniaBancaria() { + } + + public CompaniaBancaria(Integer companiabancariaId) { + this.companiabancariaId = companiabancariaId; + } + + public CompaniaBancaria(Integer companiabancariaId, Boolean activo) { + this.companiabancariaId = companiabancariaId; + this.activo = activo; + } + + public Integer getCompaniabancariaId() { + return companiabancariaId; + } + + public void setCompaniabancariaId(Integer companiabancariaId) { + this.companiabancariaId = companiabancariaId; + } + + public String getCvecompania() { + return cvecompania; + } + + public void setCvecompania(String cvecompania) { + this.cvecompania = cvecompania; + } + + public String getCvesucursal() { + return cvesucursal; + } + + public void setCvesucursal(String cvesucursal) { + this.cvesucursal = cvesucursal; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public List getMerchantBancarioList() { + List tmp = new ArrayList(); + if (merchantBancarioList != null) { + for (MerchantBancario ddab : this.merchantBancarioList) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + + this.merchantBancarioList = tmp; + + return tmp; + } + + public void setMerchantBancarioList(List merchantBancarioList) { + this.merchantBancarioList = merchantBancarioList; + } + + public List getUsuarioBancarioList() { + List tmp = new ArrayList(); + if (usuarioBancarioList != null) { + for (UsuarioBancario ddab : this.usuarioBancarioList) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + + this.usuarioBancarioList = tmp; + + return tmp; + } + + public void setUsuarioBancarioList(List usuarioBancarioList) { + this.usuarioBancarioList = usuarioBancarioList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (companiabancariaId != null ? companiabancariaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CompaniaBancaria)) { + return false; + } + CompaniaBancaria other = (CompaniaBancaria) object; + if ((this.companiabancariaId == null && other.companiabancariaId != null) || (this.companiabancariaId != null && !this.companiabancariaId.equals(other.companiabancariaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CompaniaBancaria[companiabancariaId=" + companiabancariaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Conductor.java b/src/com/rjconsultores/ventaboletos/entidad/Conductor.java new file mode 100644 index 000000000..5313cba59 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Conductor.java @@ -0,0 +1,172 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CONDUCTOR_SEQ", sequenceName = "CONDUCTOR_SEQ", allocationSize = 1) +@Table(name = "CONDUCTOR") +public class Conductor implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "CONDUCTOR_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONDUCTOR_SEQ") + private Integer conductorId; + @Column(name = "NOMBCONDUCTOR") + private String nombconductor; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "conductor") + private List corridaList; + @OneToMany(mappedBy = "conductor1") + private List corridaList1; + @OneToOne + @JoinColumn(name = "EMPLEADO_ID") + private Empleado empleado; + @Column(name = "NOMBPATERNO") + private String nomPaterno; + @Column(name = "NOMBMATERNO") + private String nomMaterno; + + public String getNomMaterno() { + return nomMaterno; + } + + public void setNomMaterno(String nomMaterno) { + this.nomMaterno = nomMaterno; + } + + public String getNomPaterno() { + return nomPaterno; + } + + public void setNomPaterno(String nomPaterno) { + this.nomPaterno = nomPaterno; + } + + public Empleado getEmpleado() { + return empleado; + } + + public void setEmpleado(Empleado empleado) { + this.empleado = empleado; + } + + public Conductor() { + } + + public Conductor(Integer conductorId) { + this.conductorId = conductorId; + } + + public Integer getConductorId() { + return conductorId; + } + + public void setConductorId(Integer conductorId) { + this.conductorId = conductorId; + } + + public String getNombconductor() { + return nombconductor; + } + + public void setNombconductor(String nombconductor) { + this.nombconductor = nombconductor; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + public List getCorridaList1() { + return corridaList1; + } + + public void setCorridaList1(List corridaList1) { + this.corridaList1 = corridaList1; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (conductorId != null ? conductorId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Conductor)) { + return false; + } + Conductor other = (Conductor) object; + if ((this.conductorId == null && other.conductorId != null) || (this.conductorId != null && !this.conductorId.equals(other.conductorId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return (this.getEmpleado() != null ? this.getEmpleado().getCveEmpleado() : "") + "-" + this.getNombconductor() + " " + this.getNomPaterno(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Conexion.java b/src/com/rjconsultores/ventaboletos/entidad/Conexion.java new file mode 100644 index 000000000..cdda6562f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Conexion.java @@ -0,0 +1,205 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "CONEXION_SEQ", sequenceName = "CONEXION_SEQ", allocationSize = 1) +@Table(name = "CONEXION") +public class Conexion implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_SEQ") + @Column(name = "CONEXION_ID") + private Long conexionId; + @Column(name = "NUMGRUPO") + private Integer numgrupo; + @Column(name = "NUMSECUENCIA") + private Short numsecuencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ORIGEN_ID") + private Integer origenId; + @Column(name = "DESTINO_ID") + private Integer destinoId; + @Column(name = "CONEXIONCTRL_ID") + private Long conexionctrlId; + @Column(name = "CORRIDA_ID") + private Long corridaId; + @Transient + private List conexionesDescuentos; + @Column(name = "RUTA_ID") + private Integer rutaId; + @Column(name = "CONEXIONRUTATRAMOCTRL_ID") + private Long conexionRutaTramoId; + + public Long getCorridaId() { + return corridaId; + } + + public void setCorridaId(Long corridaId) { + this.corridaId = corridaId; + } + + public Conexion() { + this(null); + } + + public Conexion(Long conexionId) { + this.conexionId = conexionId; + conexionesDescuentos = new ArrayList(); + } + + public Long getConexionId() { + return conexionId; + } + + public void setConexionId(Long conexionId) { + this.conexionId = conexionId; + } + + public Integer getNumgrupo() { + return numgrupo; + } + + public void setNumgrupo(Integer numgrupo) { + this.numgrupo = numgrupo; + } + + public Short getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Short numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (conexionId != null ? conexionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Conexion)) { + return false; + } + Conexion other = (Conexion) object; + + if (this.conexionId == null && other.getConexionId() == null) { + return this.numgrupo == other.getNumgrupo() + && this.getOrigenId() == other.getOrigenId() + && this.getNumsecuencia() == other.getNumsecuencia() + && this.getDestinoId() == other.destinoId; + } + return conexionId == other.getConexionId(); + } + + @Override + public String toString() { + return "com.rjconsultores.entidad.Conexion[ conexionId=" + conexionId + " ]"; + } + + public Long getConexionctrlId() { + return conexionctrlId; + } + + public void setConexionctrlId(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public List getConexionesDescuentos() { + return conexionesDescuentos; + } + + public void setConexionesDescuentos(List conexionesDescuentos) { + this.conexionesDescuentos = conexionesDescuentos; + } + + public Integer getRutaId() { + return rutaId; + } + + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + + public Long getConexionRutaTramoId() { + return conexionRutaTramoId; + } + + public void setConexionRutaTramoId(Long conexionRutaTramoId) { + this.conexionRutaTramoId = conexionRutaTramoId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionConf.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionConf.java new file mode 100644 index 000000000..efbcfaa3b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionConf.java @@ -0,0 +1,183 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONEXION_CONF_SEQ", sequenceName = "CONEXION_CONF_SEQ", allocationSize = 1) +@Table(name = "CONEXION_CONF") +public class ConexionConf implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "CONEXIONCONF_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_CONF_SEQ") + private Long conexionConfId; + @ManyToOne + @JoinColumn(name = "CONEXIONCTRL_ID", referencedColumnName = "CONEXIONCTRL_ID") + private ConexionCtrl conexionCtrl; + @Column(name = "GRUPO") + private Integer grupo; + @Column(name = "PORSEC1") + private BigDecimal porSec1; + @Column(name = "PORSEC2") + private BigDecimal porSec2; + @Column(name = "PORSEC3") + private BigDecimal porSec3; + @Column(name = "PORSEC4") + private BigDecimal porSec4; + @Column(name = "TIEMPOMIN") + private Integer tiempoMin; + @Column(name = "TIEMPOMAX") + private Integer tiempoMax; + @Column(name = "INDDISPONIBLE") + private Boolean indisponible; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getConexionConfId() { + return conexionConfId; + } + + public void setConexionConfId(Long conexionConfId) { + this.conexionConfId = conexionConfId; + } + + public ConexionCtrl getConexionCtrl() { + return conexionCtrl; + } + + public void setConexionCtrl(ConexionCtrl conexionCtrl) { + this.conexionCtrl = conexionCtrl; + } + + public Integer getGrupo() { + return grupo; + } + + public void setGrupo(Integer grupo) { + this.grupo = grupo; + } + + public BigDecimal getPorSec1() { + return porSec1; + } + + public void setPorSec1(BigDecimal porSec1) { + this.porSec1 = porSec1; + } + + public BigDecimal getPorSec2() { + return porSec2; + } + + public void setPorSec2(BigDecimal porSec2) { + this.porSec2 = porSec2; + } + + public BigDecimal getPorSec3() { + return porSec3; + } + + public void setPorSec3(BigDecimal porSec3) { + this.porSec3 = porSec3; + } + + public BigDecimal getPorSec4() { + return porSec4; + } + + public void setPorSec4(BigDecimal porSec4) { + this.porSec4 = porSec4; + } + + public Integer getTiempoMin() { + return tiempoMin; + } + + public void setTiempoMin(Integer tiempoMin) { + this.tiempoMin = tiempoMin; + } + + public Integer getTiempoMax() { + return tiempoMax; + } + + public void setTiempoMax(Integer tiempoMax) { + this.tiempoMax = tiempoMax; + } + + public Boolean getIndisponible() { + return indisponible; + } + + public void setIndisponible(Boolean indisponible) { + this.indisponible = indisponible; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((conexionConfId == null) ? 0 : conexionConfId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConexionConf other = (ConexionConf) obj; + if (conexionConfId == null) { + if (other.conexionConfId != null) + return false; + } else if (!conexionConfId.equals(other.conexionConfId)) + return false; + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrl.java new file mode 100644 index 000000000..b0b535459 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrl.java @@ -0,0 +1,147 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "CONEXION_CTRL_SEQ", sequenceName = "CONEXION_CTRL_SEQ", allocationSize = 1) +@Table(name = "CONEXION_CTRL") +public class ConexionCtrl implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_CTRL_SEQ") + @Column(name = "CONEXIONCTRL_ID") + private Long conexionctrlId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ORIGEN_ID") + private Integer origenId; + @Column(name = "DESTINO_ID") + private Integer destinoId; + + @Transient + private Integer grupos; + + public ConexionCtrl() { + } + + public ConexionCtrl(Integer origenId, Integer destinoId, Integer grupos) { + this(); + this.origenId = origenId; + this.destinoId = destinoId; + this.grupos = grupos; + } + + public ConexionCtrl(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Long getConexionctrlId() { + return conexionctrlId; + } + + public void setConexionctrlId(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getConexionctrlId() != null ? getConexionctrlId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof ConexionCtrl)) { + return false; + } + ConexionCtrl other = (ConexionCtrl) object; + if ((this.getConexionctrlId() == null && other.getConexionctrlId() != null) || (this.getConexionctrlId() != null && !this.getConexionctrlId().equals(other.getConexionctrlId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.entidad.ConexionCtrl[ conexionctrlId=" + conexionctrlId + " ]"; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public Integer getGrupos() { + return grupos; + } + + public void setGrupos(Integer grupos) { + this.grupos = grupos; + } + + public boolean isOrigemDestinoIgual(Integer origemConexaoCtrl, Integer destinoConexaoCtrl) { + return getOrigenId().equals(origemConexaoCtrl) && getDestinoId().equals(destinoConexaoCtrl); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrlTemp.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrlTemp.java new file mode 100644 index 000000000..131ab1b99 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrlTemp.java @@ -0,0 +1,126 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "CONEXION_CTRL_SEQ", sequenceName = "CONEXION_CTRL_SEQ", allocationSize = 1) +@Table(name = "CONEXION_CTRL_TEMP") +public class ConexionCtrlTemp implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_CTRL_SEQ") + @Column(name = "CONEXIONCTRL_ID") + private Long conexionctrlId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ORIGEN_ID") + private Integer origenId; + @Column(name = "DESTINO_ID") + private Integer destinoId; + + public ConexionCtrlTemp() { + } + + public ConexionCtrlTemp(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Long getConexionctrlId() { + return conexionctrlId; + } + + public void setConexionctrlId(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + @Override + public int hashCode() { + int hash = 0; + hash += (conexionctrlId != null ? conexionctrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConexionCtrlTemp)) { + return false; + } + ConexionCtrlTemp other = (ConexionCtrlTemp) object; + if ((this.conexionctrlId == null && other.conexionctrlId != null) || (this.conexionctrlId != null && !this.conexionctrlId.equals(other.conexionctrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.entidad.ConexionCtrlTemp[ conexionctrlId=" + conexionctrlId + " ]"; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionDescuento.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionDescuento.java new file mode 100644 index 000000000..775b59911 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionDescuento.java @@ -0,0 +1,135 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "CONEXION_DESCUENTO_SEQ", sequenceName = "CONEXION_DESCUENTO_SEQ", allocationSize = 1) +@Table(name = "CONEXION_DESCUENTO") +public class ConexionDescuento { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_DESCUENTO_SEQ") + @Column(name = "CONEXIONDESCUENTO_ID") + private Long idConexionDescuento; + + @Column + private Boolean activo; + + @ManyToOne + @JoinColumn(name = "CONEXION_ID") + private Conexion conexion; + + @ManyToOne(targetEntity = ClaseServicio.class) + @JoinColumn(name = "CLASSESERVICIO_ID") + private ClaseServicio claseServicio; + + @Column + private Short secuencia; + + @Column + private Integer grupo; + + @Column + private BigDecimal descuento; + + @Column(name = "DESCUENTO_TASAEMBARQUE") + private BigDecimal descuentoTasaEmbarque; + + @Column + private Date fecModif; + + public Long getIdConexionDescuento() { + return idConexionDescuento; + } + + public void setIdConexionDescuento(Long idConexionDescuento) { + this.idConexionDescuento = idConexionDescuento; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Conexion getConexion() { + return conexion; + } + + public void setConexion(Conexion conexion) { + this.conexion = conexion; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Short getSecuencia() { + return secuencia; + } + + public void setSecuencia(Short secuencia) { + this.secuencia = secuencia; + } + + public Integer getGrupo() { + return grupo; + } + + public void setGrupo(Integer grupo) { + this.grupo = grupo; + } + + public BigDecimal getDescuento() { + return descuento; + } + + public void setDescuento(BigDecimal descuento) { + this.descuento = descuento; + } + + public Date getFecModif() { + return fecModif; + } + + public void setFecModif(Date fecModif) { + this.fecModif = fecModif; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof ConexionDescuento)) { + return false; + } + ConexionDescuento other = (ConexionDescuento) obj; + if(this.getClaseServicio()==null &&other.getClaseServicio()==null){ + return true; + } + return this.getClaseServicio().equals(other.getClaseServicio()); + } + + public BigDecimal getDescuentoTasaEmbarque() { + return descuentoTasaEmbarque; + } + + public void setDescuentoTasaEmbarque(BigDecimal descuentoTasaEmbarque) { + this.descuentoTasaEmbarque = descuentoTasaEmbarque; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcion.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcion.java new file mode 100644 index 000000000..a738a0312 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcion.java @@ -0,0 +1,134 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONEXION_EXCEPCION_SEQ", sequenceName = "CONEXION_EXCEPCION_SEQ", allocationSize = 1) +@Table(name = "CONEXION_EXCEPCION") +public class ConexionExcepcion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_EXCEPCION_SEQ") + @Column(name = "CONEXIONEXCEPCION_ID") + private Long conexionExcepcionId; + @Column(name = "NUMCORRIDA") + private Integer numcorrida; + @Column(name = "CONEXIONCTRL_ID") + private Long conexionctrlId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public ConexionExcepcion() { + } + + public ConexionExcepcion(Long conexionExcepcionId) { + this.conexionExcepcionId = conexionExcepcionId; + } + + public ConexionExcepcion(Long conexionExcepcionId, Integer numcorrida, Long conexionctrlId, Boolean activo, Date fecmodif, Integer usuarioId) { + this.conexionExcepcionId = conexionExcepcionId; + this.numcorrida = numcorrida; + this.conexionctrlId = conexionctrlId; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Long getConexionExcepcionId() { + return conexionExcepcionId; + } + + public void setConexionExcepcionId(Long conexionExcepcionId) { + this.conexionExcepcionId = conexionExcepcionId; + } + + public Integer getNumcorrida() { + return numcorrida; + } + + public void setNumcorrida(Integer numcorrida) { + this.numcorrida = numcorrida; + } + + public Long getConexionctrlId() { + return conexionctrlId; + } + + public void setConexionctrlId(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((conexionExcepcionId == null) ? 0 : conexionExcepcionId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConexionExcepcion other = (ConexionExcepcion) obj; + if (conexionExcepcionId == null) { + if (other.conexionExcepcionId != null) + return false; + } else if (!conexionExcepcionId.equals(other.conexionExcepcionId)) + return false; + return true; + } + + @Override + public String toString() { + return "ConexionExcepcion [conexionExcepcionId=" + conexionExcepcionId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcionRuta.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcionRuta.java new file mode 100644 index 000000000..bf107fe39 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionExcepcionRuta.java @@ -0,0 +1,78 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONEXION_EXCEPCION_RUTA_SEQ", sequenceName = "CONEXION_EXCEPCION_RUTA_SEQ", allocationSize = 1) +@Table(name = "CONEXION_EXCEPCION_RUTA") +public class ConexionExcepcionRuta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_EXCEPCION_RUTA_SEQ") + @Column(name = "CONEXIONEXCEPCIONRUTA_ID") + private Long conexionExcepcionRutaId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @Column(name = "CONEXIONCTRL_ID") + private Long conexionctrlId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + public Long getConexionExcepcionRutaId() { + return conexionExcepcionRutaId; + } + public void setConexionExcepcionRutaId(Long conexionExcepcionRutaId) { + this.conexionExcepcionRutaId = conexionExcepcionRutaId; + } + public Ruta getRuta() { + return ruta; + } + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + public Long getConexionctrlId() { + return conexionctrlId; + } + public void setConexionctrlId(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaConf.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaConf.java new file mode 100644 index 000000000..bddd2d280 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaConf.java @@ -0,0 +1,136 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author wallace + */ +@Entity +@SequenceGenerator(name = "CONEXION_RUTA_CONF_SEQ", sequenceName = "CONEXION_RUTA_CONF_SEQ", allocationSize = 1) +@Table(name = "CONEXION_RUTA_CONF") +public class ConexionRutaConf implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_RUTA_CONF_SEQ") + @Column(name = "CONEXIONRUTACONF_ID") + private Integer conexionRutaConfId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "DESCRICAO") + private String descricao; + @Column(name = "TIEMPOMIN") + private Integer tiempoMin; + @Column(name = "TIEMPOMAX") + private Integer tiempoMax; + + public ConexionRutaConf() { + super(); + } + + public Boolean getActivo() { + return activo; + } + + public Integer getConexionRutaConfId() { + return conexionRutaConfId; + } + + + public void setConexionRutaConfId(Integer conexionRutaConfId) { + this.conexionRutaConfId = conexionRutaConfId; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public Integer getTiempoMin() { + return tiempoMin; + } + + public void setTiempoMin(Integer tiempoMin) { + this.tiempoMin = tiempoMin; + } + + public Integer getTiempoMax() { + return tiempoMax; + } + + public void setTiempoMax(Integer tiempoMax) { + this.tiempoMax = tiempoMax; + } + + @Override + public String toString() { + return "ConexionRutaConf [descricao=" + descricao + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getConexionRutaConfId() == null) ? 0 : getConexionRutaConfId().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ConexionRutaConf)) + return false; + ConexionRutaConf other = (ConexionRutaConf) obj; + if (getConexionRutaConfId() == null) { + if (other.getConexionRutaConfId() != null) + return false; + } else if (!getConexionRutaConfId().equals(other.getConexionRutaConfId())) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaCtrl.java new file mode 100644 index 000000000..5d35b77a7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaCtrl.java @@ -0,0 +1,177 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author wallace + */ +@Entity +@SequenceGenerator(name = "CONEXION_RUTA_CTRL_SEQ", sequenceName = "CONEXION_RUTA_CTRL_SEQ", allocationSize = 1) +@Table(name = "CONEXION_RUTA_CTRL") +public class ConexionRutaCtrl implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_RUTA_CTRL_SEQ") + @Column(name = "CONEXIONRUTACTRL_ID") + private Long conexionRutaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @ManyToOne + @JoinColumn(name = "RUTA_ORIGEN_ID") + private Ruta rutaOrigen; + + @ManyToOne + @JoinColumn(name = "RUTA_DESTINO_ID") + private Ruta rutaDestino; + + @ManyToOne + @JoinColumn(name = "RUTA_DESTINOC_ID") + private Ruta rutaDestinoC; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CONEXIONRUTACONF_ID") + private ConexionRutaConf conexionRutaConf; + + public ConexionRutaCtrl() { + super(); + } + + public Boolean getActivo() { + return activo; + } + + public Long getConexionRutaId() { + return conexionRutaId; + } + + public void setConexionRutaId(Long conexionRutaId) { + this.conexionRutaId = conexionRutaId; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ConexionRutaConf getConexionRutaConf() { + return conexionRutaConf; + } + + public void setConexionRutaConf(ConexionRutaConf conexionRutaConf) { + this.conexionRutaConf = conexionRutaConf; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((conexionRutaId == null) ? 0 : conexionRutaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConexionRutaCtrl other = (ConexionRutaCtrl) obj; + if (conexionRutaId == null) { + if (other.conexionRutaId != null) + return false; + } else if (!conexionRutaId.equals(other.conexionRutaId)) + return false; + return true; + } + + public static ConexionRutaCtrl getConexionRutaCtrl(List list, Integer... rutas) { + if(rutas != null && rutas.length > 1) { + for (ConexionRutaCtrl conexionRutaCtrl : list) { + boolean isMatched = conexionRutaCtrl.getRutaOrigen() != null && conexionRutaCtrl.getRutaOrigen().getRutaId().equals(rutas[0]); + if(!isMatched) { + continue; + } + + isMatched = conexionRutaCtrl.getRutaDestino() != null && conexionRutaCtrl.getRutaDestino().getRutaId().equals(rutas[1]); + if(!isMatched) { + continue; + } + + if(rutas.length > 2 && conexionRutaCtrl.getRutaDestinoC() != null) { + isMatched = conexionRutaCtrl.getRutaDestinoC().getRutaId().equals(rutas[2]); + } + + if(isMatched) { + return conexionRutaCtrl; + } + } + } + throw new RuntimeException("ConexionRutaCtrl não identificada"); + } + + public Ruta getRutaOrigen() { + return rutaOrigen; + } + + public void setRutaOrigen(Ruta rutaOrigen) { + this.rutaOrigen = rutaOrigen; + } + + public Ruta getRutaDestino() { + return rutaDestino; + } + + public void setRutaDestino(Ruta rutaDestino) { + this.rutaDestino = rutaDestino; + } + + public Ruta getRutaDestinoC() { + return rutaDestinoC; + } + + public void setRutaDestinoC(Ruta rutaDestinoC) { + this.rutaDestinoC = rutaDestinoC; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionPtoVta.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionPtoVta.java new file mode 100644 index 000000000..0ff4a2353 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionPtoVta.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author wallace + */ +@Entity +@SequenceGenerator(name = "CONEXIORUTAEXCEPCIONPTOVTA_SEQ", sequenceName = "CONEXIORUTAEXCEPCIONPTOVTA_SEQ", allocationSize = 1) +@Table(name = "CONEXION_RUTA_EXCEPCION_PTOVTA") +public class ConexionRutaExcepcionPtoVta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXIORUTAEXCEPCIONPTOVTA_SEQ") + @Column(name = "CONEXIONRUTAPTOVTA_ID") + private Integer conexionRutaPtovtaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + @JoinColumn(name = "CONEXIONRUTACONF_ID", referencedColumnName = "CONEXIONRUTACONF_ID") + @ManyToOne + private ConexionRutaConf conexionRutaConf; + + public ConexionRutaExcepcionPtoVta() { + } + + public Integer getConexionRutaPtovtaId() { + return conexionRutaPtovtaId; + } + + public void setConexionRutaPtovtaId(Integer conexionRutaPtovtaId) { + this.conexionRutaPtovtaId = conexionRutaPtovtaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public ConexionRutaConf getConexionRutaConf() { + return conexionRutaConf; + } + + public void setConexionRutaConf(ConexionRutaConf conexionRutaConf) { + this.conexionRutaConf = conexionRutaConf; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getConexionRutaPtovtaId() != null ? getConexionRutaPtovtaId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof ConexionRutaExcepcionPtoVta)) { + return false; + } + ConexionRutaExcepcionPtoVta other = (ConexionRutaExcepcionPtoVta) object; + if ((this.getConexionRutaPtovtaId() == null && other.getConexionRutaPtovtaId() != null) || (this.getConexionRutaPtovtaId() != null && !this.getConexionRutaPtovtaId().equals(other.conexionRutaPtovtaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return puntoVenta.getNombpuntoventa(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionTipoPtoVta.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionTipoPtoVta.java new file mode 100644 index 000000000..230f7d498 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionTipoPtoVta.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author wallace + */ +@Entity +@SequenceGenerator(name = "CONEXIORUTAEXCEPCIOTIPOPTA_SEQ", sequenceName = "CONEXIORUTAEXCEPCIOTIPOPTA_SEQ", allocationSize = 1) +@Table(name = "CONEXION_RUTAEXCEPCIONTIPOPTA") +public class ConexionRutaExcepcionTipoPtoVta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXIORUTAEXCEPCIOTIPOPTA_SEQ") + @Column(name = "CONEXIONRUTATIPOPTOVTA_ID") + private Integer conexionRutatipoptovtaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @ManyToOne + @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") + private TipoPuntoVenta tipoPtovta; + + @JoinColumn(name = "CONEXIONRUTACONF_ID", referencedColumnName = "CONEXIONRUTACONF_ID") + @ManyToOne + private ConexionRutaConf conexionRutaConf; + + public ConexionRutaExcepcionTipoPtoVta() { + } + + public Integer getConexionRutatipoptovtaId() { + return conexionRutatipoptovtaId; + } + + public void setConexionRutatipoptovtaId(Integer conexionRutatipoptovtaId) { + this.conexionRutatipoptovtaId = conexionRutatipoptovtaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public TipoPuntoVenta getTipoPtovta() { + return tipoPtovta; + } + + public void setTipoPtovta(TipoPuntoVenta tipoPtovta) { + this.tipoPtovta = tipoPtovta; + } + + public ConexionRutaConf getConexionRutaConf() { + return conexionRutaConf; + } + + public void setConexionRutaConf(ConexionRutaConf conexionRutaConf) { + this.conexionRutaConf = conexionRutaConf; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getConexionRutatipoptovtaId() != null ? getConexionRutatipoptovtaId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof ConexionRutaExcepcionTipoPtoVta)) { + return false; + } + ConexionRutaExcepcionTipoPtoVta other = (ConexionRutaExcepcionTipoPtoVta) object; + if ((this.getConexionRutatipoptovtaId() == null && other.getConexionRutatipoptovtaId() != null) || (this.getConexionRutatipoptovtaId() != null && !this.conexionRutatipoptovtaId.equals(other.getConexionRutatipoptovtaId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return tipoPtovta.getDesctipo(); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaTramoCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaTramoCtrl.java new file mode 100644 index 000000000..4ed4ec73b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaTramoCtrl.java @@ -0,0 +1,198 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +/** + * + * @author wallace + */ +@Entity +@SequenceGenerator(name = "CONEXION_RUTA_TRAMO_CTRL_SEQ", sequenceName = "CONEXION_RUTA_TRAMO_CTRL_SEQ", allocationSize = 1) +@Table(name = "CONEXION_RUTA_TRAMO_CTRL") +public class ConexionRutaTramoCtrl implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_RUTA_TRAMO_CTRL_SEQ") + @Column(name = "CONEXIONRUTATRAMOCTRL_ID") + private Long conexionRutaTramoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @ManyToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origen; + + @ManyToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CONEXIONRUTACTRL_ID") + private ConexionRutaCtrl conexionRutaCtrl; + + @ManyToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + + @Transient + private Short secuencia; + @Transient + private boolean valido; + @Transient + private Integer grupo; + + public ConexionRutaTramoCtrl() { + super(); + } + + public ConexionRutaTramoCtrl(Long conexionRutaTramoId) { + this(); + this.conexionRutaTramoId = conexionRutaTramoId; + } + + public Boolean getActivo() { + return activo; + } + + public Long getConexionRutaTramoId() { + return conexionRutaTramoId; + } + + public void setConexionRutaTramoId(Long conexionRutaTramoId) { + this.conexionRutaTramoId = conexionRutaTramoId; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ConexionRutaCtrl getConexionRutaCtrl() { + return conexionRutaCtrl; + } + + public void setConexionRutaCtrl(ConexionRutaCtrl conexionRutaCtrl) { + this.conexionRutaCtrl = conexionRutaCtrl; + } + + public Short getSecuencia() { + return secuencia; + } + + public void setSecuencia(Short secuencia) { + this.secuencia = secuencia; + } + + public boolean isValido() { + return valido; + } + + public void setValido(boolean valido) { + this.valido = valido; + } + + public Integer getGrupo() { + return grupo; + } + + public void setGrupo(Integer grupo) { + this.grupo = grupo; + } + + public static Long getConexionRutaTramoConexionId(List conexiones) { + if(conexiones != null && !conexiones.isEmpty()) { + Conexion conexionRutaTramoCtrl = conexiones.get(0); + return conexionRutaTramoCtrl.getConexionRutaTramoId(); + } + return null; + + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((conexionRutaTramoId == null) ? 0 : conexionRutaTramoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ConexionRutaTramoCtrl)) + return false; + ConexionRutaTramoCtrl other = (ConexionRutaTramoCtrl) obj; + if (getConexionRutaTramoId() == null) { + if (other.getConexionRutaTramoId() != null) + return false; + } else if (!getConexionRutaTramoId().equals(other.getConexionRutaTramoId())) + return false; + return true; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionTemp.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionTemp.java new file mode 100644 index 000000000..d48a86058 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionTemp.java @@ -0,0 +1,156 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@Table(name = "CONEXION_TEMP") +@SequenceGenerator(name = "CONEXION_SEQ", sequenceName = "CONEXION_SEQ", allocationSize = 1) +public class ConexionTemp implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_SEQ") + @Column(name = "CONEXION_ID") + private Long conexionId; + @Column(name = "NUMGRUPO") + private Integer numgrupo; + @Column(name = "NUMSECUENCIA") + private Short numsecuencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ORIGEN_ID") + private Integer origenId; + @Column(name = "DESTINO_ID") + private Integer destinoId; + @Column(name = "CONEXIONCTRL_ID") + private Long conexionctrlId; + + public ConexionTemp() { + } + + public ConexionTemp(Long conexionId) { + this.conexionId = conexionId; + } + + public Long getConexionId() { + return conexionId; + } + + public void setConexionId(Long conexionId) { + this.conexionId = conexionId; + } + + public Integer getNumgrupo() { + return numgrupo; + } + + public void setNumgrupo(Integer numgrupo) { + this.numgrupo = numgrupo; + } + + public Short getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Short numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + @Override + public int hashCode() { + int hash = 0; + hash += (conexionId != null ? conexionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConexionTemp)) { + return false; + } + ConexionTemp other = (ConexionTemp) object; + if ((this.conexionId == null && other.conexionId != null) || (this.conexionId != null && !this.conexionId.equals(other.conexionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.entidad.ConexionTemp[ conexionId=" + conexionId + " ]"; + } + + public Long getConexionctrlId() { + return conexionctrlId; + } + + public void setConexionctrlId(Long conexionctrlId) { + this.conexionctrlId = conexionctrlId; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfContratoPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/ConfContratoPuntoVenta.java new file mode 100644 index 000000000..c6b68ba99 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfContratoPuntoVenta.java @@ -0,0 +1,122 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "conf_contrato_puntoVenta") +@SequenceGenerator(name = "CONFCONTRATOPUNTOVENTA_SEQ", sequenceName = "CONFCONTRATOPUNTOVENTA_SEQ", allocationSize = 1) +public class ConfContratoPuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONFCONTRATOPUNTOVENTA_SEQ") + @Column(name = "CONF_CONTRATO_PUNTOVENTA_ID") + private Integer confContratoPuntoVentaId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "TEXTOCONTRATOAVISTA") + private String textoContratoAVista; + @Column(name = "TEXTOCONTRATOPRAZO") + private String textoContratoPrazo; + + public Integer getConfigContratoPuntoVentaId() { + return confContratoPuntoVentaId; + } + + public void setConfContratoPuntoVentaId(Integer confContratoPuntoVentaId) { + this.confContratoPuntoVentaId = confContratoPuntoVentaId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + + public String getTextoContratoAVista() { + return textoContratoAVista; + } + + public void setTextoContratoAVista(String textoContratoAVista) { + this.textoContratoAVista = textoContratoAVista; + } + + public String getTextoContratoPrazo() { + return textoContratoPrazo; + } + + public void setTextoContratoPrazo(String textoContratoPrazo) { + this.textoContratoPrazo = textoContratoPrazo; + } + + public Integer getConfContratoPuntoVentaId() { + return confContratoPuntoVentaId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((confContratoPuntoVentaId == null) ? 0 : confContratoPuntoVentaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + ConfContratoPuntoVenta other = (ConfContratoPuntoVenta) obj; + if (confContratoPuntoVentaId == null) { + if (other.confContratoPuntoVentaId != null) + return false; + } else if (!confContratoPuntoVentaId.equals(other.confContratoPuntoVentaId)) + return false; + return true; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoCanalVenta.java b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoCanalVenta.java new file mode 100644 index 000000000..d8d0446d9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoCanalVenta.java @@ -0,0 +1,509 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.Where; + +@Entity +@SequenceGenerator(name = "CONF_RESTRICAO_CANALVENTA_SEQ", sequenceName = "CONF_RESTRICAO_CANALVENTA_SEQ", allocationSize = 1) +@Table(name = "CONF_RESTRICAO_CANALVENTA") +public class ConfRestricaoCanalVenta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_CANALVENTA_SEQ") + @Column(name = "CONFRESTRICAOCANALVENTA_ID") + private Long confRestricaoCanalVentaId; + @Column(name = "DESCCONFRESTRICAOCANALVENTA") + private String descConfRestricaoCanalVenta; + @OneToOne + @JoinColumn(name = "TIPOPTOVTA_ID") + @Deprecated + private TipoPuntoVenta tipoPuntoVenta; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + @Deprecated + private Parada origem; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + @Deprecated + private Parada destino; + @Column(name = "TEMPOPERMITIR") + @Deprecated + private Date tempoPermitir; + @Column(name = "CORRIDA_ID") + private Integer corridaId; + @Column(name = "FECCORRIDA") + private Date fecCorrida; + @Column(name = "SEGUNDA") + @Deprecated + private Boolean segunda; + @Column(name = "TERCA") + @Deprecated + private Boolean terca; + @Column(name = "QUARTA") + @Deprecated + private Boolean quarta; + @Column(name = "QUINTA") + @Deprecated + private Boolean quinta; + @Column(name = "SEXTA") + @Deprecated + private Boolean sexta; + @Column(name = "SABADO") + @Deprecated + private Boolean sabado; + @Column(name = "DOMINGO") + @Deprecated + private Boolean domingo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @OneToMany(mappedBy = "confRestricaoCanalVenta", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List lsConfRestricaoExcecao; + @OneToMany(mappedBy = "confRestricaoCanalVenta", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List lsConfRestricaoPtovta; + @Column(name = "INDEXIBECONSULTAVENDAWEB") + private Boolean indexibeconsultavendaweb; + @Column(name = "INDEXIBECORRIDABLOQ") + private Boolean indexibecorridabloq; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date feciniciovigencia; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinvigencia; + @Column(name = "INDRESTRICAODINAMICA") + private Boolean indRestricaoDinamica; + + @OneToMany(mappedBy = "confRestricaoCanalVenta", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @Where(clause="activo=1") + private List lsConfRestricaoTramo; + + @OneToMany(mappedBy = "confRestricaoCanalVenta", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List lsConfRestricaoOrgaoConcedente; + + @OneToMany(mappedBy = "confRestricaoCanalVenta", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List lsConfRestricaoRutas; + + @OneToMany(mappedBy = "confRestricaoCanalVenta", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List lsConfRestricaoTramoOC; + + public ConfRestricaoCanalVenta() { + super(); + indexibeconsultavendaweb = false; + indexibecorridabloq = false; + } + + public Long getConfRestricaoCanalVentaId() { + return confRestricaoCanalVentaId; + } + + public void setConfRestricaoCanalVentaId(Long confRestricaoCanalVentaId) { + this.confRestricaoCanalVentaId = confRestricaoCanalVentaId; + } + + public String getDescConfRestricaoCanalVenta() { + return descConfRestricaoCanalVenta; + } + + public void setDescConfRestricaoCanalVenta(String descConfRestricaoCanalVenta) { + this.descConfRestricaoCanalVenta = descConfRestricaoCanalVenta; + } + + @Deprecated + public TipoPuntoVenta getTipoPuntoVenta() { + return tipoPuntoVenta; + } + + @Deprecated + public void setTipoPuntoVenta(TipoPuntoVenta tipoPuntoVenta) { + this.tipoPuntoVenta = tipoPuntoVenta; + } + + @Deprecated + public Parada getOrigem() { + return origem; + } + @Deprecated + public void setOrigem(Parada origem) { + this.origem = origem; + } + @Deprecated + public Parada getDestino() { + return destino; + } + @Deprecated + public void setDestino(Parada destino) { + this.destino = destino; + } + @Deprecated + public Date getTempoPermitir() { + return tempoPermitir; + } + @Deprecated + public void setTempoPermitir(Date tempoPermitir) { + this.tempoPermitir = tempoPermitir; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Date getFecCorrida() { + return fecCorrida; + } + + public void setFecCorrida(Date fecCorrida) { + this.fecCorrida = fecCorrida; + } + @Deprecated + public Boolean getSegunda() { + return segunda; + } + @Deprecated + public void setSegunda(Boolean segunda) { + this.segunda = segunda; + } + @Deprecated + public Boolean getTerca() { + return terca; + } + @Deprecated + public void setTerca(Boolean terca) { + this.terca = terca; + } + @Deprecated + public Boolean getQuarta() { + return quarta; + } + @Deprecated + public void setQuarta(Boolean quarta) { + this.quarta = quarta; + } + @Deprecated + public Boolean getQuinta() { + return quinta; + } + @Deprecated + public void setQuinta(Boolean quinta) { + this.quinta = quinta; + } + @Deprecated + public Boolean getSexta() { + return sexta; + } + @Deprecated + public void setSexta(Boolean sexta) { + this.sexta = sexta; + } + @Deprecated + public Boolean getSabado() { + return sabado; + } + @Deprecated + public void setSabado(Boolean sabado) { + this.sabado = sabado; + } + @Deprecated + public Boolean getDomingo() { + return domingo; + } + @Deprecated + public void setDomingo(Boolean domingo) { + this.domingo = domingo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Boolean getIndexibeconsultavendaweb() { + return indexibeconsultavendaweb; + } + + public void setIndexibeconsultavendaweb(Boolean indexibeconsultavendaweb) { + this.indexibeconsultavendaweb = indexibeconsultavendaweb; + } + + public Boolean getIndexibecorridabloq() { + return indexibecorridabloq; + } + + public void setIndexibecorridabloq(Boolean indexibecorridabloq) { + this.indexibecorridabloq = indexibecorridabloq; + } + + public List getLsConfRestricaoExcecao() { + if (this.lsConfRestricaoExcecao != null) { + List lsTemp = new ArrayList(); + + for (ConfRestricaoExcecao cre : this.lsConfRestricaoExcecao) { + if (cre.getActivo() == Boolean.TRUE) { + lsTemp.add(cre); + } + } + + lsConfRestricaoExcecao = lsTemp; + return lsConfRestricaoExcecao; + } + + return null; + } + + public void setLsConfRestricaoExcecao(List lsConfRestricaoExcecao) { + this.lsConfRestricaoExcecao = lsConfRestricaoExcecao; + } + + + public List getLsConfRestricaoOrgaoConcedente() { + if (this.lsConfRestricaoOrgaoConcedente != null) { + List lsTemp = new ArrayList(); + + for (ConfRestricaoOrgaoConcedente cre : this.lsConfRestricaoOrgaoConcedente) { + if (cre.getActivo() == Boolean.TRUE) { + lsTemp.add(cre); + } + } + + lsConfRestricaoOrgaoConcedente = lsTemp; + return lsConfRestricaoOrgaoConcedente; + } + + return null; + } + + public void setLsConfRestricaoOrgaoConcedente(List lsConfRestricaoOrgaoConcedente) { + this.lsConfRestricaoOrgaoConcedente = lsConfRestricaoOrgaoConcedente; + } + + public List getLsConfRestricaoRutas() { + if (this.lsConfRestricaoRutas != null) { + List lsTemp = new ArrayList(); + + for (ConfRestricaoRutas cre : this.lsConfRestricaoRutas) { + if (cre.getActivo() == Boolean.TRUE) { + lsTemp.add(cre); + } + } + + lsConfRestricaoRutas = lsTemp; + return lsConfRestricaoRutas; + } + + return null; + } + + public void setLsConfRestricaoRutas(List lsConfRestricaoRutas) { + this.lsConfRestricaoRutas = lsConfRestricaoRutas; + } + + public List getLsConfRestricaoTramoOC() { + if (this.lsConfRestricaoTramoOC != null) { + List lsTemp = new ArrayList(); + + for (ConfRestricaoTramoOC cre : this.lsConfRestricaoTramoOC) { + if (cre.getActivo() == Boolean.TRUE) { + lsTemp.add(cre); + } + } + + lsConfRestricaoTramoOC = lsTemp; + return lsConfRestricaoTramoOC; + } + + return null; + } + + public void setLsConfRestricaoTramoOC(List lsConfRestricaoTramoOC) { + this.lsConfRestricaoTramoOC = lsConfRestricaoTramoOC; + } + + public List getLsConfRestricaoPtovta() { + if (this.lsConfRestricaoPtovta != null) { + List lsTemp = new ArrayList(); + + for (ConfRestricaoPtovta cre : this.lsConfRestricaoPtovta) { + if (cre.getActivo() == Boolean.TRUE) { + lsTemp.add(cre); + } + } + + lsConfRestricaoPtovta = lsTemp; + return lsConfRestricaoPtovta; + } + + return null; + } + + public void setLsConfRestricaoPtovta(List lsConfRestricaoPtovta) { + this.lsConfRestricaoPtovta = lsConfRestricaoPtovta; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Date getFeciniciovigencia() { + return feciniciovigencia; + } + + public void setFeciniciovigencia(Date feciniciovigencia) { + this.feciniciovigencia = feciniciovigencia; + } + + public Date getFecfinvigencia() { + return fecfinvigencia; + } + + public void setFecfinvigencia(Date fecfinvigencia) { + this.fecfinvigencia = fecfinvigencia; + } + + public List getLsConfRestricaoTramo() { + if(lsConfRestricaoTramo== null) { + lsConfRestricaoTramo = new ArrayList(); + } + return lsConfRestricaoTramo; + } + + public void setLsConfRestricaoTramo(List lsConfRestricaoTramo) { + this.lsConfRestricaoTramo = lsConfRestricaoTramo; + } + + + public Boolean getIndRestricaoDinamica() { + return indRestricaoDinamica; + } + + public void setIndRestricaoDinamica(Boolean indRestricaoDinamica) { + this.indRestricaoDinamica = indRestricaoDinamica; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((confRestricaoCanalVentaId == null) ? 0 : confRestricaoCanalVentaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfRestricaoCanalVenta other = (ConfRestricaoCanalVenta) obj; + if (confRestricaoCanalVentaId == null) { + if (other.confRestricaoCanalVentaId != null) + return false; + } else if (!confRestricaoCanalVentaId.equals(other.confRestricaoCanalVentaId)) + return false; + return true; + } + + public ConfRestricaoCanalVenta getNewConfRestricaoCanalVenta(ConfRestricaoCanalVenta oldConfRestricaoCanalVenta) { + ConfRestricaoCanalVenta newConfRestricaoCanalVenda = new ConfRestricaoCanalVenta(); + newConfRestricaoCanalVenda.setActivo(oldConfRestricaoCanalVenta.getActivo()); + newConfRestricaoCanalVenda.setCorridaId(oldConfRestricaoCanalVenta.getCorridaId()); + newConfRestricaoCanalVenda.setDescConfRestricaoCanalVenta(oldConfRestricaoCanalVenta.getDescConfRestricaoCanalVenta()); + newConfRestricaoCanalVenda.setDestino(oldConfRestricaoCanalVenta.getDestino()); + newConfRestricaoCanalVenda.setDomingo(oldConfRestricaoCanalVenta.getDomingo()); + newConfRestricaoCanalVenda.setEmpresa(oldConfRestricaoCanalVenta.getEmpresa()); + newConfRestricaoCanalVenda.setFecCorrida(oldConfRestricaoCanalVenta.getFecCorrida()); + newConfRestricaoCanalVenda.setFecfinvigencia(oldConfRestricaoCanalVenta.getFecfinvigencia()); + newConfRestricaoCanalVenda.setFeciniciovigencia(oldConfRestricaoCanalVenta.getFeciniciovigencia()); + newConfRestricaoCanalVenda.setFecmodif(new Date()); + newConfRestricaoCanalVenda.setIndexibeconsultavendaweb(oldConfRestricaoCanalVenta.getIndexibeconsultavendaweb()); + newConfRestricaoCanalVenda.setIndexibecorridabloq(oldConfRestricaoCanalVenta.getIndexibecorridabloq()); + newConfRestricaoCanalVenda.setLsConfRestricaoExcecao(oldConfRestricaoCanalVenta.getLsConfRestricaoExcecao()); + newConfRestricaoCanalVenda.setLsConfRestricaoPtovta(oldConfRestricaoCanalVenta.getLsConfRestricaoPtovta()); + newConfRestricaoCanalVenda.setLsConfRestricaoTramo(oldConfRestricaoCanalVenta.getLsConfRestricaoTramo()); + newConfRestricaoCanalVenda.setOrigem(oldConfRestricaoCanalVenta.getOrigem()); + newConfRestricaoCanalVenda.setQuarta(oldConfRestricaoCanalVenta.getQuarta()); + newConfRestricaoCanalVenda.setQuinta(oldConfRestricaoCanalVenta.getQuinta()); + newConfRestricaoCanalVenda.setRuta(oldConfRestricaoCanalVenta.getRuta()); + newConfRestricaoCanalVenda.setSabado(oldConfRestricaoCanalVenta.getSabado()); + newConfRestricaoCanalVenda.setSegunda(oldConfRestricaoCanalVenta.getSegunda()); + newConfRestricaoCanalVenda.setSexta(oldConfRestricaoCanalVenta.getSexta()); + newConfRestricaoCanalVenda.setTempoPermitir(oldConfRestricaoCanalVenta.getTempoPermitir()); + newConfRestricaoCanalVenda.setTerca(oldConfRestricaoCanalVenta.getTerca()); + newConfRestricaoCanalVenda.setTipoPuntoVenta(oldConfRestricaoCanalVenta.getTipoPuntoVenta()); + newConfRestricaoCanalVenda.setUsuarioId(oldConfRestricaoCanalVenta.getUsuarioId()); + newConfRestricaoCanalVenda.setLsConfRestricaoOrgaoConcedente(oldConfRestricaoCanalVenta.getLsConfRestricaoOrgaoConcedente()); + newConfRestricaoCanalVenda.setLsConfRestricaoRutas(oldConfRestricaoCanalVenta.getLsConfRestricaoRutas()); + newConfRestricaoCanalVenda.setLsConfRestricaoTramoOC(oldConfRestricaoCanalVenta.getLsConfRestricaoTramoOC()); + + return newConfRestricaoCanalVenda; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoExcecao.java b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoExcecao.java new file mode 100644 index 000000000..02aeeab71 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoExcecao.java @@ -0,0 +1,150 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONF_RESTRICAO_EXCECAO_SEQ", sequenceName = "CONF_RESTRICAO_EXCECAO_SEQ", allocationSize = 1) +@Table(name = "CONF_RESTRICAO_EXCECAO") +public class ConfRestricaoExcecao implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "CONFRESTRICAOEXCECAO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_EXCECAO_SEQ") + private Integer confRestricaoExcecaoId; + @JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID", referencedColumnName = "CONFRESTRICAOCANALVENTA_ID") + @ManyToOne + private ConfRestricaoCanalVenta confRestricaoCanalVenta; + @Column(name = "FECEXCECAO") + private Date fecExcecao; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONFRESTRICAOTRAMO_ID", referencedColumnName = "CONFRESTRICAOTRAMO_ID") + @OneToOne + private ConfRestricaoTramo confRestricaoTramo; + + + public Integer getConfRestricaoExcecaoId() { + return confRestricaoExcecaoId; + } + + public void setConfRestricaoExcecaoId(Integer confRestricaoExcecaoId) { + this.confRestricaoExcecaoId = confRestricaoExcecaoId; + } + + public ConfRestricaoCanalVenta getConfRestricaoCanalVenta() { + return confRestricaoCanalVenta; + } + + public void setConfRestricaoCanalVenta(ConfRestricaoCanalVenta confRestricaoCanalVenta) { + this.confRestricaoCanalVenta = confRestricaoCanalVenta; + } + + public Date getFecExcecao() { + return fecExcecao; + } + + public void setFecExcecao(Date fecExcecao) { + this.fecExcecao = fecExcecao; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ConfRestricaoTramo getConfRestricaoTramo() { + return confRestricaoTramo; + } + + public void setConfRestricaoTramo(ConfRestricaoTramo confRestricaoTramo) { + this.confRestricaoTramo = confRestricaoTramo; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activo == null) ? 0 : activo.hashCode()); + result = prime * result + ((confRestricaoTramo == null) ? 0 : confRestricaoTramo.hashCode()); + result = prime * result + ((fecExcecao == null) ? 0 : fecExcecao.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof ConfRestricaoExcecao)) { + return false; + } + ConfRestricaoExcecao other = (ConfRestricaoExcecao) obj; + if (activo == null) { + if (other.activo != null) { + return false; + } + } else if (!activo.equals(other.activo)) { + return false; + } + if (confRestricaoTramo == null) { + if (other.confRestricaoTramo != null) { + return false; + } + } else if (!confRestricaoTramo.equals(other.confRestricaoTramo)) { + return false; + } + if (fecExcecao == null) { + if (other.fecExcecao != null) { + return false; + } + } else if (!fecExcecao.equals(other.fecExcecao)) { + return false; + } + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoOrgaoConcedente.java b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoOrgaoConcedente.java new file mode 100644 index 000000000..e0c787185 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoOrgaoConcedente.java @@ -0,0 +1,132 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONF_REST_ORGAOCONCEDENTE_SEQ", sequenceName = "CONF_REST_ORGAOCONCEDENTE_SEQ", allocationSize = 1) +@Table(name = "CONF_REST_ORGAOCONCEDENTE") +public class ConfRestricaoOrgaoConcedente implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_REST_ORGAOCONCEDENTE_SEQ") + @Column(name = "CONFRESTORGAOCONCEDENTE_ID") + private Long confRestOrgaoConcedenteId; + + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + + @JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID", referencedColumnName = "CONFRESTRICAOCANALVENTA_ID") + @ManyToOne + private ConfRestricaoCanalVenta confRestricaoCanalVenta; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public ConfRestricaoOrgaoConcedente() { + super(); + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Long getConfRestOrgaoConcedenteId() { + return confRestOrgaoConcedenteId; + } + + public void setConfRestOrgaoConcedenteId(Long confRestOrgaoConcedenteId) { + this.confRestOrgaoConcedenteId = confRestOrgaoConcedenteId; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public ConfRestricaoCanalVenta getConfRestricaoCanalVenta() { + return confRestricaoCanalVenta; + } + + public void setConfRestricaoCanalVenta(ConfRestricaoCanalVenta confRestricaoCanalVenta) { + this.confRestricaoCanalVenta = confRestricaoCanalVenta; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((orgaoConcedente == null) ? 0 : orgaoConcedente.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfRestricaoOrgaoConcedente other = (ConfRestricaoOrgaoConcedente) obj; + if (orgaoConcedente == null) { + if (other.orgaoConcedente != null) + return false; + } else if (!orgaoConcedente.equals(other.orgaoConcedente)) + return false; + return true; + } + + @Override + public String toString() { + return "ConfRestricaoOrgaoConcedente [confRestOrgaoConcedenteId=" + confRestOrgaoConcedenteId + ", orgaoConcedente=" + orgaoConcedente + ", confRestricaoCanalVenta=" + confRestricaoCanalVenta + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoPtovta.java b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoPtovta.java new file mode 100644 index 000000000..777f24eec --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoPtovta.java @@ -0,0 +1,157 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONF_RESTRICAO_PTOVTA_SEQ", sequenceName = "CONF_RESTRICAO_PTOVTA_SEQ", allocationSize = 1) +@Table(name = "CONF_RESTRICAO_PTOVTA") +public class ConfRestricaoPtovta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_PTOVTA_SEQ") + @Column(name = "CONFRESTRICAOPTOVTA_ID") + private Integer confRestricaoPtovtaId; + @JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID", referencedColumnName = "CONFRESTRICAOCANALVENTA_ID") + @ManyToOne + private ConfRestricaoCanalVenta confRestricaoCanalVenta; + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONFRESTRICAOTRAMO_ID", referencedColumnName = "CONFRESTRICAOTRAMO_ID") + @OneToOne + private ConfRestricaoTramo confRestricaoTramo; + + public Integer getConfRestricaoPtovtaId() { + return confRestricaoPtovtaId; + } + + public void setConfRestricaoPtovtaId(Integer confRestricaoPtovtaId) { + this.confRestricaoPtovtaId = confRestricaoPtovtaId; + } + + public ConfRestricaoCanalVenta getConfRestricaoCanalVenta() { + return confRestricaoCanalVenta; + } + + public void setConfRestricaoCanalVenta(ConfRestricaoCanalVenta confRestricaoCanalVenta) { + this.confRestricaoCanalVenta = confRestricaoCanalVenta; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ConfRestricaoTramo getConfRestricaoTramo() { + return confRestricaoTramo; + } + + public void setConfRestricaoTramo(ConfRestricaoTramo confRestricaoTramo) { + this.confRestricaoTramo = confRestricaoTramo; + } + + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activo == null) ? 0 : activo.hashCode()); + result = prime * result + ((confRestricaoTramo == null) ? 0 : confRestricaoTramo.hashCode()); + result = prime * result + ((puntoVenta == null) ? 0 : puntoVenta.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof ConfRestricaoPtovta)) { + return false; + } + ConfRestricaoPtovta other = (ConfRestricaoPtovta) obj; + if (activo == null) { + if (other.activo != null) { + return false; + } + } else if (!activo.equals(other.activo)) { + return false; + } + if (confRestricaoTramo == null) { + if (other.confRestricaoTramo != null) { + return false; + } + } else if (!confRestricaoTramo.equals(other.confRestricaoTramo)) { + return false; + } + if (puntoVenta == null) { + if (other.puntoVenta != null) { + return false; + } + } else if (!puntoVenta.equals(other.puntoVenta)) { + return false; + } + return true; + } + + @Override + public String toString() { + return "ConfRestricaoPtovta [confRestricaoPtovtaId=" + confRestricaoPtovtaId + ", confRestricaoCanalVenta=" + confRestricaoCanalVenta + ", puntoVenta=" + puntoVenta + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoRutas.java b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoRutas.java new file mode 100644 index 000000000..a65af418c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoRutas.java @@ -0,0 +1,132 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONF_REST_RUTAS_SEQ", sequenceName = "CONF_REST_RUTAS_SEQ", allocationSize = 1) +@Table(name = "CONF_REST_RUTAS") +public class ConfRestricaoRutas implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_REST_RUTAS_SEQ") + @Column(name = "CONFRESTRUTAS_ID") + private Long confRestRutasId; + + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + + @JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID", referencedColumnName = "CONFRESTRICAOCANALVENTA_ID") + @ManyToOne + private ConfRestricaoCanalVenta confRestricaoCanalVenta; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public ConfRestricaoRutas() { + super(); + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Long getConfRestRutasId() { + return confRestRutasId; + } + + public void setConfRestRutasId(Long confRestRutasId) { + this.confRestRutasId = confRestRutasId; + } + + public ConfRestricaoCanalVenta getConfRestricaoCanalVenta() { + return confRestricaoCanalVenta; + } + + public void setConfRestricaoCanalVenta(ConfRestricaoCanalVenta confRestricaoCanalVenta) { + this.confRestricaoCanalVenta = confRestricaoCanalVenta; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((ruta == null) ? 0 : ruta.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfRestricaoRutas other = (ConfRestricaoRutas) obj; + if (ruta == null) { + if (other.ruta != null) + return false; + } else if (!ruta.equals(other.ruta)) + return false; + return true; + } + + @Override + public String toString() { + return "ConfRestricaoRutas [confRestRutasId=" + confRestRutasId + ", ruta=" + ruta + ", confRestricaoCanalVenta=" + confRestricaoCanalVenta + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoTramo.java b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoTramo.java new file mode 100644 index 000000000..cc86cb512 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoTramo.java @@ -0,0 +1,274 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONF_RESTRICAO_TRAMO_SEQ", sequenceName = "CONF_RESTRICAO_TRAMO_SEQ", allocationSize = 1) +@Table(name = "CONF_RESTRICAO_TRAMO") +public class ConfRestricaoTramo implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_TRAMO_SEQ") + @Column(name = "CONFRESTRICAOTRAMO_ID") + private Long confRestricaoTramoId; + + @JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID", referencedColumnName = "CONFRESTRICAOCANALVENTA_ID") + @ManyToOne + private ConfRestricaoCanalVenta confRestricaoCanalVenta; + @OneToOne + @JoinColumn(name = "TIPOPTOVTA_ID") + private TipoPuntoVenta tipoPuntoVenta; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origem; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + @Column(name = "TEMPOPERMITIR") + private Date tempoPermitir; + + @Column(name = "SEGUNDA") + private Boolean segunda; + @Column(name = "TERCA") + private Boolean terca; + @Column(name = "QUARTA") + private Boolean quarta; + @Column(name = "QUINTA") + private Boolean quinta; + @Column(name = "SEXTA") + private Boolean sexta; + @Column(name = "SABADO") + private Boolean sabado; + @Column(name = "DOMINGO") + private Boolean domingo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getConfRestricaoTramoId() { + return confRestricaoTramoId; + } + + public void setConfRestricaoTramoId(Long confRestricaoTramoId) { + this.confRestricaoTramoId = confRestricaoTramoId; + } + + public ConfRestricaoCanalVenta getConfRestricaoCanalVenta() { + return confRestricaoCanalVenta; + } + + public void setConfRestricaoCanalVenta(ConfRestricaoCanalVenta confRestricaoCanalVenta) { + this.confRestricaoCanalVenta = confRestricaoCanalVenta; + } + + public TipoPuntoVenta getTipoPuntoVenta() { + return tipoPuntoVenta; + } + + public void setTipoPuntoVenta(TipoPuntoVenta tipoPuntoVenta) { + this.tipoPuntoVenta = tipoPuntoVenta; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Date getTempoPermitir() { + return tempoPermitir; + } + + public void setTempoPermitir(Date tempoPermitir) { + this.tempoPermitir = tempoPermitir; + } + + public Boolean getSegunda() { + return segunda; + } + + public void setSegunda(Boolean segunda) { + this.segunda = segunda; + } + + public Boolean getTerca() { + return terca; + } + + public void setTerca(Boolean terca) { + this.terca = terca; + } + + public Boolean getQuarta() { + return quarta; + } + + public void setQuarta(Boolean quarta) { + this.quarta = quarta; + } + + public Boolean getQuinta() { + return quinta; + } + + public void setQuinta(Boolean quinta) { + this.quinta = quinta; + } + + public Boolean getSexta() { + return sexta; + } + + public void setSexta(Boolean sexta) { + this.sexta = sexta; + } + + public Boolean getSabado() { + return sabado; + } + + public void setSabado(Boolean sabado) { + this.sabado = sabado; + } + + public Boolean getDomingo() { + return domingo; + } + + public void setDomingo(Boolean domingo) { + this.domingo = domingo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + if (confRestricaoTramoId != null) + builder.append(confRestricaoTramoId).append(" - "); + if (tipoPuntoVenta != null) + builder.append(tipoPuntoVenta).append(" - "); + if (origem != null) + builder.append(origem).append(" - "); + if (destino != null) + builder.append(destino); + return builder.toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activo == null) ? 0 : activo.hashCode()); + result = prime * result + ((confRestricaoCanalVenta == null) ? 0 : confRestricaoCanalVenta.hashCode()); + result = prime * result + ((destino == null) ? 0 : destino.hashCode()); + result = prime * result + ((origem == null) ? 0 : origem.hashCode()); + result = prime * result + ((tipoPuntoVenta == null) ? 0 : tipoPuntoVenta.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof ConfRestricaoTramo)) { + return false; + } + ConfRestricaoTramo other = (ConfRestricaoTramo) obj; + if (activo == null) { + if (other.activo != null) { + return false; + } + } else if (!activo.equals(other.activo)) { + return false; + } + if (confRestricaoCanalVenta == null) { + if (other.confRestricaoCanalVenta != null) { + return false; + } + } else if (!confRestricaoCanalVenta.equals(other.confRestricaoCanalVenta)) { + return false; + } + if (destino == null) { + if (other.destino != null) { + return false; + } + } else if (!destino.equals(other.destino)) { + return false; + } + if (origem == null) { + if (other.origem != null) { + return false; + } + } else if (!origem.equals(other.origem)) { + return false; + } + if (tipoPuntoVenta == null) { + if (other.tipoPuntoVenta != null) { + return false; + } + } else if (!tipoPuntoVenta.equals(other.tipoPuntoVenta)) { + return false; + } + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoTramoOC.java b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoTramoOC.java new file mode 100644 index 000000000..40ff14477 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoTramoOC.java @@ -0,0 +1,149 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONF_REST_TRAMOOC_SEQ", sequenceName = "CONF_REST_TRAMOOC_SEQ", allocationSize = 1) +@Table(name = "CONF_REST_TRAMOOC") +public class ConfRestricaoTramoOC implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_REST_TRAMOOC_SEQ") + @Column(name = "CONFRESTTRAMOOC_ID") + private Long confRestTramoOCId; + + @OneToOne + @JoinColumn(name = "ORIGEM_ID") + private Parada origem; + + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + + @JoinColumn(name = "CONFRESTRICAOCANALVENTA_ID", referencedColumnName = "CONFRESTRICAOCANALVENTA_ID") + @ManyToOne + private ConfRestricaoCanalVenta confRestricaoCanalVenta; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public ConfRestricaoTramoOC() { + super(); + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ConfRestricaoCanalVenta getConfRestricaoCanalVenta() { + return confRestricaoCanalVenta; + } + + public void setConfRestricaoCanalVenta(ConfRestricaoCanalVenta confRestricaoCanalVenta) { + this.confRestricaoCanalVenta = confRestricaoCanalVenta; + } + + public Long getConfRestTramoOCId() { + return confRestTramoOCId; + } + + public void setConfRestTramoOCId(Long confRestTramoOCId) { + this.confRestTramoOCId = confRestTramoOCId; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((destino == null) ? 0 : destino.hashCode()); + result = prime * result + ((origem == null) ? 0 : origem.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfRestricaoTramoOC other = (ConfRestricaoTramoOC) obj; + if (destino == null) { + if (other.destino != null) + return false; + } else if (!destino.equals(other.destino)) + return false; + if (origem == null) { + if (other.origem != null) + return false; + } else if (!origem.equals(other.origem)) + return false; + return true; + } + + @Override + public String toString() { + return "ConfRestricaoTramoOC [confRestTramoOCId=" + confRestTramoOCId + ", origem=" + origem + ", destino=" + destino + ", confRestricaoCanalVenta=" + confRestricaoCanalVenta + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoVendaWeb.java b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoVendaWeb.java new file mode 100644 index 000000000..9f657efec --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfRestricaoVendaWeb.java @@ -0,0 +1,80 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONF_RESTRICAO_VENDAWEB_SEQ", sequenceName = "CONF_RESTRICAO_VENDAWEB_SEQ", allocationSize = 1) +@Table(name = "CONF_RESTRICAO_VENDAWEB") +public class ConfRestricaoVendaWeb implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_RESTRICAO_VENDAWEB_SEQ") + @Column(name = "CONFRESTRICAOVENDAWEB_ID") + private Integer confRestricaoVendaWebId; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "valor") + private Double valor; + + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getConfRestricaoVendaWebId() { + return confRestricaoVendaWebId; + } + public void setConfRestricaoVendaWebId(Integer confRestricaoVendaWebId) { + this.confRestricaoVendaWebId = confRestricaoVendaWebId; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Double getValor() { + return valor; + } + public void setValor(Double valor) { + this.valor = valor; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfTotem.java b/src/com/rjconsultores/ventaboletos/entidad/ConfTotem.java new file mode 100644 index 000000000..551ba9e74 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfTotem.java @@ -0,0 +1,110 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CONF_TOTEM_SEQ", sequenceName = "CONF_TOTEM_SEQ",allocationSize=1) +@Table(name = "CONF_TOTEM") +public class ConfTotem implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONF_TOTEM_SEQ") + @Column(name = "CONFTOTEM_ID") + private Integer confTotemId; + @Column(name = "VALOR") + private String valor; + @Column(name = "CHAVE") + private String chave; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getConfTotemId() { + return confTotemId; + } + public void setConfTotemId(Integer confTotemId) { + this.confTotemId = confTotemId; + } + + public ConfTotem() { + super(); + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((confTotemId == null) ? 0 : confTotemId.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfTotem other = (ConfTotem) obj; + if (confTotemId == null) { + if (other.confTotemId != null) + return false; + } else if (!confTotemId.equals(other.confTotemId)) + return false; + return true; + } + + public String getValor() { + return valor; + } + public void setValor(String valor) { + this.valor = valor; + } + + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public String getChave() { + return chave; + } + public void setChave(String chave) { + this.chave = chave; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Conferencia.java b/src/com/rjconsultores/ventaboletos/entidad/Conferencia.java new file mode 100644 index 000000000..0350786d4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Conferencia.java @@ -0,0 +1,289 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import com.rjconsultores.ventaboletos.enums.comissao.CoresConferencia; + +@Entity +@Table(name = "CONFERENCIA") +@SequenceGenerator(name = "CONFERENCIA_SEQ", sequenceName = "CONFERENCIA_SEQ", allocationSize = 1) +public class Conferencia implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONFERENCIA_SEQ") + @Column(name = "CONFERENCIA_ID") + private Long conferenciaId; + + @Temporal(TemporalType.DATE) + @Column(name = "DATAMOVIMENTO") + private Date datamovimento; + + @Column(name = "INDBOLETOGERADO") + private Boolean indboletogerado; + + @Column(name = "INDCONFERIDO") + private Boolean indconferido; + + @Column(name = "INDPENDENCIA") + private Boolean indpendencia; + + @Column(name = "INDSEMMOVIMENTO") + private Boolean indsemmovimento; + + @Column(name = "INDMALOTERECEBIDO") + private Boolean indmaloterecebido; + + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "DATAMALOTE") + private Date datamalote; + + @Column(name = "USUARIO_MALOTE_ID") + private Integer usuarioMaloteId; + + @Transient + private CoresConferencia cor; + + @Transient + private String numfoliosistema; + + @Transient + private boolean semPendenciaConferencia; + + @Transient + private String competencia; + + @Transient + private Date dataInicial; + + @Transient + private Date dataFinal; + + public Conferencia() { + super(); + this.indboletogerado = Boolean.FALSE; + this.indconferido = Boolean.FALSE; + this.indpendencia = Boolean.FALSE; + this.indsemmovimento = Boolean.FALSE; + this.indmaloterecebido = Boolean.FALSE; + } + + public Long getConferenciaId() { + return conferenciaId; + } + + public void setConferenciaId(Long conferenciaId) { + this.conferenciaId = conferenciaId; + } + + public Date getDatamovimento() { + return datamovimento; + } + + public void setDatamovimento(Date datamovimento) { + this.datamovimento = datamovimento; + } + + public Boolean getIndboletogerado() { + return indboletogerado; + } + + public void setIndboletogerado(Boolean indboletogerado) { + this.indboletogerado = indboletogerado; + } + + public Boolean getIndconferido() { + return indconferido; + } + + public void setIndconferido(Boolean indconferido) { + this.indconferido = indconferido; + } + + public Boolean getIndpendencia() { + return indpendencia; + } + + public void setIndpendencia(Boolean indpendencia) { + this.indpendencia = indpendencia; + } + + public Boolean getIndsemmovimento() { + return indsemmovimento; + } + + public void setIndsemmovimento(Boolean indsemmovimento) { + this.indsemmovimento = indsemmovimento; + } + + public Boolean getIndmaloterecebido() { + return indmaloterecebido; + } + + public void setIndmaloterecebido(Boolean indmaloterecebido) { + this.indmaloterecebido = indmaloterecebido; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((conferenciaId == null) ? 0 : conferenciaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + Conferencia other = (Conferencia) obj; + if (conferenciaId == null) { + if (other.conferenciaId != null) + return false; + } else if (!conferenciaId.equals(other.conferenciaId)) + return false; + return true; + } + + public CoresConferencia getCor() { + return cor; + } + + public void setCor(CoresConferencia cor) { + this.cor = cor; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getNumfoliosistema() { + return numfoliosistema; + } + + public void setNumfoliosistema(String numfoliosistema) { + this.numfoliosistema = numfoliosistema; + } + + public Date getDatamalote() { + return datamalote; + } + + public void setDatamalote(Date datamalote) { + this.datamalote = datamalote; + } + + public Integer getUsuarioMaloteId() { + return usuarioMaloteId; + } + + public void setUsuarioMaloteId(Integer usuarioMaloteId) { + this.usuarioMaloteId = usuarioMaloteId; + } + + public boolean isSemPendenciaConferencia() { + return semPendenciaConferencia; + } + + public void setSemPendenciaConferencia(boolean semPendenciaConferencia) { + this.semPendenciaConferencia = semPendenciaConferencia; + } + + public String getCompetencia() { + return competencia; + } + + public void setCompetencia(String competencia) { + this.competencia = competencia; + } + + public Date getDataInicial() { + return dataInicial; + } + + public void setDataInicial(Date dataInicial) { + this.dataInicial = dataInicial; + } + + public Date getDataFinal() { + return dataFinal; + } + + public void setDataFinal(Date dataFinal) { + this.dataFinal = dataFinal; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConferenciaPendencia.java b/src/com/rjconsultores/ventaboletos/entidad/ConferenciaPendencia.java new file mode 100644 index 000000000..e7e458489 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConferenciaPendencia.java @@ -0,0 +1,127 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "CONFERENCIA_PENDENCIA") +@SequenceGenerator(name = "CONFERENCIA_PENDENCIA_SEQ", sequenceName = "CONFERENCIA_PENDENCIA_SEQ", allocationSize = 1) +public class ConferenciaPendencia implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONFERENCIA_PENDENCIA_SEQ") + @Column(name = "CONFERENCIAPENDENCIA_ID") + private Integer conferenciapendenciaId; + + @Column(name = "DESCPENDENCIA") + private String descpendencia; + + @Column(name = "ACTIVO") + private boolean activo; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "USUARIO_ID") + private Usuario usuario; + + public ConferenciaPendencia() { + super(); + } + + public ConferenciaPendencia(Integer conferenciapendenciaId, String descpendencia) { + this(); + this.conferenciapendenciaId = conferenciapendenciaId; + this.descpendencia = descpendencia; + } + + public Integer getConferenciapendenciaId() { + return conferenciapendenciaId; + } + + public void setConferenciapendenciaId(Integer conferenciapendenciaId) { + this.conferenciapendenciaId = conferenciapendenciaId; + } + + public String getDescpendencia() { + return descpendencia; + } + + public void setDescpendencia(String descpendencia) { + this.descpendencia = descpendencia; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((conferenciapendenciaId == null) ? 0 : conferenciapendenciaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ConferenciaPendencia)) + return false; + ConferenciaPendencia other = (ConferenciaPendencia) obj; + if (getConferenciapendenciaId() == null) { + if (other.getConferenciapendenciaId() != null) + return false; + } else if (!getConferenciapendenciaId().equals(other.getConferenciapendenciaId())) + return false; + return true; + } + + @Override + public String toString() { + return getDescpendencia(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfigRestriccionPago.java b/src/com/rjconsultores/ventaboletos/entidad/ConfigRestriccionPago.java new file mode 100644 index 000000000..927ec24b3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfigRestriccionPago.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CONFIG_RESTRICCION_PAGO_SEQ", sequenceName = "CONFIG_RESTRICCION_PAGO_SEQ",allocationSize=1) +@Table(name = "CONFIG_RESTRICCION_PAGO") +public class ConfigRestriccionPago implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONFIG_RESTRICCION_PAGO_SEQ") + @Column(name = "CONFIGRESTRICCION_ID") + private Integer configrestriccionId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RESTRICCION_ID", referencedColumnName = "RESTRICCION_ID") + @ManyToOne + private RestriccionPago restriccion; + @JoinColumn(name = "FORMAPAGO_ID", referencedColumnName = "FORMAPAGO_ID") + @ManyToOne + private FormaPago formaPago; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + public ConfigRestriccionPago() { + } + + public ConfigRestriccionPago(Integer configrestriccionId) { + this.configrestriccionId = configrestriccionId; + } + + public Integer getConfigrestriccionId() { + return configrestriccionId; + } + + public void setConfigrestriccionId(Integer configrestriccionId) { + this.configrestriccionId = configrestriccionId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public RestriccionPago getRestriccion() { + return restriccion; + } + + public void setRestriccion(RestriccionPago restriccion) { + this.restriccion = restriccion; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getConfigrestriccionId() != null ? getConfigrestriccionId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConfigRestriccionPago)) { + return false; + } + ConfigRestriccionPago other = (ConfigRestriccionPago) object; + if ((this.getConfigrestriccionId() == null && other.getConfigrestriccionId() != null) || (this.getConfigrestriccionId() != null && !this.getConfigrestriccionId().equals(other.getConfigrestriccionId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago[configrestriccionId=" + configrestriccionId + "]"; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Constante.java b/src/com/rjconsultores/ventaboletos/entidad/Constante.java new file mode 100644 index 000000000..a834a9c57 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Constante.java @@ -0,0 +1,156 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CONSTANTE_SEQ", sequenceName = "CONSTANTE_SEQ", allocationSize = 1) +@Table(name = "CONSTANTE") +public class Constante implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONSTANTE_SEQ") + @Column(name = "CONSTANTE_ID") + private Integer constanteId; + @Column(name = "NOMBCONSTANTE") + private String nombconstante; + @Column(name = "DESCCONSTANTE") + private String descconstante; + @Column(name = "INDTIPOCONSTANTE") + private String indtipoconstante; + @Column(name = "VALORCONSTANTE") + private String valorconstante; + @Column(name = "INDMANTENIMIENTOUSUARIO") + private Boolean indmantenimientousuario; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Constante() { + } + + public Constante(Integer constanteId) { + this.constanteId = constanteId; + } + + public Integer getConstanteId() { + return constanteId; + } + + public void setConstanteId(Integer constanteId) { + this.constanteId = constanteId; + } + + public String getNombconstante() { + return nombconstante; + } + + public void setNombconstante(String nombconstante) { + this.nombconstante = nombconstante; + } + + public String getDescconstante() { + return descconstante; + } + + public void setDescconstante(String descconstante) { + this.descconstante = descconstante; + } + + public String getIndtipoconstante() { + return indtipoconstante; + } + + public void setIndtipoconstante(String indtipoconstante) { + this.indtipoconstante = indtipoconstante; + } + + public String getValorconstante() { + return valorconstante; + } + + public void setValorconstante(String valorconstante) { + this.valorconstante = valorconstante; + } + + public Boolean getIndmantenimientousuario() { + return indmantenimientousuario; + } + + public void setIndmantenimientousuario(Boolean indmantenimientousuario) { + this.indmantenimientousuario = indmantenimientousuario; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (constanteId != null ? constanteId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Constante)) { + return false; + } + Constante other = (Constante) object; + if ((this.constanteId == null && other.constanteId != null) || (this.constanteId != null && !this.constanteId.equals(other.constanteId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Constante[constanteId=" + constanteId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ContaCorrentePtoVta.java b/src/com/rjconsultores/ventaboletos/entidad/ContaCorrentePtoVta.java new file mode 100644 index 000000000..2a6ed0e65 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ContaCorrentePtoVta.java @@ -0,0 +1,405 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "CONTA_CORRENTE_PTOVTA") +@SequenceGenerator(name = "CONTA_CORRENTE_PTOVTA_SEQ", sequenceName = "CONTA_CORRENTE_PTOVTA_SEQ", allocationSize = 1) +public class ContaCorrentePtoVta implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONTA_CORRENTE_PTOVTA_SEQ") + @Column(name = "CONTACORRENTEPTOVTA_ID") + private Long contaCorrentePtoVtaId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Temporal(TemporalType.DATE) + @Column(name = "FECHOROPERACION") + private Date fecHorOperacion; + + @Column(name = "DESCOPERACION") + private String descOperacion; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "TURNO_ID") + private Turno turno; + + @Temporal(TemporalType.DATE) + @Column(name = "FECCORTE") + private Date fecCorte; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "USUARIO_ID") + private Usuario usuario; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "TIPOOPERACIONCC_ID") + private TipoOperacionCC tipoOperacionCC; + + @Column(name = "IMPORTE") + private BigDecimal importe; + + @Column(name = "IMPORTETARIFA") + private BigDecimal importeTotalTarifa; + + @Column(name = "IMPORTEPEDAGIO") + private BigDecimal importeTotalPedagio; + + @Column(name = "IMPORTETAXAEMBARQUE") + private BigDecimal importeTotalTasaAbordaje; + + @Column(name = "IMPORTESEGURO") + private BigDecimal importeTotalSeguro; + + @Column(name = "IMPORTEINGRESO") + private BigDecimal importeTotalIngreso; + + @Column(name = "IMPORTEEGRESO") + private BigDecimal importeTotalEgreso; + + @Column(name = "IMPORTEDEVOLUCION") + private BigDecimal importeTotalDevolucion; + + @Column(name = "IMPORTETROCA") + private BigDecimal importeTotalTransferencia; + + @Column(name = "IMPORTETOTALEFECTIVO") + private BigDecimal importeTotalEfectivo; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "USUARIOMODIF_ID") + private Integer usuarioModifId; + + @Column(name = "TOTALVENTA_SEGOPCIONAL") + private BigDecimal totalVentaSegOpcional; + + @Column(name = "TOTALCANC_SEGOPCIONAL") + private BigDecimal totalCancSegOpcional; + + @Column(name = "FECHAMENTOCNTCORRENTE_ID") + private Long fechamentocntcorrenteId; + + @Column(name = "IND_COMISSAO") + private Boolean indComissao; + + @Column(name = "IMPORTETOTALDEBITO") + private BigDecimal importetotalDebito; + + @Column(name = "IMPORTETOTALCREDITO") + private BigDecimal importetotalCredito; + + public ContaCorrentePtoVta() { + super(); + } + + public ContaCorrentePtoVta(Long contaCorrentePtoVtaId) { + this(); + this.contaCorrentePtoVtaId = contaCorrentePtoVtaId; + } + + public Long getContaCorrentePtoVtaId() { + return contaCorrentePtoVtaId; + } + + public void setContaCorrentePtoVtaId(Long contaCorrentePtoVtaId) { + this.contaCorrentePtoVtaId = contaCorrentePtoVtaId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Date getFecHorOperacion() { + return fecHorOperacion; + } + + public void setFecHorOperacion(Date fecHorOperacion) { + this.fecHorOperacion = fecHorOperacion; + } + + public String getDescOperacion() { + return descOperacion; + } + + public void setDescOperacion(String descOperacion) { + this.descOperacion = descOperacion; + } + + public Turno getTurno() { + return turno; + } + + public void setTurno(Turno turno) { + this.turno = turno; + } + + public Date getFecCorte() { + return fecCorte; + } + + public void setFecCorte(Date fecCorte) { + this.fecCorte = fecCorte; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public TipoOperacionCC getTipoOperacionCC() { + return tipoOperacionCC; + } + + public void setTipoOperacionCC(TipoOperacionCC tipoOperacionCC) { + this.tipoOperacionCC = tipoOperacionCC; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioModifId() { + return usuarioModifId; + } + + public void setUsuarioModifId(Integer usuarioModifId) { + this.usuarioModifId = usuarioModifId; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public BigDecimal getImporteTotalTarifa() { + return importeTotalTarifa; + } + + public void setImporteTotalTarifa(BigDecimal importeTotalTarifa) { + this.importeTotalTarifa = importeTotalTarifa; + } + + public BigDecimal getImporteTotalPedagio() { + return importeTotalPedagio; + } + + public void setImporteTotalPedagio(BigDecimal importeTotalPedagio) { + this.importeTotalPedagio = importeTotalPedagio; + } + + public BigDecimal getImporteTotalTasaAbordaje() { + return importeTotalTasaAbordaje; + } + + public void setImporteTotalTasaAbordaje(BigDecimal importeTotalTasaAbordaje) { + this.importeTotalTasaAbordaje = importeTotalTasaAbordaje; + } + + public BigDecimal getImporteTotalSeguro() { + return importeTotalSeguro; + } + + public void setImporteTotalSeguro(BigDecimal importeTotalSeguro) { + this.importeTotalSeguro = importeTotalSeguro; + } + + public BigDecimal getImporteTotalIngreso() { + return importeTotalIngreso; + } + + public void setImporteTotalIngreso(BigDecimal importeTotalIngreso) { + this.importeTotalIngreso = importeTotalIngreso; + } + + public BigDecimal getImporteTotalEgreso() { + return importeTotalEgreso; + } + + public void setImporteTotalEgreso(BigDecimal importeTotalEgreso) { + this.importeTotalEgreso = importeTotalEgreso; + } + + public BigDecimal getImporteTotalDevolucion() { + return importeTotalDevolucion; + } + + public void setImporteTotalDevolucion(BigDecimal importeTotalDevolucion) { + this.importeTotalDevolucion = importeTotalDevolucion; + } + + public BigDecimal getImporteTotalTransferencia() { + return importeTotalTransferencia; + } + + public void setImporteTotalTransferencia(BigDecimal importeTotalTransferencia) { + this.importeTotalTransferencia = importeTotalTransferencia; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((contaCorrentePtoVtaId == null) ? 0 : contaCorrentePtoVtaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ContaCorrentePtoVta other = (ContaCorrentePtoVta) obj; + if (contaCorrentePtoVtaId == null) { + if (other.contaCorrentePtoVtaId != null) + return false; + } else if (!contaCorrentePtoVtaId.equals(other.contaCorrentePtoVtaId)) + return false; + + return true; + } + + @Override + public String toString() { + try { + return "ContaCorrentePtoVta [contaCorrentePtoVtaId=" + + contaCorrentePtoVtaId + ", puntoVenta=" + puntoVenta.getPuntoventaId() + + ", empresa=" + empresa.getEmpresaId() + ", fecHorOperacion=" + + fecHorOperacion + ", descOperacion=" + descOperacion + + ", turno=" + turno.getTurnoId() + ", fecCorte=" + fecCorte + ", usuario=" + + usuario.getUsuarioId() + ", tipoOperacionCC=" + tipoOperacionCC.getTipoOperacionCCId() + + ", importe=" + importe + ", importeTotalTarifa=" + + importeTotalTarifa + ", importeTotalPedagio=" + + importeTotalPedagio + ", importeTotalTasaAbordaje=" + + importeTotalTasaAbordaje + ", importeTotalSeguro=" + + importeTotalSeguro + ", importeTotalIngreso=" + + importeTotalIngreso + ", importeTotalEgreso=" + + importeTotalEgreso + ", importeTotalDevolucion=" + + importeTotalDevolucion + ", importeTotalTransferencia=" + + importeTotalTransferencia + ", activo=" + activo + + ", fecmodif=" + fecmodif + ", usuarioModifId=" + + usuarioModifId + "]"; + } catch (Throwable e) { + return super.toString(); + } + } + + public BigDecimal getTotalVentaSegOpcional() { + return totalVentaSegOpcional; + } + + public void setTotalVentaSegOpcional(BigDecimal totalVentaSegOpcional) { + this.totalVentaSegOpcional = totalVentaSegOpcional; + } + + public BigDecimal getTotalCancSegOpcional() { + return totalCancSegOpcional; + } + + public void setTotalCancSegOpcional(BigDecimal totalCancSegOpcional) { + this.totalCancSegOpcional = totalCancSegOpcional; + } + + public BigDecimal getImporteTotalEfectivo() { + return importeTotalEfectivo; + } + + public void setImporteTotalEfectivo(BigDecimal importeTotalEfectivo) { + this.importeTotalEfectivo = importeTotalEfectivo; + } + + public Long getFechamentocntcorrenteId() { + return fechamentocntcorrenteId; + } + + public void setFechamentocntcorrenteId(Long fechamentocntcorrenteId) { + this.fechamentocntcorrenteId = fechamentocntcorrenteId; + } + + public Boolean getIndComissao() { + return indComissao; + } + + public void setIndComissao(Boolean indComissao) { + this.indComissao = indComissao; + } + + public BigDecimal getImportetotalDebito() { + return importetotalDebito; + } + + public void setImportetotalDebito(BigDecimal importetotalDebito) { + this.importetotalDebito = importetotalDebito; + } + + public BigDecimal getImportetotalCredito() { + return importetotalCredito; + } + + public void setImportetotalCredito(BigDecimal importetotalCredito) { + this.importetotalCredito = importetotalCredito; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/ContaMD.java b/src/com/rjconsultores/ventaboletos/entidad/ContaMD.java new file mode 100644 index 000000000..c1604ec54 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ContaMD.java @@ -0,0 +1,207 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "MDCONTA_SEQ", sequenceName = "MDCONTA_SEQ", allocationSize = 1) +@Table(name = "MD_CONTA") +public class ContaMD implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MDCONTA_SEQ") + @Column(name = "CONTA_ID") + private Integer contaId; + + @Column(name = "NOME") + private String nome; + + @Column(name = "TIPO") + private String tipo; + + @Column(name = "CODIGOCONTABIL") + private Integer codigoContabil; + + @Column(name = "DOCASSOCIADO") + private Boolean docAssociado; + + @Column(name = "CANCELAMENTO") + private Boolean cancelamento; + + @Column(name = "STATUS") + private Boolean status; + + @Column(name = "ORIGEM") + private String origem; + + @Column(name = "REFERENCIA") + private String referencia; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "ACTIVO") + private Boolean activo; + + public ContaMD() { + + } + + public Integer getContaId() { + return contaId; + } + + public void setContaId(Integer contaId) { + this.contaId = contaId; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public String getTipo() { + return tipo; + } + + public void setTipo(String tipo) { + this.tipo = tipo; + } + + public Integer getCodigoContabil() { + return codigoContabil; + } + + public void setCodigoContabil(Integer codigoContabil) { + this.codigoContabil = codigoContabil; + } + + public Boolean getDocAssociado() { + return docAssociado; + } + + public void setDocAssociado(Boolean docAssociado) { + this.docAssociado = docAssociado; + } + + public Boolean getCancelamento() { + return cancelamento; + } + + public void setCancelamento(Boolean cancelamento) { + this.cancelamento = cancelamento; + } + + public Boolean getStatus() { + return status; + } + + public void setStatus(Boolean status) { + this.status = status; + } + + public String getOrigem() { + return origem; + } + + public void setOrigem(String origem) { + this.origem = origem; + } + + public String getReferencia() { + return referencia; + } + + public void setReferencia(String referencia) { + this.referencia = referencia; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getTipoDesc() { + if (tipo == null) { + return ""; + } + + return tipo.equals("C") ? "Crédito" : "Débito"; + } + + public String getStatusDesc() { + if (status == null) { + return ""; + } + + return status ? "Ativo" : "Inativo"; + } + + @Override + public String toString() { + return getNome(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getContaId() == null) ? 0 : getContaId().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ContaMD)) + return false; + ContaMD other = (ContaMD) obj; + if (getContaId() == null) { + if (other.getContaId() != null) + return false; + } else if (!getContaId().equals(other.getContaId())) + return false; + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ControleEstoqueMigracao.java b/src/com/rjconsultores/ventaboletos/entidad/ControleEstoqueMigracao.java new file mode 100644 index 000000000..6f67648ef --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ControleEstoqueMigracao.java @@ -0,0 +1,81 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AbastoCentral generated by hbm2java + */ +@Entity +@Table(name = "CTRL_EST_MIGRACAO") +public class ControleEstoqueMigracao implements java.io.Serializable { + + private Long ctrlestmigracaoId; + private PuntoVenta puntoventa; + private Date fecmodif; + private Integer usuarioId; + + public ControleEstoqueMigracao() { + } + + public ControleEstoqueMigracao(PuntoVenta _puntoventa, Date _fecmodif, Integer _usuarioId) { + puntoventa = _puntoventa; + fecmodif = _fecmodif; + usuarioId = _usuarioId; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoventa() { + return this.puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @SequenceGenerator(name = "CTRL_EST_MIGRACAO_SEQ", sequenceName = "CTRL_EST_MIGRACAO_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CTRL_EST_MIGRACAO_SEQ") + @Column(name = "CTRLESTMIGRACAO_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getCtrlestmigracaoId() { + return ctrlestmigracaoId; + } + + public void setCtrlestmigracaoId(Long ctrlestmigracaoId) { + this.ctrlestmigracaoId = ctrlestmigracaoId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Convenio.java b/src/com/rjconsultores/ventaboletos/entidad/Convenio.java new file mode 100644 index 000000000..afba3c800 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Convenio.java @@ -0,0 +1,373 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CONVENIO_SEQ", sequenceName = "CONVENIO_SEQ", allocationSize = 1) +@Table(name = "CONVENIO") +public class Convenio implements Serializable { + + public static final Short IMPRIME_PRECO_TOTAL = 1; + public static final Short IMPRIME_PRECO_MENOS_DESCONTO = 2; + public static final Short IMPRIME_DESCONTO = 3; + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_SEQ") + @Basic(optional = false) + @Column(name = "CONVENIO_ID") + private Integer convenioId; + + @Column(name = "DESCCONVENIO") + private String descconvenio; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "CVECONVENIO") + private String cveconvenio; + + @Column(name = "VALIDAFOLIO") + private Boolean validafolio; + + @Column(name = "IMPRIMEPRECIO") + private Short imprimeprecio; + + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + private List convenioDetList; + + @OneToMany(mappedBy = "convenio", cascade = CascadeType.ALL) + private List convenioTramoList; + + @OneToMany(mappedBy = "convenio", cascade = CascadeType.ALL) + private List convenioUsuarioList; + + @OneToMany(mappedBy = "convenio", cascade = CascadeType.ALL) + private List convenioPuntoVentaList; + + @OneToMany(mappedBy = "convenio", cascade = CascadeType.ALL) + private List convenioEmpresaList; + + @OneToMany(mappedBy = "convenio", cascade = CascadeType.ALL) + private List convenioRutaList; + + @Column(name = "FECVENTAINI") + @Temporal(TemporalType.TIMESTAMP) + private Date fecVentaInicial; + + @Column(name = "FECVENTAFIN") + @Temporal(TemporalType.TIMESTAMP) + private Date fecVentaFinal; + + @Column(name = "FECVIAJEINI") + @Temporal(TemporalType.TIMESTAMP) + private Date fecViajeInicial; + + @Column(name = "FECVIAJEFIN") + @Temporal(TemporalType.TIMESTAMP) + private Date fecViajeFinal; + + @Column(name = "INDDESCUENTONORMAL") + private Integer indDescuentoNormal; + + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID") + private Cliente cliente; + + @Column(name = "INDGERAL") + private Short indGeral; + + public Cliente getCliente() { + return cliente; + } + + public void setCliente(Cliente cliente) { + this.cliente = cliente; + } + + public Convenio() { + } + + public Convenio(Integer convenioId) { + this.convenioId = convenioId; + } + + public Integer getConvenioId() { + return convenioId; + } + + public void setConvenioId(Integer convenioId) { + this.convenioId = convenioId; + } + + public String getDescconvenio() { + return descconvenio; + } + + public void setDescconvenio(String descconvenio) { + this.descconvenio = descconvenio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getCveconvenio() { + return cveconvenio; + } + + public void setCveconvenio(String cveconvenio) { + this.cveconvenio = cveconvenio; + } + + public Boolean getValidafolio() { + return validafolio; + } + + public void setValidafolio(Boolean validafolio) { + this.validafolio = validafolio; + } + + public Short getImprimeprecio() { + return imprimeprecio; + } + + public void setImprimeprecio(Short imprimeprecio) { + this.imprimeprecio = imprimeprecio; + } + + public List getConvenioDetList() { + List tmp = new ArrayList(); + if (convenioDetList != null) { + for (ConvenioDet cd : this.convenioDetList) { + if (cd.getActivo()) { + tmp.add(cd); + } + } + } + + return tmp; + } + + public void setConvenioDetList(List convenioDetList) { + this.convenioDetList = convenioDetList; + } + + public List getConvenioTramoList() { + List tempList = new ArrayList(); + + if (convenioTramoList != null) { + for (ConvenioTramo convenioTramo : this.convenioTramoList) { + if(convenioTramo.getActivo()) { + tempList.add(convenioTramo); + } + } + } + + return tempList; + } + + public List getConvenioUsuarioList() { + List tempList = new ArrayList(); + + if (convenioUsuarioList != null) { + for (ConvenioUsuario convenioUsuario : this.convenioUsuarioList) { + if (convenioUsuario.getActivo()) { + tempList.add(convenioUsuario); + } + } + } + + return tempList; + } + + public List getConvenioPuntoVentaList() { + List tempList = new ArrayList(); + + if (convenioPuntoVentaList != null) { + for (ConvenioPuntoVenta convenioPuntoVenta : this.convenioPuntoVentaList) { + if (convenioPuntoVenta.getActivo()) { + tempList.add(convenioPuntoVenta); + } + } + } + + return tempList; + } + + public void setConvenioPuntoVentaList(List convenioPuntoVentaList) { + this.convenioPuntoVentaList = convenioPuntoVentaList; + } + + public List getConvenioEmpresaList() { + List tempList = new ArrayList(); + + if (convenioEmpresaList != null) { + for (ConvenioEmpresa convenioEmpresa : this.convenioEmpresaList) { + if (convenioEmpresa.getActivo()) { + tempList.add(convenioEmpresa); + } + } + } + + return tempList; + } + + public List getConvenioRutaList() { + List tempList = new ArrayList(); + + if (convenioRutaList != null) { + for (ConvenioRuta convenioRuta : this.convenioRutaList) { + if (convenioRuta.getActivo()) { + tempList.add(convenioRuta); + } + } + } + + return tempList; + } + + public void setConvenioRutaList(List convenioRutaList) { + this.convenioRutaList = convenioRutaList; + } + + public void setConvenioEmpresaList(List convenioEmpresaList) { + this.convenioEmpresaList = convenioEmpresaList; + } + + public void setConvenioUsuarioList(List convenioUsuarioList) { + this.convenioUsuarioList = convenioUsuarioList; + } + + public void setConvenioTramoList(List convenioTramoList) { + this.convenioTramoList = convenioTramoList; + } + + public Date getFecVentaInicial() { + return fecVentaInicial; + } + + public void setFecVentaInicial(Date fecVentaInicial) { + this.fecVentaInicial = fecVentaInicial; + } + + public Date getFecVentaFinal() { + return fecVentaFinal; + } + + public void setFecVentaFinal(Date fecVentaFinal) { + this.fecVentaFinal = fecVentaFinal; + } + + public Date getFecViajeInicial() { + return fecViajeInicial; + } + + public void setFecViajeInicial(Date fecViajeInicial) { + this.fecViajeInicial = fecViajeInicial; + } + + public Date getFecViajeFinal() { + return fecViajeFinal; + } + + public void setFecViajeFinal(Date fecViajeFinal) { + this.fecViajeFinal = fecViajeFinal; + } + + public Integer getIndDescuentoNormal() { + return indDescuentoNormal; + } + + public void setIndDescuentoNormal(Integer indDescuentoNormal) { + this.indDescuentoNormal = indDescuentoNormal; + } + + public Short getIndGeral() { + return indGeral; + } + + public void setIndGeral(Short indGeral) { + this.indGeral = indGeral; + } + + + @Override + public int hashCode() { + int hash = 0; + hash += (convenioId != null ? convenioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Convenio)) { + return false; + } + Convenio other = (Convenio) object; + if ((this.convenioId == null && other.convenioId != null) || (this.convenioId != null && !this.convenioId.equals(other.convenioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Convenio[convenioId=" + convenioId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConvenioDet.java b/src/com/rjconsultores/ventaboletos/entidad/ConvenioDet.java new file mode 100644 index 000000000..994b81b87 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConvenioDet.java @@ -0,0 +1,191 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "CONVENIO_DET_SEQ", sequenceName = "CONVENIO_DET_SEQ", allocationSize = 1) +@Table(name = "CONVENIO_DET") +public class ConvenioDet implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_DET_SEQ") + @Basic(optional = false) + @Column(name = "CONVENIODET_ID") + private Integer conveniodetId; + + @Column(name = "PORCDESCUENTO") /* Refere-se ao desconto na tarifa */ + private BigDecimal porcdescuento; + @Column(name = "PORCDESCUENTOTAXAEMBARQUE") + private BigDecimal porcDescuentoTaxaEmbarque; + @Column(name = "PORCDESCUENTOPEDAGIO") + private BigDecimal porcDescuentoPedagio; + @Column(name = "PORCDESCUENTOSEGURO") + private BigDecimal porcDescuentoSeguro; + @Column(name = "PORCOUTROS") + private BigDecimal porcOutros; + + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "NUMFOLIOINICIAL") + private Long numfolioinicial; + @Column(name = "NUMFOLIOFINAL") + private Long numfoliofinal; + @Column(name = "QUANTIDADE") + private Long quantidade; + + public ConvenioDet() { + } + + public ConvenioDet(Integer conveniodetId) { + this.conveniodetId = conveniodetId; + } + + public Integer getConveniodetId() { + return conveniodetId; + } + + public void setConveniodetId(Integer conveniodetId) { + this.conveniodetId = conveniodetId; + } + + public BigDecimal getPorcdescuento() { + return porcdescuento; + } + + public void setPorcdescuento(BigDecimal porcdescuento) { + this.porcdescuento = porcdescuento; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Long getNumfolioinicial() { + return numfolioinicial; + } + + public void setNumfolioinicial(Long numfolioinicio) { + this.numfolioinicial = numfolioinicio; + } + + public Long getNumfoliofinal() { + return numfoliofinal; + } + + public void setNumfoliofinal(Long numfoliofinal) { + this.numfoliofinal = numfoliofinal; + } + + public BigDecimal getPorcDescuentoTaxaEmbarque() { + return porcDescuentoTaxaEmbarque; + } + + public void setPorcDescuentoTaxaEmbarque(BigDecimal porcDescuentoTaxaEmbarque) { + this.porcDescuentoTaxaEmbarque = porcDescuentoTaxaEmbarque; + } + + public BigDecimal getPorcDescuentoPedagio() { + return porcDescuentoPedagio; + } + + public void setPorcDescuentoPedagio(BigDecimal porcDescuentoPedagio) { + this.porcDescuentoPedagio = porcDescuentoPedagio; + } + + public BigDecimal getPorcDescuentoSeguro() { + return porcDescuentoSeguro; + } + + public void setPorcDescuentoSeguro(BigDecimal porcDescuentoSeguro) { + this.porcDescuentoSeguro = porcDescuentoSeguro; + } + + public Long getQuantidade() { + return quantidade; + } + + public void setQuantidade(Long quantidade) { + this.quantidade = quantidade; + } + + public BigDecimal getPorcOutros() { + return porcOutros; + } + + public void setPorcOutros(BigDecimal porcOutros) { + this.porcOutros = porcOutros; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (conveniodetId != null ? conveniodetId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConvenioDet)) { + return false; + } + + ConvenioDet other = (ConvenioDet) object; + if ((this.conveniodetId == null && other.conveniodetId != null) || (this.conveniodetId != null && !this.conveniodetId.equals(other.conveniodetId))) { + return false; + } + + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioDet[conveniodetId=" + conveniodetId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConvenioEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/ConvenioEmpresa.java new file mode 100644 index 000000000..192b7924a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConvenioEmpresa.java @@ -0,0 +1,106 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="CONVENIO_EMPRESA_SEQ", sequenceName="CONVENIO_EMPRESA_SEQ", allocationSize=1) +@Table(name="CONVENIO_EMPRESA") +public class ConvenioEmpresa implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_EMPRESA_SEQ") + @Column(name = "CONVENIOEMPRESA_ID") + private Integer convenioEmpresaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + @ManyToOne + private Convenio convenio; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + public Integer getConvenioEmpresaId() { + return convenioEmpresaId; + } + public void setConvenioEmpresaId(Integer convenioEmpresaId) { + this.convenioEmpresaId = convenioEmpresaId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Convenio getConvenio() { + return convenio; + } + public void setConvenio(Convenio convenio) { + this.convenio = convenio; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (convenioEmpresaId != null ? convenioEmpresaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConvenioEmpresa)) { + return false; + } + ConvenioEmpresa other = (ConvenioEmpresa) object; + if ((this.convenioEmpresaId == null && other.convenioEmpresaId != null) || (this.convenioEmpresaId != null && !this.convenioEmpresaId.equals(other.convenioEmpresaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioEmpresa[convenioEmpresaId=" + convenioEmpresaId + "]"; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConvenioPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/ConvenioPuntoVenta.java new file mode 100644 index 000000000..b64402861 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConvenioPuntoVenta.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="CONVENIO_PTOVTA_SEQ", sequenceName="CONVENIO_PTOVTA_SEQ", allocationSize=1) +@Table(name="CONVENIO_PTOVTA") +public class ConvenioPuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_PTOVTA_SEQ") + @Column(name = "CONVENIOPTOVTA_ID") + private Integer convenioPuntoVentaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + @ManyToOne + private Convenio convenio; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + + @Override + public int hashCode() { + int hash = 0; + hash += (convenioPuntoVentaId != null ? convenioPuntoVentaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConvenioPuntoVenta)) { + return false; + } + ConvenioPuntoVenta other = (ConvenioPuntoVenta) object; + if ((this.convenioPuntoVentaId == null && other.convenioPuntoVentaId != null) || (this.convenioPuntoVentaId != null && !this.convenioPuntoVentaId.equals(other.convenioPuntoVentaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioPuntoVenta[convenioPuntoVentaId=" + convenioPuntoVentaId + "]"; + } + + public Integer getConvenioPuntoVentaId() { + return convenioPuntoVentaId; + } + + public void setConvenioPuntoVentaId(Integer convenioPuntoVentaId) { + this.convenioPuntoVentaId = convenioPuntoVentaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Convenio getConvenio() { + return convenio; + } + + public void setConvenio(Convenio convenio) { + this.convenio = convenio; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConvenioRuta.java b/src/com/rjconsultores/ventaboletos/entidad/ConvenioRuta.java new file mode 100644 index 000000000..d791c280f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConvenioRuta.java @@ -0,0 +1,106 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="CONVENIO_RUTA_SEQ", sequenceName="CONVENIO_RUTA_SEQ", allocationSize=1) +@Table(name="CONVENIO_RUTA") +public class ConvenioRuta implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_RUTA_SEQ") + @Column(name = "CONVENIORUTA_ID") + private Integer convenioRutaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + @ManyToOne + private Convenio convenio; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + + public Integer getConvenioRutaId() { + return convenioRutaId; + } + public void setConvenioRutaId(Integer convenioRutaId) { + this.convenioRutaId = convenioRutaId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Convenio getConvenio() { + return convenio; + } + public void setConvenio(Convenio convenio) { + this.convenio = convenio; + } + public Ruta getRuta() { + return ruta; + } + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (convenioRutaId != null ? convenioRutaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConvenioRuta)) { + return false; + } + ConvenioRuta other = (ConvenioRuta) object; + if ((this.convenioRutaId == null && other.convenioRutaId != null) || (this.convenioRutaId != null && !this.convenioRutaId.equals(other.convenioRutaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioRuta[convenioRutaId=" + convenioRutaId + "]"; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConvenioTramo.java b/src/com/rjconsultores/ventaboletos/entidad/ConvenioTramo.java new file mode 100644 index 000000000..dfca0a4a2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConvenioTramo.java @@ -0,0 +1,142 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="CONVENIO_TRAMO_SEQ", sequenceName="CONVENIO_TRAMO_SEQ", allocationSize=1) +@Table(name="CONVENIO_TRAMO") +public class ConvenioTramo implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_TRAMO_SEQ") + @Column(name = "CONVENIOTRAMO_ID") + private Integer convenioTramoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + @ManyToOne + private Convenio convenio; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaOrigem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaDestino; + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ConvenioTramo other = (ConvenioTramo) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.convenio != other.convenio && (this.convenio == null || !this.convenio.equals(other.convenio))) { + return false; + } + if (this.paradaOrigem != other.paradaOrigem && (this.paradaOrigem == null || !this.paradaOrigem.equals(other.paradaOrigem))) { + return false; + } + if (this.paradaDestino != other.paradaDestino && (this.paradaDestino == null || !this.paradaDestino.equals(other.paradaDestino))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 73 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 73 * hash + (this.convenio != null ? this.convenio.hashCode() : 0); + hash = 73 * hash + (this.paradaOrigem != null ? this.paradaOrigem.hashCode() : 0); + hash = 73 * hash + (this.paradaDestino != null ? this.paradaDestino.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioTramo[conveniaTramoId=" + convenioTramoId + "]"; + } + + public Integer getConvenioTramoId() { + return convenioTramoId; + } + + public void setConvenioTramoId(Integer convenioTramoId) { + this.convenioTramoId = convenioTramoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Convenio getConvenio() { + return convenio; + } + + public void setConvenio(Convenio convenio) { + this.convenio = convenio; + } + + public Parada getParadaOrigem() { + return paradaOrigem; + } + + public void setParadaOrigem(Parada paradaOrigem) { + this.paradaOrigem = paradaOrigem; + } + + public Parada getParadaDestino() { + return paradaDestino; + } + + public void setParadaDestino(Parada paradaDestino) { + this.paradaDestino = paradaDestino; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConvenioUsuario.java b/src/com/rjconsultores/ventaboletos/entidad/ConvenioUsuario.java new file mode 100644 index 000000000..668fc812a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConvenioUsuario.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="CONVENIO_USUARIO_SEQ", sequenceName="CONVENIO_USUARIO_SEQ", allocationSize=1) +@Table(name="CONVENIO_USUARIO") +public class ConvenioUsuario implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONVENIO_USUARIO_SEQ") + @Column(name = "CONVENIOUSUARIO_ID") + private Integer convenioUsuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CONVENIO_ID", referencedColumnName = "CONVENIO_ID") + @ManyToOne + private Convenio convenio; + @JoinColumn(name = "USUARIOCONVENIO_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuario; + + @Override + public int hashCode() { + int hash = 0; + hash += (convenioUsuarioId != null ? convenioUsuarioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ConvenioUsuario)) { + return false; + } + ConvenioUsuario other = (ConvenioUsuario) object; + if ((this.convenioUsuarioId == null && other.convenioUsuarioId != null) || (this.convenioUsuarioId != null && !this.convenioUsuarioId.equals(other.convenioUsuarioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ConvenioUsuario[convenioUsuarioId=" + convenioUsuarioId + "]"; + } + + public Integer getConvenioUsuarioId() { + return convenioUsuarioId; + } + + public void setConvenioUsuarioId(Integer convenioUsuarioId) { + this.convenioUsuarioId = convenioUsuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Convenio getConvenio() { + return convenio; + } + + public void setConvenio(Convenio convenio) { + this.convenio = convenio; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/Corrida.java b/src/com/rjconsultores/ventaboletos/entidad/Corrida.java new file mode 100644 index 000000000..22e313fd3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Corrida.java @@ -0,0 +1,609 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Embeddable; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "CORRIDA") +public class Corrida implements Serializable { + + private static final long serialVersionUID = 1L; + + @Embeddable + public static class Id implements Serializable { + + private static final long serialVersionUID = 1L; + @Column(name = "CORRIDA_ID") + private Integer corridaId; + @Column(name = "FECCORRIDA") + @Temporal(TemporalType.DATE) + private Date feccorrida; + + public Id() { + } + + public Id(Integer corridaId, Date feccorrida) { + this.corridaId = corridaId; + this.feccorrida = feccorrida; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Date getFeccorrida() { + return feccorrida; + } + + public void setFeccorrida(Date feccorrida) { + this.feccorrida = feccorrida; + } + + @Override + public String toString() { + SimpleDateFormat sf = new SimpleDateFormat("dd/MM HH:mm"); + return corridaId + " Hora:" + sf.format(feccorrida); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((corridaId == null) ? 0 : corridaId.hashCode()); + result = prime * result + ((feccorrida == null) ? 0 : feccorrida.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Id other = (Id) obj; + if (corridaId == null) { + if (other.corridaId != null) + return false; + } else if (!corridaId.equals(other.corridaId)) + return false; + if (feccorrida == null) { + if (other.feccorrida != null) + return false; + } else if (!feccorrida.equals(other.feccorrida)) + return false; + return true; + } + } + + @EmbeddedId + private Id id = new Id(); + @Column(name = "FECHORSALIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorsalida; + @Column(name = "INDSTATUSCORRIDA") + private String indstatuscorrida; + @Column(name = "FECHORTARJETAVIAJE") + @Temporal(TemporalType.TIMESTAMP) + private Date fechortarjetaviaje; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToOne + @JoinColumn(name = "AUTOBUS_ID", referencedColumnName = "AUTOBUS_ID") + private Autobus autobus; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "CONDUCTOR1_ID", referencedColumnName = "CONDUCTOR_ID") + @ManyToOne + private Conductor conductor; + @JoinColumn(name = "CONDUCTOR2_ID", referencedColumnName = "CONDUCTOR_ID") + @ManyToOne + private Conductor conductor1; + @JoinColumn(name = "CORRIDA_ID", referencedColumnName = "CORRIDA_ID", insertable = false, updatable = false) + @ManyToOne(optional = false) + private CorridaCtrl corridaCtrl; + @OneToMany(mappedBy = "corrida", cascade = CascadeType.ALL) + private List corridaTramoList; + @JoinColumn(name = "EMPRESACORRIDA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "EMPRESAINGRESO_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa1; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "NODO_ID", referencedColumnName = "NODO_ID") + @ManyToOne + private Nodo nodo; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "ZONA_ID", referencedColumnName = "ZONA_ID") + @ManyToOne + private Zona zona; + @OneToOne + @JoinColumn(name = "ROLOPERATIVO_ID") + private RolOperativo rolOperativo; + @Column(name = "CANTPARADOS") + private Short cantParados; + @Column(name = "TIPOSERVICIO_ID") + private Short tipoServicio; + @Column(name = "fechorsalidaoriginal") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date fechorSalidaOriginal; + @OneToOne + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumn(name = "esquemacorrida_id", referencedColumnName = "esquemacorrida_id") + private EsquemaCorrida esquemaCorrida; + @Column(name = "indtipoventa") + private String indTipoVenta; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @ManyToOne + @JoinColumns({ + @JoinColumn(name = "CORRIDAREBOTE_ID", referencedColumnName = "CORRIDA_ID"), + @JoinColumn(name = "FECCORRIDAREBOTE", referencedColumnName = "FECCORRIDA") }) + @NotFound(action = NotFoundAction.IGNORE) + private Corrida corridaRebote; + @ManyToOne + @JoinColumns({ + @JoinColumn(name = "CORRIDA2_ID", referencedColumnName = "CORRIDA_ID"), + @JoinColumn(name = "FECCORRIDA2", referencedColumnName = "FECCORRIDA") }) + @NotFound(action = NotFoundAction.IGNORE) + private Corrida corridaPiso; + @JoinColumn(name = "DIVISIONINGRESO_ID", referencedColumnName = "DIVISION_ID") + @ManyToOne + private Division division; + @Column(name = "NUMPISO") + private Integer numPiso; + + @Column(name = "fechorsalidaoriginalh") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date fechorSalidaOriginalH; + + @Column(name = "ESQUEMAAGRUPACION_ID") + private Integer esquemaAgrupacionId; + + @Column(name = "CODPRODUTOFISCAL") + private String codProdutoFiscal; + + @Column(name = "INFOCORRIDA") + private String infoCorrida; + + @Column(name = "ISFLEXBUS") + private Boolean isFlexBus; + + @Column(name = "STATUSFLEXBUS") + private Integer statusFlexBus; + + @Column(name = "OCUPACAO_MINIMA") + private Integer ocupacaoMinima; + + @Column(name = "HORAS_CONFIRMACAO") + private Integer horasParaConfirmacao; + + @Column(name = "MINUTOS_CONFIRMACAO") + private Integer minutosParaConfirmacao; + + @Column(name = "USUARIOFLEXBUS_ID") + private Integer usuarioFlexBusId; + + public String getIndTipoVenta() { + return indTipoVenta; + } + + public void setIndTipoVenta(String indTipoVenta) { + this.indTipoVenta = indTipoVenta; + } + + public Date getFechorSalidaOriginal() { + return fechorSalidaOriginal; + } + + public void setFechorSalidaOriginal(Date fechorSalidaOriginal) { + if (fechorSalidaOriginal != null) { + fechorSalidaOriginal = DateUtil.normalizar(fechorSalidaOriginal); + } + this.fechorSalidaOriginal = fechorSalidaOriginal; + } + + public EsquemaCorrida getEsquemaCorrida() { + return esquemaCorrida; + } + + public void setEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + this.esquemaCorrida = esquemaCorrida; + } + + public Corrida() { + } + + public Corrida(Integer corridaId, Date feccorrida) { + this.id.setCorridaId(corridaId); + this.id.setFeccorrida(feccorrida); + } + + public Corrida(Marca marca, Integer corridaId, Parada origen, Parada destino, ClaseServicio claseServicio, Date horario) { + this.id = new Id(); + this.id.setCorridaId(corridaId); + this.setFechorsalida(horario); + this.origem = origen; + this.destino = destino; + this.claseServicio = claseServicio; + this.marca = marca; + } + + public Corrida(Integer corridaId, Parada origen, Parada destino) { + this.id = new Id(); + this.id.setCorridaId(corridaId); + this.origem = origen; + this.destino = destino; + } + + public Id getId() { + return id; + } + + public void setId(Id id) { + this.id = id; + } + + public List getCorridaTramoList() { + return corridaTramoList; + } + + public void setCorridaTramoList(List corridaTramoList) { + this.corridaTramoList = corridaTramoList; + } + + public Date getFechorsalida() { + return fechorsalida; + } + + public void setFechorsalida(Date fechorsalida) { + if (fechorsalida != null) { + fechorsalida = DateUtil.normalizar(fechorsalida); + } + this.fechorsalida = fechorsalida; + } + + public String getIndstatuscorrida() { + return indstatuscorrida; + } + + public void setIndstatuscorrida(String indstatuscorrida) { + this.indstatuscorrida = indstatuscorrida; + } + + public Date getFechortarjetaviaje() { + return fechortarjetaviaje; + } + + public void setFechortarjetaviaje(Date fechortarjetaviaje) { + this.fechortarjetaviaje = fechortarjetaviaje; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Autobus getAutobus() { + return autobus; + } + + public void setAutobus(Autobus autobus) { + this.autobus = autobus; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Conductor getConductor() { + return conductor; + } + + public void setConductor(Conductor conductor) { + this.conductor = conductor; + } + + public Conductor getConductor1() { + return conductor1; + } + + public void setConductor1(Conductor conductor1) { + this.conductor1 = conductor1; + } + + public CorridaCtrl getCorridaCtrl() { + return corridaCtrl; + } + + public void setCorridaCtrl(CorridaCtrl corridaCtrl) { + this.corridaCtrl = corridaCtrl; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Empresa getEmpresa1() { + return empresa1; + } + + public void setEmpresa1(Empresa empresa1) { + this.empresa1 = empresa1; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Nodo getNodo() { + return nodo; + } + + public void setNodo(Nodo nodo) { + this.nodo = nodo; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Zona getZona() { + return zona; + } + + public void setZona(Zona zona) { + this.zona = zona; + } + + public RolOperativo getRolOperativo() { + return rolOperativo; + } + + public void setRolOperativo(RolOperativo rolOperativo) { + this.rolOperativo = rolOperativo; + } + + public Short getCantParados() { + return cantParados; + } + + public void setCantParados(Short cantParados) { + this.cantParados = cantParados; + } + + public Short getTipoServicio() { + return tipoServicio; + } + + public void setTipoServicio(Short tipoServicio) { + this.tipoServicio = tipoServicio; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Corrida getCorridaRebote() { + return corridaRebote; + } + + public void setCorridaRebote(Corrida corridaRebote) { + this.corridaRebote = corridaRebote; + } + + public Division getDivision() { + return division; + } + + public void setDivision(Division division) { + this.division = division; + } + + public Corrida getCorridaPiso() { + return corridaPiso; + } + + public void setCorridaPiso(Corrida corridaPiso) { + this.corridaPiso = corridaPiso; + } + + public Integer getNumPiso() { + return numPiso; + } + + public void setNumPiso(Integer numPiso) { + this.numPiso = numPiso; + } + + public Date getFechorSalidaOriginalH() { + return fechorSalidaOriginalH; + } + + public void setFechorSalidaOriginalH(Date fechorSalidaOriginalH) { + this.fechorSalidaOriginalH = fechorSalidaOriginalH; + } + + public Integer getEsquemaAgrupacionId() { + return esquemaAgrupacionId; + } + + public void setEsquemaAgrupacionId(Integer esquemaAgrupacionId) { + this.esquemaAgrupacionId = esquemaAgrupacionId; + } + + public String getCodProdutoFiscal() { + return codProdutoFiscal; + } + + public void setCodProdutoFiscal(String codProdutoFiscal) { + this.codProdutoFiscal = codProdutoFiscal; + } + + public String getInfoCorrida() { + return infoCorrida; + } + + public void setInfoCorrida(String infoCorrida) { + this.infoCorrida = infoCorrida; + } + + @Override + public String toString() { + return id.toString(); + } + + public Boolean getIsFlexBus() { + return isFlexBus == null ? false : isFlexBus; + } + + public void setIsFlexBus(Boolean isFlexBus) { + this.isFlexBus = isFlexBus; + } + + public Integer getHorasParaConfirmacao() { + return horasParaConfirmacao == null ? 0 : horasParaConfirmacao; + } + + public void setHorasParaConfirmacao(Integer horasParaConfirmacao) { + this.horasParaConfirmacao = horasParaConfirmacao; + } + + public Integer getMinutosParaConfirmacao() { + return minutosParaConfirmacao == null ? 0 : minutosParaConfirmacao; + } + + public void setMinutosParaConfirmacao(Integer minutosParaConfirmacao) { + this.minutosParaConfirmacao = minutosParaConfirmacao; + } + + public Integer getOcupacaoMinima() { + return ocupacaoMinima == null ? 0 : ocupacaoMinima; + } + + public void setOcupacaoMinima(Integer ocupacaoMinima) { + this.ocupacaoMinima = ocupacaoMinima; + } + + public Integer getStatusFlexBus() { + return statusFlexBus; + } + + public void setStatusFlexBus(Integer statusFlexBus) { + this.statusFlexBus = statusFlexBus; + } + + public Integer getUsuarioFlexBusId() { + return usuarioFlexBusId; + } + + public void setUsuarioFlexBusId(Integer usuarioFlexBusId) { + this.usuarioFlexBusId = usuarioFlexBusId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CorridaCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/CorridaCtrl.java new file mode 100644 index 000000000..a45f30c47 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CorridaCtrl.java @@ -0,0 +1,170 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "CORRIDA_CTRL") +public class CorridaCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "CORRIDA_ID") + private Integer corridaId; + @Column(name = "HORARIO") + @Temporal(TemporalType.TIME) + private Date horario; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @OneToOne + @JoinColumn(name = "NODO_ID") + private Nodo nodo; + @Column(name = "INDPISOEXTRA") + private Boolean pisoExtra; + + public CorridaCtrl() { + } + + public Boolean getPisoExtra() { + return pisoExtra; + } + + public void setPisoExtra(Boolean pisoExtra) { + this.pisoExtra = pisoExtra; + } + + public CorridaCtrl(Integer corridaId) { + this.corridaId = corridaId; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Date getHorario() { + return horario; + } + + public void setHorario(Date horario) { + this.horario = horario; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Nodo getNodo() { + return nodo; + } + + public void setNodo(Nodo nodo) { + this.nodo = nodo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (corridaId != null ? corridaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CorridaCtrl)) { + return false; + } + CorridaCtrl other = (CorridaCtrl) object; + if ((this.corridaId == null && other.corridaId != null) || (this.corridaId != null && !this.corridaId.equals(other.corridaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.test.CorridaCtrl[corridaId=" + corridaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CorridaTramo.java b/src/com/rjconsultores/ventaboletos/entidad/CorridaTramo.java new file mode 100644 index 000000000..1a5c2f076 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CorridaTramo.java @@ -0,0 +1,386 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.SequenceGenerator; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "CORRIDA_TRAMO_SEQ", sequenceName = "CORRIDA_TRAMO_SEQ", allocationSize = 1) +@Table(name = "CORRIDA_TRAMO") +public class CorridaTramo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "CORRIDATRAMO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CORRIDA_TRAMO_SEQ") + private Integer corridatramoId; + @OneToOne + @NotFound(action = NotFoundAction.IGNORE) + @JoinColumns({ + @JoinColumn(name = "CORRIDA_ID", referencedColumnName = "CORRIDA_ID"), + @JoinColumn(name = "FECCORRIDA", referencedColumnName = "FECCORRIDA") }) + private Corrida corrida; + @Column(name = "NUMSECUENCIA") + private Short numsecuencia; + @Column(name = "FECHORSALIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorsalida; + @Column(name = "FECHORLLEGADA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorllegada; + @Column(name = "FECHORTARJETAVIAJE") + @Temporal(TemporalType.TIMESTAMP) + private Date fechortarjetaviaje; + @Column(name = "USUARIOTARJETAVIAJE_ID") + private Integer usuariotarjetaviajeId; + @Column(name = "NUMSECORIGEN") + private Short numsecorigen; + @Column(name = "NUMSECDESTINO") + private Short numsecdestino; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "NODO_ID", referencedColumnName = "NODO_ID") + @ManyToOne + private Nodo nodo; + @JoinColumn(name = "CONDUCTOR1_ID", referencedColumnName = "CONDUCTOR_ID") + @ManyToOne + private Conductor conductor; + @JoinColumn(name = "CONDUCTOR2_ID", referencedColumnName = "CONDUCTOR_ID") + @ManyToOne + private Conductor conductor1; + @JoinColumn(name = "AUTOBUS_ID", referencedColumnName = "AUTOBUS_ID") + @ManyToOne + private Autobus autobus; + @Column(name = "fechorsalidaoriginal") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date fechorSalidaOriginal; + @Column(name = "TIEMPOESTANCIA") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date tiempoEstancia; + @Column(name = "INDMANTTARJETA") + private Boolean indmanttarjeta; + @Column(name = "FOLIOTARJETAVIAJE") + private String folioTarjeta; + @Column(name = "PLATAFORMA") + private String plataforma; + @Column(name = "TIPO_PASSAGEM") + private String tipoPassagem; + + @Column(name = "FECHORSALIDAH") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorsalidaH; + @Column(name = "FECHORLLEGADAH") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorllegadaH; + + @Column(name = "fechorsalidaoriginalh") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date fechorSalidaOriginalH; + + public Boolean getIndmanttarjeta() { + return indmanttarjeta; + } + + public void setIndmanttarjeta(Boolean indmanttarjeta) { + this.indmanttarjeta = indmanttarjeta; + } + + public Date getTiempoEstancia() { + return tiempoEstancia; + } + + public void setTiempoEstancia(Date tiempoEstancia) { + this.tiempoEstancia = tiempoEstancia; + } + + public CorridaTramo() { + } + + public CorridaTramo(Integer corridatramoId) { + this.corridatramoId = corridatramoId; + } + + public Date getFechorSalidaOriginal() { + return fechorSalidaOriginal; + } + + public void setFechorSalidaOriginal(Date fechorSalidaOriginal) { + if (fechorSalidaOriginal != null) { + fechorSalidaOriginal = DateUtil.normalizar(fechorSalidaOriginal); + } + this.fechorSalidaOriginal = fechorSalidaOriginal; + } + + public Integer getCorridatramoId() { + return corridatramoId; + } + + public void setCorridatramoId(Integer corridatramoId) { + this.corridatramoId = corridatramoId; + } + + public Corrida getCorrida() { + return corrida; + } + + public void setCorrida(Corrida corrida) { + this.corrida = corrida; + } + + public Short getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Short numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public Date getFechorsalida() { + return fechorsalida; + } + + public void setFechorsalida(Date fechorsalida) { + if (fechorsalida != null) { + fechorsalida = DateUtil.normalizar(fechorsalida); + } + this.fechorsalida = fechorsalida; + } + + public Date getFechorllegada() { + return fechorllegada; + } + + public void setFechorllegada(Date fechorllegada) { + if (fechorllegada != null) { + fechorllegada = DateUtil.normalizar(fechorllegada); + } + this.fechorllegada = fechorllegada; + } + + public Date getFechortarjetaviaje() { + return fechortarjetaviaje; + } + + public void setFechortarjetaviaje(Date fechortarjetaviaje) { + this.fechortarjetaviaje = fechortarjetaviaje; + } + + public Integer getUsuariotarjetaviajeId() { + return usuariotarjetaviajeId; + } + + public void setUsuariotarjetaviajeId(Integer usuariotarjetaviajeId) { + this.usuariotarjetaviajeId = usuariotarjetaviajeId; + } + + public Short getNumsecorigen() { + return numsecorigen; + } + + public void setNumsecorigen(Short numsecorigen) { + this.numsecorigen = numsecorigen; + } + + public Short getNumsecdestino() { + return numsecdestino; + } + + public void setNumsecdestino(Short numsecdestino) { + this.numsecdestino = numsecdestino; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public com.rjconsultores.ventaboletos.entidad.Parada getDestino() { + return destino; + } + + public void setDestino(com.rjconsultores.ventaboletos.entidad.Parada destino) { + this.destino = destino; + } + + public com.rjconsultores.ventaboletos.entidad.Parada getOrigem() { + return origem; + } + + public void setOrigem(com.rjconsultores.ventaboletos.entidad.Parada origem) { + this.origem = origem; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public Nodo getNodo() { + return nodo; + } + + public void setNodo(Nodo nodo) { + this.nodo = nodo; + } + + public Conductor getConductor() { + return conductor; + } + + public void setConductor(Conductor conductor) { + this.conductor = conductor; + } + + public Conductor getConductor1() { + return conductor1; + } + + public void setConductor1(Conductor conductor1) { + this.conductor1 = conductor1; + } + + public Autobus getAutobus() { + return autobus; + } + + public void setAutobus(Autobus autobus) { + this.autobus = autobus; + } + + public String getFolioTarjeta() { + return folioTarjeta; + } + + public void setFolioTarjeta(String folioTarjeta) { + this.folioTarjeta = folioTarjeta; + } + + public String getPlataforma() { + return plataforma; + } + + public void setPlataforma(String plataforma) { + this.plataforma = plataforma; + } + + public Date getFechorsalidaH() { + return fechorsalidaH; + } + + public void setFechorsalidaH(Date fechorsalidaH) { + this.fechorsalidaH = fechorsalidaH; + } + + public Date getFechorllegadaH() { + return fechorllegadaH; + } + + public void setFechorllegadaH(Date fechorllegadaH) { + this.fechorllegadaH = fechorllegadaH; + } + + public Date getFechorSalidaOriginalH() { + return fechorSalidaOriginalH; + } + + public void setFechorSalidaOriginalH(Date fechorSalidaOriginalH) { + this.fechorSalidaOriginalH = fechorSalidaOriginalH; + } + + public String getTipoPassagem() { + return tipoPassagem; + } + + public void setTipoPassagem(String tipoPassagem) { + this.tipoPassagem = tipoPassagem; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (corridatramoId != null ? corridatramoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof CorridaTramo)) { + return false; + } + CorridaTramo other = (CorridaTramo) object; + if ((this.corridatramoId == null && other.corridatramoId != null) || (this.corridatramoId != null && !this.corridatramoId.equals(other.corridatramoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.test.CorridaTramo[corridatramoId=" + corridatramoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Cortesia.java b/src/com/rjconsultores/ventaboletos/entidad/Cortesia.java new file mode 100644 index 000000000..7e7a2ac89 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Cortesia.java @@ -0,0 +1,260 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "CORTESIA_SEQ", sequenceName = "CORTESIA_SEQ", allocationSize = 1) +@Table(name = "CORTESIA") +public class Cortesia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CORTESIA_SEQ") + @Column(name = "CORTESIA_ID") + private Integer cortesiaId; + @Column(name = "DESCCORREO") + private String descCorreo; + @Column(name = "INDTIPOVIAJE") + private String indtipoviaje; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecinicio; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinal; + @Column(name = "NDSTATUS") + private String ndstatus; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "EMPLEADO_ID") + @OneToOne + private Empleado empleado; + @JoinColumn(name = "TIPOCORTESIA_ID", referencedColumnName = "TIPOCORTESIA_ID") + @ManyToOne + private TipoCortesia tipoCortesia; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "MOTIVOVIAJE_ID", referencedColumnName = "MOTIVOVIAJE_ID") + @ManyToOne + private MotivoViaje motivoViaje; + @OneToMany(mappedBy = "cortesia", cascade = CascadeType.ALL) + @LazyCollection(value = LazyCollectionOption.FALSE) + private List cortesiaBeneficiarioList; + + public MotivoViaje getMotivoViaje() { + return motivoViaje; + } + + public void setMotivoViaje(MotivoViaje motivoViaje) { + this.motivoViaje = motivoViaje; + } + + public List getCortesiaBeneficiarioList() { + List cb = new ArrayList(); + if (cortesiaBeneficiarioList != null) { + for (CortesiaBeneficiario ctb : this.cortesiaBeneficiarioList) { + if (ctb.getActivo() == Boolean.TRUE) { + cb.add(ctb); + } + } + } + + this.cortesiaBeneficiarioList = cb; + + return cb; + } + + public void setCortesiaBeneficiarioList(List cortesiaBeneficiarioList) { + this.cortesiaBeneficiarioList = cortesiaBeneficiarioList; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Integer getCortesiaId() { + return cortesiaId; + } + + public void setCortesiaId(Integer cortesiaId) { + this.cortesiaId = cortesiaId; + } + + public String getDescCorreo() { + return descCorreo; + } + + public void setDescCorreo(String descCorreo) { + this.descCorreo = descCorreo; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Empleado getEmpleado() { + return empleado; + } + + public void setEmpleado(Empleado empleado) { + this.empleado = empleado; + } + + public Date getFecfinal() { + return fecfinal; + } + + public void setFecfinal(Date fecfinal) { + this.fecfinal = fecfinal; + } + + public Date getFecinicio() { + return fecinicio; + } + + public void setFecinicio(Date fecinicio) { + this.fecinicio = fecinicio; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public String getIndtipoviaje() { + return indtipoviaje; + } + + public void setIndtipoviaje(String indtipoviaje) { + this.indtipoviaje = indtipoviaje; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public String getNdstatus() { + return ndstatus; + } + + public void setNdstatus(String ndstatus) { + this.ndstatus = ndstatus; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public TipoCortesia getTipoCortesia() { + return tipoCortesia; + } + + public void setTipoCortesia(TipoCortesia tipoCortesia) { + this.tipoCortesia = tipoCortesia; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cortesiaId != null ? cortesiaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Cortesia)) { + return false; + } + Cortesia other = (Cortesia) object; + if ((this.cortesiaId == null && other.cortesiaId != null) || (this.cortesiaId != null && !this.cortesiaId.equals(other.cortesiaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Cortesia[cortesiaId=" + cortesiaId + "]"; + //return this.getEmpleado() + getDescCorreo(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CortesiaBeneficiario.java b/src/com/rjconsultores/ventaboletos/entidad/CortesiaBeneficiario.java new file mode 100644 index 000000000..3bdb744f2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CortesiaBeneficiario.java @@ -0,0 +1,186 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "CORTESIA_BENEFICIARIO_SEQ", sequenceName = "CORTESIA_BENEFICIARIO_SEQ", allocationSize = 1) +@Table(name = "CORTESIA_BENEFICIARIO") +public class CortesiaBeneficiario implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CORTESIA_BENEFICIARIO_SEQ") + @Column(name = "CORTESIABENEFICIARIO_ID") + private Integer cortesiaBeneficiarioId; + @Column(name = "NOMBBENEF") + private String nombBenef; + @Column(name = "NOMBPATERNO") + private String nombPaterno; + @Column(name = "NOMBMATERNO") + private String nombMaterno; + @Column(name = "INDTIPOBENEF") + private String indtipobenef; + @Column(name = "FECUTILIZACIONIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecUtilizacionIda; + @Column(name = "FECUTILIZACIONREGRESO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecUtilizacionRegreso; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CORTESIA_ID", referencedColumnName = "CORTESIA_ID") + @ManyToOne + private Cortesia cortesia; + @JoinColumn(name = "TIPOCORTESIADESCUENTO_ID", referencedColumnName = "TIPOCORTESIADESCUENTO_ID") + @ManyToOne + private TipoCortesiaDescuento descuento; + + public TipoCortesiaDescuento getDescuento() { + return descuento; + } + + public void setDescuento(TipoCortesiaDescuento descuento) { + this.descuento = descuento; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Cortesia getCortesia() { + return cortesia; + } + + public void setCortesia(Cortesia cortesia) { + this.cortesia = cortesia; + } + + public Integer getCortesiaBeneficiarioId() { + return cortesiaBeneficiarioId; + } + + public void setCortesiaBeneficiarioId(Integer cortesiaBeneficiarioId) { + this.cortesiaBeneficiarioId = cortesiaBeneficiarioId; + } + + public Date getFecUtilizacionIda() { + return fecUtilizacionIda; + } + + public void setFecUtilizacionIda(Date fecUtilizacionIda) { + this.fecUtilizacionIda = fecUtilizacionIda; + } + + public Date getFecUtilizacionRegreso() { + return fecUtilizacionRegreso; + } + + public void setFecUtilizacionRegreso(Date fecUtilizacionRegreso) { + this.fecUtilizacionRegreso = fecUtilizacionRegreso; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public String getNombBenef() { + return nombBenef; + } + + public void setNombBenef(String nombBenef) { + this.nombBenef = nombBenef; + } + + public String getNombMaterno() { + return nombMaterno; + } + + public void setNombMaterno(String nombMaterno) { + this.nombMaterno = nombMaterno; + } + + public String getNombPaterno() { + return nombPaterno; + } + + public void setNombPaterno(String nombPaterno) { + this.nombPaterno = nombPaterno; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getIndtipobenef() { + return indtipobenef; + } + + public void setIndtipobenef(String indtipobenef) { + this.indtipobenef = indtipobenef; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cortesiaBeneficiarioId != null ? cortesiaBeneficiarioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CortesiaBeneficiario)) { + return false; + } + CortesiaBeneficiario other = (CortesiaBeneficiario) object; + if ((this.cortesiaBeneficiarioId == null && other.cortesiaBeneficiarioId != null) || (this.cortesiaBeneficiarioId != null && !this.cortesiaBeneficiarioId.equals(other.cortesiaBeneficiarioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CortesiaBeneficiario[cortesiaBeneficiarioId=" + cortesiaBeneficiarioId + "]"; + //return this.getNombBenef(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CortesiaDireccion.java b/src/com/rjconsultores/ventaboletos/entidad/CortesiaDireccion.java new file mode 100644 index 000000000..a26391f74 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CortesiaDireccion.java @@ -0,0 +1,177 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + * + */ +@Entity +@SequenceGenerator(name = "CORTESIA_DIRECCION_SEQ", sequenceName = "CORTESIA_DIRECCION_SEQ", allocationSize = 1) +@Table(name = "CORTESIA_DIRECCION") +public class CortesiaDireccion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CORTESIA_DIRECCION_SEQ") + @Column(name = "CORTESIADIRECCION_ID") + private Integer cortesiaDireccionId; + @Column(name = "NUMFOLIOINICIO") + private Integer numFolioInicio; + @Column(name = "NUMFOLIOFIN") + private Integer numFolioFin; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecInicioV; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecFinV; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TIPOCORTESIADESCUENTO_ID", referencedColumnName = "TIPOCORTESIADESCUENTO_ID") + @ManyToOne + private TipoCortesiaDescuento tipocortesiaDescuento; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public TipoCortesiaDescuento getTipocortesiaDescuento() { + return tipocortesiaDescuento; + } + + public void setTipocortesiaDescuento(TipoCortesiaDescuento tipocortesiaDescuento) { + this.tipocortesiaDescuento = tipocortesiaDescuento; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getCortesiaDireccionId() { + return cortesiaDireccionId; + } + + public void setCortesiaDireccionId(Integer cortesiaDireccionId) { + this.cortesiaDireccionId = cortesiaDireccionId; + } + + public Date getFecFinV() { + return fecFinV; + } + + public void setFecFinV(Date fecFinV) { + this.fecFinV = fecFinV; + } + + public Date getFecInicioV() { + return fecInicioV; + } + + public void setFecInicioV(Date fecInicioV) { + this.fecInicioV = fecInicioV; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getNumFolioFin() { + return numFolioFin; + } + + public void setNumFolioFin(Integer numFolioFin) { + this.numFolioFin = numFolioFin; + } + + public Integer getNumFolioInicio() { + return numFolioInicio; + } + + public void setNumFolioInicio(Integer numFolioInicio) { + this.numFolioInicio = numFolioInicio; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cortesiaDireccionId != null ? cortesiaDireccionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof CortesiaDireccion)) { + return false; + } + CortesiaDireccion other = (CortesiaDireccion) obj; + if ((this.cortesiaDireccionId == null && other.cortesiaDireccionId != null) || (this.cortesiaDireccionId != null && !this.cortesiaDireccionId.equals(other.cortesiaDireccionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CortesiaDireccion[cortesiaDireccionId=" + cortesiaDireccionId + "]"; + //return this.getDescTipo(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Cotacao.java b/src/com/rjconsultores/ventaboletos/entidad/Cotacao.java new file mode 100644 index 000000000..0110b8df3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Cotacao.java @@ -0,0 +1,106 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + + +@Entity +@SequenceGenerator(name = "COTACAO_SEQ", sequenceName = "COTACAO_SEQ", allocationSize = 1) +@Table(name = "COTACAO") +public class Cotacao implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "COTACAO_SEQ") + @Column(name = "COTACAO_ID") + private Integer cotacaoId; + @OneToOne + @JoinColumn(name = "MONEDA_ID") + private Moneda moneda; + @Column(name = "VALOR", precision = 7) + private BigDecimal valor; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getCotacaoId() { + return cotacaoId; + } + + public void setCotacaoId(Integer cotacaoId) { + this.cotacaoId = cotacaoId; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Cotacao)) { + return false; + } + Cotacao other = (Cotacao) object; + if ((this.cotacaoId == null && other.cotacaoId != null) || (this.cotacaoId != null && !this.cotacaoId.equals(other.cotacaoId))) { + return false; + } + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CtrlFechamentoCaixa.java b/src/com/rjconsultores/ventaboletos/entidad/CtrlFechamentoCaixa.java new file mode 100644 index 000000000..926727fd3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CtrlFechamentoCaixa.java @@ -0,0 +1,96 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.rjconsultores.ventaboletos.enums.CtrlFechamentoCaixaStatus; + +/** + * Classe que controla a rotina de retenção de comissão após o fechamento do caixa + * + * @author wilian + * @since 29/11/2018 + * + */ +@Entity +@SequenceGenerator(name = "CTRL_FECHAMENTO_CAIXA_SEQ", sequenceName = "CTRL_FECHAMENTO_CAIXA_SEQ", allocationSize = 1) +@Table(name = "CTRL_FECHAMENTO_CAIXA") +public class CtrlFechamentoCaixa implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CTRL_FECHAMENTO_CAIXA_SEQ") + @Column(name = "CTRLFECHAMENTOCAIXA_ID") + private Long ctrlfechamentocaixaId; + + @Column(name = "FECCORTE") + @Temporal(TemporalType.DATE) + private Date feccorte; + + @Enumerated(EnumType.STRING) + @Column(name = "FECHAMENTO_STATUS") + private CtrlFechamentoCaixaStatus status; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.DATE) + private Date fecmodif; + + @Column(name = "ACTIVO") + private boolean activo; + + public Long getCtrlfechamentocaixaId() { + return ctrlfechamentocaixaId; + } + + public void setCtrlfechamentocaixaId(Long ctrlfechamentocaixaId) { + this.ctrlfechamentocaixaId = ctrlfechamentocaixaId; + } + + public Date getFeccorte() { + return feccorte; + } + + public void setFeccorte(Date feccorte) { + this.feccorte = feccorte; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public CtrlFechamentoCaixaStatus getStatus() { + return status; + } + + public void setStatus(CtrlFechamentoCaixaStatus status) { + this.status = status; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CtrlSerieBPe.java b/src/com/rjconsultores/ventaboletos/entidad/CtrlSerieBPe.java new file mode 100644 index 000000000..e10fe3faf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CtrlSerieBPe.java @@ -0,0 +1,110 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CTRL_SERIE_BPE_SEQ", sequenceName = "CTRL_SERIE_BPE_SEQ", allocationSize = 1) +@Table(name = "CTRL_SERIE_BPE") +public class CtrlSerieBPe { + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CTRL_SERIE_BPE_SEQ") + @Column(name = "CTRLSERIEBPE_ID") + private Long ctrlSerieBPeId; + + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @ManyToOne + @JoinColumn(name = "ESTADO_ID", referencedColumnName = "ESTADO_ID") + private Estado estado; + + @Column(name = "NUMSERIE") + private String serie; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public CtrlSerieBPe() { + + } + + public Long getCtrlSerieBPeId() { + return ctrlSerieBPeId; + } + + public void setCtrlSerieBPeId(Long ctrlSerieBPeId) { + this.ctrlSerieBPeId = ctrlSerieBPeId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CtrlSerieEmbarcada.java b/src/com/rjconsultores/ventaboletos/entidad/CtrlSerieEmbarcada.java new file mode 100644 index 000000000..e47425cff --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CtrlSerieEmbarcada.java @@ -0,0 +1,180 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CTRL_SERIE_EMBARCADA_SEQ", sequenceName = "CTRL_SERIE_EMBARCADA_SEQ", allocationSize = 1) +@Table(name = "CTRL_SERIE_EMBARCADA") +public class CtrlSerieEmbarcada implements Serializable { + private static final long serialVersionUID = 3608706761067496642L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CTRL_SERIE_EMBARCADA_SEQ") + @Column(name = "CTRLSERIEEMBARCADA_ID") + private Long ctrlSerieEmbarcadaId; + @ManyToOne + @JoinColumn(name = "DISPOSITIVOEMBARCADA_ID", referencedColumnName = "DISPOSITIVOEMBARCADA_ID") + private DispositivoEmbarcada dispositivoEmbarcada; + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private PuntoVenta puntoventa; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne + @JoinColumn(name = "ESTADO_ID", referencedColumnName = "ESTADO_ID") + private Estado estado; + @Column(name = "SERIE") + private String serie; + @Column(name = "NUMEROINICIAL") + private String numeroInicial; + @Column(name = "NUMEROCORRENTE") + private String numeroCorrente; + @Column(name = "IND_BAIXADO") + private Boolean indBaixado; + @Column(name = "IND_REUTILIZADO") + private Boolean indReutilizado; + @OneToOne + @JoinColumn(name = "CTRLSERIEEMBARCADASEQ_ID", referencedColumnName = "CTRLSERIEEMBARCADA_ID") + private CtrlSerieEmbarcada ctrlSerieEmbarcadaSeq; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public CtrlSerieEmbarcada() { + + } + + public Long getCtrlSerieEmbarcadaId() { + return ctrlSerieEmbarcadaId; + } + + public void setCtrlSerieEmbarcadaId(Long ctrlSerieEmbarcadaId) { + this.ctrlSerieEmbarcadaId = ctrlSerieEmbarcadaId; + } + + public DispositivoEmbarcada getDispositivoEmbarcada() { + return dispositivoEmbarcada; + } + + public void setDispositivoEmbarcada(DispositivoEmbarcada dispositivoEmbarcada) { + this.dispositivoEmbarcada = dispositivoEmbarcada; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public String getNumeroInicial() { + return numeroInicial; + } + + public void setNumeroInicial(String numeroInicial) { + this.numeroInicial = numeroInicial; + } + + public String getNumeroCorrente() { + return numeroCorrente; + } + + public void setNumeroCorrente(String numeroCorrente) { + this.numeroCorrente = numeroCorrente; + } + + public Boolean getIndBaixado() { + return indBaixado; + } + + public void setIndBaixado(Boolean indBaixado) { + this.indBaixado = indBaixado; + } + + public Boolean getIndReutilizado() { + return indReutilizado; + } + + public void setIndReutilizado(Boolean indReutilizado) { + this.indReutilizado = indReutilizado; + } + + public CtrlSerieEmbarcada getCtrlSerieEmbarcadaSeq() { + return ctrlSerieEmbarcadaSeq; + } + + public void setCtrlSerieEmbarcadaSeq(CtrlSerieEmbarcada ctrlSerieEmbarcadaSeq) { + this.ctrlSerieEmbarcadaSeq = ctrlSerieEmbarcadaSeq; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoventa() { + return puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CuponConvenio.java b/src/com/rjconsultores/ventaboletos/entidad/CuponConvenio.java new file mode 100644 index 000000000..90c16412f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CuponConvenio.java @@ -0,0 +1,133 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "CUPON_CONVENIO_SEQ", sequenceName = "CUPON_CONVENIO_SEQ", allocationSize = 1) +@Table(name = "CUPON_CONVENIO") +public class CuponConvenio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CUPON_CONVENIO_SEQ") + @Column(name = "CUPONCONVENIO_ID") + private Integer cuponConvenioID; + @Column(name = "NUMFOLIOINICIO") + private Integer folioInicio; + @Column(name = "NUMFOLIOFINAL") + private Integer folioFinal; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TIPOCONVENIO_ID", referencedColumnName = "TIPOCONVENIO_ID") + @ManyToOne + private TipoConvenio tipoConvenio; + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getCuponConvenioID() { + return cuponConvenioID; + } + + public void setCuponConvenioID(Integer cuponConvenioID) { + this.cuponConvenioID = cuponConvenioID; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getFolioFinal() { + return folioFinal; + } + + public void setFolioFinal(Integer folioFinal) { + this.folioFinal = folioFinal; + } + + public Integer getFolioInicio() { + return folioInicio; + } + + public void setFolioInicio(Integer folioInicio) { + this.folioInicio = folioInicio; + } + + public TipoConvenio getTipoConvenio() { + return tipoConvenio; + } + + public void setTipoConvenio(TipoConvenio tipoConvenio) { + this.tipoConvenio = tipoConvenio; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cuponConvenioID != null ? cuponConvenioID.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CuponConvenio)) { + return false; + } + CuponConvenio other = (CuponConvenio) object; + if ((this.cuponConvenioID == null && other.cuponConvenioID != null) || (this.cuponConvenioID != null && !this.cuponConvenioID.equals(other.cuponConvenioID))) { + return false; + } + return true; + } + + @Override + public String toString() { + //return "com.rjconsultores.ventaboletos.entidad.CuponConvenio[cuponConvenioID=" + cuponConvenioID + "]"; + return this.getTipoConvenio().getDescTipo(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CuponSecretaria.java b/src/com/rjconsultores/ventaboletos/entidad/CuponSecretaria.java new file mode 100644 index 000000000..0a72dda22 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CuponSecretaria.java @@ -0,0 +1,208 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@Table(name = "CUPON_SECRETARIA") +@SequenceGenerator(name = "CUPON_SECRETARIA_SEQ", sequenceName = "CUPON_SECRETARIA_SEQ", allocationSize = 1) +public class CuponSecretaria implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CUPON_SECRETARIA_SEQ") + @Column(name = "CUPONSECRETARIA_ID") + private Integer cuponsecretariaId; + @Column(name = "NUMFOLIOINICIO") + private Long numfolioinicio; + @Column(name = "NUMFOLIOFINAL") + private Long numfoliofinal; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "PORCDESCUENTO") + private BigDecimal porcdescuento; + + @Column(name = "PORCDESCUENTOOUTROS") + private BigDecimal porcdescuentooutros; + @Column(name = "PORCDESCUENTOPEDAGIO") + private BigDecimal porcdescuentopedagio; + @Column(name = "PORCDESCUENTOSEGURO") + private BigDecimal porcdescuentoseguro; + @Column(name = "PORCDESCUENTOTAXAEMBARQUE") + private BigDecimal porcdescuentotaxaembarque; + @Column(name = "PORCDESCUENTOSEGUROOPCIONAL") + private BigDecimal porcdescuentoseguroopcional; + @Column(name = "SERIE") + private String serie; + @Column(name = "SUBSERIE") + private String subserie; + + public CuponSecretaria() { + } + + public CuponSecretaria(Integer cuponsecretariaId) { + this.cuponsecretariaId = cuponsecretariaId; + } + + public Integer getCuponsecretariaId() { + return cuponsecretariaId; + } + + public void setCuponsecretariaId(Integer cuponsecretariaId) { + this.cuponsecretariaId = cuponsecretariaId; + } + + public Long getNumfolioinicio() { + return numfolioinicio; + } + + public void setNumfolioinicio(Long numfolioinicio) { + this.numfolioinicio = numfolioinicio; + } + + public Long getNumfoliofinal() { + return numfoliofinal; + } + + public void setNumfoliofinal(Long numfoliofinal) { + this.numfoliofinal = numfoliofinal; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public BigDecimal getPorcdescuento() { + return porcdescuento; + } + + public void setPorcdescuento(BigDecimal porcdescuento) { + this.porcdescuento = porcdescuento; + } + + public BigDecimal getPorcdescuentooutros() { + return porcdescuentooutros; + } + + public void setPorcdescuentooutros(BigDecimal porcdescuentooutros) { + this.porcdescuentooutros = porcdescuentooutros; + } + + public BigDecimal getPorcdescuentopedagio() { + return porcdescuentopedagio; + } + + public void setPorcdescuentopedagio(BigDecimal porcdescuentopedagio) { + this.porcdescuentopedagio = porcdescuentopedagio; + } + + public BigDecimal getPorcdescuentoseguro() { + return porcdescuentoseguro; + } + + public void setPorcdescuentoseguro(BigDecimal porcdescuentoseguro) { + this.porcdescuentoseguro = porcdescuentoseguro; + } + + public BigDecimal getPorcdescuentotaxaembarque() { + return porcdescuentotaxaembarque; + } + + public void setPorcdescuentotaxaembarque(BigDecimal porcdescuentotaxaembarque) { + this.porcdescuentotaxaembarque = porcdescuentotaxaembarque; + } + + public BigDecimal getPorcdescuentoseguroopcional() { + return porcdescuentoseguroopcional; + } + + public void setPorcdescuentoseguroopcional(BigDecimal porcdescuentoseguroopcional) { + this.porcdescuentoseguroopcional = porcdescuentoseguroopcional; + } + + public String getSubserie() { + return subserie; + } + + public void setSubserie(String subserie) { + this.subserie = subserie; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (cuponsecretariaId != null ? cuponsecretariaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof CuponSecretaria)) { + return false; + } + CuponSecretaria other = (CuponSecretaria) object; + if ((this.cuponsecretariaId == null && other.cuponsecretariaId != null) || (this.cuponsecretariaId != null && !this.cuponsecretariaId.equals(other.cuponsecretariaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.CuponSecretaria[cuponsecretariaId=" + cuponsecretariaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Curso.java b/src/com/rjconsultores/ventaboletos/entidad/Curso.java new file mode 100644 index 000000000..2a0714d29 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Curso.java @@ -0,0 +1,100 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "CURSO_SEQ", sequenceName = "CURSO_SEQ", allocationSize = 1) +@Table(name = "CURSO") +public class Curso implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CURSO_SEQ") + @Basic(optional = false) + @Column(name = "CURSO_ID") + private Integer cursoId; + @Column(name = "NOMCURSO") + private String nomcurso; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @ManyToMany + @JoinTable(name = "CLIENTE_CURSO", joinColumns = { @JoinColumn(name = "CURSO_ID") }, + inverseJoinColumns = { @JoinColumn(name = "CLIENTE_ID") }) + private List clienteList; + + public Integer getCursoId() { + return cursoId; + } + + public void setCursoId(Integer cursoId) { + this.cursoId = cursoId; + } + + public String getNomcurso() { + return nomcurso; + } + + public void setNomcurso(String nomcurso) { + this.nomcurso = nomcurso; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getClienteList() { + return clienteList; + } + + public void setClienteList(List clienteList) { + this.clienteList = clienteList; + } + + @Override + public String toString() { + return this.nomcurso; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Custom.java b/src/com/rjconsultores/ventaboletos/entidad/Custom.java new file mode 100644 index 000000000..90b062625 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Custom.java @@ -0,0 +1,167 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Lucas + */ +@Entity +@SequenceGenerator(name = "CUSTOM_SEQ", sequenceName = "CUSTOM_SEQ", allocationSize = 1) +@Table(name = "CUSTOM") +public class Custom implements Serializable { + + public static final Integer TIPO_SISTEMA_CLIENTE = 1; + public static final Integer TIPO_SISTEMA_SERVIDOR = 2; + public static final Integer TIPO_SISTEMA_ADM = 3; + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CUSTOM_SEQ") + @Column(name = "CUSTOM_ID") + private Integer customId; + @Column(name = "SISTEMA") + private Integer sistema; + @Column(name = "TIPO") + private Integer tipo; + @Column(name = "ORDEM") + private Integer ordem; + @Column(name = "REFERENCIA") + private String referencia; + @Column(name = "CHAVE") + private String chave; + @Column(name = "VALOR") + private String valor; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Custom() { + } + + public Integer getCustomId() { + return customId; + } + + public void setCustomId(Integer customId) { + this.customId = customId; + } + + public Integer getSistema() { + return sistema; + } + + public void setSistema(Integer sistema) { + this.sistema = sistema; + } + + public Integer getTipo() { + return tipo; + } + + public void setTipo(Integer tipo) { + this.tipo = tipo; + } + + public Integer getOrdem() { + return ordem; + } + + public void setOrdem(Integer ordem) { + this.ordem = ordem; + } + + public String getReferencia() { + return referencia; + } + + public void setReferencia(String referencia) { + this.referencia = referencia; + } + + public String getChave() { + return chave; + } + + public void setChave(String chave) { + this.chave = chave; + } + + public String getValor() { + return valor; + } + + public void setValor(String valor) { + this.valor = valor; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (customId != null ? customId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Custom)) { + return false; + } + Custom other = (Custom) object; + if ((this.customId == null && other.customId != null) || (this.customId != null && !this.customId.equals(other.customId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Custom[customId=" + customId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/CustomIdGenerator.java b/src/com/rjconsultores/ventaboletos/entidad/CustomIdGenerator.java new file mode 100644 index 000000000..2085c92ff --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/CustomIdGenerator.java @@ -0,0 +1,74 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Properties; + +import org.apache.commons.lang.StringUtils; +import org.hibernate.HibernateException; +import org.hibernate.MappingException; +import org.hibernate.dialect.Dialect; +import org.hibernate.engine.SessionImplementor; +import org.hibernate.id.Configurable; +import org.hibernate.id.IdentifierGenerator; + +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; + +public class CustomIdGenerator implements IdentifierGenerator, Configurable { + + private String seqName; + private Integer tamanho; + + public Serializable generate(SessionImplementor session, Object object) + throws HibernateException { + + Connection connection = session.connection(); + try { + + PreparedStatement ps = connection + .prepareStatement("SELECT " + seqName + ".NEXTVAL AS NEXTVAL FROM DUAL"); + + ResultSet rs = ps.executeQuery(); + + if (rs.next()) { + Integer id = rs.getInt("NEXTVAL"); + String newValue = id.toString(); + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.HABILITAR_CUSTOM_SEQUENCE.getDescricao())) { + newValue = "1" + (StringUtils.leftPad(id.toString(), tamanho, "0")); + } + return Integer.valueOf(newValue); + } + + } catch (SQLException e) { + e.printStackTrace(); + } + return null; + } + + @Override + public void configure(org.hibernate.type.Type arg0, Properties arg1, Dialect arg2) throws MappingException { + setTamanho(Integer.valueOf(arg1.getProperty("tamanho"))); + setSeqName(arg1.getProperty("seqName")); + } + + public Integer getTamanho() { + return tamanho; + } + + public void setTamanho(Integer tamanho) { + this.tamanho = tamanho; + } + + public String getSeqName() { + return seqName; + } + + public void setSeqName(String seqName) { + this.seqName = seqName; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/DepositoBancario.java b/src/com/rjconsultores/ventaboletos/entidad/DepositoBancario.java new file mode 100644 index 000000000..4613f7af0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/DepositoBancario.java @@ -0,0 +1,158 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "DEPOSITO_BANCARIO") +@SequenceGenerator(name = "DEPOSITO_BANCARIO_SEQ", sequenceName = "DEPOSITO_BANCARIO_SEQ", allocationSize = 1) +public class DepositoBancario implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DEPOSITO_BANCARIO_SEQ") + @Column(name = "DEPOSITOBANCARIO_ID") + private Long depositobancarioId; + @Column(name = "PUNTOVENTA_ID") + private Integer puntoventaId; + @Column(name = "IMPORTE") + private BigDecimal importe; + @Column(name = "FORMAPAGO_ID") + private Integer formapagoId; + @Column(name = "BANCO_ID") + private Integer bancoId; + @Column(name = "FECDEPOSITO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecdeposito; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + + public DepositoBancario() { + } + + public DepositoBancario(Long depositobancarioId) { + this.depositobancarioId = depositobancarioId; + } + + public Long getDepositobancarioId() { + return depositobancarioId; + } + + public void setDepositobancarioId(Long depositobancarioId) { + this.depositobancarioId = depositobancarioId; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public Integer getBancoId() { + return bancoId; + } + + public void setBancoId(Integer bancoId) { + this.bancoId = bancoId; + } + + public Date getFecdeposito() { + return fecdeposito; + } + + public void setFecdeposito(Date fecdeposito) { + this.fecdeposito = fecdeposito; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (depositobancarioId != null ? depositobancarioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof DepositoBancario)) { + return false; + } + DepositoBancario other = (DepositoBancario) object; + if ((this.depositobancarioId == null && other.depositobancarioId != null) || (this.depositobancarioId != null && !this.depositobancarioId.equals(other.depositobancarioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.DepositoBancario[depositobancarioId=" + depositobancarioId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/DescontoComissao.java b/src/com/rjconsultores/ventaboletos/entidad/DescontoComissao.java new file mode 100644 index 000000000..73343f1d2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/DescontoComissao.java @@ -0,0 +1,185 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "DESCONTO_COMISSAO") +@SequenceGenerator(name = "DESCONTO_COMISSAO_SEQ", sequenceName = "DESCONTO_COMISSAO_SEQ", allocationSize = 1) +public class DescontoComissao implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DESCONTO_COMISSAO_SEQ") + @Column(name = "DESCONTOCOMISSAO_ID") + private Long descontocomissaoId; + + @Column(name = "PRECO") + private BigDecimal preco; + + @Column(name = "DATAINICIAL") + @Temporal(TemporalType.DATE) + private Date datainicial; + + @Column(name = "DATAFINAL") + @Temporal(TemporalType.DATE) + private Date datafinal; + + @Column(name = "OBSERVACAO") + private String observacao; + + @Column(name = "ACTIVO") + private boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.DATE) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "ITEMDESCONTO_ID") + private ItemDesconto itemDesconto; + + public Long getDescontocomissaoId() { + return descontocomissaoId; + } + + public void setDescontocomissaoId(Long descontocomissaoId) { + this.descontocomissaoId = descontocomissaoId; + } + + public BigDecimal getPreco() { + return preco; + } + + public void setPreco(BigDecimal preco) { + this.preco = preco; + } + + public Date getDatainicial() { + return datainicial; + } + + public void setDatainicial(Date datainicial) { + this.datainicial = datainicial; + } + + public Date getDatafinal() { + return datafinal; + } + + public void setDatafinal(Date datafinal) { + this.datafinal = datafinal; + } + + public String getObservacao() { + return observacao; + } + + public void setObservacao(String observacao) { + this.observacao = observacao; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public ItemDesconto getItemDesconto() { + return itemDesconto; + } + + public void setItemDesconto(ItemDesconto itemDesconto) { + this.itemDesconto = itemDesconto; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((descontocomissaoId == null) ? 0 : descontocomissaoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + DescontoComissao other = (DescontoComissao) obj; + if (descontocomissaoId == null) { + if (other.descontocomissaoId != null) + return false; + } else if (!descontocomissaoId.equals(other.descontocomissaoId)) + return false; + return true; + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/DetAbastoBoleto.java b/src/com/rjconsultores/ventaboletos/entidad/DetAbastoBoleto.java new file mode 100644 index 000000000..bade0a3ad --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/DetAbastoBoleto.java @@ -0,0 +1,191 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "DET_ABASTO_BOLETO_SEQ", sequenceName = "DET_ABASTO_BOLETO_SEQ", allocationSize = 1) +@Table(name = "DET_ABASTO_BOLETO") +public class DetAbastoBoleto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DET_ABASTO_BOLETO_SEQ") + @Column(name = "DETABASTOBOLETO_ID") + private Integer detabastoboletoId; + @Column(name = "NUMMOVIMIENTO") + private Long nummovimiento; + @Column(name = "NUMSERIEPREIMPRESA") + private String numseriepreimpresa; + @Column(name = "NUMFOLIOINICIAL") + private String numfolioinicial; + @Column(name = "NUMFOLIOFINAL") + private String numfoliofinal; + @Column(name = "STATUSFIRMA") + private Boolean statusfirma; + @Column(name = "STATUSOPERACION") + private Integer statusoperacion; + @Column(name = "STATUSENVIO") + private Boolean statusenvio; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "INDINUTILIZA") + private Boolean indinutiliza; + @JoinColumn(name = "ABASTOBOLETO_ID", referencedColumnName = "ABASTOBOLETO_ID") + @ManyToOne + private AbastoBoleto abastoBoleto; + + public Integer getDetabastoboletoId() { + return detabastoboletoId; + } + + public void setDetabastoboletoId(Integer detabastoboletoId) { + this.detabastoboletoId = detabastoboletoId; + } + + public Long getNummovimiento() { + return nummovimiento; + } + + public void setNummovimiento(Long nummovimiento) { + this.nummovimiento = nummovimiento; + } + + public String getNumseriepreimpresa() { + return numseriepreimpresa; + } + + public void setNumseriepreimpresa(String numseriepreimpresa) { + this.numseriepreimpresa = numseriepreimpresa; + } + + public String getNumfolioinicial() { + return numfolioinicial; + } + + public void setNumfolioinicial(String numfolioinicial) { + this.numfolioinicial = numfolioinicial; + } + + public String getNumfoliofinal() { + return numfoliofinal; + } + + public void setNumfoliofinal(String numfoliofinal) { + this.numfoliofinal = numfoliofinal; + } + + public Boolean getStatusfirma() { + return statusfirma; + } + + public void setStatusfirma(Boolean statusfirma) { + this.statusfirma = statusfirma; + } + + public Integer getStatusoperacion() { + return statusoperacion; + } + + public void setStatusoperacion(Integer statusoperacion) { + this.statusoperacion = statusoperacion; + } + + public Boolean getStatusenvio() { + return statusenvio; + } + + public void setStatusenvio(Boolean statusenvio) { + this.statusenvio = statusenvio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getIndinutiliza() { + return indinutiliza; + } + + public void setIndinutiliza(Boolean indinutiliza) { + this.indinutiliza = indinutiliza; + } + + public AbastoBoleto getAbastoBoleto() { + return abastoBoleto; + } + + public void setAbastoBoleto(AbastoBoleto abastoBoleto) { + this.abastoBoleto = abastoBoleto; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((detabastoboletoId == null) ? 0 : detabastoboletoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + DetAbastoBoleto other = (DetAbastoBoleto) obj; + if (detabastoboletoId == null) { + if (other.detabastoboletoId != null) + return false; + } else if (!detabastoboletoId.equals(other.detabastoboletoId)) + return false; + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto [detabastoboletoId=" + detabastoboletoId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/DetDiagramaAutobus.java b/src/com/rjconsultores/ventaboletos/entidad/DetDiagramaAutobus.java new file mode 100644 index 000000000..e50e7fb49 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/DetDiagramaAutobus.java @@ -0,0 +1,219 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; +import javax.persistence.Transient; + +import org.apache.commons.lang.StringUtils; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "DET_DIAGRAMA_AUTOBUS_SEQ", sequenceName = "DET_DIAGRAMA_AUTOBUS_SEQ", allocationSize = 1) +@Table(name = "DET_DIAGRAMA_AUTOBUS") +public class DetDiagramaAutobus implements Serializable { + + public final static String WC = "WC";//BAÑO + public final static String TV = "TV";//TELEVISION + public final static String PT = "PT";//PORTA TRAJE + public final static String CF = "CF";//CAFE + public final static String ME = "ME";//MESA + public final static String GE = "GE";//GELADEIRA + public final static String ES = "ES";//ESCADA + public final static String BR = "BR";//BAR + + public final static String ORIENTACION_W = "W";//OESTTE + public final static String ORIENTACION_S = "S";//SUL + public final static String ORIENTACION_E = "E";//LESTE + public final static String ORIENTACION_N = "S";//NORTE + + + + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DET_DIAGRAMA_AUTOBUS_SEQ") + @Column(name = "DETDIAGRAMAAUTOBUS_ID") + private Short detdiagramaautobusId; + @Column(name = "ASIENTO") + private String asiento; + @Column(name = "NUMECOLUMNA") + private Short numecolumna; + @Column(name = "NUMEFILA") + private Short numefila; + @Column(name = "VENDIBLE") + private Boolean vendible; + @Column(name = "INTERNET") + private Boolean internet; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "DIAGRAMAAUTOBUS_ID", referencedColumnName = "DIAGRAMAAUTOBUS_ID") + @ManyToOne + private DiagramaAutobus diagramaAutobus; + @Column(name = "ORIENTACION") + private String orientacion; + + public DetDiagramaAutobus() { + } + + public Short getDetdiagramaautobusId() { + return detdiagramaautobusId; + } + + public void setDetdiagramaautobusId(Short detdiagramaautobusId) { + this.detdiagramaautobusId = detdiagramaautobusId; + } + + public String getAsiento() { + return asiento; + } + + public void setAsiento(String asiento) { + this.asiento = asiento; + } + + public Short getNumecolumna() { + return numecolumna; + } + + public void setNumecolumna(Short numecolumna) { + this.numecolumna = numecolumna; + } + + public Short getNumefila() { + return numefila; + } + + public void setNumefila(Short numefila) { + this.numefila = numefila; + } + + public Boolean getVendible() { + return vendible; + } + + public void setVendible(Boolean vendible) { + this.vendible = vendible; + } + + public Boolean getInternet() { + return internet; + } + + public void setInternet(Boolean internet) { + this.internet = internet; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public DiagramaAutobus getDiagramaAutobus() { + return diagramaAutobus; + } + + public void setDiagramaAutobus(DiagramaAutobus diagramaAutobus) { + this.diagramaAutobus = diagramaAutobus; + } + + public String getOrientacion() { + return orientacion; + } + + public void setOrientacion(String orientacion) { + this.orientacion = orientacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (detdiagramaautobusId != null ? detdiagramaautobusId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof DetDiagramaAutobus)) { + return false; + } + DetDiagramaAutobus other = (DetDiagramaAutobus) object; + if ((this.detdiagramaautobusId == null && other.detdiagramaautobusId != null) || (this.detdiagramaautobusId != null && !this.detdiagramaautobusId.equals(other.detdiagramaautobusId))) { + return false; + } + return true; + } + + /** + * Indica se el tipo del asiento es vendible + * @param tipoAsiento + * @return + */ + @Transient + public static boolean asientoVendible(String tipoAsiento){ + if (StringUtils.isEmpty(tipoAsiento)){ + return false; + } + + if (tipoAsiento.equalsIgnoreCase(CF) + || tipoAsiento.equalsIgnoreCase(PT) + || tipoAsiento.equalsIgnoreCase(TV) + || tipoAsiento.equalsIgnoreCase(WC) + || tipoAsiento.equalsIgnoreCase(GE) + || tipoAsiento.equalsIgnoreCase(ES) + || tipoAsiento.contains(BR)) { + return false; + } + + return true; + } + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus[detdiagramaautobusId=" + detdiagramaautobusId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/DiagramaAutobus.java b/src/com/rjconsultores/ventaboletos/entidad/DiagramaAutobus.java new file mode 100644 index 000000000..b3cf11bb8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/DiagramaAutobus.java @@ -0,0 +1,203 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "DIAGRAMA_AUTOBUS_SEQ", sequenceName = "DIAGRAMA_AUTOBUS_SEQ", allocationSize = 1) +@Table(name = "DIAGRAMA_AUTOBUS") +public class DiagramaAutobus implements Serializable { + + @OneToMany(mappedBy = "diagramaAutobus") + private List autobusList; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DIAGRAMA_AUTOBUS_SEQ") + @Column(name = "DIAGRAMAAUTOBUS_ID") + private Short diagramaautobusId; + @Column(name = "CANTASIENTOS") + private Short cantasientos; + @Column(name = "MARCAAUTOBUS") + private String marcaautobus; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "diagramaAutobus", cascade = CascadeType.ALL,fetch=FetchType.EAGER) + @Fetch(FetchMode.SELECT) + private List detDiagramaAutobusList; + @Column(name = "DESCDIAGRAMA") + private String descDiagrama; + + @Column(name = "INDTIPO") + private Integer indtipo; + + @Column(name = "INDUSAVAGAOFIM") + private Boolean indUsaVagaoFim; + + public DiagramaAutobus() { + super(); + } + + public DiagramaAutobus(Integer indtipo) { + this(); + setIndtipo(indtipo); + } + + public Short getDiagramaautobusId() { + return diagramaautobusId; + } + + public void setDiagramaautobusId(Short diagramaautobusId) { + this.diagramaautobusId = diagramaautobusId; + } + + public Short getCantasientos() { + return cantasientos; + } + + public void setCantasientos(Short cantasientos) { + this.cantasientos = cantasientos; + } + + public String getMarcaautobus() { + return marcaautobus; + } + + public void setMarcaautobus(String marcaautobus) { + this.marcaautobus = marcaautobus; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getDetDiagramaAutobusList() { + List tmp = new ArrayList(); + if (detDiagramaAutobusList != null) { + for (DetDiagramaAutobus ddab : this.detDiagramaAutobusList) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + + this.detDiagramaAutobusList = tmp; + + return tmp; + } + + public void setDetDiagramaAutobusList(List detDiagramaAutobusList) { + this.detDiagramaAutobusList = detDiagramaAutobusList; + } + + public String getDescDiagrama() { + return descDiagrama; + } + + public void setDescDiagrama(String descDiagrama) { + this.descDiagrama = descDiagrama; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (diagramaautobusId != null ? diagramaautobusId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof DiagramaAutobus)) { + return false; + } + DiagramaAutobus other = (DiagramaAutobus) object; + if ((this.diagramaautobusId == null && other.diagramaautobusId != null) || (this.diagramaautobusId != null && !this.diagramaautobusId.equals(other.diagramaautobusId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescDiagrama(); + } + + public List getAutobusList() { + return autobusList; + } + + public void setAutobusList(List autobusList) { + this.autobusList = autobusList; + } + + public Integer getIndtipo() { + return indtipo; + } + + public void setIndtipo(Integer indtipo) { + this.indtipo = indtipo; + } + + public Boolean getIndUsaVagaoFim() { + return indUsaVagaoFim; + } + + public void setIndUsaVagaoFim(Boolean indUsaVagaoFim) { + this.indUsaVagaoFim = indUsaVagaoFim; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/DispositivoEmbarcada.java b/src/com/rjconsultores/ventaboletos/entidad/DispositivoEmbarcada.java new file mode 100644 index 000000000..b8d17ec15 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/DispositivoEmbarcada.java @@ -0,0 +1,201 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "DISPOSITIVO_EMBARCADA_SEQ", sequenceName = "DISPOSITIVO_EMBARCADA_SEQ", allocationSize = 1) +@Table(name = "DISPOSITIVO_EMBARCADA") +public class DispositivoEmbarcada { + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DISPOSITIVO_EMBARCADA_SEQ") + @Column(name = "DISPOSITIVOEMBARCADA_ID") + private Long dispositivoEmbarcadaId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @Column(name = "DESCRICAO") + private String descricao; + @Column(name = "REGISTRO") + private String registro; + @Column(name = "IMEI") + private String imei; + @Column(name = "IND_DISP_BLOQUEADO") + private Boolean indDispBloqueado; + @Column(name = "MOTIVO_DISP_BLOQUEADO") + private String motivoDispBloqueado; + @Column(name = "IND_DISP_MANUTENCAO") + private Boolean indDispManutencao; + @Column(name = "MOTIVO_DISP_MANUTENCAO") + private String motivoDispManutencao; + @Column(name = "IND_DISP_BAIXADO") + private Boolean indDispBaixado; + @Column(name = "MOTIVO_DISP_BAIXADO") + private String motivoDispBaixado; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @OneToOne + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + private Usuario usuario; + + @OneToMany(mappedBy="dispositivoEmbarcada", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List series = new ArrayList(); + + @Column(name = "IND_VENDE_BPE") + private Boolean indVendeNaoBpe; + + @Column(name = "VERSAO") + private String versaoUltimaSinc; + + @Column(name = "FECHORSINC") + private Date dataUltimaSinc; + + public Long getDispositivoEmbarcadaId() { + return dispositivoEmbarcadaId; + } + public void setDispositivoEmbarcadaId(Long dispositivoEmbarcadaId) { + this.dispositivoEmbarcadaId = dispositivoEmbarcadaId; + } + + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + public String getDescricao() { + return descricao; + } + public void setDescricao(String descricao) { + this.descricao = descricao; + } + public String getRegistro() { + return registro; + } + public void setRegistro(String registro) { + this.registro = registro; + } + public String getImei() { + return imei; + } + public void setImei(String imei) { + this.imei = imei; + } + public Boolean getIndDispBloqueado() { + return indDispBloqueado; + } + public void setIndDispBloqueado(Boolean indDispBloqueado) { + this.indDispBloqueado = indDispBloqueado; + } + public String getMotivoDispBloqueado() { + return motivoDispBloqueado; + } + public void setMotivoDispBloqueado(String motivoDispBloqueado) { + this.motivoDispBloqueado = motivoDispBloqueado; + } + public Boolean getIndDispManutencao() { + return indDispManutencao; + } + public void setIndDispManutencao(Boolean indDispManutencao) { + this.indDispManutencao = indDispManutencao; + } + public String getMotivoDispManutencao() { + return motivoDispManutencao; + } + public void setMotivoDispManutencao(String motivoDispManutencao) { + this.motivoDispManutencao = motivoDispManutencao; + } + public Boolean getIndDispBaixado() { + return indDispBaixado; + } + public void setIndDispBaixado(Boolean indDispBaixado) { + this.indDispBaixado = indDispBaixado; + } + public String getMotivoDispBaixado() { + return motivoDispBaixado; + } + public void setMotivoDispBaixado(String motivoDispBaixado) { + this.motivoDispBaixado = motivoDispBaixado; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Usuario getUsuario() { + return usuario; + } + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + public List getSeries() { + return series; + } + public void setSeries(List series) { + this.series = series; + } + + public Boolean getIndVendeNaoBpe() { + return indVendeNaoBpe; + } + public void setIndVendeNaoBpe(Boolean indVendeNaoBpe) { + this.indVendeNaoBpe = indVendeNaoBpe; + } + public String getVersaoUltimaSinc() { + return versaoUltimaSinc; + } + public void setVersaoUltimaSinc(String versaoUltimaSinc) { + this.versaoUltimaSinc = versaoUltimaSinc; + } + public Date getDataUltimaSinc() { + return dataUltimaSinc; + } + public void setDataUltimaSinc(Date dataUltimaSinc) { + this.dataUltimaSinc = dataUltimaSinc; + } + @Override + public String toString() { + return this.getDescricao(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/DispositivoEmbarcadaHistorico.java b/src/com/rjconsultores/ventaboletos/entidad/DispositivoEmbarcadaHistorico.java new file mode 100644 index 000000000..dc2ddea42 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/DispositivoEmbarcadaHistorico.java @@ -0,0 +1,86 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "DISPOSITIVO_EMBARCADA_HIST_SEQ", sequenceName = "DISPOSITIVO_EMBARCADA_HIST_SEQ", allocationSize = 1) +@Table(name = "DISPOSITIVO_EMBARCADA_HIST") +public class DispositivoEmbarcadaHistorico { + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DISPOSITIVO_EMBARCADA_HIST_SEQ") + @Column(name = "DISPOSITIVO_EMBARCADA_HIST_ID") + private Long dispositivoEmbarcadaHistId; + @JoinColumn(name = "DISPOSITIVOEMBARCADA_ID", referencedColumnName = "DISPOSITIVOEMBARCADA_ID") + @ManyToOne + private DispositivoEmbarcada dispositivoEmbarcada; + @Column(name = "DESCRICAO", length = 500) + private String descricao; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "TIPO_BLOQUEIO_DISP_EMBARCADA") + private Integer tipoBloqueioDispositivoEmbarcada; + public Long getDispositivoEmbarcadaHistId() { + return dispositivoEmbarcadaHistId; + } + public void setDispositivoEmbarcadaHistId(Long dispositivoEmbarcadaHistId) { + this.dispositivoEmbarcadaHistId = dispositivoEmbarcadaHistId; + } + public DispositivoEmbarcada getDispositivoEmbarcada() { + return dispositivoEmbarcada; + } + public void setDispositivoEmbarcada(DispositivoEmbarcada dispositivoEmbarcada) { + this.dispositivoEmbarcada = dispositivoEmbarcada; + } + public String getDescricao() { + return descricao; + } + public void setDescricao(String descricao) { + this.descricao = descricao; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Integer getTipoBloqueioDispositivoEmbarcada() { + return tipoBloqueioDispositivoEmbarcada; + } + public void setTipoBloqueioDispositivoEmbarcada(Integer tipoBloqueioDispositivoEmbarcada) { + this.tipoBloqueioDispositivoEmbarcada = tipoBloqueioDispositivoEmbarcada; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Division.java b/src/com/rjconsultores/ventaboletos/entidad/Division.java new file mode 100644 index 000000000..5920a57b5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Division.java @@ -0,0 +1,155 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@Entity +@SequenceGenerator(name = "DIVISION_SEQ", sequenceName = "DIVISION_SEQ", allocationSize = 1) +@Table(name = "DIVISION") +public class Division implements Serializable, Auditavel { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "DIVISION_SEQ") + @Column(name = "DIVISION_ID") + private Integer divisionId; + + @Column(name = "NOMBDIVISION") + private String nombDivion; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Transient + @NaoAuditar + private Division divisionClone; + + public Division() { + + } + + public Division(Integer divisionId) { + this.divisionId = divisionId; + } + + public Integer getDivisionId() { + return divisionId; + } + + public void setDivisionId(Integer divisionId) { + this.divisionId = divisionId; + } + + public String getNombDivion() { + return nombDivion; + } + + public void setNombDivion(String nombDivion) { + this.nombDivion = nombDivion; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((divisionId == null) ? 0 : divisionId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof Division)) + return false; + Division other = (Division) obj; + if (getDivisionId() == null) { + if (other.getDivisionId() != null) + return false; + } else if (!getDivisionId().equals(other.getDivisionId())) + return false; + return true; + } + + @Override + public String toString() { + return this.getNombDivion(); + } + + @Override + public void clonar() throws CloneNotSupportedException { + divisionClone = new Division(); + divisionClone = (Division) this.clone(); + } + + @Override + public Division getCloneObject() { + return divisionClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getDivisionId()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmbarcadaDispOperador.java b/src/com/rjconsultores/ventaboletos/entidad/EmbarcadaDispOperador.java new file mode 100644 index 000000000..50b26d77d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmbarcadaDispOperador.java @@ -0,0 +1,104 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "EMBARCADADISPOPERADOR_SEQ", sequenceName = "EMBARCADADISPOPERADOR_SEQ", allocationSize = 1) +@Table(name = "EMBARCADA_DISP_OPERADOR") +public class EmbarcadaDispOperador { + + public EmbarcadaDispOperador() { + // TODO Auto-generated constructor stub + } + + public EmbarcadaDispOperador(Long usuarioId, Long dispositivoEmbarcadaId, Long puntoVentaId, Date fecmodif, Boolean activo) { + this.usuarioId = usuarioId; + this.dispositivoEmbarcadaId = dispositivoEmbarcadaId; + this.puntoVentaId = puntoVentaId; + this.activo = activo !=null ? activo : Boolean.TRUE; + this.fecmodif = fecmodif !=null ? fecmodif : new Date(); + + } + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMBARCADADISPOPERADOR_SEQ") + @Column(name = "EMBARCADADISPOPERADOR_ID") + private Long embarcadaDispOperador; + + @Column(name = "DISPOSITIVOEMBARCADA_ID") + private Long dispositivoEmbarcadaId; + + @Column(name = "USUARIO_ID") + private Long usuarioId; + + @Column(name = "PUNTOVENTA_ID") + private Long puntoVentaId; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "ACTIVO") + private Boolean activo; + + public Long getEmbarcadaDispOperador() { + return embarcadaDispOperador; + } + + public void setEmbarcadaDispOperador(Long embarcadaDispOperador) { + this.embarcadaDispOperador = embarcadaDispOperador; + } + + public Long getDispositivoEmbarcadaId() { + return dispositivoEmbarcadaId; + } + + public void setDispositivoEmbarcadaId(Long dispositivoEmbarcadaId) { + this.dispositivoEmbarcadaId = dispositivoEmbarcadaId; + } + + public Long getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Long usuarioId) { + this.usuarioId = usuarioId; + } + + public Long getPuntoVentaId() { + return puntoVentaId; + } + + public void setPuntoVentaId(Long puntoVentaId) { + this.puntoVentaId = puntoVentaId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmbarqueCatracaRodoviaria.java b/src/com/rjconsultores/ventaboletos/entidad/EmbarqueCatracaRodoviaria.java new file mode 100644 index 000000000..d7583aa3d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmbarqueCatracaRodoviaria.java @@ -0,0 +1,116 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@Table(name = "EMBARQUE_CATRACA_RODOVIARIA") +@SequenceGenerator(name = "EMBARQUE_CATRACA_ROD_SEQ", sequenceName = "EMBARQUE_CATRACA_ROD_SEQ", allocationSize = 1) +public class EmbarqueCatracaRodoviaria implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "EMBARQUECATRACARODOVIARIA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMBARQUE_CATRACA_ROD_SEQ") + private Integer embarqueCatracaRodoviariaId; + + @Column + private Boolean activo; + + @ManyToOne(targetEntity = Empresa.class) + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @ManyToOne(targetEntity = Parada.class) + @JoinColumn(name = "PARADA_ID") + private Parada parada; + + @Column + private Integer sequenciaRod; + + @Column(name = "EMPRESAROD_ID") + private Integer empresaRod; + + @ManyToOne(targetEntity = Usuario.class) + @JoinColumn(name = "USUARIO_ID") + private Usuario usuario; + + @Column + private Date fecModif; + + public Integer getEmbarqueCatracaRodoviariaId() { + return embarqueCatracaRodoviariaId; + } + + public void setEmbarqueCatracaRodoviariaId(Integer embarqueCatracaRodoviariaId) { + this.embarqueCatracaRodoviariaId = embarqueCatracaRodoviariaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa emrpesa) { + this.empresa = emrpesa; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public Integer getSequenciaRod() { + return sequenciaRod; + } + + public void setSequenciaRod(Integer sequenciaRod) { + this.sequenciaRod = sequenciaRod; + } + + public Integer getEmpresaRod() { + return empresaRod; + } + + public void setEmpresaRod(Integer empresaRod) { + this.empresaRod = empresaRod; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public Date getFecModif() { + return fecModif; + } + + public void setFecModif(Date fecModif) { + this.fecModif = fecModif; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Empleado.java b/src/com/rjconsultores/ventaboletos/entidad/Empleado.java new file mode 100644 index 000000000..5acca9cd2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Empleado.java @@ -0,0 +1,261 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "EMPLEADO_SEQ", sequenceName = "EMPLEADO_SEQ", allocationSize = 1) +@Table(name = "EMPLEADO") +public class Empleado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPLEADO_SEQ") + @Column(name = "EMPLEADO_ID") + private Integer empleadoId; + @Column(name = "CVEEMPLEADO") + private String cveEmpleado; + @Column(name = "NOMBEMPLEADO") + private String nombEmpleado; + @Column(name = "NOMBPATERNO") + private String nombPaterno; + @Column(name = "NOMBMATERNO") + private String nombMaterno; + @Column(name = "FECNACIMIENTO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecNacimiento; + @Column(name = "FECINGRESO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecIngreso; + @Column(name = "FECBAJA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecBaja; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "DESCCALLE") + private String descCalle; + @Column(name = "NUMEXTINT") + private String numExtInt; + @Column(name = "CODPOSTAL") + private String codPostal; + @Column(name = "DESCCORREO") + private String desccorreo; + + @JoinColumn(name = "TIPOEMPLEADO_ID", referencedColumnName = "TIPOEMPLEADO_ID") + @ManyToOne + private TipoEmpleado tipoEmpleado; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + public Empleado() { + super(); + } + + public Empleado(Integer empleadoId) { + this(); + this.empleadoId = empleadoId; + } + + public Empleado(Integer empleadoId, String nombEmpleado) { + this(); + this.empleadoId = empleadoId; + this.nombEmpleado = nombEmpleado; + } + + public Empleado(Integer empleadoId, Date fecmodif) { + this(); + this.empleadoId = empleadoId; + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getCveEmpleado() { + return cveEmpleado; + } + + public void setCveEmpleado(String cveEmpleado) { + this.cveEmpleado = cveEmpleado; + } + + public Integer getEmpleadoId() { + return empleadoId; + } + + public void setEmpleadoId(Integer empleadoId) { + this.empleadoId = empleadoId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Date getFecBaja() { + return fecBaja; + } + + public void setFecBaja(Date fecBaja) { + this.fecBaja = fecBaja; + } + + public Date getFecIngreso() { + return fecIngreso; + } + + public void setFecIngreso(Date fecIngreso) { + this.fecIngreso = fecIngreso; + } + + public Date getFecNacimiento() { + return fecNacimiento; + } + + public void setFecNacimiento(Date fecNacimiento) { + this.fecNacimiento = fecNacimiento; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public String getNombEmpleado() { + return nombEmpleado; + } + + public void setNombEmpleado(String nombEmpleado) { + this.nombEmpleado = nombEmpleado; + } + + public String getNombMaterno() { + return nombMaterno; + } + + public void setNombMaterno(String nombMaterno) { + this.nombMaterno = nombMaterno; + } + + public String getNombPaterno() { + return nombPaterno; + } + + public void setNombPaterno(String nombPaterno) { + this.nombPaterno = nombPaterno; + } + + public TipoEmpleado getTipoEmpleado() { + return tipoEmpleado; + } + + public void setTipoEmpleado(TipoEmpleado tipoEmpleado) { + this.tipoEmpleado = tipoEmpleado; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getDescCalle() { + return descCalle; + } + + public void setDescCalle(String descCalle) { + this.descCalle = descCalle; + } + + public String getNumExtInt() { + return numExtInt; + } + + public void setNumExtInt(String numExtInt) { + this.numExtInt = numExtInt; + } + + public String getCodPostal() { + return codPostal; + } + + public void setCodPostal(String codPostal) { + this.codPostal = codPostal; + } + + public String getDesccorreo() { + return desccorreo; + } + + public void setDesccorreo(String desccorreo) { + this.desccorreo = desccorreo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (empleadoId != null ? empleadoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Empleado)) { + return false; + } + Empleado other = (Empleado) object; + if ((this.empleadoId == null && other.empleadoId != null) || (this.empleadoId != null && !this.empleadoId.equals(other.empleadoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + String nombMaterno = getNombMaterno() != null ? getNombMaterno() : ""; + String nombPaterno = getNombPaterno() != null ? getNombPaterno() : ""; + return getNombEmpleado() + " " + nombMaterno + " " + nombPaterno; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Empresa.java b/src/com/rjconsultores/ventaboletos/entidad/Empresa.java new file mode 100644 index 000000000..f4ae5d35f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Empresa.java @@ -0,0 +1,1475 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.Predicate; +import org.apache.commons.lang.BooleanUtils; +import org.hibernate.annotations.Where; + +import com.rjconsultores.ventaboletos.enums.TipoCstGratuidade; + +import br.com.rjconsultores.auditador.annotations.AuditarID; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * + * @author Rafius + */ + +@Entity +@SequenceGenerator(name = "EMPRESA_SEQ", sequenceName = "EMPRESA_SEQ", allocationSize = 1) +@Table(name = "EMPRESA") +public class Empresa implements Serializable, Auditavel { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_SEQ") + @Column(name = "EMPRESA_ID") + @AuditarID + private Integer empresaId; + + @Column(name = "NOMBEMPRESA") + private String nombempresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "empresa") + private List puntoVentaList; + @Column(name = "INDEXTERNA") + private Boolean indExterna; + @Column(name = "INDTIPO") + private Short indTipo; + @Column(name = "INDPAGOCONDUCTOR") + private Boolean pagoConductor; + @OneToMany(mappedBy = "empresa") + private List corridaList; + @OneToMany(mappedBy = "empresa1") + private List corridaList1; + @Column(name = "EQUIVALENCIAELEKTRA_ID") + private String equivalenciaElektraId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "RFC") + private String rfc; + @Column(name = "CNPJ") + private String cnpj; + @Column(name = "LOGRADOURO") + private String logradouro; + @Column(name = "NUMERO") + private String numero; + @Column(name = "COMPLEMENTO") + private String complemento; + @Column(name = "CEP") + private String cep; + @Column(name = "BAIRRO") + private String bairro; + @Column(name = "CODANTT") + private String codantt; + @Column(name = "CODDER") + private String codder; + @OneToOne(cascade = CascadeType.MERGE) + @JoinColumn(name = "CIUDAD_ID") + private Ciudad cidade; + @OneToMany(mappedBy = "empresa") + private List empresaImpostoList; + @Column(name = "NUMTELEFONO") + private String numtelefono; + @Column(name = "NUMTELSACDEF") + private String numtelsacdef; + @Column(name = "INDCARBOLETOSDEVOLVIDOSCONF") + private Boolean indcarboletosdevolvidosconf; + @Column(name = "INDBILHETEDEVDEBITODINHEIRO") + private Boolean indBilheteDevDebitoDinheiro; + + @Column(name = "INDBOLETOAGRUPADO") + private Boolean indBoletoAgrupado; + + @Column(name = "INDVALIDABLOQUEIOECF") + private Boolean indvalidabloqueioecf; + + @Column(name = "INDFECHATARIFA") + private Boolean indfechatarifa; + + @Column(name = "INDEXIGEBPEEXCESSOBAGAGEM") + private Boolean indExigeBpeExcessoBagagem; + + @OneToMany(mappedBy = "empresa") + private List inscricoesEstaduais; + + @OneToMany(mappedBy = "empresa", cascade = CascadeType.ALL) + private List empresaContaBancaria; + + @OneToMany(mappedBy = "empresa") + @Where(clause="ACTIVO=1") + private List comEmpCategorias; + + @OneToMany(mappedBy = "empresa") + @Where(clause="ACTIVO=1") + private List comEmpFormapagos; + + @OneToMany(mappedBy = "empresa") + @Where(clause="ACTIVO=1") + private List comEmpTipoEventoExtras; + + @OneToMany(mappedBy = "empresa") + @Where(clause="ACTIVO=1") + private List comEmpConferencias; + + @Column(name = "INDGENNUMFOLIOVTAINTIMPOST") + private Boolean indgennumfoliovtaintimpost; + + @Column(name = "INDENVIAEMAILCOMISSAO") + private Boolean indenviaemailcomissao; + + @Column(name = "INDNAOPERMITECONFSEMMALOTE") + private Boolean indnaopermiteconfsemmalote; + + @Column(name = "INDOBRIGANOMEPASSAGEIRO") + private Boolean indobrigarinformarnomepassageiro; + + @Column(name = "INDBLOQVDAIMPPOSTERIOR") + private Boolean indBloqVdaImpPosterior; + + @Column(name = "EMAIL_PENDENCIA") + private String email; + + @Column(name = "INDIMPRIMEGRATUIDADE") + private Boolean indImprimeGratuidade; + + @Column(name = "INDFIDELIDADE") + private Boolean indFidelidade; + + @Column(name = "PONTUACAOFRAUDEINI") + private String pontuacaoFraudeIni; + + @Column(name = "PONTUACAOFRAUDEFIM") + private String pontuacaoFraudeFim; + + @Column(name = "INDVALIDADESCONTOTARIFA") + private Boolean indValidaDescontoTarifa; + + @Column(name = "INDUTILIZAFIDELIDADE") + private Boolean indUtilizaFidelidade; + + @Column(name = "INDUSAALIASLOCALIDADE") + private Boolean indUsarAliasMapaViagem; + + @Column(name = "INDEMITECUPOMFISCALREMARCACAO") + private Boolean indEmiteCupomFiscalRemarcacao; + + @Column(name = "INDNAOALTERARDIAGRAMA") + private Boolean indNaoAlterarDiagrama; + + @Column(name = "INDIMPRIMESEGVIATRANSFERENCIA") + private Boolean indImprimeSegviaTransferencia; + + @Column(name = "INDIMPRIMECUPEMBVENDAMANUAL") + private Boolean indImprimirCupomEmbarqueVendaManual; + + @Column(name = "INDPERMVENMANUTODOSESTADOS") + private Boolean indPermiteVendaManualTodosEstados; + + @Column(name = "INDIMPRIME2VIAS") + private Boolean indImprime2Vias; + + @Column(name = "INDIMPRIME2VIASDEVOLUCAO") + private Boolean indImprime2ViasDevolucao; + + @Column(name = "CODIGO_EMTU") + private Integer codigoEmtu; + + @Column(name = "SEQUENCIA_EMTU") + private Integer sequenciaEmtu; + + @Column(name = "CNAE") + private String cnae; + + @Column(name = "TARBPE") + private String tarBPe; + + @Column(name = "CRTBPE") + private Integer crtBPe; + + @Column(name = "INDEMITEBPEVDAIMPPOSTERIOR") + private Boolean indEmiteBpeVdaImpPosterior; + + @Column(name = "INDCANCELABPETROCAORIGDEST") + private Boolean indCancelaBpeTrocaOrigDest; + + @Column(name = "INDTRANSFERENCIABPEMOVICAJA") + private Boolean indTransferenciaBpeMoviCaja; + + @Column(name = "CNPJAUTORIZADORA") + private String cnpjAutorizadora; + + @Column(name = "CPFCNPJ_AUTDOWNLOAD") + private String cpfCnpjAutDownload; + + @Column(name = "INDUTILIZARESOLUCAO") + private Boolean indUtilizaResolucao; + + @Column(name = "INDUTIFOLIOLOCAPREPAGOABERTO") + private Boolean indUtiFolioLocaPrepagoAberto; + + @Column(name = "INDIMPRIME2VIASIMPRENAOFISCAL") + private Boolean indImprime2ViasImpreNaoFiscal; + + @Column(name = "INDEXIBEDIFMENORTROCACEECF") + private Boolean indExibeDiferencaMenorTrocaCupomEmbarqueEcf; + + @Column(name = "INDPERMITETROCAVDAABERTO") + private Boolean indPermiteTrocaVdaAberto; + + @Column(name = "INDEXIBECOMISSAOZERADAAGENCIA") + private Boolean indExibeComissaoZeradaAgencia; + + @Column(name = "INDPERMREATIVBPEESTNAOBPE") + private Boolean indPermiteReativacaoPassagemBpeEstacaoNaoBpe; + + @Column(name = "INDIMPEMBARQDESEMBARQCUPOM") + private Boolean indImprimirEmbarqueDesembarqCupom; + + @Column(name = "ANTIFRAUDEKEY") + private String antifraudekey; + + @Column(name = "INDOUTRASFPVDACALLCENTER") + private Boolean indOutrasFPVdaCallCenter; + + @Column(name = "INDEMITEDABPEVDACALLCENTER") + private Boolean indEmiteDABpeVdaCallCenter; + + @Column(name = "INDEMITEDABPEVDAINTERNET") + private Boolean indEmiteDABpeVdaInternet; + + @Column(name = "INDEMITEDABPEVDAINTJ3") + private Boolean indEmiteDABpeVdaIntJ3; + + @Column(name = "INDEMITEDABPEVDAFIDELIDADE") + private Boolean indEmiteDABpeVdaFidelidade; + + @Column(name = "INDEXIGECLICOMPVDACALLCENTER") + private Boolean indExigeClienteCompradorVdaCallCenter; + + @Column(name = "INDEMITECANCBPETROCAORIGDEST") + private Boolean indEmiteDeclaracaoCancelaBpeTrocaOrigDest; + + @Column(name = "INDREAPROVEITARNUMBPEREJEITADO") + private Boolean indReaproveitarNumBPeRejeitado; + + @Column(name = "INDSUBSTITUICAOIGUALSEFAZ") + private Boolean indSubstituicaoIgualSefaz; + + @Column(name = "INDVENDAESTUDANTETOTEM") + private Boolean indVendaEstudanteTotem; + + @Column(name = "INDIMPRIMERELFECHDETEMBARCADA") + private Boolean indImprimeRelFechamentoViagemDetalhadoEmarcada; + + @Column(name = "INDIMPLOGOBILHETEVTAEMBARCADA") + private Boolean indImprimeLogoBilheteVendaEmbarcada; + + @Column(name = "INDCODBARCPEMBARQUE") + private Boolean indCodBarCpEmbarque; + + @Column(name = "INDEMITECOMPCANCELSITEF") + private Boolean indEmiteComprovanteCancelamentoSitef; + + @Column(name = "INDIMPRIMIRCOMPPAGSEGOPCIONAL") + private Boolean indImprimirComprovantePagamentoSeguroOpcional; + + @Column(name = "INDENCERRAVIAGEMFECHORLLEGADA") + private Boolean indEncerraViagemFechorllegada; + + @Column(name = "INDIMPSEGOPCIONALENTVDAPOSTERI") + private Boolean indImprimirSeguroOpcionalEntregaVdaImpPosterior; + + @Column(name = "INDTABELAPRECOEMBARCADA") + private Boolean indTabelaPrecoEmbarcada; + + @Column(name = "INDIMPRESSAOCANHOTOEMBARCADA") + private Boolean indImpressaoCanhotoEmbarcada; + + @Column(name = "INDIMPRIMEQRCODEADICIONAL") + private Boolean indImprimeQRCodeAdicional; + + @Column(name = "INDALTPOSICAOCAMPOSCUPOM") + private Boolean indAltPosicaoCamposCupom; + + @Column(name = "INDIMPRIMEVOUCHERPERSONALIZADO") + private Boolean indImprimeVoucherPersonalizado; + + @Column(name = "INDIMPCOMPROVANTERESERVA") + private Boolean indImpComprovanteReserva; + + @Column(name = "CAMPO_CUSTOM_VOUCHER") + private String campoCustomVoucher; + + @Column(name = "INDENVIADADOSAGENCIABPE") + private Boolean indEnviaDadosAgenciaBpe; + + @Column(name = "INDPRECOPORDEMANDA") + private Boolean indPrecoPorDemanda; + + @Column(name = "INDRATEIOCOMISSAOGRUPOLINHA") + private Boolean indRateioComissaoGrupoLinha; + + @Column(name = "INDCOMISSAOGRUPOLINHAORIGINAL") + private Boolean indComissaoGrupoLinhaOriginal; + + @Enumerated(EnumType.STRING) + @Column(name = "CST_GRATUIDADE") + private TipoCstGratuidade cstGratuidade; + + @Column(name = "INDSEGUNDAVIAFECHAMENTOCAIXA") + private Boolean indSegundaViaFechamentoCaixa; + + @Column(name = "URLBASESEGURO") + private String urlBaseEmpresaSeguro; + + @Column(name = "CODCONTPREVIDENCIA") + private String codContPrevidencia; + + @Column(name = "INDMANTEMVDACAJAVDAEMBARCADA") + private Boolean indMantemVdaCajaVdaEmbarcada; + + @Column(name = "INDALERTAVDAPOSHORARIOVIAGEM") + private Boolean indAlertaVDAPosHorarioViagem; + + @Column(name = "INDCONFMOVFPTROCAVLRDEPOSITO") + private Boolean indConfMovFPTrocaVlrDeposito; + + @Column(name = "INDCOMTRANSFGERACAJA") + private Boolean indComTransfGeraCaja; + + @Column(name = "INDPRICINGVENDAABERTO") + private Boolean indPricingVendaAberto; + + @Column(name = "INDNAOPERMITETROCAENTREEMPRESA") + private Boolean indNaoPermiteTrocaEntreEmpresa; + + @Column(name = "INDVENDAABERTOMOVIMENTOCAIXA") + private Boolean indVendaAbertoMovimentaCaixa; + + @Column(name = "INDICEIRK") + private BigDecimal indiceIRK; + + @Column(name = "INDNAOIMPRIMECUPOMVENDABERTO") + private Boolean indNaoImprimeCupomEmbarqueVendaAberto; + + @Column(name = "INDNAOIMPRIMECUPOMCONFABERTO") + private Boolean indNaoImprimeCupomEmbarqueConfirmacaoAberto; + + @Column(name = "INDSEGUROOPCIONALW2DIGITAL") + private Boolean indSeguroOpcionalW2Digital; + + + @Transient + @NaoAuditar + private Empresa empresaClone; + + public Empresa() { + super(); + } + + public Empresa(Integer empresaId) { + this(); + this.empresaId = empresaId; + } + + public Empresa(Integer empresaId, String nombempresa) { + this(); + this.empresaId = empresaId; + this.nombempresa = nombempresa; + } + + public Empresa(Integer empresaId, Date fecmodif) { + this(); + this.empresaId = empresaId; + this.fecmodif = fecmodif; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPuntoVentaList() { + return puntoVentaList; + } + + public void setPuntoVentaList(List puntoVentaList) { + this.puntoVentaList = puntoVentaList; + } + + public Boolean getIndExterna() { + return indExterna; + } + + public void setIndExterna(Boolean indExterna) { + this.indExterna = indExterna; + } + + public Short getIndTipo() { + return indTipo; + } + + public void setIndTipo(Short indTipo) { + this.indTipo = indTipo; + } + + public Boolean getPagoConductor() { + return pagoConductor; + } + + public void setPagoConductor(Boolean pagoConductor) { + this.pagoConductor = pagoConductor; + } + + public String getEquivalenciaElektraId() { + return equivalenciaElektraId; + } + + public void setEquivalenciaElektraId(String equivalenciaElektraId) { + this.equivalenciaElektraId = equivalenciaElektraId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public String getRfc() { + return rfc; + } + + public void setRfc(String rfc) { + this.rfc = rfc; + } + + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + public String getLogradouro() { + return logradouro; + } + + public void setLogradouro(String logradouro) { + this.logradouro = logradouro; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public Ciudad getCidade() { + return cidade; + } + + public void setCidade(Ciudad cidade) { + this.cidade = cidade; + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + public List getCorridaList1() { + return corridaList1; + } + + public void setCorridaList1(List corridaList1) { + this.corridaList1 = corridaList1; + } + + public List getEmpresaImpostoList() { + + return this.empresaImpostoList; + } + + public void setEmpresaImpostoList(List empresaImpostoList) { + this.empresaImpostoList = empresaImpostoList; + } + + public String getCodantt() { + return codantt; + } + + public void setCodantt(String codantt) { + this.codantt = codantt; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getEmpresaId() != null ? getEmpresaId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Empresa)) { + return false; + } + Empresa other = (Empresa) object; + if ((this.getEmpresaId() == null && other.getEmpresaId() != null) || (this.getEmpresaId() != null && !this.getEmpresaId().equals(other.getEmpresaId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getNombempresa(); + } + + + public List getInscricoesEstaduais() { + return inscricoesEstaduais; + } + + public List getInscricoesEstaduaisActivas() { + + List inscEstaduais = new ArrayList(); + inscEstaduais.addAll(getInscricoesEstaduais()); + + CollectionUtils.filter(inscEstaduais, new Predicate() { + + @Override + public boolean evaluate(Object arg0) { + return ((InscricaoEstadual)arg0).getActivo(); + } + }); + + return inscEstaduais; + } + + public void setInscricoesEstaduais(List inscricoesEstaduais) { + this.inscricoesEstaduais = inscricoesEstaduais; + } + + public String getNumtelefono() { + return numtelefono; + } + + public void setNumtelefono(String numtelefono) { + this.numtelefono = numtelefono; + } + + + /** + * @return the indfechatarifa + */ + public Boolean getIndfechatarifa() { + return indfechatarifa; + } + + /** + * @param indfechatarifa the indfechatarifa to set + */ + public void setIndfechatarifa(Boolean indfechatarifa) { + this.indfechatarifa = indfechatarifa; + } + + + + public List getEmpresaContaBancaria() { + + List tempList = new ArrayList(); + + if (empresaContaBancaria != null) { + for (EmpresaContaBancaria empContaBancaria : this.empresaContaBancaria) { + if (empContaBancaria.getActivo()) { + tempList.add(empContaBancaria); + } + } + } + return tempList; + } + + public void setEmpresaContaBancaria(List empresaContaBancaria) { + this.empresaContaBancaria = empresaContaBancaria; + } + + public Boolean getIndcarboletosdevolvidosconf() { + return indcarboletosdevolvidosconf; + } + + public void setIndcarboletosdevolvidosconf(Boolean indcarboletosdevolvidosconf) { + this.indcarboletosdevolvidosconf = indcarboletosdevolvidosconf; + } + + public List getComEmpCategorias() { + return comEmpCategorias; + } + + public void setComEmpCategorias(List comEmpCategorias) { + this.comEmpCategorias = comEmpCategorias; + } + + public List getComEmpFormapagos() { + return comEmpFormapagos; + } + + public void setComEmpFormapagos(List comEmpFormapagos) { + this.comEmpFormapagos = comEmpFormapagos; + } + + public List getComEmpTipoEventoExtras() { + return comEmpTipoEventoExtras; + } + + public void setComEmpTipoEventoExtras(List comEmpTipoEventoExtras) { + this.comEmpTipoEventoExtras = comEmpTipoEventoExtras; + } + + public List getComEmpConferencias() { + return comEmpConferencias; + } + + public void setComEmpConferencias(List comEmpConferencias) { + this.comEmpConferencias = comEmpConferencias; + } + + public Boolean getIndBoletoAgrupado() { + return indBoletoAgrupado; + } + + public void setIndBoletoAgrupado(Boolean indBoletoAgrupado) { + this.indBoletoAgrupado = indBoletoAgrupado; + } + + public Boolean getIndvalidabloqueioecf() { + return indvalidabloqueioecf; + } + + public void setIndvalidabloqueioecf(Boolean indvalidabloqueioecf) { + this.indvalidabloqueioecf = indvalidabloqueioecf; + } + + public Boolean getIndgennumfoliovtaintimpost() { + return indgennumfoliovtaintimpost; + } + + public void setIndgennumfoliovtaintimpost(Boolean indgennumfoliovtaintimpost) { + this.indgennumfoliovtaintimpost = indgennumfoliovtaintimpost; + } + + public Boolean getIndenviaemailcomissao() { + return indenviaemailcomissao; + } + + public void setIndenviaemailcomissao(Boolean indenviaemailcomissao) { + this.indenviaemailcomissao = indenviaemailcomissao; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Boolean getIndnaopermiteconfsemmalote() { + return indnaopermiteconfsemmalote; + } + + public void setIndnaopermiteconfsemmalote(Boolean indnaopermiteconfsemmalote) { + this.indnaopermiteconfsemmalote = indnaopermiteconfsemmalote; + } + + public Boolean getIndobrigarinformarnomepassageiro() { + return indobrigarinformarnomepassageiro; + } + + public void setIndobrigarinformarnomepassageiro(Boolean indobrigarinformarnomepassageiro) { + this.indobrigarinformarnomepassageiro = indobrigarinformarnomepassageiro; + } + + /** + * @return the indImprimeGratuidade + */ + public Boolean getIndImprimeGratuidade() { + return indImprimeGratuidade; + } + + /** + * @param indImprimeGratuidade the indImprimeGratuidade to set + */ + public void setIndImprimeGratuidade(Boolean indImprimeGratuidade) { + this.indImprimeGratuidade = indImprimeGratuidade; + } + + public Boolean getIndFidelidade() { + return indFidelidade; + } + + public void setIndFidelidade(Boolean indFidelidade) { + this.indFidelidade = indFidelidade; + } + + public String getPontuacaoFraudeIni() { + return pontuacaoFraudeIni; + } + + public void setPontuacaoFraudeIni(String pontuacaoFraudeIni) { + this.pontuacaoFraudeIni = pontuacaoFraudeIni; + } + + public String getPontuacaoFraudeFim() { + return pontuacaoFraudeFim; + } + + public void setPontuacaoFraudeFim(String pontuacaoFraudeFim) { + this.pontuacaoFraudeFim = pontuacaoFraudeFim; + } + + /** + * @return the indValidaDescontoTarifa + */ + public Boolean getIndValidaDescontoTarifa() { + return indValidaDescontoTarifa; + } + + /** + * @param indValidaDescontoTarifa the indValidaDescontoTarifa to set + */ + public void setIndValidaDescontoTarifa(Boolean indValidaDescontoTarifa) { + this.indValidaDescontoTarifa = indValidaDescontoTarifa; + } + + public Boolean getIndUtilizaFidelidade() { + return indUtilizaFidelidade; + } + + public void setIndUtilizaFidelidade(Boolean indUtilizaFidelidade) { + this.indUtilizaFidelidade = indUtilizaFidelidade; + } + + public Boolean getIndUsarAliasMapaViagem() { + return indUsarAliasMapaViagem; + } + + public void setIndUsarAliasMapaViagem(Boolean indUsarAliasMapaViagem) { + this.indUsarAliasMapaViagem = indUsarAliasMapaViagem; + } + + public Boolean getIndBilheteDevDebitoDinheiro() { + return indBilheteDevDebitoDinheiro; + } + + public void setIndBilheteDevDebitoDinheiro(Boolean indBilheteDevDebitoDinheiro) { + this.indBilheteDevDebitoDinheiro = indBilheteDevDebitoDinheiro; + } + + public Boolean getIndNaoAlterarDiagrama() { + return indNaoAlterarDiagrama; + } + + public void setIndNaoAlterarDiagrama(Boolean indNaoAlterarDiagrama) { + this.indNaoAlterarDiagrama = indNaoAlterarDiagrama; + } + + + public Boolean getIndEmiteCupomFiscalRemarcacao() { + return indEmiteCupomFiscalRemarcacao; + } + + public void setIndEmiteCupomFiscalRemarcacao(Boolean indEmiteCupomFiscalRemarcacao) { + this.indEmiteCupomFiscalRemarcacao = indEmiteCupomFiscalRemarcacao; + } + + public Boolean getIndBloqVdaImpPosterior() { + return indBloqVdaImpPosterior; + } + + public void setIndBloqVdaImpPosterior(Boolean indBloqVdaImpPosterior) { + this.indBloqVdaImpPosterior = indBloqVdaImpPosterior; + } + + public Boolean getIndImprimeSegviaTransferencia() { + return indImprimeSegviaTransferencia; + } + + public void setIndImprimeSegviaTransferencia(Boolean indImprimeSegviaTransferencia) { + this.indImprimeSegviaTransferencia = indImprimeSegviaTransferencia; + } + + public Boolean getIndImprimirCupomEmbarqueVendaManual() { + return indImprimirCupomEmbarqueVendaManual; + } + + public void setIndImprimirCupomEmbarqueVendaManual(Boolean indImprimirCupomEmbarqueVendaManual) { + this.indImprimirCupomEmbarqueVendaManual = indImprimirCupomEmbarqueVendaManual; + } + + public Boolean getIndPermiteVendaManualTodosEstados() { + return indPermiteVendaManualTodosEstados; + } + + public void setIndPermiteVendaManualTodosEstados(Boolean indPermiteVendaManualTodosEstados) { + this.indPermiteVendaManualTodosEstados = indPermiteVendaManualTodosEstados; + } + + public String getNumtelsacdef() { + return numtelsacdef; + } + + public void setNumtelsacdef(String numtelsacdef) { + this.numtelsacdef = numtelsacdef; + } + + public Integer getCodigoEmtu() { + return codigoEmtu; + } + + public void setCodigoEmtu(Integer codigoEmtu) { + this.codigoEmtu = codigoEmtu; + } + + public Integer getSequenciaEmtu() { + return sequenciaEmtu; + } + + public void setSequenciaEmtu(Integer sequenciaEmtu) { + this.sequenciaEmtu = sequenciaEmtu; + } + + public Boolean getIndImprime2Vias() { + return indImprime2Vias; + } + + public void setIndImprime2Vias(Boolean indImprime2Vias) { + this.indImprime2Vias = indImprime2Vias; + } + + public String getCnae() { + return cnae; + } + + public void setCnae(String cnae) { + this.cnae = cnae; + } + + public String getTarBPe() { + return tarBPe; + } + + public void setTarBPe(String tarBPe) { + this.tarBPe = tarBPe; + } + + public Integer getCrtBPe() { + return crtBPe; + } + + public void setCrtBPe(Integer crtBPe) { + this.crtBPe = crtBPe; + } + + public Boolean getIndEmiteBpeVdaImpPosterior() { + return indEmiteBpeVdaImpPosterior; + } + + public void setIndEmiteBpeVdaImpPosterior(Boolean indEmiteBpeVdaImpPosterior) { + this.indEmiteBpeVdaImpPosterior = indEmiteBpeVdaImpPosterior; + } + + public Boolean getIndCancelaBpeTrocaOrigDest() { + return indCancelaBpeTrocaOrigDest; + } + + public void setIndCancelaBpeTrocaOrigDest(Boolean indCancelaBpeTrocaOrigDest) { + this.indCancelaBpeTrocaOrigDest = indCancelaBpeTrocaOrigDest; + } + + public Boolean getIndTransferenciaBpeMoviCaja() { + return indTransferenciaBpeMoviCaja; + } + + public void setIndTransferenciaBpeMoviCaja(Boolean indTransferenciaBpeMoviCaja) { + this.indTransferenciaBpeMoviCaja = indTransferenciaBpeMoviCaja; + } + + public String getCnpjAutorizadora() { + return cnpjAutorizadora; + } + + public void setCnpjAutorizadora(String cnpjAutorizadora) { + this.cnpjAutorizadora = cnpjAutorizadora; + } + public Boolean getIndUtilizaResolucao() { + return indUtilizaResolucao; + } + + public void setIndUtilizaResolucao(Boolean indUtilizaResolucao) { + this.indUtilizaResolucao = indUtilizaResolucao; + } + + public Boolean getIndUtiFolioLocaPrepagoAberto() { + return indUtiFolioLocaPrepagoAberto; + } + + public void setIndUtiFolioLocaPrepagoAberto(Boolean indUtiFolioLocaPrepagoAberto) { + this.indUtiFolioLocaPrepagoAberto = indUtiFolioLocaPrepagoAberto; + } + + public Boolean getIndImprime2ViasImpreNaoFiscal() { + return indImprime2ViasImpreNaoFiscal; + } + + public void setIndImprime2ViasImpreNaoFiscal(Boolean indImprime2ViasImpreNaoFiscal) { + this.indImprime2ViasImpreNaoFiscal = indImprime2ViasImpreNaoFiscal; + } + + public Boolean getIndImprime2ViasDevolucao() { + return indImprime2ViasDevolucao; + } + + public void setIndImprime2ViasDevolucao(Boolean indImprime2ViasDevolucao) { + this.indImprime2ViasDevolucao = indImprime2ViasDevolucao; + } + + public Boolean getIndExibeDiferencaMenorTrocaCupomEmbarqueEcf() { + return indExibeDiferencaMenorTrocaCupomEmbarqueEcf; + } + + public void setIndExibeDiferencaMenorTrocaCupomEmbarqueEcf(Boolean indExibeDiferencaMenorTrocaCupomEmbarqueEcf) { + this.indExibeDiferencaMenorTrocaCupomEmbarqueEcf = indExibeDiferencaMenorTrocaCupomEmbarqueEcf; + } + + public Boolean getIndPermiteTrocaVdaAberto() { + return indPermiteTrocaVdaAberto; + } + + public void setIndPermiteTrocaVdaAberto(Boolean indPermiteTrocaVdaAberto) { + this.indPermiteTrocaVdaAberto = indPermiteTrocaVdaAberto; + } + + public Boolean getIndExibeComissaoZeradaAgencia() { + return indExibeComissaoZeradaAgencia; + } + + public void setIndExibeComissaoZeradaAgencia(Boolean indExibeComissaoZeradaAgencia) { + this.indExibeComissaoZeradaAgencia = indExibeComissaoZeradaAgencia; + } + + public Boolean getIndPermiteReativacaoPassagemBpeEstacaoNaoBpe() { + return indPermiteReativacaoPassagemBpeEstacaoNaoBpe; + } + + public void setIndPermiteReativacaoPassagemBpeEstacaoNaoBpe(Boolean indPermiteReativacaoPassagemBpeEstacaoNaoBpe) { + this.indPermiteReativacaoPassagemBpeEstacaoNaoBpe = indPermiteReativacaoPassagemBpeEstacaoNaoBpe; + } + + public Boolean getIndImprimirEmbarqueDesembarqCupom() { + return indImprimirEmbarqueDesembarqCupom; + } + + public void setIndImprimirEmbarqueDesembarqCupom(Boolean indImprimirEmbarqueDesembarqCupom) { + this.indImprimirEmbarqueDesembarqCupom = indImprimirEmbarqueDesembarqCupom; + } + + public String getAntifraudekey() { + return antifraudekey; + } + + public void setAntifraudekey(String antifraudekey) { + this.antifraudekey = antifraudekey; + } + + public Boolean getIndOutrasFPVdaCallCenter() { + return indOutrasFPVdaCallCenter; + } + + public void setIndOutrasFPVdaCallCenter(Boolean indOutrasFPVdaCallCenter) { + this.indOutrasFPVdaCallCenter = indOutrasFPVdaCallCenter; + } + + public Boolean getIndEmiteDABpeVdaCallCenter() { + return indEmiteDABpeVdaCallCenter; + } + + public void setIndEmiteDABpeVdaCallCenter(Boolean indEmiteDABpeVdaCallCenter) { + this.indEmiteDABpeVdaCallCenter = indEmiteDABpeVdaCallCenter; + } + + public Boolean getIndEmiteDABpeVdaInternet() { + return indEmiteDABpeVdaInternet; + } + + public void setIndEmiteDABpeVdaInternet(Boolean indEmiteDABpeVdaInternet) { + this.indEmiteDABpeVdaInternet = indEmiteDABpeVdaInternet; + } + + public Boolean getIndEmiteDABpeVdaIntJ3() { + return indEmiteDABpeVdaIntJ3; + } + + public void setIndEmiteDABpeVdaIntJ3(Boolean indEmiteDABpeVdaIntJ3) { + this.indEmiteDABpeVdaIntJ3 = indEmiteDABpeVdaIntJ3; + } + + public Boolean getIndEmiteDABpeVdaFidelidade() { + return indEmiteDABpeVdaFidelidade; + } + + public void setIndEmiteDABpeVdaFidelidade(Boolean indEmiteDABpeVdaFidelidade) { + this.indEmiteDABpeVdaFidelidade = indEmiteDABpeVdaFidelidade; + } + + public Boolean getIndExigeClienteCompradorVdaCallCenter() { + return indExigeClienteCompradorVdaCallCenter; + } + + public void setIndExigeClienteCompradorVdaCallCenter(Boolean indExigeClienteCompradorVdaCallCenter) { + this.indExigeClienteCompradorVdaCallCenter = indExigeClienteCompradorVdaCallCenter; + } + + public Boolean getIndEmiteDeclaracaoCancelaBpeTrocaOrigDest() { + return BooleanUtils.toBoolean(indEmiteDeclaracaoCancelaBpeTrocaOrigDest); + } + + public void setIndEmiteDeclaracaoCancelaBpeTrocaOrigDest(Boolean indEmiteDeclaracaoCancelaBpeTrocaOrigDest) { + this.indEmiteDeclaracaoCancelaBpeTrocaOrigDest = indEmiteDeclaracaoCancelaBpeTrocaOrigDest; + } + + public Boolean getIndReaproveitarNumBPeRejeitado() { + return indReaproveitarNumBPeRejeitado; + } + + public void setIndReaproveitarNumBPeRejeitado(Boolean indReaproveitarNumBPeRejeitado) { + this.indReaproveitarNumBPeRejeitado = indReaproveitarNumBPeRejeitado; + } + + public Boolean getIndSubstituicaoIgualSefaz() { + return indSubstituicaoIgualSefaz == null ? false : indSubstituicaoIgualSefaz; + } + + public void setIndSubstituicaoIgualSefaz(Boolean indSubstituicaoIgualSefaz) { + this.indSubstituicaoIgualSefaz = indSubstituicaoIgualSefaz; + } + + public Boolean getIndVendaEstudanteTotem() { + return indVendaEstudanteTotem == null ? false : indVendaEstudanteTotem; + } + + public void setIndVendaEstudanteTotem(Boolean indVendaEstudanteTotem) { + this.indVendaEstudanteTotem = indVendaEstudanteTotem; + } + + public Boolean getIndImprimeRelFechamentoViagemDetalhadoEmarcada() { + return indImprimeRelFechamentoViagemDetalhadoEmarcada; + } + + public void setIndImprimeRelFechamentoViagemDetalhadoEmarcada(Boolean indImprimeRelFechamentoViagemDetalhadoEmarcada) { + this.indImprimeRelFechamentoViagemDetalhadoEmarcada = indImprimeRelFechamentoViagemDetalhadoEmarcada; + } + + public Boolean getIndImprimeLogoBilheteVendaEmbarcada() { + return indImprimeLogoBilheteVendaEmbarcada; + } + + public void setIndImprimeLogoBilheteVendaEmbarcada(Boolean indImprimeLogoBilheteVendaEmbarcada) { + this.indImprimeLogoBilheteVendaEmbarcada = indImprimeLogoBilheteVendaEmbarcada; + } + + public Boolean getIndCodBarCpEmbarque() { + return indCodBarCpEmbarque; + } + + public void setIndCodBarCpEmbarque(Boolean indCodBarCpEmbarque) { + this.indCodBarCpEmbarque = indCodBarCpEmbarque; + } + + public Boolean getIndEmiteComprovanteCancelamentoSitef() { + return indEmiteComprovanteCancelamentoSitef; + } + + public void setIndEmiteComprovanteCancelamentoSitef(Boolean indEmiteComprovanteCancelamentoSitef) { + this.indEmiteComprovanteCancelamentoSitef = indEmiteComprovanteCancelamentoSitef; + } + + public Boolean getIndImprimirComprovantePagamentoSeguroOpcional() { + return indImprimirComprovantePagamentoSeguroOpcional; + } + + public void setIndImprimirComprovantePagamentoSeguroOpcional(Boolean indImprimirComprovantePagamentoSeguroOpcional) { + this.indImprimirComprovantePagamentoSeguroOpcional = indImprimirComprovantePagamentoSeguroOpcional; + } + + public Boolean getIndEncerraViagemFechorllegada() { + return indEncerraViagemFechorllegada; + } + + public void setIndEncerraViagemFechorllegada(Boolean indEncerraViagemFechorllegada) { + this.indEncerraViagemFechorllegada = indEncerraViagemFechorllegada; + } + + public Boolean getIndImprimirSeguroOpcionalEntregaVdaImpPosterior() { + return indImprimirSeguroOpcionalEntregaVdaImpPosterior; + } + + public void setIndImprimirSeguroOpcionalEntregaVdaImpPosterior(Boolean indImprimirSeguroOpcionalEntregaVdaImpPosterior) { + this.indImprimirSeguroOpcionalEntregaVdaImpPosterior = indImprimirSeguroOpcionalEntregaVdaImpPosterior; + } + + public Boolean getIndTabelaPrecoEmbarcada() { + return indTabelaPrecoEmbarcada == null ? false : indTabelaPrecoEmbarcada; + } + + public void setIndTabelaPrecoEmbarcada(Boolean indTabelaPrecoEmbarcada) { + this.indTabelaPrecoEmbarcada = indTabelaPrecoEmbarcada; + } + + public Boolean getIndImpressaoCanhotoEmbarcada() { + return indImpressaoCanhotoEmbarcada == null ? false : indImpressaoCanhotoEmbarcada; + } + + public void setIndImpressaoCanhotoEmbarcada(Boolean indImpressaoCanhotoEmbarcada) { + this.indImpressaoCanhotoEmbarcada = indImpressaoCanhotoEmbarcada; + } + + public Boolean getIndImprimeQRCodeAdicional() { + return indImprimeQRCodeAdicional; + } + + public void setIndImprimeQRCodeAdicional(Boolean indImprimeQRCodeAdicional) { + this.indImprimeQRCodeAdicional = indImprimeQRCodeAdicional; + } + + public Boolean getIndAltPosicaoCamposCupom() { + return indAltPosicaoCamposCupom; + } + + public void setIndAltPosicaoCamposCupom(Boolean indAltPosicaoCamposCupom) { + this.indAltPosicaoCamposCupom = indAltPosicaoCamposCupom; + } + + public Boolean getIndImprimeVoucherPersonalizado() { + return indImprimeVoucherPersonalizado; + } + + public void setIndImprimeVoucherPersonalizado(Boolean indImprimeVoucherPersonalizado) { + this.indImprimeVoucherPersonalizado = indImprimeVoucherPersonalizado; + } + + public String getCampoCustomVoucher() { + return campoCustomVoucher; + } + + public void setCampoCustomVoucher(String campoCustomVoucher) { + this.campoCustomVoucher = campoCustomVoucher; + } + + public Boolean getIndImpComprovanteReserva() { + return indImpComprovanteReserva == null ? false : indImpComprovanteReserva; + } + + public void setIndImpComprovanteReserva(Boolean indImpComprovanteReserva) { + this.indImpComprovanteReserva = indImpComprovanteReserva; + } + + public Boolean getIndEnviaDadosAgenciaBpe() { + return indEnviaDadosAgenciaBpe == null ? false : indEnviaDadosAgenciaBpe; + } + + public void setIndEnviaDadosAgenciaBpe(Boolean indEnviaDadosAgenciaBpe) { + this.indEnviaDadosAgenciaBpe = indEnviaDadosAgenciaBpe; + } + + public Boolean getIndPrecoPorDemanda() { + return indPrecoPorDemanda == null ? false : indPrecoPorDemanda; + } + + public void setIndPrecoPorDemanda(Boolean indPrecoPorDemanda) { + this.indPrecoPorDemanda = indPrecoPorDemanda; + } + + public Boolean getIndRateioComissaoGrupoLinha() { + return indRateioComissaoGrupoLinha == null ? false : indRateioComissaoGrupoLinha; + } + + public void setIndRateioComissaoGrupoLinha(Boolean indRateioComissaoGrupoLinha) { + this.indRateioComissaoGrupoLinha = indRateioComissaoGrupoLinha; + } + + public Boolean getIndComissaoGrupoLinhaOriginal() { + return indComissaoGrupoLinhaOriginal == null ? false : indComissaoGrupoLinhaOriginal; + } + + public void setIndComissaoGrupoLinhaOriginal(Boolean indComissaoGrupoLinhaOriginal) { + this.indComissaoGrupoLinhaOriginal = indComissaoGrupoLinhaOriginal; + } + + public TipoCstGratuidade getCstGratuidade() { + return cstGratuidade; + } + + public void setCstGratuidade(TipoCstGratuidade cstGratuidade) { + this.cstGratuidade = cstGratuidade; + } + + public Boolean getIndSegundaViaFechamentoCaixa() { + return indSegundaViaFechamentoCaixa ==null ? Boolean.FALSE : indSegundaViaFechamentoCaixa; + } + + public void setIndSegundaViaFechamentoCaixa(Boolean indSegundaViaFechamentoCaixa) { + this.indSegundaViaFechamentoCaixa = indSegundaViaFechamentoCaixa; + } + + public String getCodder() { + return codder; + } + + public void setCodder(String codder) { + this.codder = codder; + } + + public Boolean getIndExigeBpeExcessoBagagem() { + return indExigeBpeExcessoBagagem; + } + + public void setIndExigeBpeExcessoBagagem(Boolean indExigeBpeExcessoBagagem) { + this.indExigeBpeExcessoBagagem = indExigeBpeExcessoBagagem; + } + + public String getUrlBaseEmpresaSeguro() { + return urlBaseEmpresaSeguro; + } + + public void setUrlBaseEmpresaSeguro(String urlBaseEmpresaSeguro) { + this.urlBaseEmpresaSeguro = urlBaseEmpresaSeguro; + } + + @Override + public void clonar() throws CloneNotSupportedException { + empresaClone = new Empresa(); + empresaClone = (Empresa) this.clone(); + } + + @Override + public Empresa getCloneObject() throws CloneNotSupportedException { + return empresaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getEmpresaId()); + } + + public String getCodContPrevidencia() { + return codContPrevidencia; + } + + public void setCodContPrevidencia(String codContPrevidencia) { + this.codContPrevidencia = codContPrevidencia; + } + + public Boolean getIndMantemVdaCajaVdaEmbarcada() { + return indMantemVdaCajaVdaEmbarcada != null ? indMantemVdaCajaVdaEmbarcada : false; + } + + public void setIndMantemVdaCajaVdaEmbarcada(Boolean indMantemVdaCajaVdaEmbarcada) { + this.indMantemVdaCajaVdaEmbarcada = indMantemVdaCajaVdaEmbarcada; + } + + public String getCpfCnpjAutDownload() { + return cpfCnpjAutDownload; + } + + public void setCpfCnpjAutDownload(String cpfCnpjAutDownload) { + this.cpfCnpjAutDownload = cpfCnpjAutDownload; + } + + public Boolean getIndAlertaVDAPosHorarioViagem() { + return indAlertaVDAPosHorarioViagem != null ? indAlertaVDAPosHorarioViagem : false; + } + + public void setIndAlertaVDAPosHorarioViagem(Boolean indAlertaVDAPosHorarioViagem) { + this.indAlertaVDAPosHorarioViagem = indAlertaVDAPosHorarioViagem; + } + + public Boolean getIndConfMovFPTrocaVlrDeposito() { + return indConfMovFPTrocaVlrDeposito != null ? indConfMovFPTrocaVlrDeposito : false; + } + + public void setIndConfMovFPTrocaVlrDeposito(Boolean indConfMovFPTrocaVlrDeposito) { + this.indConfMovFPTrocaVlrDeposito = indConfMovFPTrocaVlrDeposito; + } + + public Boolean getIndComTransfGeraCaja() { + return indComTransfGeraCaja != null ? indComTransfGeraCaja : false; + } + + public void setIndComTransfGeraCaja(Boolean indComTransfGeraCaja) { + this.indComTransfGeraCaja = indComTransfGeraCaja; + } + + public Boolean getIndPricingVendaAberto() { + return indPricingVendaAberto != null ? indPricingVendaAberto : false; + } + + public void setIndPricingVendaAberto(Boolean indPricingVendaAberto) { + this.indPricingVendaAberto = indPricingVendaAberto; + } + + public Boolean getIndVendaAbertoMovimentaCaixa() { + return indVendaAbertoMovimentaCaixa == null ? false : indVendaAbertoMovimentaCaixa; + } + + public void setIndVendaAbertoMovimentaCaixa(Boolean indVendaAbertoMovimentaCaixa) { + this.indVendaAbertoMovimentaCaixa = indVendaAbertoMovimentaCaixa; + } + + public BigDecimal getIndiceIRK() { + return indiceIRK; + } + + public void setIndiceIRK(BigDecimal indiceIRK) { + this.indiceIRK = indiceIRK; + } + + public Boolean getIndNaoPermiteTrocaEntreEmpresa() { + return indNaoPermiteTrocaEntreEmpresa != null ? indNaoPermiteTrocaEntreEmpresa : false; + } + + public void setIndNaoPermiteTrocaEntreEmpresa(Boolean indNaoPermiteTrocaEntreEmpresa) { + this.indNaoPermiteTrocaEntreEmpresa = indNaoPermiteTrocaEntreEmpresa; + } + + public Boolean getIndNaoImprimeCupomEmbarqueVendaAberto() { + return indNaoImprimeCupomEmbarqueVendaAberto == null ? false : indNaoImprimeCupomEmbarqueVendaAberto; + } + + public void setIndNaoImprimeCupomEmbarqueVendaAberto(Boolean indNaoImprimeCupomEmbarqueVendaAberto) { + this.indNaoImprimeCupomEmbarqueVendaAberto = indNaoImprimeCupomEmbarqueVendaAberto; + } + + public Boolean getIndNaoImprimeCupomEmbarqueConfirmacaoAberto() { + return indNaoImprimeCupomEmbarqueConfirmacaoAberto == null ? false : indNaoImprimeCupomEmbarqueConfirmacaoAberto; + } + + public void setIndNaoImprimeCupomEmbarqueConfirmacaoAberto(Boolean indNaoImprimeCupomEmbarqueConfirmacaoAberto) { + this.indNaoImprimeCupomEmbarqueConfirmacaoAberto = indNaoImprimeCupomEmbarqueConfirmacaoAberto; + } + + public Boolean getIndSeguroOpcionalW2Digital() { + return indSeguroOpcionalW2Digital == null ? false : indSeguroOpcionalW2Digital; + } + + public void setIndSeguroOpcionalW2Digital(Boolean indSeguroOpcionalW2Digital) { + this.indSeguroOpcionalW2Digital = indSeguroOpcionalW2Digital; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaContaBancaria.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaContaBancaria.java new file mode 100644 index 000000000..7c4424ce7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaContaBancaria.java @@ -0,0 +1,161 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name="EMPRESA_CONTABANCARIA_SEQ", sequenceName="EMPRESA_CONTABANCARIA_SEQ", allocationSize=1) +@Table(name="EMPRESA_CONTABANCARIA") +public class EmpresaContaBancaria implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer empresaContaBancariaId; + private Empresa empresa; + private InstiFinanceira instituicaoFinandeira; + private String numConta; + private String numAgencia; + private String numIntegracion; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_CONTABANCARIA_SEQ") + @Column(name = "EMPRESACONTABANCARIA_ID") + public Integer getEmpresaContaBancariaId() { + return empresaContaBancariaId; + } + + public void setEmpresaContaBancariaId(Integer empresaContaBancariaId) { + this.empresaContaBancariaId = empresaContaBancariaId; + } + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @JoinColumn(name = "INSTIFINANCEIRA_ID", referencedColumnName = "INSTIFINANCEIRA_ID") + @ManyToOne + public InstiFinanceira getInstituicaoFinandeira() { + return instituicaoFinandeira; + } + + public void setInstituicaoFinandeira(InstiFinanceira instituicaoFinandeira) { + this.instituicaoFinandeira = instituicaoFinandeira; + } + + @Column(name = "NUMCONTA") + public String getNumConta() { + return numConta; + } + + public void setNumConta(String numConta) { + this.numConta = numConta; + } + + @Column(name = "NUMAGENCIA") + public String getNumAgencia() { + return numAgencia; + } + + public void setNumAgencia(String numAgencia) { + this.numAgencia = numAgencia; + } + + @Column(name = "ACTIVO") + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID") + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Column(name = "NUMINTEGRACION") + public String getNumIntegracion() { + return numIntegracion; + } + + public void setNumIntegracion(String numIntegracion) { + this.numIntegracion = numIntegracion; + } + + @Override + public boolean equals(Object old) { + + if (!(old instanceof EmpresaContaBancaria)) { + return false; + } + + EmpresaContaBancaria oldObject = (EmpresaContaBancaria) old; + + if(this.getInstituicaoFinandeira().equals(oldObject.getInstituicaoFinandeira()) && + this.getNumAgencia().equals(oldObject.getNumAgencia()) && this.getNumConta().equals(oldObject.getNumConta()) && + (this.getNumIntegracion() != null && this.getNumIntegracion().equals(oldObject.getNumIntegracion())) && + this.getActivo().equals(oldObject.getActivo())) { + return true; + } + + if(this.empresaContaBancariaId == null && oldObject.empresaContaBancariaId == null) { + return false; + } + + if ((this.empresaContaBancariaId == null && oldObject.empresaContaBancariaId != null) || (this.empresaContaBancariaId != null && !this.empresaContaBancariaId.equals(oldObject.empresaContaBancariaId))) { + return false; + } + + return Boolean.TRUE; + } + + @Override + public String toString() { + return getNumConta() + " - " + getNumAgencia() + " - " + getNumIntegracion() + " - " + getInstituicaoFinandeira().getNome(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (empresaContaBancariaId != null ? empresaContaBancariaId.hashCode() : 0); + return hash; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaEmail.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaEmail.java new file mode 100644 index 000000000..49b42675d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaEmail.java @@ -0,0 +1,196 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "EMPRESA_EMAIL_SEQ", sequenceName = "EMPRESA_EMAIL_SEQ", allocationSize = 1) +@Table(name = "EMPRESA_EMAIL") +public class EmpresaEmail implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_EMAIL_SEQ") + @Column(name = "EMPRESAEMAIL_ID") + private Integer empresaEmailId; + @Column(name = "TEXTOEMAIL") + private String textoEmail; + @Column(name = "TEXTOEMAILFISCAL") + private String textoEmailFiscal; + @Column(name = "TEXTOCUPOMEMBARQUE") + private String textoCupomEmbarque; + @Column(name = "ASSUNTO") + private String assunto; + @Column(name = "ASSUNTOFISCAL") + private String assuntoFiscal; + @Column(name = "EMAILDE") + private String emailDe; + @Column(name = "EMAILCOPIAOCULTA") + private String emailCopiaOculta; + @Column(name = "DESTINATARIO") + private String destinatario; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public EmpresaEmail() { + + } + + public Integer getEmpresaEmailId() { + return empresaEmailId; + } + + public void setEmpresaEmailId(Integer empresaEmailId) { + this.empresaEmailId = empresaEmailId; + } + + public String getTextoEmail() { + return textoEmail; + } + + public void setTextoEmail(String textoEmail) { + this.textoEmail = textoEmail; + } + + public String getTextoCupomEmbarque() { + return textoCupomEmbarque; + } + + public void setTextoCupomEmbarque(String textoCupomEmbarque) { + this.textoCupomEmbarque = textoCupomEmbarque; + } + + public String getTextoEmailFiscal() { + return textoEmailFiscal; + } + + public void setTextoEmailFiscal(String textoEmailFiscal) { + this.textoEmailFiscal = textoEmailFiscal; + } + + public String getAssunto() { + return assunto; + } + + public void setAssunto(String assunto) { + this.assunto = assunto; + } + + public String getAssuntoFiscal() { + return assuntoFiscal; + } + + public void setAssuntoFiscal(String assuntoFiscal) { + this.assuntoFiscal = assuntoFiscal; + } + + public String getEmailDe() { + return emailDe; + } + + public String getEmailCopiaOculta() { + return emailCopiaOculta; + } + + public void setEmailCopiaOculta(String emailCopiaOculta) { + this.emailCopiaOculta = emailCopiaOculta; + } + + public String getDestinatario() { + return destinatario; + } + + public void setDestinatario(String destinatario) { + this.destinatario = destinatario; + } + + public void setEmailDe(String emailDe) { + this.emailDe = emailDe; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((empresaEmailId == null) ? 0 : empresaEmailId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + EmpresaEmail other = (EmpresaEmail) obj; + if (empresaEmailId == null) { + if (other.empresaEmailId != null) + return false; + } else if (!empresaEmailId.equals(other.empresaEmailId)) + return false; + return true; + } + + @Override + public String toString() { + return String.valueOf(this.getEmpresaEmailId()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaEmailConfig.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaEmailConfig.java new file mode 100644 index 000000000..bfd623d7d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaEmailConfig.java @@ -0,0 +1,178 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang.BooleanUtils; + +@Entity +@SequenceGenerator(name = "EMPRESA_EMAIL_CONFIG_SEQ", sequenceName = "EMPRESA_EMAIL_CONFIG_SEQ", allocationSize = 1) +@Table(name = "EMPRESA_EMAIL_CONFIG") +public class EmpresaEmailConfig implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_EMAIL_CONFIG_SEQ") + @Column(name = "EMPRESAEMAILCONFIG_ID") + private Integer empresaEmailConfigId; + @Column(name = "SMTP") + private String smtp; + @Column(name = "SENHA") + private String senha; + @Column(name = "SMTPPORTA") + private String smtpPorta; + @Column(name = "SMTPEMAIL") + private String smtpEmail; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "INDAUTENTICACAO") + private Boolean indAutenticacao; + @Column(name = "TIPOAUTORIZACAO") + private String tipoAutorizacao; + + public EmpresaEmailConfig() { + + } + + public Integer getEmpresaEmailConfigId() { + return empresaEmailConfigId; + } + + public void setEmpresaEmailConfigId(Integer empresaEmailConfigId) { + this.empresaEmailConfigId = empresaEmailConfigId; + } + + public String getSmtp() { + return smtp; + } + + public void setSmtp(String smtp) { + this.smtp = smtp; + } + + public String getSenha() { + return senha; + } + + public void setSenha(String senha) { + this.senha = senha; + } + + public String getSmtpPorta() { + return smtpPorta; + } + + public void setSmtpPorta(String smtpPorta) { + this.smtpPorta = smtpPorta; + } + + public String getSmtpEmail() { + return smtpEmail; + } + + public void setSmtpEmail(String smtpEmail) { + this.smtpEmail = smtpEmail; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getIndAutenticacao() { + return BooleanUtils.toBooleanDefaultIfNull(indAutenticacao, true) ; + } + + public void setIndAutenticacao(Boolean indAutenticacao) { + this.indAutenticacao = indAutenticacao; + } + + public String getTipoAutorizacao() { + return tipoAutorizacao; + } + + public void setTipoAutorizacao(String tipoAutorizacao) { + this.tipoAutorizacao = tipoAutorizacao; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((empresaEmailConfigId == null) ? 0 : empresaEmailConfigId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + EmpresaEmailConfig other = (EmpresaEmailConfig) obj; + if (empresaEmailConfigId == null) { + if (other.empresaEmailConfigId != null) + return false; + } else if (!empresaEmailConfigId.equals(other.empresaEmailConfigId)) + return false; + return true; + } + + @Override + public String toString() { + return String.valueOf(this.getEmpresaEmailConfigId()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaEmailFlexBus.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaEmailFlexBus.java new file mode 100644 index 000000000..92f16acd9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaEmailFlexBus.java @@ -0,0 +1,232 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang.BooleanUtils; + +@Entity +@SequenceGenerator(name = "EMP_EMAIL_FLEXBUS_SEQ", sequenceName = "EMP_EMAIL_FLEXBUS_SEQ", allocationSize = 1) +@Table(name = "EMPRESA_EMAIL_FLEXBUS") +public class EmpresaEmailFlexBus implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMP_EMAIL_FLEXBUS_SEQ") + @Column(name = "EMPRESAEMAILFLEXBUS_ID") + private Integer empresaEmailFlexBusId; + + @Column(name = "SMTP") + private String smtp; + + @Column(name = "SENHA") + private String senha; + + @Column(name = "SMTPPORTA") + private String smtpPorta; + + @Column(name = "SMTPEMAIL") + private String smtpEmail; + + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "INDAUTENTICACAO") + private Boolean indAutenticacao; + + @Column(name = "TEXTOEMAIL") + private String textoEmail; + + @Column(name = "ASSUNTO") + private String assunto; + + @Column(name = "EMAILDE") + private String emailDe; + + @Column(name = "EMAILCOPIAOCULTA") + private String emailCopiaOculta; + + @Column(name = "TIPOAUTORIZACAO") + private String tipoAutorizacao; + + public EmpresaEmailFlexBus() { + + } + + public Integer getEmpresaEmailFlexBusId() { + return empresaEmailFlexBusId; + } + + public void setEmpresaEmailFlexBusId(Integer empresaEmailFlexBusId) { + this.empresaEmailFlexBusId = empresaEmailFlexBusId; + } + + public String getSmtp() { + return smtp; + } + + public void setSmtp(String smtp) { + this.smtp = smtp; + } + + public String getSenha() { + return senha; + } + + public void setSenha(String senha) { + this.senha = senha; + } + + public String getSmtpPorta() { + return smtpPorta; + } + + public void setSmtpPorta(String smtpPorta) { + this.smtpPorta = smtpPorta; + } + + public String getSmtpEmail() { + return smtpEmail; + } + + public void setSmtpEmail(String smtpEmail) { + this.smtpEmail = smtpEmail; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getIndAutenticacao() { + return BooleanUtils.toBooleanDefaultIfNull(indAutenticacao, true) ; + } + + public void setIndAutenticacao(Boolean indAutenticacao) { + this.indAutenticacao = indAutenticacao; + } + + public String getTextoEmail() { + return textoEmail; + } + + public void setTextoEmail(String textoEmail) { + this.textoEmail = textoEmail; + } + + public String getAssunto() { + return assunto; + } + + public void setAssunto(String assunto) { + this.assunto = assunto; + } + + public String getEmailDe() { + return emailDe; + } + + public void setEmailDe(String emailDe) { + this.emailDe = emailDe; + } + + public String getEmailCopiaOculta() { + return emailCopiaOculta; + } + + public void setEmailCopiaOculta(String emailCopiaOculta) { + this.emailCopiaOculta = emailCopiaOculta; + } + + public String getTipoAutorizacao() { + return tipoAutorizacao; + } + + public void setTipoAutorizacao(String tipoAutorizacao) { + this.tipoAutorizacao = tipoAutorizacao; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((empresaEmailFlexBusId == null) ? 0 : empresaEmailFlexBusId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + EmpresaEmailFlexBus other = (EmpresaEmailFlexBus) obj; + if (empresaEmailFlexBusId == null) { + if (other.empresaEmailFlexBusId != null) + return false; + } else if (!empresaEmailFlexBusId.equals(other.empresaEmailFlexBusId)) + return false; + return true; + } + + @Override + public String toString() { + return String.valueOf(this.getEmpresaEmailFlexBusId()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaEquivalencia.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaEquivalencia.java new file mode 100644 index 000000000..21421e25b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaEquivalencia.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "EMPRESA_EQUIVALENCIA_SEQ", sequenceName = "EMPRESA_EQUIVALENCIA_SEQ", allocationSize = 1) +@Table(name = "EMPRESA_EQUIVALENCIA") +public class EmpresaEquivalencia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "EMPRESAEQUIVALENCIA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_EQUIVALENCIA_SEQ") + private Integer empresaequivalenciaId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @OneToOne + @JoinColumn(name = "COMISIONISTAEXTERNO_ID") + private ComisionistaExterno comisionistaExterno; + + public EmpresaEquivalencia() { + } + + public EmpresaEquivalencia(Integer empresaequivalenciaId) { + this.empresaequivalenciaId = empresaequivalenciaId; + } + + public Integer getEmpresaequivalenciaId() { + return empresaequivalenciaId; + } + + public void setEmpresaequivalenciaId(Integer empresaequivalenciaId) { + this.empresaequivalenciaId = empresaequivalenciaId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ComisionistaExterno getComisionistaExterno() { + return comisionistaExterno; + } + + public void setComisionistaExterno(ComisionistaExterno comisionistaExterno) { + this.comisionistaExterno = comisionistaExterno; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (empresaequivalenciaId != null ? empresaequivalenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof EmpresaEquivalencia)) { + return false; + } + EmpresaEquivalencia other = (EmpresaEquivalencia) object; + if ((this.empresaequivalenciaId == null && other.empresaequivalenciaId != null) || (this.empresaequivalenciaId != null && !this.empresaequivalenciaId.equals(other.empresaequivalenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.EmpresaEquivalencia[ empresaequivalenciaId=" + empresaequivalenciaId + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java new file mode 100644 index 000000000..c9665c24a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java @@ -0,0 +1,822 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "EMPRESA_IMPOSTO_SEQ", sequenceName = "EMPRESA_IMPOSTO_SEQ", allocationSize = 1) +@Table(name = "EMPRESA_IMPOSTO") +public class EmpresaImposto implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_IMPOSTO_SEQ") + @Column(name = "EMPRESAIMPOSTO_ID") + private Integer empresaImpostoId; + + @Column(name = "ICMS") + private BigDecimal icms; + + @Column(name = "INDTARIFAMUNICIPAL") + private Boolean indTarifaMunicipal; + @Column(name = "INDSEGUROMUNICIPAL") + private Boolean indSeguroMunicipal; + @Column(name = "INDTXEMBARQUEMUNICIPAL") + private Boolean indTxEmbarqueMunicipal; + @Column(name = "INDPEDAGIOMUNICIPAL") + private Boolean indPedagioMunicipal; + @Column(name = "INDTARIFAESTADUAL") + private Boolean indTarifaEstadual; + @Column(name = "INDSEGUROESTADUAL") + private Boolean indSeguroEstadual; + @Column(name = "INDTXEMBARQUEESTADUAL") + private Boolean indTxEmbarqueEstadual; + @Column(name = "INDPEDAGIOESTDUAL") + private Boolean indPedadioEstdual; + + @Column(name = "PORCREDBASEICMS") + private BigDecimal porCredBaseIcms; + @Column(name = "PORCREDBASEICMSIM") + private BigDecimal porcRedBaseIcmsIM; + + @Column(name = "INDJANEIRO") + private Boolean indJaneiro; + @Column(name = "INDFEVEREIRO") + private Boolean indFevereiro; + @Column(name = "INDMARCO") + private Boolean indMarco; + @Column(name = "INDABRIL") + private Boolean indAbril; + @Column(name = "INDMAIO") + private Boolean indMaio; + @Column(name = "INDJUNHO") + private Boolean indJunho; + @Column(name = "INDJULHO") + private Boolean indJulho; + @Column(name = "INDAGOSTO") + private Boolean indAgosto; + @Column(name = "INDSETEMBRO") + private Boolean indSetembro; + @Column(name = "INDOUTUBRO") + private Boolean indOutubro; + @Column(name = "INDNOVEMBRO") + private Boolean indNovembro; + @Column(name = "INDDEZEMBRO") + private Boolean indDezembro; + + @Column(name = "INDOUTROSISENTO") + private Boolean indOutrosIsento; + + @Column(name = "INDOUTRASUFBLOQUEADAS") + private Boolean indOutrasUFBloqueadas; + + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @JoinColumn(name = "ESTADO_ID", referencedColumnName = "ESTADO_ID") + @ManyToOne + private Estado estado; + + @Column(name = "INDICEICMSECF") + private Integer indiceICMSecf; + + @Column(name = "PORCTRIBUTO") + private BigDecimal porctributo; + + @Column(name = "ICMSIM") + private BigDecimal icmsIntermunicipal; + + @Column(name = "ICMSIMMATRICIAL") + private BigDecimal icmsIntermunicipalMatricial; + + @Column(name = "ICMSMATRICIAL") + private BigDecimal icmsMatricial; + + @Column(name = "INDICEICMSIMECF") + private BigDecimal indiceICMSIntermunicipal; + + @Column(name = "INDVALIDAECF") + private Boolean indValidaECF; + + @Column(name = "TRIBUTACAOIMPORTACAO") + private BigDecimal tributacaoImportacao; + + @Column(name = "TRIBUTACAOIMPORTACAOIM") + private BigDecimal tributacaoImportacaoIM; + + @Column(name = "CODESTABELECIMENTO") + private String codEstabelecimento; + + @Column(name = "CODIGOCONTABILMUNICIPAL") + private String codigoContabilMunicipal; + + @Column(name = "CODIGOCONTABILESTADUAL") + private String codigoContabilEstadual; + + @Column(name = "INDBPE") + private Boolean isBPe; + + @Column(name = "INDREDBASEICMSBPE") + private Boolean indRedutorBaseIcmsBPe; + + @Column(name = "INDALIQUOTABPEUFDESTINO") + private Boolean indAliquotaBPeUfDestino; + + @Column(name = "INDTRIBVIAGEM") + private Boolean indTribViagem; + + @Column(name = "PORCFECP") + private BigDecimal porcFECP; + + + + @OneToMany(mappedBy = "empresaImposto", cascade = CascadeType.ALL, orphanRemoval=true) + private List lsAliquotaEstadoDestino; + + + + public EmpresaImposto() { + super(); + this.indTarifaMunicipal = false; + this.indSeguroMunicipal = false; + this.indTxEmbarqueMunicipal = false; + this.indPedagioMunicipal = false; + this.indTarifaEstadual = false; + this.indSeguroEstadual = false; + this.indTxEmbarqueEstadual = false; + this.indPedadioEstdual = false; + this.indJaneiro = false; + this.indFevereiro = false; + this.indMarco = false; + this.indAbril = false; + this.indMaio = false; + this.indJunho = false; + this.indJulho = false; + this.indAgosto = false; + this.indSetembro = false; + this.indOutubro = false; + this.indNovembro = false; + this.indDezembro = false; + this.indOutrosIsento = false; + this.indOutrasUFBloqueadas = false; + this.isBPe = false; + this.indRedutorBaseIcmsBPe = false; + this.indAliquotaBPeUfDestino = false; + this.indTribViagem = false; + this.lsAliquotaEstadoDestino = new ArrayList(); + } + + /** + * @return the empresaImpostoId + */ + public Integer getEmpresaImpostoId() { + return empresaImpostoId; + } + + /** + * @param empresaImpostoId + * the empresaImpostoId to set + */ + public void setEmpresaImpostoId(Integer empresaImpostoId) { + this.empresaImpostoId = empresaImpostoId; + } + + /** + * @return the icms + */ + public BigDecimal getIcms() { + return icms; + } + + /** + * @param icms + * the icms to set + */ + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + + /** + * @return the indTarifaMunicipal + */ + public Boolean getIndTarifaMunicipal() { + return indTarifaMunicipal; + } + + /** + * @param indTarifaMunicipal + * the indTarifaMunicipal to set + */ + public void setIndTarifaMunicipal(Boolean indTarifaMunicipal) { + this.indTarifaMunicipal = indTarifaMunicipal; + } + + /** + * @return the indSeguroMunicipal + */ + public Boolean getIndSeguroMunicipal() { + return indSeguroMunicipal; + } + + /** + * @param indSeguroMunicipal + * the indSeguroMunicipal to set + */ + public void setIndSeguroMunicipal(Boolean indSeguroMunicipal) { + this.indSeguroMunicipal = indSeguroMunicipal; + } + + /** + * @return the indTxEmbarqueMunicipal + */ + public Boolean getIndTxEmbarqueMunicipal() { + return indTxEmbarqueMunicipal; + } + + /** + * @param indTxEmbarqueMunicipal + * the indTxEmbarqueMunicipal to set + */ + public void setIndTxEmbarqueMunicipal(Boolean indTxEmbarqueMunicipal) { + this.indTxEmbarqueMunicipal = indTxEmbarqueMunicipal; + } + + /** + * @return the indPedagioMunicipal + */ + public Boolean getIndPedagioMunicipal() { + return indPedagioMunicipal; + } + + /** + * @param indPedagioMunicipal + * the indPedagioMunicipal to set + */ + public void setIndPedagioMunicipal(Boolean indPedagioMunicipal) { + this.indPedagioMunicipal = indPedagioMunicipal; + } + + /** + * @return the indTarifaEstadual + */ + public Boolean getIndTarifaEstadual() { + return indTarifaEstadual; + } + + /** + * @param indTarifaEstadual + * the indTarifaEstadual to set + */ + public void setIndTarifaEstadual(Boolean indTarifaEstadual) { + this.indTarifaEstadual = indTarifaEstadual; + } + + /** + * @return the indSeguroEstadual + */ + public Boolean getIndSeguroEstadual() { + return indSeguroEstadual; + } + + /** + * @param indSeguroEstadual + * the indSeguroEstadual to set + */ + public void setIndSeguroEstadual(Boolean indSeguroEstadual) { + this.indSeguroEstadual = indSeguroEstadual; + } + + /** + * @return the indTxEmbarqueEstadual + */ + public Boolean getIndTxEmbarqueEstadual() { + return indTxEmbarqueEstadual; + } + + /** + * @param indTxEmbarqueEstadual + * the indTxEmbarqueEstadual to set + */ + public void setIndTxEmbarqueEstadual(Boolean indTxEmbarqueEstadual) { + this.indTxEmbarqueEstadual = indTxEmbarqueEstadual; + } + + /** + * @return the indPedadioEstdual + */ + public Boolean getIndPedadioEstdual() { + return indPedadioEstdual; + } + + /** + * @param indPedadioEstdual + * the indPedadioEstdual to set + */ + public void setIndPedadioEstdual(Boolean indPedadioEstdual) { + this.indPedadioEstdual = indPedadioEstdual; + } + + + /** + * @return the porCredBaseIcms + */ + public BigDecimal getPorCredBaseIcms() { + return porCredBaseIcms; + } + + /** + * @param porCredBaseIcms + * the porCredBaseIcms to set + */ + public void setPorCredBaseIcms(BigDecimal porCredBaseIcms) { + this.porCredBaseIcms = porCredBaseIcms; + } + + /** + * @return the indJaneiro + */ + public Boolean getIndJaneiro() { + return indJaneiro; + } + + /** + * @param indJaneiro + * the indJaneiro to set + */ + public void setIndJaneiro(Boolean indJaneiro) { + this.indJaneiro = indJaneiro; + } + + /** + * @return the indFevereiro + */ + public Boolean getIndFevereiro() { + return indFevereiro; + } + + /** + * @param indFevereiro + * the indFevereiro to set + */ + public void setIndFevereiro(Boolean indFevereiro) { + this.indFevereiro = indFevereiro; + } + + /** + * @return the indMarco + */ + public Boolean getIndMarco() { + return indMarco; + } + + /** + * @param indMarco + * the indMarco to set + */ + public void setIndMarco(Boolean indMarco) { + this.indMarco = indMarco; + } + + /** + * @return the indAbril + */ + public Boolean getIndAbril() { + return indAbril; + } + + /** + * @param indAbril + * the indAbril to set + */ + public void setIndAbril(Boolean indAbril) { + this.indAbril = indAbril; + } + + /** + * @return the indMaio + */ + public Boolean getIndMaio() { + return indMaio; + } + + /** + * @param indMaio + * the indMaio to set + */ + public void setIndMaio(Boolean indMaio) { + this.indMaio = indMaio; + } + + /** + * @return the indJunho + */ + public Boolean getIndJunho() { + return indJunho; + } + + /** + * @param indJunho + * the indJunho to set + */ + public void setIndJunho(Boolean indJunho) { + this.indJunho = indJunho; + } + + /** + * @return the indJulho + */ + public Boolean getIndJulho() { + return indJulho; + } + + /** + * @param indJulho + * the indJulho to set + */ + public void setIndJulho(Boolean indJulho) { + this.indJulho = indJulho; + } + + /** + * @return the indAgosto + */ + public Boolean getIndAgosto() { + return indAgosto; + } + + /** + * @param indAgosto + * the indAgosto to set + */ + public void setIndAgosto(Boolean indAgosto) { + this.indAgosto = indAgosto; + } + + /** + * @return the indSetembro + */ + public Boolean getIndSetembro() { + return indSetembro; + } + + /** + * @param indSetembro + * the indSetembro to set + */ + public void setIndSetembro(Boolean indSetembro) { + this.indSetembro = indSetembro; + } + + /** + * @return the indOutubro + */ + public Boolean getIndOutubro() { + return indOutubro; + } + + /** + * @param indOutubro + * the indOutubro to set + */ + public void setIndOutubro(Boolean indOutubro) { + this.indOutubro = indOutubro; + } + + /** + * @return the indNovembro + */ + public Boolean getIndNovembro() { + return indNovembro; + } + + /** + * @param indNovembro + * the indNovembro to set + */ + public void setIndNovembro(Boolean indNovembro) { + this.indNovembro = indNovembro; + } + + /** + * @return the indDezembro + */ + public Boolean getIndDezembro() { + return indDezembro; + } + + /** + * @param indDezembro + * the indDezembro to set + */ + public void setIndDezembro(Boolean indDezembro) { + this.indDezembro = indDezembro; + } + + /** + * @return the indOutrosIsento + */ + public Boolean getIndOutrosIsento() { + return indOutrosIsento; + } + + /** + * @param indOutrosIsento + * the indOutrosIsento to set + */ + public void setIndOutrosIsento(Boolean indOutrosIsento) { + this.indOutrosIsento = indOutrosIsento; + } + + /** + * @return the activo + */ + public Boolean getActivo() { + return activo; + } + + /** + * @param activo + * the activo to set + */ + public void setActivo(Boolean activo) { + this.activo = activo; + } + + /** + * @return the fecmodif + */ + public Date getFecmodif() { + return fecmodif; + } + + /** + * @param fecmodif + * the fecmodif to set + */ + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + /** + * @return the usuarioId + */ + public Integer getUsuarioId() { + return usuarioId; + } + + /** + * @param usuarioId + * the usuarioId to set + */ + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + /** + * @return the empresa + */ + public Empresa getEmpresa() { + return empresa; + } + + /** + * @param empresa + * the empresa to set + */ + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + public Integer getIndiceICMSecf() { + return indiceICMSecf; + } + + public void setIndiceICMSecf(Integer indiceICMSecf) { + this.indiceICMSecf = indiceICMSecf; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (empresaImpostoId != null ? empresaImpostoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof EmpresaImposto)) { + return false; + } + EmpresaImposto other = (EmpresaImposto) object; + if ((this.empresaImpostoId == null && other.empresaImpostoId != null) || (this.empresaImpostoId != null && !this.empresaImpostoId.equals(other.empresaImpostoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.EmpresaImposto[empresaImpostoId=" + empresaImpostoId + "]"; + } + + public BigDecimal getPorctributo() { + return porctributo; + } + + public void setPorctributo(BigDecimal porctributo) { + this.porctributo = porctributo; + } + + /** + * @return the indOutrasUFBloqueadas + */ + public Boolean getIndOutrasUFBloqueadas() { + return indOutrasUFBloqueadas; + } + + /** + * @param indOutrasUFBloqueadas + * the indOutrasUFBloqueadas to set + */ + public void setIndOutrasUFBloqueadas(Boolean indOutrasUFBloqueadas) { + this.indOutrasUFBloqueadas = indOutrasUFBloqueadas; + } + + public BigDecimal getIcmsIntermunicipal() { + return icmsIntermunicipal; + } + + public void setIcmsIntermunicipal(BigDecimal icmsIntermunicipal) { + this.icmsIntermunicipal = icmsIntermunicipal; + } + + public BigDecimal getIndiceICMSIntermunicipal() { + return indiceICMSIntermunicipal; + } + + public void setIndiceICMSIntermunicipal(BigDecimal indiceICMSIntermunicipal) { + this.indiceICMSIntermunicipal = indiceICMSIntermunicipal; + } + + public Boolean getIndValidaECF() { + return indValidaECF; + } + + public void setIndValidaECF(Boolean indValidaECF) { + this.indValidaECF = indValidaECF; + } + + public BigDecimal getIcmsIntermunicipalMatricial() { + return icmsIntermunicipalMatricial; + } + + public void setIcmsIntermunicipalMatricial(BigDecimal icmsIntermunicipalMatricial) { + this.icmsIntermunicipalMatricial = icmsIntermunicipalMatricial; + } + + public BigDecimal getIcmsMatricial() { + return icmsMatricial; + } + + public void setIcmsMatricial(BigDecimal icmsMatricial) { + this.icmsMatricial = icmsMatricial; + } + + public BigDecimal getTributacaoImportacao() { + return tributacaoImportacao; + } + + public void setTributacaoImportacao(BigDecimal tributacaoImportacao) { + this.tributacaoImportacao = tributacaoImportacao; + } + + public String getCodEstabelecimento() { + return codEstabelecimento; + } + + public void setCodEstabelecimento(String codEstabelecimento) { + this.codEstabelecimento = codEstabelecimento; + } + + public String getCodigoContabilMunicipal() { + return codigoContabilMunicipal; + } + + public void setCodigoContabilMunicipal(String codigoContabilMunicipal) { + this.codigoContabilMunicipal = codigoContabilMunicipal; + } + + public String getCodigoContabilEstadual() { + return codigoContabilEstadual; + } + + public void setCodigoContabilEstadual(String codigoContabilEstadual) { + this.codigoContabilEstadual = codigoContabilEstadual; + } + + public Boolean getIsBPe() { + return isBPe; + } + + public void setIsBPe(Boolean isBPe) { + this.isBPe = isBPe; + } + + public BigDecimal getPorcRedBaseIcmsIM() { + return porcRedBaseIcmsIM; + } + + public void setPorcRedBaseIcmsIM(BigDecimal porcRedBaseIcmsIM) { + this.porcRedBaseIcmsIM = porcRedBaseIcmsIM; + } + + public Boolean getIndRedutorBaseIcmsBPe() { + return indRedutorBaseIcmsBPe; + } + + public void setIndRedutorBaseIcmsBPe(Boolean indRedutorBaseIcmsBPe) { + this.indRedutorBaseIcmsBPe = indRedutorBaseIcmsBPe; + } + + + public Boolean getIndTribViagem() { + return indTribViagem; + } + + public void setIndTribViagem(Boolean indTribViagem) { + this.indTribViagem = indTribViagem; + } + + public BigDecimal getTributacaoImportacaoIM() { + return tributacaoImportacaoIM; + } + + public void setTributacaoImportacaoIM(BigDecimal tributacaoImportacaoIM) { + this.tributacaoImportacaoIM = tributacaoImportacaoIM; + } + + public BigDecimal getPorcFECP() { + return porcFECP; + } + + public void setPorcFECP(BigDecimal porcFECP) { + this.porcFECP = porcFECP; + } + + public Boolean getIndAliquotaBPeUfDestino() { + return indAliquotaBPeUfDestino; + } + + public void setIndAliquotaBPeUfDestino(Boolean indAliquotaBPeUfDestino) { + this.indAliquotaBPeUfDestino = indAliquotaBPeUfDestino; + } + + public List getLsAliquotaEstadoDestino() { + return lsAliquotaEstadoDestino; + } + + public void setLsAliquotaEstadoDestino(List lsAliquotaEstadoDestino) { + this.lsAliquotaEstadoDestino = lsAliquotaEstadoDestino; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaSaferConfig.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaSaferConfig.java new file mode 100644 index 000000000..3e622ac64 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaSaferConfig.java @@ -0,0 +1,157 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "EMPRESA_SAFER_CONFIG_SEQ", sequenceName = "EMPRESA_SAFER_CONFIG_SEQ", allocationSize = 1) +@Table(name = "EMPRESA_SAFER_CONFIG") +public class EmpresaSaferConfig implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_SAFER_CONFIG_SEQ") + @Column(name = "EMPRESASAFERCONFIG_ID") + private Integer empresaSaferConfigId; + @Column(name = "PARTNERID") + private String partnerId; + @Column(name = "CONTRACTID") + private String contractId; + @Column(name = "SENHA") + private String senha; + @Column(name = "CERTIFICADO") + private byte[] certificado; + + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public EmpresaSaferConfig() { + + } + + public Integer getEmpresaSaferConfigId() { + return empresaSaferConfigId; + } + + public void setEmpresaSaferConfigId(Integer empresaSaferConfigId) { + this.empresaSaferConfigId = empresaSaferConfigId; + } + + public String getPartnerId() { + return partnerId; + } + + public void setPartnerId(String partnerId) { + this.partnerId = partnerId; + } + + public String getContractId() { + return contractId; + } + + public void setContractId(String contractId) { + this.contractId = contractId; + } + + public String getSenha() { + return senha; + } + + public void setSenha(String senha) { + this.senha = senha; + } + + public byte[] getCertificado() { + return certificado; + } + + public void setCertificado(byte[] certificado) { + this.certificado = certificado; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((empresaSaferConfigId == null) ? 0 : empresaSaferConfigId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + EmpresaSaferConfig other = (EmpresaSaferConfig) obj; + if (empresaSaferConfigId == null) { + if (other.empresaSaferConfigId != null) + return false; + } else if (!empresaSaferConfigId.equals(other.empresaSaferConfigId)) + return false; + return true; + } + + @Override + public String toString() { + return String.valueOf(this.getEmpresaSaferConfigId()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaTrocoSimples.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaTrocoSimples.java new file mode 100644 index 000000000..41e4e3ec8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaTrocoSimples.java @@ -0,0 +1,167 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + + +@Entity +@Table(name = "EMPRESA_TROCOSIMPLES") +@SequenceGenerator(name = "EMPRESA_TROCOSIMPLES_SEQ", sequenceName = "EMPRESA_TROCOSIMPLES_SEQ", allocationSize = 1) +public class EmpresaTrocoSimples implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_TROCOSIMPLES_SEQ") + @Column(name = "EMPRESA_TROCOSIMPLES_ID") + private Long empresaTrocoSimplesId; + + @ManyToOne + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "RAZAO_SOCIAL") + private String razaoSocial; + + @Column(name = "NOME_FANTASIA") + private String nomeFantasia; + + @Column(name = "CNPJ") + private String cnpj; + + @Column(name = "TELEFONE") + private String telefone; + + @Column(name = "ENDERECO") + private String endereco; + + @Column(name = "VALOR_SUGERIR_TROCO") + private BigDecimal valorSugerirTroco; + + @Column(name = "TOKEN_EMPRESA") + private String tokenEmpresa; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @OneToOne + @JoinColumn(name = "USUARIO_ID") + private Usuario usuario; + + public Long getEmpresaTrocoSimplesId() { + return empresaTrocoSimplesId; + } + + public void setEmpresaTrocoSimplesId(Long empresaTrocoSimplesId) { + this.empresaTrocoSimplesId = empresaTrocoSimplesId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public String getRazaoSocial() { + return razaoSocial; + } + + public void setRazaoSocial(String razaoSocial) { + this.razaoSocial = razaoSocial; + } + + public String getNomeFantasia() { + return nomeFantasia; + } + + public void setNomeFantasia(String nomeFantasia) { + this.nomeFantasia = nomeFantasia; + } + + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + public String getTelefone() { + return telefone; + } + + public void setTelefone(String telefone) { + this.telefone = telefone; + } + + public String getEndereco() { + return endereco; + } + + public void setEndereco(String endereco) { + this.endereco = endereco; + } + + public BigDecimal getValorSugerirTroco() { + return valorSugerirTroco; + } + + public void setValorSugerirTroco(BigDecimal valorSugerirTroco) { + this.valorSugerirTroco = valorSugerirTroco; + } + + public String getTokenEmpresa() { + return tokenEmpresa; + } + + public void setTokenEmpresa(String tokenEmpresa) { + this.tokenEmpresa = tokenEmpresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EnderecoApanhe.java b/src/com/rjconsultores/ventaboletos/entidad/EnderecoApanhe.java new file mode 100644 index 000000000..2d3efbde6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EnderecoApanhe.java @@ -0,0 +1,221 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.rjconsultores.ventaboletos.enums.LocalEnderecoApanhe; + +@Entity +@Table(name = "ENDERECO_APANHE") +@SequenceGenerator(name = "ENDERECO_APANHE_SEQ", sequenceName = "ENDERECO_APANHE_SEQ", allocationSize = 1) +public class EnderecoApanhe implements Serializable, Cloneable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ENDERECO_APANHE_SEQ") + @Column(name = "ENDERECOAPANHE_ID") + private Long enderecoapanheId; + + @Enumerated(EnumType.ORDINAL) + @Column(name = "LOCAL") + private LocalEnderecoApanhe localEnderecoApanhe; + + @Column(name = "CEP") + private String cep; + + @Column(name = "ENDERECO") + private String endereco; + + @Column(name = "CIDADE") + private String cidade; + + @Column(name = "NUMERO") + private String numero; + + @Column(name = "BAIRRO") + private String bairro; + + @Column(name = "COMPLEMENTO") + private String complemento; + + @Column(name = "REFERENCIA") + private String referencia; + + @Column(name = "DESCHOTEL") + private String deschotel; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "VENDAPACOTE_ID") + private VendaPacote vendaPacote; + + public Long getEnderecoapanheId() { + return enderecoapanheId; + } + + public void setEnderecoapanheId(Long enderecoapanheId) { + this.enderecoapanheId = enderecoapanheId; + } + + public LocalEnderecoApanhe getLocalEnderecoApanhe() { + return localEnderecoApanhe; + } + + public void setLocalEnderecoApanhe(LocalEnderecoApanhe localEnderecoApanhe) { + this.localEnderecoApanhe = localEnderecoApanhe; + } + + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + public String getEndereco() { + return endereco; + } + + public void setEndereco(String endereco) { + this.endereco = endereco; + } + + public String getCidade() { + return cidade; + } + + public void setCidade(String cidade) { + this.cidade = cidade; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getReferencia() { + return referencia; + } + + public void setReferencia(String referencia) { + this.referencia = referencia; + } + + public String getDeschotel() { + return deschotel; + } + + public void setDeschotel(String deschotel) { + this.deschotel = deschotel; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((enderecoapanheId == null) ? 0 : enderecoapanheId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + EnderecoApanhe other = (EnderecoApanhe) obj; + if (enderecoapanheId == null) { + if (other.enderecoapanheId != null) + return false; + } else if (!enderecoapanheId.equals(other.enderecoapanheId)) + return false; + return true; + } + + public VendaPacote getVendaPacote() { + return vendaPacote; + } + + public void setVendaPacote(VendaPacote vendaPacote) { + this.vendaPacote = vendaPacote; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Escola.java b/src/com/rjconsultores/ventaboletos/entidad/Escola.java new file mode 100644 index 000000000..b19fe85db --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Escola.java @@ -0,0 +1,96 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ESCOLA_SEQ", sequenceName = "ESCOLA_SEQ", allocationSize = 1) +@Table(name = "ESCOLA") +public class Escola implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESCOLA_SEQ") + @Basic(optional = false) + @Column(name = "ESCOLA_ID") + private Integer escolaId; + @Column(name = "NOMESCOLA") + private String nombescola; + @JoinColumn(name = "CIUDAD_ID", referencedColumnName = "CIUDAD_ID") + @ManyToOne + private Ciudad ciudad; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getEscolaId() { + return escolaId; + } + + public void setEscolaId(Integer escolaId) { + this.escolaId = escolaId; + } + + public String getNombescola() { + return nombescola; + } + + public void setNombescola(String nombescola) { + this.nombescola = nombescola; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return this.nombescola; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EsquemaAgrupacion.java b/src/com/rjconsultores/ventaboletos/entidad/EsquemaAgrupacion.java new file mode 100644 index 000000000..bae27a7b9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EsquemaAgrupacion.java @@ -0,0 +1,148 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ESQUEMA_AGRUPACION_SEQ", sequenceName = "ESQUEMA_AGRUPACION_SEQ", allocationSize = 1) +@Table(name = "ESQUEMA_AGRUPACION") +public class EsquemaAgrupacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_AGRUPACION_SEQ") + @Column(name = "ESQUEMAAGRUPACION_ID") + private Integer esquemaagrupacionId; + @Column(name = "DESCAGRUPACION ") + private String descagrupacion; + @Column(name = "NUMAGRUPACION") + private Integer numagrupacion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "ESQUEMAAGRUPACION_ID", referencedColumnName = "ESQUEMAAGRUPACION_ID") + @OneToMany + private List esquemaCorridaList; + + public EsquemaAgrupacion() { + } + + public EsquemaAgrupacion(Integer esquemaagrupacionId) { + this.esquemaagrupacionId = esquemaagrupacionId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getEsquemaagrupacionId() { + return esquemaagrupacionId; + } + + public void setEsquemaagrupacionId(Integer esquemaagrupacionId) { + this.esquemaagrupacionId = esquemaagrupacionId; + } + + public String getDescagrupacion() { + return descagrupacion; + } + + public void setDescagrupacion(String descagrupacion) { + this.descagrupacion = descagrupacion; + } + + public Integer getNumagrupacion() { + return numagrupacion; + } + + public void setNumagrupacion(Integer numagrupacion) { + this.numagrupacion = numagrupacion; + } + + public List getEsquemaCorridaList() { + + if (this.esquemaCorridaList != null) { + List esquemaList = new ArrayList(); + + for (EsquemaCorrida ec : this.esquemaCorridaList) { + if (ec.getActivo()) { + esquemaList.add(ec); + } + } + return esquemaList; + } + return null; + } + + public void setEsquemaCorridaList(List esquemaCorrida) { + this.esquemaCorridaList = esquemaCorrida; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (esquemaagrupacionId != null ? esquemaagrupacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof EsquemaAgrupacion)) { + return false; + } + EsquemaAgrupacion other = (EsquemaAgrupacion) object; + if ((this.esquemaagrupacionId == null && other.esquemaagrupacionId != null) || (this.esquemaagrupacionId != null && !this.esquemaagrupacionId.equals(other.esquemaagrupacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.EsquemaAgrupacion[esquemaagrupacionId=" + esquemaagrupacionId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EsquemaAsiento.java b/src/com/rjconsultores/ventaboletos/entidad/EsquemaAsiento.java new file mode 100644 index 000000000..189bff8d9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EsquemaAsiento.java @@ -0,0 +1,214 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "ESQUEMA_ASIENTO_SEQ", sequenceName = "ESQUEMA_ASIENTO_SEQ", allocationSize = 1) +@Table(name = "ESQUEMA_ASIENTO") +public class EsquemaAsiento implements Serializable, Auditavel { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "ESQUEMAASIENTO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_ASIENTO_SEQ") + private Integer esquemaasientoId; + + @Column(name = "NUMASIENTO") + private String numasiento; + @Column(name = "INDVENDIBLE") + private Boolean indvendible; + @Column(name = "TIEMPOLIBERACION") + private Integer tiempoLiberacion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PARADA_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada parada; + + @JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID") + @ManyToOne(cascade = CascadeType.MERGE) + @NaoAuditar + private EsquemaCorrida esquemaCorrida; + @Column(name = "MOTIVOBLOQUEO") + private String motivobloqueo; + @OneToOne + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + private Parada destino; + + @Transient + @NaoAuditar + private EsquemaAsiento esquemaAsientoClone; + + public EsquemaAsiento() { + } + + public EsquemaAsiento(Integer esquemaasientoId) { + this.esquemaasientoId = esquemaasientoId; + } + + public Integer getEsquemaasientoId() { + return esquemaasientoId; + } + + public void setEsquemaasientoId(Integer esquemaasientoId) { + this.esquemaasientoId = esquemaasientoId; + } + + public String getNumasiento() { + return numasiento; + } + + public void setNumasiento(String numasiento) { + this.numasiento = numasiento; + } + + public Boolean getIndvendible() { + return indvendible; + } + + public void setIndvendible(Boolean indvendible) { + this.indvendible = indvendible; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public EsquemaCorrida getEsquemaCorrida() { + return esquemaCorrida; + } + + public void setEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + this.esquemaCorrida = esquemaCorrida; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destinoId) { + this.destino = destinoId; + } + + public String getMotivobloqueo() { + return motivobloqueo; + } + + public void setMotivobloqueo(String motivobloqueo) { + this.motivobloqueo = motivobloqueo; + } + + public Integer getTiempoLiberacion() { + return tiempoLiberacion; + } + + public void setTiempoLiberacion(Integer tiempoLiberacion) { + this.tiempoLiberacion = tiempoLiberacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getEsquemaasientoId() != null ? getEsquemaasientoId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof EsquemaAsiento)) { + return false; + } + EsquemaAsiento other = (EsquemaAsiento) object; + if ((this.getEsquemaasientoId() == null && other.getEsquemaasientoId() != null) || (this.getEsquemaasientoId() != null && !this.getEsquemaasientoId().equals(other.getEsquemaasientoId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.test.EsquemaAsiento[esquemaasientoId=" + esquemaasientoId + "]"; + } + + @Override + public void clonar() throws CloneNotSupportedException { + esquemaAsientoClone = new EsquemaAsiento(); + esquemaAsientoClone = (EsquemaAsiento) this.clone(); + } + + @Override + public EsquemaAsiento getCloneObject() throws CloneNotSupportedException { + return esquemaAsientoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s] - ASSENTOS [%s] - Localidade [%s]", getEsquemaasientoId(), + getNumasiento(), + getParada() != null ? getParada().getDescparada() : null); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java b/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java new file mode 100644 index 000000000..f0dc94caa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java @@ -0,0 +1,849 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.apache.commons.lang.BooleanUtils; +import org.apache.commons.lang.StringUtils; + +import br.com.rjconsultores.auditador.annotations.AuditarAtributo; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarEntidade; +import br.com.rjconsultores.auditador.annotations.AuditarID; +import br.com.rjconsultores.auditador.annotations.AuditarLista; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "ESQUEMA_CORRIDA_SEQ", sequenceName = "ESQUEMA_CORRIDA_SEQ", allocationSize = 1) +@Table(name = "ESQUEMA_CORRIDA") +@AuditarClasse(nome = "ESQUEMA_CORRIDA", tela = "Configuração de Serviços") +public class EsquemaCorrida implements Serializable, Auditavel { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "ESQUEMACORRIDA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_CORRIDA_SEQ") + @AuditarID + private Integer esquemacorridaId; + + @Column(name = "HORASALIDA") + @Temporal(TemporalType.TIME) + @AuditarAtributo(pattern = "HH:mm") + private Date horasalida; + + @Column(name = "INDPISOEXTRA") + private Boolean pisoExtra; + + @Column(name = "INDLUNES") + private Boolean indlunes; + + @Column(name = "INDMARTES") + private Boolean indmartes; + + @Column(name = "INDMIERCOLES") + private Boolean indmiercoles; + + @Column(name = "INDJUEVES") + private Boolean indjueves; + + @Column(name = "INDVIERNES") + private Boolean indviernes; + + @Column(name = "INDSABADO") + private Boolean indsabado; + + @Column(name = "INDDOMINGO") + private Boolean inddomingo; + + @Column(name = "CANTPARADOS") + private Integer cantparados; + + @Column(name = "ACTIVO") + @NaoAuditar + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + @NaoAuditar + private Date fecmodif; + + @Column(name = "USUARIO_ID") + @NaoAuditar + private Integer usuarioId; + + @Column(name = "DIAGRAMAAUTOBUS_ID") + private Integer diagramaAutobusId; + + @Column(name = "STATUSCORRIDA") + private String statusCorrida; + + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + + @JoinColumn(name = "ROLOPERATIVO_ID", referencedColumnName = "ROLOPERATIVO_ID") + @ManyToOne(cascade = CascadeType.ALL) + private RolOperativo rolOperativo; + + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + + @JoinColumn(name = "ESQUEMAOPERACIONAL_ID", referencedColumnName = "ESQUEMAOPERACIONAL_ID") + @ManyToOne(cascade = CascadeType.ALL) + @AuditarEntidade + private EsquemaOperacional esquemaOperacional; + + @JoinColumn(name = "EMPRESACORRIDA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @JoinColumn(name = "EMPRESAINGRESO_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa1; + + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne(cascade = CascadeType.ALL) + private ClaseServicio claseServicio; + + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID") + @AuditarLista(auditarEntidades = true, nome = "Localidade") + private List esquemaTramoList; + + @OneToMany(cascade = CascadeType.PERSIST) + @JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID") + @AuditarLista(auditarEntidades = true, nome = "Cotas") + private List esquemaAsientoList; + + @Column(name = "tipocorrida") + private String tipocorrida; + + @JoinColumn(name = "ESQUEMAREBOTE_ID", referencedColumnName = "ESQUEMACORRIDA_ID") + @ManyToOne(cascade = CascadeType.ALL) + private EsquemaCorrida esquemaCorridaRebote; + + @JoinColumn(name = "DIVISION_ID", referencedColumnName = "DIVISION_ID") + @ManyToOne(cascade = CascadeType.ALL) + private Division division; + + @Column(name = "NUMCORRIDA") + private Integer numCorrida; + + @Column(name = "NUMCORRIDAPISOEXTRA") + private Integer numCorridaPisoExtra; + + @Column(name = "NUMCORRIDAPISOEXTRA2") + private Integer numCorridaPisoExtra2; + + @Column(name = "INDGENERAFERIADO") + private String indGeneraFeriado; + + @Column(name = "CANTDIASGENERACION") + private Integer cantDiasGeneracion; + + @Column(name = "ESQUEMAAGRUPACION_ID") + private Integer esquemaAgrupacionId; + + @Column(name = "INFOCORRIDA") + private String infoCorrida; + + @Column(name = "INDCORRIDAEXTRA") + private Boolean indCorridaExtra; + + @Column(name = "INDDIASIMDIANAO") + private Boolean indDiaSimDiaNao; + + @JoinColumn(name = "AUTOBUS_ID", referencedColumnName = "AUTOBUS_ID") + @ManyToOne(cascade = CascadeType.ALL) + private Autobus autoBus; + + @OneToMany(mappedBy = "esquemaCorrida", cascade = CascadeType.ALL) + @AuditarLista(auditarEntidades = true, nome = "Embarque/Desembarque") + private List lsEsquemaCorridaEmbarqueDesembarque; + + @Transient + @NaoAuditar + private EsquemaCorrida esquemaCorridaClone; + + @Column(name = "ISFLEXBUS") + private Boolean isFlexBus; + + @Column(name = "OCUPACAO_MINIMA") + private Integer ocupacaoMinima; + + @Column(name = "HORAS_CONFIRMACAO") + private Integer horasParaConfirmacao; + + @Column(name = "MINUTOS_CONFIRMACAO") + private Integer minutosParaConfirmacao; + + @Column(name = "ISAUTOMACAOHORARIOEXTRA") + private Boolean isAutomacaoHorarioExtra; + + @Column(name = "TAXA_OCUPACAO") + private Integer taxaOcupacao; + + @Column(name = "HORAS_AUTOMACAO_HE_DE") + private Integer horasAutomacaoHEDe; + + @Column(name = "MINUTOS_AUTOMACAO_HE_DE") + private Integer minutosAutomacaoHEDe; + + @Column(name = "HORAS_AUTOMACAO_HE_ATE") + private Integer horasAutomacaoHEAte; + + @Column(name = "MINUTOS_AUTOMACAO_HE_ATE") + private Integer minutosAutomacaoHEAte; + + @JoinColumn(name = "ROLOPERATIVO_SERVICOEXTRA_ID", referencedColumnName = "ROLOPERATIVO_ID") + @ManyToOne(cascade = CascadeType.ALL) + private RolOperativo rolOperativoServicoExtra; + + @Column(name = "NUMCORRIDA_SERVICOEXTRA") + private Integer numCorridaServicoExtra; + + @Column(name = "BLOQUEIAINTERNET_HE") + private Boolean blolqueiaInternetHE; + + @Column(name = "PLATAFORMASERVICOEXTRA") + private String plataformaServicoExtra; + + public enum GerarFeriado { + // Declaração dos enum + GERARSEMPRE("GERAR SEMPRE", "S"), + + GERARQUANDOFERIADO("GERAR SÓ QUANDO FOR FERIADO", "F"), + + GERARQUANDONAOFERIADO("GERAR QUANDO NÃO FOR FERIADO", "N"); + + // Definição das constantes + public final String valor; + public final String descricao; + + public String valor() { + return this.valor; + } + + public String descricao() { + return this.descricao; + } + + private GerarFeriado(String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + } + + public String getTipocorrida() { + return tipocorrida; + } + + public void setTipocorrida(String tipocorrida) { + this.tipocorrida = tipocorrida; + } + + public EsquemaCorrida() { + } + + public EsquemaCorrida(Integer esquemacorridaId) { + this.esquemacorridaId = esquemacorridaId; + } + + public Integer getEsquemacorridaId() { + return esquemacorridaId; + } + + public void setEsquemacorridaId(Integer esquemacorridaId) { + this.esquemacorridaId = esquemacorridaId; + } + + public Date getHorasalida() { + return horasalida; + } + + public void setHorasalida(Date horasalida) { + this.horasalida = horasalida; + } + + public Integer getCantparados() { + return cantparados; + } + + public void setCantparados(Integer cantparados) { + this.cantparados = cantparados; + } + + public Boolean getInddomingo() { + return inddomingo; + } + + public void setInddomingo(Boolean inddomingo) { + this.inddomingo = inddomingo; + } + + public Boolean getIndjueves() { + return indjueves; + } + + public void setIndjueves(Boolean indjueves) { + this.indjueves = indjueves; + } + + public Boolean getIndlunes() { + return indlunes; + } + + public void setIndlunes(Boolean indlunes) { + this.indlunes = indlunes; + } + + public Boolean getIndmartes() { + return indmartes; + } + + public void setIndmartes(Boolean indmartes) { + this.indmartes = indmartes; + } + + public Boolean getIndmiercoles() { + return indmiercoles; + } + + public void setIndmiercoles(Boolean indmiercoles) { + this.indmiercoles = indmiercoles; + } + + public Boolean getIndsabado() { + return indsabado; + } + + public void setIndsabado(Boolean indsabado) { + this.indsabado = indsabado; + } + + public Boolean getIndviernes() { + return indviernes; + } + + public void setIndviernes(Boolean indviernes) { + this.indviernes = indviernes; + } + + public Date getFecmodif() { + return fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public RolOperativo getRolOperativo() { + return rolOperativo; + } + + public void setRolOperativo(RolOperativo rolOperativo) { + this.rolOperativo = rolOperativo; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public EsquemaOperacional getEsquemaOperacional() { + return esquemaOperacional; + } + + public void setEsquemaOperacional(EsquemaOperacional esquemaOperacional) { + this.esquemaOperacional = esquemaOperacional; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Empresa getEmpresa1() { + return empresa1; + } + + public void setEmpresa1(Empresa empresa1) { + this.empresa1 = empresa1; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public String getStatusCorrida() { + return statusCorrida; + } + + public void setStatusCorrida(String statusCorrida) { + this.statusCorrida = statusCorrida; + } + + public Integer getDiagramaAutobusId() { + return diagramaAutobusId; + } + + public void setDiagramaAutobusId(Integer diagramaAutobusId) { + this.diagramaAutobusId = diagramaAutobusId; + } + + public Division getDivision() { + return division; + } + + public void setDivision(Division division) { + this.division = division; + } + + public Boolean getPisoExtra() { + return pisoExtra; + } + + public void setPisoExtra(Boolean pisoExtra) { + this.pisoExtra = pisoExtra; + } + + public List getEsquemaTramoList() { + if (this.esquemaTramoList != null) { + List esquemaList = new ArrayList(); + + for (EsquemaTramo ec : this.esquemaTramoList) { + if (ec.getActivo()) { + esquemaList.add(ec); + } + } + return esquemaList; + } + return null; + + } + + public void setEsquemaTramoList(List esquemaTramoList) { + this.esquemaTramoList = esquemaTramoList; + } + + public void clearEsquemaAsiento(){ + if (esquemaAsientoList !=null){ + while(!esquemaAsientoList.isEmpty()) { + esquemaAsientoList.remove(0); + } + } + } + + public List getEsquemaAsientoList() { + if (esquemaAsientoList == null){ + return Collections.emptyList(); + } + + List esquemaList = new ArrayList(); + for (EsquemaAsiento ec : this.esquemaAsientoList) { + if (ec.getActivo()) { + esquemaList.add(ec); + } + } + return esquemaList; + } + + public void setEsquemaAsientoList(List esquemaAsientoList) { + this.esquemaAsientoList = esquemaAsientoList; + } + + public EsquemaCorrida getEsquemaCorridaRebote() { + return esquemaCorridaRebote; + } + + public void setEsquemaCorridaRebote(EsquemaCorrida esquemaCorridaRebote) { + this.esquemaCorridaRebote = esquemaCorridaRebote; + } + + + public Integer getNumCorrida() { + return numCorrida; + } + + public void setNumCorrida(Integer numCorrida) { + this.numCorrida = numCorrida; + } + + public Integer getNumCorridaPisoExtra() { + return numCorridaPisoExtra; + } + + public void setNumCorridaPisoExtra(Integer numCorridaPisoExtra) { + this.numCorridaPisoExtra = numCorridaPisoExtra; + } + + public String getIndGeneraFeriado() { + return indGeneraFeriado; + } + + public void setIndGeneraFeriado(String indGeneraFeriado) { + this.indGeneraFeriado = indGeneraFeriado; + } + + public Integer getCantDiasGeneracion() { + return cantDiasGeneracion; + } + + public void setCantDiasGeneracion(Integer cantDiasGeracion) { + this.cantDiasGeneracion = cantDiasGeracion; + } + + public Integer getEsquemaAgrupacionId() { + return esquemaAgrupacionId; + } + + public void setEsquemaAgrupacionId(Integer esquemaAgrupacionId) { + this.esquemaAgrupacionId = esquemaAgrupacionId; + } + + public String getInfoCorrida() { + return infoCorrida; + } + + public void setInfoCorrida(String infoCorrida) { + this.infoCorrida = infoCorrida; + } + + public Boolean getIndCorridaExtra() { + return indCorridaExtra; + } + + public void setIndCorridaExtra(Boolean indCorridaExtra) { + this.indCorridaExtra = indCorridaExtra; + } + + public Boolean getIndDiaSimDiaNao() { + return indDiaSimDiaNao; + } + + public void setIndDiaSimDiaNao(Boolean indDiaSimDiaNao) { + this.indDiaSimDiaNao = indDiaSimDiaNao; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getEsquemacorridaId() != null ? getEsquemacorridaId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof EsquemaCorrida)) { + return false; + } + EsquemaCorrida other = (EsquemaCorrida) object; + if ((this.getEsquemacorridaId() == null && other.getEsquemacorridaId() != null) || (this.getEsquemacorridaId() != null && !this.getEsquemacorridaId().equals(other.getEsquemacorridaId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getNumCorrida() + (StringUtils.isNotEmpty(this.getInfoCorrida()) ? " - " + this.getInfoCorrida() : "") + " - "+esquemacorridaId; + } + + public Autobus getAutoBus() { + return autoBus; + } + + public void setAutoBus(Autobus autoBus) { + this.autoBus = autoBus; + } + + public List getLsEsquemaCorridaEmbarqueDesembarque() { + return lsEsquemaCorridaEmbarqueDesembarque; + } + + public void setLsEsquemaCorridaEmbarqueDesembarque(List lsEsquemaCorridaEmbarqueDesembarque) { + this.lsEsquemaCorridaEmbarqueDesembarque = lsEsquemaCorridaEmbarqueDesembarque; + } + + @Override + public void clonar() throws CloneNotSupportedException { + esquemaCorridaClone = new EsquemaCorrida(); + esquemaCorridaClone = (EsquemaCorrida) this.clone(); + + if(this.getAutoBus() != null) { + this.getAutoBus().clonar(); + esquemaCorridaClone.setAutoBus(this.getAutoBus().getCloneObject()); + } + + if(this.getClaseServicio() != null) { + this.getClaseServicio().clonar(); + esquemaCorridaClone.setClaseServicio(this.getClaseServicio().getCloneObject()); + } + + if(this.getDivision() != null) { + this.getDivision().clonar(); + esquemaCorridaClone.setDivision(this.getDivision().getCloneObject()); + } + + if(this.getEmpresa() != null) { + this.getEmpresa().clonar(); + esquemaCorridaClone.setEmpresa(this.getEmpresa().getCloneObject()); + } + + if(this.getEmpresa1() != null) { + this.getEmpresa1().clonar(); + esquemaCorridaClone.setEmpresa1(this.getEmpresa1().getCloneObject()); + } + + if(this.getMarca() != null) { + this.getMarca().clonar(); + esquemaCorridaClone.setMarca(this.getMarca().getCloneObject()); + } + + if(this.getEsquemaCorridaRebote() != null) { + this.getEsquemaCorridaRebote().clonar(); + esquemaCorridaClone.setEsquemaCorridaRebote(this.getEsquemaCorridaRebote().getCloneObject()); + } + + if(this.getEsquemaOperacional() != null) { + this.getEsquemaOperacional().clonar(); + esquemaCorridaClone.setEsquemaOperacional(this.getEsquemaOperacional().getCloneObject()); + } + + if(this.getRolOperativo() != null) { + this.getRolOperativo().clonar(); + esquemaCorridaClone.setRolOperativo(this.getRolOperativo().getCloneObject()); + } + + if(this.getRuta() != null) { + this.getRuta().clonar(); + esquemaCorridaClone.setRuta(this.getRuta().getCloneObject()); + } + + if(this.getEsquemaAsientoList() != null) { + List lsClones = new ArrayList(); + for (EsquemaAsiento esquemaAsiento : this.getEsquemaAsientoList()) { + if(BooleanUtils.isTrue(esquemaAsiento.getActivo())) { + esquemaAsiento.clonar(); + lsClones.add(esquemaAsiento.getCloneObject()); + } + } + esquemaCorridaClone.setEsquemaAsientoList(lsClones); + } + + if(this.getEsquemaTramoList() != null) { + List lsClones = new ArrayList(); + for (EsquemaTramo esquemaTramo : this.getEsquemaTramoList()) { + if(BooleanUtils.isTrue(esquemaTramo.getActivo())) { + esquemaTramo.clonar(); + lsClones.add(esquemaTramo.getCloneObject()); + } + } + esquemaCorridaClone.setEsquemaTramoList(lsClones); + } + + if(this.getLsEsquemaCorridaEmbarqueDesembarque() != null) { + List lsClones = new ArrayList(); + for (EsquemaCorridaEmbarqueDesembarque esquemaCorridaEmbarqueDesembarque : this.getLsEsquemaCorridaEmbarqueDesembarque()) { + if(BooleanUtils.isTrue(esquemaCorridaEmbarqueDesembarque.getActivo())) { + esquemaCorridaEmbarqueDesembarque.clonar(); + lsClones.add(esquemaCorridaEmbarqueDesembarque.getCloneObject()); + } + } + esquemaCorridaClone.setLsEsquemaCorridaEmbarqueDesembarque(lsClones); + } + + } + + @Override + public EsquemaCorrida getCloneObject() throws CloneNotSupportedException { + return esquemaCorridaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s] - Número Serviço [%s]", getEsquemacorridaId(), getNumCorrida()); + } + + public Integer getNumCorridaPisoExtra2() { + return numCorridaPisoExtra2; + } + + public void setNumCorridaPisoExtra2(Integer numCorridaPisoExtra2) { + this.numCorridaPisoExtra2 = numCorridaPisoExtra2; + } + + public Boolean getIsFlexBus() { + return isFlexBus == null ? false : isFlexBus; + } + + public void setIsFlexBus(Boolean isFlexBus) { + this.isFlexBus = isFlexBus; + } + + public Integer getHorasParaConfirmacao() { + return horasParaConfirmacao == null ? 0 : horasParaConfirmacao; + } + + public void setHorasParaConfirmacao(Integer horasParaConfirmacao) { + this.horasParaConfirmacao = horasParaConfirmacao; + } + + public Integer getMinutosParaConfirmacao() { + return minutosParaConfirmacao == null ? 0 : minutosParaConfirmacao; + } + + public void setMinutosParaConfirmacao(Integer minutosParaConfirmacao) { + this.minutosParaConfirmacao = minutosParaConfirmacao; + } + + public Integer getOcupacaoMinima() { + return ocupacaoMinima == null ? 0 : ocupacaoMinima; + } + + public void setOcupacaoMinima(Integer ocupacaoMinima) { + this.ocupacaoMinima = ocupacaoMinima; + } + + public Boolean getIsAutomacaoHorarioExtra() { + return isAutomacaoHorarioExtra == null ? false : isAutomacaoHorarioExtra; + } + + public void setIsAutomacaoHorarioExtra(Boolean isAutomacaoHorarioExtra) { + this.isAutomacaoHorarioExtra = isAutomacaoHorarioExtra; + } + + public Integer getTaxaOcupacao() { + return taxaOcupacao; + } + + public void setTaxaOcupacao(Integer taxaOcupacao) { + this.taxaOcupacao = taxaOcupacao; + } + + public Integer getHorasAutomacaoHEDe() { + return horasAutomacaoHEDe; + } + + public void setHorasAutomacaoHEDe(Integer horasAutomacaoHEDe) { + this.horasAutomacaoHEDe = horasAutomacaoHEDe; + } + + public Integer getMinutosAutomacaoHEDe() { + return minutosAutomacaoHEDe; + } + + public void setMinutosAutomacaoHEDe(Integer minutosAutomacaoHEDe) { + this.minutosAutomacaoHEDe = minutosAutomacaoHEDe; + } + + public Integer getHorasAutomacaoHEAte() { + return horasAutomacaoHEAte; + } + + public void setHorasAutomacaoHEAte(Integer horasAutomacaoHEAte) { + this.horasAutomacaoHEAte = horasAutomacaoHEAte; + } + + public Integer getMinutosAutomacaoHEAte() { + return minutosAutomacaoHEAte; + } + + public void setMinutosAutomacaoHEAte(Integer minutosAutomacaoHEAte) { + this.minutosAutomacaoHEAte = minutosAutomacaoHEAte; + } + + public RolOperativo getRolOperativoServicoExtra() { + return rolOperativoServicoExtra; + } + + public void setRolOperativoServicoExtra(RolOperativo rolOperativoServicoExtra) { + this.rolOperativoServicoExtra = rolOperativoServicoExtra; + } + + public Integer getNumCorridaServicoExtra() { + return numCorridaServicoExtra; + } + + public void setNumCorridaServicoExtra(Integer numCorridaServicoExtra) { + this.numCorridaServicoExtra = numCorridaServicoExtra; + } + + public Boolean getBlolqueiaInternetHE() { + return blolqueiaInternetHE; + } + + public void setBlolqueiaInternetHE(Boolean blolqueiaInternetHE) { + this.blolqueiaInternetHE = blolqueiaInternetHE; + } + + public String getPlataformaServicoExtra() { + return plataformaServicoExtra; + } + + public void setPlataformaServicoExtra(String plataformaServicoExtra) { + this.plataformaServicoExtra = plataformaServicoExtra; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorridaEmbarqueDesembarque.java b/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorridaEmbarqueDesembarque.java new file mode 100644 index 000000000..844254f35 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorridaEmbarqueDesembarque.java @@ -0,0 +1,210 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@Entity +@SequenceGenerator(name = "ESQUEMA_CORRIDA_EMB_DESEM_SEQ", sequenceName = "ESQUEMA_CORRIDA_EMB_DESEM_SEQ", allocationSize = 1) +@Table(name = "ESQUEMA_CORRIDA_EMBRQ_DESEMBRQ") +public class EsquemaCorridaEmbarqueDesembarque implements java.io.Serializable, Auditavel { + + private static final long serialVersionUID = -6308295160991190414L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_CORRIDA_EMB_DESEM_SEQ") + @Column(name = "ESQUEMACORRIDAEMBRQDESEMBRQ_ID", unique = true, nullable = false, precision = 7, scale = 0) + private Integer esquemaCorridaEmbarqueDesembarqueId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "ESQUEMACORRIDA_ID", nullable = false) + @NaoAuditar + private EsquemaCorrida esquemaCorrida; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "PARADA_ID", nullable = false) + private Parada parada; + + @Column(name = "ACTIVO", precision = 1, scale = 0) + private Boolean activo; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + private Date fecmodif; + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + private Integer usuarioId; + + @Column(name = "EMBARQUE", precision = 1, scale = 0) + private Boolean embarque; + + @Column(name = "DESEMBARQUE", precision = 1, scale = 0) + private Boolean desembarque; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "PARADA_EMB_DES_ID") + private Parada localDesembarqueEmbarque; + + @Transient + @NaoAuditar + private EsquemaCorridaEmbarqueDesembarque esquemaCorridaEmbarqueDesembarqueClone; + + public EsquemaCorridaEmbarqueDesembarque() { + } + + public EsquemaCorridaEmbarqueDesembarque(Integer esquemacorridaembrqdesembrqId, EsquemaCorrida esquemaCorrida, + Parada parada) { + this.esquemaCorridaEmbarqueDesembarqueId = esquemacorridaembrqdesembrqId; + this.esquemaCorrida = esquemaCorrida; + this.parada = parada; + } + + public EsquemaCorridaEmbarqueDesembarque(Integer esquemacorridaembrqdesembrqId, EsquemaCorrida esquemaCorrida, Parada parada, + Boolean activo, Date fecmodif, Integer usuarioId) { + this.esquemaCorridaEmbarqueDesembarqueId = esquemacorridaembrqdesembrqId; + this.esquemaCorrida = esquemaCorrida; + this.parada = parada; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Integer getEsquemaCorridaEmbarqueDesembarqueId() { + return this.esquemaCorridaEmbarqueDesembarqueId; + } + + public void setEsquemaCorridaEmbarqueDesembarqueId(Integer esquemaCorridaEmbarqueDesembarqueId) { + this.esquemaCorridaEmbarqueDesembarqueId = esquemaCorridaEmbarqueDesembarqueId; + } + + public EsquemaCorrida getEsquemaCorrida() { + return this.esquemaCorrida; + } + + public void setEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + this.esquemaCorrida = esquemaCorrida; + } + + public Parada getParada() { + return this.parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getEmbarque() { + return embarque; + } + + public void setEmbarque(Boolean embarque) { + this.embarque = embarque; + } + + public Boolean getDesembarque() { + return desembarque; + } + + public void setDesembarque(Boolean desembarque) { + this.desembarque = desembarque; + } + + @Override + public String toString() { + return parada != null ? parada.getDescparada() : ""; + } + + public Parada getLocalDesembarqueEmbarque() { + return localDesembarqueEmbarque; + } + + public void setLocalDesembarqueEmbarque(Parada localDesembarqueEmbarque) { + this.localDesembarqueEmbarque = localDesembarqueEmbarque; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getEsquemaCorridaEmbarqueDesembarqueId() == null) ? 0 : getEsquemaCorridaEmbarqueDesembarqueId().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof EsquemaCorridaEmbarqueDesembarque)) + return false; + EsquemaCorridaEmbarqueDesembarque other = (EsquemaCorridaEmbarqueDesembarque) obj; + if (getEsquemaCorridaEmbarqueDesembarqueId() == null) { + if (other.getEsquemaCorridaEmbarqueDesembarqueId() != null) + return false; + } else if (!getEsquemaCorridaEmbarqueDesembarqueId().equals(other.getEsquemaCorridaEmbarqueDesembarqueId())) + return false; + return true; + } + + @Override + public void clonar() throws CloneNotSupportedException { + esquemaCorridaEmbarqueDesembarqueClone = new EsquemaCorridaEmbarqueDesembarque(); + esquemaCorridaEmbarqueDesembarqueClone = (EsquemaCorridaEmbarqueDesembarque) this.clone(); + + } + + @Override + public EsquemaCorridaEmbarqueDesembarque getCloneObject() throws CloneNotSupportedException { + return esquemaCorridaEmbarqueDesembarqueClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s] - Embarque [%s] - Desemb. [%s]", + getEsquemaCorridaEmbarqueDesembarqueId(), getParada() != null ? getParada().getDescparada() : "", + getEsquemaCorridaEmbarqueDesembarqueId(), getLocalDesembarqueEmbarque() != null ? getLocalDesembarqueEmbarque().getDescparada() : ""); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EsquemaOperacional.java b/src/com/rjconsultores/ventaboletos/entidad/EsquemaOperacional.java new file mode 100644 index 000000000..529019002 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EsquemaOperacional.java @@ -0,0 +1,210 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import br.com.rjconsultores.auditador.annotations.AuditarAtributo; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "ESQUEMA_OPERACIONAL_SEQ", sequenceName = "ESQUEMA_OPERACIONAL_SEQ", allocationSize = 1) +@Table(name = "ESQUEMA_OPERACIONAL") +public class EsquemaOperacional implements Serializable, Auditavel { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "ESQUEMAOPERACIONAL_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_OPERACIONAL_SEQ") + private Integer esquemaoperacionalId; + + @Column(name = "FECNICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + @AuditarAtributo(pattern = "dd/MM/yyyy", nome = "Inicio Vigencia") + private Date fecniciovigencia; + + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + @AuditarAtributo(pattern = "dd/MM/yyyy", nome = "Fim Vigencia") + private Date fecfinvigencia; + + @Column(name = "ACTIVO") + @NaoAuditar + private Boolean activo; + + @Column(name = "USUARIO_ID") + @NaoAuditar + private Integer usuarioId; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + @NaoAuditar + private Date fecmodif; + + @OneToMany(mappedBy = "esquemaOperacional") + @NaoAuditar + private List esquemaCorridaList; + + @Transient + @NaoAuditar + private EsquemaOperacional esquemaOperacionalClone; + + public EsquemaOperacional() { + } + + public EsquemaOperacional(Integer esquemaoperacionalId) { + this.esquemaoperacionalId = esquemaoperacionalId; + } + + public Integer getEsquemaoperacionalId() { + return esquemaoperacionalId; + } + + public void setEsquemaoperacionalId(Integer esquemaoperacionalId) { + this.esquemaoperacionalId = esquemaoperacionalId; + } + + public Date getFecniciovigencia() { + return fecniciovigencia; + } + + public void setFecniciovigencia(Date fecniciovigencia) { + if (fecniciovigencia != null) { + GregorianCalendar fecInicioVigenciaEsquema = new GregorianCalendar(); + + fecInicioVigenciaEsquema.setTime(fecniciovigencia); + fecInicioVigenciaEsquema.set(Calendar.SECOND, 0); + fecInicioVigenciaEsquema.set(Calendar.MILLISECOND, 0); + fecInicioVigenciaEsquema.set(Calendar.MINUTE, 0); + fecInicioVigenciaEsquema.set(Calendar.HOUR_OF_DAY, 0); + + fecniciovigencia = fecInicioVigenciaEsquema.getTime(); + } + this.fecniciovigencia = fecniciovigencia; + } + + public Date getFecfinvigencia() { + return fecfinvigencia; + } + + public void setFecfinvigencia(Date fecfinvigencia) { + if (fecfinvigencia != null) { + GregorianCalendar fecFinVigenciaEsquema = new GregorianCalendar(); + + fecFinVigenciaEsquema.setTime(fecfinvigencia); + fecFinVigenciaEsquema.set(Calendar.SECOND, 0); + fecFinVigenciaEsquema.set(Calendar.MILLISECOND, 0); + fecFinVigenciaEsquema.set(Calendar.MINUTE, 0); + fecFinVigenciaEsquema.set(Calendar.HOUR_OF_DAY, 0); + + fecfinvigencia = fecFinVigenciaEsquema.getTime(); + } + this.fecfinvigencia = fecfinvigencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public List getEsquemaCorridaList() { + List esquemaList = new ArrayList(); + for (EsquemaCorrida ec : this.esquemaCorridaList) { + if (ec.getActivo() == Boolean.TRUE) { + esquemaList.add(ec); + } + } + return esquemaList; + } + + public void setEsquemaCorridaList(List esquemaCorridaList) { + this.esquemaCorridaList = esquemaCorridaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getEsquemaoperacionalId() != null ? getEsquemaoperacionalId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof EsquemaOperacional)) { + return false; + } + EsquemaOperacional other = (EsquemaOperacional) object; + if ((this.getEsquemaoperacionalId() == null && other.getEsquemaoperacionalId() != null) || (this.getEsquemaoperacionalId() != null && !this.getEsquemaoperacionalId().equals(other.getEsquemaoperacionalId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.test.EsquemaOperacional[esquemaoperacionalId=" + esquemaoperacionalId + "]"; + } + + @Override + public void clonar() throws CloneNotSupportedException { + esquemaOperacionalClone = new EsquemaOperacional(); + esquemaOperacionalClone = (EsquemaOperacional) this.clone(); + + } + + @Override + public EsquemaOperacional getCloneObject() throws CloneNotSupportedException { + return esquemaOperacionalClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getEsquemaoperacionalId()); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EsquemaTramo.java b/src/com/rjconsultores/ventaboletos/entidad/EsquemaTramo.java new file mode 100644 index 000000000..7d69ec1ae --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EsquemaTramo.java @@ -0,0 +1,231 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "ESQUEMA_TRAMO_SEQ", sequenceName = "ESQUEMA_TRAMO_SEQ", allocationSize = 1) +@Table(name = "ESQUEMA_TRAMO") +public class EsquemaTramo implements Serializable, Comparable, Auditavel { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "ESQUEMATRAMO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESQUEMA_TRAMO_SEQ") + private Integer esquematramoId; + + @Column(name = "NUMSECUENCIA") + private Short numsecuencia; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + + private Integer usuarioId; + @Column(name = "TIEMPOESTANCIA") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date tiempoEstancia; + + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + + @JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID") + @ManyToOne + @NaoAuditar + private EsquemaCorrida esquemaCorrida; + + @Column(name = "PLATAFORMA") + private String plataforma; + + @Column(name = "EXCEPCIONRECORRIDO") + private Date excepcionRecorrido; + + @Column(name = "TIPO_PASSAGEM") + private String tipoPassagem; + + @Transient + @NaoAuditar + private EsquemaTramo esquemaTramoClone; + + public Date getTiempoEstancia() { + return tiempoEstancia; + } + + public void setTiempoEstancia(Date tiempoEstancia) { + this.tiempoEstancia = tiempoEstancia; + } + + public EsquemaTramo() { + } + + public EsquemaTramo(Integer esquematramoId) { + this.esquematramoId = esquematramoId; + } + + public Integer getEsquematramoId() { + return esquematramoId; + } + + public void setEsquematramoId(Integer esquematramoId) { + this.esquematramoId = esquematramoId; + } + + public Short getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Short numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public EsquemaCorrida getEsquemaCorrida() { + return esquemaCorrida; + } + + public void setEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + this.esquemaCorrida = esquemaCorrida; + } + + public String getPlataforma() { + return plataforma; + } + + public void setPlataforma(String plataforma) { + this.plataforma = plataforma; + } + + public Date getExcepcionRecorrido() { + return excepcionRecorrido; + } + + public void setExcepcionRecorrido(Date excepcionRecorrido) { + this.excepcionRecorrido = excepcionRecorrido; + } + + public String getTipoPassagem() { + return tipoPassagem; + } + + public void setTipoPassagem(String tipoPassagem) { + this.tipoPassagem = tipoPassagem; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getEsquematramoId() != null ? getEsquematramoId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof EsquemaTramo)) { + return false; + } + EsquemaTramo other = (EsquemaTramo) object; + if ((this.getEsquematramoId() == null && other.getEsquematramoId() != null) || (this.getEsquematramoId() != null && !this.getEsquematramoId().equals(other.getEsquematramoId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.test.EsquemaTramo[esquematramoId=" + esquematramoId + "]"; + } + + @Override + public int compareTo(EsquemaTramo o) { + if (this.numsecuencia > o.getNumsecuencia()) { + return 1; + } else if (this.numsecuencia < o.getNumsecuencia()) { + return -1; + } + return 0; + } + + @Override + public void clonar() throws CloneNotSupportedException { + esquemaTramoClone = new EsquemaTramo(); + esquemaTramoClone = (EsquemaTramo) this.clone(); + Hibernate.initialize(esquemaTramoClone.getTramo()); + } + + @Override + public EsquemaTramo getCloneObject() throws CloneNotSupportedException { + return esquemaTramoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("EsquemaTramo - Sequencia [%s] - Origem [%s] - Destino [%s]", getNumsecuencia(), + getTramo() != null && getTramo().getOrigem() != null ? getTramo().getOrigem().getDescparada() : "", + getTramo() != null && getTramo().getDestino() != null ? getTramo().getDestino().getDescparada() : ""); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Estacion.java b/src/com/rjconsultores/ventaboletos/entidad/Estacion.java new file mode 100644 index 000000000..bc4aad81e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Estacion.java @@ -0,0 +1,456 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.Where; + +/** + * + * @author Administrador + */ +@Entity +@Table(name = "ESTACION") +@SequenceGenerator(name = "ESTACION_SEQ", sequenceName = "ESTACION_SEQ", allocationSize = 1) +public class Estacion implements Serializable { + + public final static String CONEXION_SANTANDER = "S"; + public final static String CONEXION_BANORTE = "B"; + public final static String CONEXION_SW_MANUAL = "M"; + public final static String CONEXION_SW_PINPAD = "E"; + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESTACION_SEQ") + @Column(name = "ESTACION_ID") + private Integer estacionId; + @Column(name = "NUMCAJA") + private Long numcaja; + @Column(name = "NUMPORTAPINPAD") + private Integer numPortaPinpad; + @Column(name = "INDLIBERCARD") + private Boolean utilizaCartaoLibercard; + @Column(name = "DESCESTACION") + private String descestacion; + @Column(name = "DESCMAC") + private String descmac; + @Column(name = "INDCONEXIONBANCARIA") + private String conexionBancaria; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "INDIMPRESIONPINPAD") + private Boolean pinPadImpresoraPropia; + @Column(name = "INDPAUSARIMPRESORA") + private Boolean pausarImpressora; + @Column(name = "INDTERMINALMULTIPLO") + private Boolean terminalMultiplo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + @OneToOne + @JoinColumn(name = "USUARIOBANCARIO_ID") + private UsuarioBancario usuarioBancario; + @Column(name = "NOMEIMPRESSORA") + private String nomeImpressora; + @Column(name = "NOMEARQUIVOLAYOUT") + private String nomeArquivoLayout; + @Column(name = "NOMEIMPRESSORARELATORIO") + private String nomeImpressoraRelatorio; + @Column(name = "NOMBIMPRESORASEGURO") + private String nombImpresoraSeguro; + @Column(name = "NOMBIMPRESORABPE") + private String nomeImpressoraBPe; + @Column(name = "INDSTOCKCENTRAL") + private Boolean indStockCentral; + @Column(name = "INDVOUCHER") + private Boolean indVoucher; + @Column(name = "TIPOIMPRESSORARELATORIO") + private Integer tipoImpressoraRelatorio; + @Column(name = "INDMAPAVIAGEMIMPTERMICA") + private Boolean indMapaViagemImpTermica; + @Column(name = "IMEI") + private String imei; + @Column(name = "INDEXIBEQRCODEPINPAD") + private Boolean indExibeQrcodePinpad; + + @OneToMany(mappedBy = "estacion", cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @Where(clause="activo=1") + private List estacionSitefList; + + @OneToMany(mappedBy = "estacion", cascade = CascadeType.ALL) + @Where(clause="activo=1") + private List estacionRioCardList; + + @OneToMany(mappedBy = "estacion", cascade = CascadeType.ALL) + @Where(clause="activo=1") + private List lsEstacionImpresora; + + @OneToMany(mappedBy = "estacion", cascade = CascadeType.ALL) + @Where(clause="activo=1") + private List abastoBoletoList; + + @OneToMany(mappedBy = "estacion", cascade = CascadeType.ALL) + @Where(clause="activo=1") + private List requisicionBoletoList; + + @OneToMany(mappedBy = "estacion", cascade = CascadeType.ALL) + @Where(clause="activo=1") + private List folioPreimpresoList; + + public Estacion() { + super(); + } + + public Estacion(Integer estacionId) { + this(); + this.estacionId = estacionId; + } + + public Estacion(Integer estacionId, String descestacion) { + this(); + this.estacionId = estacionId; + this.descestacion = descestacion; + } + + public Integer getEstacionId() { + return estacionId; + } + + public void setEstacionId(Integer estacionId) { + this.estacionId = estacionId; + } + + public Long getNumcaja() { + return numcaja; + } + + public void setNumcaja(Long numcaja) { + this.numcaja = numcaja; + } + + public String getDescestacion() { + return descestacion; + } + + public void setDescestacion(String descestacion) { + this.descestacion = descestacion; + } + + public String getDescmac() { + return descmac; + } + + public void setDescmac(String descmac) { + this.descmac = descmac; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public UsuarioBancario getUsuarioBancario() { + return usuarioBancario; + } + + public void setUsuarioBancario(UsuarioBancario usuarioBancario) { + this.usuarioBancario = usuarioBancario; + } + + public String getConexionBancaria() { + return conexionBancaria; + } + + public void setConexionBancaria(String conexionBancaria) { + this.conexionBancaria = conexionBancaria; + } + + public Boolean getPinPadImpresoraPropia() { + return pinPadImpresoraPropia; + } + + public void setPinPadImpresoraPropia(Boolean pinPadImpresoraPropia) { + this.pinPadImpresoraPropia = pinPadImpresoraPropia; + } + + public Boolean getPausarImpressora() { + return pausarImpressora; + } + + public void setPausarImpressora(Boolean pausarImpressora) { + this.pausarImpressora = pausarImpressora; + } + + public String getNomeImpressora() { + return nomeImpressora; + } + + public void setNomeImpressora(String nomeImpressora) { + this.nomeImpressora = nomeImpressora; + } + + public String getNomeArquivoLayout() { + return nomeArquivoLayout; + } + + public void setNomeArquivoLayout(String nomeArquivoLayout) { + this.nomeArquivoLayout = nomeArquivoLayout; + } + + public String getNomeImpressoraRelatorio() { + return nomeImpressoraRelatorio; + } + + public void setNomeImpressoraRelatorio(String nomeImpressoraRelatorio) { + this.nomeImpressoraRelatorio = nomeImpressoraRelatorio; + } + + public List getEstacionSitefList() { + List tmp = new ArrayList(); + + if (estacionSitefList != null) { + for (EstacionSitef es : estacionSitefList) { + if (es.getActivo()) { + tmp.add(es); + } + } + } + + return tmp; + } + + public void setEstacionSitefList(List estacionSitefList) { + this.estacionSitefList = estacionSitefList; + } + + public List getEstacionRioCardList() { + List tmp = new ArrayList(); + + if (estacionRioCardList != null) { + for (EstacionRioCard es : estacionRioCardList) { + if (es.getActivo()) { + tmp.add(es); + } + } + } + + return tmp; + } + + public void setEstacionRioCardList(List estacionRioCardList) { + this.estacionRioCardList = estacionRioCardList; + } + + public List getLsEstacionImpresora() { + List tmp = new ArrayList(); + + if (lsEstacionImpresora != null) { + for (EstacionImpresora es : lsEstacionImpresora) { + if (es.getActivo()) { + tmp.add(es); + } + } + } + + return tmp; + } + + public void setLsEstacionImpresora(List lsEstacionImpresora) { + this.lsEstacionImpresora = lsEstacionImpresora; + } + + public List getAbastoBoletoList() { + return abastoBoletoList; + } + + public void setAbastoBoletoList(List abastoBoletoList) { + this.abastoBoletoList = abastoBoletoList; + } + + public List getRequisicionBoletoList() { + return requisicionBoletoList; + } + + public void setRequisicionBoletoList(List requisicionBoletoList) { + this.requisicionBoletoList = requisicionBoletoList; + } + + public List getFolioPreimpresoList() { + return folioPreimpresoList; + } + + public void setFolioPreimpresoList(List folioPreimpresoList) { + this.folioPreimpresoList = folioPreimpresoList; + } + + public String getNombImpresoraSeguro() { + return nombImpresoraSeguro; + } + + public void setNombImpresoraSeguro(String nombImpresoraSeguro) { + this.nombImpresoraSeguro = nombImpresoraSeguro; + } + public Integer getNumPortaPinpad() { + return numPortaPinpad; + } + + public void setNumPortaPinpad(Integer numPortaPinpad) { + this.numPortaPinpad = numPortaPinpad; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (estacionId != null ? estacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Estacion)) { + return false; + } + Estacion other = (Estacion) object; + if ((this.estacionId == null && other.estacionId != null) || (this.estacionId != null && !this.estacionId.equals(other.estacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return (numcaja != null) ? String.format("%d - %s", numcaja, descestacion) : descestacion; + } + + /** + * @return the terminalMultiplo + */ + public Boolean getTerminalMultiplo() { + return terminalMultiplo; + } + + /** + * @param terminalMultiplo the terminalMultiplo to set + */ + public void setTerminalMultiplo(Boolean terminalMultiplo) { + this.terminalMultiplo = terminalMultiplo; + } + public Boolean getUtilizaCartaoLibercard() { + return utilizaCartaoLibercard; + } + + public void setUtilizaCartaoLibercard(Boolean utilizaCartaoLibercard) { + this.utilizaCartaoLibercard = utilizaCartaoLibercard; + } + + public Boolean getIndStockCentral() { + return indStockCentral; + } + + public void setIndStockCentral(Boolean indStockCentral) { + this.indStockCentral = indStockCentral; + } + + public String getNomeImpressoraBPe() { + return nomeImpressoraBPe; + } + + public void setNomeImpressoraBPe(String nomeImpressoraBPe) { + this.nomeImpressoraBPe = nomeImpressoraBPe; + } + + public Boolean getIndVoucher() { + return indVoucher; + } + + public void setIndVoucher(Boolean indVoucher) { + this.indVoucher = indVoucher; + } + + public Integer getTipoImpressoraRelatorio() { + return tipoImpressoraRelatorio; + } + + public void setTipoImpressoraRelatorio(Integer tipoImpressoraRelatorio) { + this.tipoImpressoraRelatorio = tipoImpressoraRelatorio; + } + + public Boolean getIndMapaViagemImpTermica() { + return indMapaViagemImpTermica; + } + + public void setIndMapaViagemImpTermica(Boolean indMapaViagemImpTermica) { + this.indMapaViagemImpTermica = indMapaViagemImpTermica; + } + + public String getImei() { + return imei; + } + + public void setImei(String imei) { + this.imei = imei; + } + + public Boolean getIndExibeQrcodePinpad() { + return indExibeQrcodePinpad; + } + + public void setIndExibeQrcodePinpad(Boolean indExibeQrcodePinpad) { + this.indExibeQrcodePinpad = indExibeQrcodePinpad; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EstacionImpresora.java b/src/com/rjconsultores/ventaboletos/entidad/EstacionImpresora.java new file mode 100644 index 000000000..346c556e4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EstacionImpresora.java @@ -0,0 +1,144 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ESTACION_IMPRESORA_SEQ", sequenceName = "ESTACION_IMPRESORA_SEQ", allocationSize = 1) +@Table(name = "ESTACION_IMPRESORA ") +public class EstacionImpresora implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESTACION_IMPRESORA_SEQ") + @Column(name = "ESTACIONIMPRESORA_ID") + private Integer estacionImpresoraId; + @ManyToOne + @JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID") + private Estacion estacion; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "NOMBIMPRESORA") + private String nombImpresora; + @Column(name = "NOMBARCHIVOLAYOUT") + private String nombArchivoLayout; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "TIPOIMPRESSORA") + private Integer tipoImpressora; + @ManyToOne + @JoinColumn(name = "ESTACIONCENTRAL_ID", referencedColumnName = "ESTACION_ID") + private Estacion estacionCentral; + @Column(name = "NOMBARCHIVOLAYOUTINTERNACIONAL") + private String nombArchivoLayoutIternacional; + + public Integer getEstacionImpresoraId() { + return estacionImpresoraId; + } + + public void setEstacionImpresoraId(Integer estacionImpresoraId) { + this.estacionImpresoraId = estacionImpresoraId; + } + + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public String getNombImpresora() { + return nombImpresora; + } + + public void setNombImpresora(String nombImpresora) { + this.nombImpresora = nombImpresora; + } + + public String getNombArchivoLayout() { + return nombArchivoLayout; + } + + public void setNombArchivoLayout(String nombArchivoLayout) { + this.nombArchivoLayout = nombArchivoLayout; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getTipoImpressora() { + return tipoImpressora; + } + + public void setTipoImpressora(Integer tipoImpressora) { + this.tipoImpressora = tipoImpressora; + } + + public Estacion getEstacionCentral() { + return estacionCentral; + } + + public void setEstacionCentral(Estacion estacionCentral) { + this.estacionCentral = estacionCentral; + } + + public String getNombArchivoLayoutIternacional() { + return nombArchivoLayoutIternacional; + } + + public void setNombArchivoLayoutIternacional(String nombArchivoLayoutIternacional) { + this.nombArchivoLayoutIternacional = nombArchivoLayoutIternacional; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EstacionRioCard.java b/src/com/rjconsultores/ventaboletos/entidad/EstacionRioCard.java new file mode 100644 index 000000000..d1b021524 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EstacionRioCard.java @@ -0,0 +1,143 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author RJ + */ +@Entity +@Table(name = "ESTACION_RIOCARD") +@SequenceGenerator(name = "ESTACION_RIOCARD_SEQ", sequenceName = "ESTACION_RIOCARD_SEQ", allocationSize = 1) +public class EstacionRioCard implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESTACION_RIOCARD_SEQ") + @Column(name = "ESTACIONRIOCARD_ID") + private Integer estacionRioCardId; + @Column(name = "OPERADORA") + private String operadora; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne + @JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID") + private Estacion estacion; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + public EstacionRioCard() { + } + + public EstacionRioCard(Integer estacionRioCardId) { + this.estacionRioCardId = estacionRioCardId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (estacionRioCardId != null ? estacionRioCardId.hashCode() : 0); + return hash; + } + + public Integer getEstacionRioCardId() { + return estacionRioCardId; + } + + public void setEstacionRioCardId(Integer estacionRioCardId) { + this.estacionRioCardId = estacionRioCardId; + } + + public String getOperadora() { + return operadora; + } + + public void setOperadora(String operadora) { + this.operadora = operadora; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof EstacionRioCard)) { + return false; + } + EstacionRioCard other = (EstacionRioCard) object; + if ((this.estacionRioCardId == null && other.estacionRioCardId != null) || (this.estacionRioCardId != null && !this.estacionRioCardId.equals(other.estacionRioCardId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.EstacionRiocard[ estacionRioCardId=" + estacionRioCardId + " ]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java b/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java new file mode 100644 index 000000000..b147dff77 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EstacionSitef.java @@ -0,0 +1,209 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.rjconsultores.ventaboletos.enums.TipoIntegracaoTEF; + +/** + * + * @author RJ + */ +@Entity +@Table(name = "ESTACION_SITEF") +@SequenceGenerator(name = "ESTACION_SITEF_SEQ", sequenceName = "ESTACION_SITEF_SEQ", allocationSize = 1) +public class EstacionSitef implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESTACION_SITEF_SEQ") + @Column(name = "ESTACIONSITEF_ID") + private Integer estacionsitefId; + @Column(name = "NUMEMPRESA") + private String numempresa; + @Column(name = "NUMFILIAL") + private Integer numfilial; + @Column(name = "NUMPDV") + private String numpdv; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne + @JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID") + private Estacion estacion; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "IPSERVIDOR") + private String ipServidor; + @Column(name = "SENHA_CONFIG") + private String senhaConfig; + + @Column(name = "TIPO_INTEGRACAO") + @Enumerated(EnumType.STRING) + private TipoIntegracaoTEF tipoIntegracao; + + @Column(name = "CNPJ") + private String cnpj; + + public EstacionSitef() { + } + + public EstacionSitef(Integer estacionsitefId) { + this.estacionsitefId = estacionsitefId; + } + + public Integer getEstacionsitefId() { + return estacionsitefId; + } + + public void setEstacionsitefId(Integer estacionsitefId) { + this.estacionsitefId = estacionsitefId; + } + + public String getNumempresa() { + return numempresa; + } + + public void setNumempresa(String numempresa) { + this.numempresa = numempresa; + } + + public Integer getNumfilial() { + return numfilial; + } + + public void setNumfilial(Integer numfilial) { + this.numfilial = numfilial; + } + + public String getNumpdv() { + return numpdv; + } + + public void setNumpdv(String numpdv) { + this.numpdv = numpdv; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (estacionsitefId != null ? estacionsitefId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof EstacionSitef)) { + return false; + } + EstacionSitef other = (EstacionSitef) object; + if ((this.estacionsitefId == null && other.estacionsitefId != null) || (this.estacionsitefId != null && !this.estacionsitefId.equals(other.estacionsitefId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.EstacionSitef[ estacionsitefId=" + estacionsitefId + " ]"; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + + public String getIpServidor() { + return ipServidor; + } + + public void setIpServidor(String ipServidor) { + this.ipServidor = ipServidor; + } + + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + public TipoIntegracaoTEF getTipoIntegracao() { + return tipoIntegracao; + } + + public void setTipoIntegracao(TipoIntegracaoTEF tipoIntegracao) { + this.tipoIntegracao = tipoIntegracao; + } + + public String getSenhaConfig() { + return senhaConfig; + } + + public void setSenhaConfig(String senhaConfig) { + this.senhaConfig = senhaConfig; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Estado.java b/src/com/rjconsultores/ventaboletos/entidad/Estado.java new file mode 100644 index 000000000..27fb88ea1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Estado.java @@ -0,0 +1,293 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "ESTADO_SEQ", sequenceName = "ESTADO_SEQ", allocationSize = 1) +@Table(name = "ESTADO") +public class Estado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ESTADO_SEQ") + @Basic(optional = false) + @Column(name = "ESTADO_ID") + private Integer estadoId; + @Column(name = "NOMBESTADO") + private String nombestado; + @Column(name = "CVEESTADO") + private String cveestado; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PAIS_ID", referencedColumnName = "PAIS_ID") + @ManyToOne + private Pais pais; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @OneToMany(mappedBy = "estado") + private List ciudadList; + @Column(name = "ICMS") + private BigDecimal icms; + @Column(name = "TIEMPOHORHUSO") + private Integer tiempoHorHuso; + @Column(name = "FECINICIOHORVERANO") + @Temporal(TemporalType.DATE) + private Date fecInicioHorVerano; + @Column(name = "FECFINOHORVERANO") + @Temporal(TemporalType.DATE) + private Date fecFinoHorVerano; + @Column(name = "TIEMPOHORVERANO") + private Integer tiempoHorVerano; + @OneToMany(mappedBy = "estado") + private List empresaImpostoList; + @Column(name = "DESCPROCON") + private String descProcon; + @Column(name = "DESCPROMOCIONAL1") + private String mensagemPromocional1; + @Column(name = "DESCPROMOCIONAL2") + private String mensagemPromocional2; + @Column(name = "DESCPROMOCIONAL3") + private String mensagemPromocional3; + + @Column(name = "CODESTABELECIMENTO") + private String codEstabelecimento; + + @Column(name = "CENTRORESULTADOSAG") + private String centroResultadosAG; + + @Column(name = "CODIBGE") + private Integer codibge; + + public Estado() { + } + + public Estado(Integer estadoId) { + this.estadoId = estadoId; + } + + public Integer getEstadoId() { + return estadoId; + } + + public void setEstadoId(Integer estadoId) { + this.estadoId = estadoId; + } + + public String getNombestado() { + return nombestado; + } + + public void setNombestado(String nombestado) { + this.nombestado = nombestado; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pais getPais() { + return pais; + } + + public void setPais(Pais pais) { + this.pais = pais; + } + + public List getCiudadList() { + return ciudadList; + } + + public void setCiudadList(List ciudadList) { + this.ciudadList = ciudadList; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public String getCveestado() { + return cveestado; + } + + public void setCveestado(String cveestado) { + this.cveestado = cveestado; + } + + public BigDecimal getIcms() { + return icms; + } + + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + + public Integer getTiempoHorHuso() { + return tiempoHorHuso; + } + + public void setTiempoHorHuso(Integer tiempoHorHuso) { + this.tiempoHorHuso = tiempoHorHuso; + } + + public Date getFecInicioHorVerano() { + return fecInicioHorVerano; + } + + public void setFecInicioHorVerano(Date fecInicioHorVerano) { + this.fecInicioHorVerano = fecInicioHorVerano; + } + + public Date getFecFinoHorVerano() { + return fecFinoHorVerano; + } + + public void setFecFinoHorVerano(Date fecFinoHorVerano) { + this.fecFinoHorVerano = fecFinoHorVerano; + } + + public Integer getTiempoHorVerano() { + return tiempoHorVerano; + } + + public void setTiempoHorVerano(Integer tiempoHorVerano) { + this.tiempoHorVerano = tiempoHorVerano; + } + + public String getDescProcon() { + return descProcon; + } + + public void setDescProcon(String descProcon) { + this.descProcon = descProcon; + } + + + + public String getCentroResultadosAG() { + return centroResultadosAG; + } + + public void setCentroResultadosAG(String centroResultadosAG) { + this.centroResultadosAG = centroResultadosAG; + } + + + + public String getMensagemPromocional1() { + return mensagemPromocional1; + } + + public void setMensagemPromocional1(String mensagemPromocional1) { + this.mensagemPromocional1 = mensagemPromocional1; + } + + public String getMensagemPromocional2() { + return mensagemPromocional2; + } + + public void setMensagemPromocional2(String mensagemPromocional2) { + this.mensagemPromocional2 = mensagemPromocional2; + } + + public String getMensagemPromocional3() { + return mensagemPromocional3; + } + + public void setMensagemPromocional3(String mensagemPromocional3) { + this.mensagemPromocional3 = mensagemPromocional3; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getEstadoId() != null ? getEstadoId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Estado)) { + return false; + } + Estado other = (Estado) object; + if ((this.getEstadoId() == null && other.getEstadoId() != null) || (this.getEstadoId() != null && !this.getEstadoId().equals(other.getEstadoId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getNombestado(); + } + + public String getCodEstabelecimento() { + return codEstabelecimento; + } + + public void setCodEstabelecimento(String codEstabelecimento) { + this.codEstabelecimento = codEstabelecimento; + } + + public Integer getCodibge() { + return codibge; + } + + public void setCodibge(Integer codibge) { + this.codibge = codibge; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/EventoExtra.java b/src/com/rjconsultores/ventaboletos/entidad/EventoExtra.java new file mode 100644 index 000000000..5e25cccf4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EventoExtra.java @@ -0,0 +1,249 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "EVENTO_EXTRA") +@SequenceGenerator(name = "EVENTO_EXTRA_SEQ", sequenceName = "EVENTO_EXTRA_SEQ", allocationSize = 1) +public class EventoExtra implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EVENTO_EXTRA_SEQ") + @Column(name = "EVENTOEXTRA_ID") + private Long eventoextraId; + @Column(name = "TIPOEVENTOEXTRA_ID") + private Integer tipoeventoextraId; + @Column(name = "FECHORINGRESO") + @Temporal(TemporalType.TIMESTAMP) + private Date fechoringreso; + @Column(name = "IMPINGRESO") + private BigDecimal impingreso; + @Column(name = "NUMDOCUMENTO") + private String numdocumento; + @Column(name = "IMPORTEIVA") + private BigDecimal importeiva; + @Column(name = "PUNTOVENTA_ID") + private Integer puntoventaId; + @Column(name = "FORMAPAGO_ID") + private Integer formapagoId; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "CANTBOLETOS") + private Short cantboletos; + @Column(name = "CORRIDA_ID") + private Integer corridaId; + @Column(name = "FECCORRIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date feccorrida; + @Column(name = "CONDUCTOR1_ID") + private Integer conductor1Id; + @Column(name = "EMPRESA_ID") + private Integer empresaId; + @Column(name = "CONDUCTOR2_ID") + private Integer conductor2Id; + @Column(name = "AUTOBUS") + private Integer autobus; + + public EventoExtra() { + } + + public EventoExtra(Long eventoextraId) { + this.eventoextraId = eventoextraId; + } + + public Long getEventoextraId() { + return eventoextraId; + } + + public void setEventoextraId(Long eventoextraId) { + this.eventoextraId = eventoextraId; + } + + public Integer getTipoeventoextraId() { + return tipoeventoextraId; + } + + public void setTipoeventoextraId(Integer tipoeventoextraId) { + this.tipoeventoextraId = tipoeventoextraId; + } + + public Date getFechoringreso() { + return fechoringreso; + } + + public void setFechoringreso(Date fechoringreso) { + this.fechoringreso = fechoringreso; + } + + public BigDecimal getImpingreso() { + return impingreso; + } + + public void setImpingreso(BigDecimal impingreso) { + this.impingreso = impingreso; + } + + public String getNumdocumento() { + return numdocumento; + } + + public void setNumdocumento(String numdocumento) { + this.numdocumento = numdocumento; + } + + public BigDecimal getImporteiva() { + return importeiva; + } + + public void setImporteiva(BigDecimal importeiva) { + this.importeiva = importeiva; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Short getCantboletos() { + return cantboletos; + } + + public void setCantboletos(Short cantboletos) { + this.cantboletos = cantboletos; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Date getFeccorrida() { + return feccorrida; + } + + public void setFeccorrida(Date feccorrida) { + this.feccorrida = feccorrida; + } + + public Integer getConductor1Id() { + return conductor1Id; + } + + public void setConductor1Id(Integer conductor1Id) { + this.conductor1Id = conductor1Id; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public Integer getConductor2Id() { + return conductor2Id; + } + + public void setConductor2Id(Integer conductor2Id) { + this.conductor2Id = conductor2Id; + } + + public Integer getAutobus() { + return autobus; + } + + public void setAutobus(Integer autobus) { + this.autobus = autobus; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (eventoextraId != null ? eventoextraId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof EventoExtra)) { + return false; + } + EventoExtra other = (EventoExtra) object; + if ((this.eventoextraId == null && other.eventoextraId != null) || (this.eventoextraId != null && !this.eventoextraId.equals(other.eventoextraId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.EventoExtra[eventoextraId=" + eventoextraId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeaje.java b/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeaje.java new file mode 100644 index 000000000..3e751e780 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeaje.java @@ -0,0 +1,118 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.Filter; +import org.hibernate.annotations.FilterDef; + +@Entity +@FilterDef(name="ativo") +@SequenceGenerator(name = "EXCEPCION_PEAJE_SEQ", sequenceName = "EXCEPCION_PEAJE_SEQ", allocationSize = 1) +@Table(name = "EXCEPCION_PEAJE") +public class ExcepcionPeaje implements Serializable,Comparable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @Column(name = "EXCEPCIONPEAJE_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EXCEPCION_PEAJE_SEQ") + private Integer excepcionPeajeId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID") + @OneToOne + private Ruta ruta; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origem; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + @OneToMany(mappedBy = "excepcionPeaje", cascade = CascadeType.ALL)//, fetch = FetchType.EAGER + @Filter(name="ativo", condition="ACTIVO = 1") + private List lsExcepcionPeajeVigencia = new ArrayList(); + + public Integer getExcepcionPeajeId() { + return excepcionPeajeId; + } + public void setExcepcionPeajeId(Integer excepcionPeajeId) { + this.excepcionPeajeId = excepcionPeajeId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Ruta getRuta() { + return ruta; + } + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + public Parada getOrigem() { + return origem; + } + public void setOrigem(Parada origem) { + this.origem = origem; + } + public Parada getDestino() { + return destino; + } + public void setDestino(Parada destino) { + this.destino = destino; + } + + public List getLsExcepcionPeajeVigencia() { + return lsExcepcionPeajeVigencia; + } + public void setLsExcepcionPeajeVigencia(List lsExcepcionPeajeVigencia) { + this.lsExcepcionPeajeVigencia = lsExcepcionPeajeVigencia; + } + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje[excepcionPeajeId=" + excepcionPeajeId + "]"; + } + @Override + public int compareTo(ExcepcionPeaje excepcionPeaje) { + return this.getExcepcionPeajeId().intValue() - excepcionPeaje.getExcepcionPeajeId().intValue(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeajeVigencia.java b/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeajeVigencia.java new file mode 100644 index 000000000..f6de59fa3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeajeVigencia.java @@ -0,0 +1,268 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "EXCEPCION_PEAJE_VIGENCIA_SEQ", sequenceName = "EXCEPCION_PEAJE_VIGENCIA_SEQ", allocationSize = 1) +@Table(name = "EXCEPCION_PEAJE_VIGENCIA") +public class ExcepcionPeajeVigencia implements Serializable ,Comparable { + +private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @Column(name = "EXCEPCIONPEAJEVIGENCIA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EXCEPCION_PEAJE_VIGENCIA_SEQ") + private Integer excepcionPeajeVigenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "EXCEPCIONPEAJE_ID" , referencedColumnName = "EXCEPCIONPEAJE_ID") + private ExcepcionPeaje excepcionPeaje; + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "CASETAPEAJE_ID" , referencedColumnName = "CASETAPEAJE_ID") + private CasetaPeaje casetaPeaje; + @Column(name = "FECHAVENTAINI") + @Temporal(TemporalType.TIMESTAMP) + private java.util.Date fecVentaIni; + @Column(name = "FECHAVENTAFIN") + @Temporal(TemporalType.TIMESTAMP) + private java.util.Date fecVentaFin; + @Column(name = "FECHORINICIO") + @Temporal(TemporalType.TIME) + private Date horaIni; + @Column(name = "FECHORFINAL") + @Temporal(TemporalType.TIME) + private Date horaFin; + @Column(name = "INDLUNES") + private Boolean INDLUNES; + @Column(name = "INDMARTES") + private Boolean INDMARTES; + @Column(name = "INDMIERCOLES") + private Boolean INDMIERCOLES; + @Column(name = "INDJUEVES") + private Boolean INDJUEVES; + @Column(name = "INDVIERNES") + private Boolean INDVIERNES; + @Column(name = "INDSABADO") + private Boolean INDSABADO; + @Column(name = "INDDOMINGO") + private Boolean INDDOMINGO; + @Column(name = "PRECIO") + private BigDecimal precio; + + public Integer getExcepcionPeajeVigenciaId() { + return excepcionPeajeVigenciaId; + } + + + public void setExcepcionPeajeVigenciaId(Integer excepcionPeajeVigenciaId) { + this.excepcionPeajeVigenciaId = excepcionPeajeVigenciaId; + } + + + public Boolean getActivo() { + return activo; + } + + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + + public Date getFecmodif() { + return fecmodif; + } + + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + + public Integer getUsuarioId() { + return usuarioId; + } + + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + public ExcepcionPeaje getExcepcionPeaje() { + return excepcionPeaje; + } + + + public void setExcepcionPeaje(ExcepcionPeaje excepcionPeaje) { + this.excepcionPeaje = excepcionPeaje; + } + + + public java.util.Date getFecVentaIni() { + return fecVentaIni; + } + + + public void setFecVentaIni(java.util.Date fecVentaIni) { + this.fecVentaIni = fecVentaIni; + } + + + public java.util.Date getFecVentaFin() { + return fecVentaFin; + } + + + public void setFecVentaFin(java.util.Date fecVentaFin) { + this.fecVentaFin = fecVentaFin; + } + + + public Date getHoraIni() { + return horaIni; + } + + + public void setHoraIni(Date horaIni) { + this.horaIni = horaIni; + } + + + public Date getHoraFin() { + return horaFin; + } + + + public void setHoraFin(Date horaFin) { + this.horaFin = horaFin; + } + + + public Boolean getINDLUNES() { + return INDLUNES; + } + + + public void setINDLUNES(Boolean iNDLUNES) { + INDLUNES = iNDLUNES; + } + + + public Boolean getINDMARTES() { + return INDMARTES; + } + + + public void setINDMARTES(Boolean iNDMARTES) { + INDMARTES = iNDMARTES; + } + + + public Boolean getINDMIERCOLES() { + return INDMIERCOLES; + } + + + public void setINDMIERCOLES(Boolean iNDMIERCOLES) { + INDMIERCOLES = iNDMIERCOLES; + } + + + public Boolean getINDJUEVES() { + return INDJUEVES; + } + + + public void setINDJUEVES(Boolean iNDJUEVES) { + INDJUEVES = iNDJUEVES; + } + + + public Boolean getINDVIERNES() { + return INDVIERNES; + } + + + public void setINDVIERNES(Boolean iNDVIERNES) { + INDVIERNES = iNDVIERNES; + } + + + public Boolean getINDSABADO() { + return INDSABADO; + } + + + public void setINDSABADO(Boolean iNDSABADO) { + INDSABADO = iNDSABADO; + } + + + public Boolean getINDDOMINGO() { + return INDDOMINGO; + } + + + public void setINDDOMINGO(Boolean iNDDOMINGO) { + INDDOMINGO = iNDDOMINGO; + } + + + public BigDecimal getPrecio() { + return precio; + } + + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + + public CasetaPeaje getCasetaPeaje() { + return casetaPeaje; + } + + + public void setCasetaPeaje(CasetaPeaje casetaPeaje) { + this.casetaPeaje = casetaPeaje; + } + + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ExcepcionPeajeVigencia[excepcionPeajeVigenciaId=" + excepcionPeajeVigenciaId + "]"; + } + + @Override + public int compareTo(ExcepcionPeajeVigencia excepcionPeajeVigencia) { + if(excepcionPeajeVigencia.getExcepcionPeajeVigenciaId() != null){ + return this.getExcepcionPeajeVigenciaId().intValue() - excepcionPeajeVigencia.getExcepcionPeajeVigenciaId().intValue(); + }else{ + return -1; + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ExcepcionRedondo.java b/src/com/rjconsultores/ventaboletos/entidad/ExcepcionRedondo.java new file mode 100644 index 000000000..68bb75d18 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ExcepcionRedondo.java @@ -0,0 +1,146 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "EXCEPCION_REDONDO_SEQ", sequenceName = "EXCEPCION_REDONDO_SEQ", allocationSize = 1) +@Table(name = "EXCEPCION_REDONDO") +public class ExcepcionRedondo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EXCEPCION_REDONDO_SEQ") + @Basic(optional = false) + @Column(name = "EXCEPCIONREDONDO_ID") + private Integer excepcionredondoId; + @Column(name = "INDTIPO") + private String indtipo; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origem; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + + public ExcepcionRedondo() { + } + + public ExcepcionRedondo(Integer excepcionredondoId) { + this.excepcionredondoId = excepcionredondoId; + } + + public ExcepcionRedondo(Integer excepcionredondoId, Boolean activo) { + this.excepcionredondoId = excepcionredondoId; + this.activo = activo; + } + + public Integer getExcepcionredondoId() { + return excepcionredondoId; + } + + public void setExcepcionredondoId(Integer excepcionredondoId) { + this.excepcionredondoId = excepcionredondoId; + } + + public String getIndtipo() { + return indtipo; + } + + public void setIndtipo(String indtipo) { + this.indtipo = indtipo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (excepcionredondoId != null ? excepcionredondoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ExcepcionRedondo)) { + return false; + } + ExcepcionRedondo other = (ExcepcionRedondo) object; + if ((this.excepcionredondoId == null && other.excepcionredondoId != null) || (this.excepcionredondoId != null && !this.excepcionredondoId.equals(other.excepcionredondoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ExcepcionRedondo[excepcionredondoId=" + excepcionredondoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FechamentoBoleto.java b/src/com/rjconsultores/ventaboletos/entidad/FechamentoBoleto.java new file mode 100644 index 000000000..48ab21c03 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FechamentoBoleto.java @@ -0,0 +1,208 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "FECHAMENTO_BOLETO") +public class FechamentoBoleto implements java.io.Serializable{ + + private static final long serialVersionUID = 1L; + + @SequenceGenerator(name = "FECHAMENTO_BOLETO_SEQ", sequenceName = "FECHAMENTO_BOLETO_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FECHAMENTO_BOLETO_SEQ") + @Column(name = "FECHAMENTOBOLETO_ID", unique = true, nullable = false, precision = 15, scale = 0) + private Long fechamentoboletoId; + + @JoinColumn(name = "FECHAMENTOCNTCORRENTE_ID", referencedColumnName="FECHAMENTOCNTCORRENTE_ID") + @ManyToOne + private FechamentoCntcorrente fechamentoCntcorrente; + + @Column(name = "NOSSONUMERO") + private String nossonumero; + + @Column(name = "FECDOCUMENTO", length = 7) + @Temporal(TemporalType.TIMESTAMP) + private Date fecdocumento; + + @Column(name = "FECVENCIMENTO", length = 7) + @Temporal(TemporalType.TIMESTAMP) + private Date fecvencimento; + + @Column(name = "VALORDOCUMENTO") + private BigDecimal valordocumento; + + @Column(name = "DESCONTOS") + private BigDecimal descontos; + + @Column(name = "DEDUCOES") + private BigDecimal deducoes; + + @Column(name = "MORA") + private BigDecimal mora; + + @Column(name = "ACRESCIMOS") + private BigDecimal acrescimos; + + @Column(name = "VALOR_COBRADO") + private BigDecimal valorCobrado; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "STATUS") + private String status; + + @Column(name = "REMESSA_ID") + private Long remessaId; + + @Column(name = "PORC_MULTA", precision = 5, scale = 2) + private BigDecimal porcentagemMulta; + + @Column(name = "PORC_MORA", precision = 5, scale = 2) + private BigDecimal porcentagemMora; + + + public Long getFechamentoboletoId() { + return fechamentoboletoId; + } + public void setFechamentoboletoId(Long fechamentoboletoId) { + this.fechamentoboletoId = fechamentoboletoId; + } + + public FechamentoCntcorrente getFechamentoCntcorrente() { + return fechamentoCntcorrente; + } + public void setFechamentoCntcorrente(FechamentoCntcorrente fechamentoCntcorrente) { + this.fechamentoCntcorrente = fechamentoCntcorrente; + } + + public String getNossonumero() { + return nossonumero; + } + public void setNossonumero(String nossonumero) { + this.nossonumero = nossonumero; + } + + public Date getFecdocumento() { + return fecdocumento; + } + public void setFecdocumento(Date fecdocumento) { + this.fecdocumento = fecdocumento; + } + + public Date getFecvencimento() { + return fecvencimento; + } + public void setFecvencimento(Date fecvencimento) { + this.fecvencimento = fecvencimento; + } + + public BigDecimal getValordocumento() { + return valordocumento; + } + public void setValordocumento(BigDecimal valordocumento) { + this.valordocumento = valordocumento; + } + + public BigDecimal getDescontos() { + return descontos; + } + public void setDescontos(BigDecimal descontos) { + this.descontos = descontos; + } + + public BigDecimal getDeducoes() { + return deducoes; + } + public void setDeducoes(BigDecimal deducoes) { + this.deducoes = deducoes; + } + + public BigDecimal getMora() { + return mora; + } + public void setMora(BigDecimal mora) { + this.mora = mora; + } + + public BigDecimal getAcrescimos() { + return acrescimos; + } + public void setAcrescimos(BigDecimal acrescimos) { + this.acrescimos = acrescimos; + } + + public BigDecimal getValorCobrado() { + return valorCobrado; + } + public void setValorCobrado(BigDecimal valorCobrado) { + this.valorCobrado = valorCobrado; + } + + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public Long getRemessaId() { + return remessaId; + } + public void setRemessaId(Long remessaId) { + this.remessaId = remessaId; + } + public BigDecimal getPorcentagemMulta() { + return porcentagemMulta; + } + public void setPorcentagemMulta(BigDecimal porcentagemMulta) { + this.porcentagemMulta = porcentagemMulta; + } + public BigDecimal getPorcentagemMora() { + return porcentagemMora; + } + public void setPorcentagemMora(BigDecimal porcentagemMora) { + this.porcentagemMora = porcentagemMora; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FechamentoCntcorrente.java b/src/com/rjconsultores/ventaboletos/entidad/FechamentoCntcorrente.java new file mode 100644 index 000000000..7a6de826f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FechamentoCntcorrente.java @@ -0,0 +1,181 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.rjconsultores.ventaboletos.enums.StatusIntegracaoSap; + +@Entity +@Table(name = "FECHAMENTO_CNTCORRENTE") +public class FechamentoCntcorrente { + + @SequenceGenerator(name = "FECHAMENTO_CNTCORRENTE_SEQ", sequenceName = "FECHAMENTO_CNTCORRENTE_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FECHAMENTO_CNTCORRENTE_SEQ") + @Column(name = "FECHAMENTOCNTCORRENTE_ID", unique = true, nullable = false, precision = 15, scale = 0) + private Long fechamentocntcorrenteId; + + @Column(name = "TOTAL") + private BigDecimal total; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECFECHAMENTO", length = 7) + private Date fecfechamento; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECINIFECHAMENTO", length = 7) + private Date fecinifechamento; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECFINFECHAMENTO", length = 7) + private Date fecfinfechamento; + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventa; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName="EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "INDCOMISSAO") + private Boolean indComissao; + + @Column(name = "INDEMAILENVIADO") + private Boolean indemailenviado; + + @Column(name = "INDINTEGRADOSAP") + @Enumerated(EnumType.ORDINAL) + private StatusIntegracaoSap integradoSap; + + public Long getFechamentocntcorrenteId() { + return fechamentocntcorrenteId; + } + + public void setFechamentocntcorrenteId(Long fechamentocntcorrenteId) { + this.fechamentocntcorrenteId = fechamentocntcorrenteId; + } + + public BigDecimal getTotal() { + return total; + } + + public void setTotal(BigDecimal total) { + this.total = total; + } + + public Date getFecfechamento() { + return fecfechamento; + } + + public void setFecfechamento(Date fecfechamento) { + this.fecfechamento = fecfechamento; + } + + public Date getFecinifechamento() { + return fecinifechamento; + } + + public void setFecinifechamento(Date fecinifechamento) { + this.fecinifechamento = fecinifechamento; + } + + public Date getFecfinfechamento() { + return fecfinfechamento; + } + + public void setFecfinfechamento(Date fecfinfechamento) { + this.fecfinfechamento = fecfinfechamento; + } + + public PuntoVenta getPuntoventa() { + return puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Boolean getIndComissao() { + return indComissao; + } + + public void setIndComissao(Boolean indComissao) { + this.indComissao = indComissao; + } + + public Boolean getIndemailenviado() { + return indemailenviado; + } + + public void setIndemailenviado(Boolean indemailenviado) { + this.indemailenviado = indemailenviado; + } + + public StatusIntegracaoSap getIntegradoSap() { + return integradoSap; + } + + public void setIntegradoSap(StatusIntegracaoSap integradoSap) { + this.integradoSap = integradoSap; + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamgeral.java b/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamgeral.java new file mode 100644 index 000000000..8f869e364 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamgeral.java @@ -0,0 +1,356 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "FECHAMENTO_PARAMGERAL") +public class FechamentoParamgeral implements java.io.Serializable { + + private static final long serialVersionUID = 1L; + + @SequenceGenerator(name = "FECHAMENTO_PARAMGERAL_SEQ", sequenceName = "FECHAMENTO_PARAMGERAL_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FECHAMENTO_PARAMGERAL_SEQ") + @Column(name = "FECHAMENTOPARAMGERAL_ID", unique = true, nullable = false, precision = 15, scale = 0) + private Long fechamentoparamgeralId; + + @JoinColumn(name = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @Column(name = "BOLETO_BANCO_COD", length = 4) + private String boletoBancoCod; + + @Column(name = "BOLETO_BANCO_AGENCIA", length = 10) + private String boletoBancoAgencia; + + @Column(name = "BOLETO_BANCO_AGENCIA_DIGITO", length = 10) + private String boletoBancoAgenciaDigito; + + @Column(name = "BOLETO_BANCO_CONTA", length = 10) + private String boletoBancoConta; + + @Column(name = "BOLETO_BANCO_CONTA_DIGITO", length = 1) + private String boletoBancoContaDigito; + + @Column(name = "BOLETO_BANCO_CARTEIRA", length = 3) + private String boletoBancoCarteira; + + @Column(name = "BOLETO_BANCO_CARTEIRA_VARIAVEL", length = 3) + private String boletoBancoCarteiraVariavel; + + @Column(name = "BOLETO_DIAS_VENC", length = 3) + private Integer boletoDiasVenc; + + @Column(name = "BOLETO_JUROS", precision = 5, scale = 2) + private BigDecimal boletoJuros; + + @Column(name = "BOLETO_MULTA", precision = 5, scale = 2) + private BigDecimal boletoMulta; + + @Column(name = "COD_EMP_BANCO", precision = 7, scale = 0) + private String codConvenio; + + @Column(name = "BOLETO_BANCO_INSTRUCAO", precision = 255) + private String boletoBancoInstrucao; + + @Column(name = "BOLETO_BANCO_INSTRUCAO2", precision = 255) + private String boletoBancoInstrucao2; + + @Column(name = "BOLETO_BANCO_INSTRUCAO3", precision = 255) + private String boletoBancoInstrucao3; + + @Column(name = "BOLETO_BANCO_INSTRUCAO_SACADO", precision = 255) + private String boletoBancoInstrucaoSacado; + + @Column(name = "COUNT_REMESSA", precision = 15, scale = 0) + private Long countRemessa; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + private Date fecmodif; + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + private Integer usuarioId; + + @Column(name = "ACTIVO", precision = 1, scale = 0) + private Boolean activo; + + public FechamentoParamgeral() { + super(); + } + + public FechamentoParamgeral(Empresa empresa, String boletoBancoCod, + String boletoBancoAgencia, String boletoBancoConta, + String boletoBancoContaDigito, String boletoBancoCarteira, + Integer boletoDiasVenc, Date fecmodif, Integer usuarioId, + Boolean activo) { + this(); + this.empresa = empresa; + this.boletoBancoCod = boletoBancoCod; + this.boletoBancoAgencia = boletoBancoAgencia; + this.boletoBancoConta = boletoBancoConta; + this.boletoBancoContaDigito = boletoBancoContaDigito; + this.boletoBancoCarteira = boletoBancoCarteira; + this.boletoDiasVenc = boletoDiasVenc; + + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.activo = activo; + } + + public FechamentoParamgeral(Long fechamentoparamgeralId, Empresa empresa, String boletoBancoCod, + String boletoBancoAgencia, String boletoBancoAgenciaDigito, String boletoBancoConta, + String boletoBancoContaDigito, String boletoBancoCarteira, String boletoBancoCarteiraVariavel, + Integer boletoDiasVenc, BigDecimal boletoJuros, BigDecimal boletoMulta, + String codConvenio, String boletoBancoInstrucao, String boletoBancoInstrucao2, + String boletoBancoInstrucao3, String boletoBancoInstrucaoSacado, Long countRemessa, + Date fecmodif, Integer usuarioId, Boolean activo) { + super(); + this.fechamentoparamgeralId = fechamentoparamgeralId; + this.empresa = empresa; + this.boletoBancoCod = boletoBancoCod; + this.boletoBancoAgencia = boletoBancoAgencia; + this.boletoBancoAgenciaDigito = boletoBancoAgenciaDigito; + this.boletoBancoConta = boletoBancoConta; + this.boletoBancoContaDigito = boletoBancoContaDigito; + this.boletoBancoCarteira = boletoBancoCarteira; + this.boletoBancoCarteiraVariavel = boletoBancoCarteiraVariavel; + this.boletoDiasVenc = boletoDiasVenc; + this.boletoJuros = boletoJuros; + this.boletoMulta = boletoMulta; + this.codConvenio = codConvenio; + this.boletoBancoInstrucao = boletoBancoInstrucao; + this.boletoBancoInstrucao2 = boletoBancoInstrucao2; + this.boletoBancoInstrucao3 = boletoBancoInstrucao3; + this.boletoBancoInstrucaoSacado = boletoBancoInstrucaoSacado; + this.countRemessa = countRemessa; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.activo = activo; + } + + public FechamentoParamgeral(Empresa empresa, String boletoBancoCod, + String boletoBancoAgencia, String boletoBancoConta, + String boletoBancoContaDigito, String boletoBancoCarteira, + Integer boletoDiasVenc, Integer usuarioId) { + this(); + this.empresa = empresa; + this.boletoBancoCod = boletoBancoCod; + this.boletoBancoAgencia = boletoBancoAgencia; + this.boletoBancoConta = boletoBancoConta; + this.boletoBancoContaDigito = boletoBancoContaDigito; + this.boletoBancoCarteira = boletoBancoCarteira; + this.boletoDiasVenc = boletoDiasVenc; + + this.fecmodif = new Date(); + this.usuarioId = usuarioId; + this.activo = true; + } + + public Long getFechamentoparamgeralId() { + return fechamentoparamgeralId; + } + + public void setFechamentoparamgeralId(Long fechamentoparamgeralId) { + this.fechamentoparamgeralId = fechamentoparamgeralId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public String getBoletoBancoCod() { + return boletoBancoCod; + } + + public void setBoletoBancoCod(String boletoBancoCod) { + this.boletoBancoCod = boletoBancoCod; + } + + public String getBoletoBancoAgencia() { + return boletoBancoAgencia; + } + + public void setBoletoBancoAgencia(String boletoBancoAgencia) { + this.boletoBancoAgencia = boletoBancoAgencia; + } + + public String getBoletoBancoAgenciaDigito() { + return boletoBancoAgenciaDigito; + } + + public void setBoletoBancoAgenciaDigito(String boletoBancoAgenciaDigito) { + this.boletoBancoAgenciaDigito = boletoBancoAgenciaDigito; + } + + public String getBoletoBancoConta() { + return boletoBancoConta; + } + + public void setBoletoBancoConta(String boletoBancoConta) { + this.boletoBancoConta = boletoBancoConta; + } + + public String getBoletoBancoContaDigito() { + return boletoBancoContaDigito; + } + + public void setBoletoBancoContaDigito(String boletoBancoContaDigito) { + this.boletoBancoContaDigito = boletoBancoContaDigito; + } + + public String getBoletoBancoCarteira() { + return boletoBancoCarteira; + } + + public void setBoletoBancoCarteira(String boletoBancoCarteira) { + this.boletoBancoCarteira = boletoBancoCarteira; + } + + public String getBoletoBancoCarteiraVariavel() { + return boletoBancoCarteiraVariavel; + } + + public void setBoletoBancoCarteiraVariavel(String boletoBancoCarteiraVariavel) { + this.boletoBancoCarteiraVariavel = boletoBancoCarteiraVariavel; + } + + public Integer getBoletoDiasVenc() { + return boletoDiasVenc; + } + + public void setBoletoDiasVenc(Integer boletoDiasVenc) { + this.boletoDiasVenc = boletoDiasVenc; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getCodConvenio() { + return codConvenio; + } + + public void setCodConvenio(String codConvenio) { + this.codConvenio = codConvenio; + } + + public String getBoletoBancoInstrucao() { + return boletoBancoInstrucao; + } + + public void setBoletoBancoInstrucao(String boletoBancoInstrucao) { + this.boletoBancoInstrucao = boletoBancoInstrucao; + } + + public String getBoletoBancoInstrucao2() { + return boletoBancoInstrucao2; + } + + public void setBoletoBancoInstrucao2(String boletoBancoInstrucao2) { + this.boletoBancoInstrucao2 = boletoBancoInstrucao2; + } + + public String getBoletoBancoInstrucao3() { + return boletoBancoInstrucao3; + } + + public void setBoletoBancoInstrucao3(String boletoBancoInstrucao3) { + this.boletoBancoInstrucao3 = boletoBancoInstrucao3; + } + + public String getBoletoBancoInstrucaoSacado() { + return boletoBancoInstrucaoSacado; + } + + public void setBoletoBancoInstrucaoSacado(String boletoBancoInstrucaoSacado) { + this.boletoBancoInstrucaoSacado = boletoBancoInstrucaoSacado; + } + + public Long getCountRemessa() { + return countRemessa; + } + + public void setCountRemessa(Long countRemessa) { + this.countRemessa = countRemessa; + } + + public BigDecimal getBoletoJuros() { + return boletoJuros; + } + + public void setBoletoJuros(BigDecimal boletoJuros) { + this.boletoJuros = boletoJuros; + } + + public BigDecimal getBoletoMulta() { + return boletoMulta; + } + + public void setBoletoMulta(BigDecimal boletoMulta) { + this.boletoMulta = boletoMulta; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((fechamentoparamgeralId == null) ? 0 : fechamentoparamgeralId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof FechamentoParamgeral)) + return false; + FechamentoParamgeral other = (FechamentoParamgeral) obj; + if (fechamentoparamgeralId == null) { + if (other.fechamentoparamgeralId != null) + return false; + } else if (!fechamentoparamgeralId.equals(other.fechamentoparamgeralId)) + return false; + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java b/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java new file mode 100644 index 000000000..870c54e12 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java @@ -0,0 +1,152 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "FECHAMENTO_PARAMPTOVTA") +public class FechamentoParamptovta implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long fechamentoparamptovtaId; + private PuntoVenta puntoventa; + private Empresa empresa; + private Integer intervalofechamento; + private Date fecmodif; + private Integer usuarioId; + private Boolean activo; + private Integer diasemtransito; + private String tipopagamento; + + public FechamentoParamptovta() { + } + + public FechamentoParamptovta( PuntoVenta puntoventa, Empresa empresa, Integer usuarioId) { + this.puntoventa = puntoventa; + this.empresa = empresa; + + this.fecmodif = new Date(); + this.usuarioId = usuarioId; + this.activo = true; + } + + public FechamentoParamptovta( + PuntoVenta puntoventa, Empresa empresa, Integer intervalofechamento, + Date fecmodif, Integer usuarioId, Boolean activo) { + this.puntoventa = puntoventa; + this.empresa = empresa; + this.intervalofechamento = intervalofechamento; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.activo = activo; + } + + + @SequenceGenerator(name = "FECHAMENTO_PARAMPTOVTA_SEQ", sequenceName = "FECHAMENTO_PARAMPTOVTA_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FECHAMENTO_PARAMPTOVTA_SEQ") + @Column(name = "FECHAMENTOPARAMPTOVTA_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getFechamentoparamptovtaId() { + return this.fechamentoparamptovtaId; + } + + public void setFechamentoparamptovtaId(Long fechamentoparamptovtaId) { + this.fechamentoparamptovtaId = fechamentoparamptovtaId; + } + + public void setIntervalofechamento(Integer intervalofechamento) { + this.intervalofechamento = intervalofechamento; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoventa() { + return puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + @JoinColumn(name = "EMPRESA_ID") + @ManyToOne + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Column(name = "INTERVALOFECHAMENTO", length = 2) + public Integer getIntervalofechamento() { + return intervalofechamento; + } + + @Column(name = "DIASEMTRANSITO", length = 2) + public Integer getDiasemtransito() { + return diasemtransito; + } + + public void setDiasemtransito(Integer diasemtransito) { + this.diasemtransito = diasemtransito; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("FechamentoParamptovta [fechamentoparamptovtaId=").append(fechamentoparamptovtaId).append(", puntoventa=").append(puntoventa).append(", empresa=").append(empresa).append(", intervalofechamento=").append(intervalofechamento).append(", fecmodif=").append(fecmodif).append(", usuarioId=").append(usuarioId).append(", activo=").append(activo).append(", diasemtransito=").append(diasemtransito).append("]"); + return builder.toString(); + } + + @Column(name = "TIPOPAGAMENTO", length = 1) + public String getTipopagamento() { + return tipopagamento; + } + + public void setTipopagamento(String tipopagamento) { + this.tipopagamento = tipopagamento; + } + + + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Feriado.java b/src/com/rjconsultores/ventaboletos/entidad/Feriado.java new file mode 100644 index 000000000..191f9465b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Feriado.java @@ -0,0 +1,158 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "FERIADO_SEQ", sequenceName = "FERIADO_SEQ", allocationSize = 1) +@Table(name = "FERIADO") +public class Feriado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "FERIADO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FERIADO_SEQ") + private Integer feriadoId; + @Column(name = "FECFERIADO") + @Temporal(TemporalType.DATE) + private Date fecferiado; + @Column(name = "DESCFERIADO") + private String descferiado; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "ESTADO_ID") + private Estado estado; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + public Feriado(Integer feriadoId, Date fecferiado, String descferiado) { + super(); + this.feriadoId = feriadoId; + this.fecferiado = fecferiado; + this.descferiado = descferiado; + } + + public Feriado() { + } + + public Feriado(Integer feriadoId) { + this.feriadoId = feriadoId; + } + + public Integer getFeriadoId() { + return feriadoId; + } + + public void setFeriadoId(Integer feriadoId) { + this.feriadoId = feriadoId; + } + + public Date getFecferiado() { + return fecferiado; + } + + public void setFecferiado(Date fecferiado) { + this.fecferiado = fecferiado; + } + + public String getDescferiado() { + return descferiado; + } + + public void setDescferiado(String descferiado) { + this.descferiado = descferiado; + } + + public Date getFecmodif() { + return fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (feriadoId != null ? feriadoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Feriado)) { + return false; + } + Feriado other = (Feriado) object; + if ((this.feriadoId == null && other.feriadoId != null) || (this.feriadoId != null && !this.feriadoId.equals(other.feriadoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.descferiado; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FiscalAliquotaEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/FiscalAliquotaEmpresa.java new file mode 100644 index 000000000..fdacd2443 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FiscalAliquotaEmpresa.java @@ -0,0 +1,126 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "FISCAL_ALIQUOTA_EMP_SEQ", sequenceName = "FISCAL_ALIQUOTA_EMP_SEQ", allocationSize = 1) +@Table(name = "FISCAL_ALIQUOTA_EMPRESA") +public class FiscalAliquotaEmpresa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FISCAL_ALIQUOTA_EMP_SEQ") + @Column(name = "FISCALALIQUOTAEMPRESA_ID") + private Integer fiscalAliquotaEmpresaId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @Column(name = "TOTALIZADOR") + private Integer totalizador; + @Column(name = "ICMS") + private BigDecimal icms; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getFiscalAliquotaEmpresaId() { + return fiscalAliquotaEmpresaId; + } + + public void setFiscalAliquotaEmpresaId(Integer fiscalAliquotaEmpresaId) { + this.fiscalAliquotaEmpresaId = fiscalAliquotaEmpresaId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Integer getTotalizador() { + return totalizador; + } + + public void setTotalizador(Integer totalizador) { + this.totalizador = totalizador; + } + + public BigDecimal getIcms() { + return icms; + } + + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return fiscalAliquotaEmpresaId.toString(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (fiscalAliquotaEmpresaId != null ? fiscalAliquotaEmpresaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof FiscalAliquotaEmpresa)) { + return false; + } + FiscalAliquotaEmpresa other = (FiscalAliquotaEmpresa) object; + if ((this.fiscalAliquotaEmpresaId == null && other.fiscalAliquotaEmpresaId != null) || (this.fiscalAliquotaEmpresaId != null && !this.fiscalAliquotaEmpresaId.equals(other.fiscalAliquotaEmpresaId))) { + return false; + } + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FiscalFormapagoEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/FiscalFormapagoEmpresa.java new file mode 100644 index 000000000..837e8698c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FiscalFormapagoEmpresa.java @@ -0,0 +1,134 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "FISCAL_FORMAPAGO_EMP_SEQ", sequenceName = "FISCAL_FORMAPAGO_EMP_SEQ", allocationSize = 1) +@Table(name = "FISCAL_FORMAPAGO_EMPRESA") +public class FiscalFormapagoEmpresa { + + @Id + @Basic(optional = false) + @Column(name = "FISCALFORMAPAGOEMPRESA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FISCAL_FORMAPAGO_EMP_SEQ") + private Long fiscalformapagoempresaId; + @Column(name = "TIPOFORMAPAGO") + private String tipoformapago; + @Column(name = "DESCRICAO") + private String descricao; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToOne + @JoinColumn(name = "FORMAPAGO_ID") + private FormaPago formaPago; + @Column(name = "INDVINCULADO") + private Boolean indVinculado; + + + public String getDescricao() { + return descricao; + } + public void setDescricao(String descricao) { + this.descricao = descricao; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public FormaPago getFormaPago() { + return formaPago; + } + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + public Long getFiscalformapagoempresaId() { + return fiscalformapagoempresaId; + } + public void setFiscalformapagoempresaId(Long fiscalformapagoempresaId) { + this.fiscalformapagoempresaId = fiscalformapagoempresaId; + } + public String getTipoformapago() { + return tipoformapago; + } + public void setTipoformapago(String tipoformapago) { + this.tipoformapago = tipoformapago; + } + + public Boolean getIndVinculado() { + return indVinculado; + } + public void setIndVinculado(Boolean indVinculado) { + this.indVinculado = indVinculado; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((empresa == null) ? 0 : empresa.hashCode()); + result = prime * result + ((tipoformapago == null) ? 0 : tipoformapago.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + FiscalFormapagoEmpresa other = (FiscalFormapagoEmpresa) obj; + if (empresa == null) { + if (other.empresa != null) + return false; + } else if (!empresa.equals(other.empresa)) + return false; + if (tipoformapago == null) { + if (other.tipoformapago != null) + return false; + } else if (!tipoformapago.equals(other.tipoformapago)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FiscalImpressora.java b/src/com/rjconsultores/ventaboletos/entidad/FiscalImpressora.java new file mode 100644 index 000000000..f43d25f99 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FiscalImpressora.java @@ -0,0 +1,228 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "FISCAL_IMPRESSORA") +public class FiscalImpressora implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @Column(name = "FISCALIMPRESSORA_ID") + private Integer fiscalimpressoraId; + + @Column(name = "MARCA") + private String marca; + + @Column(name = "MODELO") + private String modelo; + + @Column(name = "VERSIONSB") + private String versionsb; + + @Column(name = "CNIEE") + private String cniee; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "NUMSERIE20") + private String numserie20; + + @Column(name = "NUMEROIDENTIFICACAO") + private String numeroIdentificacao; + + @JoinColumn(name = "ESTADOLOCAL_ID", referencedColumnName = "ESTADO_ID") + @ManyToOne + private Estado estado; + + @JoinColumn(name = "ESTADOLACRE_ID", referencedColumnName = "ESTADO_ID") + @ManyToOne + private Estado estadoLacre; + + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "INDBLOQUEAECF") + private Boolean indBloqueaECF; + + @Column(name = "INDVALIDAESTADO") + private Boolean indValidaEstado; + + public FiscalImpressora() { + super(); + } + + public FiscalImpressora(Integer fiscalimpressoraId) { + this(); + setFiscalimpressoraId(fiscalimpressoraId); + } + + public Integer getFiscalimpressoraId() { + return fiscalimpressoraId; + } + + public void setFiscalimpressoraId(Integer fiscalimpressoraId) { + this.fiscalimpressoraId = fiscalimpressoraId; + } + + public String getMarca() { + return marca; + } + + public void setMarca(String marca) { + this.marca = marca; + } + + public String getModelo() { + return modelo; + } + + public void setModelo(String modelo) { + this.modelo = modelo; + } + + public String getVersionsb() { + return versionsb; + } + + public void setVersionsb(String versionsb) { + this.versionsb = versionsb; + } + + public String getCniee() { + return cniee; + } + + public void setCniee(String cniee) { + this.cniee = cniee; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((fiscalimpressoraId == null) ? 0 : fiscalimpressoraId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof FiscalImpressora)) + return false; + FiscalImpressora other = (FiscalImpressora) obj; + if (fiscalimpressoraId == null) { + if (other.fiscalimpressoraId != null) + return false; + } else if (!fiscalimpressoraId.equals(other.fiscalimpressoraId)) + return false; + return true; + } + + public String getNumserie20() { + return numserie20; + } + + public void setNumserie20(String numserie20) { + this.numserie20 = numserie20; + } + + public String getNumeroIdentificacao() { + return numeroIdentificacao; + } + + public void setNumeroIdentificacao(String numeroIdentificacao) { + this.numeroIdentificacao = numeroIdentificacao; + } + + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + public Estado getEstadoLacre() { + return estadoLacre; + } + + public void setEstadoLacre(Estado estadoLacre) { + this.estadoLacre = estadoLacre; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getIndBloqueaECF() { + return indBloqueaECF; + } + + public void setIndBloqueaECF(Boolean indBloqueaECF) { + this.indBloqueaECF = indBloqueaECF; + } + + public Boolean getIndValidaEstado() { + return indValidaEstado; + } + + public void setIndValidaEstado(Boolean indValidaEstado) { + this.indValidaEstado = indValidaEstado; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FiscalImpressoraEstado.java b/src/com/rjconsultores/ventaboletos/entidad/FiscalImpressoraEstado.java new file mode 100644 index 000000000..938a8aeac --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FiscalImpressoraEstado.java @@ -0,0 +1,129 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "FISCAL_IMPRESSORA_ESTADO_SEQ", sequenceName = "FISCAL_IMPRESSORA_ESTADO_SEQ", allocationSize = 1) +@Table(name = "FISCAL_IMPRESSORA_ESTADO") +public class FiscalImpressoraEstado implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FISCAL_IMPRESSORA_ESTADO_SEQ") + @Column(name = "FISCALIMPESTADO_ID") + private Integer fiscalImpressoraEstadoId; + + @JoinColumn(name = "FISCALIMPRESSORA_ID", referencedColumnName = "FISCALIMPRESSORA_ID") + @ManyToOne + private FiscalImpressora fiscalImpressora; + + @JoinColumn(name = "ESTADO_ID", referencedColumnName = "ESTADO_ID") + @ManyToOne + private Estado estado; + + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public FiscalImpressoraEstado() { + super(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (fiscalImpressoraEstadoId != null ? fiscalImpressoraEstadoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof FiscalImpressoraEstado)) { + return false; + } + FiscalImpressoraEstado other = (FiscalImpressoraEstado) object; + if ((this.getFiscalImpressoraEstadoId() == null && other.getFiscalImpressoraEstadoId() != null) || (this.getFiscalImpressoraEstadoId() != null && !this.getFiscalImpressoraEstadoId().equals(other.getFiscalImpressoraEstadoId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getEstado().getNombestado(); + } + + public Integer getFiscalImpressoraEstadoId() { + return fiscalImpressoraEstadoId; + } + + public void setFiscalImpressoraEstadoId(Integer fiscalImpressoraEstadoId) { + this.fiscalImpressoraEstadoId = fiscalImpressoraEstadoId; + } + + public FiscalImpressora getFiscalImpressora() { + return fiscalImpressora; + } + + public void setFiscalImpressora(FiscalImpressora fiscalImpressora) { + this.fiscalImpressora = fiscalImpressora; + } + + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FiscalRelgerencialEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/FiscalRelgerencialEmpresa.java new file mode 100644 index 000000000..6aabc3dfe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FiscalRelgerencialEmpresa.java @@ -0,0 +1,114 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +@Entity +@SequenceGenerator(name = "FISCAL_RELGERENCIAL_EMP_SEQ", sequenceName = "FISCAL_RELGERENCIAL_EMP_SEQ", allocationSize = 1) +@Table(name = "FISCAL_RELGERENCIAL_EMPRESA") +public class FiscalRelgerencialEmpresa { + + @Id + @Basic(optional = false) + @Column(name = "FISCALRELGERENCIAL_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FISCAL_RELGERENCIAL_EMP_SEQ") + private Long fiscalrelgerencialId; + @Column(name = "TIPORELGERENCIAL") + private String tiporelgerencial; + @Column(name = "DESCRICAO") + private String descricao; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getFiscalrelgerencialId() { + return fiscalrelgerencialId; + } + public void setFiscalrelgerencialId(Long relgerencialId) { + this.fiscalrelgerencialId = relgerencialId; + } + public String getTiporelgerencial() { + return tiporelgerencial; + } + public void setTiporelgerencial(String tiporelgerencial) { + this.tiporelgerencial = tiporelgerencial; + } + public String getDescricao() { + return descricao; + } + public void setDescricao(String descricao) { + this.descricao = descricao; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((empresa == null) ? 0 : empresa.hashCode()); + result = prime * result + ((tiporelgerencial == null) ? 0 : tiporelgerencial.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + FiscalRelgerencialEmpresa other = (FiscalRelgerencialEmpresa) obj; + if (empresa == null) { + if (other.empresa != null) + return false; + } else if (!empresa.equals(other.empresa)) + return false; + if (tiporelgerencial == null) { + if (other.tiporelgerencial != null) + return false; + } else if (!tiporelgerencial.equals(other.tiporelgerencial)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FiscalTotnaofiscalEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/FiscalTotnaofiscalEmpresa.java new file mode 100644 index 000000000..762b4dbd2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FiscalTotnaofiscalEmpresa.java @@ -0,0 +1,125 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +@Entity +@SequenceGenerator(name = "FISCAL_TOTNAOFISCAL_EMP_SEQ", sequenceName = "FISCAL_TOTNAOFISCAL_EMP_SEQ", allocationSize = 1) +@Table(name = "FISCAL_TOTNAOFISCAL_EMPRESA") +public class FiscalTotnaofiscalEmpresa { + + @Id + @Basic(optional = false) + @Column(name = "FISCALTOTNAOFISCAL_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FISCAL_TOTNAOFISCAL_EMP_SEQ") + private Long fiscaltotnaofiscalId; + @Column(name = "TIPOTOTALIZADOR") + private String tipototalizador; + @Column(name = "DESCRICAO") + private String descricao; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne + @JoinColumn(name = "TIPOEVENTOEXTRA_ID") + private TipoEventoExtra tipoeventoextra; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + + public String getTipototalizador() { + return tipototalizador; + } + public void setTipototalizador(String tipototalizador) { + this.tipototalizador = tipototalizador; + } + public String getDescricao() { + return descricao; + } + public void setDescricao(String descricao) { + this.descricao = descricao; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public TipoEventoExtra getTipoeventoextra() { + return tipoeventoextra; + } + public void setTipoeventoextra(TipoEventoExtra tipoeventoextra) { + this.tipoeventoextra = tipoeventoextra; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Long getFiscaltotnaofiscalId() { + return fiscaltotnaofiscalId; + } + public void setFiscaltotnaofiscalId(Long fiscaltotnaofiscalId) { + this.fiscaltotnaofiscalId = fiscaltotnaofiscalId; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((empresa == null) ? 0 : empresa.hashCode()); + result = prime * result + ((tipototalizador == null) ? 0 : tipototalizador.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + FiscalTotnaofiscalEmpresa other = (FiscalTotnaofiscalEmpresa) obj; + if (empresa == null) { + if (other.empresa != null) + return false; + } else if (!empresa.equals(other.empresa)) + return false; + if (tipototalizador == null) { + if (other.tipototalizador != null) + return false; + } else if (!tipototalizador.equals(other.tipototalizador)) + return false; + return true; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FolioPreimpreso.java b/src/com/rjconsultores/ventaboletos/entidad/FolioPreimpreso.java new file mode 100644 index 000000000..ee836f9b3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FolioPreimpreso.java @@ -0,0 +1,181 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.Parameter; + +@Entity +@SequenceGenerator(name = "FOLIO_PREIMPRESO_SEQ", sequenceName = "FOLIO_PREIMPRESO_SEQ", allocationSize = 1) +@Table(name = "FOLIO_PREIMPRESO") +public class FolioPreimpreso implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GenericGenerator(name = "FOLIO_PREIMPRESO_SEQ", strategy = "com.rjconsultores.ventaboletos.entidad.CustomIdGenerator" , + parameters = { + @Parameter(name="tamanho", value="8"), + @Parameter(name="seqName", value="FOLIO_PREIMPRESO_SEQ") + } ) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FOLIO_PREIMPRESO_SEQ") + @Column(name = "FOLIOPREIMPRESO_ID") + private Integer foliopreimpresoId; + @Column(name = "NUMESERIE") + private String numeserie; + @Column(name = "FOLIOPREIMPRESO") + private String foliopreimpreso; + @Column(name = "INDREPLICA") + private Long indreplica; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "NODO_ID") + private Integer nodoId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID") + @ManyToOne + private Estacion estacion; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + public Integer getFoliopreimpresoId() { + return foliopreimpresoId; + } + + public void setFoliopreimpresoId(Integer foliopreimpresoId) { + this.foliopreimpresoId = foliopreimpresoId; + } + + public String getNumeserie() { + return numeserie; + } + + public void setNumeserie(String numeserie) { + this.numeserie = numeserie; + } + + public String getFoliopreimpreso() { + return foliopreimpreso; + } + + public void setFoliopreimpreso(String foliopreimpreso) { + this.foliopreimpreso = foliopreimpreso; + } + + public Long getIndreplica() { + return indreplica; + } + + public void setIndreplica(Long indreplica) { + this.indreplica = indreplica; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getNodoId() { + return nodoId; + } + + public void setNodoId(Integer nodoId) { + this.nodoId = nodoId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((foliopreimpresoId == null) ? 0 : foliopreimpresoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + FolioPreimpreso other = (FolioPreimpreso) obj; + if (foliopreimpresoId == null) { + if (other.foliopreimpresoId != null) + return false; + } else if (!foliopreimpresoId.equals(other.foliopreimpresoId)) + return false; + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.FolioPreimpreso [foliopreimpresoId=" + foliopreimpresoId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java b/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java new file mode 100644 index 000000000..32ef4d739 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java @@ -0,0 +1,315 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.GenericGenerator; + +import com.rjconsultores.ventaboletos.enums.TipoCarteiraDigital; +import com.rjconsultores.ventaboletos.enums.TipoFormapago; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "FORMA_PAGO_SEQ", sequenceName = "FORMA_PAGO_SEQ", allocationSize = 1) +@Table(name = "FORMA_PAGO") +public class FormaPago implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GenericGenerator(name = "FOR_PAG_GEN_ID", strategy = "com.rjconsultores.ventaboletos.dao.util.FormaPagoGenerator") + @GeneratedValue(generator = "FOR_PAG_GEN_ID") + @Column(name = "FORMAPAGO_ID") + private Short formapagoId; + @Column(name = "DESCPAGO") + private String descpago; + @Column(name = "INDOPERACION") + private Short indoperacion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "CVEPAGO") + private String cvePago; + @Column(name = "IMPFISCAL") + private Boolean impfiscal; + @OneToMany(mappedBy = "formaPago") + private List configRestriccionPagoList; + @OneToMany(mappedBy = "formaPago") + private List pricingFormapagoList; + @Column(name = "INDCONFERENCIAFISICACOMISSAO") + private Boolean indconferenciafisicacomissao; + @Column(name = "TIPO_PAGO") + @Enumerated(EnumType.ORDINAL) + private TipoFormapago tipoFormapago; + @Column(name = "CVESISTEMA") + private String cveSistema; + @Column(name = "INDRESTRICAOFORMAPAGO") + private String indRestricaoFormaPago; + + @Column(name = "INDESTORNO") + private Boolean indProcessoEstorno; + + @Column(name = "INDVOUCHERRODOVIARIA") + private Boolean indVoucherRodoviaria; + @Column(name = "INDTRANSFERENCIAREATIVACAO") + private Boolean indTransferenciaReativacao; + + @Column(name = "TIPO_CARTEIRA_DIGITAL") + @Enumerated(EnumType.STRING) + private TipoCarteiraDigital tipoCarteiraDigital; + + @Column(name = "TIPOEVENTOEXTRA_ID") + private Long tipoEventoExtraId; + + public FormaPago() { + super(); + } + + public FormaPago(Short formapagoId) { + this(); + this.formapagoId = formapagoId; + } + + public FormaPago(Short formapagoId, String descpago) { + this(); + this.formapagoId = formapagoId; + this.descpago = descpago; + } + + public Short getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Short formapagoId) { + this.formapagoId = formapagoId; + } + + public String getDescpago() { + return descpago; + } + + public void setDescpago(String descpago) { + this.descpago = descpago; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Short getIndoperacion() { + return indoperacion; + } + + public void setIndoperacion(Short indoperacion) { + this.indoperacion = indoperacion; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public String getCvePago() { + return cvePago; + } + + public void setCvePago(String cvePago) { + this.cvePago = cvePago; + } + + public List getConfigRestriccionPagoList() { + List tmp = new ArrayList(); + if (configRestriccionPagoList != null) { + for (ConfigRestriccionPago crp : this.configRestriccionPagoList) { + if (crp.getActivo()) { + tmp.add(crp); + } + } + } + + return tmp; + } + + public void setConfigRestriccionPagoList(List configRestriccionPagoList) { + this.configRestriccionPagoList = configRestriccionPagoList; + } + + public List getPricingFormapagoList() { + List pfpgList = new ArrayList(); + if (pricingFormapagoList != null) { + for (PricingFormapago pfpg : this.pricingFormapagoList) { + if (pfpg.getActivo() == Pricing.ATIVO) { + pfpgList.add(pfpg); + } + } + } + return pfpgList; + } + + public void setPricingFormapagoList(List pricingFormapagoList) { + this.pricingFormapagoList = pricingFormapagoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (formapagoId != null ? formapagoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof FormaPago)) { + return false; + } + FormaPago other = (FormaPago) object; + if ((this.formapagoId == null && other.formapagoId != null) || (this.formapagoId != null && !this.formapagoId.equals(other.formapagoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDescpago(); + } + + public Boolean getImpfiscal() { + return impfiscal; + } + + public void setImpfiscal(Boolean impfiscal) { + this.impfiscal = impfiscal; + } + + public Boolean getIndconferenciafisicacomissao() { + return indconferenciafisicacomissao; + } + + public void setIndconferenciafisicacomissao(Boolean indconferenciafisicacomissao) { + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + } + + public TipoFormapago getTipoFormapago() { + return tipoFormapago; + } + + public void setTipoFormapago(TipoFormapago tipoFormapago) { + this.tipoFormapago = tipoFormapago; + } + + public String getCveSistema() { + return cveSistema; + } + + public void setCveSistema(String cveSistema) { + this.cveSistema = cveSistema; + } + + /** + * @return the indRestricaoFormaPago + */ + public String getIndRestricaoFormaPago() { + return indRestricaoFormaPago; + } + + /** + * @param indRestricaoFormaPago the indRestricaoFormaPago to set + */ + public void setIndRestricaoFormaPago(String indRestricaoFormaPago) { + this.indRestricaoFormaPago = indRestricaoFormaPago; + } + + public Boolean getIndProcessoEstorno() { + return indProcessoEstorno == null ? false : indProcessoEstorno; + } + + public void setIndProcessoEstorno(Boolean indProcessoEstorno) { + this.indProcessoEstorno = indProcessoEstorno; + } + + public Boolean getIndVoucherRodoviaria() { + return indVoucherRodoviaria == null ? false : indVoucherRodoviaria; + } + + public void setIndVoucherRodoviaria(Boolean indVoucherRodoviaria) { + this.indVoucherRodoviaria = indVoucherRodoviaria; + } + + public TipoCarteiraDigital getTipoCarteiraDigital() { + return tipoCarteiraDigital; + } + + public void setTipoCarteiraDigital(TipoCarteiraDigital tipoCarteiraDigital) { + this.tipoCarteiraDigital = tipoCarteiraDigital; + } + + public Boolean getIndTransferenciaReativacao() { + return indTransferenciaReativacao == null ? false : indTransferenciaReativacao; + } + + public void setIndTransferenciaReativacao(Boolean indTransferenciaReativacao) { + this.indTransferenciaReativacao = indTransferenciaReativacao; + } + + public Long getTipoEventoExtraId() { + return tipoEventoExtraId; + } + + public void setTipoEventoExtraId(Long tipoEventoExtraId) { + this.tipoEventoExtraId = tipoEventoExtraId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java b/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java new file mode 100644 index 000000000..893b1f596 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java @@ -0,0 +1,183 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "FORMA_PAGO_DET_SEQ", sequenceName = "FORMA_PAGO_DET_SEQ", allocationSize = 1) +@Table(name = "FORMA_PAGO_DET") +public class FormaPagoDet implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "FORMAPAGODET_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FORMA_PAGO_DET_SEQ") + private Integer formapagodetId; + @Column(name = "CARGOSEXTRAS") + private BigDecimal cargosextras; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @OneToOne + @JoinColumn(name = "FORMAPAGO_ID") + private FormaPago formaPago; + @Column(name = "INDTOTALBUS") + private Boolean indTotalBus; + @Column(name = "INDEMBARCADA") + private Boolean indEmbarcada; + + public FormaPagoDet() { + } + + public FormaPagoDet(Integer formapagodetId) { + this.formapagodetId = formapagodetId; + } + + public FormaPagoDet(Integer formapagodetId, Date fecmodif) { + this.formapagodetId = formapagodetId; + this.fecmodif = fecmodif; + } + + public Integer getFormapagodetId() { + return formapagodetId; + } + + public void setFormapagodetId(Integer formapagodetId) { + this.formapagodetId = formapagodetId; + } + + public BigDecimal getCargosextras() { + return cargosextras; + } + + public void setCargosextras(BigDecimal cargosextras) { + this.cargosextras = cargosextras; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + + @Override + public int hashCode() { + int hash = 0; + hash += (formapagodetId != null ? formapagodetId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof FormaPagoDet)) { + return false; + } + FormaPagoDet other = (FormaPagoDet) object; + if ((this.formapagodetId == null && other.formapagodetId != null) || (this.formapagodetId != null && !this.formapagodetId.equals(other.formapagodetId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.FormaPagoDet[formapagodetId=" + formapagodetId + "]"; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getIndTotalBus() { + return indTotalBus; + } + + public void setIndTotalBus(Boolean indTotalBus) { + this.indTotalBus = indTotalBus; + } + + public Boolean getIndEmbarcada() { + return indEmbarcada; + } + + public void setIndEmbarcada(Boolean indEmbarcada) { + this.indEmbarcada = indEmbarcada; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/FuncionSistema.java b/src/com/rjconsultores/ventaboletos/entidad/FuncionSistema.java new file mode 100644 index 000000000..580c0e0bb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/FuncionSistema.java @@ -0,0 +1,151 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@Table(name = "FUNCION_SISTEMA") +@SequenceGenerator(name = "FUNCION_SISTEMA_SEQ", sequenceName = "FUNCION_SISTEMA_SEQ", allocationSize = 1) +public class FuncionSistema implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "FUNCIONSISTEMA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "FUNCION_SISTEMA_SEQ") + private Integer funcionsistemaId; + @Column(name = "NOMBFUNCION") + private String nombfuncion; + @Column(name = "DESCRUTA") + private String descruta; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "funcionSistema") + private List perfilFuncionList; + @JoinColumn(name = "SISTEMA_ID", referencedColumnName = "SISTEMA_ID") + @ManyToOne + private Sistema sistema; + + public FuncionSistema() { + } + + public FuncionSistema(Integer funcionsistemaId) { + this.funcionsistemaId = funcionsistemaId; + } + + public Integer getFuncionsistemaId() { + return funcionsistemaId; + } + + public void setFuncionsistemaId(Integer funcionsistemaId) { + this.funcionsistemaId = funcionsistemaId; + } + + public String getNombfuncion() { + return nombfuncion; + } + + public void setNombfuncion(String nombfuncion) { + this.nombfuncion = nombfuncion; + } + + public String getDescruta() { + return descruta; + } + + public void setDescruta(String descruta) { + this.descruta = descruta; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPerfilFuncionList() { + return perfilFuncionList; + } + + public void setPerfilFuncionList(List perfilFuncionList) { + this.perfilFuncionList = perfilFuncionList; + } + + public Sistema getSistema() { + return sistema; + } + + public void setSistema(Sistema sistema) { + this.sistema = sistema; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (funcionsistemaId != null ? funcionsistemaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof FuncionSistema)) { + return false; + } + FuncionSistema other = (FuncionSistema) object; + if ((this.funcionsistemaId == null && other.funcionsistemaId != null) || (this.funcionsistemaId != null && !this.funcionsistemaId.equals(other.funcionsistemaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNombfuncion(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/GrupoCategoria.java b/src/com/rjconsultores/ventaboletos/entidad/GrupoCategoria.java new file mode 100644 index 000000000..1318ea5b1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/GrupoCategoria.java @@ -0,0 +1,102 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "GRUPO_CATEGORIA_SEQ", sequenceName = "GRUPO_CATEGORIA_SEQ", allocationSize = 1) +@Table(name = "GRUPO_CATEGORIA") +public class GrupoCategoria implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "GRUPO_CATEGORIA_SEQ") + @Column(name = "GRUPOCATEGORIA_ID") + private Integer grupoCategoriaId; + @Column(name = "DESCGRUPO") + private String descGrupo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Override + public int hashCode() { + int hash = 0; + hash += (grupoCategoriaId != null ? grupoCategoriaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof GrupoCategoria)) { + return false; + } + GrupoCategoria other = (GrupoCategoria) object; + if ((this.grupoCategoriaId == null && other.grupoCategoriaId != null) || (this.grupoCategoriaId != null && !this.grupoCategoriaId.equals(other.grupoCategoriaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescGrupo(); + } + + public Integer getGrupoCategoriaId() { + return grupoCategoriaId; + } + + public void setGrupoCategoriaId(Integer grupoCategoriaId) { + this.grupoCategoriaId = grupoCategoriaId; + } + + public String getDescGrupo() { + return descGrupo; + } + + public void setDescGrupo(String descGrupo) { + this.descGrupo = descGrupo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/GrupoCortesia.java b/src/com/rjconsultores/ventaboletos/entidad/GrupoCortesia.java new file mode 100644 index 000000000..6b4a589a5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/GrupoCortesia.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "GRUPO_CORTESIA_SEQ", sequenceName = "GRUPO_CORTESIA_SEQ", allocationSize = 1) +@Table(name = "GRUPO_CORTESIA") +public class GrupoCortesia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "GRUPO_CORTESIA_SEQ") + @Column(name = "GRUPOCORTESIA_ID") + private Short grupocortesiaId; + @Column(name = "DESCGRUPO") + private String descgrupo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "grupoCortesia") + private List tipoCortesiaList; + + public GrupoCortesia() { + } + + public GrupoCortesia(Short grupocortesiaId) { + this.grupocortesiaId = grupocortesiaId; + } + + public Short getGrupocortesiaId() { + return grupocortesiaId; + } + + public void setGrupocortesiaId(Short grupocortesiaId) { + this.grupocortesiaId = grupocortesiaId; + } + + public String getDescgrupo() { + return descgrupo; + } + + public void setDescgrupo(String descgrupo) { + this.descgrupo = descgrupo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getTipoCortesiaList() { + return tipoCortesiaList; + } + + public void setTipoCortesiaList(List tipoCortesiaList) { + this.tipoCortesiaList = tipoCortesiaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (grupocortesiaId != null ? grupocortesiaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof GrupoCortesia)) { + return false; + } + GrupoCortesia other = (GrupoCortesia) object; + if ((this.grupocortesiaId == null && other.grupocortesiaId != null) || (this.grupocortesiaId != null && !this.grupocortesiaId.equals(other.grupocortesiaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescgrupo(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/GrupoRuta.java b/src/com/rjconsultores/ventaboletos/entidad/GrupoRuta.java new file mode 100644 index 000000000..4b9e0dd45 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/GrupoRuta.java @@ -0,0 +1,131 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +@Entity +@SequenceGenerator(name = "GRUPO_RUTA_SEQ", sequenceName = "GRUPO_RUTA_SEQ", allocationSize = 1) +@Table(name = "GRUPO_RUTA") +public class GrupoRuta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "GRUPO_RUTA_SEQ") + @Column(name = "GRUPORUTA_ID") + private Integer grupoRutaId; + @Column(name = "DESCGRUPO") + private String descgrupo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public GrupoRuta() { + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + /** + * @return the grupoRutaId + */ + public Integer getGrupoRutaId() { + return grupoRutaId; + } + + /** + * @param grupoRutaId + * the grupoRutaId to set + */ + public void setGrupoRutaId(Integer grupoRutaId) { + this.grupoRutaId = grupoRutaId; + } + + /** + * @return the descGrupo + */ + public String getDescGrupo() { + return descgrupo; + } + + /** + * @param descGrupo + * the descGrupo to set + */ + public void setDescGrupo(String descgrupo) { + this.descgrupo = descgrupo; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final GrupoRuta other = (GrupoRuta) obj; + if (!this.getGrupoRutaId().equals(other.getGrupoRutaId())) { + return false; + } + + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 59 * hash + (this.getGrupoRutaId() != null ? this.getGrupoRutaId().hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return this.getDescGrupo(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java new file mode 100644 index 000000000..9cf70205a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java @@ -0,0 +1,110 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "HIST_PUNTOVENTA_SEQ", sequenceName = "HIST_PUNTOVENTA_SEQ", allocationSize = 1) +@Table(name = "HIST_PUNTOVENTA") +public class HistoricoPuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "HIST_PUNTOVENTA_SEQ") + @Column(name = "HIST_PUNTOVENTA_ID") + private Integer historicoPuntoVentaId; + + @Column(name = "IND_BLOQUEIO") + private Boolean indBloqueio; + + @Column(name = "FEC_BLOQUEIO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecBloqueio; + + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getHistoricoPuntoVentaId() { + return historicoPuntoVentaId; + } + + public void setHistoricoPuntoVentaId(Integer historicoPuntoVentaId) { + this.historicoPuntoVentaId = historicoPuntoVentaId; + } + + public Boolean getIndBloqueio() { + return indBloqueio; + } + + public void setIndBloqueio(Boolean indBloqueio) { + this.indBloqueio = indBloqueio; + } + + public Date getFecBloqueio() { + return fecBloqueio; + } + + public void setFecBloqueio(Date fecBloqueio) { + this.fecBloqueio = fecBloqueio; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Hotel.java b/src/com/rjconsultores/ventaboletos/entidad/Hotel.java new file mode 100644 index 000000000..10067196f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Hotel.java @@ -0,0 +1,199 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "HOTEL") +@SequenceGenerator(name = "HOTEL_SEQ", sequenceName = "HOTEL_SEQ", allocationSize = 1) +public class Hotel implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "HOTEL_SEQ") + @Column(name = "HOTEL_ID") + private Long hotelId; + + @Column(name = "DESCHOTEL") + private String deschotel; + + @Column(name = "CEP") + private String cep; + + @Column(name = "ENDERECO") + private String endereco; + + @Column(name = "NUMERO") + private String numero; + + @Column(name = "COMPLEMENTO") + private String complemento; + + @Column(name = "BAIRRO") + private String bairro; + + @Column(name = "CIDADE") + private String cidade; + + @Column(name = "ESTADO") + private String estado; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.DATE) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "DESCTELEFONE") + private String desctelefone; + + public Long getHotelId() { + return hotelId; + } + + public void setHotelId(Long hotelId) { + this.hotelId = hotelId; + } + + public String getDeschotel() { + return deschotel; + } + + public void setDeschotel(String deschotel) { + this.deschotel = deschotel; + } + + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + public String getEndereco() { + return endereco; + } + + public void setEndereco(String endereco) { + this.endereco = endereco; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public String getCidade() { + return cidade; + } + + public void setCidade(String cidade) { + this.cidade = cidade; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return getDeschotel(); + } + + public String getDesctelefone() { + return desctelefone; + } + + public void setDesctelefone(String desctelefone) { + this.desctelefone = desctelefone; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((hotelId == null) ? 0 : hotelId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + Hotel other = (Hotel) obj; + if (hotelId == null) { + if (other.hotelId != null) + return false; + } else if (!hotelId.equals(other.hotelId)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Imagem.java b/src/com/rjconsultores/ventaboletos/entidad/Imagem.java new file mode 100644 index 000000000..635a51dc7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Imagem.java @@ -0,0 +1,122 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.sql.Blob; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "IMAGEM_SEQ", sequenceName = "IMAGEM_SEQ", allocationSize = 1) +@Table(name = "IMAGEM") +public class Imagem implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "IMAGEM_SEQ") + @Column(name = "IMAGEM_ID") + private Integer imagemId; + @Lob + @Column(name = "IMAGEM") + private byte[] imagem; + @Column(name = "NOMBIMAGEM") + private String nombImagem; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Imagem() { + } + + public Integer getImagemId() { + return imagemId; + } + + public void setImagemId(Integer imagemId) { + this.imagemId = imagemId; + } + + public byte[] getImagem() { + return imagem; + } + + public void setImagem(byte[] imagem) { + this.imagem = imagem; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getNombImagem() { + return nombImagem; + } + + public void setNombImagem(String nombImagem) { + this.nombImagem = nombImagem; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (imagemId != null ? imagemId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Imagem)) { + return false; + } + Imagem other = (Imagem) object; + if ((this.imagemId == null && other.imagemId != null) || (this.imagemId != null && !this.imagemId.equals(other.imagemId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Imagem[imagemId=" + imagemId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/InscricaoEstadual.java b/src/com/rjconsultores/ventaboletos/entidad/InscricaoEstadual.java new file mode 100644 index 000000000..57c8224bb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/InscricaoEstadual.java @@ -0,0 +1,279 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "INSCRICAO_ESTADUAL") +public class InscricaoEstadual { + private Long inscricaoestadualId; + + private Empresa empresa; + private Estado estado; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private String numInscricaoEstadual; + private String logradouro; + private String numero; + private String complemento; + private String cep; + private String bairro; + private Ciudad cidade; + private String cnpj; + private String equivalenciaAG; + private Boolean isBPe; + private Boolean indHabilitaIEDescentralizada; + private Parada origemIEDescentralizada; + private Boolean indFormaPagoOutrosSemCartao; + private String numInscricaoMunicipal; + + + public InscricaoEstadual() { + super(); + } + + public InscricaoEstadual(String inscricaoEstadual, Empresa empresa, Estado estado, Integer usuarioId, + String logradouro, String numero, String complemento, String cep, String bairro, Ciudad cidade, String cnpj,String numInscricaoMunicipal) { + super(); + this.numInscricaoEstadual = inscricaoEstadual; + this.empresa = empresa; + this.estado = estado; + this.fecmodif = new Date(); + this.activo = true; + this.usuarioId = usuarioId; + this.logradouro = logradouro; + this.numero=numero; + this.complemento=complemento; + this.cep=cep; + this.bairro=bairro; + this.cidade=cidade; + this.cnpj=cnpj; + this.numInscricaoMunicipal =numInscricaoMunicipal; + } + + @SequenceGenerator(name = "INSCRICAO_ESTADUAL_SEQ", sequenceName = "INSCRICAO_ESTADUAL_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "INSCRICAO_ESTADUAL_SEQ") + @Column(name = "INSCRICAOESTADUAL_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getInscricaoestadualId() { + return inscricaoestadualId; + } + + public void setInscricaoestadualId(Long inscricaoestadualId) { + this.inscricaoestadualId = inscricaoestadualId; + } + + @Column(name = "NUMINSCRICAOESTADUAL", length = 20) + public String getNumInscricaoEstadual() { + return numInscricaoEstadual; + } + + public void setNumInscricaoEstadual(String inscricaoEstadual) { + this.numInscricaoEstadual = inscricaoEstadual; + } + + @JoinColumn(name = "EMPRESA_ID") + @ManyToOne + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @JoinColumn(name = "ESTADO_ID") + @ManyToOne + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + @Column(name = "LOGRADOURO") + public String getLogradouro() { + return logradouro; + } + + public void setLogradouro(String logradouro) { + this.logradouro = logradouro; + } + + @Column(name = "NUMERO") + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + @Column(name = "COMPLEMENTO") + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + @Column(name = "CEP") + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + @Column(name = "BAIRRO") + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + @OneToOne(cascade = CascadeType.MERGE) + @JoinColumn(name = "CIUDAD_ID") + public Ciudad getCidade() { + return cidade; + } + + public void setCidade(Ciudad cidade) { + this.cidade = cidade; + } + + @Column(name = "CNPJ") + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + @Column(name = "EQUIVALENCIAAG") + public String getEquivalenciaAG() { + return equivalenciaAG; + } + + public void setEquivalenciaAG(String equivalenciaAG) { + this.equivalenciaAG = equivalenciaAG; + } + + @Column(name = "INDBPE") + public Boolean getIsBPe() { + return isBPe; + } + + public void setIsBPe(Boolean isBPe) { + this.isBPe = isBPe; + } + + @Column(name="NUMINSCRICAOMUNICIPAL") + public String getNumInscricaoMunicipal() { + return numInscricaoMunicipal; + } + + public void setNumInscricaoMunicipal(String numInscricaoMunicipal) { + this.numInscricaoMunicipal = numInscricaoMunicipal; + } + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getInscricaoestadualId() == null) ? 0 : getInscricaoestadualId().hashCode()); + return result; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof InscricaoEstadual)) { + return false; + } + InscricaoEstadual other = (InscricaoEstadual) object; + if ((this.getInscricaoestadualId() == null && other.getInscricaoestadualId() != null) || (this.getInscricaoestadualId() != null && !this.getInscricaoestadualId().equals(other.getInscricaoestadualId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return String.format("%s-%s", estado.getCveestado(), numInscricaoEstadual); + } + + @ManyToOne + @JoinColumn(name = "ORIGEM_ID_IEDESCENTRALIZADA") + public Parada getOrigemIEDescentralizada() { + return origemIEDescentralizada; + } + + public void setOrigemIEDescentralizada(Parada origemIEDescentralizada) { + this.origemIEDescentralizada = origemIEDescentralizada; + } + + @Column(name = "INDHABILITAIEDESCENTRALIZADA") + public Boolean getIndHabilitaIEDescentralizada() { + return indHabilitaIEDescentralizada != null ? indHabilitaIEDescentralizada : false; + } + + public void setIndHabilitaIEDescentralizada(Boolean indHabilitaIEDescentralizada) { + this.indHabilitaIEDescentralizada = indHabilitaIEDescentralizada; + } + + public Boolean getIndFormaPagoOutrosSemCartao() { + return indFormaPagoOutrosSemCartao; + } + + public void setIndFormaPagoOutrosSemCartao(Boolean indFormaPagoOutrosSemCartao) { + this.indFormaPagoOutrosSemCartao = indFormaPagoOutrosSemCartao; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/InstiFinanceira.java b/src/com/rjconsultores/ventaboletos/entidad/InstiFinanceira.java new file mode 100644 index 000000000..ec977334d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/InstiFinanceira.java @@ -0,0 +1,159 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "INSTI_FINANCEIRA_SEQ", sequenceName = "INSTI_FINANCEIRA_SEQ", allocationSize = 1) +@Table(name = "INSTI_FINANCEIRA") + +public class InstiFinanceira implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "INSTI_FINANCEIRA_SEQ") + @Column(name = "INSTIFINANCEIRA_ID") + private Integer instFinanceiraId; + + @Column(name = "NOME") + private String nome; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "CODIGO") + private String codigo; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "instiFinanceiraId") + private List ptovtaAgenciaList; + + public InstiFinanceira() { + } + + public InstiFinanceira(Integer instFinanceiraId) { + this.instFinanceiraId = instFinanceiraId; + } + + public InstiFinanceira(Integer instFinanceiraId, String codigo, String nome, Boolean activo, Date fecmodif, int usuarioId) { + this.instFinanceiraId = instFinanceiraId; + this.codigo = codigo; + this.nome = nome; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + + public Integer getInstFinanceiraId() { + return instFinanceiraId; + } + + public void setInstFinanceiraId(Integer instFinanceiraId) { + this.instFinanceiraId = instFinanceiraId; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPtovtaAgenciaList() { + return ptovtaAgenciaList; + } + + public void setPtovtaAgenciaList(List ptovtaAgenciaList) { + this.ptovtaAgenciaList = ptovtaAgenciaList; + } + + public String getCodigo() { + return codigo; + } + + public void setCodigo(String codigo) { + this.codigo = codigo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (instFinanceiraId != null ? instFinanceiraId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof InstiFinanceira)) { + return false; + } + InstiFinanceira other = (InstiFinanceira) object; + if ((this.instFinanceiraId == null && other.instFinanceiraId != null) || (this.instFinanceiraId != null && !this.instFinanceiraId.equals(other.instFinanceiraId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.nome; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/IntegracaoTotvs.java b/src/com/rjconsultores/ventaboletos/entidad/IntegracaoTotvs.java new file mode 100644 index 000000000..78f23bb23 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/IntegracaoTotvs.java @@ -0,0 +1,134 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "INTEGRACAOTOTVS_SEQ", sequenceName = "INTEGRACAOTOTVS_SEQ", allocationSize = 1) +@Table(name = "INTEGRACAO_TOTVS") +public class IntegracaoTotvs implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "INTEGRACAOTOTVS_SEQ") + @Column(name = "INTEGRACAOTOTVS_ID") + private Integer integracaoTotvsId; + @Column(name = "DESC_INTEGRACAO") + private String descIntegracao; + @Column(name = "ESQUEMACORRIDA_ID") + private Integer esquemaCorridaId; + @Column(name = "FECFIN") + private Date fecFin; + @Column(name = "FECINI") + private Date fecInicio; + @Column(name = "FECMODIF") + private Date fecmodif; + @Column(name = "PUNTOVENTA_ID") + private Integer puntoVentaId; + @Column(name = "EMPRESA_ID") + private Integer empresaId; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "QTDEREGISTROSATUALIZADOS") + private Integer qtdadeResgistrosAtualizados; + + @Column(name = "ACTIVO") + private Boolean activo; + + public Integer getIntegracaoTotvsId() { + return integracaoTotvsId; + } + + public void setIntegracaoTotvsId(Integer integracaoTotvsId) { + this.integracaoTotvsId = integracaoTotvsId; + } + + public String getDescIntegracao() { + return descIntegracao; + } + + public void setDescIntegracao(String descIntegracao) { + this.descIntegracao = descIntegracao; + } + + public Integer getEsquemaCorridaId() { + return esquemaCorridaId; + } + + public void setEsquemaCorridaId(Integer esquemaCorridaId) { + this.esquemaCorridaId = esquemaCorridaId; + } + + public Date getFecFin() { + return fecFin; + } + + public void setFecFin(Date fecFin) { + this.fecFin = fecFin; + } + + public Date getFecInicio() { + return fecInicio; + } + + public void setFecInicio(Date fecInicio) { + this.fecInicio = fecInicio; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getPuntoVentaId() { + return puntoVentaId; + } + + public void setPuntoVentaId(Integer puntoVentaId) { + this.puntoVentaId = puntoVentaId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getQtdadeResgistrosAtualizados() { + return qtdadeResgistrosAtualizados; + } + + public void setQtdadeResgistrosAtualizados(Integer qtdadeResgistrosAtualizados) { + this.qtdadeResgistrosAtualizados = qtdadeResgistrosAtualizados; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ItemAdicional.java b/src/com/rjconsultores/ventaboletos/entidad/ItemAdicional.java new file mode 100644 index 000000000..b7a53d3a3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ItemAdicional.java @@ -0,0 +1,136 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "ITEM_ADICIONAL") +@SequenceGenerator(name = "ITEM_ADICIONAL_SEQ", sequenceName = "ITEM_ADICIONAL_SEQ", allocationSize = 1) +public class ItemAdicional implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ITEM_ADICIONAL_SEQ") + @Column(name = "ITEMADICIONAL_ID") + private Integer itemadicionalId; + @Column(name = "DESCITEMADICIONAL") + private String descitemadicional; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToMany + @JoinTable(name = "PACOTE_ITEM", joinColumns = { @JoinColumn(name = "ITEMADICIONAL_ID") }, + inverseJoinColumns = { @JoinColumn(name = "PACOTE_ID") }) + private List pacoteList; + + public ItemAdicional() { + } + + public ItemAdicional(Integer itemadicionalId, String descitemadicional, Boolean activo, Date fecmodif, Integer usuarioId) { + super(); + this.itemadicionalId = itemadicionalId; + this.descitemadicional = descitemadicional; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Integer getItemadicionalId() { + return itemadicionalId; + } + + public void setItemadicionalId(Integer itemadicionalId) { + this.itemadicionalId = itemadicionalId; + } + + public String getDescitemadicional() { + return descitemadicional; + } + + public void setDescitemadicional(String descitemadicional) { + this.descitemadicional = descitemadicional; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPacoteList() { + return pacoteList; + } + + public void setPacoteList(List pacoteList) { + this.pacoteList = pacoteList; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((itemadicionalId == null) ? 0 : itemadicionalId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ItemAdicional other = (ItemAdicional) obj; + if (itemadicionalId == null) { + if (other.itemadicionalId != null) + return false; + } else if (!itemadicionalId.equals(other.itemadicionalId)) + return false; + return true; + } + + @Override + public String toString() { + return this.getDescitemadicional() + " - " + this.getItemadicionalId(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ItemDesconto.java b/src/com/rjconsultores/ventaboletos/entidad/ItemDesconto.java new file mode 100644 index 000000000..8c3bf1f74 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ItemDesconto.java @@ -0,0 +1,101 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.text.NumberFormat; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "ITEM_DESCONTO_SEQ", sequenceName = "ITEM_DESCONTO_SEQ", allocationSize = 1) +@Table(name = "ITEM_DESCONTO") +public class ItemDesconto implements Serializable { + + private static final long serialVersionUID = 1L; + + private static NumberFormat NF = NumberFormat.getInstance(); + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ITEM_DESCONTO_SEQ") + @Column(name = "ITEMDESCONTO_ID") + private Long itemdescontoId; + + @Column(name = "NOMITEMDESCONTO") + private String nomitemdesconto; + + @Column(name = "PRECO") + private BigDecimal preco; + + @Column(name = "ACTIVO") + private boolean activo; + + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getItemdescontoId() { + return itemdescontoId; + } + + public void setItemdescontoId(Long itemdescontoId) { + this.itemdescontoId = itemdescontoId; + } + + public String getNomitemdesconto() { + return nomitemdesconto; + } + + public void setNomitemdesconto(String nomitemdesconto) { + this.nomitemdesconto = nomitemdesconto; + } + + public BigDecimal getPreco() { + return preco; + } + + public void setPreco(BigDecimal preco) { + this.preco = preco; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + NF.setMinimumFractionDigits(2); + return this.getNomitemdesconto() + " - " + NF.format(this.getPreco()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/LogAuditoria.java b/src/com/rjconsultores/ventaboletos/entidad/LogAuditoria.java new file mode 100644 index 000000000..b205bd8be --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/LogAuditoria.java @@ -0,0 +1,200 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "LOG_AUDITORIA_SEQ", sequenceName = "LOG_AUDITORIA_SEQ", allocationSize = 1) +@Table(name = "LOG_AUDITORIA") +public class LogAuditoria implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "LOG_AUDITORIA_SEQ") + @Column(name = "LOGAUDITORIA_ID") + private Long logauditoriaId; + + @Column(name = "ID_AUDITADO") + private String idAuditado; + + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "VALOR_ANTERIOR") + private String valorAnterior; + + @Column(name = "VALOR_NOVO") + private String valorNovo; + + @Column(name = "CAMPO_ALTERADO") + private String campoAlterado; + + @Column(name = "CLASSE_ALTERADA") + private String classeAlterada; + + @Column(name = "CLASSE_PRINCIPAL") + private String classePrincipal; + + @Column(name = "TELA") + private String tela; + + @Column(name = "TIPO_ALTERACAO") + private String tipoAlteracao; + + @Column(name = "ACTIVO") + private boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @ManyToOne + @JoinColumn(name = "USUARIO_ID") + private Usuario usuario; + + public Long getLogauditoriaId() { + return logauditoriaId; + } + + public void setLogauditoriaId(Long logauditoriaId) { + this.logauditoriaId = logauditoriaId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public String getValorAnterior() { + return valorAnterior; + } + + public void setValorAnterior(String valorAnterior) { + this.valorAnterior = valorAnterior; + } + + public String getValorNovo() { + return valorNovo; + } + + public void setValorNovo(String valorNovo) { + this.valorNovo = valorNovo; + } + + public String getCampoAlterado() { + return campoAlterado; + } + + public void setCampoAlterado(String campoAlterado) { + this.campoAlterado = campoAlterado; + } + + public String getClasseAlterada() { + return classeAlterada; + } + + public void setClasseAlterada(String classeAlterada) { + this.classeAlterada = classeAlterada; + } + + public String getClassePrincipal() { + return classePrincipal; + } + + public void setClassePrincipal(String classePrincipal) { + this.classePrincipal = classePrincipal; + } + + public String getTela() { + return tela; + } + + public void setTela(String tela) { + this.tela = tela; + } + + public String getTipoAlteracao() { + return tipoAlteracao; + } + + public void setTipoAlteracao(String tipoAlteracao) { + this.tipoAlteracao = tipoAlteracao; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getLogauditoriaId() == null) ? 0 : getLogauditoriaId().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof LogAuditoria)) + return false; + LogAuditoria other = (LogAuditoria) obj; + if (getLogauditoriaId() == null) { + if (other.getLogauditoriaId() != null) + return false; + } else if (!getLogauditoriaId().equals(other.getLogauditoriaId())) + return false; + return true; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public String getIdAuditado() { + return idAuditado; + } + + public void setIdAuditado(String idAuditado) { + this.idAuditado = idAuditado; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/LogConferencia.java b/src/com/rjconsultores/ventaboletos/entidad/LogConferencia.java new file mode 100644 index 000000000..75bb9009d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/LogConferencia.java @@ -0,0 +1,286 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; +import com.rjconsultores.ventaboletos.enums.comissao.TipoLogConferencia; + +@Entity +@Table(name = "LOG_CONFERENCIA") +@SequenceGenerator(name = "LOG_CONFERENCIA_SEQ", sequenceName = "LOG_CONFERENCIA_SEQ", allocationSize = 1) +public class LogConferencia implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "LOG_CONFERENCIA_SEQ") + @Column(name = "LOGCONFERENCIA_ID") + private Long logconferenciaId; + + @Column(name = "OBSERVACAO") + private String observacao; + + @Column(name = "PRECO") + private BigDecimal preco; + + @Column(name = "ACTIVO") + private boolean activo; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "BOLETO_ID") + private Long boletoId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "USUARIO_ID") + private Usuario usuario; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CONFERENCIA_ID") + private Conferencia conferencia; + + @Enumerated(EnumType.ORDINAL) + @Column(name = "STATUS") + private StatusLogConferencia status; + + @Column(name = "EVENTOEXTRA_ID") + private Long eventoextraId; + + @Column(name = "OCD_ID") + private Long ocdId; + + @Enumerated(EnumType.ORDINAL) + @Column(name = "TIPO") + private TipoLogConferencia tipo; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CONTACORRENTEPTOVTA_ID") + private ContaCorrentePtoVta contaCorrentePtoVta; + + @Column(name = "INDCREDITO") + private Short indcredito; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "TIPOINFORMATIVOCOMISSAO_ID") + private TipoInformativoComissao tipoInformativoComissao; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CONFERENCIAPENDENCIA_ID") + private ConferenciaPendencia conferenciaPendencia; + + @Column(name = "INDMESMODIA") + private Boolean indmesmodia; + + @Column(name = "CAJA_ID") + private Long cajaId; + + @Column(name = "TRANSACAOORIGINAL_ID", precision = 15, scale = 0) + private Long transacaoOriginalId; + + public Long getLogconferenciaId() { + return logconferenciaId; + } + + public void setLogconferenciaId(Long logconferenciaId) { + this.logconferenciaId = logconferenciaId; + } + + public String getObservacao() { + return observacao; + } + + public void setObservacao(String observacao) { + this.observacao = observacao; + } + + public BigDecimal getPreco() { + return preco; + } + + public void setPreco(BigDecimal preco) { + this.preco = preco; + } + + public boolean isActivo() { + return activo; + } + + public void setActivo(boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public Conferencia getConferencia() { + return conferencia; + } + + public void setConferencia(Conferencia conferencia) { + this.conferencia = conferencia; + } + + public StatusLogConferencia getStatus() { + return status; + } + + public void setStatus(StatusLogConferencia status) { + this.status = status; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((logconferenciaId == null) ? 0 : logconferenciaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + LogConferencia other = (LogConferencia) obj; + if (logconferenciaId == null) { + if (other.logconferenciaId != null) + return false; + } else if (!logconferenciaId.equals(other.logconferenciaId)) + return false; + return true; + } + + public Long getEventoextraId() { + return eventoextraId; + } + + public void setEventoextraId(Long eventoextraId) { + this.eventoextraId = eventoextraId; + } + + public Long getOcdId() { + return ocdId; + } + + public void setOcdId(Long ocdId) { + this.ocdId = ocdId; + } + + public TipoLogConferencia getTipo() { + return tipo; + } + + public void setTipo(TipoLogConferencia tipo) { + this.tipo = tipo; + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public ContaCorrentePtoVta getContaCorrentePtoVta() { + return contaCorrentePtoVta; + } + + public void setContaCorrentePtoVta(ContaCorrentePtoVta contaCorrentePtoVta) { + this.contaCorrentePtoVta = contaCorrentePtoVta; + } + + /** + * Tipos de movimentos
+ * 0 - Débito
+ * 1 - Crédito
+ * 2 - Informativo
+ */ + public Short isIndcredito() { + return indcredito; + } + + public void setIndcredito(Short indcredito) { + this.indcredito = indcredito; + } + + public TipoInformativoComissao getTipoInformativoComissao() { + return tipoInformativoComissao; + } + + public void setTipoInformativoComissao(TipoInformativoComissao tipoInformativoComissao) { + this.tipoInformativoComissao = tipoInformativoComissao; + } + + public ConferenciaPendencia getConferenciaPendencia() { + return conferenciaPendencia; + } + + public void setConferenciaPendencia(ConferenciaPendencia conferenciaPendencia) { + this.conferenciaPendencia = conferenciaPendencia; + } + + public Short getIndcredito() { + return indcredito; + } + + public Boolean getIndmesmodia() { + return indmesmodia; + } + + public void setIndmesmodia(Boolean indmesmodia) { + this.indmesmodia = indmesmodia; + } + + public Long getCajaId() { + return cajaId; + } + + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + + public Long getTransacaoOriginalId() { + return transacaoOriginalId; + } + + public void setTransacaoOriginalId(Long transacaoOriginalId) { + this.transacaoOriginalId = transacaoOriginalId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/LogDespesaReceitaDiversa.java b/src/com/rjconsultores/ventaboletos/entidad/LogDespesaReceitaDiversa.java new file mode 100644 index 000000000..49c224868 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/LogDespesaReceitaDiversa.java @@ -0,0 +1,80 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "LOG_DESPESAS_RECEITAS_DIV_SEQ", sequenceName = "LOG_DESPESAS_RECEITAS_DIV_SEQ", allocationSize = 1) +@Table(name = "LOG_DESPESAS_RECEITAS_DIV") +public class LogDespesaReceitaDiversa { + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "LOG_DESPESAS_RECEITAS_DIV_SEQ") + @Column(name = "DESPESASRECEITASDIV_ID") + private Long despesaReceitaDivId; + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuario; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @Column(name = "DATA_EXEC") + private Date dataExecucao; + @Column(name = "DATA_INICIO") + private Date dataInicio; + @Column(name = "DATA_FIM") + private Date dataFim; + @Column(name = "PROCESSADO") + private Boolean indProcessado; + + public Long getDespesaReceitaDivId() { + return despesaReceitaDivId; + } + public void setDespesaReceitaDivId(Long despesaReceitaDivId) { + this.despesaReceitaDivId = despesaReceitaDivId; + } + public Usuario getUsuario() { + return usuario; + } + public void setUsuario(Usuario usuarioId) { + this.usuario = usuarioId; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresaId) { + this.empresa = empresaId; + } + public Date getDataExecucao() { + return dataExecucao; + } + public void setDataExecucao(Date dataExecucao) { + this.dataExecucao = dataExecucao; + } + public Date getDataInicio() { + return dataInicio; + } + public void setDataInicio(Date dataInicio) { + this.dataInicio = dataInicio; + } + public Date getDataFim() { + return dataFim; + } + public void setDataFim(Date dataFim) { + this.dataFim = dataFim; + } + public Boolean getIndProcessado() { + return indProcessado; + } + public void setIndProcessado(Boolean indProcessado) { + this.indProcessado = indProcessado; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/LogHistoricoContingencia.java b/src/com/rjconsultores/ventaboletos/entidad/LogHistoricoContingencia.java new file mode 100644 index 000000000..d061c4469 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/LogHistoricoContingencia.java @@ -0,0 +1,135 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * @author vjcor + * + */ +@Entity +@Table(name = "LOG_HISTORICO_CONTINGENCIA") +@SequenceGenerator(name = "LOG_HISTORICO_CONTINGENCIA_SEQ", sequenceName = "LOG_HISTORICO_CONTINGENCIA_SEQ", allocationSize = 1) +public class LogHistoricoContingencia implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "LOG_HISTORICO_CONTINGENCIA_SEQ") + @Column(name = "LOGHISTORICOCONTINGENCIA_ID") + private Long logHistoricoContingenciaId; + + @Column(name = "MOTIVO") + private String motivo; + + @OneToOne + @JoinColumn(name = "USUARIO_ID") + private Usuario usuario; + + @Column(name = "DATAHORA") + @Temporal(TemporalType.TIMESTAMP) + private Date dataHora; + + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @OneToOne + @JoinColumn(name = "ESTADO_ID") + private Estado estado; + + @Column(name = "STATUS") + private String status; + + @Column(name = "IND_AMBIENTE") + private Integer ambiente; + + @Column(name = "INDAUTOMATICA") + private Boolean indautomatica; + + public Long getLogHistoricoContingenciaId() { + return logHistoricoContingenciaId; + } + + public void setLogHistoricoContingenciaId(Long logHistoricoContingenciaId) { + this.logHistoricoContingenciaId = logHistoricoContingenciaId; + } + + public String getMotivo() { + return motivo; + } + + public void setMotivo(String motivo) { + this.motivo = motivo; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public Date getDataHora() { + return dataHora; + } + + public void setDataHora(Date dataHora) { + this.dataHora = dataHora; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Integer getAmbiente() { + return ambiente; + } + + public void setAmbiente(Integer ambiente) { + this.ambiente = ambiente; + } + + public Boolean getIndautomatica() { + return indautomatica == null ? false : indautomatica; + } + + public void setIndautomatica(Boolean indautomatica) { + this.indautomatica = indautomatica; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Marca.java b/src/com/rjconsultores/ventaboletos/entidad/Marca.java new file mode 100644 index 000000000..64b91daca --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Marca.java @@ -0,0 +1,273 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.Lob; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; + +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "MARCA_SEQ", sequenceName = "MARCA_SEQ", allocationSize = 1) +@Table(name = "MARCA") +public class Marca implements Serializable, Auditavel { + + public final static short TODOS = -1; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MARCA_SEQ") + @Column(name = "MARCA_ID") + private Short marcaId; + + @Column(name = "DESCMARCA") + private String descmarca; + + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Lob + @Column(name = "LOGOTIPOMARCA") + private byte[] logotipomarca; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "marca") + @Fetch(FetchMode.SELECT) + private List categoriaMarcaList; + @OneToMany(mappedBy = "marca") + @Fetch(FetchMode.SELECT) + private List reservacionMarcaList; + @OneToMany(mappedBy = "marca") + private List cancelacionCtrlList; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @OneToMany(mappedBy = "marca") + @Fetch(FetchMode.SELECT) + private List tarifaHistList; + @OneToMany(mappedBy = "marca") + @Fetch(FetchMode.SELECT) + private List corridaList; + + @Transient + @NaoAuditar + private Marca marcaClone; + + public Marca() { + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Marca(Short marcaId) { + this.marcaId = marcaId; + } + + public Marca(Short marcaId, Date fecmodif) { + this.marcaId = marcaId; + this.fecmodif = fecmodif; + } + + public Marca(Short marcaId, String descMarca) { + this.marcaId = marcaId; + this.descmarca = descMarca; + } + + public Marca(Short marcaId, String descMarca, Integer usuarioId , Date fecmodif) { + this.marcaId = marcaId; + this.descmarca = descMarca; + this.usuarioId = usuarioId; + this.fecmodif = fecmodif; + } + + public Short getMarcaId() { + return marcaId; + } + + public void setMarcaId(Short marcaId) { + this.marcaId = marcaId; + } + + public String getDescmarca() { + return descmarca; + } + + public void setDescmarca(String descmarca) { + this.descmarca = descmarca; + } + + public byte[] getLogotipomarca() { + return logotipomarca; + } + + public void setLogotipomarca(byte[] logotipomarca) { + this.logotipomarca = logotipomarca; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getCategoriaMarcaList() { + List tmp = new ArrayList(); + if (categoriaMarcaList != null) { + for (CategoriaMarca cm : this.categoriaMarcaList) { + if (cm.getActivo()) { + tmp.add(cm); + } + } + } + + return tmp; + } + + public void setCategoriaMarcaList(List categoriaMarcaList) { + this.categoriaMarcaList = categoriaMarcaList; + } + + public List getReservacionMarcaList() { + List tmp = new ArrayList(); + for (ReservacionMarca rm : this.reservacionMarcaList) { + if (rm.getActivo()) { + tmp.add(rm); + } + } + + return tmp; + } + + public void setReservacionMarcaList(List reservacionMarcaList) { + this.reservacionMarcaList = reservacionMarcaList; + } + + public List getCancelacionCtrlList() { + return cancelacionCtrlList; + } + + public void setCancelacionCtrlList(List cancelacionCtrlList) { + this.cancelacionCtrlList = cancelacionCtrlList; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getMarcaId() != null ? getMarcaId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Marca)) { + return false; + } + Marca other = (Marca) object; + if ((this.getMarcaId() == null && other.getMarcaId() != null) || (this.getMarcaId() != null && !this.getMarcaId().equals(other.getMarcaId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescmarca(); + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + public List getTarifaHistList() { + return tarifaHistList; + } + + public void setTarifaHistList(List tarifaHistList) { + this.tarifaHistList = tarifaHistList; + } + + @Override + public void clonar() throws CloneNotSupportedException { + marcaClone = new Marca(); + marcaClone = (Marca) this.clone(); + } + + @Override + public Marca getCloneObject() throws CloneNotSupportedException { + return marcaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getMarcaId()); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MarcaAutobus.java b/src/com/rjconsultores/ventaboletos/entidad/MarcaAutobus.java new file mode 100644 index 000000000..b94ffc0f6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MarcaAutobus.java @@ -0,0 +1,87 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "MARCA_AUTOBUS_SEQ", sequenceName = "MARCA_AUTOBUS_SEQ", allocationSize = 1) +@Table(name = "MARCA_AUTOBUS") +public class MarcaAutobus implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MARCA_AUTOBUS_SEQ") + @Column(name = "MARCAAUTOBUS_ID") + private Long marcaAutobusId; + @Column(name = "DESCMARCA") + private String descmarca; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getMarcaAutobusId() { + return marcaAutobusId; + } + public void setMarcaAutobusId(Long marcaAutobusId) { + this.marcaAutobusId = marcaAutobusId; + } + public String getDescmarca() { + return descmarca; + } + public void setDescmarca(String descmarca) { + this.descmarca = descmarca; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString(){ + return this.descmarca; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MarcaAutobus)) { + return false; + } + MarcaAutobus other = (MarcaAutobus) object; + if ((this.marcaAutobusId == null && other.marcaAutobusId != null) || (this.marcaAutobusId != null && !this.marcaAutobusId.equals(other.marcaAutobusId))) { + return false; + } + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicio.java b/src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicio.java new file mode 100644 index 000000000..c10952ad4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicio.java @@ -0,0 +1,94 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@Table(name = "MARCA_CLASESERVICIO") +public class MarcaClaseServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @EmbeddedId + protected MarcaClaseServicioPK marcaClaseservicioPK; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public MarcaClaseServicio() { + } + + public MarcaClaseServicioPK getMarcaClaseservicioPK() { + return marcaClaseservicioPK; + } + + public void setMarcaClaseservicioPK(MarcaClaseServicioPK marcaClaseservicioPK) { + this.marcaClaseservicioPK = marcaClaseservicioPK; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (marcaClaseservicioPK != null ? marcaClaseservicioPK.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MarcaClaseServicio)) { + return false; + } + MarcaClaseServicio other = (MarcaClaseServicio) object; + if ((this.marcaClaseservicioPK == null && other.marcaClaseservicioPK != null) || (this.marcaClaseservicioPK != null && !this.marcaClaseservicioPK.equals(other.marcaClaseservicioPK))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.MarcaClaseservicio[marcaClaseservicioPK=" + marcaClaseservicioPK + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicioPK.java b/src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicioPK.java new file mode 100644 index 000000000..602e495a0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MarcaClaseServicioPK.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import javax.persistence.Basic; +import javax.persistence.Embeddable; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; + +/** + * + * @author Administrador + */ +@Embeddable +public class MarcaClaseServicioPK implements Serializable { + + private static final long serialVersionUID = 1L; + @Basic(optional = false) + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseservicio; + @Basic(optional = false) + @OneToOne + @JoinColumn(name = "MARCA_ID") + private Marca marca; + + public MarcaClaseServicioPK() { + } + + public ClaseServicio getClaseservicio() { + return claseservicio; + } + + public void setClaseservicio(ClaseServicio claseservicio) { + this.claseservicio = claseservicio; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MensagemRecusa.java b/src/com/rjconsultores/ventaboletos/entidad/MensagemRecusa.java new file mode 100644 index 000000000..ae391ad81 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MensagemRecusa.java @@ -0,0 +1,112 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "MENSAGEM_RECUSA_SEQ", sequenceName = "MENSAGEM_RECUSA_SEQ", allocationSize = 1) +@Table(name = "MENSAGEM_RECUSA") +public class MensagemRecusa implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MENSAGEM_RECUSA_SEQ") + @Column(name = "MENSAGEMRECUSA_ID") + private Integer mensagemRecusaId; + + @Column(name = "TIPO_MENSAGEM") + private String tipoMensagem; + + @Column(name = "DESCRICAO") + private String descricao; + + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public MensagemRecusa() { + } + + public Integer getMensagemRecusaId() { + return mensagemRecusaId; + } + + public void setMensagemRecusaId(Integer mensagemRecusaId) { + this.mensagemRecusaId = mensagemRecusaId; + } + + public String getTipoMensagem() { + return tipoMensagem; + } + + public void setTipoMensagem(String tipoMensagem) { + this.tipoMensagem = tipoMensagem; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/Mensaje.java b/src/com/rjconsultores/ventaboletos/entidad/Mensaje.java new file mode 100644 index 000000000..d436d17a0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Mensaje.java @@ -0,0 +1,180 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "MENSAJE_SEQ", sequenceName = "MENSAJE_SEQ", allocationSize = 1) +@Table(name = "MENSAJE") +public class Mensaje implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer mensajeId; + private Date fecIni; + private Date fecFin; + private String descripcion; + private Boolean indTipo; + private Boolean activo; + private Date fecModif; + private Integer usuarioId; + private List mensajesPuntoVenda; + private List mensajesEmpresa; + private List mensajesUsuario; + + public Mensaje() { + mensajesPuntoVenda = new ArrayList(); + mensajesEmpresa = new ArrayList(); + mensajesUsuario = new ArrayList(); + } + + @Id + @Column(name = "MENSAJE_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MENSAJE_SEQ") + @Basic(optional = false) + public Integer getMensajeId() { + return mensajeId; + } + + public void setMensajeId(Integer mensajeId) { + this.mensajeId = mensajeId; + } + + @Column(name = "FECINI") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecIni() { + return fecIni; + } + + public void setFecIni(Date fecIni) { + this.fecIni = fecIni; + } + + @Column(name = "FECFIN") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecFin() { + return fecFin; + } + + public void setFecFin(Date fecFin) { + this.fecFin = fecFin; + } + + @Column(name = "DESCRIPCION") + public String getDescripcion() { + return descripcion; + } + + public void setDescripcion(String descripcion) { + this.descripcion = descripcion; + } + + @Column(name = "INDTIPO") + public Boolean getIndTipo() { + return indTipo; + } + + public void setIndTipo(Boolean indTipo) { + this.indTipo = indTipo; + } + + @Column(name = "ACTIVO") + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecModif() { + return fecModif; + } + + public void setFecModif(Date fecModif) { + this.fecModif = fecModif; + } + + @Column(name = "USUARIO_ID") + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "MENSAJE_ID", referencedColumnName = "MENSAJE_ID") + public List getMensajesPuntoVenda() { + return mensajesPuntoVenda; + } + + public void setMensajesPuntoVenda(List mensajesPuntoVenda) { + this.mensajesPuntoVenda = mensajesPuntoVenda; + } + + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "MENSAJE_ID", referencedColumnName = "MENSAJE_ID") + public List getMensajesEmpresa() { + return mensajesEmpresa; + } + + public void setMensajesEmpresa(List mensajesEmpresa) { + this.mensajesEmpresa = mensajesEmpresa; + } + + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "MENSAJE_ID", referencedColumnName = "MENSAJE_ID") + public List getMensajesUsuario() { + return mensajesUsuario; + } + + public void setMensajesUsuario(List mensajesUsuario) { + this.mensajesUsuario = mensajesUsuario; + } + + @Override + public String toString() { + return mensajeId == null ? "null" : this.mensajeId.toString(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (mensajeId != null ? mensajeId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Mensaje)) { + return false; + } + Mensaje other = (Mensaje) object; + if ((this.mensajeId == null && other.mensajeId != null) || (this.mensajeId != null && !this.mensajeId.equals(other.mensajeId))) { + return false; + } + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MensajeEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/MensajeEmpresa.java new file mode 100644 index 000000000..f367eca4f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MensajeEmpresa.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "MENSAJE_EMPRESA_SEQ", sequenceName = "MENSAJE_EMPRESA_SEQ", allocationSize = 1) +@Table(name = "MENSAJE_EMPRESA") +public class MensajeEmpresa implements Serializable{ + + private static final long serialVersionUID = 1L; + + private Integer mensajeEmpresaId; + private Mensaje mensaje; + private Empresa empresa; + private Boolean activo; + private Date fecModif; + private Integer usuarioId; + + @Id + @Column(name = "MENSAJE_EMPRESA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MENSAJE_EMPRESA_SEQ") + @Basic(optional = false) + public Integer getMensajeEmpresaId() { + return mensajeEmpresaId; + } + + public void setMensajeEmpresaId(Integer mensajeEmpresaId) { + this.mensajeEmpresaId = mensajeEmpresaId; + } + + @ManyToOne + @JoinColumn(name = "MENSAJE_ID", referencedColumnName = "MENSAJE_ID") + public Mensaje getMensaje() { + return mensaje; + } + + public void setMensaje(Mensaje mensaje) { + this.mensaje = mensaje; + } + + @ManyToOne + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Column(name = "ACTIVO") + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecModif() { + return fecModif; + } + + public void setFecModif(Date fecModif) { + this.fecModif = fecModif; + } + + @Column(name = "USUARIO_ID") + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return mensajeEmpresaId == null ? "null" : this.mensajeEmpresaId.toString(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (mensajeEmpresaId != null ? mensajeEmpresaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof MensajeEmpresa)) { + return false; + } + MensajeEmpresa other = (MensajeEmpresa) object; + if ((this.mensajeEmpresaId == null && other.mensajeEmpresaId != null) || (this.mensajeEmpresaId != null && !this.mensajeEmpresaId.equals(other.mensajeEmpresaId))) { + return false; + } + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MensajePuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/MensajePuntoVenta.java new file mode 100644 index 000000000..b5cedb8d7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MensajePuntoVenta.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "MENSAJE_PUNTO_VENTA_SEQ", sequenceName = "MENSAJE_PUNTO_VENTA_SEQ", allocationSize = 1) +@Table(name = "MENSAJE_PUNTO_VENTA") +public class MensajePuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer mensajePuntoVendaId; + private Mensaje mensaje; + private PuntoVenta puntoVenda; + private Boolean activo; + private Date fecModif; + private Integer usuarioId; + + @Id + @Column(name = "MENSAJE_PUNTO_VENTA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MENSAJE_PUNTO_VENTA_SEQ") + @Basic(optional = false) + public Integer getMensajePuntoVendaId() { + return mensajePuntoVendaId; + } + + public void setMensajePuntoVendaId(Integer mensajePuntoVendaId) { + this.mensajePuntoVendaId = mensajePuntoVendaId; + } + + @ManyToOne + @JoinColumn(name = "MENSAJE_ID", referencedColumnName = "MENSAJE_ID") + public Mensaje getMensaje() { + return mensaje; + } + + public void setMensaje(Mensaje mensaje) { + this.mensaje = mensaje; + } + + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + public PuntoVenta getPuntoVenda() { + return puntoVenda; + } + + public void setPuntoVenda(PuntoVenta puntoVenda) { + this.puntoVenda = puntoVenda; + } + + @Column(name = "ACTIVO") + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecModif() { + return fecModif; + } + + public void setFecModif(Date fecModif) { + this.fecModif = fecModif; + } + + @Column(name = "USUARIO_ID") + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return mensajePuntoVendaId == null ? "null" : this.mensajePuntoVendaId.toString(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (mensajePuntoVendaId != null ? mensajePuntoVendaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof MensajePuntoVenta)) { + return false; + } + MensajePuntoVenta other = (MensajePuntoVenta) object; + if ((this.mensajePuntoVendaId == null && other.mensajePuntoVendaId != null) || (this.mensajePuntoVendaId != null && !this.mensajePuntoVendaId.equals(other.mensajePuntoVendaId))) { + return false; + } + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MensajeUsuario.java b/src/com/rjconsultores/ventaboletos/entidad/MensajeUsuario.java new file mode 100644 index 000000000..9518c1c2c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MensajeUsuario.java @@ -0,0 +1,125 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "MENSAJE_USUARIO_SEQ", sequenceName = "MENSAJE_USUARIO_SEQ", allocationSize = 1) +@Table(name = "MENSAJE_USUARIO") +public class MensajeUsuario { + + private Integer mensajeUsuarioId; + private Mensaje mensaje; + private Usuario usuario; + private Date fecLeido; + private Date fecModif; + private Boolean activo; + private Integer usuarioModifId; + + @Id + @Column(name = "MENSAJE_USUARIO_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MENSAJE_USUARIO_SEQ") + @Basic(optional = false) + public Integer getMensajeUsuarioId() { + return mensajeUsuarioId; + } + + public void setMensajeUsuarioId(Integer mensajeUsuarioId) { + this.mensajeUsuarioId = mensajeUsuarioId; + } + + @ManyToOne + @JoinColumn(name = "MENSAJE_ID", referencedColumnName = "MENSAJE_ID") + public Mensaje getMensaje() { + return mensaje; + } + + public void setMensaje(Mensaje mensaje) { + this.mensaje = mensaje; + } + + @ManyToOne + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + @Column(name = "FECLEIDO") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecLeido() { + return fecLeido; + } + + public void setFecLeido(Date fecLeido) { + this.fecLeido = fecLeido; + } + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecModif() { + return fecModif; + } + + public void setFecModif(Date fecModif) { + this.fecModif = fecModif; + } + + @Column(name = "ACTIVO") + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Column(name = "USUARIOMODIF_ID ") + public Integer getUsuarioModifId() { + return usuarioModifId; + } + + public void setUsuarioModifId(Integer usuarioModifId) { + this.usuarioModifId = usuarioModifId; + } + + @Override + public String toString() { + return mensajeUsuarioId == null ? "null" : this.mensajeUsuarioId.toString(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (mensajeUsuarioId != null ? mensajeUsuarioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof MensajeUsuario)) { + return false; + } + MensajeUsuario other = (MensajeUsuario) object; + if ((this.mensajeUsuarioId == null && other.mensajeUsuarioId != null) || (this.mensajeUsuarioId != null && !this.mensajeUsuarioId.equals(other.mensajeUsuarioId))) { + return false; + } + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MercadoCompetido.java b/src/com/rjconsultores/ventaboletos/entidad/MercadoCompetido.java new file mode 100644 index 000000000..832dcdb0d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MercadoCompetido.java @@ -0,0 +1,137 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "MERCADO_COMPETIDO_SEQ", sequenceName = "MERCADO_COMPETIDO_SEQ", allocationSize = 1) +@Table(name = "MERCADO_COMPETIDO") +public class MercadoCompetido implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MERCADO_COMPETIDO_SEQ") + @Basic(optional = false) + @Column(name = "MERCADOCOMPETIDO_ID") + private Integer mercadocompetidoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public MercadoCompetido() { + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getMercadocompetidoId() { + return mercadocompetidoId; + } + + public void setMercadocompetidoId(Integer mercadocompetidoId) { + this.mercadocompetidoId = mercadocompetidoId; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (mercadocompetidoId != null ? mercadocompetidoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MercadoCompetido)) { + return false; + } + MercadoCompetido other = (MercadoCompetido) object; + if ((this.mercadocompetidoId == null && other.mercadocompetidoId != null) || (this.mercadocompetidoId != null && !this.mercadocompetidoId.equals(other.mercadocompetidoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "newpackage.MercadoCompetido[mercadocompetidoId=" + mercadocompetidoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MerchantBancario.java b/src/com/rjconsultores/ventaboletos/entidad/MerchantBancario.java new file mode 100644 index 000000000..4bf33934d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MerchantBancario.java @@ -0,0 +1,155 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "MERCHANT_BANCARIO_SEQ", sequenceName = "MERCHANT_BANCARIO_SEQ", allocationSize = 1) +@Table(name = "MERCHANT_BANCARIO") +public class MerchantBancario implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MERCHANT_BANCARIO_SEQ") + @Column(name = "MERCHANTBANCARIO_ID") + private Integer merchantbancarioId; + @Column(name = "CVEMERCHANT") + private String cvemerchant; + @Column(name = "DESCMERCHANT") + private String descmerchant; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @JoinColumn(name = "COMPANIABANCARIA_ID", referencedColumnName = "COMPANIABANCARIA_ID") + @ManyToOne(optional = false) + private CompaniaBancaria companiaBancaria; + + public MerchantBancario() { + } + + public MerchantBancario(Integer merchantbancarioId) { + this.merchantbancarioId = merchantbancarioId; + } + + public MerchantBancario(Integer merchantbancarioId, Boolean activo) { + this.merchantbancarioId = merchantbancarioId; + this.activo = activo; + } + + public Integer getMerchantbancarioId() { + return merchantbancarioId; + } + + public void setMerchantbancarioId(Integer merchantbancarioId) { + this.merchantbancarioId = merchantbancarioId; + } + + public String getCvemerchant() { + return cvemerchant; + } + + public void setCvemerchant(String cvemerchant) { + this.cvemerchant = cvemerchant; + } + + public String getDescmerchant() { + return descmerchant; + } + + public void setDescmerchant(String descmerchant) { + this.descmerchant = descmerchant; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public CompaniaBancaria getCompaniaBancaria() { + return companiaBancaria; + } + + public void setCompaniaBancaria(CompaniaBancaria companiaBancaria) { + this.companiaBancaria = companiaBancaria; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final MerchantBancario other = (MerchantBancario) obj; + if ((this.cvemerchant == null) ? (other.cvemerchant != null) : !this.cvemerchant.equals(other.cvemerchant)) { + return false; + } + if ((this.descmerchant == null) ? (other.descmerchant != null) : !this.descmerchant.equals(other.descmerchant)) { + return false; + } + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 53 * hash + (this.cvemerchant != null ? this.cvemerchant.hashCode() : 0); + hash = 53 * hash + (this.descmerchant != null ? this.descmerchant.hashCode() : 0); + hash = 53 * hash + (this.activo != null ? this.activo.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.MerchantBancario[merchantbancarioId=" + merchantbancarioId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Moneda.java b/src/com/rjconsultores/ventaboletos/entidad/Moneda.java new file mode 100644 index 000000000..7ee10ee63 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Moneda.java @@ -0,0 +1,159 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "MONEDA_SEQ", sequenceName = "MONEDA_SEQ", allocationSize = 1) +@Table(name = "MONEDA") +public class Moneda implements Serializable { + + public final static Integer MONEDA_REAL_ID = 1; + @OneToMany(mappedBy = "moneda") + private List tarifaHistList; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MONEDA_SEQ") + @Column(name = "MONEDA_ID") + private Integer monedaId; + @Column(name = "DESCMONEDA") + private String descmoneda; + @Column(name = "SIMBOLO") + private String simbolo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "moneda") + private List puntoVentaList; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + + public Moneda() { + } + + public Moneda(Integer monedaId) { + this.monedaId = monedaId; + } + + public Integer getMonedaId() { + return monedaId; + } + + public void setMonedaId(Integer monedaId) { + this.monedaId = monedaId; + } + + public String getDescmoneda() { + return descmoneda; + } + + public void setDescmoneda(String descmoneda) { + this.descmoneda = descmoneda; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPuntoVentaList() { + return puntoVentaList; + } + + public void setPuntoVentaList(List puntoVentaList) { + this.puntoVentaList = puntoVentaList; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (monedaId != null ? monedaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Moneda)) { + return false; + } + Moneda other = (Moneda) object; + if ((this.monedaId == null && other.monedaId != null) || (this.monedaId != null && !this.monedaId.equals(other.monedaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescmoneda(); + } + + public List getTarifaHistList() { + return tarifaHistList; + } + + public void setTarifaHistList(List tarifaHistList) { + this.tarifaHistList = tarifaHistList; + } + + public String getSimbolo() { + return simbolo; + } + + public void setSimbolo(String simbolo) { + this.simbolo = simbolo; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCF.java b/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCF.java new file mode 100644 index 000000000..d3585e452 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCF.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "MONITORAMENTO_CCF_SEQ", sequenceName = "MONITORAMENTO_CCF_SEQ", allocationSize = 1) +@Table(name = "MONITORAMENTO_CCF") +public class MonitoramentoCCF { + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MONITORAMENTO_CCF_SEQ") + @Column(name = "MONITORAMENTOCCF_ID") + private Integer monitoramentoCcfId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "UF_INSTALACAO", referencedColumnName = "ESTADO_ID") + @ManyToOne + private Estado estadoInstalacao; + @JoinColumn(name = "FISCALIMPRESSORA_ID", referencedColumnName = "FISCALIMPRESSORA_ID") + @ManyToOne + private FiscalImpressora impressora; + @Column(name = "DATA_OCORRENCIA") + private Date dataOcorrencia; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventa; + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuario; + @Column(name = "SEQUENCIA_CCF_QUEBRADA") + private Integer sequenciaCCFQuebrada; + @Column(name = "DATA_MONITORAMENTO") + private Date dataMonitoramento; + @Column(name = "DIAS_ALERTA_ABERTO") + private Date diasAlertaAberto; + @Column(name = "REPROCESSADO") + private Boolean reprocessado; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + private Date fecmodif; + @JoinColumn(name = "USUARIOMODIF_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuarioModif; + + + public Integer getMonitoramentoCcfId() { + return monitoramentoCcfId; + } + public void setMonitoramentoCcfId(Integer monitoramentoCcfId) { + this.monitoramentoCcfId = monitoramentoCcfId; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Estado getEstadoInstalacao() { + return estadoInstalacao; + } + public void setEstadoInstalacao(Estado estadoInstalacao) { + this.estadoInstalacao = estadoInstalacao; + } + public Date getDataOcorrencia() { + return dataOcorrencia; + } + public void setDataOcorrencia(Date dataOcorrencia) { + this.dataOcorrencia = dataOcorrencia; + } + public PuntoVenta getPuntoventa() { + return puntoventa; + } + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + public Usuario getUsuario() { + return usuario; + } + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + public Integer getSequenciaCCFQuebrada() { + return sequenciaCCFQuebrada; + } + public void setSequenciaCCFQuebrada(Integer sequenciaCCFQuebrada) { + this.sequenciaCCFQuebrada = sequenciaCCFQuebrada; + } + public Date getDataMonitoramento() { + return dataMonitoramento; + } + public void setDataMonitoramento(Date dataMonitoramento) { + this.dataMonitoramento = dataMonitoramento; + } + public Date getDiasAlertaAberto() { + return diasAlertaAberto; + } + public void setDiasAlertaAberto(Date diasAlertaAberto) { + this.diasAlertaAberto = diasAlertaAberto; + } + public Boolean getReprocessado() { + return reprocessado; + } + public void setReprocessado(Boolean reprocessado) { + this.reprocessado = reprocessado; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Usuario getUsuarioModif() { + return usuarioModif; + } + public void setUsuarioModif(Usuario usuarioModif) { + this.usuarioModif = usuarioModif; + } + public FiscalImpressora getImpressora() { + return impressora; + } + public void setImpressora(FiscalImpressora impressora) { + this.impressora = impressora; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCFR2.java b/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCFR2.java new file mode 100644 index 000000000..7cc27a160 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCCFR2.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.entidad; + +public class MonitoramentoCCFR2 { + public Integer cooinicio; + public Integer coofim; + public String numserie20; + public Integer estadoId; + public Integer empresaId; + public Integer puntoventaId; + public Integer fiscalImpressoraId; +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCRZ.java b/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCRZ.java new file mode 100644 index 000000000..9739115b6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MonitoramentoCRZ.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "MONITORAMENTO_CRZ_SEQ", sequenceName = "MONITORAMENTO_CRZ_SEQ", allocationSize = 1) +@Table(name = "MONITORAMENTO_CRZ") +public class MonitoramentoCRZ { + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MONITORAMENTO_CRZ_SEQ") + @Column(name = "MONITORAMENTOCRZ_ID") + private Integer monitoramentoCrzId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "UF_INSTALACAO", referencedColumnName = "ESTADO_ID") + @ManyToOne + private Estado estadoInstalacao; + @JoinColumn(name = "FISCALIMPRESSORA_ID", referencedColumnName = "FISCALIMPRESSORA_ID") + @ManyToOne + private FiscalImpressora impressora; + @Column(name = "DATA_REDUCAOZ_FALTANTE") + private Date dataReducaoZFaltante; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventa; + @JoinColumn(name = "ULTIMO_USUARIO_ECF_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario ultimoUsuarioECF; + @Column(name = "SEQUENCIA_CRZ_QUEBRADA") + private Integer sequenciaCRZQuebrada; + @Column(name = "DATA_MONITORAMENTO") + private Date dataMonitoramento; + @Column(name = "DIAS_ALERTA_ABERTO") + private Date diasAlertaAberto; + @Column(name = "REPROCESSADO") + private Boolean reprocessado; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + private Date fecmodif; + @JoinColumn(name = "USUARIOMODIF_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuarioModif; + + public Integer getMonitoramentoCrzId() { + return monitoramentoCrzId; + } + public void setMonitoramentoCrzId(Integer monitoramentoCrzId) { + this.monitoramentoCrzId = monitoramentoCrzId; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Estado getEstadoInstalacao() { + return estadoInstalacao; + } + public void setEstadoInstalacao(Estado estadoInstalacao) { + this.estadoInstalacao = estadoInstalacao; + } + public Date getDataReducaoZFaltante() { + return dataReducaoZFaltante; + } + public void setDataReducaoZFaltante(Date dataReducaoZFaltante) { + this.dataReducaoZFaltante = dataReducaoZFaltante; + } + public PuntoVenta getPuntoventa() { + return puntoventa; + } + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + public Usuario getUltimoUsuarioECF() { + return ultimoUsuarioECF; + } + public void setUltimoUsuarioECF(Usuario ultimoUsuarioECF) { + this.ultimoUsuarioECF = ultimoUsuarioECF; + } + public Integer getSequenciaCRZQuebrada() { + return sequenciaCRZQuebrada; + } + public void setSequenciaCRZQuebrada(Integer sequenciaCRZQuebrada) { + this.sequenciaCRZQuebrada = sequenciaCRZQuebrada; + } + public Date getDataMonitoramento() { + return dataMonitoramento; + } + public void setDataMonitoramento(Date dataMonitoramento) { + this.dataMonitoramento = dataMonitoramento; + } + public Date getDiasAlertaAberto() { + return diasAlertaAberto; + } + public void setDiasAlertaAberto(Date diasAlertaAberto) { + this.diasAlertaAberto = diasAlertaAberto; + } + public Boolean getReprocessado() { + return reprocessado; + } + public void setReprocessado(Boolean reprocessado) { + this.reprocessado = reprocessado; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Usuario getUsuarioModif() { + return usuarioModif; + } + public void setUsuarioModif(Usuario usuarioModif) { + this.usuarioModif = usuarioModif; + } + public FiscalImpressora getImpressora() { + return impressora; + } + public void setImpressora(FiscalImpressora impressora) { + this.impressora = impressora; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MotivoCancelVendaPacote.java b/src/com/rjconsultores/ventaboletos/entidad/MotivoCancelVendaPacote.java new file mode 100644 index 000000000..d47c71c03 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MotivoCancelVendaPacote.java @@ -0,0 +1,149 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Bruno + */ +@Entity +@SequenceGenerator(name = "MOTIVO_CANCEL_VENDA_PACOTE_SEQ", sequenceName = "MOTIVO_CANCEL_VENDA_PACOTE_SEQ", allocationSize = 1) +@Table(name = "MOTIVO_CANCEL_VENDA_PACOTE") +public class MotivoCancelVendaPacote implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MOTIVO_CANCEL_VENDA_PACOTE_SEQ") + @Column(name = "MOTIVOCANCELVENDAPACOTE_ID") + private Integer motivocancelvendapacoteId; + @Column(name = "DESCMOTIVOCANCEL") + private String descmotivocancel; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "TIPOMOTIVOCANCEL") + private String tipomotivocancel; + + @Column(name="PORCMULTA") + private BigDecimal porcmulta; + + + public MotivoCancelVendaPacote() { + } + + + public Integer getMotivocancelvendapacoteId() { + return motivocancelvendapacoteId; + } + + + public void setMotivocancelvendapacoteId(Integer motivocancelvendapacoteId) { + this.motivocancelvendapacoteId = motivocancelvendapacoteId; + } + + + public String getDescmotivocancel() { + return descmotivocancel; + } + + + public void setDescmotivocancel(String descmotivocancel) { + this.descmotivocancel = descmotivocancel; + } + + + public Boolean getActivo() { + return activo; + } + + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + + public Date getFecmodif() { + return fecmodif; + } + + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + + public Integer getUsuarioId() { + return usuarioId; + } + + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + public String getTipomotivocancel() { + return tipomotivocancel; + } + + + public void setTipomotivocancel(String tipomotivocancel) { + this.tipomotivocancel = tipomotivocancel; + } + + public BigDecimal getPorcmulta() { + return porcmulta; + } + + + public void setPorcmulta(BigDecimal porcmulta) { + this.porcmulta = porcmulta; + } + + + @Override + public int hashCode() { + int hash = 0; + hash += (motivocancelvendapacoteId != null ? motivocancelvendapacoteId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MotivoCancelVendaPacote)) { + return false; + } + MotivoCancelVendaPacote other = (MotivoCancelVendaPacote) object; + if ((this.motivocancelvendapacoteId == null && other.motivocancelvendapacoteId != null) || (this.motivocancelvendapacoteId != null && !this.motivocancelvendapacoteId.equals(other.motivocancelvendapacoteId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescmotivocancel(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MotivoCancelacion.java b/src/com/rjconsultores/ventaboletos/entidad/MotivoCancelacion.java new file mode 100644 index 000000000..1914e7433 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MotivoCancelacion.java @@ -0,0 +1,156 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "MOTIVO_CANCELACION_SEQ", sequenceName = "MOTIVO_CANCELACION_SEQ", allocationSize = 1) +@Table(name = "MOTIVO_CANCELACION") +public class MotivoCancelacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MOTIVO_CANCELACION_SEQ") + @Column(name = "MOTIVOCANCELACION_ID") + private Integer motivocancelacionId; + @Column(name = "DESCMOTIVO") + private String descmotivo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "TIPOMOTIVO") + private String tipomotivo; + @Column(name = "TXTRELATORIO") + private String txtRelatorio; + @Column(name="CVESISTEMA") + private String cveSistema; + @Column(name="INDEXIBECANCEL") + private Boolean indexibecancel; + + public MotivoCancelacion() { + } + + public MotivoCancelacion(Integer motivocancelacionId) { + this.motivocancelacionId = motivocancelacionId; + } + + public Integer getMotivocancelacionId() { + return motivocancelacionId; + } + + public void setMotivocancelacionId(Integer motivocancelacionId) { + this.motivocancelacionId = motivocancelacionId; + } + + public String getDescmotivo() { + return descmotivo; + } + + public void setDescmotivo(String descmotivo) { + this.descmotivo = descmotivo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getTipomotivo() { + return tipomotivo; + } + + public void setTipomotivo(String tipomotivo) { + this.tipomotivo = tipomotivo; + } + + public String getTxtRelatorio() { + return txtRelatorio; + } + + public void setTxtRelatorio(String txtRelatorio) { + this.txtRelatorio = txtRelatorio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (motivocancelacionId != null ? motivocancelacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MotivoCancelacion)) { + return false; + } + MotivoCancelacion other = (MotivoCancelacion) object; + if ((this.motivocancelacionId == null && other.motivocancelacionId != null) || (this.motivocancelacionId != null && !this.motivocancelacionId.equals(other.motivocancelacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescmotivo(); + } + + public String getCveSistema() { + return cveSistema; + } + + public void setCveSistema(String cveSistema) { + this.cveSistema = cveSistema; + } + + public Boolean getIndexibecancel() { + return indexibecancel; + } + + public void setIndexibecancel(Boolean indexibecancel) { + this.indexibecancel = indexibecancel; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MotivoDevolucaoBilhete.java b/src/com/rjconsultores/ventaboletos/entidad/MotivoDevolucaoBilhete.java new file mode 100644 index 000000000..6f890e668 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MotivoDevolucaoBilhete.java @@ -0,0 +1,134 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Bruno Neves + */ +/** + * @author Bruno + * + */ +@Entity +@SequenceGenerator(name = "MOTIVO_DEVOLUCAO_BILHETE_SEQ", sequenceName = "MOTIVO_DEVOLUCAO_BILHETE_SEQ", allocationSize = 1) +@Table(name = "MOTIVO_DEVOLUCAO_BILHETE") +public class MotivoDevolucaoBilhete implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MOTIVO_DEVOLUCAO_BILHETE_SEQ") + @Column(name = "MOTIVODEVOLUCAOBILHETE_ID") + private Integer motivodevolucaobilheteId; + @Column(name = "DESCMOTIVO") + private String descmotivo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + + public MotivoDevolucaoBilhete() { + } + + + public Integer getMotivodevolucaobilheteId() { + return motivodevolucaobilheteId; + } + + + public void setMotivodevolucaobilheteId(Integer motivodevolucaobilheteId) { + this.motivodevolucaobilheteId = motivodevolucaobilheteId; + } + + + public String getDescmotivo() { + return descmotivo; + } + + + public void setDescmotivo(String descmotivo) { + this.descmotivo = descmotivo; + } + + + public Boolean getActivo() { + return activo; + } + + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + + public Date getFecmodif() { + return fecmodif; + } + + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + + public Integer getUsuarioId() { + return usuarioId; + } + + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((motivodevolucaobilheteId == null) ? 0 : motivodevolucaobilheteId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + MotivoDevolucaoBilhete other = (MotivoDevolucaoBilhete) obj; + if (motivodevolucaobilheteId == null) { + if (other.motivodevolucaobilheteId != null) + return false; + } else if (!motivodevolucaobilheteId.equals(other.motivodevolucaobilheteId)) + return false; + return true; + } + + @Override + public String toString() { + return "MotivoDevolucaoBilhete [motivodevolucaobilheteId=" + motivodevolucaobilheteId + ", descmotivo=" + descmotivo + "]"; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MotivoReimpresion.java b/src/com/rjconsultores/ventaboletos/entidad/MotivoReimpresion.java new file mode 100644 index 000000000..18347ba7d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MotivoReimpresion.java @@ -0,0 +1,122 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "MOTIVO_REIMPRESION_SEQ", sequenceName = "MOTIVO_REIMPRESION_SEQ", allocationSize=1) +@Table(name = "MOTIVO_REIMPRESION") +public class MotivoReimpresion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MOTIVO_REIMPRESION_SEQ") + @Column(name = "MOTIVOREIMPRESION_ID") + private Integer motivoreimpresionId; + @Column(name = "DESCMOTIVO") + private String descmotivo; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public MotivoReimpresion() { + } + + public MotivoReimpresion(Integer motivoreimpresionId) { + this.motivoreimpresionId = motivoreimpresionId; + } + + public MotivoReimpresion(Integer motivoreimpresionId, Date fecmodif) { + this.motivoreimpresionId = motivoreimpresionId; + this.fecmodif = fecmodif; + } + + public Integer getMotivoreimpresionId() { + return motivoreimpresionId; + } + + public void setMotivoreimpresionId(Integer motivoreimpresionId) { + this.motivoreimpresionId = motivoreimpresionId; + } + + public String getDescmotivo() { + return descmotivo; + } + + public void setDescmotivo(String descmotivo) { + this.descmotivo = descmotivo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (motivoreimpresionId != null ? motivoreimpresionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MotivoReimpresion)) { + return false; + } + MotivoReimpresion other = (MotivoReimpresion) object; + if ((this.motivoreimpresionId == null && other.motivoreimpresionId != null) || (this.motivoreimpresionId != null && !this.motivoreimpresionId.equals(other.motivoreimpresionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.MotivoReimpresion[motivoreimpresionId=" + motivoreimpresionId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MotivoViaje.java b/src/com/rjconsultores/ventaboletos/entidad/MotivoViaje.java new file mode 100644 index 000000000..db7d21459 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MotivoViaje.java @@ -0,0 +1,132 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "MOTIVO_VIAJE_SEQ", sequenceName = "MOTIVO_VIAJE_SEQ", allocationSize = 1) +@Table(name = "MOTIVO_VIAJE") +public class MotivoViaje implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MOTIVO_VIAJE_SEQ") + @Column(name = "MOTIVOVIAJE_ID") + private Integer motivoViajeId; + @Column(name = "CVEMOTIVOVIAJE") + private String cveMotivoViaje; + @Column(name = "DESCMOTIVOVIAJE") + private String descMotivoViaje; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "motivoViaje") + private List cortesiaList; + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public List getCortesiaList() { + return cortesiaList; + } + + public void setCortesiaList(List cortesiaList) { + this.cortesiaList = cortesiaList; + } + + public String getCveMotivoViaje() { + return cveMotivoViaje; + } + + public void setCveMotivoViaje(String cveMotivoViaje) { + this.cveMotivoViaje = cveMotivoViaje; + } + + public String getDescMotivoViaje() { + return descMotivoViaje; + } + + public void setDescMotivoViaje(String descMotivoViaje) { + this.descMotivoViaje = descMotivoViaje; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getMotivoViajeId() { + return motivoViajeId; + } + + public void setMotivoViajeId(Integer motivoViajeId) { + this.motivoViajeId = motivoViajeId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (motivoViajeId != null ? motivoViajeId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MotivoViaje)) { + return false; + } + MotivoViaje other = (MotivoViaje) object; + if ((this.motivoViajeId == null && other.motivoViajeId != null) || (this.motivoViajeId != null && !this.motivoViajeId.equals(other.motivoViajeId))) { + return false; + } + return true; + } + + @Override + public String toString() { + //return "com.rjconsultores.ventaboletos.entidad.GrupoCortesias[grupocortesiaId=" + grupocortesiaId + "]"; + return this.getDescMotivoViaje(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/MotivocancelacionEquivalencia.java b/src/com/rjconsultores/ventaboletos/entidad/MotivocancelacionEquivalencia.java new file mode 100644 index 000000000..0ecf7665f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/MotivocancelacionEquivalencia.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "MOTIVOCANC_EQUIVALENCIA_SEQ", sequenceName = "MOTIVOCANC_EQUIVALENCIA_SEQ", allocationSize = 1) +@Table(name = "MOTIVOCANCELACION_EQUIVALENCIA") +public class MotivocancelacionEquivalencia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "MOTIVOCANC_EQUIVALENCIA_SEQ") + @Basic(optional = false) + @Column(name = "MOTIVOEQUIVALENCIA_ID") + private Integer motivoequivalenciaId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "MOTIVOCANCELACION_ID") + private MotivoCancelacion motivoCancelacion; + @OneToOne + @JoinColumn(name = "COMISIONISTAEXTERNO_ID") + private ComisionistaExterno comisionistaExterno; + + public MotivocancelacionEquivalencia() { + } + + public MotivocancelacionEquivalencia(Integer motivoequivalenciaId) { + this.motivoequivalenciaId = motivoequivalenciaId; + } + + public Integer getMotivoequivalenciaId() { + return motivoequivalenciaId; + } + + public void setMotivoequivalenciaId(Integer motivoequivalenciaId) { + this.motivoequivalenciaId = motivoequivalenciaId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ComisionistaExterno getComisionistaExterno() { + return comisionistaExterno; + } + + public void setComisionistaExterno(ComisionistaExterno comisionistaExterno) { + this.comisionistaExterno = comisionistaExterno; + } + + public MotivoCancelacion getMotivoCancelacion() { + return motivoCancelacion; + } + + public void setMotivoCancelacion(MotivoCancelacion motivoCancelacion) { + this.motivoCancelacion = motivoCancelacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (motivoequivalenciaId != null ? motivoequivalenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof MotivocancelacionEquivalencia)) { + return false; + } + MotivocancelacionEquivalencia other = (MotivocancelacionEquivalencia) object; + if ((this.motivoequivalenciaId == null && other.motivoequivalenciaId != null) || (this.motivoequivalenciaId != null && !this.motivoequivalenciaId.equals(other.motivoequivalenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.MotivocancelacionEquivalencia[ motivoequivalenciaId=" + motivoequivalenciaId + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Nodo.java b/src/com/rjconsultores/ventaboletos/entidad/Nodo.java new file mode 100644 index 000000000..4959b2455 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Nodo.java @@ -0,0 +1,137 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "NODO_SEQ", sequenceName = "NODO_SEQ", allocationSize=1) +@Table(name = "NODO") +public class Nodo implements Serializable { + public static final Integer NODO_ID_CENTRAL = 1; + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "NODO_SEQ") + @Basic(optional = false) + @Column(name = "NODO_ID") + private Integer nodoId; + @Column(name = "DESCNODO") + private String descnodo; + @Column(name = "INDCONTINGENCIA") + private Short indcontingencia; + @Column(name = "DIRECCIONNODO") + private String direccionnodo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Nodo() { + } + + public Nodo(Integer nodoId) { + this.nodoId = nodoId; + } + + public Integer getNodoId() { + return nodoId; + } + + public void setNodoId(Integer nodoId) { + this.nodoId = nodoId; + } + + public String getDescnodo() { + return descnodo; + } + + public void setDescnodo(String descnodo) { + this.descnodo = descnodo; + } + + public Short getIndcontingencia() { + return indcontingencia; + } + + public void setIndcontingencia(Short indcontingencia) { + this.indcontingencia = indcontingencia; + } + + public String getDireccionnodo() { + return direccionnodo; + } + + public void setDireccionnodo(String direccionnodo) { + this.direccionnodo = direccionnodo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (nodoId != null ? nodoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Nodo)) { + return false; + } + Nodo other = (Nodo) object; + if ((this.nodoId == null && other.nodoId != null) || (this.nodoId != null && !this.nodoId.equals(other.nodoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDescnodo(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/NotaCreditoVendaPacote.java b/src/com/rjconsultores/ventaboletos/entidad/NotaCreditoVendaPacote.java new file mode 100644 index 000000000..e7fe2f58d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/NotaCreditoVendaPacote.java @@ -0,0 +1,220 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "NOTA_CREDITO_VENDA_PACOTE", schema = "VTABOL") +public class NotaCreditoVendaPacote implements java.io.Serializable { + + private static final long serialVersionUID = -4838838474645281215L; + + @Id + @Column(name = "NOTACREDITOVENDAPACOTE_ID", unique = true, nullable = false, precision = 7, scale = 0) + private Long notaCreditoVendaPacoteId; + + @Column(name = "MOTIVOCANCELVENDAPACOTE_ID", precision = 7, scale = 0) + private Integer motivocancelvendapacoteId; + + @ManyToOne + @JoinColumn(name = "VENDAPACOTECANCELAMENTO_ID") + private VendaPacote vendapacotecancelamento; + + @ManyToOne + @JoinColumn(name = "VENDAPACOTEPAGAMENTO_ID") + private VendaPacote vendapacotepagamento; + + @Temporal(TemporalType.DATE) + @Column(name = "DATAPAGAMENTO", length = 7) + private Date datapagamento; + + @Column(name = "VALOR", nullable = false, precision = 7) + private BigDecimal valor; + + @Column(name = "SITUACAO", nullable = false, precision = 1, scale = 0) + private Integer situacao; + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + private Integer usuarioId; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", nullable = false, length = 7) + private Date fecmodif; + + @Column(name = "ACTIVO", nullable = false, precision = 1, scale = 0) + private Boolean activo; + + @Column(name = "SALDO_PAGAR", precision = 7) + private BigDecimal saldoPagar; + + @Column(name = "PUNTOVENTA_ID", precision = 7, scale = 0) + private Integer puntoventaId; + + @Column(name = "PUNTOVENTAPAGAMENTO_ID", precision = 7, scale = 0) + private Integer puntoventapagamentoId; + + @Column(name = "USUARIOPAGAMENTO_ID", precision = 7, scale = 0) + private Integer usuariopagamentoId; + + @Temporal(TemporalType.DATE) + @Column(name = "DATANOTACREDITO", length = 7) + private Date datanotacredito; + + @OneToMany(mappedBy = "notaCreditoVendaPacote") + private List cajaDiversosList; + + @OneToMany(mappedBy = "notaCreditoVendaPacote") + private List ocdDatosPagamentoList; + + public Long getNotaCreditoVendaPacoteId() { + return notaCreditoVendaPacoteId; + } + + public void setNotaCreditoVendaPacoteId(Long notaCreditoVendaPacoteId) { + this.notaCreditoVendaPacoteId = notaCreditoVendaPacoteId; + } + + public Integer getMotivocancelvendapacoteId() { + return motivocancelvendapacoteId; + } + + public void setMotivocancelvendapacoteId(Integer motivocancelvendapacoteId) { + this.motivocancelvendapacoteId = motivocancelvendapacoteId; + } + + public Date getDatapagamento() { + return datapagamento; + } + + public void setDatapagamento(Date datapagamento) { + this.datapagamento = datapagamento; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public Integer isSituacao() { + return situacao; + } + + public void setSituacao(Integer situacao) { + this.situacao = situacao; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public BigDecimal getSaldoPagar() { + return saldoPagar; + } + + public void setSaldoPagar(BigDecimal saldoPagar) { + this.saldoPagar = saldoPagar; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Integer getPuntoventapagamentoId() { + return puntoventapagamentoId; + } + + public void setPuntoventapagamentoId(Integer puntoventapagamentoId) { + this.puntoventapagamentoId = puntoventapagamentoId; + } + + public Integer getUsuariopagamentoId() { + return usuariopagamentoId; + } + + public void setUsuariopagamentoId(Integer usuariopagamentoId) { + this.usuariopagamentoId = usuariopagamentoId; + } + + public Date getDatanotacredito() { + return datanotacredito; + } + + public void setDatanotacredito(Date datanotacredito) { + this.datanotacredito = datanotacredito; + } + + public List getCajaDiversosList() { + return cajaDiversosList; + } + + public void setCajaDiversosList(List cajaDiversos) { + this.cajaDiversosList = cajaDiversos; + } + + public List getOcdDatosPagamentoList() { + return ocdDatosPagamentoList; + } + + public void setOcdDatosPagamentoList(List ocdDatosPagamentos) { + this.ocdDatosPagamentoList = ocdDatosPagamentos; + } + + public Integer getSituacao() { + return situacao; + } + + public VendaPacote getVendapacotecancelamento() { + return vendapacotecancelamento; + } + + public void setVendapacotecancelamento(VendaPacote vendapacotecancelamento) { + this.vendapacotecancelamento = vendapacotecancelamento; + } + + public VendaPacote getVendapacotepagamento() { + return vendapacotepagamento; + } + + public void setVendapacotepagamento(VendaPacote vendapacotepagamento) { + this.vendapacotepagamento = vendapacotepagamento; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/OCD.java b/src/com/rjconsultores/ventaboletos/entidad/OCD.java new file mode 100644 index 000000000..75ace6215 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/OCD.java @@ -0,0 +1,334 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "OCD") +public class OCD implements java.io.Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @SequenceGenerator(name = "OCD_SEQ", sequenceName = "OCD_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "OCD_SEQ") + @Column(name = "OCD_ID", unique = true, nullable = false, precision = 15, scale = 0) + private Long ocdId; + + @JoinColumn(name = "BOLETO_ID") + @ManyToOne(fetch = FetchType.LAZY) + private Boleto boleto; + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + + @Column(name = "NUMTARJETA",length=16) + private String numtarjeta; + @Column(name = "NUMAUTORIZACION",length=15) + private String numautorizacion; + @Column(name = "NSU",length=6) + private String nsu; + + @Column(name = "NUMOPERACION", length = 36) + private String numoperacion; + + @Temporal(TemporalType.DATE) + @Column(name = "FECPAGAR", length = 7) + private Date fecpagar; + @Column(name = "VALOR_PAGAR", precision = 7, scale = 2) + private BigDecimal valorPagar; + @Column(name = "SALDO_PAGAR", precision = 7, scale = 2) + private BigDecimal saldoPagar; + @Column(name = "VALOR_TARJETA", precision = 7, scale = 2) + private BigDecimal valorTarjeta; + @Column(name = "PENALIZACION", precision = 7, scale = 2) + private BigDecimal penalizacion; + + @Column(name = "USUARIOINC_ID", precision = 7, scale = 0) + private Integer usuarioIncId; + @Temporal(TemporalType.DATE) + @Column(name = "FECINC", length = 7) + private Date fecinc; + + @Column(name = "INDPAGO", precision = 1, scale = 0) + private Boolean indpago; + @Column(name = "USUARIOPAGO_ID", precision = 7, scale = 0) + private Integer usuarioPagoId; + @Temporal(TemporalType.DATE) + @Column(name = "FECPAGO", length = 7) + private Date fecpago; + @JoinColumn(name = "PUNTOVENTAPAGO_ID") + @ManyToOne + private PuntoVenta puntoVentaPago; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + private Date fecmodif; + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + private Integer usuarioId; + @Column(name = "ACTIVO", precision = 1, scale = 0) + private Boolean activo; + + @OneToMany(mappedBy = "ocd") + private List ocdDatosPagamentos; + + public OCD(){ + + } + + public OCD(Long ocdId, Boleto boleto, PuntoVenta puntoVenta, + String numoperacion, Date fecpagar, BigDecimal valorPagar, + BigDecimal penalizacion, Integer usuarioIncId, Date fecinc, + Boolean indpago, Integer usuarioPagoId, Date fecpago, + PuntoVenta puntoVentaPago, Date fecmodif, Integer usuarioId, + Boolean activo) { + super(); + this.ocdId = ocdId; + this.boleto = boleto; + this.puntoVenta = puntoVenta; + this.numoperacion = numoperacion; + this.fecpagar = fecpagar; + this.valorPagar = valorPagar; + this.penalizacion = penalizacion; + this.usuarioIncId = usuarioIncId; + this.fecinc = fecinc; + this.indpago = indpago; + this.usuarioPagoId = usuarioPagoId; + this.fecpago = fecpago; + this.puntoVentaPago = puntoVentaPago; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.activo = activo; + } + + + public OCD(Long ocdId, Boleto boleto, PuntoVenta puntoVenta, + String numoperacion, Date fecpagar, BigDecimal valorPagar, + BigDecimal penalizacion, Integer usuarioIncId) { + super(); + this.ocdId = ocdId; + this.boleto = boleto; + this.puntoVenta = puntoVenta; + this.numoperacion = numoperacion; + this.fecpagar = fecpagar; + this.valorPagar = valorPagar; + this.penalizacion = penalizacion; + this.usuarioIncId = usuarioIncId; + + this.fecinc = new Date(); + this.indpago = Boolean.FALSE; + + this.fecmodif = new Date(); + this.usuarioId = usuarioIncId; + this.activo = Boolean.TRUE; + } + + public Long getOcdId() { + return ocdId; + } + public void setOcdId(Long ocdId) { + this.ocdId = ocdId; + } + + public String getNumoperacion() { + return numoperacion; + } + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public Date getFecpagar() { + return fecpagar; + } + public void setFecpagar(Date fecpagar) { + this.fecpagar = fecpagar; + } + + public BigDecimal getValorPagar() { + return valorPagar; + } + public void setValorPagar(BigDecimal valorPagar) { + this.valorPagar = valorPagar; + } + + public BigDecimal getPenalizacion() { + return penalizacion; + } + public void setPenalizacion(BigDecimal penalizacion) { + this.penalizacion = penalizacion; + } + + public Integer getUsuarioIncId() { + return usuarioIncId; + } + public void setUsuarioIncId(Integer usuarioIncId) { + this.usuarioIncId = usuarioIncId; + } + + public Date getFecinc() { + return fecinc; + } + public void setFecinc(Date fecinc) { + this.fecinc = fecinc; + } + + public Boolean getIndpago() { + return indpago; + } + public void setIndpago(Boolean indpago) { + this.indpago = indpago; + } + + public Integer getUsuarioPagoId() { + return usuarioPagoId; + } + public void setUsuarioPagoId(Integer usuarioPagoId) { + this.usuarioPagoId = usuarioPagoId; + } + + public Date getFecpago() { + return fecpago; + } + public void setFecpago(Date fecpago) { + this.fecpago = fecpago; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public PuntoVenta getPuntoVentaPago() { + return puntoVentaPago; + } + + public void setPuntoVentaPago(PuntoVenta puntoVentaPago) { + this.puntoVentaPago = puntoVentaPago; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public String getNumtarjeta() { + return numtarjeta; + } + + public void setNumtarjeta(String numtarjeta) { + this.numtarjeta = numtarjeta; + } + public String getNumautorizacion() { + return numautorizacion; + } + + public void setNumautorizacion(String numautorizacion) { + this.numautorizacion = numautorizacion; + } + + public String getNsu() { + return nsu; + } + + public void setNsu(String nsu) { + this.nsu = nsu; + } + + public List getOcdDatosPagamentos() { + return ocdDatosPagamentos; + } + + public void setOcdDatosPagamentos(List ocdDatosPagamentos) { + this.ocdDatosPagamentos = ocdDatosPagamentos; + } + + public BigDecimal getSaldoPagar() { + return saldoPagar; + } + + public void setSaldoPagar(BigDecimal saldoPagar) { + this.saldoPagar = saldoPagar; + } + + public Boleto getBoleto() { + return boleto; + } + + public void setBoleto(Boleto boleto) { + this.boleto = boleto; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((ocdId == null) ? 0 : ocdId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + OCD other = (OCD) obj; + if (ocdId == null) { + if (other.ocdId != null) + return false; + } else if (!ocdId.equals(other.ocdId)) + return false; + return true; + } + + public BigDecimal getValorTarjeta() { + return valorTarjeta; + } + + public void setValorTarjeta(BigDecimal valorTarjeta) { + this.valorTarjeta = valorTarjeta; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/OCDDatosPagamento.java b/src/com/rjconsultores/ventaboletos/entidad/OCDDatosPagamento.java new file mode 100644 index 000000000..5f979eaa6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/OCDDatosPagamento.java @@ -0,0 +1,156 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; + +@Entity +@Table(name = "OCD_DATOS_PAGAMENTO") +public class OCDDatosPagamento implements Serializable { + + private static final long serialVersionUID = 4354050654434171301L; + + @Id + @Column(name = "OCDDATOSPAGAMENTO_ID") + private Integer ocdDatosPagamentoId; + + @ManyToOne + @JoinColumn(name = "OCD_ID") + private OCD ocd; + + @Column(name = "TITULARCUENTA") + private String titularcuenta; + + @Column(name = "IDENTIFICACION") + private String identificacion; + + @Column(name = "BANCO") + private String banco; + + @Column(name = "CUENTABANCO") + private String cuentabanco; + + @Column(name = "AGENCIA") + private String agencia; + + @Column(name = "EMAIL") + private String email; + + @Column(name = "TELEFONO") + private String telefono; + + @ManyToOne + @JoinColumn(name = "NOTACREDITOVENDAPACOTE_ID") + private NotaCreditoVendaPacote notaCreditoVendaPacote; + + public OCD getOcd() { + return ocd; + } + + public void setOcd(OCD ocd) { + this.ocd = ocd; + } + + public String getTitularcuenta() { + return titularcuenta; + } + + public void setTitularcuenta(String titularcuenta) { + this.titularcuenta = titularcuenta; + } + + public String getIdentificacion() { + return identificacion; + } + + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + + public String getBanco() { + return banco; + } + + public void setBanco(String banco) { + this.banco = banco; + } + + public String getCuentabanco() { + return cuentabanco; + } + + public void setCuentabanco(String cuentabanco) { + this.cuentabanco = cuentabanco; + } + + public String getAgencia() { + return agencia; + } + + public void setAgencia(String agencia) { + this.agencia = agencia; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getTelefono() { + return telefono; + } + + public void setTelefono(String telefono) { + this.telefono = telefono; + } + + public Integer getOcdDatosPagamentoId() { + return ocdDatosPagamentoId; + } + + public void setOcdDatosPagamentoId(Integer ocdDatosPagamentoId) { + this.ocdDatosPagamentoId = ocdDatosPagamentoId; + } + + public NotaCreditoVendaPacote getNotaCreditoVendaPacote() { + return notaCreditoVendaPacote; + } + + public void setNotaCreditoVendaPacote(NotaCreditoVendaPacote notaCreditoVendaPacote) { + this.notaCreditoVendaPacote = notaCreditoVendaPacote; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((ocdDatosPagamentoId == null) ? 0 : ocdDatosPagamentoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + OCDDatosPagamento other = (OCDDatosPagamento) obj; + if (ocdDatosPagamentoId == null) { + if (other.ocdDatosPagamentoId != null) + return false; + } else if (!ocdDatosPagamentoId.equals(other.ocdDatosPagamentoId)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java b/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java new file mode 100644 index 000000000..55a7d9b45 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java @@ -0,0 +1,268 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; + +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Entity +@Table(name = "OCD_PARAM") +public class OCDParam implements java.io.Serializable { + + + /** + * + */ + private static final long serialVersionUID = 1L; + private Long ocdparamId; + private BigDecimal penalizacion; + private Integer diasPagar; + private PuntoVenta puntoventa; + private Empresa empresa; + private Estado estado; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private Boolean indOCDDefault; + private Boolean indOCDTroca; + private Boolean indOCDTransferencia; + private Boolean indPenalizacionOCD; + private Boolean indOcdDinheiro; + private Boolean indtotalbilhete; + private Boolean indsempregerarapagar; + private BigDecimal tiempoLimitePenalizacion; + private List listOCDPtoVtaParam; + + public OCDParam(Long ocdparamId, BigDecimal penalizacion, + Integer diasPagar, PuntoVenta puntoventa, Empresa empresa, + Estado estado, Boolean activo, Date fecmodif, Integer usuarioId) { + super(); + this.ocdparamId = ocdparamId; + this.penalizacion = penalizacion; + this.diasPagar = diasPagar; + this.puntoventa = puntoventa; + this.empresa = empresa; + this.estado = estado; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public OCDParam() {/*...*/} + + @SequenceGenerator(name = "OCD_PARAM_SEQ", sequenceName = "OCD_PARAM_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "OCD_PARAM_SEQ") + @Column(name = "OCDPARAM_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getOcdparamId() { + return ocdparamId; + } + + public void setOcdparamId(Long ocdparamId) { + this.ocdparamId = ocdparamId; + } + + @Column(name = "PENALIZACION", length = 10) + public BigDecimal getPenalizacion() { + return penalizacion; + } + + public void setPenalizacion(BigDecimal penalizacion) { + this.penalizacion = penalizacion; + } + + @Column(name = "DIAS_PAGAR", length = 10) + public Integer getDiasPagar() { + return diasPagar; + } + + public void setDiasPagar(Integer diasPagar) { + this.diasPagar = diasPagar; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoventa() { + return puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + @JoinColumn(name = "EMPRESA_ID") + @ManyToOne + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @JoinColumn(name = "ESTADO_ID") + @ManyToOne + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Column(name = "INDOCDDEFAULT") + public Boolean getIndOCDDefault() { + return indOCDDefault; + } + + public void setIndOCDDefault(Boolean indOCDDefault) { + this.indOCDDefault = indOCDDefault; + } + + @Column(name = "INDOCDTROCA") + public Boolean getIndOCDTroca() { + return indOCDTroca; + } + + public void setIndOCDTroca(Boolean indOCDTroca) { + this.indOCDTroca = indOCDTroca; + } + + public Boolean getIndPenalizacionOCD() { + return indPenalizacionOCD; + } + + public void setIndPenalizacionOCD(Boolean indPenalizacionOCD) { + this.indPenalizacionOCD = indPenalizacionOCD; + } + + /** + * @return the indOcdDinheiro + */ + @Column(name = "INDOCDDINHEIRO") + public Boolean getIndOcdDinheiro() { + return indOcdDinheiro; + } + + /** + * @param indOcdDinheiro the indOcdDinheiro to set + */ + public void setIndOcdDinheiro(Boolean indOcdDinheiro) { + this.indOcdDinheiro = indOcdDinheiro; + } + @Column(name = "INDOCDTRANSFERENCIA") + public Boolean getIndOCDTransferencia() { + return indOCDTransferencia; + } + + public void setIndOCDTransferencia(Boolean indOCDTransferencia) { + this.indOCDTransferencia = indOCDTransferencia; + } + + @Column(name = "INDTOTALBILHETE") + public Boolean getIndtotalbilhete() { + return indtotalbilhete; + } + + public void setIndtotalbilhete(Boolean indtotalbilhete) { + this.indtotalbilhete = indtotalbilhete; + } + + @Column(name = "TIEMPOLIMITEPENALIZACION") + public BigDecimal getTiempoLimitePenalizacion() { + return tiempoLimitePenalizacion; + } + + public void setTiempoLimitePenalizacion(BigDecimal tiempoLimitePenalizacion) { + this.tiempoLimitePenalizacion = tiempoLimitePenalizacion; + } + + public OCDPtoVtaParam addOCDPtoVtaParam(OCDPtoVtaParam ocdPtoVtaParam) { + OCDPtoVtaParam ocd = new OCDPtoVtaParam(); + ocd.setPuntoventa(ocdPtoVtaParam.getPuntoventa()); + ocd.setOcdParam(ocdPtoVtaParam.getOcdParam()); + ocd.setActivo(Boolean.TRUE); + ocd.setFecmodif(Calendar.getInstance().getTime()); + ocd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + this.listOCDPtoVtaParam.add(ocd); + return ocd; + } + public void removePtovtaOCDParam(OCDPtoVtaParam ocdPtoVtaParam) { + this.listOCDPtoVtaParam.remove(ocdPtoVtaParam); + + } + + /** + * @return the listOCDPtoVtaParam + * + */ + @OneToMany(cascade = CascadeType.ALL, mappedBy = "ocdParam") + @LazyCollection(LazyCollectionOption.FALSE) + public List getListOCDPtoVtaParam() { + return listOCDPtoVtaParam; + } + + /** + * @param listOCDPtoVtaParam the listOCDPtoVtaParam to set + */ + public void setListOCDPtoVtaParam(List listOCDPtoVtaParam) { + this.listOCDPtoVtaParam = listOCDPtoVtaParam; + } + + @Column(name = "INDSEMPREGERARAPAGAR") + public Boolean getIndsempregerarapagar() { + return indsempregerarapagar; + } + + public void setIndsempregerarapagar(Boolean indsempregerarapagar) { + this.indsempregerarapagar = indsempregerarapagar; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/OCDPtoVtaParam.java b/src/com/rjconsultores/ventaboletos/entidad/OCDPtoVtaParam.java new file mode 100644 index 000000000..d5997df92 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/OCDPtoVtaParam.java @@ -0,0 +1,94 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * @author Thiago + * + */ +@Entity +@Table(name = "OCD_PTOVTA_PARAM") +public class OCDPtoVtaParam { + + private Long ocdPtoVtaParamId; + private OCDParam ocdParam; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private PuntoVenta puntoventa; + + @SequenceGenerator(name = "OCD_PTOVTA_PARAM_SEQ", sequenceName = "OCD_PTOVTA_PARAM_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "OCD_PTOVTA_PARAM_SEQ") + @Column(name = "OCDPTOVTAPARAM_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getOcdPtoVtaParamId() { + return ocdPtoVtaParamId; + } + + public void setOcdPtoVtaParamId(Long ocdPtoVtaParamId) { + this.ocdPtoVtaParamId = ocdPtoVtaParamId; + } + + @JoinColumn(name = "OCDPARAM_ID", referencedColumnName="OCDPARAM_ID") + @ManyToOne + public OCDParam getOcdParam() { + return ocdParam; + } + + public void setOcdParam(OCDParam ocdParam) { + this.ocdParam = ocdParam; + } + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoventa() { + return puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/OperadorEmbarcada.java b/src/com/rjconsultores/ventaboletos/entidad/OperadorEmbarcada.java new file mode 100644 index 000000000..76b1c1233 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/OperadorEmbarcada.java @@ -0,0 +1,141 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; +import org.hibernate.annotations.Where; + +@Entity +@Table(name = "OPERADOR_EMBARCADA") +@SequenceGenerator(name = "OPERADOR_EMBARCADA_SEQ", sequenceName = "OPERADOR_EMBARCADA_SEQ", allocationSize = 1) +public class OperadorEmbarcada implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "OPERADOR_EMBARCADA_SEQ") + @Column(name = "OPERADOR_EMBARCADA_ID") + private Long operadorEmbarcadaId; + + @OneToOne + @JoinColumn(name = "USUARIO_ID") + private Usuario usuario; + + @OneToMany(mappedBy = "operadorEmbarcada", cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @Fetch(FetchMode.SELECT) + @Where(clause="activo=1") + private List linhas; + + @OneToMany(mappedBy = "operadorEmbarcada", cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @Fetch(FetchMode.SELECT) + @Where(clause="activo=1") + private List servicos; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "ACTIVO") + private Boolean activo; + + public Long getOperadorEmbarcadaId() { + return operadorEmbarcadaId; + } + + public void setOperadorEmbarcadaId(Long operadorEmbarcadaId) { + this.operadorEmbarcadaId = operadorEmbarcadaId; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public List getLinhas() { + List tmp = new ArrayList(); + + if (linhas != null) { + for (OperadorEmbarcadaLinha es : linhas) { + if (es.getActivo()) { + tmp.add(es); + } + } + } + + return tmp; + } + + public void setLinhas(List linhas) { + this.linhas = linhas; + } + + public List getServicos() { + List tmp = new ArrayList(); + + if (servicos != null) { + for (OperadorEmbarcadaServico es : servicos) { + if (es.getActivo()) { + tmp.add(es); + } + } + } + + return tmp; + } + + public void setServicos(List servicos) { + this.servicos = servicos; + } + + public Boolean getActivo() { + return activo == null ? false : activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return this.usuario.getUsuarioId(); + } + + public String getUsername() { + return this.usuario.getClaveUsuario(); + } + + public String getName() { + return usuario.getName(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/OperadorEmbarcadaLinha.java b/src/com/rjconsultores/ventaboletos/entidad/OperadorEmbarcadaLinha.java new file mode 100644 index 000000000..c863de953 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/OperadorEmbarcadaLinha.java @@ -0,0 +1,73 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@Table(name = "OPERADOR_EMBARCADA_LINHA") +@SequenceGenerator(name = "OPERADOR_EMBARCADA_LINHA_SEQ", sequenceName = "OPERADOR_EMBARCADA_LINHA_SEQ", allocationSize = 1) +public class OperadorEmbarcadaLinha implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "OPERADOR_EMBARCADA_LINHA_SEQ") + @Column(name = "OPERADOR_EMBARCADA_LINHA_ID") + private Long operadorEmbarcadaLinhaId; + + @ManyToOne + @JoinColumn(name = "OPERADOR_EMBARCADA_ID", referencedColumnName = "OPERADOR_EMBARCADA_ID") + private OperadorEmbarcada operadorEmbarcada; + + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + + @Column(name = "ACTIVO") + private Boolean activo; + + public Long getOperadorEmbarcadaLinhaId() { + return operadorEmbarcadaLinhaId; + } + + public void setOperadorEmbarcadaLinhaId(Long operadorEmbarcadaLinhaId) { + this.operadorEmbarcadaLinhaId = operadorEmbarcadaLinhaId; + } + + public OperadorEmbarcada getOperadorEmbarcada() { + return operadorEmbarcada; + } + + public void setOperadorEmbarcada(OperadorEmbarcada operadorEmbarcada) { + this.operadorEmbarcada = operadorEmbarcada; + } + + public Boolean getActivo() { + return activo == null ? false : activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/OperadorEmbarcadaServico.java b/src/com/rjconsultores/ventaboletos/entidad/OperadorEmbarcadaServico.java new file mode 100644 index 000000000..849690273 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/OperadorEmbarcadaServico.java @@ -0,0 +1,73 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@Table(name = "OPERADOR_EMBARCADA_SERVICO") +@SequenceGenerator(name = "OPERADOR_EMBARCADA_SERVICO_SEQ", sequenceName = "OPERADOR_EMBARCADA_SERVICO_SEQ", allocationSize = 1) +public class OperadorEmbarcadaServico implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "OPERADOR_EMBARCADA_SERVICO_SEQ") + @Column(name = "OPERADOR_EMBARCADA_SERVICO_ID") + private Long operadorEmbarcadaServicoId; + + @ManyToOne + @JoinColumn(name = "OPERADOR_EMBARCADA_ID", referencedColumnName = "OPERADOR_EMBARCADA_ID") + private OperadorEmbarcada operadorEmbarcada; + + @OneToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "ESQUEMA_CORRIDA_ID") + private EsquemaCorrida corrida; + + @Column(name = "ACTIVO") + private Boolean activo; + + public Long getOperadorEmbarcadaServicoId() { + return operadorEmbarcadaServicoId; + } + + public void setOperadorEmbarcadaServicoId(Long operadorEmbarcadaServicoId) { + this.operadorEmbarcadaServicoId = operadorEmbarcadaServicoId; + } + + public OperadorEmbarcada getOperadorEmbarcada() { + return operadorEmbarcada; + } + + public void setOperadorEmbarcada(OperadorEmbarcada operadorEmbarcada) { + this.operadorEmbarcada = operadorEmbarcada; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public EsquemaCorrida getCorrida() { + return corrida; + } + + public void setCorrida(EsquemaCorrida corrida) { + this.corrida = corrida; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java new file mode 100644 index 000000000..a1dfc64e0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java @@ -0,0 +1,369 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "ORGAO_CANCELACION") +@SequenceGenerator(name = "ORGAO_CANCELACION_SEQ", sequenceName = "ORGAO_CANCELACION_SEQ", allocationSize = 1) +public class OrgaoCancelacion implements Serializable { + + private static final long serialVersionUID = 1L; + + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ORGAO_CANCELACION_SEQ") + @Column(name = "ORGAOCANCELACION_ID") + private Integer orgaoCancelacionId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgao; + @Column(name = "PORCMULTA") + private BigDecimal porcmulta; + @Column(name = "PORCCAMBIO") + private BigDecimal porccambio; + @Column(name = "PORCCAMBIOEMBARCADO") + private BigDecimal porcCambioEmbarcado; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "TIEMPOLIMITE") + private Integer tiempolimite; + + @Column(name = "TIEMPOLIMITE_MIN") + private Integer tiempolimiteMin; + + @Column(name = "TIEMPOLIMITECAMBIO") + private Integer tiempolimiteCambio; + + @Column(name = "TIEMPOLIMITECAMBIO_MIN") + private Integer tiempolimiteCambioMin; + + @Column(name = "INDNAOPERMITETRANSFERENCIA") + private Boolean indnaopermitetransferencia; + @Column(name = "INDSOLICITADATOSTARJETA") + private Boolean indSolicitaDatosTarjeta; + @Column(name = "INDMULTATRANSFERENCIA") + private Boolean indMultaTransferencia; + @Column(name = "INDDEVOLUCAOTRANSFERENCIA") + private Boolean indDevolucaoTransferencia; + @Column(name = "INDCOBRANCATRANSFERENCIA") + private Boolean indCobrancaTransferencia; + @Column(name = "INDORGAOCONCEDENTETRANSF") + private Boolean indOrgaoconcedentetransf; + @Column(name = "INDMULTADEVOLUCAOABERTO") + private Boolean indMultaDevolucaoAberto; + @Column(name = "INDPERMITEDEVTOTALRIOCARD") + private Boolean IndPermiteDevolucaoTotalRioCard; + @Column(name = "PORCCOMISSAOVENDA") + private BigDecimal porcMultaResolAgerba; + @Column(name = "QTDE_LIMITE_TRANSF_REAT") + private Integer qtdeLimiteTransfReat; + + @Column(name = "TEMPOLIMITE_APOS_SAIDA_H") + private Integer tempolimiteAposSaidaH; + + @Column(name = "TEMPOLIMITE_APOS_SAIDA_MIN") + private Integer tempolimiteAposSaidaMin; + + @Column(name = "TROCA_MESMO_DIA_ANTES_H") + private Integer trocaMesmoDiaAntesHora; + + @Column(name = "TROCA_MESMO_DIA_ANTES_MIN") + private Integer trocaMesmoDiaAntesMin; + + @Column(name = "TROCA_MESMO_DIA_APOS_H") + private Integer trocaMesmoDiaAposHora; + + @Column(name = "TROCA_MESMO_DIA_APOS_MIN") + private Integer trocaMesmoDiaAposMin; + + @Column(name = "TEMPO_TROCA_POLTRONA_H") + private Integer tempoTrocaPoltronaH; + + @Column(name = "TEMPO_TROCA_POLTRONA_MIN") + private Integer tempoTrocaPoltronaMin; + + @Column(name = "INDBLOQUEIOREMARCADO") + private Boolean indBloqueioRemarcado; + + public Integer getOrgaoCancelacionId() { + return orgaoCancelacionId; + } + public void setOrgaoCancelacionId(Integer orgaoCancelacionId) { + this.orgaoCancelacionId = orgaoCancelacionId; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public OrgaoConcedente getOrgao() { + return orgao; + } + public void setOrgao(OrgaoConcedente orgao) { + this.orgao = orgao; + } + public BigDecimal getPorcmulta() { + return porcmulta; + } + public void setPorcmulta(BigDecimal porcmulta) { + this.porcmulta = porcmulta; + } + public BigDecimal getPorccambio() { + return porccambio; + } + public void setPorccambio(BigDecimal porccambio) { + this.porccambio = porccambio; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Integer getTiempolimite() { + return tiempolimite; + } + public void setTiempolimite(Integer tiempolimite) { + this.tiempolimite = tiempolimite; + } + public Integer getTiempolimiteCambio() { + return tiempolimiteCambio; + } + public void setTiempolimiteCambio(Integer tiempolimiteCambio) { + this.tiempolimiteCambio = tiempolimiteCambio; + } + public Boolean getIndnaopermitetransferencia() { + return indnaopermitetransferencia; + } + public void setIndnaopermitetransferencia(Boolean indnaopermitetransferencia) { + this.indnaopermitetransferencia = indnaopermitetransferencia; + } + /** + * @return the porcCambioEmbarcado + */ + public BigDecimal getPorcCambioEmbarcado() { + return porcCambioEmbarcado; + } + /** + * @param porcCambioEmbarcado the porcCambioEmbarcado to set + */ + public void setPorcCambioEmbarcado(BigDecimal porcCambioEmbarcado) { + this.porcCambioEmbarcado = porcCambioEmbarcado; + } + public Boolean getIndSolicitaDatosTarjeta() { + return indSolicitaDatosTarjeta; + } + public void setIndSolicitaDatosTarjeta(Boolean indSolicitaDatosTarjeta) { + this.indSolicitaDatosTarjeta = indSolicitaDatosTarjeta; + } + + /** + * @return the indMultaTransferencia + */ + public Boolean getIndMultaTransferencia() { + return indMultaTransferencia; + } + + /** + * @param indMultaTransferencia + * the indMultaTransferencia to set + */ + public void setIndMultaTransferencia(Boolean indMultaTransferencia) { + this.indMultaTransferencia = indMultaTransferencia; + } + + /** + * @return the indDevolucaoTransferencia + */ + public Boolean getIndDevolucaoTransferencia() { + return indDevolucaoTransferencia; + } + + /** + * @param indDevolucaoTransferencia + * the indDevolucaoTransferencia to set + */ + public void setIndDevolucaoTransferencia(Boolean indDevolucaoTransferencia) { + this.indDevolucaoTransferencia = indDevolucaoTransferencia; + } + + /** + * @return the indCobrancaTransferencia + */ + public Boolean getIndCobrancaTransferencia() { + return indCobrancaTransferencia; + } + + /** + * @param indCobrancaTransferencia + * the indCobrancaTransferencia to set + */ + public void setIndCobrancaTransferencia(Boolean indCobrancaTransferencia) { + this.indCobrancaTransferencia = indCobrancaTransferencia; + } + + /** + * @return the indOrgaoconcedentetransf + */ + public Boolean getIndOrgaoconcedentetransf() { + return indOrgaoconcedentetransf; + } + + /** + * @param indOrgaoconcedentetransf + * the indOrgaoconcedentetransf to set + */ + public void setIndOrgaoconcedentetransf(Boolean indOrgaoconcedentetransf) { + this.indOrgaoconcedentetransf = indOrgaoconcedentetransf; + } + public Boolean getIndMultaDevolucaoAberto() { + return indMultaDevolucaoAberto; + } + public void setIndMultaDevolucaoAberto(Boolean indMultaDevolucaoAberto) { + this.indMultaDevolucaoAberto = indMultaDevolucaoAberto; + } + public Boolean getIndPermiteDevolucaoTotalRioCard() { + return IndPermiteDevolucaoTotalRioCard == null ? false : IndPermiteDevolucaoTotalRioCard; + } + public void setIndPermiteDevolucaoTotalRioCard(Boolean indPermiteDevolucaoTotalRioCard) { + IndPermiteDevolucaoTotalRioCard = indPermiteDevolucaoTotalRioCard; + } + public BigDecimal getPorcMultaResolAgerba() { + return porcMultaResolAgerba; + } + public void setPorcMultaResolAgerba(BigDecimal porMultaResolAgerba) { + this.porcMultaResolAgerba = porMultaResolAgerba; + } + + public Integer getQtdeLimiteTransfReat() { + return qtdeLimiteTransfReat; + } + public void setQtdeLimiteTransfReat(Integer qtdeLimiteTransfReat) { + this.qtdeLimiteTransfReat = qtdeLimiteTransfReat; + } + + public Integer getTiempolimiteMin() { + return tiempolimiteMin == null ? 0 : tiempolimiteMin; + } + + public void setTiempolimiteMin(Integer tiempolimiteMin) { + this.tiempolimiteMin = tiempolimiteMin; + } + + public Integer getTiempolimiteCambioMin() { + return tiempolimiteCambioMin == null ? 0 : tiempolimiteCambioMin; + } + + public void setTiempolimiteCambioMin(Integer tiempolimiteCambioMin) { + this.tiempolimiteCambioMin = tiempolimiteCambioMin; + } + + public Integer getTempolimiteAposSaidaH() { + return tempolimiteAposSaidaH == null ? 0 : tempolimiteAposSaidaH; + } + + public void setTempolimiteAposSaidaH(Integer tempolimiteAposSaidaH) { + this.tempolimiteAposSaidaH = tempolimiteAposSaidaH; + } + + public Integer getTempolimiteAposSaidaMin() { + return tempolimiteAposSaidaMin == null ? 0 : tempolimiteAposSaidaMin; + } + + public void setTempolimiteAposSaidaMin(Integer tempolimiteAposSaidaMin) { + this.tempolimiteAposSaidaMin = tempolimiteAposSaidaMin; + } + + public Integer getTrocaMesmoDiaAntesHora() { + return trocaMesmoDiaAntesHora == null ? 0 : trocaMesmoDiaAntesHora; + } + + public void setTrocaMesmoDiaAntesHora(Integer trocaMesmoDiaAntesHora) { + this.trocaMesmoDiaAntesHora = trocaMesmoDiaAntesHora; + } + + public Integer getTrocaMesmoDiaAntesMin() { + return trocaMesmoDiaAntesMin == null ? 0 : trocaMesmoDiaAntesMin; + } + + public void setTrocaMesmoDiaAntesMin(Integer trocaMesmoDiaAntesMin) { + this.trocaMesmoDiaAntesMin = trocaMesmoDiaAntesMin; + } + + public Integer getTrocaMesmoDiaAposHora() { + return trocaMesmoDiaAposHora == null ? 0 : trocaMesmoDiaAposHora; + } + + public void setTrocaMesmoDiaAposHora(Integer trocaMesmoDiaAposHora) { + this.trocaMesmoDiaAposHora = trocaMesmoDiaAposHora; + } + + public Integer getTrocaMesmoDiaAposMin() { + return trocaMesmoDiaAposMin == null ? 0 : trocaMesmoDiaAposMin; + } + + public void setTrocaMesmoDiaAposMin(Integer trocaMesmoDiaAposMin) { + this.trocaMesmoDiaAposMin = trocaMesmoDiaAposMin; + } + + public Integer getTempoTrocaPoltronaH() { + return tempoTrocaPoltronaH == null ? 0 : tempoTrocaPoltronaH; + } + + public void setTempoTrocaPoltronaH(Integer tempoTrocaPoltronaH) { + this.tempoTrocaPoltronaH = tempoTrocaPoltronaH; + } + + public Integer getTempoTrocaPoltronaMin() { + return tempoTrocaPoltronaMin == null ? 0 : tempoTrocaPoltronaMin; + } + + public void setTempoTrocaPoltronaMin(Integer tempoTrocaPoltronaMin) { + this.tempoTrocaPoltronaMin = tempoTrocaPoltronaMin; + } + public Boolean getIndBloqueioRemarcado() { + return indBloqueioRemarcado; + } + + public void setIndBloqueioRemarcado(Boolean indBloqueioRemarcado) { + this.indBloqueioRemarcado = indBloqueioRemarcado; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java new file mode 100644 index 000000000..fded872ca --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java @@ -0,0 +1,332 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang.BooleanUtils; +import org.hibernate.annotations.Where; + +@Entity +@SequenceGenerator(name = "ORGAO_CONCEDENTE_SEQ", sequenceName = "ORGAO_CONCEDENTE_SEQ", allocationSize = 1) +@Table(name = "ORGAO_CONCEDENTE") +public class OrgaoConcedente implements Serializable { + + private static final long serialVersionUID = 1L; + public final static Integer CODIGO_ARTESP = 21; + public final static Integer CODIGO_ANTT = 3; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ORGAO_CONCEDENTE_SEQ") + @Column(name = "ORGAOCONCEDENTE_ID") + private Integer orgaoConcedenteId; + @Column(name = "DESCORGAO") + private String descOrgao; + @Column(name = "INDDEFAULTSEGURO") + private Boolean indDefaultSeguro; + @Column(name = "INDSUBSEGURO") + private Boolean indSubSeguro; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "orgao") + private List categoriaOrgaoList; + @Column(name = "INDNOMDOCOBLIGATORIO") + private Boolean indNomDocObligatorio; + @OneToMany(mappedBy = "orgao") + private List orgaoCancelacionList; + @Column(name = "INDICEPEAJE") + private BigDecimal indicePeaje; + @Column(name = "IDADE_IDOSO") + private Integer idadeIdoso; + @Column(name = "IDADE_MINIMA") + private Integer idadeMinima; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne() + private Categoria categoria; + @Column(name = "INDUTILIZAICMS") + private Boolean indUtilizaICMS; + @Column(name = "INDMULTATODASREMARCACOES") + private Boolean indmultatodasremarcacoes; + @Column(name = "INDVALDOCOBLIGATORIOMONITRIP") + private Boolean indValDocObligatorioMonitrip; + @Column(name = "INDVALDOCOBLIGATORIOEMBARCADA") + private Boolean indValDocObligatorioEmbarcada; + + @OneToMany(mappedBy = "orgaoConcedente", cascade = CascadeType.ALL) + private List classesIndicePeaje; + + @OneToMany(mappedBy = "orgaoConcedente", cascade = CascadeType.ALL) + @Where(clause = "activo=1") + private List orgaoEmpParams; + + @Column(name = "COEFICIENTETARIFA") + private BigDecimal coeficiente; + + @Column(name = "MENSAGEM_INTRANSFERIVEL") + private String mensagemPassagemIntrasferivel; + + @Column(name = "INDNAOIMPPOLCONSUMIDOR") + private Boolean indNaoImprimirPoliticasConsumidor; + + @Column(name = "TAXA_CONVENIENCIA_SVI") + private BigDecimal taxaConvenienciaSVI; + + public void addParametro(OrgaoCancelacion param) { + this.orgaoCancelacionList.add(param); + } + + public void removeParametro(OrgaoCancelacion param) { + this.orgaoCancelacionList.remove(param); + } + + public Integer getOrgaoConcedenteId() { + return orgaoConcedenteId; + } + + public void setOrgaoConcedenteId(Integer orgaoConcedenteId) { + this.orgaoConcedenteId = orgaoConcedenteId; + } + + public String getDescOrgao() { + return descOrgao; + } + + public void setDescOrgao(String descOrgao) { + this.descOrgao = descOrgao; + } + + public Boolean getIndSubSeguro() { + return indSubSeguro; + } + + public void setIndSubSeguro(Boolean indSubSeguro) { + this.indSubSeguro = indSubSeguro; + } + + public Boolean getIndDefaultSeguro() { + return indDefaultSeguro; + } + + public void setIndDefaultSeguro(Boolean indDefaultSeguro) { + this.indDefaultSeguro = indDefaultSeguro; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getCategoriaOrgaoList() { + return categoriaOrgaoList; + } + + public void setCategoriaOrgaoList(List categoriaOrgaoList) { + this.categoriaOrgaoList = categoriaOrgaoList; + } + + public Boolean getIndNomDocObligatorio() { + return BooleanUtils.isTrue(indNomDocObligatorio); + } + + public void setIndNomDocObligatorio(Boolean indNomDocObligatorio) { + this.indNomDocObligatorio = indNomDocObligatorio; + } + + public List getOrgaoCancelacionList() { + return orgaoCancelacionList; + } + + public void setOrgaoCancelacionList(List orgaoCancelacionList) { + this.orgaoCancelacionList = orgaoCancelacionList; + } + + public BigDecimal getIndicePeaje() { + return indicePeaje; + } + + public void setIndicePeaje(BigDecimal indicePeaje) { + this.indicePeaje = indicePeaje; + } + + public Integer getIdadeIdoso() { + return idadeIdoso; + } + + public void setIdadeIdoso(Integer idadeIdoso) { + this.idadeIdoso = idadeIdoso; + } + + public List getClassesIndicePeaje() { + List lsClasseIndicePeaje = new ArrayList(); + for (ClasseIndicePeaje classeIndicePeaje : this.classesIndicePeaje) { + if (classeIndicePeaje.getActivo()) { + lsClasseIndicePeaje.add(classeIndicePeaje); + } + } + return this.classesIndicePeaje = lsClasseIndicePeaje; + } + + public void setClassesIndicePeaje(List classesIndicePeaje) { + this.classesIndicePeaje = classesIndicePeaje; + } + + public Integer getIdadeMinima() { + return idadeMinima; + } + + public void setIdadeMinima(Integer idadeMinima) { + this.idadeMinima = idadeMinima; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + @Override + public String toString() { + return descOrgao; + } + + public Boolean getIndUtilizaICMS() { + return indUtilizaICMS; + } + + public void setIndUtilizaICMS(Boolean indUtilizaICMS) { + this.indUtilizaICMS = indUtilizaICMS; + } + + public List getOrgaoEmpParams() { + return orgaoEmpParams; + } + + public void setOrgaoEmpParams(List orgaoEmpParams) { + this.orgaoEmpParams = orgaoEmpParams; + } + + public Boolean getIndmultatodasremarcacoes() { + return indmultatodasremarcacoes; + } + + public void setIndmultatodasremarcacoes(Boolean indmultatodasremarcacoes) { + this.indmultatodasremarcacoes = indmultatodasremarcacoes; + } + + public Boolean getIndValDocObligatorioMonitrip() { + return BooleanUtils.toBoolean(indValDocObligatorioMonitrip); + } + + public void setIndValDocObligatorioMonitrip(Boolean indValDocObligatorioMonitrip) { + this.indValDocObligatorioMonitrip = indValDocObligatorioMonitrip; + } + + public BigDecimal getCoeficiente() { + return coeficiente; + } + + public void setCoeficiente(BigDecimal coeficiente) { + this.coeficiente = coeficiente; + } + + public String getMensagemPassagemIntrasferivel() { + return mensagemPassagemIntrasferivel; + } + + public void setMensagemPassagemIntrasferivel(String mensagemPassagemIntrasferivel) { + this.mensagemPassagemIntrasferivel = mensagemPassagemIntrasferivel; + } + + + public Boolean getIndValDocObligatorioEmbarcada() { + return indValDocObligatorioEmbarcada; + } + + public void setIndValDocObligatorioEmbarcada(Boolean indValDocObligatorioEmbarcada) { + this.indValDocObligatorioEmbarcada = indValDocObligatorioEmbarcada; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((orgaoConcedenteId == null) ? 0 : orgaoConcedenteId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + OrgaoConcedente other = (OrgaoConcedente) obj; + if (orgaoConcedenteId == null) { + if (other.orgaoConcedenteId != null) + return false; + } else if (!orgaoConcedenteId.equals(other.orgaoConcedenteId)) + return false; + return true; + } + + public Boolean getIndNaoImprimirPoliticasConsumidor() { + return indNaoImprimirPoliticasConsumidor; + } + + public void setIndNaoImprimirPoliticasConsumidor(Boolean indNaoImprimirPoliticasConsumidor) { + this.indNaoImprimirPoliticasConsumidor = indNaoImprimirPoliticasConsumidor; + } + + public BigDecimal getTaxaConvenienciaSVI() { + return taxaConvenienciaSVI; + } + + public void setTaxaConvenienciaSVI(BigDecimal taxaConvenienciaSVI) { + this.taxaConvenienciaSVI = taxaConvenienciaSVI; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java new file mode 100644 index 000000000..95d7d8706 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java @@ -0,0 +1,167 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ORGAO_EMP_PARAM_SEQ", sequenceName = "ORGAO_EMP_PARAM_SEQ", allocationSize = 1) +@Table(name = "ORGAO_EMP_PARAM") +public class OrgaoEmpParam implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ORGAO_EMP_PARAM_SEQ") + @Column(name = "ORGAOEMPPARAM_ID") + private Integer orgaoempparamId; + + @Column(name = "INDEMITESEGUNDAVIA") + private Boolean indemitesegundavia; + + @Column(name = "INDDOISCUPOMEMBARQUE") + private Boolean inddoiscupomembarque; + + @Column(name = "INDNAORESTRINGE2VIABPE") + private Boolean indNaoRestringe2ViaBPe; + + @ManyToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + + @ManyToOne + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "CODEMPRESAPORORGAO", length=30) + private String codEmpresaPorOrgao; + + public String getCodEmpresaPorOrgao() { + return codEmpresaPorOrgao; + } + + public void setCodEmpresaPorOrgao(String codEmpresaPorOrgao) { + this.codEmpresaPorOrgao = codEmpresaPorOrgao; + } + + public Integer getOrgaoempparamId() { + return orgaoempparamId; + } + + public void setOrgaoempparamId(Integer orgaoempparamId) { + this.orgaoempparamId = orgaoempparamId; + } + + public Boolean getIndemitesegundavia() { + return indemitesegundavia; + } + + public void setIndemitesegundavia(Boolean indemitesegundavia) { + this.indemitesegundavia = indemitesegundavia; + } + + public Boolean getInddoiscupomembarque() { + return inddoiscupomembarque; + } + + public void setInddoiscupomembarque(Boolean inddoiscupomembarque) { + this.inddoiscupomembarque = inddoiscupomembarque; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getIndNaoRestringe2ViaBPe() { + return indNaoRestringe2ViaBPe == null ? false : indNaoRestringe2ViaBPe; + } + + public void setIndNaoRestringe2ViaBPe(Boolean indNaoRestringe2ViaBPe) { + this.indNaoRestringe2ViaBPe = indNaoRestringe2ViaBPe; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((orgaoempparamId == null) ? 0 : orgaoempparamId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof OrgaoEmpParam)) + return false; + OrgaoEmpParam other = (OrgaoEmpParam) obj; + if (getOrgaoempparamId() == null) { + if (other.getOrgaoempparamId() != null) + return false; + } else if (!getOrgaoempparamId().equals(other.getOrgaoempparamId())) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoTramo.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoTramo.java new file mode 100644 index 000000000..cce82adde --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoTramo.java @@ -0,0 +1,191 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "ORGAO_TRAMO_SEQ", sequenceName = "ORGAO_TRAMO_SEQ", allocationSize = 1) +@Table(name = "ORGAO_TRAMO") +public class OrgaoTramo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ORGAO_TRAMO_SEQ") + @Basic(optional = false) + @Column(name = "ORGAOTRAMO_ID") + private Integer orgaoTramoId; + @OneToOne + @JoinColumn(name = "TRAMO_ID") + private Tramo tramo; + @OneToOne + @JoinColumn(name = "COEFICIENTETARIFA1_ID") + private CoeficienteTarifa coeficienteTarifa1; + @Column(name = "KMCOEFICIENTE1") + private BigDecimal kmCoeficiente1; + @OneToOne + @JoinColumn(name = "COEFICIENTETARIFA2_ID") + private CoeficienteTarifa coeficienteTarifa2; + @Column(name = "KMCOEFICIENTE2") + private BigDecimal kmCoeficiente2; + @OneToOne + @JoinColumn(name = "COEFICIENTETARIFA3_ID") + private CoeficienteTarifa coeficienteTarifa3; + @Column(name = "KMCOEFICIENTE3") + private BigDecimal kmCoeficiente3; + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getOrgaoTramoId() { + return orgaoTramoId; + } + + public void setOrgaoTramoId(Integer orgaoTramoId) { + this.orgaoTramoId = orgaoTramoId; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public CoeficienteTarifa getCoeficienteTarifa1() { + return coeficienteTarifa1; + } + + public void setCoeficienteTarifa1(CoeficienteTarifa coeficienteTarifa1) { + this.coeficienteTarifa1 = coeficienteTarifa1; + } + + public BigDecimal getKmCoeficiente1() { + return kmCoeficiente1; + } + + public void setKmCoeficiente1(BigDecimal kmCoeficiente1) { + this.kmCoeficiente1 = kmCoeficiente1; + } + + public CoeficienteTarifa getCoeficienteTarifa2() { + return coeficienteTarifa2; + } + + public void setCoeficienteTarifa2(CoeficienteTarifa coeficienteTarifa2) { + this.coeficienteTarifa2 = coeficienteTarifa2; + } + + public BigDecimal getKmCoeficiente2() { + return kmCoeficiente2; + } + + public void setKmCoeficiente2(BigDecimal kmCoeficiente2) { + this.kmCoeficiente2 = kmCoeficiente2; + } + + public CoeficienteTarifa getCoeficienteTarifa3() { + return coeficienteTarifa3; + } + + public void setCoeficienteTarifa3(CoeficienteTarifa coeficienteTarifa3) { + this.coeficienteTarifa3 = coeficienteTarifa3; + } + + public BigDecimal getKmCoeficiente3() { + return kmCoeficiente3; + } + + public void setKmCoeficiente3(BigDecimal kmCoeficiente3) { + this.kmCoeficiente3 = kmCoeficiente3; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((orgaoTramoId == null) ? 0 : orgaoTramoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + OrgaoTramo other = (OrgaoTramo) obj; + if (orgaoTramoId == null) { + if (other.orgaoTramoId != null) + return false; + } else if (!orgaoTramoId.equals(other.orgaoTramoId)) + return false; + return true; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Pacote.java b/src/com/rjconsultores/ventaboletos/entidad/Pacote.java new file mode 100644 index 000000000..1b3d0411d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Pacote.java @@ -0,0 +1,219 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "PACOTE") +@SequenceGenerator(name = "PACOTE_SEQ", sequenceName = "PACOTE_SEQ", allocationSize = 1) +public class Pacote implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PACOTE_SEQ") + @Column(name = "PACOTE_ID") + private Integer pacoteId; + @Column(name = "NOMPACOTE") + private String nompacote; + @Column(name = "DESCPACOTE") + private String descpacote; + @Column(name = "INDVENDAAGENCIA") + private Boolean indvendaagencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @ManyToMany + @JoinTable(name = "PACOTE_ITEM", joinColumns = { @JoinColumn(name = "PACOTE_ID") }, + inverseJoinColumns = { @JoinColumn(name = "ITEMADICIONAL_ID") }) + private List itemAdicionalList; + + @ManyToMany + @JoinTable(name = "PACOTE_TARIFA", joinColumns = { @JoinColumn(name = "PACOTE_ID") }, + inverseJoinColumns = { @JoinColumn(name = "TIPOTARIFAPACOTE_ID") }) + private List tipoTarifaPacoteList; + + public Pacote() { + super(); + } + + public Pacote(Integer pacoteId, String nompacote) { + this(); + this.pacoteId = pacoteId; + this.nompacote = nompacote; + } + + public Pacote(Integer pacoteId, String nompacote, String descpacote, Boolean indvendaagencia, Boolean activo, Date fecmodif, Integer usuarioId, Ruta ruta) { + this(); + this.pacoteId = pacoteId; + this.nompacote = nompacote; + this.descpacote = descpacote; + this.indvendaagencia = indvendaagencia; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.ruta = ruta; + } + + public Integer getPacoteId() { + return pacoteId; + } + + public void setPacoteId(Integer pacoteId) { + this.pacoteId = pacoteId; + } + + public String getNompacote() { + return nompacote; + } + + public void setNompacote(String nompacote) { + this.nompacote = nompacote; + } + + public String getDescpacote() { + return descpacote; + } + + public void setDescpacote(String descpacote) { + this.descpacote = descpacote; + } + + public Boolean getIndvendaagencia() { + return indvendaagencia; + } + + public void setIndvendaagencia(Boolean indvendaagencia) { + this.indvendaagencia = indvendaagencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public List getItemAdicionalList() { + if (this.itemAdicionalList == null || this.itemAdicionalList.isEmpty()) + return new ArrayList(); + + List aux = new ArrayList(); + for (ItemAdicional item : this.itemAdicionalList) { + if (item.getActivo()) + aux.add(item); + } + return aux; + } + + public void setItemAdicionalList(List itemAdicionalList) { + this.itemAdicionalList = itemAdicionalList; + } + + public List getTipoTarifaPacoteList() { + if (this.tipoTarifaPacoteList == null || this.tipoTarifaPacoteList.isEmpty()) + return new ArrayList(); + + List aux = new ArrayList(); + for (TipoTarifaPacote item : this.tipoTarifaPacoteList) { + if (item.getActivo()) + aux.add(item); + } + return aux; + } + + public void setTipoTarifaPacoteList(List tipoTarifaPacoteList) { + this.tipoTarifaPacoteList = tipoTarifaPacoteList; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((pacoteId == null) ? 0 : pacoteId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Pacote other = (Pacote) obj; + if (pacoteId == null) { + if (other.pacoteId != null) + return false; + } else if (!pacoteId.equals(other.pacoteId)) + return false; + return true; + } + + @Override + public String toString() { + return this.getNompacote(); + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PacoteConvenio.java b/src/com/rjconsultores/ventaboletos/entidad/PacoteConvenio.java new file mode 100644 index 000000000..d887689d7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PacoteConvenio.java @@ -0,0 +1,88 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "PACOTE_CONVENIO") +@SequenceGenerator(name = "PACOTE_CONVENIO_SEQ", sequenceName = "PACOTE_CONVENIO_SEQ", allocationSize = 1) +public class PacoteConvenio implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PACOTE_CONVENIO_SEQ") + @Column(name = "PACOTECONVENIO_ID") + private Long pacoteconvenioId; + + @Column(name = "NOMCONVENIO") + private String nomconvenio; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.DATE) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getPacoteconvenioId() { + return pacoteconvenioId; + } + + public void setPacoteconvenioId(Long pacoteconvenioId) { + this.pacoteconvenioId = pacoteconvenioId; + } + + public String getNomconvenio() { + return nomconvenio; + } + + public void setNomconvenio(String nomconvenio) { + this.nomconvenio = nomconvenio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return getNomconvenio(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PacoteDescontoBilhete.java b/src/com/rjconsultores/ventaboletos/entidad/PacoteDescontoBilhete.java new file mode 100644 index 000000000..39d3dd0d5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PacoteDescontoBilhete.java @@ -0,0 +1,108 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "PACOTE_DESCONTO_BILHETE") +@SequenceGenerator(name = "PACOTE_DESCONTO_BILHETE_SEQ", sequenceName = "PACOTE_DESCONTO_BILHETE_SEQ", allocationSize = 1) +public class PacoteDescontoBilhete implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "PACOTEDESCONTOBILHETE_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PACOTE_DESCONTO_BILHETE_SEQ") + private Long pacotedescontobilheteId; + + @Column(name = "PERCDESCONTO") + private BigDecimal percdesconto; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + @ManyToOne + @JoinColumn(name = "PACOTE_ID") + private Pacote pacote; + + @ManyToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + + public Long getPacotedescontobilheteId() { + return pacotedescontobilheteId; + } + + public void setPacotedescontobilheteId(Long pacotedescontobilheteId) { + this.pacotedescontobilheteId = pacotedescontobilheteId; + } + + public BigDecimal getPercdesconto() { + return percdesconto; + } + + public void setPercdesconto(BigDecimal percdesconto) { + this.percdesconto = percdesconto; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Pacote getPacote() { + return pacote; + } + + public void setPacote(Pacote pacote) { + this.pacote = pacote; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PacoteFormapago.java b/src/com/rjconsultores/ventaboletos/entidad/PacoteFormapago.java new file mode 100644 index 000000000..fa3f2d08b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PacoteFormapago.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "PACOTE_FORMAPAGO_SEQ", sequenceName = "PACOTE_FORMAPAGO_SEQ", allocationSize = 1) +@Table(name = "PACOTE_FORMAPAGO") +public class PacoteFormapago implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "PACOTEFORMAPAGO_ID") + private Long pacoteformapagoId; + + @Column(name = "VALOR") + private BigDecimal valor; + + @ManyToOne + @JoinColumn(name = "VENDAPACOTE_ID") + private VendaPacote vendaPacote; + + @ManyToOne + @JoinColumn(name = "FORMAPAGO_ID") + private FormaPago formaPago; + + public Long getPacoteformapagoId() { + return pacoteformapagoId; + } + + public void setPacoteformapagoId(Long pacoteformapagoId) { + this.pacoteformapagoId = pacoteformapagoId; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public VendaPacote getVendaPacote() { + return vendaPacote; + } + + public void setVendaPacote(VendaPacote vendaPacote) { + this.vendaPacote = vendaPacote; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PacoteItem.java b/src/com/rjconsultores/ventaboletos/entidad/PacoteItem.java new file mode 100644 index 000000000..fb3c3edbe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PacoteItem.java @@ -0,0 +1,126 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "PACOTE_ITEM") +@SequenceGenerator(name = "PACOTE_ITEM_SEQ", sequenceName = "PACOTE_ITEM_SEQ", allocationSize = 1) +public class PacoteItem implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PACOTE_ITEM_SEQ") + @Column(name = "PACOTEITEM_ID") + private Integer pacoteItemId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PACOTE_ID", referencedColumnName = "PACOTE_ID") + @ManyToOne + private Pacote pacote; + @JoinColumn(name = "ITEMADICIONAL_ID", referencedColumnName = "ITEMADICIONAL_ID") + @ManyToOne + private ItemAdicional itemAdicional; + + public PacoteItem() { + super(); + } + + public Integer getPacoteItemId() { + return pacoteItemId; + } + + public void setPacoteItemId(Integer pacoteItemId) { + this.pacoteItemId = pacoteItemId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((pacoteItemId == null) ? 0 : pacoteItemId.hashCode()); + return result; + } + + public Pacote getPacote() { + return pacote; + } + + public void setPacote(Pacote pacote) { + this.pacote = pacote; + } + + public ItemAdicional getItemAdicional() { + return itemAdicional; + } + + public void setItemAdicional(ItemAdicional itemAdicional) { + this.itemAdicional = itemAdicional; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PacoteItem other = (PacoteItem) obj; + if (pacoteItemId == null) { + if (other.pacoteItemId != null) + return false; + } else if (!pacoteItemId.equals(other.pacoteItemId)) + return false; + return true; + } + + @Override + public String toString() { + return "PacoteItem [pacoteItemId=" + pacoteItemId + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + ", pacoteId=" + pacote + ", itemadicionalId=" + itemAdicional + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PacoteTarifa.java b/src/com/rjconsultores/ventaboletos/entidad/PacoteTarifa.java new file mode 100644 index 000000000..8a3ac297f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PacoteTarifa.java @@ -0,0 +1,167 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "PACOTE_TARIFA") +@SequenceGenerator(name = "PACOTE_TARIFA_SEQ", sequenceName = "PACOTE_TARIFA_SEQ", allocationSize = 1) +public class PacoteTarifa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PACOTE_TARIFA_SEQ") + @Column(name = "PACOTETARIFA_ID ") + private Integer pacotetarifaId; + @Column(name = "TARIFA") + private BigDecimal tarifa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PACOTE_ID", referencedColumnName = "PACOTE_ID") + @ManyToOne + private Pacote pacote; + @JoinColumn(name = "TIPOTARIFAPACOTE_ID", referencedColumnName = "TIPOTARIFAPACOTE_ID") + @ManyToOne + private TipoTarifaPacote tipoTarifaPacote; + @Column(name = "INDVENDAWEB") + private Boolean indvendaweb; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + + + public PacoteTarifa() { + super(); + } + + public PacoteTarifa(Integer pacotetarifaId, Boolean activo, Date fecmodif, Integer usuarioId) { + super(); + this.pacotetarifaId = pacotetarifaId; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Integer getPacotetarifaId() { + return pacotetarifaId; + } + + public void setPacotetarifaId(Integer pacotetarifaId) { + this.pacotetarifaId = pacotetarifaId; + } + + public BigDecimal getTarifa() { + return tarifa; + } + + public void setTarifa(BigDecimal tarifa) { + this.tarifa = tarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pacote getPacote() { + return pacote; + } + + public void setPacote(Pacote pacote) { + this.pacote = pacote; + } + + public TipoTarifaPacote getTipoTarifaPacote() { + return tipoTarifaPacote; + } + + public void setTipoTarifaPacote(TipoTarifaPacote tipoTarifaPacote) { + this.tipoTarifaPacote = tipoTarifaPacote; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((pacotetarifaId == null) ? 0 : pacotetarifaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof PacoteTarifa)) + return false; + PacoteTarifa other = (PacoteTarifa) obj; + if (pacotetarifaId == null) { + if (other.pacotetarifaId != null) + return false; + } else if (!pacotetarifaId.equals(other.pacotetarifaId)) + return false; + return true; + } + + @Override + public String toString() { + return "PacoteTarifa [pacotetarifaId=" + pacotetarifaId + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + ", pacote=" + pacote + ", tipoTarifaPacote=" + tipoTarifaPacote + "]"; + } + + public Boolean getIndvendaweb() { + return indvendaweb; + } + + public void setIndvendaweb(Boolean indvendaweb) { + this.indvendaweb = indvendaweb; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Pais.java b/src/com/rjconsultores/ventaboletos/entidad/Pais.java new file mode 100644 index 000000000..9c676f783 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Pais.java @@ -0,0 +1,138 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PAIS_SEQ", sequenceName = "PAIS_SEQ", allocationSize = 1) +@Table(name = "PAIS") +public class Pais implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PAIS_SEQ") + @Basic(optional = false) + @Column(name = "PAIS_ID") + private Integer paisId; + @Column(name = "NOMBPAIS") + private String nombpais; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "pais") + private List estadoList; + @Column(name = "CODIGOBACENPAIS") + private String codigoBacen; + + public Pais() { + } + + public Pais(Integer paisId) { + this.paisId = paisId; + } + + public Integer getPaisId() { + return paisId; + } + + public void setPaisId(Integer paisId) { + this.paisId = paisId; + } + + public String getNombpais() { + return nombpais; + } + + public void setNombpais(String nombpais) { + this.nombpais = nombpais; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getEstadoList() { + return estadoList; + } + + public void setEstadoList(List estadoList) { + this.estadoList = estadoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paisId != null ? paisId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Pais)) { + return false; + } + Pais other = (Pais) object; + if ((this.paisId == null && other.paisId != null) || (this.paisId != null && !this.paisId.equals(other.paisId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getNombpais(); + } + + public String getCodigoBacen() { + return codigoBacen; + } + + public void setCodigoBacen(String codigoBacen) { + this.codigoBacen = codigoBacen; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Parada.java b/src/com/rjconsultores/ventaboletos/entidad/Parada.java new file mode 100644 index 000000000..6ea3b734e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Parada.java @@ -0,0 +1,387 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; + +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "PARADA_SEQ", sequenceName = "PARADA_SEQ", allocationSize = 1) +@Table(name = "PARADA") +public class Parada implements Serializable, Auditavel { + public static Integer ID_PARADA_TODOS = -1; + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARADA_SEQ") + @Column(name = "PARADA_ID") + private Integer paradaId; + @Basic(optional = false) + @Column(name = "DESCPARADA") + private String descparada; + @Column(name = "CVEPARADA") + private String cveparada; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "CIUDAD_ID") + private Ciudad ciudad; + @OneToOne + @JoinColumn(name = "TIPOPARADA_ID") + private TipoParada tipoParada; + @OneToMany(mappedBy = "origem") + private List corridaList; + @OneToMany(mappedBy = "destino") + private List corridaList1; + @OneToMany(mappedBy = "paradaOrigem") + private List reservacionMercadoList; + @OneToMany(mappedBy = "paradaDestino") + private List reservacionMercadoList1; + @OneToMany(mappedBy = "destino") + private List categoriaMercadoDestinoList; + @OneToMany(mappedBy = "origem") + private List categoriaMercadoOrigemList; + @OneToOne + @JoinColumn(name = "NODO_ID") + private Nodo nodo; + @OneToMany(mappedBy = "origem") + private List tramoOrigemList; + @OneToMany(mappedBy = "destino") + private List tramoDestinoList; + @Column(name = "CODANTT") + private Integer codantt; + @Column(name = "CODANTTAUX") + private Integer codanttaux; + @Column(name = "DESCPROCON") + private String descProcon; + @Column(name="INDVENDETOTEM") + private Boolean indVendeTotem; + @Column(name="INDVISIBLEINTERNET") + private Boolean indVisibleInternet; + @OneToOne + @JoinColumn(name = "AGRUPAMENTOPARADA_ID") + private AgrupamentoParada agrupamentoParada; + + @ManyToOne + @JoinColumn(name = "REGIONMETROPOLITANA_ID", referencedColumnName = "REGIONMETROPOLITANA_ID") + private RegionMetropolitana regionMetropolitana; + + @OneToMany(mappedBy = "parada", fetch = FetchType.EAGER, cascade = javax.persistence.CascadeType.ALL) + @Fetch(value = FetchMode.SUBSELECT) + private List codigosOrgaosConcedentes = new ArrayList(); + + @Transient + @NaoAuditar + private Parada paradaClone; + + public Parada() { + super(); + } + + public Parada(Integer paradaId) { + this(); + + this.paradaId = paradaId; + } + + public Parada(Integer paradaId, String cveparada, String descparada) { + this(paradaId); + this.cveparada = cveparada; + this.descparada = descparada; + } + + public List getCategoriaMercadoDestinoList() { + return categoriaMercadoDestinoList; + } + + public void setCategoriaMercadoDestinoList(List categoriaMercadoDestinoList) { + this.categoriaMercadoDestinoList = categoriaMercadoDestinoList; + } + + public List getCategoriaMercadoOrigemList() { + return categoriaMercadoOrigemList; + } + + public void setCategoriaMercadoOrigemList(List categoriaMercadoOrigemList) { + this.categoriaMercadoOrigemList = categoriaMercadoOrigemList; + } + + public String getDescparada() { + return descparada; + } + + public void setDescparada(String descparada) { + this.descparada = descparada; + } + + public Integer getParadaId() { + return paradaId; + } + + public void setParadaId(Integer paradaId) { + this.paradaId = paradaId; + } + + public List getReservacionMercadoList() { + return reservacionMercadoList; + } + + public void setReservacionMercadoList(List reservacionMercadoList) { + this.reservacionMercadoList = reservacionMercadoList; + } + + public List getReservacionMercadoList1() { + return reservacionMercadoList1; + } + + public void setReservacionMercadoList1(List reservacionMercadoList1) { + this.reservacionMercadoList1 = reservacionMercadoList1; + } + + public String getCveparada() { + return cveparada; + } + + public void setCveparada(String cveparada) { + this.cveparada = cveparada; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + public List getCorridaList1() { + return corridaList1; + } + + public void setCorridaList1(List corridaList1) { + this.corridaList1 = corridaList1; + } + + public List getTramoDestinoList() { + return tramoDestinoList; + } + + public void setTramoDestinoList(List tramoDestinoList) { + this.tramoDestinoList = tramoDestinoList; + } + + public List getTramoOrigemList() { + return tramoOrigemList; + } + + public void setTramoOrigemList(List tramoOrigemList) { + this.tramoOrigemList = tramoOrigemList; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + public TipoParada getTipoParada() { + return tipoParada; + } + + public void setTipoParada(TipoParada tipoParada) { + this.tipoParada = tipoParada; + } + + public Nodo getNodo() { + return nodo; + } + + public void setNodo(Nodo nodo) { + this.nodo = nodo; + } + + public Integer getCodantt() { + return codantt; + } + + public void setCodantt(Integer codantt) { + this.codantt = codantt; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getParadaId() != null ? getParadaId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Parada)) { + return false; + } + Parada other = (Parada) object; + if ((this.getParadaId() == null && other.getParadaId() != null) || (this.getParadaId() != null && !this.getParadaId().equals(other.getParadaId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDescparada(); + } + + public String toStringCve() { + return getCveparada(); + } + + public RegionMetropolitana getRegionMetropolitana() { + return regionMetropolitana; + } + + public void setRegionMetropolitana(RegionMetropolitana regionMetropolitana) { + this.regionMetropolitana = regionMetropolitana; + } + + public List getCodigosOrgaosConcedentes() { + return codigosOrgaosConcedentes; + } + + public void setCodigosOrgaosConcedentes(List codigosOrgaosConcedentes) { + this.codigosOrgaosConcedentes = codigosOrgaosConcedentes; + } + + public void addCodOrgaoConcedente(ParadaCodOrgaoConcedente codigo) { + this.codigosOrgaosConcedentes.add(codigo); + } + + public void removeCodOrgaoConcedente(ParadaCodOrgaoConcedente codigo) { + this.codigosOrgaosConcedentes.remove(codigo); + } + + public String getDescProcon() { + return descProcon; + } + + public void setDescProcon(String descProcon) { + this.descProcon = descProcon; + } + + public Boolean getIndVendeTotem() { + return indVendeTotem; + } + + public void setIndVendeTotem(Boolean indVendeTotem) { + this.indVendeTotem = indVendeTotem; + } + + public Integer getCodanttaux() { + return codanttaux; + } + + public void setCodanttaux(Integer codanttaux) { + this.codanttaux = codanttaux; + } + + public Boolean getIndVisibleInternet() { + return indVisibleInternet; + } + + public void setIndVisibleInternet(Boolean indVisibleInternet) { + this.indVisibleInternet = indVisibleInternet; + } + + + + public AgrupamentoParada getAgrupamentoParada() { + return agrupamentoParada; + } + + public void setAgrupamentoParada(AgrupamentoParada agrupamentoParada) { + this.agrupamentoParada = agrupamentoParada; + } + + @Override + public void clonar() throws CloneNotSupportedException { + paradaClone = new Parada(); + paradaClone = (Parada) this.clone(); + } + + @Override + public Parada getCloneObject() throws CloneNotSupportedException { +// if(paradaClone == null) { +// this.clonar(); +// } + return paradaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("EsquemaAsientoID [%s]", getParadaId()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParadaCodOrgaoConcedente.java b/src/com/rjconsultores/ventaboletos/entidad/ParadaCodOrgaoConcedente.java new file mode 100644 index 000000000..3774f6a3c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ParadaCodOrgaoConcedente.java @@ -0,0 +1,81 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "PARADA_CODORGAOCONCEDENTE_SEQ", sequenceName = "PARADA_CODORGAOCONCEDENTE_SEQ", allocationSize = 1) +@Table(name = "PARADA_COD_ORGAOCONCEDENTE") +public class ParadaCodOrgaoConcedente implements Serializable { + /** + * + */ + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARADA_CODORGAOCONCEDENTE_SEQ") + @Column(name = "PARADACODORGAOCONCEDENTE_ID") + private Integer paradaCodOrgaoConcedenteId; + @OneToOne + @JoinColumn(name = "PARADA_ID") + private Parada parada; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgaoConcedente; + @Column(name = "CODIGO") + private String codigo; + public Integer getParadaCodOrgaoConcedenteId() { + return paradaCodOrgaoConcedenteId; + } + public void setParadaCodOrgaoConcedenteId(Integer paradaCodOrgaoConcedenteId) { + this.paradaCodOrgaoConcedenteId = paradaCodOrgaoConcedenteId; + } + public Parada getParada() { + return parada; + } + public void setParada(Parada parada) { + this.parada = parada; + } + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + public String getCodigo() { + return codigo; + } + public void setCodigo(String codigo) { + this.codigo = codigo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getParadaCodOrgaoConcedenteId() != null ? getParadaCodOrgaoConcedenteId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof ParadaCodOrgaoConcedente)) { + return false; + } + ParadaCodOrgaoConcedente other = (ParadaCodOrgaoConcedente) object; + if ((this.getParadaCodOrgaoConcedenteId() == null && other.getParadaCodOrgaoConcedenteId() != null) || (this.getParadaCodOrgaoConcedenteId() != null && !this.getParadaCodOrgaoConcedenteId().equals(other.getParadaCodOrgaoConcedenteId()))) { + return false; + } + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParadaEquivalencia.java b/src/com/rjconsultores/ventaboletos/entidad/ParadaEquivalencia.java new file mode 100644 index 000000000..1613b86d2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ParadaEquivalencia.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@Table(name = "PARADA_EQUIVALENCIA") +@SequenceGenerator(name = "PARADA_EQUIVALENCIA_SEQ", sequenceName = "PARADA_EQUIVALENCIA_SEQ", allocationSize = 1) +public class ParadaEquivalencia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARADA_EQUIVALENCIA_SEQ") + @Basic(optional = false) + @Column(name = "PARADAEQUIVALENCIA_ID") + private Integer paradaequivalenciaId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "PARADA_ID") + private Parada parada; + @OneToOne + @JoinColumn(name = "COMISIONISTAEXTERNO_ID") + private ComisionistaExterno comisionistaExterno; + + public ParadaEquivalencia() { + } + + public ParadaEquivalencia(Integer paradaequivalenciaId) { + this.paradaequivalenciaId = paradaequivalenciaId; + } + + public Integer getParadaequivalenciaId() { + return paradaequivalenciaId; + } + + public void setParadaequivalenciaId(Integer paradaequivalenciaId) { + this.paradaequivalenciaId = paradaequivalenciaId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public ComisionistaExterno getComisionistaExterno() { + return comisionistaExterno; + } + + public void setComisionistaExterno(ComisionistaExterno comisionistaExterno) { + this.comisionistaExterno = comisionistaExterno; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paradaequivalenciaId != null ? paradaequivalenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParadaEquivalencia)) { + return false; + } + ParadaEquivalencia other = (ParadaEquivalencia) object; + if ((this.paradaequivalenciaId == null && other.paradaequivalenciaId != null) || (this.paradaequivalenciaId != null && !this.paradaequivalenciaId.equals(other.paradaequivalenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ParadaEquivalencia[ paradaequivalenciaId=" + paradaequivalenciaId + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParadaEsquema.java b/src/com/rjconsultores/ventaboletos/entidad/ParadaEsquema.java new file mode 100644 index 000000000..65553158b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ParadaEsquema.java @@ -0,0 +1,115 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +/** + * + * @author Administrador + */ +public class ParadaEsquema { + + private Short numsecuencia; + private Date tiempoEstancia; + private Date padraoRecorrido; + private Date excepcionRecorrido; + private Parada parada; + private Boolean activo; + private String plataforma; + private String tipoPassagem; + + public ParadaEsquema() { + } + + public Short getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Short numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public Date getTiempoEstancia() { + return tiempoEstancia; + } + + public void setTiempoEstancia(Date tiempoEstancia) { + this.tiempoEstancia = tiempoEstancia; + } + + public String getPlataforma() { + return plataforma; + } + + public void setPlataforma(String plataforma) { + this.plataforma = plataforma; + } + + public Date getPadraoRecorrido() { + return padraoRecorrido; + } + + public void setPadraoRecorrido(Date padraoRecorrido) { + this.padraoRecorrido = padraoRecorrido; + } + + public Date getExcepcionRecorrido() { + return excepcionRecorrido; + } + + public void setExcepcionRecorrido(Date excepcionRecorrido) { + this.excepcionRecorrido = excepcionRecorrido; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getTipoPassagem() { + return tipoPassagem; + } + + public void setTipoPassagem(String tipoPassagem) { + this.tipoPassagem = tipoPassagem; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((numsecuencia == null) ? 0 : numsecuencia.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ParadaEsquema)) + return false; + ParadaEsquema other = (ParadaEsquema) obj; + if (numsecuencia == null) { + if (other.numsecuencia != null) + return false; + } else if (!numsecuencia.equals(other.numsecuencia)) + return false; + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParadaSecuencia.java b/src/com/rjconsultores/ventaboletos/entidad/ParadaSecuencia.java new file mode 100644 index 000000000..92bf5b7d6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ParadaSecuencia.java @@ -0,0 +1,111 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.List; + +/** + * + * @author Administrador + */ +public class ParadaSecuencia { + + private Short secuencia; + private Parada parada; + private Via via; + private List casetas; + private String casetasTxt =""; + private String kmReal = ""; + private String kmEntradaSaida = ""; + private String tempoReal = ""; + + @Override + public String toString() { + if (parada != null) { + return parada.toString(); + } + return super.toString(); + } + + public ParadaSecuencia() { + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public Short getSecuencia() { + return secuencia; + } + + public void setSecuencia(Short secuencia) { + this.secuencia = secuencia; + } + + public Via getVia() { + return via; + } + + public void setVia(Via via) { + this.via = via; + } + + public List getCasetas() { + return casetas; + } + + public void setCasetas(List casetas) { + this.casetas = casetas; + } + + public String getCasetasTxt() { + if(casetas != null){ + casetasTxt = ""; + + for( int i = 0 ; i < casetas.size() ; i ++){ + RutaCaseta cs = casetas.get(i); + if(i == casetas.size()-1){ + casetasTxt = casetasTxt + cs.getCasetaPeaje().getDesccaseta(); + }else{ + casetasTxt = casetasTxt + cs.getCasetaPeaje().getDesccaseta()+", "; + } + } + } + return casetasTxt; + } + + public void setCasetasTxt(String casetasTxt) { + this.casetasTxt = casetasTxt; + } + + public String getKmReal() { + return kmReal; + } + + public void setKmReal(String kmReal) { + this.kmReal = kmReal; + } + + public String getTempoReal() { + return tempoReal; + } + + public void setTempoReal(String tempoReal) { + this.tempoReal = tempoReal; + } + + public String getKmEntradaSaida() { + return kmEntradaSaida; + } + + public void setKmEntradaSaida(String kmEntradaSaida) { + this.kmEntradaSaida = kmEntradaSaida; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParadaSecuenciaCombinacaoLinha.java b/src/com/rjconsultores/ventaboletos/entidad/ParadaSecuenciaCombinacaoLinha.java new file mode 100644 index 000000000..8d78d2abd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ParadaSecuenciaCombinacaoLinha.java @@ -0,0 +1,65 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.List; + +/** + * + * @author Eduardo Classe responsável pela geração das linhas automaticamente identificando origem e destino + */ +public class ParadaSecuenciaCombinacaoLinha { + + private ParadaSecuencia origem; + private List destinos; + private Via via; + private String kmReal = ""; + private String kmEntradaSaida = ""; + private String tempoReal = ""; + + public String getKmReal() { + return kmReal; + } + + public void setKmReal(String kmReal) { + this.kmReal = kmReal; + } + + public String getKmEntradaSaida() { + return kmEntradaSaida; + } + + public void setKmEntradaSaida(String kmEntradaSaida) { + this.kmEntradaSaida = kmEntradaSaida; + } + + public String getTempoReal() { + return tempoReal; + } + + public void setTempoReal(String tempoReal) { + this.tempoReal = tempoReal; + } + + public ParadaSecuencia getOrigem() { + return origem; + } + + public void setOrigem(ParadaSecuencia origem) { + this.origem = origem; + } + + public List getDestinos() { + return destinos; + } + + public void setDestinos(List destinos) { + this.destinos = destinos; + } + + public Via getVia() { + return via; + } + + public void setVia(Via via) { + this.via = via; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaMasivo.java b/src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaMasivo.java new file mode 100644 index 000000000..90f2b7f3b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaMasivo.java @@ -0,0 +1,159 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PARAM_ACUMULA_MASIVO_SEQ", sequenceName = "PARAM_ACUMULA_MASIVO_SEQ", allocationSize = 1) +@Table(name = "PARAM_ACUMULA_MASIVO") +public class ParamAcumulaMasivo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_ACUMULA_MASIVO_SEQ") + @Column(name = "PARAMACUMULAMASIVO") + private Integer paramacumulamasivo; + @Column(name = "MAXPUNTOOTORGA") + private Integer maxpuntootorga; + @Column(name = "MINPUNTOOTORGA") + private Integer minpuntootorga; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date feciniciovigencia; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinvigencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + public ParamAcumulaMasivo() { + } + + public ParamAcumulaMasivo(Integer paramacumulamasivo) { + this.paramacumulamasivo = paramacumulamasivo; + } + + public Integer getParamacumulamasivo() { + return paramacumulamasivo; + } + + public void setParamacumulamasivo(Integer paramacumulamasivo) { + this.paramacumulamasivo = paramacumulamasivo; + } + + public Integer getMaxpuntootorga() { + return maxpuntootorga; + } + + public void setMaxpuntootorga(Integer maxpuntootorga) { + this.maxpuntootorga = maxpuntootorga; + } + + public Integer getMinpuntootorga() { + return minpuntootorga; + } + + public void setMinpuntootorga(Integer minpuntootorga) { + this.minpuntootorga = minpuntootorga; + } + + public Date getFeciniciovigencia() { + return feciniciovigencia; + } + + public void setFeciniciovigencia(Date feciniciovigencia) { + this.feciniciovigencia = feciniciovigencia; + } + + public Date getFecfinvigencia() { + return fecfinvigencia; + } + + public void setFecfinvigencia(Date fecfinvigencia) { + this.fecfinvigencia = fecfinvigencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramacumulamasivo != null ? paramacumulamasivo.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamAcumulaMasivo)) { + return false; + } + ParamAcumulaMasivo other = (ParamAcumulaMasivo) object; + if ((this.paramacumulamasivo == null && other.paramacumulamasivo != null) || (this.paramacumulamasivo != null && !this.paramacumulamasivo.equals(other.paramacumulamasivo))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.dao.ParamAcumulaMasivo[paramacumulamasivo=" + paramacumulamasivo + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaPunto.java b/src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaPunto.java new file mode 100644 index 000000000..d9594a0b0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ParamAcumulaPunto.java @@ -0,0 +1,226 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PARAM_ACUMULA_PUNTO_SEQ", sequenceName = "PARAM_ACUMULA_PUNTO_SEQ", allocationSize = 1) +@Table(name = "PARAM_ACUMULA_PUNTO") +public class ParamAcumulaPunto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_ACUMULA_PUNTO_SEQ") + @Column(name = "PARAMACUMULAPUNTO_ID") + private Integer paramacumulapuntoId; + @Column(name = "CANTOPERACIONDIA") + private Short cantoperaciondia; + @Column(name = "CANTBOLETOOPERACION") + private Integer cantboletooperacion; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date feciniciovigencia; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinvigencia; + @Column(name = "PORCCLIENTE") + private BigDecimal porccliente; + @Column(name = "PORCEMPRESA") + private BigDecimal porcempresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "FORMAPAGO_ID", referencedColumnName = "FORMAPAGO_ID") + @ManyToOne + private FormaPago formaPago; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + + public ParamAcumulaPunto() { + } + + public ParamAcumulaPunto(Integer paramacumulapuntoId) { + this.paramacumulapuntoId = paramacumulapuntoId; + } + + public Integer getParamacumulapuntoId() { + return paramacumulapuntoId; + } + + public void setParamacumulapuntoId(Integer paramacumulapuntoId) { + this.paramacumulapuntoId = paramacumulapuntoId; + } + + public Short getCantoperaciondia() { + return cantoperaciondia; + } + + public void setCantoperaciondia(Short cantoperaciondia) { + this.cantoperaciondia = cantoperaciondia; + } + + public Integer getCantboletooperacion() { + return cantboletooperacion; + } + + public void setCantboletooperacion(Integer cantboletooperacion) { + this.cantboletooperacion = cantboletooperacion; + } + + public Date getFeciniciovigencia() { + return feciniciovigencia; + } + + public void setFeciniciovigencia(Date feciniciovigencia) { + this.feciniciovigencia = feciniciovigencia; + } + + public Date getFecfinvigencia() { + return fecfinvigencia; + } + + public void setFecfinvigencia(Date fecfinvigencia) { + this.fecfinvigencia = fecfinvigencia; + } + + public BigDecimal getPorccliente() { + return porccliente; + } + + public void setPorccliente(BigDecimal porccliente) { + this.porccliente = porccliente; + } + + public BigDecimal getPorcempresa() { + return porcempresa; + } + + public void setPorcempresa(BigDecimal porcempresa) { + this.porcempresa = porcempresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramacumulapuntoId != null ? paramacumulapuntoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamAcumulaPunto)) { + return false; + } + ParamAcumulaPunto other = (ParamAcumulaPunto) object; + if ((this.paramacumulapuntoId == null && other.paramacumulapuntoId != null) || (this.paramacumulapuntoId != null && !this.paramacumulapuntoId.equals(other.paramacumulapuntoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "novasEntidades.ParamAcumulaPunto[paramacumulapuntoId=" + paramacumulapuntoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParamArticulo.java b/src/com/rjconsultores/ventaboletos/entidad/ParamArticulo.java new file mode 100644 index 000000000..a0adf01d7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ParamArticulo.java @@ -0,0 +1,79 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "PARAM_ARTICULO_SEQ", sequenceName = "PARAM_ARTICULO_SEQ", allocationSize = 1) +@Table(name = "PARAM_ARTICULO") +public class ParamArticulo implements Serializable{ + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_ARTICULO_SEQ") + @Basic(optional = false) + @Column(name = "PARAMARTICULO_ID") + private Integer paramArticuloID; + @Column(name = "CONCEPTO") + private String concepto; + @Column(name = "ARTICULO") + private String articulo; + + public Integer getParamArticuloID() { + return paramArticuloID; + } + public void setParamArticuloID(Integer paramArticuloID) { + this.paramArticuloID = paramArticuloID; + } + public String getConcepto() { + return concepto; + } + public void setConcepto(String concepto) { + this.concepto = concepto; + } + public String getArticulo() { + return articulo; + } + public void setArticulo(String articulo) { + this.articulo = articulo; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((paramArticuloID == null) ? 0 : paramArticuloID.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ParamArticulo other = (ParamArticulo) obj; + if (paramArticuloID == null) { + if (other.paramArticuloID != null) + return false; + } else if (!paramArticuloID.equals(other.paramArticuloID)) + return false; + return true; + } + @Override + public String toString() { + return this.getParamArticuloID() + " - " + this.getConcepto(); + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParamCanjePunto.java b/src/com/rjconsultores/ventaboletos/entidad/ParamCanjePunto.java new file mode 100644 index 000000000..bf700ee09 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ParamCanjePunto.java @@ -0,0 +1,181 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PARAM_CANJE_PUNTO_SEQ", sequenceName = "PARAM_CANJE_PUNTO_SEQ", allocationSize = 1) +@Table(name = "PARAM_CANJE_PUNTO") +public class ParamCanjePunto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_CANJE_PUNTO_SEQ") + @Column(name = "PARAMCANJEPUNTO_ID") + private Integer paramcanjepuntoId; + @Column(name = "CANTOPERACIONDIA") + private Short cantoperaciondia; + @Column(name = "CANTBOLETOOPERACION") + private Short cantboletooperacion; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date feciniciovigencia; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinvigencia; + @Column(name = "PORCENTAJE") + private BigDecimal porcentaje; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + + public ParamCanjePunto() { + } + + public ParamCanjePunto(Integer paramcanjepuntoId) { + this.paramcanjepuntoId = paramcanjepuntoId; + } + + public Integer getParamcanjepuntoId() { + return paramcanjepuntoId; + } + + public void setParamcanjepuntoId(Integer paramcanjepuntoId) { + this.paramcanjepuntoId = paramcanjepuntoId; + } + + public Short getCantoperaciondia() { + return cantoperaciondia; + } + + public void setCantoperaciondia(Short cantoperaciondia) { + this.cantoperaciondia = cantoperaciondia; + } + + public Short getCantboletooperacion() { + return cantboletooperacion; + } + + public void setCantboletooperacion(Short cantboletooperacion) { + this.cantboletooperacion = cantboletooperacion; + } + + public Date getFeciniciovigencia() { + return feciniciovigencia; + } + + public void setFeciniciovigencia(Date feciniciovigencia) { + this.feciniciovigencia = feciniciovigencia; + } + + public Date getFecfinvigencia() { + return fecfinvigencia; + } + + public void setFecfinvigencia(Date fecfinvigencia) { + this.fecfinvigencia = fecfinvigencia; + } + + public BigDecimal getPorcentaje() { + return porcentaje; + } + + public void setPorcentaje(BigDecimal porcentaje) { + this.porcentaje = porcentaje; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramcanjepuntoId != null ? paramcanjepuntoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamCanjePunto)) { + return false; + } + ParamCanjePunto other = (ParamCanjePunto) object; + if ((this.paramcanjepuntoId == null && other.paramcanjepuntoId != null) || (this.paramcanjepuntoId != null && !this.paramcanjepuntoId.equals(other.paramcanjepuntoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "novasEntidades.ParamCanjePunto[paramcanjepuntoId=" + paramcanjepuntoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParamCompraPunto.java b/src/com/rjconsultores/ventaboletos/entidad/ParamCompraPunto.java new file mode 100644 index 000000000..d83e36739 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ParamCompraPunto.java @@ -0,0 +1,127 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PARAM_COMPRA_PUNTO_SEQ", sequenceName = "PARAM_COMPRA_PUNTO_SEQ", allocationSize=1) +@Table(name = "PARAM_COMPRA_PUNTO") +public class ParamCompraPunto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_COMPRA_PUNTO_SEQ") + @Column(name = "PARAMCOMPRAPUNTO_ID") + private Integer paramcomprapuntoId; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date feciniciovigencia; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinvigencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public ParamCompraPunto() { + } + + public ParamCompraPunto(Integer paramcomprapuntoId) { + this.paramcomprapuntoId = paramcomprapuntoId; + } + + public Integer getParamcomprapuntoId() { + return paramcomprapuntoId; + } + + public void setParamcomprapuntoId(Integer paramcomprapuntoId) { + this.paramcomprapuntoId = paramcomprapuntoId; + } + + public Date getFeciniciovigencia() { + return feciniciovigencia; + } + + public void setFeciniciovigencia(Date feciniciovigencia) { + this.feciniciovigencia = feciniciovigencia; + } + + public Date getFecfinvigencia() { + return fecfinvigencia; + } + + public void setFecfinvigencia(Date fecfinvigencia) { + this.fecfinvigencia = fecfinvigencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramcomprapuntoId != null ? paramcomprapuntoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamCompraPunto)) { + return false; + } + ParamCompraPunto other = (ParamCompraPunto) object; + if ((this.paramcomprapuntoId == null && other.paramcomprapuntoId != null) || (this.paramcomprapuntoId != null && !this.paramcomprapuntoId.equals(other.paramcomprapuntoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "te.ParamCompraPunto[paramcomprapuntoId=" + paramcomprapuntoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParamConexion.java b/src/com/rjconsultores/ventaboletos/entidad/ParamConexion.java new file mode 100644 index 000000000..07e68ec74 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ParamConexion.java @@ -0,0 +1,133 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * + * @author gleimar + */ +@Entity +@Table(name = "PARAM_CONEXION") +public class ParamConexion implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Column(name = "PARAM_CONEXION_ID") + private Integer paramConexionId; + @Column(name = "DESCPARAMETRO") + private String descparametro; + @Column(name = "NOMBPARAMETRO") + private String nombparametro; + @Column(name = "VALOR_PARAMETRO") + private Integer valorParametro; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + + public ParamConexion() { + } + + public ParamConexion(Integer paramConexionId) { + this.paramConexionId = paramConexionId; + } + + public Integer getParamConexionId() { + return paramConexionId; + } + + public void setParamConexionId(Integer paramConexionId) { + this.paramConexionId = paramConexionId; + } + + public String getDescparametro() { + return descparametro; + } + + public void setDescparametro(String descparametro) { + this.descparametro = descparametro; + } + + public String getNombparametro() { + return nombparametro; + } + + public void setNombparametro(String nombparametro) { + this.nombparametro = nombparametro; + } + + public Integer getValorParametro() { + return valorParametro; + } + + public void setValorParametro(Integer valorParametro) { + this.valorParametro = valorParametro; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramConexionId != null ? paramConexionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamConexion)) { + return false; + } + ParamConexion other = (ParamConexion) object; + if ((this.paramConexionId == null && other.paramConexionId != null) || (this.paramConexionId != null && !this.paramConexionId.equals(other.paramConexionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.entidad.ParamConexion[ paramConexionId=" + paramConexionId + " ]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParamCostoTarjeta.java b/src/com/rjconsultores/ventaboletos/entidad/ParamCostoTarjeta.java new file mode 100644 index 000000000..30573ee3b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ParamCostoTarjeta.java @@ -0,0 +1,128 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PARAM_COSTO_TARJETA_SEQ", sequenceName = "PARAM_COSTO_TARJETA_SEQ", allocationSize=1) +@Table(name = "PARAM_COSTO_TARJETA") +public class ParamCostoTarjeta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_COSTO_TARJETA_SEQ") + @Column(name = "PARAMCOSTOTARJETA_ID") + private Integer paramcostotarjetaId; + @Column(name = "VALCOSTOINICIAL") + private BigDecimal valcostoinicial; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + public ParamCostoTarjeta() { + } + + public ParamCostoTarjeta(Integer paramcostotarjetaId) { + this.paramcostotarjetaId = paramcostotarjetaId; + } + + public Integer getParamcostotarjetaId() { + return paramcostotarjetaId; + } + + public void setParamcostotarjetaId(Integer paramcostotarjetaId) { + this.paramcostotarjetaId = paramcostotarjetaId; + } + + public BigDecimal getValcostoinicial() { + return valcostoinicial; + } + + public void setValcostoinicial(BigDecimal valcostoinicial) { + this.valcostoinicial = valcostoinicial; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramcostotarjetaId != null ? paramcostotarjetaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamCostoTarjeta)) { + return false; + } + ParamCostoTarjeta other = (ParamCostoTarjeta) object; + if ((this.paramcostotarjetaId == null && other.paramcostotarjetaId != null) || (this.paramcostotarjetaId != null && !this.paramcostotarjetaId.equals(other.paramcostotarjetaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "te.ParamCostoTarjeta[paramcostotarjetaId=" + paramcostotarjetaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java b/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java new file mode 100644 index 000000000..08a6a6d80 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@SequenceGenerator(name = "PARAM_RECOLECCION_SEQ", sequenceName = "PARAM_RECOLECCION_SEQ", allocationSize = 1) +@Table(name = "PARAM_RECOLECCION") +public class ParamRecoleccion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "PARAMRECOLECCION_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PARAM_RECOLECCION_SEQ") + private Integer paramrecoleccionId; + @Column(name = "IMPORTEINICIAL") + private BigDecimal importeinicial; + @Column(name = "IMPORTEADICIONAL") + private BigDecimal importeadicional; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + + public ParamRecoleccion() { + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public ParamRecoleccion(Integer paramrecoleccionId) { + this.paramrecoleccionId = paramrecoleccionId; + } + + public Integer getParamrecoleccionId() { + return paramrecoleccionId; + } + + public void setParamrecoleccionId(Integer paramrecoleccionId) { + this.paramrecoleccionId = paramrecoleccionId; + } + + public BigDecimal getImporteinicial() { + return importeinicial; + } + + public void setImporteinicial(BigDecimal importeinicial) { + this.importeinicial = importeinicial; + } + + public BigDecimal getImporteadicional() { + return importeadicional; + } + + public void setImporteadicional(BigDecimal importeadicional) { + this.importeadicional = importeadicional; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (paramrecoleccionId != null ? paramrecoleccionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ParamRecoleccion)) { + return false; + } + ParamRecoleccion other = (ParamRecoleccion) object; + if ((this.paramrecoleccionId == null && other.paramrecoleccionId != null) || (this.paramrecoleccionId != null && !this.paramrecoleccionId.equals(other.paramrecoleccionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ParamRecoleccion[paramrecoleccionId=" + paramrecoleccionId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Peaje.java b/src/com/rjconsultores/ventaboletos/entidad/Peaje.java new file mode 100644 index 000000000..2d14da4b4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Peaje.java @@ -0,0 +1,139 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PEAJE_SEQ", sequenceName = "PEAJE_SEQ", allocationSize = 1) +@Table(name = "PEAJE") +public class Peaje implements Serializable{ + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PEAJE_SEQ") + @Column(name = "PEAJE_ID") + private Integer pejaeId; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @OneToOne + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + private Parada origem; + @OneToOne + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + @OneToOne + @JoinColumn(name = "CASETAPEAJE_ID", referencedColumnName = "CASETAPEAJE_ID") + private CasetaPeaje casetaPeaje; + @Column(name = "CANTASIENTOS") + private BigDecimal cantAsientos; + @Column(name = "CANTEIXOS") + private BigDecimal cantEixos; + @Column(name = "IMPORTEPEAJE") + private BigDecimal importePeaje; + @Column(name = "INDICEPEAJE") + private BigDecimal indicePeaje; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + public Integer getPejaeId() { + return pejaeId; + } + public void setPejaeId(Integer pejaeId) { + this.pejaeId = pejaeId; + } + public Ruta getRuta() { + return ruta; + } + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + public Parada getOrigem() { + return origem; + } + public void setOrigem(Parada origem) { + this.origem = origem; + } + public Parada getDestino() { + return destino; + } + public void setDestino(Parada destino) { + this.destino = destino; + } + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + public CasetaPeaje getCasetaPeaje() { + return casetaPeaje; + } + public void setCasetaPeaje(CasetaPeaje casetaPeaje) { + this.casetaPeaje = casetaPeaje; + } + public BigDecimal getCantAsientos() { + return cantAsientos; + } + public void setCantAsientos(BigDecimal cantAsientos) { + this.cantAsientos = cantAsientos; + } + public BigDecimal getCantEixos() { + return cantEixos; + } + public void setCantEixos(BigDecimal cantEixos) { + this.cantEixos = cantEixos; + } + public BigDecimal getImportePeaje() { + return importePeaje; + } + public void setImportePeaje(BigDecimal importePeaje) { + this.importePeaje = importePeaje; + } + public BigDecimal getIndicePeaje() { + return indicePeaje; + } + public void setIndicePeaje(BigDecimal indicePeaje) { + this.indicePeaje = indicePeaje; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Perfil.java b/src/com/rjconsultores/ventaboletos/entidad/Perfil.java new file mode 100644 index 000000000..09a13f69d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Perfil.java @@ -0,0 +1,169 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PERFIL_SEQ", sequenceName = "PERFIL_SEQ", allocationSize = 1) +@Table(name = "PERFIL") +public class Perfil implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PERFIL_SEQ") + @Column(name = "PERFIL_ID") + private Integer perfilId; + @Column(name = "DESCPERFIL") + private String descperfil; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "INDJERARQUIA") + private Integer indJerarquia; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "perfil") + private List usuarioPerfilList; + @OneToMany(mappedBy = "perfil", cascade = CascadeType.ALL) + private List perfilFuncionList; + + public Perfil() { + } + + public Perfil(Integer perfilId) { + this.perfilId = perfilId; + } + + public Integer getPerfilId() { + return perfilId; + } + + public void setPerfilId(Integer perfilId) { + this.perfilId = perfilId; + } + + public String getDescperfil() { + return descperfil; + } + + public void setDescperfil(String descperfil) { + this.descperfil = descperfil; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getIndJerarquia() { + return indJerarquia; + } + + public void setIndJerarquia(Integer indJerarquia) { + this.indJerarquia = indJerarquia; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getUsuarioPerfilList() { + List tmp = new ArrayList(); + if (usuarioPerfilList != null) { + for (UsuarioPerfil cp : this.usuarioPerfilList) { + if (cp.getActivo()) { + tmp.add(cp); + } + } + } + + return tmp; + } + + public void setUsuarioPerfilList(List usuarioPerfilList) { + this.usuarioPerfilList = usuarioPerfilList; + } + + public List getPerfilFuncionList() { + List tmp = new ArrayList(); + if (perfilFuncionList != null) { + for (PerfilFuncion cp : this.perfilFuncionList) { + if (cp.getActivo()) { + tmp.add(cp); + } + } + } + + return tmp; + } + + public void setPerfilFuncionList(List perfilFuncionList) { + this.perfilFuncionList = perfilFuncionList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (perfilId != null ? perfilId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Perfil)) { + return false; + } + Perfil other = (Perfil) object; + if ((this.perfilId == null && other.perfilId != null) || (this.perfilId != null && !this.perfilId.equals(other.perfilId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDescperfil(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PerfilFuncion.java b/src/com/rjconsultores/ventaboletos/entidad/PerfilFuncion.java new file mode 100644 index 000000000..c54f252de --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PerfilFuncion.java @@ -0,0 +1,147 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@Table(name = "PERFIL_FUNCION") +@SequenceGenerator(name = "PERFIL_FUNCION_SEQ", sequenceName = "PERFIL_FUNCION_SEQ", allocationSize = 1) +public class PerfilFuncion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "PERFILFUNCION_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PERFIL_FUNCION_SEQ") + private Integer perfilfuncionId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PERFIL_ID", referencedColumnName = "PERFIL_ID") + @ManyToOne + private Perfil perfil; + @JoinColumn(name = "FUNCIONSISTEMA_ID", referencedColumnName = "FUNCIONSISTEMA_ID") + @ManyToOne + private FuncionSistema funcionSistema; + @Column(name = "INDLECTURA") + private Boolean indLectura; + + public PerfilFuncion() { + } + + public PerfilFuncion(Integer perfilfuncionId) { + this.perfilfuncionId = perfilfuncionId; + } + + public Integer getPerfilfuncionId() { + return perfilfuncionId; + } + + public void setPerfilfuncionId(Integer perfilfuncionId) { + this.perfilfuncionId = perfilfuncionId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Perfil getPerfil() { + return perfil; + } + + public void setPerfil(Perfil perfil) { + this.perfil = perfil; + } + + public FuncionSistema getFuncionSistema() { + return funcionSistema; + } + + public void setFuncionSistema(FuncionSistema funcionSistema) { + this.funcionSistema = funcionSistema; + } + + public Boolean getIndLectura() { + return indLectura; + } + + public void setIndLectura(Boolean indLectura) { + this.indLectura = indLectura; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (perfilfuncionId != null ? perfilfuncionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PerfilFuncion)) { + return false; + } + PerfilFuncion other = (PerfilFuncion) object; + + if((this.funcionSistema != null && other.funcionSistema != null) && this.perfilfuncionId == null && other.perfilfuncionId == null && this.funcionSistema.equals(other.funcionSistema)){ + return true; + } + if ((this.perfilfuncionId == null && other.perfilfuncionId != null) || (this.perfilfuncionId != null && !this.perfilfuncionId.equals(other.perfilfuncionId))) { + return false; + } + if((this.perfilfuncionId == other.perfilfuncionId) && (this.getFuncionSistema().getFuncionsistemaId() != other.getFuncionSistema().getFuncionsistemaId())) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PerfilFuncion[perfilfuncionId=" + perfilfuncionId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PeriodoVacacional.java b/src/com/rjconsultores/ventaboletos/entidad/PeriodoVacacional.java new file mode 100644 index 000000000..229f6bd6e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PeriodoVacacional.java @@ -0,0 +1,128 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PERIODO_VACACIONAL_SEQ", sequenceName = "PERIODO_VACACIONAL_SEQ", allocationSize = 1) +@Table(name = "PERIODO_VACACIONAL") +public class PeriodoVacacional implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PERIODO_VACACIONAL_SEQ") + @Column(name = "PERIODOVACACIONAL_ID") + private Integer periodovacacionalId; + @Column(name = "FECINICIO") + @Temporal(TemporalType.DATE) + private Date fecinicio; + @Column(name = "FECFINAL") + @Temporal(TemporalType.DATE) + private Date fecfinal; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public PeriodoVacacional() { + } + + public PeriodoVacacional(Integer periodovacacionalId) { + this.periodovacacionalId = periodovacacionalId; + } + + public Integer getPeriodovacacionalId() { + return periodovacacionalId; + } + + public void setPeriodovacacionalId(Integer periodovacacionalId) { + this.periodovacacionalId = periodovacacionalId; + } + + public Date getFecinicio() { + return fecinicio; + } + + public void setFecinicio(Date fecinicio) { + this.fecinicio = fecinicio; + } + + public Date getFecfinal() { + return fecfinal; + } + + public void setFecfinal(Date fecfinal) { + this.fecfinal = fecfinal; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (periodovacacionalId != null ? periodovacacionalId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PeriodoVacacional)) { + return false; + } + PeriodoVacacional other = (PeriodoVacacional) object; + if ((this.periodovacacionalId == null && other.periodovacacionalId != null) || (this.periodovacacionalId != null && !this.periodovacacionalId.equals(other.periodovacacionalId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PeriodoVacacional[periodovacacionalId=" + periodovacacionalId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Plaza.java b/src/com/rjconsultores/ventaboletos/entidad/Plaza.java new file mode 100644 index 000000000..f64fb239f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Plaza.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "PLAZA_SEQ", sequenceName = "PLAZA_SEQ", allocationSize=1) +@Table(name = "PLAZA") +public class Plaza implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PLAZA_SEQ") + @Column(name = "PLAZA_ID") + private Integer plazaId; + @Column(name = "NOMBPLAZA") + private String nombplaza; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Plaza() { + } + + public Plaza(Integer plazaId) { + this.plazaId = plazaId; + } + + public Integer getPlazaId() { + return plazaId; + } + + public void setPlazaId(Integer plazaId) { + this.plazaId = plazaId; + } + + public String getNombplaza() { + return nombplaza; + } + + public void setNombplaza(String nombplaza) { + this.nombplaza = nombplaza; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (plazaId != null ? plazaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Plaza)) { + return false; + } + Plaza other = (Plaza) object; + if ((this.plazaId == null && other.plazaId != null) || (this.plazaId != null && !this.plazaId.equals(other.plazaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNombplaza(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PrecioFixoPedagio.java b/src/com/rjconsultores/ventaboletos/entidad/PrecioFixoPedagio.java new file mode 100644 index 000000000..d98cdb0b0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PrecioFixoPedagio.java @@ -0,0 +1,180 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * @author Bruno Neves + * + */ +@Entity +@SequenceGenerator(name = "PRECIO_FIXO_PEDAGIO_SEQ", sequenceName = "PRECIO_FIXO_PEDAGIO_SEQ", allocationSize = 1) +@Table(name = "PRECIO_FIXO_PEDAGIO") +public class PrecioFixoPedagio implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRECIO_FIXO_PEDAGIO_SEQ") + @Column(name = "PRECIOFIXOPEDAGIO_ID") + private Integer precioFixoId; + + @ManyToOne + @JoinColumn(name = "PRACAPEDAGIO_ID", referencedColumnName = "CASETAPEAJE_ID") + private CasetaPeaje pracaPedagioId; + + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedenteId; + + @OneToOne + @JoinColumn(name = "CLASSESERVICO_ID", referencedColumnName = "CLASESERVICIO_ID") + private ClaseServicio classeId; + + @Column(name = "VALORFIXO") + private BigDecimal valorFixo; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + + public Integer getPrecioFixoId() { + return precioFixoId; + } + + public void setPrecioFixoId(Integer precioFixoId) { + this.precioFixoId = precioFixoId; + } + + public CasetaPeaje getPracaPedagioId() { + return pracaPedagioId; + } + + public void setPracaPedagioId(CasetaPeaje pracaPedagioId) { + this.pracaPedagioId = pracaPedagioId; + } + + public OrgaoConcedente getOrgaoConcedenteId() { + return orgaoConcedenteId; + } + + public void setOrgaoConcedenteId(OrgaoConcedente orgaoConcedenteId) { + this.orgaoConcedenteId = orgaoConcedenteId; + } + + public ClaseServicio getClasseId() { + return classeId; + } + + public void setClasseId(ClaseServicio classeId) { + this.classeId = classeId; + } + + public BigDecimal getValorFixo() { + return valorFixo; + } + + public void setValorFixo(BigDecimal valorFixo) { + this.valorFixo = valorFixo; + } + + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((classeId == null) ? 0 : classeId.hashCode()); + result = prime * result + ((orgaoConcedenteId == null) ? 0 : orgaoConcedenteId.hashCode()); + result = prime * result + ((pracaPedagioId == null) ? 0 : pracaPedagioId.hashCode()); + result = prime * result + ((precioFixoId == null) ? 0 : precioFixoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PrecioFixoPedagio other = (PrecioFixoPedagio) obj; + if (classeId == null) { + if (other.classeId != null) + return false; + } else if (!classeId.equals(other.classeId)) + return false; + if (orgaoConcedenteId == null) { + if (other.orgaoConcedenteId != null) + return false; + } else if (!orgaoConcedenteId.equals(other.orgaoConcedenteId)) + return false; + if (pracaPedagioId == null) { + if (other.pracaPedagioId != null) + return false; + } else if (!pracaPedagioId.equals(other.pracaPedagioId)) + return false; + if (precioFixoId == null) { + if (other.precioFixoId != null) + return false; + } else if (!precioFixoId.equals(other.precioFixoId)) + return false; + return true; + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PrecioVentaja.java b/src/com/rjconsultores/ventaboletos/entidad/PrecioVentaja.java new file mode 100644 index 000000000..71ee787c7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PrecioVentaja.java @@ -0,0 +1,212 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * @author Thiago + * + */ +@Entity +@SequenceGenerator(name = "PRECIO_VENTAJA_SEQ", sequenceName = "PRECIO_VENTAJA_SEQ", allocationSize = 1) +@Table(name = "PRECIO_VENTAJA") +public class PrecioVentaja implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRECIO_VENTAJA_SEQ") + @Column(name = "PRECIOVENTAJA_ID") + private Integer precioVentajaId; + + @OneToOne + @JoinColumn(name = "RUTA_ORIGINAL_ID", referencedColumnName = "RUTA_ID") + private Ruta rutaOriginalId; + + @OneToOne + @JoinColumn(name = "ORIGEN_ORIGINAL_ID", referencedColumnName = "PARADA_ID") + private Parada origenOriginalId; + + @OneToOne + @JoinColumn(name = "DESTINO_ORIGINAL_ID", referencedColumnName = "PARADA_ID") + private Parada destinoOriginalId; + + @Column(name = "INDPREFIXOORIGEN") + private Boolean indPrefixoOrigen; + + @Column(name = "FECINICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date fechaInicio; + + @Column(name = "FECFINAL") + @Temporal(TemporalType.TIMESTAMP) + private Date fechaFinal; + + @OneToOne + @JoinColumn(name = "RUTA_PRECIO_ID", referencedColumnName = "RUTA_ID") + private Ruta rutaPrecioId; + + @Column(name = "CORRIDA_ID") + private Integer corridaId; + + @OneToOne + @JoinColumn(name = "ORIGEN_PRECIO_ID", referencedColumnName = "PARADA_ID") + private Parada origenPrecioId; + + @OneToOne + @JoinColumn(name = "DESTINO_PRECIO_ID", referencedColumnName = "PARADA_ID") + private Parada destinoPrecioId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "INDCLASSEAPROVEITAMENTO") + private Boolean indClasseAproveitamento; + + public Integer getPrecioVentajaId() { + return precioVentajaId; + } + + public void setPrecioVentajaId(Integer precioVentajaId) { + this.precioVentajaId = precioVentajaId; + } + + public Ruta getRutaOriginalId() { + return rutaOriginalId; + } + + public void setRutaOriginalId(Ruta rutaOriginalId) { + this.rutaOriginalId = rutaOriginalId; + } + + public Parada getOrigenOriginalId() { + return origenOriginalId; + } + + public void setOrigenOriginalId(Parada origenOriginalId) { + this.origenOriginalId = origenOriginalId; + } + + public Parada getDestinoOriginalId() { + return destinoOriginalId; + } + + public void setDestinoOriginalId(Parada destinoOriginalId) { + this.destinoOriginalId = destinoOriginalId; + } + + public Boolean getIndPrefixoOrigen() { + return indPrefixoOrigen; + } + + public void setIndPrefixoOrigen(Boolean indPrefixoOrigen) { + this.indPrefixoOrigen = indPrefixoOrigen; + } + + public Date getFechaInicio() { + return fechaInicio; + } + + public void setFechaInicio(Date fechaInicio) { + this.fechaInicio = fechaInicio; + } + + public Date getFechaFinal() { + return fechaFinal; + } + + public void setFechaFinal(Date fechaFinal) { + this.fechaFinal = fechaFinal; + } + + public Ruta getRutaPrecioId() { + return rutaPrecioId; + } + + public void setRutaPrecioId(Ruta rutaPrecioId) { + this.rutaPrecioId = rutaPrecioId; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Parada getOrigenPrecioId() { + return origenPrecioId; + } + + public void setOrigenPrecioId(Parada origenPrecioId) { + this.origenPrecioId = origenPrecioId; + } + + public Parada getDestinoPrecioId() { + return destinoPrecioId; + } + + public void setDestinoPrecioId(Parada destinoPrecioId) { + this.destinoPrecioId = destinoPrecioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getIndClasseAproveitamento() { + return indClasseAproveitamento == null ? false : indClasseAproveitamento; + } + + public void setIndClasseAproveitamento(Boolean indClasseAproveitamento) { + this.indClasseAproveitamento = indClasseAproveitamento; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PrecoApanhe.java b/src/com/rjconsultores/ventaboletos/entidad/PrecoApanhe.java new file mode 100644 index 000000000..12e1c6475 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PrecoApanhe.java @@ -0,0 +1,146 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "PRECO_APANHE") +@SequenceGenerator(name = "PRECO_APANHE_SEQ", sequenceName = "PRECO_APANHE_SEQ", allocationSize = 1) +public class PrecoApanhe implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRECO_APANHE_SEQ") + @Column(name = "PRECOAPANHE_ID") + private Long precoapanheId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "HOTEL_ID") + private Hotel hotel; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "COLONIA_ID") + private Colonia colonia; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CIUDAD_ID") + private Ciudad ciudad; + + @Column(name = "PRECO", columnDefinition = "NUMBER(5,2)") + private BigDecimal preco; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.DATE) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getPrecoapanheId() { + return precoapanheId; + } + + public void setPrecoapanheId(Long precoapanheId) { + this.precoapanheId = precoapanheId; + } + + public Hotel getHotel() { + return hotel; + } + + public void setHotel(Hotel hotel) { + this.hotel = hotel; + } + + public Colonia getColonia() { + return colonia; + } + + public void setColonia(Colonia colonia) { + this.colonia = colonia; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + public BigDecimal getPreco() { + return preco; + } + + public void setPreco(BigDecimal preco) { + this.preco = preco; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((precoapanheId == null) ? 0 : precoapanheId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + PrecoApanhe other = (PrecoApanhe) obj; + if (precoapanheId == null) { + if (other.precoapanheId != null) + return false; + } else if (!precoapanheId.equals(other.precoapanheId)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Pricing.java b/src/com/rjconsultores/ventaboletos/entidad/Pricing.java new file mode 100644 index 000000000..920001c4c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Pricing.java @@ -0,0 +1,574 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang.BooleanUtils; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_SEQ", sequenceName = "PRICING_SEQ", allocationSize = 1) +@Table(name = "PRICING") +public class Pricing implements Serializable { + + private static final long serialVersionUID = 1L; + public static final Integer ATIVO = 1; + public static final Integer INATIVO = 2; + public static final Integer EXCLUIDO = 0; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_SEQ") + @Column(name = "PRICING_ID") + private Integer pricingId; + @Column(name = "NOMBPRICING") + private String nombPricing; + @Column(name = "CANTBOLETO") + private Short cantboleto; + // Rafael - Campo retirado pela Leticia no dia 15/02/2011. + // @Column(name = "DESCUENTOIMPORTE") + // private BigDecimal descuentoimporte; + @Column(name = "DESCUENTOPORCENTAJE") + private BigDecimal descuentoporcentaje; + @Column(name = "DESCUENTOPORCREDONDO") + private BigDecimal descuentoporcredondo; + @Column(name = "INDTRANSFERIBLE") + private Boolean indtransferible; + @Column(name = "INDRESERVABLE") + private Boolean indreservable; + @Column(name = "EXIBEVENDA") + private Boolean exibeVenda; + @Column(name = "INDCANCELABLE") + private Boolean indcancelable; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "CANTDIASANTICIPACION") + private Integer cantdiasanticipacion; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingAsientoList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingMercadoList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingMarcaList; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingRutaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingDiaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingImporteList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingTipoptovtaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingCategoriaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingVigenciaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingClaseList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingCorridaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingPuntoventaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingTipoServicioList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingOcupaAntecipaList; + @OneToMany(mappedBy = "pricing", cascade = CascadeType.ALL) + private List pricingFormapagoList; + @Column(name = "INDGENERAFERIADOVIAJE") + private String indGeneraFeriadoViaje; + @Column(name = "INDGENERAFERIADOVENTA") + private String indGeneraFeriadoVenta; + + @Column(name = "INDOCUPACAOPORTRECHO") + private Boolean indOcupacaoPorTrecho; + + @Column(name = "INDSOMENTEASSENTOSUGERIDO") + private Boolean indSomenteAssentoSugerido; + + @Column(name = "INDPRICINGDIVIDIRIDAEVOLTA") + private Boolean indPricingDividirIdaEVolta; + + @Column(name = "INDSAFER") + private Boolean indSafer; + + public enum GerarFeriado { + // Declaração dos enum + GERARSEMPRE("GERAR SEMPRE", "S"), + + GERARQUANDOFERIADO("GERAR SÓ QUANDO FOR FERIADO", "F"), + + GERARQUANDONAOFERIADO("GERAR QUANDO NÃO FOR FERIADO", "N"); + + // Definição das constantes + public final String valor; + public final String descricao; + + public String valor() { + return this.valor; + } + + public String descricao() { + return this.descricao; + } + + private GerarFeriado(String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + } + + public Pricing() { + } + + public Pricing(Integer pricingId) { + this.pricingId = pricingId; + } + + public Integer getPricingId() { + return pricingId; + } + + public void setPricingId(Integer pricingId) { + this.pricingId = pricingId; + } + + public Short getCantboleto() { + return cantboleto; + } + + public Integer getCantdiasanticipacion() { + return cantdiasanticipacion; + } + + public void setCantdiasanticipacion(Integer cantdiasanticipacion) { + this.cantdiasanticipacion = cantdiasanticipacion; + } + + public void setCantboleto(Short cantboleto) { + this.cantboleto = cantboleto; + } + + public BigDecimal getDescuentoporcentaje() { + return descuentoporcentaje; + } + + public void setDescuentoporcentaje(BigDecimal descuentoporcentaje) { + this.descuentoporcentaje = descuentoporcentaje; + } + + public BigDecimal getDescuentoporcredondo() { + return descuentoporcredondo; + } + + public void setDescuentoporcredondo(BigDecimal descuentoporcredondo) { + this.descuentoporcredondo = descuentoporcredondo; + } + + public Boolean getIndtransferible() { + return BooleanUtils.toBoolean(indtransferible); + } + + public void setIndtransferible(Boolean indtransferible) { + this.indtransferible = indtransferible; + } + + public Boolean getIndreservable() { + return BooleanUtils.toBoolean(indreservable); + } + + public void setIndreservable(Boolean indreservable) { + this.indreservable = indreservable; + } + + public Boolean getIndcancelable() { + return BooleanUtils.toBoolean(indcancelable); + } + + public void setIndcancelable(Boolean indcancelable) { + this.indcancelable = indcancelable; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPricingOcupaAntecipaList() { + List poaList = new ArrayList(); + for (PricingOcupaAntecipa poa : this.pricingOcupaAntecipaList) { + if (poa.getActivo() != EXCLUIDO.intValue()) { + poaList.add(poa); + } + } + return poaList; + } + + public void setPricingOcupaAntecipaList(List pricingOcupaAntecipaList) { + this.pricingOcupaAntecipaList = pricingOcupaAntecipaList; + } + + public List getPricingAsientoList() { + List paList = new ArrayList(); + for (PricingAsiento pa : this.pricingAsientoList) { + if (pa.getActivo() != EXCLUIDO.intValue()) { + paList.add(pa); + } + } + + return paList; + } + + public void setPricingAsientoList(List pricingAsientoList) { + this.pricingAsientoList = pricingAsientoList; + } + + public List getPricingMercadoList() { + List pmList = new ArrayList(); + for (PricingMercado pm : this.pricingMercadoList) { + if (pm.getActivo() != EXCLUIDO.intValue()) { + pmList.add(pm); + } + } + + return pmList; + } + + public void setPricingMercadoList(List pricingMercadoList) { + this.pricingMercadoList = pricingMercadoList; + } + + public List getPricingMarcaList() { + List pmList = new ArrayList(); + for (PricingMarca pm : this.pricingMarcaList) { + if (pm.getActivo() != EXCLUIDO.intValue()) { + pmList.add(pm); + } + } + + return pmList; + } + + public void setPricingMarcaList(List pricingMarcaList) { + this.pricingMarcaList = pricingMarcaList; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public List getPricingRutaList() { + List prList = new ArrayList(); + for (PricingRuta pr : this.pricingRutaList) { + if (pr.getActivo() != EXCLUIDO.intValue()) { + prList.add(pr); + } + } + + return prList; + } + + public void setPricingRutaList(List pricingRutaList) { + this.pricingRutaList = pricingRutaList; + } + + public List getPricingDiaList() { + List pdList = new ArrayList(); + for (PricingDia pd : this.pricingDiaList) { + if (pd.getActivo() != EXCLUIDO.intValue()) { + pdList.add(pd); + } + } + + return pdList; + } + + public void setPricingDiaList(List pricingDiaList) { + this.pricingDiaList = pricingDiaList; + } + + public List getPricingImporteList() { + List piList = new ArrayList(); + for (PricingImporte pi : this.pricingImporteList) { + if (pi.getActivo() != EXCLUIDO.intValue()) { + piList.add(pi); + } + } + + return piList; + } + + public void setPricingImporteList(List pricingImporteList) { + this.pricingImporteList = pricingImporteList; + } + + public List getPricingTipoptovtaList() { + List ptList = new ArrayList(); + for (PricingTipoPtoVta pt : this.pricingTipoptovtaList) { + if (pt.getActivo() != EXCLUIDO.intValue()) { + ptList.add(pt); + } + } + + return ptList; + } + + public void setPricingTipoptovtaList(List pricingTipoptovtaList) { + this.pricingTipoptovtaList = pricingTipoptovtaList; + } + + public List getPricingCategoriaList() { + List pcList = new ArrayList(); + for (PricingCategoria pc : this.pricingCategoriaList) { + if (pc.getActivo() != EXCLUIDO.intValue()) { + pcList.add(pc); + } + } + + return pcList; + } + + public void setPricingCategoriaList(List pricingCategoriaList) { + this.pricingCategoriaList = pricingCategoriaList; + } + + public List getPricingVigenciaList() { + List pvList = new ArrayList(); + if (this.pricingVigenciaList != null) { + for (PricingVigencia pv : this.pricingVigenciaList) { + if (pv.getActivo() != EXCLUIDO.intValue()) { + pvList.add(pv); + } + } + } + + return pvList; + } + + public void setPricingVigenciaList(List pricingVigenciaList) { + this.pricingVigenciaList = pricingVigenciaList; + } + + public List getPricingClaseList() { + List pcList = new ArrayList(); + for (PricingClase pc : this.pricingClaseList) { + if (pc.getActivo() != EXCLUIDO.intValue()) { + pcList.add(pc); + } + } + + return pcList; + } + + public void setPricingClaseList(List pricingClaseList) { + this.pricingClaseList = pricingClaseList; + } + + public List getPricingCorridaList() { + List pcList = new ArrayList(); + if (pricingCorridaList == null) { + return null; + } + + for (PricingCorrida pc : this.pricingCorridaList) { + if (pc.getActivo() != EXCLUIDO.intValue()) { + pcList.add(pc); + } + } + + return pcList; + } + + public void setPricingCorridaList(List pricingCorridaList) { + this.pricingCorridaList = pricingCorridaList; + } + + public List getPricingPuntoventaList() { + List ppList = new ArrayList(); + for (PricingPuntoVenta pp : this.pricingPuntoventaList) { + if (pp.getActivo() != EXCLUIDO.intValue()) { + ppList.add(pp); + } + } + + return ppList; + } + + public void setPricingPuntoventaList(List pricingPuntoventaList) { + this.pricingPuntoventaList = pricingPuntoventaList; + } + + public List getPricingTipoServicioList() { + List ppList = new ArrayList(); + for (PricingTipoServicio pp : this.pricingTipoServicioList) { + if (pp.getActivo() != EXCLUIDO.intValue()) { + ppList.add(pp); + } + } + + return ppList; + } + + public void setPricingTipoServicioList(List pricingTipoServicioList) { + this.pricingTipoServicioList = pricingTipoServicioList; + } + + public List getPricingFormapagoList() { + + List pfpList = new ArrayList(); + for (PricingFormapago pfp : this.pricingFormapagoList) { + if (pfp.getActivo() != EXCLUIDO.intValue()) { + pfpList.add(pfp); + } + } + + return pfpList; + } + + public void setPricingFormapagoList(List pricingFormapagoList) { + this.pricingFormapagoList = pricingFormapagoList; + } + + public String getIndGeneraFeriadoViaje() { + return indGeneraFeriadoViaje; + } + + public void setIndGeneraFeriadoViaje(String indGeneraFeriadoViaje) { + this.indGeneraFeriadoViaje = indGeneraFeriadoViaje; + } + + public String getIndGeneraFeriadoVenta() { + return indGeneraFeriadoVenta; + } + + public void setIndGeneraFeriadoVenta(String indGeneraFeriadoVenta) { + this.indGeneraFeriadoVenta = indGeneraFeriadoVenta; + } + + public String getNombPricing() { + return nombPricing; + } + + public void setNombPricing(String nombPricing) { + this.nombPricing = nombPricing; + } + + public Boolean getExibeVenda() { + return BooleanUtils.toBoolean(exibeVenda); + } + + public void setExibeVenda(Boolean exibeVenda) { + this.exibeVenda = exibeVenda; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingId != null ? pricingId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Pricing)) { + return false; + } + Pricing other = (Pricing) object; + if ((this.pricingId == null && other.pricingId != null) || (this.pricingId != null && !this.pricingId.equals(other.pricingId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.Pricing[pricingId=" + pricingId + "]"; + } + + public Boolean getIndOcupacaoPorTrecho() { + return BooleanUtils.toBoolean(indOcupacaoPorTrecho); + } + + public void setIndOcupacaoPorTrecho(Boolean indOcupacaoPorTrecho) { + this.indOcupacaoPorTrecho = indOcupacaoPorTrecho; + } + + public Boolean getIndSomenteAssentoSugerido() { + return BooleanUtils.toBoolean(indSomenteAssentoSugerido); + } + + public void setIndSomenteAssentoSugerido(Boolean indSomenteAssentoSugerido) { + this.indSomenteAssentoSugerido = indSomenteAssentoSugerido; + } + + public Boolean getIndPricingDividirIdaEVolta() { + return BooleanUtils.toBoolean(indPricingDividirIdaEVolta); + } + + public void setIndPricingDividirIdaEVolta(Boolean indPricingDividirIdaEVolta) { + this.indPricingDividirIdaEVolta = indPricingDividirIdaEVolta; + } + + public Boolean getIndSafer() { + return indSafer; + } + + public void setIndSafer(Boolean indSafer) { + this.indSafer = indSafer; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingAsiento.java b/src/com/rjconsultores/ventaboletos/entidad/PricingAsiento.java new file mode 100644 index 000000000..3148bbfac --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingAsiento.java @@ -0,0 +1,149 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_ASIENTO_SEQ", sequenceName = "PRICING_ASIENTO_SEQ", allocationSize = 1) +@Table(name = "PRICING_ASIENTO") +public class PricingAsiento implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_ASIENTO_SEQ") + @Column(name = "PRICINGASIENTO_ID") + private Integer pricingasientoId; + @Column(name = "NUMEASIENTO") + private String numeasiento; + @Column(name = "NOMBIMAGEN") + private String nombImagen; + @Column(name = "PORCENTAJE") + private BigDecimal porcentaje; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + + public PricingAsiento() { + } + + public PricingAsiento(Integer pricingasientoId) { + this.pricingasientoId = pricingasientoId; + } + + public Integer getPricingasientoId() { + return pricingasientoId; + } + + public void setPricingasientoId(Integer pricingasientoId) { + this.pricingasientoId = pricingasientoId; + } + + public String getNumeasiento() { + return numeasiento; + } + + public void setNumeasiento(String numeasiento) { + this.numeasiento = numeasiento; + } + + public BigDecimal getPorcentaje() { + return porcentaje; + } + + public void setPorcentaje(BigDecimal porcentaje) { + this.porcentaje = porcentaje; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public String getNombImagen() { + return nombImagen; + } + + public void setNombImagen(String nombImagen) { + this.nombImagen = nombImagen; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingasientoId != null ? pricingasientoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingAsiento)) { + return false; + } + PricingAsiento other = (PricingAsiento) object; + if ((this.pricingasientoId == null && other.pricingasientoId != null) || (this.pricingasientoId != null && !this.pricingasientoId.equals(other.pricingasientoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingAsiento[pricingasientoId=" + pricingasientoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingCategoria.java b/src/com/rjconsultores/ventaboletos/entidad/PricingCategoria.java new file mode 100644 index 000000000..ed0aa8a88 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingCategoria.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_CATEGORIA_SEQ", sequenceName = "PRICING_CATEGORIA_SEQ", allocationSize = 1) +@Table(name = "PRICING_CATEGORIA") +public class PricingCategoria implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_CATEGORIA_SEQ") + @Column(name = "PRICINGCATEGORIA_ID") + private Integer pricingcategoriaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + + public PricingCategoria() { + } + + public PricingCategoria(Integer pricingcategoriaId) { + this.pricingcategoriaId = pricingcategoriaId; + } + + public Integer getPricingcategoriaId() { + return pricingcategoriaId; + } + + public void setPricingcategoriaId(Integer pricingcategoriaId) { + this.pricingcategoriaId = pricingcategoriaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingcategoriaId != null ? pricingcategoriaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingCategoria)) { + return false; + } + PricingCategoria other = (PricingCategoria) object; + if ((this.pricingcategoriaId == null && other.pricingcategoriaId != null) || (this.pricingcategoriaId != null && !this.pricingcategoriaId.equals(other.pricingcategoriaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingCategoria[pricingcategoriaId=" + pricingcategoriaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingClase.java b/src/com/rjconsultores/ventaboletos/entidad/PricingClase.java new file mode 100644 index 000000000..e0833e344 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingClase.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_CLASE_SEQ", sequenceName = "PRICING_CLASE_SEQ", allocationSize = 1) +@Table(name = "PRICING_CLASE") +public class PricingClase implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_CLASE_SEQ") + @Column(name = "PRICINGCLASE_ID") + private Integer pricingclaseId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public PricingClase() { + } + + public PricingClase(Integer pricingclaseId) { + this.pricingclaseId = pricingclaseId; + } + + public Integer getPricingclaseId() { + return pricingclaseId; + } + + public void setPricingclaseId(Integer pricingclaseId) { + this.pricingclaseId = pricingclaseId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingclaseId != null ? pricingclaseId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingClase)) { + return false; + } + PricingClase other = (PricingClase) object; + if ((this.pricingclaseId == null && other.pricingclaseId != null) || (this.pricingclaseId != null && !this.pricingclaseId.equals(other.pricingclaseId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingClase[pricingclaseId=" + pricingclaseId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingClasseTarifaria.java b/src/com/rjconsultores/ventaboletos/entidad/PricingClasseTarifaria.java new file mode 100644 index 000000000..1fd65bba2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingClasseTarifaria.java @@ -0,0 +1,136 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PRICING_CLASSE_TARIFARIA_SEQ", sequenceName = "PRICING_CLASSE_TARIFARIA_SEQ", allocationSize = 1) +@Table(name = "PRICING_CLASSE_TARIFARIA") +public class PricingClasseTarifaria implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_CLASSE_TARIFARIA_SEQ") + @Column(name = "PRICINGCLASSETARIFARIA_ID") + private Integer pricingClasseTarifariaId; + @Column(name = "DESCCLASSE_TARIFARIA") + private String descClasseTarifaria; + @Column(name = "SIGLA") + private String sigla; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public PricingClasseTarifaria() { + super(); + } + + public PricingClasseTarifaria(Integer pricingClasseTarifariaId) { + this(); + this.pricingClasseTarifariaId = pricingClasseTarifariaId; + } + + public Integer getPricingClasseTarifariaId() { + return pricingClasseTarifariaId; + } + + public void setPricingClasseTarifariaId(Integer pricingClasseTarifariaId) { + this.pricingClasseTarifariaId = pricingClasseTarifariaId; + } + + public String getDescClasseTarifaria() { + return descClasseTarifaria; + } + + public void setDescClasseTarifaria(String descClasseTarifaria) { + this.descClasseTarifaria = descClasseTarifaria; + } + + public String getSigla() { + return sigla; + } + + public void setSigla(String sigla) { + this.sigla = sigla; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((pricingClasseTarifariaId == null) ? 0 : pricingClasseTarifariaId.hashCode()); + result = prime * result + ((sigla == null) ? 0 : sigla.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PricingClasseTarifaria other = (PricingClasseTarifaria) obj; + if (pricingClasseTarifariaId == null) { + if (other.pricingClasseTarifariaId != null) + return false; + } else if (!pricingClasseTarifariaId.equals(other.pricingClasseTarifariaId)) + return false; + if (sigla == null) { + if (other.sigla != null) + return false; + } else if (!sigla.equals(other.sigla)) + return false; + return true; + } + + @Override + public String toString() { + return descClasseTarifaria + " - " + sigla; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingCorrida.java b/src/com/rjconsultores/ventaboletos/entidad/PricingCorrida.java new file mode 100644 index 000000000..dffc1443b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingCorrida.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_CORRIDA_SEQ", sequenceName = "PRICING_CORRIDA_SEQ", allocationSize = 1) +@Table(name = "PRICING_CORRIDA") +public class PricingCorrida implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_CORRIDA_SEQ") + @Column(name = "PRICINGCORRIDA_ID") + private Integer pricingcorridaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "CORRIDA_ID", referencedColumnName = "CORRIDA_ID") + @ManyToOne + private CorridaCtrl corridaCtrl; + + public PricingCorrida() { + } + + public PricingCorrida(Integer pricingcorridaId) { + this.pricingcorridaId = pricingcorridaId; + } + + public Integer getPricingcorridaId() { + return pricingcorridaId; + } + + public void setPricingcorridaId(Integer pricingcorridaId) { + this.pricingcorridaId = pricingcorridaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public CorridaCtrl getCorridaCtrl() { + return corridaCtrl; + } + + public void setCorridaCtrl(CorridaCtrl corridaCtrl) { + this.corridaCtrl = corridaCtrl; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingcorridaId != null ? pricingcorridaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingCorrida)) { + return false; + } + PricingCorrida other = (PricingCorrida) object; + if ((this.pricingcorridaId == null && other.pricingcorridaId != null) || (this.pricingcorridaId != null && !this.pricingcorridaId.equals(other.pricingcorridaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingCorrida[pricingcorridaId=" + pricingcorridaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/PricingCtrl.java new file mode 100644 index 000000000..dae57e13a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingCtrl.java @@ -0,0 +1,97 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PRICING_CTRL_SEQ", sequenceName = "PRICING_CTRL_SEQ", allocationSize = 1) +@Table(name = "PRICING_CTRL") +public class PricingCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_CTRL_SEQ") + @Column(name = "PRICINGCTRL_ID") + private Integer pricingctrlId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getPricingctrlId() { + return pricingctrlId; + } + + public void setPricingctrlId(Integer pricingctrlId) { + this.pricingctrlId = pricingctrlId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getPricingctrlId() == null) ? 0 : getPricingctrlId().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof PricingCtrl)) + return false; + PricingCtrl other = (PricingCtrl) obj; + if (getPricingctrlId() == null) { + if (other.getPricingctrlId() != null) + return false; + } else if (!getPricingctrlId().equals(other.getPricingctrlId())) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingDia.java b/src/com/rjconsultores/ventaboletos/entidad/PricingDia.java new file mode 100644 index 000000000..d6016cee6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingDia.java @@ -0,0 +1,234 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang.BooleanUtils; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_DIA_SEQ", sequenceName = "PRICING_DIA_SEQ", allocationSize = 1) +@Table(name = "PRICING_DIA") +public class PricingDia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_DIA_SEQ") + @Column(name = "PRICINGDIA_ID") + private Integer pricingdiaId; + @Column(name = "INDLUNES") + private Boolean indlunes; + @Column(name = "INDMARTES") + private Boolean indmartes; + @Column(name = "INDMIERCOLES") + private Boolean indmiercoles; + @Column(name = "INDJUEVES") + private Boolean indjueves; + @Column(name = "INDVIERNES") + private Boolean indviernes; + @Column(name = "INDSABADO") + private Boolean indsabado; + @Column(name = "INDDOMINGO") + private Boolean inddomingo; + @Column(name = "HORARIOINICIO") + @Temporal(TemporalType.TIMESTAMP) + // Fue cambido de TIME para TIMESTAMP porque cuando está time el año que se salva el 1900 y no 1970. + private Date horarioinicio; + @Column(name = "HORARIOFIN") + @Temporal(TemporalType.TIMESTAMP) + // Fue cambido de TIME para TIMESTAMP porque cuando está time el año que se salva el 1900 y no 1970. + private Date horariofin; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "INDFECVIAJE") + private Boolean indfecviaje; + @Column(name = "INDFECVENTA") + private Boolean indfecventa; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + + public PricingDia() { + } + + public PricingDia(Integer pricingdiaId) { + this.pricingdiaId = pricingdiaId; + } + + public Integer getPricingdiaId() { + return pricingdiaId; + } + + public void setPricingdiaId(Integer pricingdiaId) { + this.pricingdiaId = pricingdiaId; + } + + public Boolean getInddomingo() { + return BooleanUtils.toBoolean(inddomingo); + } + + public void setInddomingo(Boolean inddomingo) { + this.inddomingo = inddomingo; + } + + public Boolean getIndjueves() { + return BooleanUtils.toBoolean(indjueves); + } + + public void setIndjueves(Boolean indjueves) { + this.indjueves = indjueves; + } + + public Boolean getIndlunes() { + return BooleanUtils.toBoolean(indlunes); + } + + public void setIndlunes(Boolean indlunes) { + this.indlunes = indlunes; + } + + public Boolean getIndmartes() { + return BooleanUtils.toBoolean(indmartes); + } + + public void setIndmartes(Boolean indmartes) { + this.indmartes = indmartes; + } + + public Boolean getIndmiercoles() { + return BooleanUtils.toBoolean(indmiercoles); + } + + public void setIndmiercoles(Boolean indmiercoles) { + this.indmiercoles = indmiercoles; + } + + public Boolean getIndsabado() { + return BooleanUtils.toBoolean(indsabado); + } + + public void setIndsabado(Boolean indsabado) { + this.indsabado = indsabado; + } + + public Boolean getIndviernes() { + return BooleanUtils.toBoolean(indviernes); + } + + public void setIndviernes(Boolean indviernes) { + this.indviernes = indviernes; + } + + public Date getHorarioinicio() { + return horarioinicio; + } + + public void setHorarioinicio(Date horarioinicio) { + this.horarioinicio = horarioinicio; + } + + public Date getHorariofin() { + return horariofin; + } + + public void setHorariofin(Date horariofin) { + this.horariofin = horariofin; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getIndfecviaje() { + return indfecviaje; + } + + public void setIndfecviaje(Boolean indfecviaje) { + this.indfecviaje = indfecviaje; + } + + public Boolean getIndfecventa() { + return BooleanUtils.toBoolean(indfecventa); + } + + public void setIndfecventa(Boolean indfecventa) { + this.indfecventa = indfecventa; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingdiaId != null ? pricingdiaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingDia)) { + return false; + } + PricingDia other = (PricingDia) object; + if ((this.pricingdiaId == null && other.pricingdiaId != null) || (this.pricingdiaId != null && !this.pricingdiaId.equals(other.pricingdiaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingDia[pricingdiaId=" + pricingdiaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingEspecifico.java b/src/com/rjconsultores/ventaboletos/entidad/PricingEspecifico.java new file mode 100644 index 000000000..fcc3da71d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingEspecifico.java @@ -0,0 +1,473 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; +import org.hibernate.annotations.Where; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_ESPECIFICO_SEQ", sequenceName = "PRICING_ESPECIFICO_SEQ", allocationSize = 1) +@Table(name = "PRICING_ESPECIFICO") +public class PricingEspecifico implements Serializable, Cloneable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_ESPECIFICO_SEQ") + @Column(name = "PRICINGESPECIFICO_ID") + private Long pricingespecificoId; + @Column(name = "NOMBPRICING") + private String nombPricing; + @Column(name = "FECHORINICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorinicio; + @Column(name = "FECHORFIN") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorfin; + @Column(name = "TARIFA") + private BigDecimal tarifa; + @Column(name = "TARIFAREDABIERTO") + private BigDecimal tarifaredabierto; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; +// @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") +// @ManyToOne +// private TipoPuntoVenta tipoPtovta; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada parada; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada parada1; + @JoinColumn(name = "MONEDA_ID", referencedColumnName = "MONEDA_ID") + @ManyToOne + private Moneda moneda; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @Column(name = "CORRIDA_ID") + private Integer corridaId; + @Column(name = "EXIBEVENDA") + private Boolean exibeVenda; + @OneToMany(mappedBy = "pricingEspecifico", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + private List pricingEspecificoOcupacionsList; + + @OneToMany(mappedBy = "pricingEspecifico", cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @Where(clause="ACTIVO=1") + private List pricingEspecificoAgenciasList; + + @OneToMany(mappedBy = "pricingEspecifico", cascade = CascadeType.ALL) + @LazyCollection(LazyCollectionOption.FALSE) + @Where(clause="ACTIVO=1") + private List pricingEspecificoCanalVendasList; + + @OneToMany(mappedBy = "pricingEspecifico", cascade = CascadeType.ALL) + @LazyCollection(LazyCollectionOption.FALSE) + @Where(clause="ACTIVO=1") + private List pricingEspecificoCategoriaList; + + @Column(name = "DATAINICIOVIAGEM") + @Temporal(TemporalType.TIMESTAMP) + private Date dataInicioViagem; + + @Column(name = "DATAFIMVIAGEM") + @Temporal(TemporalType.TIMESTAMP) + private Date dataFimViagem; + + @Column(name = "DATAINICIOVENDA") + @Temporal(TemporalType.TIMESTAMP) + private Date dataInicioVenda; + + @Column(name = "DATAFIMVENDA") + @Temporal(TemporalType.TIMESTAMP) + private Date dataFimVenda; + + @Column(name = "DOMINGO") + private Boolean domingo; + + @Column(name = "SEGUNDA") + private Boolean segunda; + + @Column(name = "TERCA") + private Boolean terca; + + @Column(name = "QUARTA") + private Boolean quarta; + + @Column(name = "QUINTA") + private Boolean quinta; + + @Column(name = "SEXTA") + private Boolean sexta; + + @Column(name = "SABADO") + private Boolean sabado; + + public PricingEspecifico() { + } + + public PricingEspecifico(Long pricingespecificoId) { + this.pricingespecificoId = pricingespecificoId; + } + + public Long getPricingespecificoId() { + return pricingespecificoId; + } + + public void setPricingespecificoId(Long pricingespecificoId) { + this.pricingespecificoId = pricingespecificoId; + } + + public Date getFechorinicio() { + return fechorinicio; + } + + public void setFechorinicio(Date fechorinicio) { + this.fechorinicio = fechorinicio; + } + + public Date getFechorfin() { + return fechorfin; + } + + public void setFechorfin(Date fechorfin) { + this.fechorfin = fechorfin; + } + + public BigDecimal getTarifa() { + return tarifa; + } + + public void setTarifa(BigDecimal tarifa) { + this.tarifa = tarifa; + } + + public BigDecimal getTarifaredabierto() { + return tarifaredabierto; + } + + public void setTarifaredabierto(BigDecimal tarifaredabierto) { + this.tarifaredabierto = tarifaredabierto; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public Parada getParada1() { + return parada1; + } + + public void setParada1(Parada parada1) { + this.parada1 = parada1; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public String getNombPricing() { + return nombPricing; + } + + public void setNombPricing(String nombPricing) { + this.nombPricing = nombPricing; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public List getPricingEspecificoOcupacionsList() { + if(this.pricingEspecificoOcupacionsList == null){ + this.pricingEspecificoOcupacionsList = new ArrayList(); + } + return this.pricingEspecificoOcupacionsList; + } + + public void setPricingEspecificoOcupacionsList(List pricingEspecificoOcupacionsList) { + this.pricingEspecificoOcupacionsList = pricingEspecificoOcupacionsList; + } + + public Boolean getExibeVenda() { + return exibeVenda; + } + + public void setExibeVenda(Boolean exibeVenda) { + this.exibeVenda = exibeVenda; + } + + public List getPricingEspecificoAgenciasList() { + if(this.pricingEspecificoAgenciasList == null){ + this.pricingEspecificoAgenciasList = new ArrayList(); + } + return pricingEspecificoAgenciasList; + } + + public void setPricingEspecificoAgenciasList(List pricingEspecificoAgenciasList) { + this.pricingEspecificoAgenciasList = pricingEspecificoAgenciasList; + } + + + public List getPricingEspecificoCanalVendasList() { + if(this.pricingEspecificoCanalVendasList == null){ + this.pricingEspecificoCanalVendasList = new ArrayList(); + } + return pricingEspecificoCanalVendasList; + } + + public void setPricingEspecificoCanalVendasList(List pricingEspecificoCanalVendasList) { + this.pricingEspecificoCanalVendasList = pricingEspecificoCanalVendasList; + } + + public List getPricingEspecificoCategoriaList() { + if (this.pricingEspecificoCategoriaList == null) { + this.pricingEspecificoCategoriaList = new ArrayList(); + } + return pricingEspecificoCategoriaList; + } + + public void setPricingEspecificoCategoriaList(List pricingEspecificoCategoriaList) { + this.pricingEspecificoCategoriaList = pricingEspecificoCategoriaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingespecificoId != null ? pricingespecificoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PricingEspecifico)) { + return false; + } + PricingEspecifico other = (PricingEspecifico) object; + if ((this.pricingespecificoId == null && other.pricingespecificoId != null) || (this.pricingespecificoId != null && !this.pricingespecificoId.equals(other.pricingespecificoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingEspecifico[pricingespecificoId=" + pricingespecificoId + "]"; + } + + @Transient + public List getPricingEspecificoOcupacionsListActivos() { + List peoList = new ArrayList(); + if(getPricingEspecificoOcupacionsList() != null) { + for (PricingEspecificoOcupacion peo : getPricingEspecificoOcupacionsList()) { + if (peo.getActivo()) { + peoList.add(peo); + } + } + } + return peoList; + } + @Transient + public List getPricingEspecificoAgenciaListActivos() { + List peoList = new ArrayList(); + if(getPricingEspecificoAgenciasList() != null) { + for (PricingEspecificoAgencia peo : getPricingEspecificoAgenciasList()) { + if (peo.getActivo()) { + peoList.add(peo); + } + } + } + return peoList; + } + @Transient + public List getPricingEspecificoCanalListActivos() { + List pecList = new ArrayList(); + if(getPricingEspecificoCanalVendasList() != null) { + for (PricingEspecificoCanalVendas pec : getPricingEspecificoCanalVendasList()) { + if (pec.getActivo()) { + pecList.add(pec); + } + } + } + return pecList; + } + + public Date getDataInicioViagem() { + return dataInicioViagem; + } + + public void setDataInicioViagem(Date dataInicioViagem) { + this.dataInicioViagem = dataInicioViagem; + } + + public Date getDataFimViagem() { + return dataFimViagem; + } + + public void setDataFimViagem(Date dataFimViagem) { + this.dataFimViagem = dataFimViagem; + } + + public Date getDataInicioVenda() { + return dataInicioVenda; + } + + public void setDataInicioVenda(Date dataInicioVenda) { + this.dataInicioVenda = dataInicioVenda; + } + + public Date getDataFimVenda() { + return dataFimVenda; + } + + public void setDataFimVenda(Date dataFimVenda) { + this.dataFimVenda = dataFimVenda; + } + + public Boolean getDomingo() { + return domingo == null ? true : domingo; + } + + public void setDomingo(Boolean domingo) { + this.domingo = domingo; + } + + public Boolean getSegunda() { + return segunda == null ? true : segunda; + } + + public void setSegunda(Boolean segunda) { + this.segunda = segunda; + } + + public Boolean getTerca() { + return terca == null ? true : terca; + } + + public void setTerca(Boolean terca) { + this.terca = terca; + } + + public Boolean getQuarta() { + return quarta == null ? true : quarta; + } + + public void setQuarta(Boolean quarta) { + this.quarta = quarta; + } + + public Boolean getQuinta() { + return quinta == null ? true : quinta; + } + + public void setQuinta(Boolean quinta) { + this.quinta = quinta; + } + + public Boolean getSexta() { + return sexta == null ? true : sexta; + } + + public void setSexta(Boolean sexta) { + this.sexta = sexta; + } + + public Boolean getSabado() { + return sabado == null ? true : sabado; + } + + public void setSabado(Boolean sabado) { + this.sabado = sabado; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoAgencia.java b/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoAgencia.java new file mode 100644 index 000000000..7ab826cc0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoAgencia.java @@ -0,0 +1,132 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PRICING_ESP_PUNTOV_SEQ", sequenceName = "PRICING_ESP_PUNTOV_SEQ", allocationSize = 1) +@Table(name = "PRICING_ESP_PUNTO_VENTA") +public class PricingEspecificoAgencia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_ESP_PUNTOV_SEQ") + @Column(name = "PRICINGESPPUNTOVENTA_ID") + private Integer pricingEspecificoAgenciaId; + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID",referencedColumnName = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICINGESPECIFICO_ID", referencedColumnName = "PRICINGESPECIFICO_ID") + @ManyToOne + private PricingEspecifico pricingEspecifico; + + public PricingEspecificoAgencia() { + super(); + } + public PricingEspecificoAgencia(PuntoVenta puntoVenta, PricingEspecifico pricingEspecifico, Integer usuarioId) { + super(); + + this.puntoVenta = puntoVenta; + this.pricingEspecifico = pricingEspecifico; + this.usuarioId = usuarioId; + this.fecmodif = new Date(); + this.activo = Boolean.TRUE; + } + public Integer getPricingEspecificoAgenciaId() { + return pricingEspecificoAgenciaId; + } + public void setPricingEspecificoAgenciaId(Integer pricingEspecificoAgenciaId) { + this.pricingEspecificoAgenciaId = pricingEspecificoAgenciaId; + } + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public PricingEspecifico getPricingEspecifico() { + return pricingEspecifico; + } + public void setPricingEspecifico(PricingEspecifico pricingEspecifico) { + this.pricingEspecifico = pricingEspecifico; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activo == null) ? 0 : activo.hashCode()); + result = prime * result + ((pricingEspecifico == null) ? 0 : pricingEspecifico.hashCode()); + result = prime * result + ((puntoVenta == null) ? 0 : puntoVenta.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PricingEspecificoAgencia other = (PricingEspecificoAgencia) obj; + if (activo == null) { + if (other.activo != null) + return false; + } else if (!activo.equals(other.activo)) + return false; + if (pricingEspecifico == null) { + if (other.pricingEspecifico != null) + return false; + } else if (!pricingEspecifico.equals(other.pricingEspecifico)) + return false; + if (puntoVenta == null) { + if (other.puntoVenta != null) + return false; + } else if (!puntoVenta.equals(other.puntoVenta)) + return false; + return true; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoCanalVendas.java b/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoCanalVendas.java new file mode 100644 index 000000000..f8488c6c2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoCanalVendas.java @@ -0,0 +1,141 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * @author Bruno Rodrigo + * + */ +@Entity +@SequenceGenerator(name = "PRICING_ESP_CANAL_SEQ", sequenceName = "PRICING_ESP_CANAL_SEQ", allocationSize = 1) +@Table(name = "PRICING_ESP_CANAL_VENTA") +public class PricingEspecificoCanalVendas implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_ESP_CANAL_SEQ") + @Column(name = "PRICINGESPCANAL_ID") + private Integer pricingEspecificoCanalId; + @ManyToOne + @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") + private TipoPuntoVenta tipoPtovta; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICINGESPECIFICO_ID", referencedColumnName = "PRICINGESPECIFICO_ID") + @ManyToOne + private PricingEspecifico pricingEspecifico; + + public PricingEspecificoCanalVendas() { + super(); + } + public PricingEspecificoCanalVendas(TipoPuntoVenta tipoPtovta, PricingEspecifico pricingEspecifico, Integer usuarioId) { + super(); + + this.tipoPtovta = tipoPtovta; + this.pricingEspecifico = pricingEspecifico; + this.usuarioId = usuarioId; + this.fecmodif = new Date(); + this.activo = Boolean.TRUE; + } + + public Integer getPricingEspecificoCanalId() { + return pricingEspecificoCanalId; + } + public void setPricingEspecificoCanalId(Integer pricingEspecificoCanalId) { + this.pricingEspecificoCanalId = pricingEspecificoCanalId; + } + public TipoPuntoVenta getTipoPtovta() { + return tipoPtovta; + } + public void setTipoPtovta(TipoPuntoVenta tipoPtovta) { + this.tipoPtovta = tipoPtovta; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public PricingEspecifico getPricingEspecifico() { + return pricingEspecifico; + } + public void setPricingEspecifico(PricingEspecifico pricingEspecifico) { + this.pricingEspecifico = pricingEspecifico; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activo == null) ? 0 : activo.hashCode()); + result = prime * result + ((pricingEspecifico == null) ? 0 : pricingEspecifico.hashCode()); + result = prime * result + ((tipoPtovta == null) ? 0 : tipoPtovta.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PricingEspecificoCanalVendas other = (PricingEspecificoCanalVendas) obj; + if (activo == null) { + if (other.activo != null) + return false; + } else if (!activo.equals(other.activo)) + return false; + if (pricingEspecifico == null) { + if (other.pricingEspecifico != null) + return false; + } else if (!pricingEspecifico.equals(other.pricingEspecifico)) + return false; + if (tipoPtovta == null) { + if (other.tipoPtovta != null) + return false; + } else if (!tipoPtovta.equals(other.tipoPtovta)) + return false; + return true; + } + @Override + public String toString() { + return "PricingEspecificoCanalVendas [tipoPtovta=" + tipoPtovta + ", activo=" + activo + "]"; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoCategoria.java b/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoCategoria.java new file mode 100644 index 000000000..475a9f84d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoCategoria.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PRICING_ESP_CATEGORIA_SEQ", sequenceName = "PRICING_ESP_CATEGORIA_SEQ", allocationSize = 1) +@Table(name = "PRICING_ESPECIFICO_CATEGORIA") +public class PricingEspecificoCategoria implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer pricingEspecificoCategoriaId; + private PricingEspecifico pricingEspecifico; + private Categoria categoria; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public PricingEspecificoCategoria() { + super(); + } + + public PricingEspecificoCategoria(Categoria categoria, PricingEspecifico pricingEspecifico, Integer usuarioId) { + this.pricingEspecifico = pricingEspecifico; + this.categoria = categoria; + this.usuarioId = usuarioId; + this.activo = true; + this.fecmodif = new Date(); + } + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_ESP_CATEGORIA_SEQ") + @Column(name = "PRICINGESPECIFICO_CATEGORIAID") + public Integer getPricingEspecificoCategoriaId() { + return pricingEspecificoCategoriaId; + } + + public void setPricingEspecificoCategoriaId(Integer pricingEspecificoCategoriaId) { + this.pricingEspecificoCategoriaId = pricingEspecificoCategoriaId; + } + + @JoinColumn(name = "PRICINGESPECIFICO_ID", referencedColumnName = "PRICINGESPECIFICO_ID") + @ManyToOne + public PricingEspecifico getPricingEspecifico() { + return pricingEspecifico; + } + + public void setPricingEspecifico(PricingEspecifico pricingEspecifico) { + this.pricingEspecifico = pricingEspecifico; + } + + @ManyToOne + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + @Column(name = "ACTIVO") + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Basic(optional = false) + @Column(name = "USUARIO_ID") + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activo == null) ? 0 : activo.hashCode()); + result = prime * result + ((pricingEspecifico == null) ? 0 : pricingEspecifico.hashCode()); + result = prime * result + ((categoria == null) ? 0 : categoria.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PricingEspecificoCategoria other = (PricingEspecificoCategoria) obj; + if (activo == null) { + if (other.activo != null) + return false; + } else if (!activo.equals(other.activo)) + return false; + if (pricingEspecifico == null) { + if (other.pricingEspecifico != null) + return false; + } else if (!pricingEspecifico.equals(other.pricingEspecifico)) + return false; + if (categoria == null) { + if (other.categoria != null) + return false; + } else if (!categoria.equals(other.categoria)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoOcupacion.java b/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoOcupacion.java new file mode 100644 index 000000000..ce07bae02 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingEspecificoOcupacion.java @@ -0,0 +1,172 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PRICING_ESPECIFICO_OCUP_SEQ", sequenceName = "PRICING_ESPECIFICO_OCUP_SEQ", allocationSize = 1) +@Table(name = "PRICING_ESPECIFICO_OCUPACION") +public class PricingEspecificoOcupacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_ESPECIFICO_OCUP_SEQ") + @Column(name = "PRICINGESPECIFICOOCUPACION_ID") + private Integer pricingEspecificoOcupacionId; + @Column(name = "OCUPACIONINICIAL") + private BigDecimal ocupacioninicial; + @Column(name = "OCUPACIONFINAL") + private BigDecimal ocupacionfinal; + @Column(name = "TARIFA") + private BigDecimal tarifa; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "DESCUENTO") + private BigDecimal descuento; + + @JoinColumn(name = "PRICINGESPECIFICO_ID", referencedColumnName = "PRICINGESPECIFICO_ID") + @ManyToOne + private PricingEspecifico pricingEspecifico; + + public PricingEspecificoOcupacion() { + super(); + } + + public PricingEspecificoOcupacion(BigDecimal ocupacioninicial, BigDecimal ocupacionfinal, BigDecimal tarifa, Boolean activo, Date fecmodif, Integer usuarioId, BigDecimal descuento, PricingEspecifico pricingEspecifico) { + super(); + this.ocupacioninicial = ocupacioninicial; + this.ocupacionfinal = ocupacionfinal; + this.tarifa = tarifa; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.descuento = descuento; + this.pricingEspecifico = pricingEspecifico; + } + + public Integer getPricingEspecificoOcupacionId() { + return pricingEspecificoOcupacionId; + } + + public void setPricingEspecificoOcupacionId(Integer pricingEspecificoOcupacionId) { + this.pricingEspecificoOcupacionId = pricingEspecificoOcupacionId; + } + + public BigDecimal getOcupacioninicial() { + return ocupacioninicial; + } + + public void setOcupacioninicial(BigDecimal ocupacioninicial) { + this.ocupacioninicial = ocupacioninicial; + } + + public BigDecimal getOcupacionfinal() { + return ocupacionfinal; + } + + public void setOcupacionfinal(BigDecimal ocupacionfinal) { + this.ocupacionfinal = ocupacionfinal; + } + + public BigDecimal getTarifa() { + return tarifa; + } + + public void setTarifa(BigDecimal tarifa) { + this.tarifa = tarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PricingEspecifico getPricingEspecifico() { + return pricingEspecifico; + } + + public void setPricingEspecifico(PricingEspecifico pricingEspecifico) { + this.pricingEspecifico = pricingEspecifico; + } + + public BigDecimal getDescuento() { + return descuento; + } + + public void setDescuento(BigDecimal descuento) { + this.descuento = descuento; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((pricingEspecificoOcupacionId == null) ? 0 : pricingEspecificoOcupacionId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PricingEspecificoOcupacion other = (PricingEspecificoOcupacion) obj; + if (pricingEspecificoOcupacionId == null) { + if (other.pricingEspecificoOcupacionId != null) + return false; + } else if (!pricingEspecificoOcupacionId.equals(other.pricingEspecificoOcupacionId)) + return false; + return true; + } + + @Override + public String toString() { + return "PricingEspecificoOcupacion [pricingEspecificoOcupacionId=" + pricingEspecificoOcupacionId + ", ocupacioninicial=" + ocupacioninicial + ", ocupacionfinal=" + ocupacionfinal + ", tarifa=" + tarifa + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + ", pricingEspecifico=" + pricingEspecifico + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingFormapago.java b/src/com/rjconsultores/ventaboletos/entidad/PricingFormapago.java new file mode 100644 index 000000000..022b35ec9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingFormapago.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PRICING_FORMAPAGO_SEQ", sequenceName = "PRICING_FORMAPAGO_SEQ", allocationSize = 1) +@Table(name = "PRICING_FORMAPAGO") +public class PricingFormapago implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_FORMAPAGO_SEQ") + @Column(name = "PRICINGFORMAPAGO_ID") + private Integer pricingformapagoId; + @Column(name = "INDEXCEPCION") + private Boolean indexcepcion; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "FORMAPAGO_ID", referencedColumnName = "FORMAPAGO_ID") + @ManyToOne + private FormaPago formaPago; + + public PricingFormapago() { + } + + public PricingFormapago(Integer pricingformapagoId) { + this.pricingformapagoId = pricingformapagoId; + } + + public PricingFormapago(Integer pricingformapagoId, Boolean indexcepcion, Integer activo, Date fecmodif, Integer usuarioId, Pricing pricing, FormaPago formaPago) { + this.pricingformapagoId = pricingformapagoId; + this.indexcepcion = indexcepcion; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.pricing = pricing; + this.formaPago = formaPago; + } + + public Integer getPricingformapagoId() { + return pricingformapagoId; + } + + public void setPricingformapagoId(Integer pricingformapagoId) { + this.pricingformapagoId = pricingformapagoId; + } + + public Boolean getIndexcepcion() { + return indexcepcion; + } + + public void setIndexcepcion(Boolean indexcepcion) { + this.indexcepcion = indexcepcion; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingformapagoId != null ? pricingformapagoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingFormapago)) { + return false; + } + PricingFormapago other = (PricingFormapago) object; + if ((this.pricingformapagoId == null && other.pricingformapagoId != null) || (this.pricingformapagoId != null && !this.pricingformapagoId.equals(other.pricingformapagoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PricingFormapago[pricingformapagoId=" + pricingformapagoId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingImporte.java b/src/com/rjconsultores/ventaboletos/entidad/PricingImporte.java new file mode 100644 index 000000000..93ce57ec2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingImporte.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_IMPORTE_SEQ", sequenceName = "PRICING_IMPORTE_SEQ", allocationSize = 1) +@Table(name = "PRICING_IMPORTE") +public class PricingImporte implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_IMPORTE_SEQ") + @Column(name = "PRICINGIMPORTE_ID") + private Integer pricingimporteId; + @Column(name = "IMPORTE") + private BigDecimal importe; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "MONEDA_ID", referencedColumnName = "MONEDA_ID") + @ManyToOne + private Moneda moneda; + + public PricingImporte() { + } + + public PricingImporte(Integer pricingimporteId) { + this.pricingimporteId = pricingimporteId; + } + + public Integer getPricingimporteId() { + return pricingimporteId; + } + + public void setPricingimporteId(Integer pricingimporteId) { + this.pricingimporteId = pricingimporteId; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingimporteId != null ? pricingimporteId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingImporte)) { + return false; + } + PricingImporte other = (PricingImporte) object; + if ((this.pricingimporteId == null && other.pricingimporteId != null) || (this.pricingimporteId != null && !this.pricingimporteId.equals(other.pricingimporteId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingImporte[pricingimporteId=" + pricingimporteId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingMarca.java b/src/com/rjconsultores/ventaboletos/entidad/PricingMarca.java new file mode 100644 index 000000000..7cebd48d7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingMarca.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_MARCA_SEQ", sequenceName = "PRICING_MARCA_SEQ", allocationSize = 1) +@Table(name = "PRICING_MARCA") +public class PricingMarca implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_MARCA_SEQ") + @Column(name = "PRICINGMARCA_ID") + private Integer pricingmarcaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + + public PricingMarca() { + } + + public PricingMarca(Integer pricingmarcaId) { + this.pricingmarcaId = pricingmarcaId; + } + + public Integer getPricingmarcaId() { + return pricingmarcaId; + } + + public void setPricingmarcaId(Integer pricingmarcaId) { + this.pricingmarcaId = pricingmarcaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingmarcaId != null ? pricingmarcaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingMarca)) { + return false; + } + PricingMarca other = (PricingMarca) object; + if ((this.pricingmarcaId == null && other.pricingmarcaId != null) || (this.pricingmarcaId != null && !this.pricingmarcaId.equals(other.pricingmarcaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingMarca[pricingmarcaId=" + pricingmarcaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingMercado.java b/src/com/rjconsultores/ventaboletos/entidad/PricingMercado.java new file mode 100644 index 000000000..7fbfd84e3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingMercado.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_MERCADO_SEQ", sequenceName = "PRICING_MERCADO_SEQ", allocationSize = 1) +@Table(name = "PRICING_MERCADO") +public class PricingMercado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_MERCADO_SEQ") + @Column(name = "PRICINGPARADA_ID") + private Integer pricingparadaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origen; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + + public PricingMercado() { + } + + public PricingMercado(Integer pricingparadaId) { + this.pricingparadaId = pricingparadaId; + } + + public Integer getPricingparadaId() { + return pricingparadaId; + } + + public void setPricingparadaId(Integer pricingparadaId) { + this.pricingparadaId = pricingparadaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingparadaId != null ? pricingparadaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingMercado)) { + return false; + } + PricingMercado other = (PricingMercado) object; + if ((this.pricingparadaId == null && other.pricingparadaId != null) || (this.pricingparadaId != null && !this.pricingparadaId.equals(other.pricingparadaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingMercado[pricingparadaId=" + pricingparadaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingOcupaAntecipa.java b/src/com/rjconsultores/ventaboletos/entidad/PricingOcupaAntecipa.java new file mode 100644 index 000000000..5333bbd8a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingOcupaAntecipa.java @@ -0,0 +1,199 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PRICING_OCUPA_ANTECIPA_SEQ", sequenceName = "PRICING_OCUPA_ANTECIPA_SEQ", allocationSize = 1) +@Table(name = "PRICING_OCUPA_ANTECIPA") +public class PricingOcupaAntecipa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_OCUPA_ANTECIPA_SEQ") + @Column(name = "PRICINGOCUPAANTECIPA_ID") + private Integer pricingocupaantecipaId; + @Column(name = "CANTDIASMIN") + private Integer cantdiasmin; + @Column(name = "CANTDIASMAX") + private Integer cantdiasmax; + @Column(name = "CANTASIENTOSMIN") + private Integer cantasientosmin; + @Column(name = "CANTASIENTOSMAX") + private Integer cantasientosmax; + @Column(name = "PORCENTAJE") + private BigDecimal porcentaje; + @Column(name = "OCUPACIONINICIAL") + private BigDecimal ocupacioninicial; + @Column(name = "OCUPACIONFINAL") + private BigDecimal ocupacionfinal; + @Column(name = "IMPORTE") + private BigDecimal importe; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Integer activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "PRICINGCLASSETARIFARIA_ID", referencedColumnName = "PRICINGCLASSETARIFARIA_ID") + @ManyToOne + private PricingClasseTarifaria pricingClasseTarifaria; + + public Integer getPricingocupaantecipaId() { + return pricingocupaantecipaId; + } + + public void setPricingocupaantecipaId(Integer pricingocupaantecipaId) { + this.pricingocupaantecipaId = pricingocupaantecipaId; + } + + public Integer getCantdiasmin() { + return cantdiasmin; + } + + public void setCantdiasmin(Integer cantdiasmin) { + this.cantdiasmin = cantdiasmin; + } + + public Integer getCantdiasmax() { + return cantdiasmax; + } + + public void setCantdiasmax(Integer cantdiasmax) { + this.cantdiasmax = cantdiasmax; + } + + public Integer getCantasientosmin() { + return cantasientosmin; + } + + public void setCantasientosmin(Integer cantasientosmin) { + this.cantasientosmin = cantasientosmin; + } + + public Integer getCantasientosmax() { + return cantasientosmax; + } + + public void setCantasientosmax(Integer cantasientosmax) { + this.cantasientosmax = cantasientosmax; + } + + public BigDecimal getPorcentaje() { + return porcentaje; + } + + public void setPorcentaje(BigDecimal porcentaje) { + this.porcentaje = porcentaje; + } + + public BigDecimal getOcupacioninicial() { + return ocupacioninicial; + } + + public void setOcupacioninicial(BigDecimal ocupacioninicial) { + this.ocupacioninicial = ocupacioninicial; + } + + public BigDecimal getOcupacionfinal() { + return ocupacionfinal; + } + + public void setOcupacionfinal(BigDecimal ocupacionfinal) { + this.ocupacionfinal = ocupacionfinal; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public PricingClasseTarifaria getPricingClasseTarifaria() { + return pricingClasseTarifaria; + } + + public void setPricingClasseTarifaria(PricingClasseTarifaria pricingClasseTarifaria) { + this.pricingClasseTarifaria = pricingClasseTarifaria; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingocupaantecipaId != null ? pricingocupaantecipaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingOcupaAntecipa)) { + return false; + } + PricingOcupaAntecipa other = (PricingOcupaAntecipa) object; + if ((this.pricingocupaantecipaId == null && other.pricingocupaantecipaId != null) || (this.pricingocupaantecipaId != null && !this.pricingocupaantecipaId.equals(other.pricingocupaantecipaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa[ pricingocupaantecipaId=" + pricingocupaantecipaId + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/PricingPuntoVenta.java new file mode 100644 index 000000000..f6b6e78df --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingPuntoVenta.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_PUNTOVENTA_SEQ", sequenceName = "PRICING_PUNTOVENTA_SEQ", allocationSize = 1) +@Table(name = "PRICING_PUNTOVENTA") +public class PricingPuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_PUNTOVENTA_SEQ") + @Column(name = "PRICINGPTOVTA_ID") + private Integer pricingptovtaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + + public PricingPuntoVenta() { + } + + public PricingPuntoVenta(Integer pricingptovtaId) { + this.pricingptovtaId = pricingptovtaId; + } + + public Integer getPricingptovtaId() { + return pricingptovtaId; + } + + public void setPricingptovtaId(Integer pricingptovtaId) { + this.pricingptovtaId = pricingptovtaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingptovtaId != null ? pricingptovtaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingPuntoVenta)) { + return false; + } + PricingPuntoVenta other = (PricingPuntoVenta) object; + if ((this.pricingptovtaId == null && other.pricingptovtaId != null) || (this.pricingptovtaId != null && !this.pricingptovtaId.equals(other.pricingptovtaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingPuntoventa[pricingptovtaId=" + pricingptovtaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingRuta.java b/src/com/rjconsultores/ventaboletos/entidad/PricingRuta.java new file mode 100644 index 000000000..86ec04f4e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingRuta.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_RUTA_SEQ", sequenceName = "PRICING_RUTA_SEQ", allocationSize = 1) +@Table(name = "PRICING_RUTA") +public class PricingRuta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_RUTA_SEQ") + @Column(name = "PRICINGRUTA_ID") + private Integer pricingrutaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + + public PricingRuta() { + } + + public PricingRuta(Integer pricingrutaId) { + this.pricingrutaId = pricingrutaId; + } + + public Integer getPricingrutaId() { + return pricingrutaId; + } + + public void setPricingrutaId(Integer pricingrutaId) { + this.pricingrutaId = pricingrutaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingrutaId != null ? pricingrutaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingRuta)) { + return false; + } + PricingRuta other = (PricingRuta) object; + if ((this.pricingrutaId == null && other.pricingrutaId != null) || (this.pricingrutaId != null && !this.pricingrutaId.equals(other.pricingrutaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingRuta[pricingrutaId=" + pricingrutaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingTipoPtoVta.java b/src/com/rjconsultores/ventaboletos/entidad/PricingTipoPtoVta.java new file mode 100644 index 000000000..de9edb817 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingTipoPtoVta.java @@ -0,0 +1,129 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_TIPOPTOVTA_SEQ", sequenceName = "PRICING_TIPOPTOVTA_SEQ", allocationSize = 1) +@Table(name = "PRICING_TIPOPTOVTA") +public class PricingTipoPtoVta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_TIPOPTOVTA_SEQ") + @Column(name = "PRICINGTIPOPTOVTA_ID") + private Integer pricingtipoptovtaId; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") + @ManyToOne + private TipoPuntoVenta tipoPtovta; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + + public PricingTipoPtoVta() { + } + + public PricingTipoPtoVta(Integer pricingtipoptovtaId) { + this.pricingtipoptovtaId = pricingtipoptovtaId; + } + + public Integer getPricingtipoptovtaId() { + return pricingtipoptovtaId; + } + + public void setPricingtipoptovtaId(Integer pricingtipoptovtaId) { + this.pricingtipoptovtaId = pricingtipoptovtaId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public TipoPuntoVenta getTipoPtovta() { + return tipoPtovta; + } + + public void setTipoPtovta(TipoPuntoVenta tipoPtovta) { + this.tipoPtovta = tipoPtovta; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingtipoptovtaId != null ? pricingtipoptovtaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingTipoPtoVta)) { + return false; + } + PricingTipoPtoVta other = (PricingTipoPtoVta) object; + if ((this.pricingtipoptovtaId == null && other.pricingtipoptovtaId != null) || (this.pricingtipoptovtaId != null && !this.pricingtipoptovtaId.equals(other.pricingtipoptovtaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingTipoptovta[pricingtipoptovtaId=" + pricingtipoptovtaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingTipoServicio.java b/src/com/rjconsultores/ventaboletos/entidad/PricingTipoServicio.java new file mode 100644 index 000000000..c97087d99 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingTipoServicio.java @@ -0,0 +1,132 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@SequenceGenerator(name = "PRICING_TIPOSERVICIO_SEQ", sequenceName = "PRICING_TIPOSERVICIO_SEQ", allocationSize = 1) +@Table(name = "PRICING_TIPOSERVICIO") +public class PricingTipoServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_TIPOSERVICIO_SEQ") + @Column(name = "PRICINGTIPOSERVICIO_ID") + private Integer pricingtiposervicioId; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Integer activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private int usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + @JoinColumn(name = "TIPOSERVICIO_ID", referencedColumnName = "TIPOSERVICIO_ID") + @ManyToOne + private TipoServicio tipoServicio; + + public PricingTipoServicio() { + } + + public PricingTipoServicio(Integer pricingtiposervicioId) { + this.pricingtiposervicioId = pricingtiposervicioId; + } + + public Integer getPricingtiposervicioId() { + return pricingtiposervicioId; + } + + public void setPricingtiposervicioId(Integer pricingtiposervicioId) { + this.pricingtiposervicioId = pricingtiposervicioId; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + public TipoServicio getTipoServicio() { + return tipoServicio; + } + + public void setTipoServicio(TipoServicio tipoServicio) { + this.tipoServicio = tipoServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingtiposervicioId != null ? pricingtiposervicioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingTipoServicio)) { + return false; + } + PricingTipoServicio other = (PricingTipoServicio) object; + if ((this.pricingtiposervicioId == null && other.pricingtiposervicioId != null) || (this.pricingtiposervicioId != null && !this.pricingtiposervicioId.equals(other.pricingtiposervicioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PricingTiposervicio[pricingtiposervicioId=" + pricingtiposervicioId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PricingVigencia.java b/src/com/rjconsultores/ventaboletos/entidad/PricingVigencia.java new file mode 100644 index 000000000..6ba07c630 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PricingVigencia.java @@ -0,0 +1,162 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRICING_VIGENCIA_SEQ", sequenceName = "PRICING_VIGENCIA_SEQ", allocationSize = 1) +@Table(name = "PRICING_VIGENCIA") +public class PricingVigencia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRICING_VIGENCIA_SEQ") + @Column(name = "PRICINGVIGENCIA_ID") + private Integer pricingvigenciaId; + @Column(name = "FECINICIOVIAJE") + @Temporal(TemporalType.TIMESTAMP) + private Date fecinicioviaje; + @Column(name = "FECFINVIAJE") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinviaje; + @Column(name = "FECINICIOVENTA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecinicioventa; + @Column(name = "FECFINVENTA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinventa; + @Column(name = "ACTIVO") + private Integer activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRICING_ID", referencedColumnName = "PRICING_ID") + @ManyToOne + private Pricing pricing; + + public PricingVigencia() { + } + + public PricingVigencia(Integer pricingvigenciaId) { + this.pricingvigenciaId = pricingvigenciaId; + } + + public Integer getPricingvigenciaId() { + return pricingvigenciaId; + } + + public void setPricingvigenciaId(Integer pricingvigenciaId) { + this.pricingvigenciaId = pricingvigenciaId; + } + + public Date getFecinicioviaje() { + return fecinicioviaje; + } + + public void setFecinicioviaje(Date fecinicioviaje) { + this.fecinicioviaje = fecinicioviaje; + } + + public Date getFecfinviaje() { + return fecfinviaje; + } + + public void setFecfinviaje(Date fecfinviaje) { + this.fecfinviaje = fecfinviaje; + } + + public Date getFecinicioventa() { + return fecinicioventa; + } + + public void setFecinicioventa(Date fecinicioventa) { + this.fecinicioventa = fecinicioventa; + } + + public Date getFecfinventa() { + return fecfinventa; + } + + public void setFecfinventa(Date fecfinventa) { + this.fecfinventa = fecfinventa; + } + + public Integer getActivo() { + return activo; + } + + public void setActivo(Integer activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Pricing getPricing() { + return pricing; + } + + public void setPricing(Pricing pricing) { + this.pricing = pricing; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (pricingvigenciaId != null ? pricingvigenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PricingVigencia)) { + return false; + } + PricingVigencia other = (PricingVigencia) object; + if ((this.pricingvigenciaId == null && other.pricingvigenciaId != null) || (this.pricingvigenciaId != null && !this.pricingvigenciaId.equals(other.pricingvigenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidad.test.PricingVigencia[pricingvigenciaId=" + pricingvigenciaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ProdClaseServicio.java b/src/com/rjconsultores/ventaboletos/entidad/ProdClaseServicio.java new file mode 100644 index 000000000..4d35011f4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ProdClaseServicio.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_CLASESERVICIO_SEQ", sequenceName = "PROD_CLASESERVICIO_SEQ", allocationSize = 1) +@Table(name = "PROD_CLASESERVICIO") +public class ProdClaseServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_CLASESERVICIO_SEQ") + @Column(name = "PRODCLASESERVICIO_ID") + private Integer prodclaseservicioId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public ProdClaseServicio() { + } + + public ProdClaseServicio(Integer prodclaseservicioId) { + this.prodclaseservicioId = prodclaseservicioId; + } + + public Integer getProdclaseservicioId() { + return prodclaseservicioId; + } + + public void setProdclaseservicioId(Integer prodclaseservicioId) { + this.prodclaseservicioId = prodclaseservicioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodclaseservicioId != null ? prodclaseservicioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdClaseServicio)) { + return false; + } + ProdClaseServicio other = (ProdClaseServicio) object; + if ((this.prodclaseservicioId == null && other.prodclaseservicioId != null) || (this.prodclaseservicioId != null && !this.prodclaseservicioId.equals(other.prodclaseservicioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdClaseservicio[prodclaseservicioId=" + prodclaseservicioId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ProdFormaPago.java b/src/com/rjconsultores/ventaboletos/entidad/ProdFormaPago.java new file mode 100644 index 000000000..deb07048b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ProdFormaPago.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_FORMAPAGO_SEQ", sequenceName = "PROD_FORMAPAGO_SEQ", allocationSize = 1) +@Table(name = "PROD_FORMAPAGO") +public class ProdFormaPago implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_FORMAPAGO_SEQ") + @Column(name = "PRODFORMAPAGO_ID") + private Integer prodformapagoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + @JoinColumn(name = "FORMAPAGO_ID", referencedColumnName = "FORMAPAGO_ID") + @ManyToOne + private FormaPago formaPago; + + public ProdFormaPago() { + } + + public ProdFormaPago(Integer prodformapagoId) { + this.prodformapagoId = prodformapagoId; + } + + public Integer getProdformapagoId() { + return prodformapagoId; + } + + public void setProdformapagoId(Integer prodformapagoId) { + this.prodformapagoId = prodformapagoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodformapagoId != null ? prodformapagoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdFormaPago)) { + return false; + } + ProdFormaPago other = (ProdFormaPago) object; + if ((this.prodformapagoId == null && other.prodformapagoId != null) || (this.prodformapagoId != null && !this.prodformapagoId.equals(other.prodformapagoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdFormapago[prodformapagoId=" + prodformapagoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ProdMarca.java b/src/com/rjconsultores/ventaboletos/entidad/ProdMarca.java new file mode 100644 index 000000000..7a0d8fdfe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ProdMarca.java @@ -0,0 +1,131 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_MARCA_SEQ", sequenceName = "PROD_MARCA_SEQ", allocationSize = 1) +@Table(name = "PROD_MARCA") +public class ProdMarca implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_MARCA_SEQ") + @Column(name = "PRODMARCA_ID") + private Integer prodmarcaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + + public ProdMarca() { + } + + public ProdMarca(Integer prodmarcaId) { + this.prodmarcaId = prodmarcaId; + } + + public Integer getProdmarcaId() { + return prodmarcaId; + } + + public void setProdmarcaId(Integer prodmarcaId) { + this.prodmarcaId = prodmarcaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodmarcaId != null ? prodmarcaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdMarca)) { + return false; + } + ProdMarca other = (ProdMarca) object; + if ((this.prodmarcaId == null && other.prodmarcaId != null) || (this.prodmarcaId != null && !this.prodmarcaId.equals(other.prodmarcaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdMarca[prodmarcaId=" + prodmarcaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ProdMercado.java b/src/com/rjconsultores/ventaboletos/entidad/ProdMercado.java new file mode 100644 index 000000000..37b2fcbc4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ProdMercado.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_MERCADO_SEQ", sequenceName = "PROD_MERCADO_SEQ", allocationSize = 1) +@Table(name = "PROD_MERCADO") +public class ProdMercado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_MERCADO_SEQ") + @Column(name = "PRODMERCADO_ID") + private Integer prodmercadoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada parada; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada parada1; + + public ProdMercado() { + } + + public ProdMercado(Integer prodmercadoId) { + this.prodmercadoId = prodmercadoId; + } + + public Integer getProdmercadoId() { + return prodmercadoId; + } + + public void setProdmercadoId(Integer prodmercadoId) { + this.prodmercadoId = prodmercadoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public Parada getParada1() { + return parada1; + } + + public void setParada1(Parada parada1) { + this.parada1 = parada1; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodmercadoId != null ? prodmercadoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdMercado)) { + return false; + } + ProdMercado other = (ProdMercado) object; + if ((this.prodmercadoId == null && other.prodmercadoId != null) || (this.prodmercadoId != null && !this.prodmercadoId.equals(other.prodmercadoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdMercado[prodmercadoId=" + prodmercadoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ProdPrecio.java b/src/com/rjconsultores/ventaboletos/entidad/ProdPrecio.java new file mode 100644 index 000000000..6987d5ec3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ProdPrecio.java @@ -0,0 +1,172 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "PROD_PRECIO_SEQ", sequenceName = "PROD_PRECIO_SEQ", allocationSize = 1) +@Table(name = "PROD_PRECIO") +public class ProdPrecio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_PRECIO_SEQ") + @Column(name = "PRODPRECIO") + private Integer prodprecio; + // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation + @Column(name = "IMPORTEINICIAL") + private BigDecimal importeinicial; + @Column(name = "IMPORTEFINAL") + private BigDecimal importefinal; + @Column(name = "PRECIO") + private BigDecimal precio; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoservicio; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + + public ProdPrecio() { + } + + public ProdPrecio(Integer prodprecio) { + this.prodprecio = prodprecio; + } + + public Integer getProdprecio() { + return prodprecio; + } + + public void setProdprecio(Integer prodprecio) { + this.prodprecio = prodprecio; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getImporteinicial() { + return importeinicial; + } + + public void setImporteinicial(BigDecimal importeinicial) { + this.importeinicial = importeinicial; + } + + public BigDecimal getImportefinal() { + return importefinal; + } + + public void setImportefinal(BigDecimal importefinal) { + this.importefinal = importefinal; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public ProductoServicio getProductoservicio() { + return productoservicio; + } + + public void setProductoservicio(ProductoServicio productoservicio) { + this.productoservicio = productoservicio; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ProdPrecio other = (ProdPrecio) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.productoservicio != other.productoservicio && (this.productoservicio == null || !this.productoservicio.equals(other.productoservicio))) { + return false; + } + if (this.marca != other.marca && (this.marca == null || !this.marca.equals(other.marca))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 53 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 53 * hash + (this.productoservicio != null ? this.productoservicio.hashCode() : 0); + hash = 53 * hash + (this.marca != null ? this.marca.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.entidad.ProdPrecio[ prodprecio=" + prodprecio + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ProdPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/ProdPuntoVenta.java new file mode 100644 index 000000000..6c3844775 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ProdPuntoVenta.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_PUNTOVENTA_SEQ", sequenceName = "PROD_PUNTOVENTA_SEQ", allocationSize = 1) +@Table(name = "PROD_PUNTOVENTA") +public class ProdPuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_PUNTOVENTA_SEQ") + @Column(name = "PRODPUNTOVENTA_ID") + private Integer prodpuntoventaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + + public ProdPuntoVenta() { + } + + public ProdPuntoVenta(Integer prodpuntoventaId) { + this.prodpuntoventaId = prodpuntoventaId; + } + + public Integer getProdpuntoventaId() { + return prodpuntoventaId; + } + + public void setProdpuntoventaId(Integer prodpuntoventaId) { + this.prodpuntoventaId = prodpuntoventaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodpuntoventaId != null ? prodpuntoventaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdPuntoVenta)) { + return false; + } + ProdPuntoVenta other = (ProdPuntoVenta) object; + if ((this.prodpuntoventaId == null && other.prodpuntoventaId != null) || (this.prodpuntoventaId != null && !this.prodpuntoventaId.equals(other.prodpuntoventaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdPuntoventa[prodpuntoventaId=" + prodpuntoventaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ProdRuta.java b/src/com/rjconsultores/ventaboletos/entidad/ProdRuta.java new file mode 100644 index 000000000..622435d40 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ProdRuta.java @@ -0,0 +1,131 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity + +@SequenceGenerator(name = "PROD_RUTA_SEQ", sequenceName = "PROD_RUTA_SEQ", allocationSize = 1) +@Table(name = "PROD_RUTA") +public class ProdRuta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_RUTA_SEQ") + @Column(name = "PRODRUTA_ID") + private Integer prodrutaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + + public ProdRuta() { + } + + public ProdRuta(Integer prodrutaId) { + this.prodrutaId = prodrutaId; + } + + public Integer getProdrutaId() { + return prodrutaId; + } + + public void setProdrutaId(Integer prodrutaId) { + this.prodrutaId = prodrutaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodrutaId != null ? prodrutaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdRuta)) { + return false; + } + ProdRuta other = (ProdRuta) object; + if ((this.prodrutaId == null && other.prodrutaId != null) || (this.prodrutaId != null && !this.prodrutaId.equals(other.prodrutaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdRuta[prodrutaId=" + prodrutaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ProdTipoptovta.java b/src/com/rjconsultores/ventaboletos/entidad/ProdTipoptovta.java new file mode 100644 index 000000000..388f85e9c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ProdTipoptovta.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_TIPOPTOVTA_SEQ", sequenceName = "PROD_TIPOPTOVTA_SEQ", allocationSize = 1) +@Table(name = "PROD_TIPOPTOVTA") +public class ProdTipoptovta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_TIPOPTOVTA_SEQ") + @Column(name = "PRODTIPOPTOVTA_ID") + private Integer prodtipoptovtaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") + @ManyToOne + private TipoPuntoVenta tipoPtovta; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + + public ProdTipoptovta() { + } + + public ProdTipoptovta(Integer prodtipoptovtaId) { + this.prodtipoptovtaId = prodtipoptovtaId; + } + + public Integer getProdtipoptovtaId() { + return prodtipoptovtaId; + } + + public void setProdtipoptovtaId(Integer prodtipoptovtaId) { + this.prodtipoptovtaId = prodtipoptovtaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public TipoPuntoVenta getTipoPtovta() { + return tipoPtovta; + } + + public void setTipoPtovta(TipoPuntoVenta tipoPtovta) { + this.tipoPtovta = tipoPtovta; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodtipoptovtaId != null ? prodtipoptovtaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdTipoptovta)) { + return false; + } + ProdTipoptovta other = (ProdTipoptovta) object; + if ((this.prodtipoptovtaId == null && other.prodtipoptovtaId != null) || (this.prodtipoptovtaId != null && !this.prodtipoptovtaId.equals(other.prodtipoptovtaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdTipoptovta[prodtipoptovtaId=" + prodtipoptovtaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ProdVigencia.java b/src/com/rjconsultores/ventaboletos/entidad/ProdVigencia.java new file mode 100644 index 000000000..e9e0ee471 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ProdVigencia.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PROD_VIGENCIA_SEQ", sequenceName = "PROD_VIGENCIA_SEQ", allocationSize = 1) +@Table(name = "PROD_VIGENCIA") +public class ProdVigencia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PROD_VIGENCIA_SEQ") + @Basic(optional = false) + @Column(name = "PRODVIGENCIA_ID") + private Integer prodvigenciaId; + @Column(name = "FECVIGENCIAINICIO") + @Temporal(TemporalType.DATE) + private Date fecvigenciainicio; + @Column(name = "FECVIGENCIAFIN") + @Temporal(TemporalType.DATE) + private Date fecvigenciafin; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PRODUCTOSERVICIO_ID", referencedColumnName = "PRODUCTOSERVICIO_ID") + @ManyToOne + private ProductoServicio productoServicio; + + public ProdVigencia() { + } + + public ProdVigencia(Integer prodvigenciaId) { + this.prodvigenciaId = prodvigenciaId; + } + + public Integer getProdvigenciaId() { + return prodvigenciaId; + } + + public void setProdvigenciaId(Integer prodvigenciaId) { + this.prodvigenciaId = prodvigenciaId; + } + + public Date getFecvigenciainicio() { + return fecvigenciainicio; + } + + public void setFecvigenciainicio(Date fecvigenciainicio) { + this.fecvigenciainicio = fecvigenciainicio; + } + + public Date getFecvigenciafin() { + return fecvigenciafin; + } + + public void setFecvigenciafin(Date fecvigenciafin) { + this.fecvigenciafin = fecvigenciafin; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ProductoServicio getProductoServicio() { + return productoServicio; + } + + public void setProductoServicio(ProductoServicio productoServicio) { + this.productoServicio = productoServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (prodvigenciaId != null ? prodvigenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProdVigencia)) { + return false; + } + ProdVigencia other = (ProdVigencia) object; + if ((this.prodvigenciaId == null && other.prodvigenciaId != null) || (this.prodvigenciaId != null && !this.prodvigenciaId.equals(other.prodvigenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProdVigencia[prodvigenciaId=" + prodvigenciaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ProductoServicio.java b/src/com/rjconsultores/ventaboletos/entidad/ProductoServicio.java new file mode 100644 index 000000000..dbd845123 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ProductoServicio.java @@ -0,0 +1,299 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PRODUCTO_SERVICIO_SEQ", sequenceName = "PRODUCTO_SERVICIO_SEQ", allocationSize = 1) +@Table(name = "PRODUCTO_SERVICIO") +public class ProductoServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PRODUCTO_SERVICIO_SEQ") + @Basic(optional = false) + @Column(name = "PRODUCTOSERVICIO_ID") + private Integer productoservicioId; + @Column(name = "DESCPRODUCTOSERVICIO") + private String descproductoservicio; + @Column(name = "INDTIPO") + private String indtipo; + @Column(name = "DESCIMPRESIONBOLETO") + private String descImpresionBoleto; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodRutaList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodMarcaList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodTipoptovtaList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodPuntoVentaList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodFormaPagoList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodMercadoList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodVigenciaList; + @OneToMany(mappedBy = "productoServicio", cascade = CascadeType.ALL) + private List prodClaseServicioList; + @OneToMany(mappedBy = "productoservicio", cascade = CascadeType.ALL) + private List prodPrecioList; + + public ProductoServicio() { + } + + public ProductoServicio(Integer productoservicioId) { + this.productoservicioId = productoservicioId; + } + + public Integer getProductoservicioId() { + return productoservicioId; + } + + public void setProductoservicioId(Integer productoservicioId) { + this.productoservicioId = productoservicioId; + } + + public String getDescproductoservicio() { + return descproductoservicio; + } + + public void setDescproductoservicio(String descproductoservicio) { + this.descproductoservicio = descproductoservicio; + } + + public String getIndtipo() { + return indtipo; + } + + public void setIndtipo(String indtipo) { + this.indtipo = indtipo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public List getProdClaseServicioList() { + List poList = new ArrayList(); + for (ProdClaseServicio po : this.prodClaseServicioList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdClaseServicioList(List prodClaseServicioList) { + this.prodClaseServicioList = prodClaseServicioList; + } + + public List getProdFormaPagoList() { + List poList = new ArrayList(); + for (ProdFormaPago po : this.prodFormaPagoList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdFormaPagoList(List prodFormaPagoList) { + this.prodFormaPagoList = prodFormaPagoList; + } + + public List getProdMarcaList() { + List poList = new ArrayList(); + for (ProdMarca po : this.prodMarcaList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdMarcaList(List prodMarcaList) { + this.prodMarcaList = prodMarcaList; + } + + public List getProdMercadoList() { + + List poList = new ArrayList(); + for (ProdMercado po : this.prodMercadoList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdMercadoList(List prodMercadoList) { + this.prodMercadoList = prodMercadoList; + } + + public List getProdPuntoVentaList() { + + List poList = new ArrayList(); + for (ProdPuntoVenta po : this.prodPuntoVentaList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdPuntoVentaList(List prodPuntoVentaList) { + this.prodPuntoVentaList = prodPuntoVentaList; + } + + public List getProdRutaList() { + List poList = new ArrayList(); + for (ProdRuta po : this.prodRutaList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdRutaList(List prodRutaList) { + this.prodRutaList = prodRutaList; + } + + public List getProdTipoptovtaList() { + List poList = new ArrayList(); + for (ProdTipoptovta po : this.prodTipoptovtaList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdTipoptovtaList(List prodTipoptovtaList) { + this.prodTipoptovtaList = prodTipoptovtaList; + } + + public List getProdVigenciaList() { + List poList = new ArrayList(); + for (ProdVigencia po : this.prodVigenciaList) { + if (po.getActivo() == Boolean.TRUE) { + poList.add(po); + } + } + return poList; + } + + public void setProdVigenciaList(List prodVigenciaList) { + this.prodVigenciaList = prodVigenciaList; + } + + public List getProdPrecioList() { + List ppList = new ArrayList(); + for (ProdPrecio pp : this.prodPrecioList) { + if (pp.getActivo() == Boolean.TRUE) { + ppList.add(pp); + } + } + return ppList; + } + + public void setProdPrecioList(List prodPrecioList) { + this.prodPrecioList = prodPrecioList; + } + + public String getDescImpresionBoleto() { + return descImpresionBoleto; + } + + public void setDescImpresionBoleto(String descImpresionBoleto) { + this.descImpresionBoleto = descImpresionBoleto; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (productoservicioId != null ? productoservicioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ProductoServicio)) { + return false; + } + ProductoServicio other = (ProductoServicio) object; + if ((this.productoservicioId == null && other.productoservicioId != null) || (this.productoservicioId != null && !this.productoservicioId.equals(other.productoservicioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.utilerias.ProductoServicio[productoservicioId=" + productoservicioId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java new file mode 100644 index 000000000..3f748c7fc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java @@ -0,0 +1,137 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author RJ + */ +@Entity +@SequenceGenerator(name = "PTOVTA_CHECKIN_SEQ", sequenceName = "PTOVTA_CHECKIN_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_CHECKIN") +public class PtoVtaCheckin implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_CHECKIN_SEQ") + @Column(name = "PTOVTACHECKIN_ID") + private Integer ptoVtaCheckinId; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @OneToOne + private PuntoVenta puntoventaId; + + @JoinColumn(name = "PARADA_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaId; + + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + public PtoVtaCheckin() { + } + + public PtoVtaCheckin(Integer ptoVtaCheckinId) { + this.ptoVtaCheckinId = ptoVtaCheckinId; + } + + public Integer getPtoVtaCheckinId() { + return ptoVtaCheckinId; + } + + public void setPtoVtaCheckinId(Integer ptoVtaCheckinId) { + this.ptoVtaCheckinId = ptoVtaCheckinId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Parada getParadaId() { + return paradaId; + } + + public void setParadaId(Parada paradaId) { + this.paradaId = paradaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptoVtaCheckinId != null ? ptoVtaCheckinId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PtoVtaCheckin)) { + return false; + } + PtoVtaCheckin other = (PtoVtaCheckin) object; + if ((this.ptoVtaCheckinId == null && other.ptoVtaCheckinId != null) || (this.ptoVtaCheckinId != null && !this.ptoVtaCheckinId.equals(other.ptoVtaCheckinId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtoVtaCheckin[ ptoVtaCheckinId=" + ptoVtaCheckinId + " ]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java new file mode 100644 index 000000000..5d7ea4073 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java @@ -0,0 +1,270 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author RJ + */ +@Entity +@SequenceGenerator(name = "PTOVTA_SEGURO_SEQ", sequenceName = "PTOVTA_SEGURO_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_SEGURO") +public class PtoVtaSeguro implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_SEGURO_SEQ") + @Column(name = "PTOVTASEGURO_ID") + private Integer ptoVtaSeguroId; + + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + + + @Basic(optional = false) + @Column(name = "INDVENDSEGOPCIONAL") + private Boolean indVendeSegOpcional; + + @Basic(optional = false) + @Column(name = "INDVENDSEGTABELA") + private Boolean indVendeSegTabela; + + @Basic(optional = false) + @Column(name = "INDESTANSEGOPCIONAL") + private Boolean indEstanSegOpcional; + + @Basic(optional = false) + @Column(name = "INDESTANSEGTABELA") + private Boolean indEstanSegTabela; + + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @OneToOne + private PuntoVenta puntoventaId; + + @Basic(optional = false) + @Column(name = "INDESTANTASAEMBARQUE") + private Boolean indEstanTasaEmbarque; + + @Basic(optional = false) + @Column(name = "INDPERMISOTASAEMBARQUE") + private Boolean indPermisoTasaEmbarque; + + @Basic(optional = false) + @Column(name = "INDPERMISOTASAEMBARQUEVTAMAN") + private Boolean indPermisoTasaEmbarqueVtaManual; + + @Basic(optional = false) + @Column(name = "INDPERMISOTASAEMBARQVTAAGEN") + private Boolean indPermisoTasaEmbarqVtaAgen; + + @Basic(optional = false) + @Column(name = "INDVENDESEGUROOPCEMBARCADA") + private Boolean indVendeSeguroOpcEmbarcada; + + @Basic(optional = false) + @Column(name = "INDVENDESEGUROTABELAEMBARCADA") + private Boolean indVendeSeguroTabelaEmbarcada; + + @Basic(optional = false) + @Column(name = "INDTAXAEMBARQUEEMBARCADA") + private Boolean indTaxaEmbarqueEmbarcada; + + + public PtoVtaSeguro() { + } + + public PtoVtaSeguro(Integer ptoVtaSeguroId) { + this.ptoVtaSeguroId = ptoVtaSeguroId; + } + + public Integer getPtoVtaSeguroId() { + return ptoVtaSeguroId; + } + + public void setPtoVtaSeguroId(Integer ptoVtaSeguroId) { + this.ptoVtaSeguroId = ptoVtaSeguroId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getIndVendeSegOpcional() { + return indVendeSegOpcional; + } + + public void setIndVendeSegOpcional(Boolean indVendeSegOpcional) { + this.indVendeSegOpcional = indVendeSegOpcional; + } + + public Boolean getIndVendeSegTabela() { + return indVendeSegTabela; + } + + public void setIndVendeSegTabela(Boolean indVendeSegTabela) { + this.indVendeSegTabela = indVendeSegTabela; + } + + public Boolean getIndEstanSegOpcional() { + return indEstanSegOpcional; + } + + public void setIndEstanSegOpcional(Boolean indEstanSegOpcional) { + this.indEstanSegOpcional = indEstanSegOpcional; + } + + public Boolean getIndEstanSegTabela() { + return indEstanSegTabela; + } + + public void setIndEstanSegTabela(Boolean indEstanSegTabela) { + this.indEstanSegTabela = indEstanSegTabela; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptoVtaSeguroId != null ? ptoVtaSeguroId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PtoVtaSeguro)) { + return false; + } + PtoVtaSeguro other = (PtoVtaSeguro) object; + if ((this.ptoVtaSeguroId == null && other.ptoVtaSeguroId != null) || (this.ptoVtaSeguroId != null && !this.ptoVtaSeguroId.equals(other.ptoVtaSeguroId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro[ ptoVtaSeguroId=" + ptoVtaSeguroId + " ]"; + } + + public Boolean getIndEstanTasaEmbarque() { + return indEstanTasaEmbarque; + } + + public void setIndEstanTasaEmbarque(Boolean indEstanTasaEmbarque) { + this.indEstanTasaEmbarque = indEstanTasaEmbarque; + } + + public Boolean getIndPermisoTasaEmbarque() { + return indPermisoTasaEmbarque; + } + + public void setIndPermisoTasaEmbarque(Boolean indPermisoTasaEmbarque) { + this.indPermisoTasaEmbarque = indPermisoTasaEmbarque; + } + + public Boolean getIndPermisoTasaEmbarqueVtaManual() { + return indPermisoTasaEmbarqueVtaManual; + } + + public void setIndPermisoTasaEmbarqueVtaManual(Boolean indPermisoTasaEmbarqueVtaManual) { + this.indPermisoTasaEmbarqueVtaManual = indPermisoTasaEmbarqueVtaManual; + } + + public Boolean getIndPermisoTasaEmbarqueVtaAgencia() { + return indPermisoTasaEmbarqVtaAgen; + } + + public void setIndPermisoTasaEmbarqueVtaAgencia(Boolean indPermisoTasaEmbarqVtaAgen) { + this.indPermisoTasaEmbarqVtaAgen = indPermisoTasaEmbarqVtaAgen; + } + + public Boolean getIndVendeSeguroOpcEmbarcada() { + return indVendeSeguroOpcEmbarcada; + } + + public void setIndVendeSeguroOpcEmbarcada(Boolean indVendeSeguroOpcEmbarcada) { + this.indVendeSeguroOpcEmbarcada = indVendeSeguroOpcEmbarcada; + } + + public Boolean getIndVendeSeguroTabelaEmbarcada() { + return indVendeSeguroTabelaEmbarcada; + } + + public void setIndVendeSeguroTabelaEmbarcada(Boolean indVendeSeguroTabelaEmbarcada) { + this.indVendeSeguroTabelaEmbarcada = indVendeSeguroTabelaEmbarcada; + } + + public Boolean getIndTaxaEmbarqueEmbarcada() { + return indTaxaEmbarqueEmbarcada; + } + + public void setIndTaxaEmbarqueEmbarcada(Boolean indTaxaEmbarqueEmbarcada) { + this.indTaxaEmbarqueEmbarcada = indTaxaEmbarqueEmbarcada; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java new file mode 100644 index 000000000..faea97fa4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java @@ -0,0 +1,149 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@Table(name = "PTOVTA_USUARIO_BANCARIO") +public class PtoVtaUsuarioBancario implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "PTOVTAUSUARIOBANCARIO_ID") + private Integer ptovtaUsuarioBancarioID; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "USUARIOBANCARIO_ID", referencedColumnName = "USUARIOBANCARIO_ID") + @ManyToOne + private UsuarioBancario usuarioBancario; + + public PtoVtaUsuarioBancario() { + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getPtovtaUsuarioBancarioID() { + return ptovtaUsuarioBancarioID; + } + + public void setPtovtaUsuarioBancarioID(Integer ptovtaUsuarioBancarioID) { + this.ptovtaUsuarioBancarioID = ptovtaUsuarioBancarioID; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public UsuarioBancario getUsuarioBancario() { + return usuarioBancario; + } + + public void setUsuarioBancario(UsuarioBancario usuarioBancario) { + this.usuarioBancario = usuarioBancario; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final PtoVtaUsuarioBancario other = (PtoVtaUsuarioBancario) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.empresa != other.empresa && (this.empresa == null || !this.empresa.equals(other.empresa))) { + return false; + } + if (this.puntoVenta != other.puntoVenta && (this.puntoVenta == null || !this.puntoVenta.equals(other.puntoVenta))) { + return false; + } + if (this.usuarioBancario != other.usuarioBancario && (this.usuarioBancario == null || !this.usuarioBancario.equals(other.usuarioBancario))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 97 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 97 * hash + (this.empresa != null ? this.empresa.hashCode() : 0); + hash = 97 * hash + (this.puntoVenta != null ? this.puntoVenta.hashCode() : 0); + hash = 97 * hash + (this.usuarioBancario != null ? this.usuarioBancario.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "PtoVtaUsuarioBancario{" + "ptovtaUsuarioBancarioID=" + ptovtaUsuarioBancarioID + '}'; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAgencia.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAgencia.java new file mode 100644 index 000000000..0c4291fb9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAgencia.java @@ -0,0 +1,298 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "PTOVTA_AGENCIA_SEQ", sequenceName = "PTOVTA_AGENCIA_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_AGENCIA") + +public class PtovtaAgencia implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_AGENCIA_SEQ") + @Column(name = "PTOVTAAGENCIA_ID") + private Integer ptovtaAgenciaId; + + @Column(name = "NUMAGENCIA") + private String numagencia; + + @Column(name = "NUMCONTA") + private String numconta; + + @Column(name = "DIGITO") + private String digito; + + @Column(name = "PESSOA") + private String pessoa; + + @Column(name = "TIPO") + private String tipo; + + @Column(name = "BILHETES") + private String bilhetes; + + @Column(name = "CARGA") + private String carga; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + @JoinColumn(name = "INSTIFINANCEIRA_ID", referencedColumnName = "INSTIFINANCEIRA_ID") + @ManyToOne + private InstiFinanceira instiFinanceiraId; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "agenciaId") + private List puntoVentaList; + + public PtovtaAgencia() { + } + + public PtovtaAgencia(Integer ptovtaAgenciaId) { + this.ptovtaAgenciaId = ptovtaAgenciaId; + } + + + + public enum enumTipoConta { + // Declara��o dos enum + CONTACORRENTE ("CONTA CORRENTE C/C", "CC"), + + POUPANCA ("POUPANCA", "P"); + + + + // Defini��o das constantes + public final String valor; + public final String descricao; + + + public String valor() { + return this.valor; + } + public String descricao() { + return this.descricao; + } + private enumTipoConta( String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + + + } + + public enum enumTipoPessoa { + // Declara��o dos enum + PESSOAFISICA ("PESSOA F�SICA", "F"), + + PESSOAJURIDICA ("PESSOA JUR�DICA", "J"); + + + + // Defini��o das constantes + public final String valor; + public final String descricao; + + + public String valor() { + return this.valor; + } + public String descricao() { + return this.descricao; + } + private enumTipoPessoa( String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + + + } + + public PtovtaAgencia(Integer ptovtaAgenciaId, String numagencia, String digito, String numconta, String pessoa, String tipo, String bilhetes, String carga, Boolean activo, Date fecmodif, int usuarioId) { + this.ptovtaAgenciaId = ptovtaAgenciaId; + this.numagencia = numagencia; + this.numconta = numconta; + this.digito = digito; + this.pessoa = pessoa; + this.tipo = tipo; + this.bilhetes = bilhetes; + this.carga = carga; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + + public Integer getPtovtaAgenciaId() { + return ptovtaAgenciaId; + } + + public void setPtovtaAgenciaId(Integer ptovtaAgenciaId) { + this.ptovtaAgenciaId = ptovtaAgenciaId; + } + + public String getNumagencia() { + return numagencia; + } + + public void setNumagencia(String numagencia) { + this.numagencia = numagencia; + } + + public String getNumconta() { + return numconta; + } + + public void setNumconta(String numconta) { + this.numconta = numconta; + } + + public String getDigito() { + return digito; + } + + public void setDigito(String digito) { + this.digito = digito; + } + + public String getPessoa() { + return pessoa; + } + + public void setPessoa(String pessoa) { + this.pessoa = pessoa; + } + + public String getTipo() { + return tipo; + } + + public void setTipo(String tipo) { + this.tipo = tipo; + } + + public String getBilhetes() { + return bilhetes; + } + + public void setBilhetes(String bilhetes) { + this.bilhetes = bilhetes; + } + + public String getCarga() { + return carga; + } + + public void setCarga(String carga) { + this.carga = carga; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + + + public InstiFinanceira getInstiFinanceiraId() { + return instiFinanceiraId; + } + + public void setInstiFinanceiraId(InstiFinanceira instiFinanceiraId) { + this.instiFinanceiraId = instiFinanceiraId; + } + + public List getPuntoVentaList() { + return puntoVentaList; + } + + public void setPuntoVentaList(List puntoVentaList) { + this.puntoVentaList = puntoVentaList; + } + + +// public static List getPessoaList() { +// return pessoaList; +// } +// +// public static List getTipoContaList() { +// return tpContaList; +// } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaAgenciaId != null ? ptovtaAgenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaAgencia)) { + return false; + } + PtovtaAgencia other = (PtovtaAgencia) object; + if ((this.ptovtaAgenciaId == null && other.ptovtaAgenciaId != null) || (this.ptovtaAgenciaId != null && !this.ptovtaAgenciaId.equals(other.ptovtaAgenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaAgencia[ ptovtaAgenciaId=" + ptovtaAgenciaId + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java new file mode 100644 index 000000000..ea2216a1f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java @@ -0,0 +1,173 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "PTOVTA_ANTECIPACOMISSAO_SEQ", sequenceName = "PTOVTA_ANTECIPACOMISSAO_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_ANTECIPACOMISSAO") + +public class PtovtaAntecipacomissao implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_ANTECIPACOMISSAO_SEQ") + @Column(name = " PTOVTAANTECIPACOMISSAO_ID") + private Integer ptovtaAntecipaComissaoId; + + @Column(name = "DATA") + @Temporal(TemporalType.TIMESTAMP) + private Date data; + + @Column(name = "RETEM") + private BigDecimal retem; + @Basic(optional = false) + @Column(name = "PERCENTUAL") + private BigDecimal percentual; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + public PtovtaAntecipacomissao() { + } + + public PtovtaAntecipacomissao(Integer ptovtaAntecipaComissaoId) { + this.ptovtaAntecipaComissaoId = ptovtaAntecipaComissaoId; + } + + public PtovtaAntecipacomissao(Integer ptovtaAntecipaComissaoId, Date data, BigDecimal retem, BigDecimal percentual, Boolean activo, Date fecmodif, int usuarioId) { + this.ptovtaAntecipaComissaoId = ptovtaAntecipaComissaoId; + this.data = data; + this.retem = retem; + this.percentual = percentual; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + + public Integer getPtovtaAntecipaComissaoId() { + return ptovtaAntecipaComissaoId; + } + + public void setPtovtaAntecipaComissaoId(Integer ptovtaAntecipaComissaoId) { + this.ptovtaAntecipaComissaoId = ptovtaAntecipaComissaoId; + } + + public Date getData() { + return data; + } + + public void setData(Date data) { + this.data = data; + } + + public BigDecimal getRetem() { + return retem; + } + + public void setRetem(BigDecimal retem) { + this.retem = retem; + } + + public BigDecimal getPercentual() { + return percentual; + } + + public void setPercentual(BigDecimal percentual) { + this.percentual = percentual; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaAntecipaComissaoId != null ? ptovtaAntecipaComissaoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaAntecipacomissao)) { + return false; + } + PtovtaAntecipacomissao other = (PtovtaAntecipacomissao) object; + if ((this.ptovtaAntecipaComissaoId == null && other.ptovtaAntecipaComissaoId != null) || (this.ptovtaAntecipaComissaoId != null && !this.ptovtaAntecipaComissaoId.equals(other.ptovtaAntecipaComissaoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaAntecipacomissao[ ptovtaAntecipaComissaoId=" + ptovtaAntecipaComissaoId + " ]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java new file mode 100644 index 000000000..00c4bc556 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java @@ -0,0 +1,163 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.rjconsultores.ventaboletos.enums.TipoAntifraude; + +/** + * @author Wilian + */ +@Entity +@SequenceGenerator(name = "PTOVTA_ANTIFRAUDE_SEQ", sequenceName = "PTOVTA_ANTIFRAUDE_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_ANTIFRAUDE") +public class PtovtaAntifraude implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_ANTIFRAUDE_SEQ") + @Column(name = "PTOVTAANTIFRAUDE_ID") + private Integer ptovtaAntifraudeId; + + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoventa; + + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Enumerated(EnumType.STRING) + @Column(name = "tipo") + private TipoAntifraude tipo; + + @Column(name = "CHAVE") + private String chave; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + public PtovtaAntifraude() { + super(); + this.activo = true; + this.fecmodif = new Date(); + } + + public PtovtaAntifraude(Integer ptovtaAntifraudeId) { + this.ptovtaAntifraudeId = ptovtaAntifraudeId; + } + + public Integer getPtovtaAntifraudeId() { + return ptovtaAntifraudeId; + } + + public void setPtovtaAntifraudeId(Integer ptovtaAntifraudeId) { + this.ptovtaAntifraudeId = ptovtaAntifraudeId; + } + + public PuntoVenta getPuntoventa() { + return puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public TipoAntifraude getTipo() { + return tipo; + } + + public void setTipo(TipoAntifraude tipo) { + this.tipo = tipo; + } + + public String getChave() { + return chave; + } + + public void setChave(String chave) { + this.chave = chave; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((ptovtaAntifraudeId == null) ? 0 : ptovtaAntifraudeId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof PtovtaAntifraude)) + return false; + PtovtaAntifraude other = (PtovtaAntifraude) obj; + if (ptovtaAntifraudeId == null) { + if (other.ptovtaAntifraudeId != null) + return false; + } else if (!ptovtaAntifraudeId.equals(other.ptovtaAntifraudeId)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java new file mode 100644 index 000000000..3cd733fe9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java @@ -0,0 +1,198 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PTOVTA_CAT_IND_SEQ", sequenceName = "PTOVTA_CAT_IND_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_CAT_IND") +public class PtovtaCatInd implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_CAT_IND_SEQ") + @Column(name = "PTOVTACATEGORIA_ID") + private Integer ptovtaCategoriaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "USUARIOBLOQUEADO_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuarioBloqueado; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @Column(name = "INDTOTALBUS") + private Boolean indTotalBus; + @Column(name = "INDEMBARCADA") + private Boolean indEmbarcada; + + public Integer getPtovtaCategoriaId() { + return ptovtaCategoriaId; + } + + public void setPtovtaCategoriaId(Integer ptovtaCategoriaId) { + this.ptovtaCategoriaId = ptovtaCategoriaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + + + public Usuario getUsuarioBloqueado() { + return usuarioBloqueado; + } + + public void setUsuarioBloqueado(Usuario usuarioBloqueado) { + this.usuarioBloqueado = usuarioBloqueado; + } + + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getIndTotalBus() { + return indTotalBus; + } + + public void setIndTotalBus(Boolean indTotalBus) { + this.indTotalBus = indTotalBus; + } + + public Boolean getIndEmbarcada() { + return indEmbarcada; + } + + public void setIndEmbarcada(Boolean indEmbarcada) { + this.indEmbarcada = indEmbarcada; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activo == null) ? 0 : activo.hashCode()); + result = prime * result + ((categoria == null) ? 0 : categoria.hashCode()); + result = prime * result + ((fecmodif == null) ? 0 : fecmodif.hashCode()); + result = prime * result + ((ptovtaCategoriaId == null) ? 0 : ptovtaCategoriaId.hashCode()); + result = prime * result + ((puntoVenta == null) ? 0 : puntoVenta.hashCode()); + result = prime * result + ((usuarioId == null) ? 0 : usuarioId.hashCode()); + result = prime * result + ((empresa == null) ? 0 : empresa.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PtovtaCatInd other = (PtovtaCatInd) obj; + if (activo == null) { + if (other.activo != null) + return false; + } else if (!activo.equals(other.activo)) + return false; + if (categoria == null) { + if (other.categoria != null) + return false; + } else if (!categoria.equals(other.categoria)) + return false; + if (fecmodif == null) { + if (other.fecmodif != null) + return false; + } else if (!fecmodif.equals(other.fecmodif)) + return false; + if (ptovtaCategoriaId == null) { + if (other.ptovtaCategoriaId != null) + return false; + } else if (!ptovtaCategoriaId.equals(other.ptovtaCategoriaId)) + return false; + if (puntoVenta == null) { + if (other.puntoVenta != null) + return false; + } else if (!puntoVenta.equals(other.puntoVenta)) + return false; + if (usuarioId == null) { + if (other.usuarioId != null) + return false; + } else if (!usuarioId.equals(other.usuarioId)) + return false; + if (empresa == null) { + if (other.empresa != null) + return false; + } else if (!empresa.equals(other.empresa)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java new file mode 100644 index 000000000..be6bddf03 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java @@ -0,0 +1,602 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.rjconsultores.ventaboletos.enums.ModeloComissaoImpressaoPosterior; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "PTOVTA_COMISSAO_SEQ", sequenceName = "PTOVTA_COMISSAO_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_COMISSAO") +public class PtovtaComissao implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_COMISSAO_SEQ") + @Column(name = "PTOVTACOMISSAO_ID") + private Integer ptovtaComissaoId; + + @Column(name = "ISSRETIDO") + private BigDecimal issretido; + + @Column(name = "ROYALTIES") + private BigDecimal royalties; + + @Column(name = "ENVIARRECIBO") + private Boolean enviarRecibo; + + @Column(name = "RECEITA") + private String receita; + + @OneToOne + @JoinColumn(name = "PTOVTADESCOMISSAO_ID") + private PuntoVenta descComissaoId; + + @Column(name = "PASSAGEMALTA") + private BigDecimal passagemAlta; + + @Column(name = "PASSAGEMBAIXA") + private BigDecimal passagemBaixa; + + @Column(name = "SEGUROALTA") + private BigDecimal seguroAlta; + + @Column(name = "SEGUROBAIXA") + private BigDecimal seguroBaixa; + + @Column(name = "OUTROSBAIXA") + private BigDecimal outrosBaixa; + + @Column(name = " OUTROSALTA") + private BigDecimal outrosAlta; + + @Column(name = "EXCESSOALTA") + private BigDecimal excessoAlta; + + @Column(name = "EXCESSOBAIXA") + private BigDecimal excessoBaixa; + + @Column(name = "TARIFARECEITA") + private Boolean tarifaReceita; + + @Column(name = " SEGURORECEITA") + private Boolean seguroReceita; + + @Column(name = "TAXARECEITA") + private Boolean taxaReceita; + + @Column(name = "PEDAGIORECEITA") + private Boolean pedagioReceita; + + @Column(name = " TARIFADEV") + private Boolean tarifaDev; + + @Column(name = " SEGURO_DEV") + private Boolean seguroDev; + + @Column(name = "TAXADEV") + private Boolean taxaDev; + + @Column(name = "PEDAGIODEV") + private Boolean pedagioDev; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + @Column(name = "INDIMPRESSAOGAPPORC") + private Boolean indimpressaogapporc; + + @Column(name = "VALOR_IMPRESSAO_GAP") + private BigDecimal valorImpressaoGap; + + @Column(name = "VALOR_IMPRESSAO_GAP_ALTA") + private BigDecimal valorImpressaoGapAlta; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresaId; + + @Column(name = "INDRETERCOMISSAO") + private Boolean indretercomissao; + + @Column(name = "INDBILHETESDEVCANORIGEM") + private Boolean indbilhetesdevcanorigem; + + @Column(name = "INDPAGACOMISSAOBILHETEOS") + private Boolean indPagaComissaoBilheteOS; + + @Column(name = "COMISSAOIMPPOSTERIOR") + @Enumerated(EnumType.STRING) + private ModeloComissaoImpressaoPosterior modeloComissaoImpressaoPosterior; + + @Column(name = "VALOR_IMP_GAP_COMP") + private BigDecimal valorImpGapComp; + + @Column(name = "VALOR_IMP_GAP_ALTA_COMP") + private BigDecimal valorImpGapCompAlta; + + @Column(name = "VALOR_VENDA_GAP_COMP") + private BigDecimal valorVendaGapComp; + + @Column(name = "VALOR_VENDA_GAP_ALTA_COMP") + private BigDecimal valorVendaGapCompAlta; + + @Column(name = "SEGUROOBRIGATORIOALTA") + private BigDecimal seguroobrigatorioAlta; + + @Column(name = "SEGUROOBRIGATORIOBAIXA") + private BigDecimal seguroobrigatorioBaixa; + + public PtovtaComissao() { + super(); + this.tarifaDev = Boolean.TRUE; + this.tarifaReceita = Boolean.TRUE; + } + + public enum Receita { + // Declaração dos enum + RECEITABRUTA("RECEITA BRUTA", "RB"), + + RECEITALIQUIDA("RECEITA LÍQUIDA ", "RL"); + + // Definição das constantes + public final String valor; + public final String descricao; + + public String valor() { + return this.valor; + } + + public String descricao() { + return this.descricao; + } + + private Receita(String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + + public static Receita getByValor(String valor) { + if (valor == null) { + return Receita.RECEITABRUTA; + } else { + if (valor.equals("RB")) + return Receita.RECEITABRUTA; + if (valor.equals("RL")) + return Receita.RECEITALIQUIDA; + } + + return null; + + } + + } + + public PtovtaComissao(Integer ptovtaComissaoId) { + this.ptovtaComissaoId = ptovtaComissaoId; + } + + public PtovtaComissao(Integer ptovtaComissaoId, BigDecimal issretido, BigDecimal royalties, Boolean enviarrecibo, String receita, BigDecimal passagemAlta, BigDecimal passagemBaixa, BigDecimal seguroAlta, BigDecimal seguroBaixa, BigDecimal outrosBaixa, BigDecimal outrosAlta, BigDecimal excessoAlta, BigDecimal excessoBaixa, Boolean tarifaReceita, Boolean seguroReceita, Boolean taxaReceita, Boolean pedagioReceita, Boolean tarifaDev, Boolean seguroDev, Boolean taxaDev, Boolean pegagioDev, Boolean activo, Date fecmodif, int usuarioId, Boolean indimpressaogapporc, BigDecimal valorImpressaoGap, + BigDecimal seguroobrigatorioBaixa, BigDecimal seguroobrigatorioAlta) { + super(); + this.ptovtaComissaoId = ptovtaComissaoId; + this.issretido = issretido; + this.royalties = royalties; + this.enviarRecibo = enviarrecibo; + this.receita = receita; + this.passagemAlta = passagemAlta; + this.passagemBaixa = passagemBaixa; + this.seguroAlta = seguroAlta; + this.seguroBaixa = seguroBaixa; + this.outrosBaixa = outrosBaixa; + this.outrosAlta = outrosAlta; + this.excessoAlta = excessoAlta; + this.excessoBaixa = excessoBaixa; + this.tarifaReceita = tarifaReceita; + this.seguroReceita = seguroReceita; + this.taxaReceita = taxaReceita; + this.pedagioReceita = pedagioReceita; + this.tarifaDev = tarifaDev; + this.seguroDev = seguroDev; + this.taxaDev = taxaDev; + this.pedagioDev = pegagioDev; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + this.indimpressaogapporc = indimpressaogapporc; + this.valorImpressaoGap = valorImpressaoGap; + this.seguroobrigatorioBaixa = seguroobrigatorioBaixa; + this.seguroobrigatorioAlta = seguroobrigatorioAlta; + } + + public Integer getPtovtaComissaoId() { + return ptovtaComissaoId; + } + + public void setPtovtaComissaoId(Integer ptovtaComissaoId) { + this.ptovtaComissaoId = ptovtaComissaoId; + } + + public PuntoVenta getDescComissaoId() { + return descComissaoId; + } + + public void setDescComissaoId(PuntoVenta descComissaoId) { + this.descComissaoId = descComissaoId; + } + + public BigDecimal getIssretido() { + return issretido; + } + + public void setIssretido(BigDecimal issretido) { + this.issretido = issretido; + } + + public BigDecimal getRoyalties() { + return royalties; + } + + public void setRoyalties(BigDecimal royalties) { + this.royalties = royalties; + } + + public Boolean getEnviarrecibo() { + return enviarRecibo; + } + + public void setEnviarrecibo(Boolean enviarRecibo) { + this.enviarRecibo = enviarRecibo; + } + + public String getReceita() { + return receita; + } + + public void setReceita(String receita) { + this.receita = receita; + } + + public BigDecimal getPassagemAlta() { + return passagemAlta; + } + + public void setPassagemAlta(BigDecimal passagemAlta) { + this.passagemAlta = passagemAlta; + } + + public BigDecimal getPassagemBaixa() { + return passagemBaixa; + } + + public void setPassagemBaixa(BigDecimal passagemBaixa) { + this.passagemBaixa = passagemBaixa; + } + + public BigDecimal getSeguroAlta() { + return seguroAlta; + } + + public void setSeguroAlta(BigDecimal seguroAlta) { + this.seguroAlta = seguroAlta; + } + + public BigDecimal getSeguroBaixa() { + return seguroBaixa; + } + + public void setSeguroBaixa(BigDecimal seguroBaixa) { + this.seguroBaixa = seguroBaixa; + } + + public BigDecimal getOutrosBaixa() { + return outrosBaixa; + } + + public void setOutrosBaixa(BigDecimal outrosBaixa) { + this.outrosBaixa = outrosBaixa; + } + + public BigDecimal getOutrosAlta() { + return outrosAlta; + } + + public void setOutrosAlta(BigDecimal outrosAlta) { + this.outrosAlta = outrosAlta; + } + + public BigDecimal getExcessoAlta() { + return excessoAlta; + } + + public void setExcessoAlta(BigDecimal excessoAlta) { + this.excessoAlta = excessoAlta; + } + + public BigDecimal getExcessoBaixa() { + return excessoBaixa; + } + + public void setExcessoBaixa(BigDecimal excessoBaixa) { + this.excessoBaixa = excessoBaixa; + } + + public Boolean getTarifaReceita() { + return tarifaReceita; + } + + public void setTarifaReceita(Boolean tarifaReceita) { + this.tarifaReceita = tarifaReceita; + } + + public Boolean getSeguroReceita() { + return seguroReceita != null ? seguroReceita : false; + } + + public void setSeguroReceita(Boolean seguroReceita) { + this.seguroReceita = seguroReceita; + } + + public Boolean getTaxaReceita() { + return taxaReceita; + } + + public void setTaxaReceita(Boolean taxaReceita) { + this.taxaReceita = taxaReceita; + } + + public Boolean getPedagioReceita() { + return pedagioReceita; + } + + public void setPedagioReceita(Boolean pedagioReceita) { + this.pedagioReceita = pedagioReceita; + } + + public Boolean getTarifaDev() { + return tarifaDev; + } + + public void setTarifaDev(Boolean tarifaDev) { + this.tarifaDev = tarifaDev; + } + + public Boolean getSeguroDev() { + return seguroDev != null ? seguroDev : false; + } + + public void setSeguroDev(Boolean seguroDev) { + this.seguroDev = seguroDev; + } + + public Boolean getTaxaDev() { + return taxaDev; + } + + public void setTaxaDev(Boolean taxaDev) { + this.taxaDev = taxaDev; + } + + public Boolean getPedagioDev() { + return pedagioDev; + } + + public void setPedagioDev(Boolean pegagioDev) { + this.pedagioDev = pegagioDev; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + // + + /** + * @return the empresaId + */ + public Empresa getEmpresaId() { + return empresaId; + } + + /** + * @param empresaId + * the empresaId to set + */ + public void setEmpresaId(Empresa empresaId) { + this.empresaId = empresaId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaComissaoId != null ? ptovtaComissaoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaComissao)) { + return false; + } + PtovtaComissao other = (PtovtaComissao) object; + if ((this.ptovtaComissaoId == null && other.ptovtaComissaoId != null) || (this.ptovtaComissaoId != null && !this.ptovtaComissaoId.equals(other.ptovtaComissaoId))) { + return false; + } + return true; + } + + public Boolean getIndimpressaogapporc() { + return indimpressaogapporc; + } + + public void setIndimpressaogapporc(Boolean indimpressaogapporc) { + this.indimpressaogapporc = indimpressaogapporc; + } + + public BigDecimal getValorImpressaoGap() { + return valorImpressaoGap; + } + + public void setValorImpressaoGap(BigDecimal valorImpressaoGap) { + this.valorImpressaoGap = valorImpressaoGap; + } + + public Boolean getIndretercomissao() { + return indretercomissao; + } + + public void setIndretercomissao(Boolean indretercomissao) { + this.indretercomissao = indretercomissao; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaComissao[ ptovtaComissaoId=" + ptovtaComissaoId + " ]"; + } + + public Boolean getIndbilhetesdevcanorigem() { + return indbilhetesdevcanorigem; + } + + public void setIndbilhetesdevcanorigem(Boolean indbilhetesdevcanorigem) { + this.indbilhetesdevcanorigem = indbilhetesdevcanorigem; + } + + public BigDecimal getValorImpressaoGapAlta() { + return valorImpressaoGapAlta; + } + + public void setValorImpressaoGapAlta(BigDecimal valorImpressaoGapAlta) { + this.valorImpressaoGapAlta = valorImpressaoGapAlta; + } + + public Boolean getIndPagaComissaoBilheteOS() { + return indPagaComissaoBilheteOS; + } + + public void setIndPagaComissaoBilheteOS(Boolean indPagaComissaoBilheteOS) { + this.indPagaComissaoBilheteOS = indPagaComissaoBilheteOS; + } + + public ModeloComissaoImpressaoPosterior getModeloComissaoImpressaoPosterior() { + return modeloComissaoImpressaoPosterior; + } + + public void setModeloComissaoImpressaoPosterior(ModeloComissaoImpressaoPosterior modeloComissaoImpressaoPosterior) { + this.modeloComissaoImpressaoPosterior = modeloComissaoImpressaoPosterior; + } + + public BigDecimal getValorImpGapComp() { + return valorImpGapComp; + } + + public void setValorImpGapComp(BigDecimal valorImpGapComp) { + this.valorImpGapComp = valorImpGapComp; + } + + public BigDecimal getValorImpGapCompAlta() { + return valorImpGapCompAlta; + } + + public void setValorImpGapCompAlta(BigDecimal valorImpGapCompAlta) { + this.valorImpGapCompAlta = valorImpGapCompAlta; + } + + public BigDecimal getValorVendaGapComp() { + return valorVendaGapComp; + } + + public void setValorVendaGapComp(BigDecimal valorVendaGapComp) { + this.valorVendaGapComp = valorVendaGapComp; + } + + public BigDecimal getValorVendaGapCompAlta() { + return valorVendaGapCompAlta; + } + + public void setValorVendaGapCompAlta(BigDecimal valorVendaGapCompAlta) { + this.valorVendaGapCompAlta = valorVendaGapCompAlta; + } + + public BigDecimal getSeguroobrigatorioAlta() { + return seguroobrigatorioAlta; + } + + public void setSeguroobrigatorioAlta(BigDecimal seguroobrigatorioAlta) { + this.seguroobrigatorioAlta = seguroobrigatorioAlta; + } + + public BigDecimal getSeguroobrigatorioBaixa() { + return seguroobrigatorioBaixa; + } + + public void setSeguroobrigatorioBaixa(BigDecimal seguroobrigatorioBaixa) { + this.seguroobrigatorioBaixa = seguroobrigatorioBaixa; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaContaMD.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaContaMD.java new file mode 100644 index 000000000..e87eb6642 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaContaMD.java @@ -0,0 +1,126 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PTOVTACONTA_SEQ", sequenceName = "PTOVTACONTA_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_CONTA") +public class PtovtaContaMD { + + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTACONTA_SEQ") + @Column(name = "PTOVTACONTA_ID") + private Integer ptovtaContaId; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresaId; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + @JoinColumn(name = "CONTA_ID", referencedColumnName = "CONTA_ID") + @ManyToOne + private ContaMD contaId; + + @Column(name = "PERCENTUAL") + private BigDecimal percentual; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "ACTIVO") + private Boolean activo; + + public Integer getPtovtaContaId() { + return ptovtaContaId; + } + + public void setPtovtaContaId(Integer ptovtaContaId) { + this.ptovtaContaId = ptovtaContaId; + } + + public Empresa getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Empresa empresaId) { + this.empresaId = empresaId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public ContaMD getContaId() { + return contaId; + } + + public void setContaId(ContaMD contaId) { + this.contaId = contaId; + } + + public BigDecimal getPercentual() { + return percentual; + } + + public void setPercentual(BigDecimal percentual) { + this.percentual = percentual; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public String toString() { + return "PtovtaConta [ptovtaContaId=" + ptovtaContaId + ", empresaId=" + empresaId + ", puntoventaId=" + puntoventaId + ", contaId=" + contaId + ", percentual=" + percentual + ", usuarioId=" + usuarioId + ", fecmodif=" + fecmodif + ", activo=" + activo + "]"; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaDiversos.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaDiversos.java new file mode 100644 index 000000000..0c6f56979 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaDiversos.java @@ -0,0 +1,324 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "PTOVTA_DIVERSOS_SEQ", sequenceName = "PTOVTA_DIVERSOS_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_DIVERSOS") +public class PtovtaDiversos implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_DIVERSOS_SEQ") + @Column(name = "PTOVTADIVERSOS_ID ") + private Integer ptovtaDiversosId; + + @Column(name = "RESPONALUGUEL") + private String responAluguel; + + @Column(name = "RESPONTELEFONE") + private String responTelefone; + + @Column(name = "RESPONENERGIA") + private String responEnergia; + + @Column(name = "POSICAO") + private String posicao; + + @Column(name = "INFORMATIZADA") + private Boolean informatizada; + + @Column(name = "BILHETEINFO") + private Boolean bilheteInfo; + + @Column(name = "VENDAINTERNET") + private Boolean vendaInternet; + + @Column(name = "DIGITACAOSEQ") + private Boolean digitacaoSeq; + + @Column(name = "TELEENTREGA") + private Boolean teleEntrega; + + @Column(name = "TRABALHABILHETE") + private Boolean trabalhaBilhete; + + @Column(name = "TRABOFPSPROPRIA") + private Boolean ofpsPropria; + + @Column(name = "TRABOFPSTERCEIROS") + private Boolean ofpsTerceiros; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + public PtovtaDiversos() { + } + + public enum gerarEnum { + // Declaração dos enum + + + POSICAOFORAEIXO ("FORA DO EIXO DA LINHA", "FEL"), + POSICAONOEIXO ("NO EIXO DA LINHA", "EL"); + + + + // Definição das constantes + public final String valor; + public final String descricao; + + + public String valor() { + return this.valor; + } + public String descricao() { + return this.descricao; + } + private gerarEnum( String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + + + } + +// private static List posicaoList = new ArrayList(); +// +// static{ +// posicaoList.add("FORA DO EIXO DA LINHA"); +// posicaoList.add("NO EIXO DA LINHA"); +// +// } +// + + public PtovtaDiversos(Integer ptovtaDiversosId, String responAluguel, String responTelefone, String responEnergia, String posicao, Boolean informatizada, Boolean bilheteInfo, Boolean vendaInternet, Boolean digitacaoSeq, Boolean teleEntrega, Boolean trabalhaBilhete, Boolean ofpsPropria, Boolean ofpsTerceiros, Boolean activo, Date fecmodif, int usuarioId) { + super(); + this.ptovtaDiversosId = ptovtaDiversosId; + this.responAluguel = responAluguel; + this.responTelefone = responTelefone; + this.responEnergia = responEnergia; + this.posicao = posicao; + this.informatizada = informatizada; + this.bilheteInfo = bilheteInfo; + this.vendaInternet = vendaInternet; + this.digitacaoSeq = digitacaoSeq; + this.teleEntrega = teleEntrega; + this.trabalhaBilhete = trabalhaBilhete; + this.ofpsPropria = ofpsPropria; + this.ofpsTerceiros = ofpsTerceiros; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + public Integer getPtovtaDiversosId() { + return ptovtaDiversosId; + } + + public void setPtovtaDiversosId(Integer ptovtaDiversosId) { + this.ptovtaDiversosId = ptovtaDiversosId; + } + + public String getResponAluguel() { + return responAluguel; + } + + public void setResponAluguel(String responAluguel) { + this.responAluguel = responAluguel; + } + + public String getResponTelefone() { + return responTelefone; + } + + public void setResponTelefone(String responTelefone) { + this.responTelefone = responTelefone; + } + + public String getResponEnergia() { + return responEnergia; + } + + public void setResponEnergia(String responEnergia) { + this.responEnergia = responEnergia; + } + + public String getPosicao() { + return posicao; + } + + public void setPosicao(String posicao) { + this.posicao = posicao; + } + + + public Boolean getInformatizada() { + return informatizada; + } + + public void setInformatizada(Boolean informatizada) { + this.informatizada = informatizada; + } + + public Boolean getBilheteInfo() { + return bilheteInfo; + } + + public void setBilheteInfo(Boolean bilheteInfo) { + this.bilheteInfo = bilheteInfo; + } + + public Boolean getVendaInternet() { + return vendaInternet; + } + + public void setVendaInternet(Boolean vendaInternet) { + this.vendaInternet = vendaInternet; + } + + public Boolean getDigitacaoSeq() { + return digitacaoSeq; + } + + public void setDigitacaoSeq(Boolean digitacaoSeq) { + this.digitacaoSeq = digitacaoSeq; + } + + public Boolean getTeleEntrega() { + return teleEntrega; + } + + public void setTeleEntrega(Boolean teleEntrega) { + this.teleEntrega = teleEntrega; + } + + public Boolean getTrabalhaBilhete() { + return trabalhaBilhete; + } + + public void setTrabalhaBilhete(Boolean trabalhaBilhete) { + this.trabalhaBilhete = trabalhaBilhete; + } + + public Boolean getOfpsPropria() { + return ofpsPropria; + } + + public void setOfpsPropria(Boolean ofpsPropria) { + this.ofpsPropria = ofpsPropria; + } + + public Boolean getOfpsTerceiros() { + return ofpsTerceiros; + } + + public void setOfpsTerceiros(Boolean ofpsTerceiros) { + this.ofpsTerceiros = ofpsTerceiros; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + + + + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaDiversosId != null ? ptovtaDiversosId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaDiversos)) { + return false; + } + PtovtaDiversos other = (PtovtaDiversos) object; + if ((this.ptovtaDiversosId == null && other.ptovtaDiversosId != null) || (this.ptovtaDiversosId != null && !this.ptovtaDiversosId.equals(other.ptovtaDiversosId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaDiversos[ ptovtaDiversosId=" + ptovtaDiversosId + " ]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java new file mode 100644 index 000000000..a2b9e67a9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java @@ -0,0 +1,270 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +/** + * + * @author Desenvolvimento + */ +@Entity +@SequenceGenerator(name = "PTOVTA_EMPRESA_SEQ", sequenceName = "PTOVTA_EMPRESA_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_EMPRESA") +public class PtovtaEmpresa implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_EMPRESA_SEQ") + @Column(name = "PTOVTAEMPRESA_ID") + private Integer ptovtaempresaId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + + @Column(name = "INDTERCEIRIZADA") + private Boolean indTerceirizada; + + @Column(name = "INDBLOQUEADA") + private Boolean indBloqueada; + + @Column(name = "INDMOSTRARCAJA") + private Boolean indMostrarCaja; + + @Column(name = "NUMSITEF") + private String numeroSitef; + + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PTOVTAEMPRESA_ID", referencedColumnName = "PTOVTAEMPRESA_ID") + private List lsPtovtaEmpresaContaBancaria; + +// @JoinColumn(name = "EMPRESACONTABANCARIA_ID", referencedColumnName = "EMPRESACONTABANCARIA_ID") +// @ManyToOne +// private EmpresaContaBancaria empresaContaBancaria; + + @Column(name = "INDIMPCOMPCARTAO") + private Boolean indImpCompCartao; + + @Transient + private List contasBancaria; + + public PtovtaEmpresa() { + } + + public PtovtaEmpresa(Integer ptovtaempresaId) { + this.ptovtaempresaId = ptovtaempresaId; + } + + public Integer getPtovtaempresaId() { + return ptovtaempresaId; + } + + public void setPtovtaempresaId(Integer ptovtaempresaId) { + this.ptovtaempresaId = ptovtaempresaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + +// public EmpresaContaBancaria getEmpresaContaBancaria() { +// return empresaContaBancaria; +// } +// +// public void setEmpresaContaBancaria(EmpresaContaBancaria empresaContaBancaria) { +// this.empresaContaBancaria = empresaContaBancaria; +// } + + public Boolean getIndTerceirizada() { + return indTerceirizada; + } + + public void setIndTerceirizada(Boolean indTerceirizada) { + this.indTerceirizada = indTerceirizada; + } + + public Boolean getIndBloqueada() { + return indBloqueada; + } + + public void setIndBloqueada(Boolean indBloqueada) { + this.indBloqueada = indBloqueada; + } + + /** + * @return the indMostrarCaja + */ + public Boolean getIndMostrarCaja() { + return indMostrarCaja; + } + + /** + * @param indMostrarCaja the indMostrarCaja to set + */ + public void setIndMostrarCaja(Boolean indMostrarCaja) { + this.indMostrarCaja = indMostrarCaja; + } + + public String getNumeroSitef() { + return numeroSitef; + } + + public void setNumeroSitef(String numeroSitef) { + this.numeroSitef = numeroSitef; + } + + public Boolean getIndImpCompCartao() { + return indImpCompCartao; + } + + public void setIndImpCompCartao(Boolean indImpCompCartao) { + this.indImpCompCartao = indImpCompCartao; + } + + public List getLsPtovtaEmpresaContaBancaria() { + if (lsPtovtaEmpresaContaBancaria == null) { + lsPtovtaEmpresaContaBancaria = new ArrayList(0); + } + + return lsPtovtaEmpresaContaBancaria; + } + + public void setLsPtovtaEmpresaContaBancaria(List lsPtovtaEmpresaContaBancaria) { + this.lsPtovtaEmpresaContaBancaria = lsPtovtaEmpresaContaBancaria; + } + + public List getContasBancaria() { + if (contasBancaria == null) { + contasBancaria = new ArrayList(0); + } + + return contasBancaria; + } + + public void setContasBancaria(List contasBancaria) { + this.contasBancaria = contasBancaria; + } + + public String getContasBancariaInfo() { + if (!getContasBancaria().isEmpty()) { + StringBuilder sb = new StringBuilder(); + + for (EmpresaContaBancaria ecb : getContasBancaria()) { + if (!sb.toString().isEmpty()) { + sb.append(", "); + } + + sb.append(ecb.getInstituicaoFinandeira().getNome()); + } + + return sb.toString(); + } + + return null; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((ptovtaempresaId == null) ? 0 : ptovtaempresaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PtovtaEmpresa other = (PtovtaEmpresa) obj; + if (ptovtaempresaId == null) { + if (other.ptovtaempresaId != null) + return false; + } else if (!ptovtaempresaId.equals(other.ptovtaempresaId)) + return false; + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa[ptovtaempresaId=" + ptovtaempresaId + "]"; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java new file mode 100644 index 000000000..da560d3a4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java @@ -0,0 +1,108 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "PTOVTA_EMP_BLOQUEADA_SEQ", sequenceName = "PTOVTA_EMP_BLOQUEADA_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_EMP_BLOQUEADA") +public class PtovtaEmpresaBloqueada implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_EMP_BLOQUEADA_SEQ") + @Column(name = "PTOVTAEMPBLOQUEADA_ID") + private Integer ptovtaempbloqueadaId; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getPtovtaempbloqueadaId() { + return ptovtaempbloqueadaId; + } + + public void setPtovtaempbloqueadaId(Integer ptovtaempbloqueadaId) { + this.ptovtaempbloqueadaId = ptovtaempbloqueadaId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public boolean equals(Object o){ + if (!(o instanceof PtovtaEmpresaBloqueada)) { + return false; + } + PtovtaEmpresaBloqueada other = (PtovtaEmpresaBloqueada) o; + if ((this.ptovtaempbloqueadaId == null && other.ptovtaempbloqueadaId != null) || (this.ptovtaempbloqueadaId != null && !this.ptovtaempbloqueadaId.equals(other.ptovtaempbloqueadaId))) { + return false; + } + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaContaBancaria.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaContaBancaria.java new file mode 100644 index 000000000..2bacc9bce --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaContaBancaria.java @@ -0,0 +1,132 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@SequenceGenerator(name = "PTOVTAEMPCONBAN_SEQ", sequenceName = "PTOVTAEMPCONBAN_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_EMPRESA_CONTABANCARIA") +public class PtovtaEmpresaContaBancaria implements Serializable { + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTAEMPCONBAN_SEQ") + @Column(name = "PTOVTAEMPRESACONTABANCARIA_ID") + private Integer ptovtaEmpresaContaBancariaId; + + @JoinColumn(name = "PTOVTAEMPRESA_ID", referencedColumnName = "PTOVTAEMPRESA_ID") + @ManyToOne + private PtovtaEmpresa ptovtaEmpresa; + + @JoinColumn(name = "EMPRESACONTABANCARIA_ID", referencedColumnName = "EMPRESACONTABANCARIA_ID") + @ManyToOne + private EmpresaContaBancaria empresaContaBancaria; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public PtovtaEmpresaContaBancaria() { + } + + public Integer getPtovtaEmpresaContaBancariaId() { + return ptovtaEmpresaContaBancariaId; + } + + public void setPtovtaEmpresaContaBancariaId(Integer ptovtaEmpresaContaBancariaId) { + this.ptovtaEmpresaContaBancariaId = ptovtaEmpresaContaBancariaId; + } + + public PtovtaEmpresa getPtovtaEmpresa() { + return ptovtaEmpresa; + } + + public void setPtovtaEmpresa(PtovtaEmpresa ptovtaEmpresa) { + this.ptovtaEmpresa = ptovtaEmpresa; + } + + public EmpresaContaBancaria getEmpresaContaBancaria() { + return empresaContaBancaria; + } + + public void setEmpresaContaBancaria(EmpresaContaBancaria empresaContaBancaria) { + this.empresaContaBancaria = empresaContaBancaria; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((ptovtaEmpresaContaBancariaId == null) ? 0 : ptovtaEmpresaContaBancariaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PtovtaEmpresaContaBancaria other = (PtovtaEmpresaContaBancaria) obj; + if (ptovtaEmpresaContaBancariaId == null) { + if (other.ptovtaEmpresaContaBancariaId != null) + return false; + } else if (!ptovtaEmpresaContaBancariaId.equals(other.ptovtaEmpresaContaBancariaId)) + return false; + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaContaBancaria[ptovtaEmpresaContaBancariaId=" + ptovtaEmpresaContaBancariaId + "]"; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java new file mode 100644 index 000000000..b3478d3b1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java @@ -0,0 +1,218 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "PTOVTA_ESTOQUE_SEQ ", sequenceName = "PTOVTA_ESTOQUE_SEQ ", allocationSize = 1) +@Table(name = "PTOVTA_ESTOQUE") + +public class PtovtaEstoque implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_ESTOQUE_SEQ ") + @Column(name = "PTOVTAESTOQUE_ID") + private Integer ptovtaEstoqueId; + + @Column(name = "ESPECIE") + private String especie; + + @Column(name = "FORMCONT") + private Integer formCont; + + @Column(name = "QUANTIDADE") + private int quantidade; + + @Column(name = "LOTEFORM") + private Integer loteform; + + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + public PtovtaEstoque() { + } + + public PtovtaEstoque(Integer ptovtaEstoqueId) { + this.ptovtaEstoqueId = ptovtaEstoqueId; + } + + + + + public enum gerarEnum { + // Declaração dos enum + SIM ("SIM", "1"), + + NAO ("NAO", "0"); + + + + // Definição das constantes + public final String valor; + public final String descricao; + + + public String valor() { + return this.valor; + } + public String descricao() { + return this.descricao; + } + private gerarEnum( String descricao, String valor) { + this.descricao = descricao; + this.valor = valor; + } + + + } + + public PtovtaEstoque(Integer ptovtaEstoqueId, String especie, Integer formCont, int quantidade, Integer loteform, Boolean activo, Date fecmodif, int usuarioId) { + this.ptovtaEstoqueId = ptovtaEstoqueId; + this.especie = especie; + this.formCont = formCont; + this.quantidade = quantidade; + this.loteform = loteform; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + + public Integer getPtovtaEstoqueId() { + return ptovtaEstoqueId; + } + + public void setPtovtaEstoqueId(Integer ptovtaEstoqueId) { + this.ptovtaEstoqueId = ptovtaEstoqueId; + } + + public String getEspecie() { + return especie; + } + + public void setEspecie(String especie) { + this.especie = especie; + } + + public Integer getFormCont() { + return formCont; + } + + public void setFormCont(Integer formCont) { + this.formCont = formCont; + } + + public int getQuantidade() { + return quantidade; + } + + public void setQuantidade(int quantidade) { + this.quantidade = quantidade; + } + + public Integer getLoteform() { + return loteform; + } + + public void setLoteform(Integer loteform) { + this.loteform = loteform; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaEstoqueId != null ? ptovtaEstoqueId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaEstoque)) { + return false; + } + PtovtaEstoque other = (PtovtaEstoque) object; + if ((this.ptovtaEstoqueId == null && other.ptovtaEstoqueId != null) || (this.ptovtaEstoqueId != null && !this.ptovtaEstoqueId.equals(other.ptovtaEstoqueId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaEstoque[ ptovtaEstoqueId=" + ptovtaEstoqueId + " ]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java new file mode 100644 index 000000000..0fa630a17 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java @@ -0,0 +1,233 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@SequenceGenerator(name = "PTOVTA_HORARIO_SEQ", sequenceName = "PTOVTA_HORARIO_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_HORARIO") + +public class PtovtaHorario implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_HORARIO_SEQ") + @Column(name = "PTOVTAHORARIO_ID") + private Integer ptovtaHorarioId; + + @Column(name = "INICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date inicio; + + @Column(name = "FIM") + @Temporal(TemporalType.TIMESTAMP) + private Date fim; + + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoventaId; + + @Column(name = "INDLUNES") + private Boolean indlunes; + @Column(name = "INDMARTES") + private Boolean indmartes; + @Column(name = "INDMIERCOLES") + private Boolean indmiercoles; + @Column(name = "INDJUEVES") + private Boolean indjueves; + @Column(name = "INDVIERNES") + private Boolean indviernes; + @Column(name = "INDSABADO") + private Boolean indsabado; + @Column(name = "INDDOMINGO") + private Boolean inddomingo; + + public PtovtaHorario() { + } + + public PtovtaHorario(Integer ptovtaHorarioId) { + this.ptovtaHorarioId = ptovtaHorarioId; + } + + public PtovtaHorario(Integer ptovtaHorarioId, Date inicio, Date fim, Boolean activo, Date fecmodif, int usuarioId) { + this.ptovtaHorarioId = ptovtaHorarioId; + this.inicio = inicio; + this.fim = fim; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + + public Integer getPtovtaHorarioId() { + return ptovtaHorarioId; + } + + public void setPtovtaHorarioId(Integer ptovtaHorarioId) { + this.ptovtaHorarioId = ptovtaHorarioId; + } + + public Date getInicio() { + return inicio; + } + + public void setInicio(Date inicio) { + this.inicio = inicio; + } + + public Date getFim() { + return fim; + } + + public void setFim(Date fim) { + this.fim = fim; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(PuntoVenta puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Boolean getIndlunes() { + return indlunes; + } + + public void setIndlunes(Boolean indlunes) { + this.indlunes = indlunes; + } + + public Boolean getIndmartes() { + return indmartes; + } + + public void setIndmartes(Boolean indmartes) { + this.indmartes = indmartes; + } + + public Boolean getIndmiercoles() { + return indmiercoles; + } + + public void setIndmiercoles(Boolean indmiercoles) { + this.indmiercoles = indmiercoles; + } + + public Boolean getIndjueves() { + return indjueves; + } + + public void setIndjueves(Boolean indjueves) { + this.indjueves = indjueves; + } + + public Boolean getIndviernes() { + return indviernes; + } + + public void setIndviernes(Boolean indviernes) { + this.indviernes = indviernes; + } + + public Boolean getIndsabado() { + return indsabado; + } + + public void setIndsabado(Boolean indsabado) { + this.indsabado = indsabado; + } + + public Boolean getInddomingo() { + return inddomingo; + } + + public void setInddomingo(Boolean inddomingo) { + this.inddomingo = inddomingo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaHorarioId != null ? ptovtaHorarioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaHorario)) { + return false; + } + PtovtaHorario other = (PtovtaHorario) object; + if ((this.ptovtaHorarioId == null && other.ptovtaHorarioId != null) || (this.ptovtaHorarioId != null && !this.ptovtaHorarioId.equals(other.ptovtaHorarioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaHorario[ ptovtaHorarioId=" + ptovtaHorarioId + " ]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaTipoEstoque.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaTipoEstoque.java new file mode 100644 index 000000000..57af533bc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaTipoEstoque.java @@ -0,0 +1,121 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * PtovtaTipoEstoque generated by hbm2java + */ +@Entity +@Table(name = "PTOVTA_TIPO_ESTOQUE") +public class PtovtaTipoEstoque implements Serializable { + + private static final long serialVersionUID = 1L; + + public static final int TIPO_CONTABILIDAD = 1; + public static final int TIPO_SUMINISTRO = 2; + public static final int TIPO_NORMAL = 3; + + private Integer ptovtatipoestId; + private String desctipoest; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public PtovtaTipoEstoque() { + } + + public PtovtaTipoEstoque(Integer ptovtatipoestId) { + this.ptovtatipoestId = ptovtatipoestId; + } + + public PtovtaTipoEstoque(Integer ptovtatipoestId, String desctipoest, Boolean activo, Date fecmodif, Integer usuarioId) { + this.ptovtatipoestId = ptovtatipoestId; + this.desctipoest = desctipoest; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return desctipoest; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtatipoestId != null ? ptovtatipoestId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaTipoEstoque)) + return false; + + PtovtaTipoEstoque other = (PtovtaTipoEstoque) object; + if ((this.ptovtatipoestId == null && other.ptovtatipoestId != null) || (this.ptovtatipoestId != null && !this.ptovtatipoestId.equals(other.ptovtatipoestId))) { + return false; + } + return true; + } + + @Id + @Column(name = "PTOVTATIPOEST_ID", unique = true, nullable = false, precision = 4, scale = 0) + public Integer getPtovtatipoestId() { + return this.ptovtatipoestId; + } + + public void setPtovtatipoestId(Integer ptovtatipoestId) { + this.ptovtatipoestId = ptovtatipoestId; + } + + @Column(name = "DESCTIPOEST", length = 20) + public String getDesctipoest() { + return this.desctipoest; + } + + public void setDesctipoest(String desctipoest) { + this.desctipoest = desctipoest; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java new file mode 100644 index 000000000..18f06f68c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java @@ -0,0 +1,198 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.Lob; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafael + */ +@Entity +@Table(name = "PTOVTA_TITULAR") +@SequenceGenerator(name = "PTOVTA_TITULAR_SEQ ", sequenceName = "PTOVTA_TITULAR_SEQ ", allocationSize = 1) +public class PtovtaTitular implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_TITULAR_SEQ ") + @Column(name = "PTOVTATITULAR_ID") + private Integer ptovtaTitularId; + + @Column(name = "NOME") + private String nome; + + @Column(name = "CPF") + private String cpf; + + @Column(name = "RG") + private String rg; + + @Column(name = "ORGAOEMISSOR") + private String orgaoemissor; + @Lob + @Column(name = "IMAGEM") + private byte[] imagem; + + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "titularId") + private List puntoVentaList; + + public PtovtaTitular() { + } + + public PtovtaTitular(Integer ptovtaTitularId) { + this.ptovtaTitularId = ptovtaTitularId; + } + + public PtovtaTitular(Integer ptovtaTitularId, String nome, String cpf, String rg, String orgaoemissor, Boolean activo, Date fecmodif, int usuarioId) { + this.ptovtaTitularId = ptovtaTitularId; + this.nome = nome; + this.cpf = cpf; + this.rg = rg; + this.orgaoemissor = orgaoemissor; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + + + public Integer getPtovtaTitularId() { + return ptovtaTitularId; + } + + public void setPtovtaTitularId(Integer ptovtaTitularId) { + this.ptovtaTitularId = ptovtaTitularId; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public String getCpf() { + return cpf; + } + + public void setCpf(String cpf) { + this.cpf = cpf; + } + + public String getRg() { + return rg; + } + + public void setRg(String rg) { + this.rg = rg; + } + + public String getOrgaoemissor() { + return orgaoemissor; + } + + public void setOrgaoemissor(String orgaoemissor) { + this.orgaoemissor = orgaoemissor; + } + + public byte[] getImagem() { + return imagem; + } + + public void setImagem(byte[] imagem) { + this.imagem = imagem; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + + public List getPuntoVentaList() { + return puntoVentaList; + } + + public void setPuntoVentaList(List puntoVentaList) { + this.puntoVentaList = puntoVentaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtaTitularId != null ? ptovtaTitularId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaTitular)) { + return false; + } + PtovtaTitular other = (PtovtaTitular) object; + if ((this.ptovtaTitularId == null && other.ptovtaTitularId != null) || (this.ptovtaTitularId != null && !this.ptovtaTitularId.equals(other.ptovtaTitularId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.PtovtaTitular[ ptovtaTitularId=" + ptovtaTitularId + " ]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java new file mode 100644 index 000000000..09dab4d7e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java @@ -0,0 +1,1203 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang.BooleanUtils; +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; +import org.hibernate.annotations.Where; + +import com.rjconsultores.ventaboletos.enums.TipoSocio; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "PUNTO_VENTA_SEQ", sequenceName = "PUNTO_VENTA_SEQ", allocationSize = 1) +@Table(name = "PUNTO_VENTA") +public class PuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PUNTO_VENTA_SEQ") + @Column(name = "PUNTOVENTA_ID") + private Integer puntoventaId; + @Column(name = "NOMBPUNTOVENTA") + private String nombpuntoventa; + @Column(name = "DIRECCIONCALLE") + private String direccioncalle; + @Column(name = "DIRECCIONNUMERO") + private String direccionnumero; + @Column(name = "STATUSAPROBACION") + private String statusaprobacion; + @Column(name = "COMENTARIOS") + private String comentarios; + @Column(name = "NUMTELEFONOUNO") + private String numtelefonouno; + @Column(name = "NUMTELEFONODOS") + private String numtelefonodos; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "DESCCORREO") + private String descCorreo; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @OneToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "COLONIA_ID") + private Colonia colonia; + @OneToOne + @JoinColumn(name = "MONEDA_ID") + private Moneda moneda; + @OneToOne + @JoinColumn(name = "PARADA_ID") + private Parada parada; + @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") + @ManyToOne + private TipoPuntoVenta tipoPuntoVenta; + @OneToMany(mappedBy = "puntoVenta") + private List reservacionPuntoventaList; + @OneToOne + @JoinColumn(name = "NODO_ID") + private Nodo nodo; + @Column(name = "INDCONEXIONBANCARIA") + private String conexionBancaria; + @Column(name = "DSCUSUARIOINTERNET") + private String dscUsuarioInternet; + @Column(name = "DSCCONTRASENAINTERNET") + private String dscContrasenaInternet; + @OneToOne + @JoinColumn(name = "USUARIOBANCARIO_ID") + private UsuarioBancario usuarioBancario; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private List lsFormaPagoDet; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private List lsParamRecoleccion; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private List lsPtovtaEmpresa; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private List lsPtovtaUsuarioBancario; + @Column(name = "NUMFAX") + private String numfax; + @Column(name = "COMPLE") + private String compl; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") + private List ptovtaEstoqueList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") + private List ptovtaHorarioList; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") + private List ptovtaAntecipacomissaoList; + @JoinColumn(name = "PTOVTACOMISSAO_ID") + @OneToOne(cascade = CascadeType.ALL) + private PtovtaComissao comissaoId; + @JoinColumn(name = "PTOVTADIVERSOS_ID") + @OneToOne(cascade = CascadeType.ALL) + private PtovtaDiversos diversosId; + @JoinColumn(name = "PTOVTAAGENCIA_ID") + @OneToOne(cascade = CascadeType.ALL) + private PtovtaAgencia agenciaId; + @JoinColumn(name = "PTOVTATITULAR_ID") + @OneToOne(cascade = CascadeType.ALL) + private PtovtaTitular titularId; + @Column(name = "NUMPUNTOVENTA") + private String numPuntoVenta; + @Column(name = "INDPERMISOTASAEMBARQUE") + private Boolean indPermisoTasaEmbarque; + @Column(name = "TIEMPOCANCELACION") + private Integer tiempoCancelacion; + @OneToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "PUNTOVENTAPADRE_ID") + private PuntoVenta puntoVentaPadre; + @Column(name = "INDESTOQUEMOTORISTA") + private Boolean indEstoqueMotorista; + + @JoinColumn(name = "PTOVTATIPOEST_ID") + @ManyToOne + private PtovtaTipoEstoque ptovtaTipoEstoque; + + @Column(name = "INDCTRLESTCENTRAL") + private Boolean usaCrtlEstCentral; + + @Column(name = "NUMDOCPUNTOVENTA") + private String numDoCPuntoVenta; + + @Column(name = "RAZONSOCIAL") + private String razonSocial; + + @Column(name = "INCPROGCONCESSAOCREDITO") + private Boolean incProgConcessaoCredito; + + @Column(name = "NUMIEPUNTOVENTA") + private String numIEPuntoVenta; + + @Column(name = "INDINTEGRACION") + private Integer indIntegracion; + + @Column(name = "INDINTEGRADOAG") + private Boolean indIntegradoAG; + + @Column(name = "MOTIVONAOINTEGRADOAG") + private String motivoNaoIntegradoAG; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") + @LazyCollection(LazyCollectionOption.FALSE) + private List ptovtaEmpresaBloqueadaList; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") + @LazyCollection(LazyCollectionOption.FALSE) + private List ptovtaCheckinList; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") + @LazyCollection(LazyCollectionOption.FALSE) + private List ptovtaSeguroList; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoVenta") + @LazyCollection(LazyCollectionOption.FALSE) + private List ptovtaCatIndList; + + @Column(name = "CODPOSTAL") + private String codpostal; + + @Column(name = "INDBLOQCANCIMPPOSTERIOR ") + private Boolean indBloqueiaCancelamentoImpressaoPosterior; + @Column(name = "TEMPOMINIMOIMPRESSAO") + @Temporal(TemporalType.TIMESTAMP) + private Date tempoMinimoParaImpressao; + @Column(name = "VALIDATEMPOPARAIMPRESSAO") + private Boolean validaTempoParaImpressao; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + + @Column(name = "FECFECHAMENTO") + @Temporal(TemporalType.TIMESTAMP) + private Date dateFechamento; + + @Column(name = "FECABERTURA") + @Temporal(TemporalType.TIMESTAMP) + private Date dateAbertura; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoVenta") + @LazyCollection(LazyCollectionOption.FALSE) + private List historicoPuntoVentaList; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventa") + @LazyCollection(LazyCollectionOption.FALSE) + private List categoriaBloqImpPosteriorList; + + @Column(name = "TAXACONVENIENCIAPORC") + private BigDecimal taxaConvenienciaPorc; + + @Column(name = "MAXIMOTAXACONVENIENCIA") + private Double maximoTaxaConveniencia; + + @Column(name = "INDBLOQUEACANCTROCAPASSNORMAL") + private Boolean indBloqueaCancTrocaPassNormal; + + @Column(name = "INDBLOQUEACANCTROCAPTA") + private Boolean indBloqueaCancTrocaPTA; + + @Column(name = "INDREPASSAUTR") + private Boolean indRepassaUTR; + + @OneToMany(mappedBy = "puntoventa", cascade = CascadeType.ALL) + @LazyCollection(LazyCollectionOption.FALSE) + @Where(clause = "activo = 1") + private List ptovtaAntifraudes; + + @Column(name = "INDBLOQUEIATIPOPASSAGEM") + private Boolean indBloqueiaTipoPassagem; + + @OneToMany(mappedBy = "puntoVenta", cascade = CascadeType.ALL) + @LazyCollection(LazyCollectionOption.FALSE) + @Where(clause = "activo = 1") + private List cobrancaAdicionalList; + + @Column(name = "TIEMPOMAXBOLETOENVENTA") + private Integer tiempoMaxBoletoEnVenta; + + @Column(name = "INDQRCODECATRACARODEAN13") + private Boolean indQrcodeCatracaRodEAN13; + + @Column(name = "INDBLOQDEVOLVEREATIVAOUTROPTO") + private Boolean indBloqDevolveReativaOutroPto; + + @Column(name = "INDRESERVAFLEXBUS") + private Boolean indReservaFlexBus; + + @Column(name = "TIPO_SOCIO") + @Enumerated(EnumType.STRING) + private TipoSocio tipoSocio; + + @Column(name = "INDQRCODETAXAEMBARQUERODTTL") + private Boolean indQrcodeTaxaEmbarqueRodTTL; + + public List getCobrancaAdicionalList() { + return cobrancaAdicionalList; + } + + public CobrancaAdcPuntoVenta addCobrancaAddPuntoVenta(CobrancaAdcPuntoVenta cobranca) { + cobranca.setActivo(Boolean.TRUE); + cobranca.setFecmodif(Calendar.getInstance().getTime()); + cobranca.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + this.cobrancaAdicionalList.add(cobranca); + return cobranca; + } + + public void removeCobrancaAddPuntoVenta(CobrancaAdcPuntoVenta cobranca) { + if(this.cobrancaAdicionalList != null) { + this.cobrancaAdicionalList.remove(cobranca); + } + } + + + public void setCobrancaAdicionalList(List cobrancaAdicionalList) { + this.cobrancaAdicionalList = cobrancaAdicionalList; + } + + public PtovtaEmpresaBloqueada addEmpresaBloqueada(Empresa e) { + PtovtaEmpresaBloqueada eb = new PtovtaEmpresaBloqueada(); + eb.setEmpresa(e); + eb.setPuntoventaId(this); + eb.setActivo(Boolean.TRUE); + eb.setFecmodif(Calendar.getInstance().getTime()); + eb.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + this.ptovtaEmpresaBloqueadaList.add(eb); + return eb; + } + + public void removeEmpresaBloqueada(PtovtaEmpresaBloqueada e) { + this.ptovtaEmpresaBloqueadaList.remove(e); + } + + public void removeEmpresaBloqueada(Empresa e) { + for (PtovtaEmpresaBloqueada eb : ptovtaEmpresaBloqueadaList) { + if (eb.getEmpresa().equals(e)) { + this.ptovtaEmpresaBloqueadaList.remove(e); + break; + } + } + } + + public PtovtaTipoEstoque getPtovtaTipoEstoque() { + return ptovtaTipoEstoque; + } + + public void setPtovtaTipoEstoque(PtovtaTipoEstoque ptovtaTipoEstoque) { + this.ptovtaTipoEstoque = ptovtaTipoEstoque; + } + + public PtovtaComissao getComissaoId() { + return comissaoId; + } + + public void setComissaoId(PtovtaComissao comissaoId) { + this.comissaoId = comissaoId; + } + + public PtovtaDiversos getDiversosId() { + return diversosId; + } + + public void setDiversosId(PtovtaDiversos diversosId) { + this.diversosId = diversosId; + } + + public PtovtaTitular getTitularId() { + return titularId; + } + + public void setTitularId(PtovtaTitular titularId) { + this.titularId = titularId; + } + + public PtovtaAgencia getAgenciaId() { + return agenciaId; + } + + public void setAgenciaId(PtovtaAgencia agenciaId) { + this.agenciaId = agenciaId; + } + + public PuntoVenta() { + this.colonia = new Colonia(); + this.agenciaId = new PtovtaAgencia(); + this.titularId = new PtovtaTitular(); + this.comissaoId = new PtovtaComissao(); + this.diversosId = new PtovtaDiversos(); + this.ptovtaCheckinList = new ArrayList(); + this.ptovtaSeguroList = new ArrayList(); + this.ptovtaCatIndList = new ArrayList(); + this.ptovtaEmpresaBloqueadaList = new ArrayList(); + this.historicoPuntoVentaList = new ArrayList(); + } + + public PuntoVenta(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + public PuntoVenta(Integer puntoventaId, String nombpuntoventa ) { + this.puntoventaId = puntoventaId; + this.nombpuntoventa = nombpuntoventa; + } + + public PuntoVenta(Integer puntoventaId, String nombpuntoventa, String numPuntoVenta ) { + this.puntoventaId = puntoventaId; + this.nombpuntoventa = nombpuntoventa; + this.numPuntoVenta = numPuntoVenta; + } + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Nodo getNodo() { + return nodo; + } + + public void setNodo(Nodo nodo) { + this.nodo = nodo; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getDireccioncalle() { + return direccioncalle; + } + + public void setDireccioncalle(String direccioncalle) { + this.direccioncalle = direccioncalle; + } + + public String getDireccionnumero() { + return direccionnumero; + } + + public void setDireccionnumero(String direccionnumero) { + this.direccionnumero = direccionnumero; + } + + public String getStatusaprobacion() { + return statusaprobacion; + } + + public void setStatusaprobacion(String statusaprobacion) { + this.statusaprobacion = statusaprobacion; + } + + public String getComentarios() { + return comentarios; + } + + public void setComentarios(String comentarios) { + this.comentarios = comentarios; + } + + public String getNumtelefonouno() { + return numtelefonouno; + } + + public void setNumtelefonouno(String numtelefonouno) { + this.numtelefonouno = numtelefonouno; + } + + public String getNumtelefonodos() { + return numtelefonodos; + } + + public void setNumtelefonodos(String numtelefonodos) { + this.numtelefonodos = numtelefonodos; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public TipoPuntoVenta getTipoPuntoVenta() { + return tipoPuntoVenta; + } + + public void setTipoPuntoVenta(TipoPuntoVenta tipoPuntoVenta) { + this.tipoPuntoVenta = tipoPuntoVenta; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public List getReservacionPuntoventaList() { + return reservacionPuntoventaList; + } + + public void setReservacionPuntoventaList(List reservacionPuntoventaList) { + this.reservacionPuntoventaList = reservacionPuntoventaList; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public List getLsFormaPagoDet() { + List tmp = new ArrayList(); + if (lsFormaPagoDet != null) { + for (FormaPagoDet ddab : this.lsFormaPagoDet) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + this.lsFormaPagoDet = tmp; + return tmp; + } + + public List getLsParamRecoleccion() { + List tmp = new ArrayList(); + if (this.lsParamRecoleccion != null) { + for (ParamRecoleccion ddab : this.lsParamRecoleccion) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + this.lsParamRecoleccion = tmp; + return tmp; + } + + public List getLsPtovtaEmpresa() { + List tmp = new ArrayList(); + + if (this.lsPtovtaEmpresa != null) { + for (PtovtaEmpresa ddab : this.lsPtovtaEmpresa) { + if (ddab.getActivo()) { + ddab.getContasBancaria().clear(); + + for (PtovtaEmpresaContaBancaria cb : ddab.getLsPtovtaEmpresaContaBancaria()) { + ddab.getContasBancaria().add(cb.getEmpresaContaBancaria()); + } + + tmp.add(ddab); + } + } + } + + this.lsPtovtaEmpresa = tmp; + + return tmp; + } + + public void setLsPtovtaEmpresa(List lsPtovtaEmpresa) { + this.lsPtovtaEmpresa = lsPtovtaEmpresa; + } + + public List getLsPtovtaUsuarioBancario() { + List tmp = new ArrayList(); + if (this.lsPtovtaUsuarioBancario != null) { + for (PtoVtaUsuarioBancario ddab : this.lsPtovtaUsuarioBancario) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + this.lsPtovtaUsuarioBancario = tmp; + return tmp; + } + + public String getNumfax() { + return numfax; + } + + public void setNumfax(String numfax) { + this.numfax = numfax; + } + + public String getCompl() { + return compl; + } + + public void setCompl(String compl) { + this.compl = compl; + } + + public List getPtovtaEstoqueList() { + return ptovtaEstoqueList; + } + + public void setPtovtaEstoqueList(List ptovtaEstoqueList) { + this.ptovtaEstoqueList = ptovtaEstoqueList; + } + + public List getPtovtaHorarioList() { + + List tmp = new ArrayList(); + if (this.ptovtaHorarioList != null) { + for (PtovtaHorario ddab : this.ptovtaHorarioList) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + + this.ptovtaHorarioList = tmp; + return tmp; + } + + public void setPtovtaHorarioList(List ptovtaHorarioList) { + this.ptovtaHorarioList = ptovtaHorarioList; + } + + public List getPtovtaAntecipacomissaoList() { + + List tmp = new ArrayList(); + if (this.ptovtaAntecipacomissaoList != null) { + for (PtovtaAntecipacomissao ddab : this.ptovtaAntecipacomissaoList) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + this.ptovtaAntecipacomissaoList = tmp; + return tmp; + + } + + public void setPtovtaAntecipacomissaoList(List ptovtaAntecipacomissaoList) { + this.ptovtaAntecipacomissaoList = ptovtaAntecipacomissaoList; + } + + public void setLsPtovtaUsuarioBancario(List lsPtovtaUsuarioBancario) { + this.lsPtovtaUsuarioBancario = lsPtovtaUsuarioBancario; + } + + public void setLsParamRecoleccion(List lsParamRecoleccion) { + this.lsParamRecoleccion = lsParamRecoleccion; + } + + public String getConexionBancaria() { + return conexionBancaria; + } + + public void setConexionBancaria(String conexionBancaria) { + this.conexionBancaria = conexionBancaria; + } + + public UsuarioBancario getUsuarioBancario() { + return usuarioBancario; + } + + public void setUsuarioBancario(UsuarioBancario usuarioBancario) { + this.usuarioBancario = usuarioBancario; + } + + public void setLsFormaPagoDet(List lsFormaPagoDet) { + this.lsFormaPagoDet = lsFormaPagoDet; + } + + // public List getRequisicionBoletoList() { + // return requisicionBoletoList; + // } + // + // public void setRequisicionBoletoList(List requisicionBoletoList) { + // this.requisicionBoletoList = requisicionBoletoList; + // } + + @Override + public int hashCode() { + int hash = 0; + hash += (puntoventaId != null ? puntoventaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof PuntoVenta)) { + return false; + } + PuntoVenta other = (PuntoVenta) object; + if ((this.puntoventaId == null && other.puntoventaId != null) || (this.puntoventaId != null && !this.puntoventaId.equals(other.puntoventaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getNombpuntoventa(); + } + + /** + * @return the colonia + */ + public Colonia getColonia() { + return colonia; + } + + /** + * @param colonia + * the colonia to set + */ + public void setColonia(Colonia colonia) { + this.colonia = colonia; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public String getDescCorreo() { + return descCorreo; + } + + public void setDescCorreo(String descCorreo) { + this.descCorreo = descCorreo; + } + + public String getDscContrasenaInternet() { + return dscContrasenaInternet; + } + + public void setDscContrasenaInternet(String dscContrasenaInternet) { + this.dscContrasenaInternet = dscContrasenaInternet; + } + + public String getDscUsuarioInternet() { + return dscUsuarioInternet; + } + + public void setDscUsuarioInternet(String dscUsuarioInternet) { + this.dscUsuarioInternet = dscUsuarioInternet; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + + public Boolean getIndPermisoTasaEmbarque() { + return indPermisoTasaEmbarque; + } + + public void setIndPermisoTasaEmbarque(Boolean indPermisoTasaEmbarque) { + this.indPermisoTasaEmbarque = indPermisoTasaEmbarque; + } + + public Integer getTiempoCancelacion() { + return tiempoCancelacion; + } + + public void setTiempoCancelacion(Integer tiempoCancelacion) { + this.tiempoCancelacion = tiempoCancelacion; + } + + public PuntoVenta getPuntoVentaPadre() { + return puntoVentaPadre; + } + + public void setPuntoVentaPadre(PuntoVenta puntoVentaPadre) { + this.puntoVentaPadre = puntoVentaPadre; + } + + public Boolean isUsaCrtlEstCentral() { + return usaCrtlEstCentral; + } + + public void setUsaCrtlEstCentral(Boolean usaCrtlEstCentral) { + this.usaCrtlEstCentral = usaCrtlEstCentral; + } + + public String getNumDoCPuntoVenta() { + return numDoCPuntoVenta; + } + + public void setNumDoCPuntoVenta(String numDoCPuntoVenta) { + this.numDoCPuntoVenta = numDoCPuntoVenta; + } + + public String getRazonSocial() { + return razonSocial; + } + + public void setRazonSocial(String razonSocial) { + this.razonSocial = razonSocial; + } + + public List getPtovtaEmpresaBloqueadaList() { + List lista = new ArrayList(); + for (PtovtaEmpresaBloqueada eb : ptovtaEmpresaBloqueadaList) { + if (eb.getActivo()) { + lista.add(eb); + } + } + return lista; + } + + public void setPtovtaEmpresaBloqueadaList(List ptovtaEmpresaBloqueadaList) { + this.ptovtaEmpresaBloqueadaList = ptovtaEmpresaBloqueadaList; + } + + public List getPtovtaCheckinList() { + List lista = new ArrayList(); + for (PtoVtaCheckin ck : ptovtaCheckinList) { + if (ck.getActivo()) { + lista.add(ck); + } + } + return lista; + } + + public void setPtovtaCheckinList(List ptovtaCheckinList) { + this.ptovtaCheckinList = ptovtaCheckinList; + } + + public PtoVtaCheckin addPtovtaCheckin(PtoVtaCheckin pto) { + PtoVtaCheckin pt = new PtoVtaCheckin(); + pt.setPuntoventaId(pto.getPuntoventaId()); + pt.setParadaId(pto.getParadaId()); + pt.setActivo(Boolean.TRUE); + pt.setFecmodif(Calendar.getInstance().getTime()); + pt.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + this.ptovtaCheckinList.add(pt); + return pt; + } + + public void removePtovtaCheckin(PtoVtaCheckin pto) { + this.ptovtaCheckinList.remove(pto); + } + + public List getPtovtaSeguroList() { + List lista = new ArrayList(); + for (PtoVtaSeguro ck : ptovtaSeguroList) { + if (ck.getActivo()) { + lista.add(ck); + } + } + return lista; + } + + public void setPtovtaSeguroList(List ptovtaSeguroList) { + this.ptovtaSeguroList = ptovtaSeguroList; + } + + public PtoVtaSeguro addPtovtaSeguro(PtoVtaSeguro pto) { + pto.setActivo(Boolean.TRUE); + pto.setFecmodif(Calendar.getInstance().getTime()); + pto.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + this.ptovtaSeguroList.add(pto); + return pto; + } + + public void removePtovtaSeguro(PtoVtaSeguro pto) { + this.ptovtaSeguroList.remove(pto); + } + + public List getPtovtaCatIndList() { + List lista = new ArrayList(); + for (PtovtaCatInd ck : ptovtaCatIndList) { + if (ck.getActivo()) { + lista.add(ck); + } + } + return lista; + } + + public void setPtovtaCatIndList(List ptovtaCatIndList) { + this.ptovtaCatIndList = ptovtaCatIndList; + } + + public PtovtaCatInd addPtovtaCatInd(PtovtaCatInd pto) { + pto.setActivo(Boolean.TRUE); + pto.setFecmodif(Calendar.getInstance().getTime()); + pto.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + this.ptovtaCatIndList.add(pto); + return pto; + } + + public void removePtovtaCatInd(PtovtaCatInd pto) { + this.ptovtaCatIndList.remove(pto); + } + + public String getNumIEPuntoVenta() { + return numIEPuntoVenta; + } + + public void setNumIEPuntoVenta(String numIEPuntoVenta) { + this.numIEPuntoVenta = numIEPuntoVenta; + } + + public Boolean getIncProgConcessaoCredito() { + return incProgConcessaoCredito; + } + + public void setIncProgConcessaoCredito(Boolean incProgConcessaoCredito) { + this.incProgConcessaoCredito = incProgConcessaoCredito; + } + + public Integer getIndIntegracion() { + return indIntegracion; + } + + public void setIndIntegracion(Integer indIntegracion) { + this.indIntegracion = indIntegracion; + } + + public String getCodpostal() { + return codpostal; + } + + public void setCodpostal(String codpostal) { + this.codpostal = codpostal; + } + + public Boolean getIndEstoqueMotorista() { + return indEstoqueMotorista; + } + + public void setIndEstoqueMotorista(Boolean indEstoqueMotorista) { + this.indEstoqueMotorista = indEstoqueMotorista; + } + + public Boolean getIndBloqueiaCancelamentoImpressaoPosterior() { + return indBloqueiaCancelamentoImpressaoPosterior; + } + + public void setIndBloqueiaCancelamentoImpressaoPosterior(Boolean indBloqueiaCancelamentoImpressaoPosterior) { + this.indBloqueiaCancelamentoImpressaoPosterior = indBloqueiaCancelamentoImpressaoPosterior; + } + + public Date getTempoMinimoParaImpressao() { + return tempoMinimoParaImpressao; + } + + public void setTempoMinimoParaImpressao(Date tempoMinimoParaImpressao) { + this.tempoMinimoParaImpressao = tempoMinimoParaImpressao; + } + + public Boolean getValidaTempoParaImpressao() { + return validaTempoParaImpressao; + } + + public void setValidaTempoParaImpressao(Boolean validaTempoParaImpressao) { + this.validaTempoParaImpressao = validaTempoParaImpressao; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getIndIntegradoAG() { + return BooleanUtils.isTrue(indIntegradoAG); + } + + public void setIndIntegradoAG(Boolean indIntegradoAG) { + this.indIntegradoAG = indIntegradoAG; + } + + public String getMotivoNaoIntegradoAG() { + return motivoNaoIntegradoAG; + } + + public void setMotivoNaoIntegradoAG(String motivoNaoIntegradoAG) { + this.motivoNaoIntegradoAG = motivoNaoIntegradoAG; + } + + public Date getDateFechamento() { + return dateFechamento; + } + + public void setDateFechamento(Date dateFechamento) { + this.dateFechamento = dateFechamento; + } + + public Date getDateAbertura() { + return dateAbertura; + } + + public void setDateAbertura(Date dateAbertura) { + this.dateAbertura = dateAbertura; + } + + public String getCep(){ + return codpostal != null ? codpostal.toString() : ""; + } + + public String getLogradouro(){ + return direccioncalle; + } + + public String getBairro(){ + return colonia != null ? colonia.getBairro() : ""; + } + + public String getNumero(){ + return direccionnumero; + } + + public String getComplemento(){ + return compl; + } + + public String getUF(){ + return colonia != null ? colonia.getUF() : ""; + } + + public String getCidade(){ + return colonia != null ? colonia.getCidade() : ""; + } + + public List getHistoricoPuntoVentaList() { + return historicoPuntoVentaList; + } + + public void setHistoricoPuntoVentaList(List historicoPuntoVentaList) { + this.historicoPuntoVentaList = historicoPuntoVentaList; + } + + public List getCategoriaBloqImpPosteriorList() { + return categoriaBloqImpPosteriorList; + } + + public void setCategoriaBloqImpPosteriorList(List categoriaBloqImpPosteriorList) { + this.categoriaBloqImpPosteriorList = categoriaBloqImpPosteriorList; + } + + public void addCategoriaBloqImpPosterior(CategoriaBloqueioImpPosterior cat){ + if(this.categoriaBloqImpPosteriorList == null) { + this.categoriaBloqImpPosteriorList = new ArrayList(); + } + this.categoriaBloqImpPosteriorList.add(cat); + } + + public void removeCategoriaBloqImpPosterior(CategoriaBloqueioImpPosterior cat){ + if(this.categoriaBloqImpPosteriorList != null) { + this.categoriaBloqImpPosteriorList.remove(cat); + } + } + + + /** + * @return the maximoTaxaConveniencia + */ + public Double getMaximoTaxaConveniencia() { + return maximoTaxaConveniencia; + } + + /** + * @param maximoTaxaConveniencia the maximoTaxaConveniencia to set + */ + public void setMaximoTaxaConveniencia(Double maximoTaxaConveniencia) { + this.maximoTaxaConveniencia = maximoTaxaConveniencia; + } + + /** + * @return the taxaConvenienciaPorc + */ + public BigDecimal getTaxaConvenienciaPorc() { + return taxaConvenienciaPorc; + } + + /** + * @param taxaConvenienciaPorc the taxaConvenienciaPorc to set + */ + public void setTaxaConvenienciaPorc(BigDecimal taxaConvenienciaPorc) { + this.taxaConvenienciaPorc = taxaConvenienciaPorc; + } + + /** + * @return the indBloqueaCancTrocaPassNormal + */ + public Boolean getIndBloqueaCancTrocaPassNormal() { + return indBloqueaCancTrocaPassNormal; + } + /** + * @param indBloqueaCancTrocaPTA the indBloqueaCancTrocaPTA to set + */ + public void setIndBloqueaCancTrocaPassNormal(Boolean indBloqueaCancTrocaPassNormal) { + this.indBloqueaCancTrocaPassNormal = indBloqueaCancTrocaPassNormal; + } + + /** + * @return the indBloqueaCancTrocaPTA + */ + public Boolean getIndBloqueaCancTrocaPTA() { + return indBloqueaCancTrocaPTA; + } + + /** + * @param indBloqueaCancTrocaPTA the indBloqueaCancTrocaPTA to set + */ + public void setIndBloqueaCancTrocaPTA(Boolean indBloqueaCancTrocaPTA) { + this.indBloqueaCancTrocaPTA = indBloqueaCancTrocaPTA; + } + + public Boolean getIndRepassaUTR() { + return indRepassaUTR == null ? Boolean.FALSE : indRepassaUTR; + } + + public void setIndRepassaUTR(Boolean indRepassaUTR) { + this.indRepassaUTR = indRepassaUTR; + } + + public List getPtovtaAntifraudes() { + return ptovtaAntifraudes; + } + + public void setPtovtaAntifraudes(List ptovtaAntifraudes) { + this.ptovtaAntifraudes = ptovtaAntifraudes; + } + + public void addChaveAntifurto(PtovtaAntifraude cat){ + if(this.ptovtaAntifraudes == null) { + this.ptovtaAntifraudes = new ArrayList(); + } + this.ptovtaAntifraudes.add(cat); + } + + public void removeChaveAntifurto(PtovtaAntifraude cat){ + if(this.ptovtaAntifraudes != null) { + this.ptovtaAntifraudes.remove(cat); + } + } + + public Boolean getIndBloqueiaTipoPassagem() { + return BooleanUtils.toBoolean(indBloqueiaTipoPassagem); + } + + public void setIndBloqueiaTipoPassagem(Boolean indBloqueiaTipoPassagem) { + this.indBloqueiaTipoPassagem = indBloqueiaTipoPassagem; + } + + public Integer getTiempoMaxBoletoEnVenta() { + return tiempoMaxBoletoEnVenta; + } + + public void setTiempoMaxBoletoEnVenta(Integer tiempoMaxBoletoEnVenta) { + this.tiempoMaxBoletoEnVenta = tiempoMaxBoletoEnVenta; + } + + public Boolean getIndQrcodeCatracaRodEAN13() { + return BooleanUtils.toBoolean(indQrcodeCatracaRodEAN13); + } + + public void setIndQrcodeCatracaRodEAN13(Boolean indQrcodeCatracaRodEAN13) { + this.indQrcodeCatracaRodEAN13 = indQrcodeCatracaRodEAN13; + } + + public Boolean getIndBloqDevolveReativaOutroPto() { + return BooleanUtils.toBoolean(indBloqDevolveReativaOutroPto); + } + + public void setIndBloqDevolveReativaOutroPto(Boolean indBloqDevolveReativaOutroPto) { + this.indBloqDevolveReativaOutroPto = indBloqDevolveReativaOutroPto; + } + + public Boolean getIndReservaFlexBus() { + return indReservaFlexBus == null ? false : indReservaFlexBus; + } + + public void setIndReservaFlexBus(Boolean indReservaFlexBus) { + this.indReservaFlexBus = indReservaFlexBus; + } + + public TipoSocio getTipoSocio() { + return tipoSocio; + } + + public void setTipoSocio(TipoSocio tipoSocio) { + this.tipoSocio = tipoSocio; + } + + public Boolean getIndQrcodeTaxaEmbarqueRodTTL() { + return indQrcodeTaxaEmbarqueRodTTL; + } + + public void setIndQrcodeTaxaEmbarqueRodTTL(Boolean indQrcodeTaxaEmbarqueRodTTL) { + this.indQrcodeTaxaEmbarqueRodTTL = indQrcodeTaxaEmbarqueRodTTL; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/PuntoVentaVO.java b/src/com/rjconsultores/ventaboletos/entidad/PuntoVentaVO.java new file mode 100644 index 000000000..7246f4079 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PuntoVentaVO.java @@ -0,0 +1,29 @@ +package com.rjconsultores.ventaboletos.entidad; + +public class PuntoVentaVO { + + private Integer puntoventaId; + public String nombpuntoventa; + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + + @Override + public String toString(){ + return nombpuntoventa; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Redondeo.java b/src/com/rjconsultores/ventaboletos/entidad/Redondeo.java new file mode 100644 index 000000000..77dbc0a93 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Redondeo.java @@ -0,0 +1,169 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "REDONDEO_SEQ", sequenceName = "REDONDEO_SEQ", allocationSize = 1) +@Table(name = "REDONDEO") +public class Redondeo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "REDONDEO_SEQ") + @Basic(optional = false) + @Column(name = "REDONDEO_ID") + private Integer redondeoId; + @Column(name = "VALORINICIAL") + private BigDecimal valorinicial; + @Column(name = "VALORFINAL") + private BigDecimal valorfinal; + @Column(name = "VALORREDONDEO") + private BigDecimal valorredondeo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "REDONDEOCTRL_ID", referencedColumnName = "REDONDEOCTRL_ID") + @ManyToOne + private RedondeoCtrl redondeoCtrl; + + public Redondeo() { + } + + public Redondeo(Integer redondeoId) { + this.redondeoId = redondeoId; + } + + public Integer getRedondeoId() { + return redondeoId; + } + + public void setRedondeoId(Integer redondeoId) { + this.redondeoId = redondeoId; + } + + public BigDecimal getValorinicial() { + return valorinicial; + } + + public void setValorinicial(BigDecimal valorinicial) { + this.valorinicial = valorinicial; + } + + public BigDecimal getValorfinal() { + return valorfinal; + } + + public void setValorfinal(BigDecimal valorfinal) { + this.valorfinal = valorfinal; + } + + public BigDecimal getValorredondeo() { + return valorredondeo; + } + + public void setValorredondeo(BigDecimal valorredondeo) { + this.valorredondeo = valorredondeo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public RedondeoCtrl getRedondeoCtrl() { + return redondeoCtrl; + } + + public void setRedondeoCtrl(RedondeoCtrl redondeoCtrl) { + this.redondeoCtrl = redondeoCtrl; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final Redondeo other = (Redondeo) obj; + if (this.valorinicial != other.valorinicial && (this.valorinicial == null || !this.valorinicial.equals(other.valorinicial))) { + return false; + } + if (this.valorfinal != other.valorfinal && (this.valorfinal == null || !this.valorfinal.equals(other.valorfinal))) { + return false; + } + if (this.valorredondeo != other.valorredondeo && (this.valorredondeo == null || !this.valorredondeo.equals(other.valorredondeo))) { + return false; + } + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.redondeoCtrl != other.redondeoCtrl && (this.redondeoCtrl == null || !this.redondeoCtrl.equals(other.redondeoCtrl))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 41 * hash + (this.valorinicial != null ? this.valorinicial.hashCode() : 0); + hash = 41 * hash + (this.valorfinal != null ? this.valorfinal.hashCode() : 0); + hash = 41 * hash + (this.valorredondeo != null ? this.valorredondeo.hashCode() : 0); + hash = 41 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 41 * hash + (this.redondeoCtrl != null ? this.redondeoCtrl.hashCode() : 0); + return hash; + } + + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Redondeo[redondeoId=" + redondeoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/RedondeoCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/RedondeoCtrl.java new file mode 100644 index 000000000..61154f3c8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RedondeoCtrl.java @@ -0,0 +1,172 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "REDONDEO_CTRL_SEQ", sequenceName = "REDONDEO_CTRL_SEQ", allocationSize = 1) +@Table(name = "REDONDEO_CTRL") +public class RedondeoCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "REDONDEO_CTRL_SEQ") + @Basic(optional = false) + @Column(name = "REDONDEOCTRL_ID") + private Integer redondeoctrlId; + @Column(name = "INDAPLICADESCUENTO") + private Boolean indaplicadescuento; + @Column(name = "INDAPLICAPRICING") + private Boolean indaplicapricing; + @Column(name = "INDAPLICAARTESP") + private Boolean indaplicaArtesp; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "redondeoCtrl", cascade = CascadeType.ALL) + private List redondeoMarcaList; + @OneToMany(mappedBy = "redondeoCtrl", cascade = CascadeType.ALL) + private List redondeoList; + + public RedondeoCtrl() { + } + + public RedondeoCtrl(Integer redondeoctrlId) { + this.redondeoctrlId = redondeoctrlId; + } + + public Integer getRedondeoctrlId() { + return redondeoctrlId; + } + + public void setRedondeoctrlId(Integer redondeoctrlId) { + this.redondeoctrlId = redondeoctrlId; + } + + public Boolean getIndaplicadescuento() { + return indaplicadescuento; + } + + public void setIndaplicadescuento(Boolean indaplicadescuento) { + this.indaplicadescuento = indaplicadescuento; + } + + public Boolean getIndaplicapricing() { + return indaplicapricing; + } + + public void setIndaplicapricing(Boolean indaplicapricing) { + this.indaplicapricing = indaplicapricing; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getRedondeoMarcaList() { + List rmList = new ArrayList(); + for (RedondeoMarca rm : this.redondeoMarcaList) { + if (rm.getActivo() == Boolean.TRUE) { + rmList.add(rm); + } + } + return rmList; + } + + public void setRedondeoMarcaList(List redondeoMarcaList) { + this.redondeoMarcaList = redondeoMarcaList; + } + + public List getRedondeoList() { + List rmList = new ArrayList(); + for (Redondeo rm : this.redondeoList) { + if (rm.getActivo() == Boolean.TRUE) { + rmList.add(rm); + } + } + return rmList; + } + + public void setRedondeoList(List redondeoList) { + this.redondeoList = redondeoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (redondeoctrlId != null ? redondeoctrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof RedondeoCtrl)) { + return false; + } + RedondeoCtrl other = (RedondeoCtrl) object; + if ((this.redondeoctrlId == null && other.redondeoctrlId != null) || (this.redondeoctrlId != null && !this.redondeoctrlId.equals(other.redondeoctrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.RedondeoCtrl[redondeoctrlId=" + redondeoctrlId + "]"; + } + + public Boolean getIndaplicaArtesp() { + return indaplicaArtesp; + } + + public void setIndaplicaArtesp(Boolean indaplicaArtesp) { + this.indaplicaArtesp = indaplicaArtesp; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/RedondeoMarca.java b/src/com/rjconsultores/ventaboletos/entidad/RedondeoMarca.java new file mode 100644 index 000000000..6058d0508 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RedondeoMarca.java @@ -0,0 +1,144 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "REDONDEO_MARCA_SEQ", sequenceName = "REDONDEO_MARCA_SEQ", allocationSize = 1) +@Table(name = "REDONDEO_MARCA") +public class RedondeoMarca implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "REDONDEO_MARCA_SEQ") + @Basic(optional = false) + @Column(name = "REDONDEO_MARCA") + private Integer redondeoMarca; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "REDONDEOCTRL_ID", referencedColumnName = "REDONDEOCTRL_ID") + @ManyToOne + private RedondeoCtrl redondeoCtrl; + @OneToOne + @JoinColumn(name = "MARCA_ID") + private Marca marca; + + public RedondeoMarca() { + } + + public RedondeoMarca(Integer redondeoMarca) { + this.redondeoMarca = redondeoMarca; + } + + public Integer getRedondeoMarca() { + return redondeoMarca; + } + + public void setRedondeoMarca(Integer redondeoMarca) { + this.redondeoMarca = redondeoMarca; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public RedondeoCtrl getRedondeoCtrl() { + return redondeoCtrl; + } + + public void setRedondeoCtrl(RedondeoCtrl redondeoCtrl) { + this.redondeoCtrl = redondeoCtrl; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final RedondeoMarca other = (RedondeoMarca) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.redondeoCtrl != other.redondeoCtrl && (this.redondeoCtrl == null || !this.redondeoCtrl.equals(other.redondeoCtrl))) { + return false; + } + if (this.marca != other.marca && (this.marca == null || !this.marca.equals(other.marca))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 47 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 47 * hash + (this.redondeoCtrl != null ? this.redondeoCtrl.hashCode() : 0); + hash = 47 * hash + (this.marca != null ? this.marca.hashCode() : 0); + return hash; + } + + + + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.RedondeoMarca[redondeoMarca=" + redondeoMarca + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/RegionMetropolitana.java b/src/com/rjconsultores/ventaboletos/entidad/RegionMetropolitana.java new file mode 100644 index 000000000..8e2ec491e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RegionMetropolitana.java @@ -0,0 +1,120 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "REGION_METROPOLITANA_SEQ", sequenceName = "REGION_METROPOLITANA_SEQ", allocationSize = 1) +@Table(name = "REGION_METROPOLITANA") +public class RegionMetropolitana implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "REGION_METROPOLITANA_SEQ") + @Column(name = "REGIONMETROPOLITANA_ID") + private Long regionMetropolitanaId; + @Column(name = "DESCREGION") + private String descRegion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "regionMetropolitana" , fetch = FetchType.EAGER) + private List paradaList; + + public Long getRegionMetropolitanaId() { + return regionMetropolitanaId; + } + + public void setRegionMetropolitanaId(Long regionMetropolitanaId) { + this.regionMetropolitanaId = regionMetropolitanaId; + } + + public String getDescRegion() { + return descRegion; + } + + public void setDescRegion(String descRegion) { + this.descRegion = descRegion; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getParadaList() { + return paradaList; + } + + public void setParadaList(List paradaList) { + this.paradaList = paradaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (regionMetropolitanaId != null ? regionMetropolitanaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof RegionMetropolitana)) { + return false; + } + RegionMetropolitana other = (RegionMetropolitana) object; + if ((regionMetropolitanaId == null && other.regionMetropolitanaId != null) || (this.regionMetropolitanaId != null && !this.regionMetropolitanaId.equals(other.regionMetropolitanaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + if (getDescRegion() != null || regionMetropolitanaId != null) { + return this.getDescRegion() + " - " + regionMetropolitanaId; + } + return " "; + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/RequisicionBoleto.java b/src/com/rjconsultores/ventaboletos/entidad/RequisicionBoleto.java new file mode 100644 index 000000000..b7f7ad8f4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RequisicionBoleto.java @@ -0,0 +1,175 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "REQUISICION_BOLETO_SEQ", sequenceName = "REQUISICION_BOLETO_SEQ", allocationSize = 1) +@Table(name = "REQUISICION_BOLETO") +public class RequisicionBoleto implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "REQUISICION_BOLETO_SEQ") + @Column(name = "REQUISICIONBOLETO_ID") + private Integer requisicionboletoId; + @Column(name = "CANTFAJILLA") + private Long cantfajilla; + @Column(name = "STATUSENVIO") + private Boolean statusenvio; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + @JoinColumn(name = "ESTACION_ID", referencedColumnName = "ESTACION_ID") + @ManyToOne + private Estacion estacion; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "CLASIFICACION_ID", referencedColumnName = "CLASIFICACION_ID") + @ManyToOne + private Clasificacion clasificacion; + @JoinColumn(name = "ARTICULO_ID", referencedColumnName = "ARTICULO_ID") + @ManyToOne + private Articulo articulo; + + public Integer getRequisicionboletoId() { + return requisicionboletoId; + } + + public void setRequisicionboletoId(Integer requisicionboletoId) { + this.requisicionboletoId = requisicionboletoId; + } + + public Long getCantfajilla() { + return cantfajilla; + } + + public void setCantfajilla(Long cantfajilla) { + this.cantfajilla = cantfajilla; + } + + public Boolean getStatusenvio() { + return statusenvio; + } + + public void setStatusenvio(Boolean statusenvio) { + this.statusenvio = statusenvio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Clasificacion getClasificacion() { + return clasificacion; + } + + public void setClasificacion(Clasificacion clasificacion) { + this.clasificacion = clasificacion; + } + + public Articulo getArticulo() { + return articulo; + } + + public void setArticulo(Articulo articulo) { + this.articulo = articulo; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((requisicionboletoId == null) ? 0 : requisicionboletoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + RequisicionBoleto other = (RequisicionBoleto) obj; + if (requisicionboletoId == null) { + if (other.requisicionboletoId != null) + return false; + } else if (!requisicionboletoId.equals(other.requisicionboletoId)) + return false; + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.RequisicionBoleto [requisicionboletoId=" + requisicionboletoId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ReservaEspecialCliente.java b/src/com/rjconsultores/ventaboletos/entidad/ReservaEspecialCliente.java new file mode 100644 index 000000000..c90601eb7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ReservaEspecialCliente.java @@ -0,0 +1,270 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Calendar; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "RESERVA_ESPECIAL_CLIENTE_SEQ", sequenceName = "RESERVA_ESPECIAL_CLIENTE_SEQ", allocationSize = 1) +@Table(name = "RESERVA_ESPECIAL_CLIENTE") +public class ReservaEspecialCliente { + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVA_ESPECIAL_CLIENTE_SEQ") + @Column(name = "RESERVAESPECIALCLIENTE_ID") + private Long reservaEspecialClienteId; + + //Cliente + @Basic(optional = false) + @Column(name = "CLIENTE_ID") + private Long clienteId; + + //Corrida + @Basic(optional = false) + @Column(name = "CORRIDA_ID") + private Long corridaId; + + //Origem trecho + @Basic(optional = false) + @JoinColumn(name = "ORIGEM_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + + //Destino trecho + @Basic(optional = false) + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + + //Data Final Vigência + @Basic(optional = false) + @Column(name = "FECINICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecinicio; + + //Data Final Vigência + @Basic(optional = false) + @Column(name = "FECFINAL") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinal; + + //Dias da Semana + @Column(name = "NUMASENTOCORRIDA") + private Short numAsentoCorrida; + @Column(name = "INDSEGUNDA") + private Boolean indSegunda; + @Column(name = "INDTERCA") + private Boolean indTerca; + @Column(name = "INDQUARTA") + private Boolean indQuarta; + @Column(name = "INDQUINTA") + private Boolean indQuinta; + @Column(name = "INDSEXTA") + private Boolean indSexta; + @Column(name = "INDSABADO") + private Boolean indSabado; + @Column(name = "INDDOMINGO") + private Boolean indDomingo; + + //FecModif + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + //Activo + @Column(name = "ACTIVO") + private Boolean activo; + + //Usuario + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "TEMPOCONFIRMACAO") + @Temporal(TemporalType.TIMESTAMP) + private Date tempoConfirmacao; + + public Date getTempoConfirmacao() { + return tempoConfirmacao; + } + + public void setTempoConfirmacao(Date tempoConfirmacao) { + this.tempoConfirmacao = tempoConfirmacao; + } + + public Long getReservaEspecialClienteId() { + return reservaEspecialClienteId; + } + + public void setReservaEspecialClienteId(Long reservaEspecialClienteId) { + this.reservaEspecialClienteId = reservaEspecialClienteId; + } + + public Long getClienteId() { + return clienteId; + } + + public void setClienteId(Long clienteId) { + this.clienteId = clienteId; + } + + public Long getCorridaId() { + return corridaId; + } + + public void setCorridaId(Long corridaId) { + this.corridaId = corridaId; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Date getFecinicio() { + return fecinicio; + } + + public void setFecinicio(Date fecinicio) { + this.fecinicio = fecinicio; + } + + public Date getFecfinal() { + return fecfinal; + } + + public void setFecfinal(Date fecfinal) { + this.fecfinal = fecfinal; + } + + public Short getNumAsentoCorrida() { + return numAsentoCorrida; + } + + public void setNumAsentoCorrida(Short numAsentoCorrida) { + this.numAsentoCorrida = numAsentoCorrida; + } + + public Boolean getIndSegunda() { + return indSegunda; + } + + public void setIndSegunda(Boolean indSegunda) { + this.indSegunda = indSegunda; + } + + public Boolean getIndTerca() { + return indTerca; + } + + public void setIndTerca(Boolean indTerca) { + this.indTerca = indTerca; + } + + public Boolean getIndQuarta() { + return indQuarta; + } + + public void setIndQuarta(Boolean indQuarta) { + this.indQuarta = indQuarta; + } + + public Boolean getIndQuinta() { + return indQuinta; + } + + public void setIndQuinta(Boolean indQuinta) { + this.indQuinta = indQuinta; + } + + + public Boolean getIndSexta() { + return indSabado; + } + + public void setIndSexta(Boolean indSexta) { + this.indSabado = indSexta; + } + + public Boolean getIndDomingo() { + return indDomingo; + } + + public void setIndDomingo(Boolean indDomingo) { + this.indDomingo = indDomingo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getIndSabado() { + return indSabado; + } + + public void setIndSabado(Boolean indSabado) { + this.indSabado = indSabado; + } + + public void setTempoConfirmacao(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTempoConfirmacao(c.getTime()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ReservacionCategoria.java b/src/com/rjconsultores/ventaboletos/entidad/ReservacionCategoria.java new file mode 100644 index 000000000..823873551 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ReservacionCategoria.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RESERVACION_CATEGORIA_SEQ", sequenceName = "RESERVACION_CATEGORIA_SEQ", allocationSize = 1) +@Table(name = "RESERVACION_CATEGORIA") +public class ReservacionCategoria implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_CATEGORIA_SEQ") + @Column(name = "RESERVACIONCATEGORIA_ID") + private Integer reservacioncategoriaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") + @ManyToOne + private ReservacionCtrl reservacionCtrl; + @JoinColumn(name = "CATEGORIA_ID", referencedColumnName = "CATEGORIA_ID") + @ManyToOne + private Categoria categoria; + + public ReservacionCategoria() { + } + + public ReservacionCategoria(Integer reservacioncategoriaId) { + this.reservacioncategoriaId = reservacioncategoriaId; + } + + public Integer getReservacioncategoriaId() { + return reservacioncategoriaId; + } + + public void setReservacioncategoriaId(Integer reservacioncategoriaId) { + this.reservacioncategoriaId = reservacioncategoriaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ReservacionCtrl getReservacionCtrl() { + return reservacionCtrl; + } + + public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { + this.reservacionCtrl = reservacionCtrl; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ReservacionCategoria other = (ReservacionCategoria) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { + return false; + } + if (this.categoria != other.categoria && (this.categoria == null || !this.categoria.equals(other.categoria))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 73 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 73 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); + hash = 73 * hash + (this.categoria != null ? this.categoria.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionCategoria[reservacioncategoriaId=" + reservacioncategoriaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ReservacionClase.java b/src/com/rjconsultores/ventaboletos/entidad/ReservacionClase.java new file mode 100644 index 000000000..107cba96b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ReservacionClase.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RESERVACION_CLASE_SEQ", sequenceName = "RESERVACION_CLASE_SEQ", allocationSize = 1) +@Table(name = "RESERVACION_CLASE") +public class ReservacionClase implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_CLASE_SEQ") + @Column(name = "RESERVACIONCLASE_ID") + private Integer reservacionclaseId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") + @ManyToOne + private ReservacionCtrl reservacionCtrl; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public ReservacionClase() { + } + + public ReservacionClase(Integer reservacionclaseId) { + this.reservacionclaseId = reservacionclaseId; + } + + public Integer getReservacionclaseId() { + return reservacionclaseId; + } + + public void setReservacionclaseId(Integer reservacionclaseId) { + this.reservacionclaseId = reservacionclaseId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ReservacionCtrl getReservacionCtrl() { + return reservacionCtrl; + } + + public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { + this.reservacionCtrl = reservacionCtrl; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ReservacionClase other = (ReservacionClase) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { + return false; + } + if (this.claseServicio != other.claseServicio && (this.claseServicio == null || !this.claseServicio.equals(other.claseServicio))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 97 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 97 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); + hash = 97 * hash + (this.claseServicio != null ? this.claseServicio.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionClase[reservacionclaseId=" + reservacionclaseId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ReservacionCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/ReservacionCtrl.java new file mode 100644 index 000000000..4abc8c9bf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ReservacionCtrl.java @@ -0,0 +1,543 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.zkoss.util.resource.Labels; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RESERVACION_CTRL_SEQ", sequenceName = "RESERVACION_CTRL_SEQ", allocationSize = 1) +@Table(name = "RESERVACION_CTRL") +public class ReservacionCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_CTRL_SEQ") + @Column(name = "RESERVACIONCTRL_ID") + private Integer reservacionctrlId; + @Column(name = "DESCCONFIG") + private String descConfig; + @Column(name = "FECINICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecinicio; + @Column(name = "FECFINAL") + @Temporal(TemporalType.TIMESTAMP) + private Date fecfinal; + @Column(name = "TIEMPOLIBERACION") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoliberacion; + @Column(name = "TIEMPOLIBERACIONINTERNET") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoliberacioninternet; + @Column(name = "TIEMPOPREVIO") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoprevio; + @Column(name = "TIEMPOPREVIOINTERNET") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempopreviointernet; + @Column(name = "NUMASIENTOSCORRIDA") + private Short numasientoscorrida; + @Column(name = "INDAPLICLUN") + private Boolean indapliclun; + @Column(name = "INDAPLICMAR") + private Boolean indaplicmar; + @Column(name = "INDAPLICMIE") + private Boolean indaplicmie; + @Column(name = "INDAPLICJUE") + private Boolean indaplicjue; + @Column(name = "INDAPLICVIE") + private Boolean indaplicvie; + @Column(name = "INDAPLICSAB") + private Boolean indaplicsab; + @Column(name = "INDAPLICDOM") + private Boolean indaplicdom; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "reservacionCtrl", cascade = CascadeType.ALL) + private List reservacionCategoriaList; + @OneToMany(mappedBy = "reservacionCtrl", cascade = CascadeType.ALL) + private List reservacionMercadoList; + @OneToMany(mappedBy = "reservacionCtrl", cascade = CascadeType.ALL) + private List reservacionMarcaList; + @OneToMany(mappedBy = "reservacionCtrl", cascade = CascadeType.ALL) + private List reservacionClaseList; + @OneToMany(mappedBy = "reservacionCtrl", cascade = CascadeType.ALL) + private List reservacionPuntoVentaList; + @Column(name = "TIEMPOLIBERACIONCADUC") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoliberacionCaduc; + @Column(name = "TIEMPOLIBERACIONINTERNETCADUC") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoliberacioninternetCaduc; + @Column(name = "INDTIPORESERVA") + private Boolean indTipoReserva; + @Column(name = "INDSEMLIBAUTOMATICA") + private Boolean indSemLiberacaoAutomatica; + + @Column(name = "TEMPOCONFIRMACAO") + @Temporal(TemporalType.TIMESTAMP) + private Date tempoConfirmacao; + + public ReservacionCtrl() { + } + + public ReservacionCtrl(Integer reservacionctrlId) { + this.reservacionctrlId = reservacionctrlId; + } + + public ReservacionCtrl(Integer reservacionctrlId, Date fecmodif) { + this.reservacionctrlId = reservacionctrlId; + this.fecmodif = fecmodif; + } + + public Integer getReservacionctrlId() { + return reservacionctrlId; + } + + public void setReservacionctrlId(Integer reservacionctrlId) { + this.reservacionctrlId = reservacionctrlId; + } + + public Date getFecinicio() { + return fecinicio; + } + + public void setFecinicio(Date fecinicio) { + this.fecinicio = fecinicio; + } + + public Date getFecfinal() { + return fecfinal; + } + + public void setFecfinal(Date fecfinal) { + this.fecfinal = fecfinal; + } + + public Date getTiempoliberacion() { + return tiempoliberacion; + } + + public void setTiempoliberacion(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTiempoliberacion(c.getTime()); + } + + public void setTiempoliberacion(Date tiempoliberacion) { + this.tiempoliberacion = tiempoliberacion; + } + + public Date getTiempoliberacioninternet() { + return tiempoliberacioninternet; + } + + public void setTiempoliberacioninternet(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTiempoliberacioninternet(c.getTime()); + } + + public void setTiempoliberacioninternet(Date tiempoliberacioninternet) { + this.tiempoliberacioninternet = tiempoliberacioninternet; + } + + public Date getTiempoprevio() { + return tiempoprevio; + } + + public void setTiempoprevio(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTiempoprevio(c.getTime()); + } + + public void setTiempoprevio(Date tiempoprevio) { + this.tiempoprevio = tiempoprevio; + } + + public Date getTiempopreviointernet() { + return tiempopreviointernet; + } + + public void setTiempopreviointernet(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTiempopreviointernet(c.getTime()); + } + + public void setTiempopreviointernet(Date tiempopreviointernet) { + this.tiempopreviointernet = tiempopreviointernet; + } + + public Short getNumasientoscorrida() { + return numasientoscorrida; + } + + public void setNumasientoscorrida(Short numasientoscorrida) { + this.numasientoscorrida = numasientoscorrida; + } + + public Boolean getIndaplicdom() { + return indaplicdom; + } + + public void setIndaplicdom(Boolean indaplicdom) { + this.indaplicdom = indaplicdom; + } + + public Boolean getIndaplicjue() { + return indaplicjue; + } + + public void setIndaplicjue(Boolean indaplicjue) { + this.indaplicjue = indaplicjue; + } + + public Boolean getIndapliclun() { + return indapliclun; + } + + public void setIndapliclun(Boolean indapliclun) { + this.indapliclun = indapliclun; + } + + public Boolean getIndaplicmar() { + return indaplicmar; + } + + public void setIndaplicmar(Boolean indaplicmar) { + this.indaplicmar = indaplicmar; + } + + public Boolean getIndaplicmie() { + return indaplicmie; + } + + public void setIndaplicmie(Boolean indaplicmie) { + this.indaplicmie = indaplicmie; + } + + public Boolean getIndaplicsab() { + return indaplicsab; + } + + public void setIndaplicsab(Boolean indaplicsab) { + this.indaplicsab = indaplicsab; + } + + public Boolean getIndaplicvie() { + return indaplicvie; + } + + public void setIndaplicvie(Boolean indaplicvie) { + this.indaplicvie = indaplicvie; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getReservacionCategoriaList() { + List rcList = new ArrayList(); + if (reservacionCategoriaList != null) { + for (ReservacionCategoria rc : this.reservacionCategoriaList) { + if (rc.getActivo() == Boolean.TRUE) { + rcList.add(rc); + } + } + } + + return rcList; + } + + public void setReservacionCategoriaList(List reservacionCategoriaList) { + this.reservacionCategoriaList = reservacionCategoriaList; + } + + public List getReservacionMercadoList() { + List rmList = new ArrayList(); + for (ReservacionMercado rc : this.reservacionMercadoList) { + if (rc.getActivo() == Boolean.TRUE) { + rmList.add(rc); + } + } + return rmList; + } + + public void setReservacionMercadoList(List reservacionMercadoList) { + this.reservacionMercadoList = reservacionMercadoList; + } + + public List getReservacionMarcaList() { + List rmList = new ArrayList(); + for (ReservacionMarca rm : this.reservacionMarcaList) { + if (rm.getActivo() == Boolean.TRUE) { + rmList.add(rm); + } + } + return rmList; + } + + public void setReservacionMarcaList(List reservacionMarcaList) { + this.reservacionMarcaList = reservacionMarcaList; + } + + public List getReservacionClaseList() { + List rcList = new ArrayList(); + for (ReservacionClase rc : this.reservacionClaseList) { + if (rc.getActivo() == Boolean.TRUE) { + rcList.add(rc); + } + } + return rcList; + } + + public void setReservacionClaseList(List reservacionClaseList) { + this.reservacionClaseList = reservacionClaseList; + } + + public String getDescConfig() { + return descConfig; + } + + public void setDescConfig(String descConfig) { + this.descConfig = descConfig; + } + + public Date getTiempoliberacionCaduc() { + return tiempoliberacionCaduc; + } + + public void setTiempoliberacionCaduc(Date tiempoliberacionCaduc) { + this.tiempoliberacionCaduc = tiempoliberacionCaduc; + } + + public Date getTiempoliberacioninternetCaduc() { + return tiempoliberacioninternetCaduc; + } + + public void setTiempoliberacioninternetCaduc(Date tiempoliberacioninternetCaduc) { + this.tiempoliberacioninternetCaduc = tiempoliberacioninternetCaduc; + } + + public void setTiempoliberacionCaduc(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTiempoliberacionCaduc(c.getTime()); + } + + public void setTiempoliberacioninternetCaduc(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTiempoliberacioninternetCaduc(c.getTime()); + } + + public List getReservacionPuntoVentaList() { + List rpvList = new ArrayList(); + for (ReservacionPuntoVenta rpv : this.reservacionPuntoVentaList) { + if (rpv.getActivo() == Boolean.TRUE) { + rpvList.add(rpv); + } + } + return rpvList; + } + + public void setReservacionPuntoVentaList(List reservacionPuntoventaList) { + this.reservacionPuntoVentaList = reservacionPuntoventaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (reservacionctrlId != null ? reservacionctrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof ReservacionCtrl)) { + return false; + } + ReservacionCtrl other = (ReservacionCtrl) object; + if ((this.reservacionctrlId == null && other.reservacionctrlId != null) || (this.reservacionctrlId != null && !this.reservacionctrlId.equals(other.reservacionctrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionCtrl[reservacionctrlId=" + reservacionctrlId + "]"; + } + + public Boolean getIndTipoReserva() { + return indTipoReserva; + } + + public void setIndTipoReserva(Boolean indTipoReserva) { + this.indTipoReserva = indTipoReserva; + } + + public Boolean getIndSemLiberacaoAutomatica() { + return indSemLiberacaoAutomatica; + } + + public void setIndSemLiberacaoAutomatica(Boolean indSemLiberacaoAutomatica) { + this.indSemLiberacaoAutomatica = indSemLiberacaoAutomatica; + } + + public String getDescTipoReserva() { + if(getIndSemLiberacaoAutomatica() != null && getIndSemLiberacaoAutomatica()) { + return Labels.getLabel("editarConfiguracionReservacionController.ra3.value"); + } else if(getIndTipoReserva() != null && getIndTipoReserva()) { + return Labels.getLabel("editarConfiguracionReservacionController.ra2.value"); + } else { + return Labels.getLabel("editarConfiguracionReservacionController.ra1.value"); + } + } + + public void setTempoConfirmacao(Integer hora, Integer minuto) { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + setTempoConfirmacao(c.getTime()); + } + + public Date getTempoConfirmacao() { + return tempoConfirmacao; + } + + public void setTempoConfirmacao(Date tempoConfirmacao) { + this.tempoConfirmacao = tempoConfirmacao; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ReservacionMarca.java b/src/com/rjconsultores/ventaboletos/entidad/ReservacionMarca.java new file mode 100644 index 000000000..4269abbf8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ReservacionMarca.java @@ -0,0 +1,140 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RESERVACION_MARCA_SEQ", sequenceName = "RESERVACION_MARCA_SEQ", allocationSize = 1) +@Table(name = "RESERVACION_MARCA") +public class ReservacionMarca implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_MARCA_SEQ") + @Column(name = "RESERVACIONMARCA_ID") + private Integer reservacionmarcaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") + @ManyToOne + private ReservacionCtrl reservacionCtrl; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + + public ReservacionMarca() { + } + + public ReservacionMarca(Integer reservacionmarcaId) { + this.reservacionmarcaId = reservacionmarcaId; + } + + public Integer getReservacionmarcaId() { + return reservacionmarcaId; + } + + public void setReservacionmarcaId(Integer reservacionmarcaId) { + this.reservacionmarcaId = reservacionmarcaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ReservacionCtrl getReservacionCtrl() { + return reservacionCtrl; + } + + public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { + this.reservacionCtrl = reservacionCtrl; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ReservacionMarca other = (ReservacionMarca) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { + return false; + } + if (this.marca != other.marca && (this.marca == null || !this.marca.equals(other.marca))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 11 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 11 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); + hash = 11 * hash + (this.marca != null ? this.marca.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionMarca[reservacionmarcaId=" + reservacionmarcaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ReservacionMercado.java b/src/com/rjconsultores/ventaboletos/entidad/ReservacionMercado.java new file mode 100644 index 000000000..f54caa076 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ReservacionMercado.java @@ -0,0 +1,157 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RESERVACION_MERCADO_SEQ", sequenceName = "RESERVACION_MERCADO_SEQ", allocationSize=1) +@Table(name = "RESERVACION_MERCADO") +public class ReservacionMercado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_MERCADO_SEQ") + @Column(name = "RESERVACIONMERCADO_ID") + private Integer reservacionmercadoId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") + @ManyToOne + private ReservacionCtrl reservacionCtrl; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaOrigem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaDestino; + + public ReservacionMercado() { + } + + public ReservacionMercado(Integer reservacionmercadoId) { + this.reservacionmercadoId = reservacionmercadoId; + } + + public Integer getReservacionmercadoId() { + return reservacionmercadoId; + } + + public void setReservacionmercadoId(Integer reservacionmercadoId) { + this.reservacionmercadoId = reservacionmercadoId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ReservacionCtrl getReservacionCtrl() { + return reservacionCtrl; + } + + public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { + this.reservacionCtrl = reservacionCtrl; + } + + public Parada getParadaDestino() { + return paradaDestino; + } + + public void setParadaDestino(Parada paradaDestino) { + this.paradaDestino = paradaDestino; + } + + public Parada getParadaOrigem() { + return paradaOrigem; + } + + public void setParadaOrigem(Parada paradaOrigem) { + this.paradaOrigem = paradaOrigem; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ReservacionMercado other = (ReservacionMercado) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { + return false; + } + if (this.paradaOrigem != other.paradaOrigem && (this.paradaOrigem == null || !this.paradaOrigem.equals(other.paradaOrigem))) { + return false; + } + if (this.paradaDestino != other.paradaDestino && (this.paradaDestino == null || !this.paradaDestino.equals(other.paradaDestino))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 5; + hash = 73 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 73 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); + hash = 73 * hash + (this.paradaOrigem != null ? this.paradaOrigem.hashCode() : 0); + hash = 73 * hash + (this.paradaDestino != null ? this.paradaDestino.hashCode() : 0); + return hash; + } + + + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionMercado[reservacionmercadoId=" + reservacionmercadoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java new file mode 100644 index 000000000..2afd57bcb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java @@ -0,0 +1,142 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "RESERVACION_PUNTOVENTA_SEQ", sequenceName = "RESERVACION_PUNTOVENTA_SEQ", allocationSize=1) +@Table(name = "RESERVACION_PUNTOVENTA") +public class ReservacionPuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_PUNTOVENTA_SEQ") + @Column(name = "RESERVACIONPTOVTA_ID") + private Integer reservacionptovtaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") + @ManyToOne + private ReservacionCtrl reservacionCtrl; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + @ManyToOne + private PuntoVenta puntoVenta; + + public ReservacionPuntoVenta() { + } + + public ReservacionPuntoVenta(Integer reservacionptovtaId) { + this.reservacionptovtaId = reservacionptovtaId; + } + + public Integer getReservacionptovtaId() { + return reservacionptovtaId; + } + + public void setReservacionptovtaId(Integer reservacionptovtaId) { + this.reservacionptovtaId = reservacionptovtaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ReservacionCtrl getReservacionCtrl() { + return reservacionCtrl; + } + + public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { + this.reservacionCtrl = reservacionCtrl; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ReservacionPuntoVenta other = (ReservacionPuntoVenta) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { + return false; + } + if (this.puntoVenta != other.puntoVenta && (this.puntoVenta == null || !this.puntoVenta.equals(other.puntoVenta))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 79 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 79 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); + hash = 79 * hash + (this.puntoVenta != null ? this.puntoVenta.hashCode() : 0); + return hash; + } + + + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionPuntoventa[reservacionptovtaId=" + reservacionptovtaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/RestriccionPago.java b/src/com/rjconsultores/ventaboletos/entidad/RestriccionPago.java new file mode 100644 index 000000000..da664bbfe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RestriccionPago.java @@ -0,0 +1,134 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RESTRICCION_SEQ", sequenceName = "RESTRICCION_SEQ", allocationSize=1) +@Table(name = "RESTRICCION") +public class RestriccionPago implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESTRICCION_SEQ") + @Column(name = "RESTRICCION_ID") + private Short restriccionId; + @Column(name = "DESCRESTRICCION") + private String descrestriccion; + @Column(name = "ACTIVO") + private Boolean activo; + @Basic(optional = false) + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "restriccion") + private List configRestriccionPagoList; + + public RestriccionPago() { + } + + public Short getRestriccionId() { + return restriccionId; + } + + public void setRestriccionId(Short restriccionId) { + this.restriccionId = restriccionId; + } + + public String getDescrestriccion() { + return descrestriccion; + } + + public void setDescrestriccion(String descrestriccion) { + this.descrestriccion = descrestriccion; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getConfigRestriccionPagoList() { + List tmp = new ArrayList(); + if (configRestriccionPagoList != null) { + for (ConfigRestriccionPago crp : this.configRestriccionPagoList) { + if (crp.getActivo()) { + tmp.add(crp); + } + } + } + + return tmp; + } + + public void setConfigRestriccionPagoList(List configRestriccionPagoList) { + this.configRestriccionPagoList = configRestriccionPagoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (restriccionId != null ? restriccionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof RestriccionPago)) { + return false; + } + RestriccionPago other = (RestriccionPago) object; + if ((this.restriccionId == null && other.restriccionId != null) || (this.restriccionId != null && !this.restriccionId.equals(other.restriccionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDescrestriccion(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/RhPagoConductor.java b/src/com/rjconsultores/ventaboletos/entidad/RhPagoConductor.java new file mode 100644 index 000000000..1e92fcb88 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RhPagoConductor.java @@ -0,0 +1,227 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@Table(name = "RH_SALIDAS") +public class RhPagoConductor implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "RHPAGOCONDUCTOR_ID") + private Integer rhpagoconductorId; +// @Column(name = "NUMPAGOCONDUCTOR") +// private Integer numpagoconductor; + @Column(name = "NUMAUTOBUS") + private Integer numautobus; + @Column(name = "NUMCORRIDA") + private Integer numcorrida; + @Column(name = "DESCRUTA") + private String descruta; + @Column(name = "FECHORSALIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date fechorsalida; + @Column(name = "CVEOPERADOR1") + private String cveoperador1; + @Column(name = "NOMBREOPERADOR1") + private String nombreoperador1; + @Column(name = "CANTKMSOPERADOR1") + private BigDecimal cantkmsoperador1; + @Column(name = "CVEOPERADOR2") + private String cveoperador2; + @Column(name = "NOMBREOPERADOR2") + private String nombreoperador2; + @Column(name = "CANTKMSOPERADOR2") + private BigDecimal cantkmsoperador2; + @Column(name = "INDEXTRA") + private Boolean indextra; + @Column(name = "CVEORIGEN") + private String cveOrigen; + @Column(name = "CVEDESTINO") + private String cveDestino; + @Column(name = "RUTA_ID ") + private Integer ruta; + @Column(name = "MARCA_ID ") + private Short marca; + + public RhPagoConductor() { + } + + public RhPagoConductor(Integer rhpagoconductorId) { + this.rhpagoconductorId = rhpagoconductorId; + } + + public Integer getRhpagoconductorId() { + return rhpagoconductorId; + } + + public void setRhpagoconductorId(Integer rhpagoconductorId) { + this.rhpagoconductorId = rhpagoconductorId; + } + + public Integer getNumautobus() { + return numautobus; + } + + public void setNumautobus(Integer numautobus) { + this.numautobus = numautobus; + } + + public Integer getNumcorrida() { + return numcorrida; + } + + public void setNumcorrida(Integer numcorrida) { + this.numcorrida = numcorrida; + } + + public String getDescruta() { + return descruta; + } + + public void setDescruta(String descruta) { + this.descruta = descruta; + } + + public Date getFechorsalida() { + return fechorsalida; + } + + public void setFechorsalida(Date fechorsalida) { + this.fechorsalida = fechorsalida; + } + + public String getCveoperador1() { + return cveoperador1; + } + + public void setCveoperador1(String cveoperador1) { + this.cveoperador1 = cveoperador1; + } + + public String getNombreoperador1() { + return nombreoperador1; + } + + public void setNombreoperador1(String nombreoperador1) { + this.nombreoperador1 = nombreoperador1; + } + + public BigDecimal getCantkmsoperador1() { + return cantkmsoperador1; + } + + public void setCantkmsoperador1(BigDecimal cantkmsoperador1) { + this.cantkmsoperador1 = cantkmsoperador1; + } + + public String getCveoperador2() { + return cveoperador2; + } + + public void setCveoperador2(String cveoperador2) { + this.cveoperador2 = cveoperador2; + } + + public String getNombreoperador2() { + return nombreoperador2; + } + + public void setNombreoperador2(String nombreoperador2) { + this.nombreoperador2 = nombreoperador2; + } + + public BigDecimal getCantkmsoperador2() { + return cantkmsoperador2; + } + + public void setCantkmsoperador2(BigDecimal cantkmsoperador2) { + this.cantkmsoperador2 = cantkmsoperador2; + } + + public Boolean getIndextra() { + return indextra; + } + + public void setIndextra(Boolean indextra) { + this.indextra = indextra; + } + + public String getCveDestino() { + return cveDestino; + } + + public void setCveDestino(String cveDestino) { + this.cveDestino = cveDestino; + } + + public String getCveOrigen() { + return cveOrigen; + } + + public void setCveOrigen(String cveOrigen) { + this.cveOrigen = cveOrigen; + } + + public Integer getRuta() { + return ruta; + } + + public void setRuta(Integer ruta) { + this.ruta = ruta; + } + + public Short getMarca() { + return marca; + } + + public void setMarca(Short marca) { + this.marca = marca; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (rhpagoconductorId != null ? rhpagoconductorId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof RhPagoConductor)) { + return false; + } + RhPagoConductor other = (RhPagoConductor) object; + if ((this.rhpagoconductorId == null && other.rhpagoconductorId != null) || (this.rhpagoconductorId != null && !this.rhpagoconductorId.equals(other.rhpagoconductorId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.RhPagoConductor[rhpagoconductorId=" + rhpagoconductorId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/RolOperativo.java b/src/com/rjconsultores/ventaboletos/entidad/RolOperativo.java new file mode 100644 index 000000000..2664f99d9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RolOperativo.java @@ -0,0 +1,176 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "ROL_OPERATIVO_SEQ", sequenceName = "ROL_OPERATIVO_SEQ", allocationSize=1) +@Table(name = "ROL_OPERATIVO") +public class RolOperativo implements Serializable, Auditavel { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ROL_OPERATIVO_SEQ") + @Column(name = "ROLOPERATIVO_ID") + private Integer roloperativoId; + @Column(name = "DESCROLOPERATIVO") + private String descroloperativo; + @Column(name = "TIEMPOPREVIO") + @Temporal(TemporalType.TIMESTAMP) + private Date tiempoprevio; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "rolOperativo") + private List esquemaCorridaList; + @JoinColumn(name = "DIAGRAMAAUTOBUS_ID", referencedColumnName = "DIAGRAMAAUTOBUS_ID") + @ManyToOne + private DiagramaAutobus diagramaAutobus; + + @Transient + @NaoAuditar + private RolOperativo rolOperativoClone; + + public RolOperativo() { + } + + public RolOperativo(Integer roloperativoId) { + this.roloperativoId = roloperativoId; + } + + public Integer getRoloperativoId() { + return roloperativoId; + } + + public void setRoloperativoId(Integer roloperativoId) { + this.roloperativoId = roloperativoId; + } + + public String getDescroloperativo() { + return descroloperativo; + } + + public void setDescroloperativo(String descroloperativo) { + this.descroloperativo = descroloperativo; + } + + public Date getTiempoprevio() { + return tiempoprevio; + } + + public void setTiempoprevio(Date tiempoprevio) { + this.tiempoprevio = tiempoprevio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getEsquemaCorridaList() { + return esquemaCorridaList; + } + + public void setEsquemaCorridaList(List esquemaCorridaList) { + this.esquemaCorridaList = esquemaCorridaList; + } + + public DiagramaAutobus getDiagramaAutobus() { + return diagramaAutobus; + } + + public void setDiagramaAutobus(DiagramaAutobus diagramaAutobus) { + this.diagramaAutobus = diagramaAutobus; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (roloperativoId != null ? roloperativoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof RolOperativo)) { + return false; + } + RolOperativo other = (RolOperativo) object; + if ((this.getRoloperativoId() == null && other.getRoloperativoId() != null) || (this.getRoloperativoId() != null && !this.getRoloperativoId().equals(other.getRoloperativoId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDescroloperativo(); + } + + @Override + public void clonar() throws CloneNotSupportedException { + rolOperativoClone = new RolOperativo(); + rolOperativoClone = (RolOperativo) this.clone(); + } + + @Override + public RolOperativo getCloneObject() throws CloneNotSupportedException { + return rolOperativoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getRoloperativoId()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Ruta.java b/src/com/rjconsultores/ventaboletos/entidad/Ruta.java new file mode 100644 index 000000000..4c822a109 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Ruta.java @@ -0,0 +1,666 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.annotations.Where; + +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "RUTA_SEQ", sequenceName = "RUTA_SEQ", allocationSize = 1) +@org.hibernate.annotations.Entity(dynamicUpdate = true) +@Table(name = "RUTA") +public class Ruta implements Serializable, Comparable, Auditavel { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_SEQ") + @Column(name = "RUTA_ID") + private Integer rutaId; + + @Column(name = "DESCRUTA") + private String descruta; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + @JoinColumn(name = "GRUPORUTA_ID", referencedColumnName = "GRUPORUTA_ID") + @ManyToOne + private GrupoRuta grupoRuta; + + @OneToMany(mappedBy = "ruta", cascade = CascadeType.ALL) + private List rutaSecuenciaList; + + @OneToMany(mappedBy = "ruta") + private List rutaCombinacionList; + + @Column(name = "indnombreobligatorio") + private Boolean indNombreObligatorio; + + @Column(name = "INDTELEFONEOBRIGATORIO") + private Boolean indTelefoneObrigatorio; + + @OneToMany(mappedBy = "ruta", cascade = CascadeType.ALL) + private List lsRutaEmpresa; + + @Column(name = "INDVENTAOFFLINE") + private Boolean ventaOffLine; + + @Column(name = "PREFIXO") + private String prefixo; + + @Column(name = "PREFIXOAUXILIAR") + private String prefixoAuxiliar; + + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + + @Column(name = "INDSENTIDOIDA") + private Boolean indSentidoIda; + + @Column(name = "NUMRUTA") + private String numRuta; + + @Column(name = "INDTRIBTARIFA") + private Boolean indTribTarifa; + + @Column(name = "INDTRIBPEDAGIO") + private Boolean indTribPedagio; + + @Column(name = "INDTRIBTAXAEMBARQUE") + private Boolean indTribTaxaEmbarque; + + @Column(name = "CANTEIXOS") + private Integer cantEixos; + + @Column(name = "CANTASIENTOS") + private Integer cantAsientos; + + @Column(name = "INDVENTARIOCARD") + private Boolean indVentaRioCard; + + @Column(name = "NUMRIOCARD") + private String numRioCard; + + @Column(name = "INDBLOQVTAABIERTA") + private Boolean indBloqueoVtaAbierta; + + @Column(name = "INDRUTACENLADA") + private Boolean indRutaCancelada; + + @Column(name = "INDRUTAINTERNACIONAL") + private Boolean indRutaInternacional; + + @Column(name = "INDVENDAEMBARCADA") + private Boolean indVendaEmbarcada; + + @Column(name = "INDPRECIOPORDEMANDA") + private Boolean indPrecioPorDemanda; + + @Column(name = "FECINIPRECIODEMANDA") + private Date fecInicioPrecioDemanda; + + @Column(name = "FECFIMPRECIODEMANDA") + private Date fecFimPrecioDemanda; + + @OneToMany(mappedBy = "ruta", cascade = CascadeType.ALL) + private List lsRutaEmbarqueDesembarque; + + @OneToMany(mappedBy = "ruta", cascade = CascadeType.ALL) + @Where(clause = "activo = 1") + private List lsRutaIcmsExcepcions; + + @Transient + private Boolean isClone; + + @Column(name = "indnumfidelidadobligatorio") + private Boolean indNumFidelidadObligatorio; + + @Transient + @NaoAuditar + private Ruta rutaClone; + + @Column(name = "STATUS_AUTORIZADORA") + private Integer statusAutorizadora; + + public Ruta() { + super(); + indRutaCancelada = false; + indBloqueoVtaAbierta = false; + indSentidoIda = true; + indRutaInternacional = false; + } + + public Ruta(Integer rutaId, String descruta) { + this(); + this.rutaId = rutaId; + this.descruta = descruta; + indRutaInternacional = false; + } + + public static Ruta clone(Ruta other) { + Ruta ruta = new Ruta(); + ruta.setIsClone(Boolean.TRUE); + ruta.activo = other.activo; + ruta.cantAsientos = other.cantAsientos; + ruta.cantEixos = other.cantEixos; + ruta.claseServicio = other.claseServicio; + ruta.descruta = other.descruta; + ruta.fecmodif = other.fecmodif; + ruta.grupoRuta = other.grupoRuta; + ruta.indNombreObligatorio = other.indNombreObligatorio; + ruta.indTelefoneObrigatorio = other.indTelefoneObrigatorio; + ruta.indSentidoIda = other.indSentidoIda; + ruta.indTribPedagio = other.indTribPedagio; + ruta.indTribTarifa = other.indTribTarifa; + ruta.indTribTaxaEmbarque = other.indTribTaxaEmbarque; + ruta.indVentaRioCard = other.indVentaRioCard; + ruta.indRutaInternacional = other.indRutaInternacional; + ruta.indPrecioPorDemanda = other.indPrecioPorDemanda; + ruta.fecInicioPrecioDemanda = other.fecInicioPrecioDemanda; + ruta.fecFimPrecioDemanda = other.fecFimPrecioDemanda; + + /******* ruta.lsRutaEmpresa *************/ + if (ruta.lsRutaEmpresa == null) { + ruta.lsRutaEmpresa = new ArrayList(); + } + for (RutaEmpresa re : other.lsRutaEmpresa) { + RutaEmpresa r = new RutaEmpresa(); + r.setActivo(re.getActivo()); + r.setEmpresa(re.getEmpresa()); + r.setFecmodif(re.getFecmodif()); + r.setRuta(ruta); + r.setRutaEmpresaId(null); + r.setUsuarioId(re.getUsuarioId()); + ruta.lsRutaEmpresa.add(r); + } + /*****************************************/ + + ruta.numRioCard = other.numRioCard; + ruta.numRuta = other.numRuta; + ruta.orgaoConcedente = other.orgaoConcedente; + ruta.prefixo = other.prefixo; + ruta.prefixoAuxiliar = other.prefixoAuxiliar; + + /************* ruta.rutaCombinacionList **************/ + // if (ruta.rutaCombinacionList == null){ + // ruta.rutaCombinacionList = new ArrayList(); + // } + // for (RutaCombinacion rc : other.rutaCombinacionList){ + // RutaCombinacion rcnew = RutaCombinacion.clone(rc); + // rcnew.setRuta(ruta); + // rcnew.setRutacombinacionId(null); + // ruta.rutaCombinacionList.add(rcnew); + // } + /*******************************************************/ + + ruta.rutaId = other.rutaId; + + /************ ruta.rutaSecuenciaList ************/ + if (ruta.rutaSecuenciaList == null) { + ruta.rutaSecuenciaList = new ArrayList(); + } + for (RutaSecuencia rs : other.rutaSecuenciaList) { + RutaSecuencia rsnew = RutaSecuencia.clone(rs); + rsnew.setRuta(ruta); + rsnew.setRutasecuenciaId(null); + ruta.rutaSecuenciaList.add(rsnew); + } + /************************************************/ + + ruta.usuarioId = other.usuarioId; + ruta.ventaOffLine = other.ventaOffLine; + return ruta; + } + + public Integer numSecuenciaOrigen(Integer origenId) { + Integer numSecuencia = -1; + for (RutaSecuencia rs : getRutaSecuenciaList()) { + if (rs.tieneOrigen(origenId)) { + numSecuencia = rs.getNumsecuencia().intValue(); + } + } + return numSecuencia; + } + + public Integer numSecuenciaDestino(Integer destinoId) { + Integer numSecuencia = -1; + for (RutaSecuencia rs : getRutaSecuenciaList()) { + if (rs.tieneDestino(destinoId)) { + numSecuencia = rs.getNumsecuencia().intValue(); + } + } + return numSecuencia; + } + + public Ruta(Integer rutaId) { + this(); + this.rutaId = rutaId; + this.indRutaInternacional = false; + } + + public Integer getRutaId() { + return rutaId; + } + + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + + public String getDescruta() { + return descruta; + } + + public void setDescruta(String descruta) { + this.descruta = descruta; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getNumRuta() { + return numRuta; + } + + public void setNumRuta(String numRuta) { + this.numRuta = numRuta; + } + + public List getRutaSecuenciaList() { + List rsList = new ArrayList(); + if (this.rutaSecuenciaList != null) + for (RutaSecuencia rs : this.rutaSecuenciaList) { + if (rs.getActivo() == Boolean.TRUE) { + rsList.add(rs); + } + } + + return rsList; + } + + public void setRutaSecuenciaList(List rutaSecuenciaList) { + this.rutaSecuenciaList = rutaSecuenciaList; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public List getRutaCombinacionList() { + + List rcList = new ArrayList(); + if (this.rutaCombinacionList == null) { + return rcList; + } + for (RutaCombinacion rc : this.rutaCombinacionList) { + if (rc.getActivo() == Boolean.TRUE) { + rcList.add(rc); + } + } + + return rcList; + } + + public void setRutaCombinacionList(List rutaCombinacionList) { + this.rutaCombinacionList = rutaCombinacionList; + } + + public List getLsRutaEmpresa() { + List rsList = new ArrayList(); + for (RutaEmpresa rs : this.lsRutaEmpresa) { + if (rs.getActivo() == Boolean.TRUE) { + rsList.add(rs); + } + } + + return rsList; + } + + public void setLsRutaEmpresa(List lsRutaEmpresa) { + this.lsRutaEmpresa = lsRutaEmpresa; + } + + public Boolean getVentaOffLine() { + return ventaOffLine; + } + + public void setVentaOffLine(Boolean ventaOffLine) { + this.ventaOffLine = ventaOffLine; + } + + public String getPrefixo() { + return prefixo; + } + + public void setPrefixo(String prefixo) { + this.prefixo = prefixo; + } + + public String getPrefixoAuxiliar() { + return prefixoAuxiliar; + } + + public void setPrefixoAuxiliar(String prefixoAuxiliar) { + this.prefixoAuxiliar = prefixoAuxiliar; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Boolean getIndSentidoIda() { + return indSentidoIda; + } + + public void setIndSentidoIda(Boolean indSentidoIda) { + this.indSentidoIda = indSentidoIda; + } + + public GrupoRuta getGrupoRuta() { + return grupoRuta; + } + + public void setGrupoRuta(GrupoRuta grupoRuta) { + this.grupoRuta = grupoRuta; + } + + public Boolean getIndTribTarifa() { + return indTribTarifa; + } + + public void setIndTribTarifa(Boolean indTribTarifa) { + this.indTribTarifa = indTribTarifa; + } + + public Boolean getIndTribPedagio() { + return indTribPedagio; + } + + public void setIndTribPedagio(Boolean indTribPedagio) { + this.indTribPedagio = indTribPedagio; + } + + public Boolean getIndTribTaxaEmbarque() { + return indTribTaxaEmbarque; + } + + public void setIndTribTaxaEmbarque(Boolean indTribTaxaEmbarque) { + this.indTribTaxaEmbarque = indTribTaxaEmbarque; + } + + public Boolean getIndNombreObligatorio() { + return indNombreObligatorio; + } + + public void setIndNombreObligatorio(Boolean indNombreObligatorio) { + this.indNombreObligatorio = indNombreObligatorio; + } + + public Boolean getIndTelefoneObrigatorio() { + return indTelefoneObrigatorio; + } + + public void setIndTelefoneObrigatorio(Boolean indTelefoneObrigatorio) { + this.indTelefoneObrigatorio = indTelefoneObrigatorio; + } + + public Integer getCantEixos() { + return cantEixos; + } + + public void setCantEixos(Integer cantEixos) { + this.cantEixos = cantEixos; + } + + public Integer getCantAsientos() { + return cantAsientos; + } + + public void setCantAsientos(Integer cantAsientos) { + this.cantAsientos = cantAsientos; + } + + public Boolean getIndVentaRioCard() { + return indVentaRioCard; + } + + public void setIndVentaRioCard(Boolean indVentaRioCard) { + this.indVentaRioCard = indVentaRioCard; + } + + public String getNumRioCard() { + return numRioCard; + } + + public void setNumRioCard(String numRioCard) { + this.numRioCard = numRioCard; + } + + public Boolean getIndBloqueoVtaAbierta() { + return indBloqueoVtaAbierta; + } + + public void setIndBloqueoVtaAbierta(Boolean indBloqueoVtaAbierta) { + this.indBloqueoVtaAbierta = indBloqueoVtaAbierta; + } + + public Boolean getIndRutaCancelada() { + return indRutaCancelada; + } + + public void setIndRutaCancelada(Boolean isRutaCancelada) { + this.indRutaCancelada = isRutaCancelada; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getRutaId() != null ? getRutaId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Ruta)) { + return false; + } + Ruta other = (Ruta) object; + if ((this.getRutaId() == null && other.getRutaId() != null) || (this.getRutaId() != null && !this.getRutaId().equals(other.getRutaId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + if (getDescruta() != null || getRutaId() != null) { + if (getRutaId() != -1) { + String sentido = getDescSentido(); + String numRuta = this.getNumRuta() != null ? this.getNumRuta() : "null"; + String descClaseServicio = this.getClaseServicio() != null ? this.getClaseServicio().getDescclase() : "null"; + String descLinha = numRuta + " - " + this.getDescruta() + " - " + descClaseServicio + " - " + this.getRutaId().toString() + " - " + sentido; + return descLinha; + } else { + return this.getRutaId() + " - " + this.getDescruta(); + } + } + return " "; + } + + @Override + public int compareTo(Ruta ruta) { + return this.getRutaId().intValue() - ruta.getRutaId().intValue(); + } + + public Boolean getIsClone() { + return isClone; + } + + public void setIsClone(Boolean isClone) { + this.isClone = isClone; + } + + public Boolean getIndRutaInternacional() { + return indRutaInternacional; + } + + public void setIndRutaInternacional(Boolean indRutaInternacional) { + this.indRutaInternacional = indRutaInternacional; + } + + public List getLsRutaEmbarqueDesembarque() { + return lsRutaEmbarqueDesembarque; + } + + public void setLsRutaEmbarqueDesembarque(List lsRutaEmbarqueDesembarque) { + this.lsRutaEmbarqueDesembarque = lsRutaEmbarqueDesembarque; + } + + public Boolean getIndNumFidelidadObligatorio() { + return indNumFidelidadObligatorio; + } + + public void setIndNumFidelidadObligatorio(Boolean indNumFidelidadObligatorio) { + this.indNumFidelidadObligatorio = indNumFidelidadObligatorio; + } + + public Boolean getIndVendaEmbarcada() { + return indVendaEmbarcada == null ? false : indVendaEmbarcada; + } + + public void setIndVendaEmbarcada(Boolean indVendaEmbarcada) { + this.indVendaEmbarcada = indVendaEmbarcada; + } + + public List getLsRutaIcmsExcepcions() { + return lsRutaIcmsExcepcions; + } + + public void setLsRutaIcmsExcepcions(List lsRutaIcmsExcepcions) { + this.lsRutaIcmsExcepcions = lsRutaIcmsExcepcions; + } + + @Override + public void clonar() throws CloneNotSupportedException { + rutaClone = new Ruta(); + rutaClone = (Ruta) this.clone(); + } + + @Override + public Ruta getCloneObject() throws CloneNotSupportedException { + return rutaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getRutaId()); + } + + public Boolean getIndPrecioPorDemanda() { + return indPrecioPorDemanda; + } + + public void setIndPrecioPorDemanda(Boolean indPrecioPorDemanda) { + this.indPrecioPorDemanda = indPrecioPorDemanda; + } + + public Date getFecInicioPrecioDemanda() { + return fecInicioPrecioDemanda; + } + + public void setFecInicioPrecioDemanda(Date fecInicioPrecioDemanda) { + this.fecInicioPrecioDemanda = fecInicioPrecioDemanda; + } + + public Date getFecFimPrecioDemanda() { + return fecFimPrecioDemanda; + } + + public void setFecFimPrecioDemanda(Date fecFimPrecioDemanda) { + this.fecFimPrecioDemanda = fecFimPrecioDemanda; + } + + public String getDescSentido() { + return this.getIndSentidoIda() == null || Boolean.TRUE.equals(this.getIndSentidoIda()) ? "IDA" : "VOLTA"; + } + + public Integer getStatusAutorizadora() { + return statusAutorizadora; + } + + public void setStatusAutorizadora(Integer statusAutorizadora) { + this.statusAutorizadora = statusAutorizadora; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/RutaCaseta.java b/src/com/rjconsultores/ventaboletos/entidad/RutaCaseta.java new file mode 100644 index 000000000..0ab9f571e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RutaCaseta.java @@ -0,0 +1,85 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "RUTA_CASETA_SEQ", sequenceName = "RUTA_CASETA_SEQ", allocationSize = 1) +@Table(name = "RUTA_CASETA") +public class RutaCaseta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_CASETA_SEQ") + @Column(name = "RUTACASETA_ID") + private Integer rutaCasetaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + + @JoinColumn(name = "RUTASECUENCIA_ID", referencedColumnName = "RUTASECUENCIA_ID") + @ManyToOne + private RutaSecuencia rutaSecuencia; + @JoinColumn(name = "CASETAPEAJE_ID", referencedColumnName = "CASETAPEAJE_ID") + @ManyToOne + private CasetaPeaje casetaPeaje; + public Integer getRutaCasetaId() { + return rutaCasetaId; + } + public void setRutaCasetaId(Integer rutaCasetaId) { + this.rutaCasetaId = rutaCasetaId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public RutaSecuencia getRutaSecuencia() { + return rutaSecuencia; + } + public void setRutaSecuencia(RutaSecuencia rutaSecuencia) { + this.rutaSecuencia = rutaSecuencia; + } + public CasetaPeaje getCasetaPeaje() { + return casetaPeaje; + } + public void setCasetaPeaje(CasetaPeaje casetaPeaje) { + this.casetaPeaje = casetaPeaje; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/RutaCombinacion.java b/src/com/rjconsultores/ventaboletos/entidad/RutaCombinacion.java new file mode 100644 index 000000000..6141fa4d0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RutaCombinacion.java @@ -0,0 +1,169 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang.BooleanUtils; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "RUTA_COMBINACION_SEQ", sequenceName = "RUTA_COMBINACION_SEQ", allocationSize=1) +@Table(name = "RUTA_COMBINACION") +public class RutaCombinacion implements Serializable, Cloneable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_COMBINACION_SEQ") + @Column(name = "RUTACOMBINACION_ID") + private Integer rutacombinacionId; + @Column(name = "INDVENTA") + private Boolean indventa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @Column(name = "INDUSAPRICING") + private Boolean indUsaPricing; + @Column(name = "CODIGODERPR") + private String codigoDerPr; + + public RutaCombinacion() { + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + + public RutaCombinacion(Integer rutacombinacionId) { + this.rutacombinacionId = rutacombinacionId; + } + + public Integer getRutacombinacionId() { + return rutacombinacionId; + } + + public void setRutacombinacionId(Integer rutacombinacionId) { + this.rutacombinacionId = rutacombinacionId; + } + + public Boolean getIndventa() { + return BooleanUtils.toBooleanDefaultIfNull(indventa, Boolean.TRUE); + } + + public void setIndventa(Boolean indventa) { + this.indventa = indventa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (rutacombinacionId != null ? rutacombinacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof RutaCombinacion)) { + return false; + } + RutaCombinacion other = (RutaCombinacion) object; + if ((this.rutacombinacionId == null && other.rutacombinacionId != null) || (this.rutacombinacionId != null && !this.rutacombinacionId.equals(other.rutacombinacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.RutaCombinacion[rutacombinacionId=" + rutacombinacionId + "]"; + } + + public Boolean getIndUsaPricing() { + return BooleanUtils.toBooleanDefaultIfNull(indUsaPricing, Boolean.TRUE); + } + + public void setIndUsaPricing(Boolean indUsaPricing) { + this.indUsaPricing = indUsaPricing; + } + + public String getCodigoDerPr() { + return codigoDerPr; + } + + public void setCodigoDerPr(String codigoDerPr) { + this.codigoDerPr = codigoDerPr; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/RutaEmbarqueDesembarque.java b/src/com/rjconsultores/ventaboletos/entidad/RutaEmbarqueDesembarque.java new file mode 100644 index 000000000..e4c79125c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RutaEmbarqueDesembarque.java @@ -0,0 +1,155 @@ +package com.rjconsultores.ventaboletos.entidad; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "RUTA_EMBRQ_DESEMBRQ_SEQ", sequenceName = "RUTA_EMBRQ_DESEMBRQ_SEQ", allocationSize = 1) +@Table(name = "RUTA_EMBRQ_DESEMBRQ") +public class RutaEmbarqueDesembarque implements java.io.Serializable { + + private static final long serialVersionUID = -8321526713959603226L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_EMBRQ_DESEMBRQ_SEQ") + @Column(name = "RUTAEMBRQDESEMBRQ_ID", unique = true, nullable = false, precision = 7, scale = 0) + private Integer rutaEmbarqueDesembarqueId; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "PARADA_ID", nullable = false) + private Parada parada; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "RUTA_ID", nullable = false) + private Ruta ruta; + + @Column(name = "ACTIVO", precision = 1, scale = 0) + private Boolean activo; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + private Date fecmodif; + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + private Integer usuarioId; + + @Column(name = "EMBARQUE", precision = 1, scale = 0) + private Boolean embarque; + + @Column(name = "DESEMBARQUE", precision = 1, scale = 0) + private Boolean desembarque; + + @ManyToOne(fetch = FetchType.EAGER) + @JoinColumn(name = "PARADA_EMB_DES_ID") + private Parada localDesembarqueEmbarque; + + public RutaEmbarqueDesembarque() { + } + + public RutaEmbarqueDesembarque(Integer rutaEmbarqueDesembarqueId, Parada parada, Ruta ruta) { + this.rutaEmbarqueDesembarqueId = rutaEmbarqueDesembarqueId; + this.parada = parada; + this.ruta = ruta; + } + + public RutaEmbarqueDesembarque(Integer rutaEmbarqueDesembarqueId, Parada parada, Ruta ruta, Boolean activo, Date fecmodif, + Integer usuarioId) { + this.rutaEmbarqueDesembarqueId = rutaEmbarqueDesembarqueId; + this.parada = parada; + this.ruta = ruta; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Integer getRutaEmbarqueDesembarqueId() { + return this.rutaEmbarqueDesembarqueId; + } + + public void setRutaEmbarqueDesembarqueId(Integer rutaEmbarqueDesembarqueId) { + this.rutaEmbarqueDesembarqueId = rutaEmbarqueDesembarqueId; + } + + public Parada getParada() { + return this.parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public Ruta getRuta() { + return this.ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getEmbarque() { + return embarque; + } + + public void setEmbarque(Boolean embarque) { + this.embarque = embarque; + } + + public Boolean getDesembarque() { + return desembarque; + } + + public void setDesembarque(Boolean desembarque) { + this.desembarque = desembarque; + } + + @Override + public String toString() { + return parada != null ? parada.getDescparada() : ""; + } + + public Parada getLocalDesembarqueEmbarque() { + return localDesembarqueEmbarque; + } + + public void setLocalDesembarqueEmbarque(Parada localDesembarqueEmbarque) { + this.localDesembarqueEmbarque = localDesembarqueEmbarque; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/RutaEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/RutaEmpresa.java new file mode 100644 index 000000000..d31e1bdbe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RutaEmpresa.java @@ -0,0 +1,117 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "RUTA_EMPRESA_SEQ", sequenceName = "RUTA_EMPRESA_SEQ", allocationSize = 1) +@Table(name = "RUTA_EMPRESA") +public class RutaEmpresa implements Cloneable { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_EMPRESA_SEQ") + @Column(name = "RUTAEMPRESA_ID") + private Integer rutaEmpresaId; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(javax.persistence.TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + + @OneToOne + @JoinColumn(name = "EMPRESA_AUTORIZADORA_ID") + private Empresa empresaAutorizadora; + + public Integer getRutaEmpresaId() { + return rutaEmpresaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public void setRutaEmpresaId(Integer rutaEmpresaId) { + this.rutaEmpresaId = rutaEmpresaId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return empresa.getNombempresa(); + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + public Empresa getEmpresaAutorizadora() { + return empresaAutorizadora; + } + + public void setEmpresaAutorizadora(Empresa empresaAutorizadora) { + this.empresaAutorizadora = empresaAutorizadora; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/RutaIcmsExcepcion.java b/src/com/rjconsultores/ventaboletos/entidad/RutaIcmsExcepcion.java new file mode 100644 index 000000000..54308f6e2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RutaIcmsExcepcion.java @@ -0,0 +1,168 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang.BooleanUtils; + +@Entity +@SequenceGenerator(name = "RUTA_ICMS_EXCEPCION_SEQ", sequenceName = "RUTA_ICMS_EXCEPCION_SEQ", allocationSize = 1) +@Table(name = "RUTA_ICMS_EXCEPCION") +public class RutaIcmsExcepcion implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_ICMS_EXCEPCION_SEQ") + @Column(name = "RUTAICMSEXCEPCION_ID") + private Integer rutaIcmsExcepcionId; + + @Column(name = "INDTRIBTARIFA") + private Boolean indTribTarifa; + + @Column(name = "INDTRIBTAXAEMBARQUE") + private Boolean indTribTaxaEmbarque; + + @Column(name = "INDTRIBPEDAGIO") + private Boolean indTribPedagio; + + @ManyToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + + @ManyToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origen; + + @ManyToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getRutaIcmsExcepcionId() { + return rutaIcmsExcepcionId; + } + + public void setRutaIcmsExcepcionId(Integer rutaIcmsExcepcionId) { + this.rutaIcmsExcepcionId = rutaIcmsExcepcionId; + } + + public Boolean getIndTribTarifa() { + return BooleanUtils.toBooleanObject(indTribTarifa); + } + + public void setIndTribTarifa(Boolean indTribTarifa) { + this.indTribTarifa = indTribTarifa; + } + + public Boolean getIndTribTaxaEmbarque() { + return BooleanUtils.toBooleanObject(indTribTaxaEmbarque); + } + + public void setIndTribTaxaEmbarque(Boolean indTribTaxaEmbarque) { + this.indTribTaxaEmbarque = indTribTaxaEmbarque; + } + + public Boolean getIndTribPedagio() { + return BooleanUtils.toBooleanObject(indTribPedagio); + } + + public void setIndTribPedagio(Boolean indTribPedagio) { + this.indTribPedagio = indTribPedagio; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getRutaIcmsExcepcionId() == null) ? 0 : getRutaIcmsExcepcionId().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof RutaIcmsExcepcion)) + return false; + RutaIcmsExcepcion other = (RutaIcmsExcepcion) obj; + if (getRutaIcmsExcepcionId() == null) { + if (other.getRutaIcmsExcepcionId() != null) + return false; + } else if (!getRutaIcmsExcepcionId().equals(other.getRutaIcmsExcepcionId())) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/RutaSecuencia.java b/src/com/rjconsultores/ventaboletos/entidad/RutaSecuencia.java new file mode 100644 index 000000000..bf4f1b57d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RutaSecuencia.java @@ -0,0 +1,217 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "RUTA_SECUENCIA_SEQ", sequenceName = "RUTA_SECUENCIA_SEQ", allocationSize=1) +@Table(name = "RUTA_SECUENCIA") +public class RutaSecuencia implements Serializable, Cloneable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RUTA_SECUENCIA_SEQ") + @Column(name = "RUTASECUENCIA_ID") + private Integer rutasecuenciaId; + @Column(name = "NUMSECUENCIA") + private Short numsecuencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @Column(name = "KMORIGINAL") + private BigDecimal kmOriginal; + + @OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL) + @JoinColumn(name = "RUTASECUENCIA_ID") + private List lsRutaCase; + + @Column(name = "CANTKMENTRADASAIDA") + private BigDecimal cantKmEntradaSaida; + + public RutaSecuencia() { + this.kmOriginal = BigDecimal.ZERO; + } + + public static RutaSecuencia clone(RutaSecuencia other){ + List rutasCaseta = new ArrayList(); + RutaSecuencia rsnew = new RutaSecuencia(); + rsnew.setActivo(other.activo); + rsnew.setFecmodif(other.fecmodif); + rsnew.setNumsecuencia(other.numsecuencia); + rsnew.setRuta(other.ruta); + rsnew.setRutasecuenciaId(other.rutasecuenciaId); + rsnew.setTramo(other.tramo); + rsnew.setUsuarioId(other.usuarioId); + rsnew.setCantKmEntradaSaida(other.cantKmEntradaSaida); + rsnew.setKmOriginal(other.kmOriginal); + + for (RutaCaseta rc : other.getLsRutaCase()){ + RutaCaseta rutaCaseta = new RutaCaseta(); + rutaCaseta.setRutaSecuencia(rsnew); + rutaCaseta.setCasetaPeaje(rc.getCasetaPeaje()); + rutaCaseta.setActivo(Boolean.TRUE); + rutaCaseta.setFecmodif(new Date()); + rutaCaseta.setUsuarioId(other.usuarioId); + rutasCaseta.add(rutaCaseta); + } + rsnew.setLsRutaCase(rutasCaseta); + return rsnew; + } + + public boolean tieneOrigen(Integer origenId){ + return tramo.getOrigem().getParadaId().equals(origenId); + } + + public boolean tieneDestino(Integer destinoId){ + return tramo.getDestino().getParadaId().equals(destinoId); + } + + public RutaSecuencia(Integer rutasecuenciaId) { + this.rutasecuenciaId = rutasecuenciaId; + } + + public Integer getRutasecuenciaId() { + return rutasecuenciaId; + } + + public void setRutasecuenciaId(Integer rutasecuenciaId) { + this.rutasecuenciaId = rutasecuenciaId; + } + + public Short getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Short numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public List getLsRutaCase() { + return lsRutaCase; + } + + public void setLsRutaCase(List lsRutaCase) { + this.lsRutaCase = lsRutaCase; + } + + public BigDecimal getCantKmEntradaSaida() { + return cantKmEntradaSaida; + } + + public void setCantKmEntradaSaida(BigDecimal cantKmEntradaSaida) { + this.cantKmEntradaSaida = cantKmEntradaSaida; + } + + + + public BigDecimal getKmOriginal() { + return kmOriginal; + } + + public void setKmOriginal(BigDecimal kmOriginal) { + this.kmOriginal = kmOriginal; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (rutasecuenciaId != null ? rutasecuenciaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof RutaSecuencia)) { + return false; + } + RutaSecuencia other = (RutaSecuencia) object; + if ((this.rutasecuenciaId == null && other.rutasecuenciaId != null) || (this.rutasecuenciaId != null && !this.rutasecuenciaId.equals(other.rutasecuenciaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.RutaSecuencia[rutasecuenciaId=" + rutasecuenciaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Secretaria.java b/src/com/rjconsultores/ventaboletos/entidad/Secretaria.java new file mode 100644 index 000000000..8f423ad98 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Secretaria.java @@ -0,0 +1,288 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; + +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Entity +@Table(name = "SECRETARIA") +@SequenceGenerator(name = "SECRETARIA_SEQ", sequenceName = "SECRETARIA_SEQ", allocationSize = 1) +public class Secretaria implements Serializable { + + public static final Short PRECIO_TOTAL = 1; + public static final Short PRECIO_MENOS_DESCUENTO = 2; + public static final Short DESCUENTO_COBRAR = 3; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SECRETARIA_SEQ") + @Column(name = "SECRETARIA_ID") + private Integer secretariaId; + @Column(name = "DESCSECRETARIA") + private String descsecretaria; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "CVESECRETARIA") + private String cvesecretaria; + @Column(name = "VALIDAFOLIO") + private Boolean validafolio; + @Column(name = "INDSERIESUBSERIE") + private Boolean validaSerieSubSerie; + @Column(name = "IMPRIMEPRECIO") + private Short imprimeprecio; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "SECRETARIA_ID") + private List lsCuponSecretaria; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "secretaria") + @LazyCollection(LazyCollectionOption.FALSE) + private List empresas = new ArrayList(); + @Column(name = "INDVOUCHERROD") + private Boolean indVoucherRod; + @Column(name = "RUT") + private Long rut; + @Column (name = "DIRSECRETARIA") + private String direccion; + @Column (name = "CIUDAD") + private String ciudad; + + @OneToOne + @JoinColumn(name = "FORMAPAGO_ID") + private FormaPago formaPago; + + public Secretaria() { + this.indVoucherRod = false; + } + + public SecretariaEmpresa addEmpresa(Empresa e) { + SecretariaEmpresa se = new SecretariaEmpresa(); + se.setEmpresa(e); + se.setSecretaria(this); + se.setActivo(Boolean.TRUE); + se.setFecmodif(Calendar.getInstance().getTime()); + se.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + this.empresas.add(se); + return se; + } + + public void removeEmpresa(SecretariaEmpresa e) { + this.empresas.remove(e); + } + + public void removeEmpresa(Empresa e) { + for (SecretariaEmpresa se : empresas) { + if (se.getEmpresa().equals(e)) { + this.empresas.remove(e); + break; + } + } + } + + public Secretaria(Integer secretariaId) { + this.secretariaId = secretariaId; + this.indVoucherRod = false; + } + + public Integer getSecretariaId() { + return secretariaId; + } + + public void setSecretariaId(Integer secretariaId) { + this.secretariaId = secretariaId; + } + + public String getDescsecretaria() { + return descsecretaria; + } + + public void setDescsecretaria(String descsecretaria) { + this.descsecretaria = descsecretaria; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getCvesecretaria() { + return cvesecretaria; + } + + public void setCvesecretaria(String cvesecretaria) { + this.cvesecretaria = cvesecretaria; + } + + public Boolean getValidafolio() { + return validafolio; + } + + public void setValidafolio(Boolean validafolio) { + this.validafolio = validafolio; + } + + public Short getImprimeprecio() { + return imprimeprecio; + } + + public void setImprimeprecio(Short imprimeprecio) { + this.imprimeprecio = imprimeprecio; + } + + public List getLsCuponSecretaria() { + + List tmp = new ArrayList(); + if (lsCuponSecretaria != null) { + for (CuponSecretaria cp : this.lsCuponSecretaria) { + if (cp.getActivo()) { + tmp.add(cp); + } + } + } + + return tmp; + } + + public List getEmpresas() { + List lista = new ArrayList(); + for (SecretariaEmpresa eb : empresas) { + if (eb.getActivo()) { + lista.add(eb); + } + } + return lista; + } + + public void setEmpresas(List empresas) { + this.empresas = empresas; + } + + public void setLsCuponSecretaria(List lsCuponSecretaria) { + this.lsCuponSecretaria = lsCuponSecretaria; + } + + public Boolean getValidaSerieSubSerie() { + return validaSerieSubSerie; + } + + public void setValidaSerieSubSerie(Boolean validaSerieSubSerie) { + this.validaSerieSubSerie = validaSerieSubSerie; + } + + public Boolean getIndVoucherRod() { + return indVoucherRod; + } + + public void setIndVoucherRod(Boolean indVoucherRod) { + this.indVoucherRod = indVoucherRod; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (secretariaId != null ? secretariaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Secretaria)) { + return false; + } + Secretaria other = (Secretaria) object; + if ((this.secretariaId == null && other.secretariaId != null) || (this.secretariaId != null && !this.secretariaId.equals(other.secretariaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return descsecretaria; + } + + public Long getRut() { + return rut; + } + + public void setRut(Long rut) { + this.rut = rut; + } + + public String getDireccion() { + return direccion; + } + + public void setDireccion(String direccion) { + this.direccion = direccion; + } + + public String getCiudad() { + return ciudad; + } + + public void setCiudad(String ciudad) { + this.ciudad = ciudad; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/SecretariaEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/SecretariaEmpresa.java new file mode 100644 index 000000000..4901937e5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/SecretariaEmpresa.java @@ -0,0 +1,108 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "SECRETARIA_EMPRESA_SEQ", sequenceName = "SECRETARIA_EMPRESA_SEQ", allocationSize = 1) +@Table(name = "SECRETARIA_EMPRESA") +public class SecretariaEmpresa { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SECRETARIA_EMPRESA_SEQ") + @Column(name = "SECRETARIAEMPRESA_ID") + private Integer secretariaempresaId; + @ManyToOne + @JoinColumn(name = "SECRETARIA_ID") + private Secretaria secretaria; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + + public SecretariaEmpresa(){ + this.activo = true; + } + + public Integer getSecretariaempresaId() { + return secretariaempresaId; + } + public void setSecretariaempresaId(Integer secretariaempresaId) { + this.secretariaempresaId = secretariaempresaId; + } + public Secretaria getSecretaria() { + return secretaria; + } + public void setSecretaria(Secretaria secretaria) { + this.secretaria = secretaria; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (secretariaempresaId != null ? secretariaempresaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof SecretariaEmpresa)) { + return false; + } + SecretariaEmpresa other = (SecretariaEmpresa) object; + if ((this.secretariaempresaId == null && other.secretariaempresaId != null) || (this.secretariaempresaId != null && !this.secretariaempresaId.equals(other.secretariaempresaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.SecretariaEmpresa[secretariaempresaId=" + secretariaempresaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/SegVKM.java b/src/com/rjconsultores/ventaboletos/entidad/SegVKM.java new file mode 100644 index 000000000..fb18e8091 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/SegVKM.java @@ -0,0 +1,150 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author RJ + */ +@Entity +@SequenceGenerator(name = "SEGVKM_SEQ", sequenceName = "SEGVKM_SEQ", allocationSize = 1) +@Table(name = "SEGVKM") +public class SegVKM implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEGVKM_SEQ") + @Column(name = "SEGVKM_ID") + private Integer segVKMId; + @Column(name = "KM") + private BigDecimal km; + @Column(name = "VALOR") + private BigDecimal valor; + @Column(name = "SERIE") + private String serie; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgaoConcedente; + + public SegVKM() { + } + + public SegVKM(Integer segVKMId) { + this.segVKMId = segVKMId; + } + + public Integer getSegVKMId() { + return segVKMId; + } + + public void setSegVKMId(Integer segVKMId) { + this.segVKMId = segVKMId; + } + + public BigDecimal getKm() { + return km; + } + + public void setKm(BigDecimal km) { + this.km = km; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (segVKMId != null ? segVKMId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof SegVKM)) { + return false; + } + SegVKM other = (SegVKM) object; + if ((this.segVKMId == null && other.segVKMId != null) || (this.segVKMId != null && !this.segVKMId.equals(other.segVKMId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.SegVKM[ segVKMId=" + segVKMId + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/SeguradoraEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/SeguradoraEmpresa.java new file mode 100644 index 000000000..4974d6ade --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/SeguradoraEmpresa.java @@ -0,0 +1,80 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "SEGURADORA_EMPRESA_SEQ", sequenceName = "SEGURADORA_EMPRESA_SEQ", allocationSize = 1) +@Table(name = "SEGURADORA_EMPRESA") +public class SeguradoraEmpresa implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEGURADORA_EMPRESA_SEQ") + @Column(name = "SEGURADORAEMPRESA_ID ") + private Integer seguradoraEmpresaId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @Column(name = "SERIESEGURADORA") + private String serie; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getSeguradoraEmpresaId() { + return seguradoraEmpresaId; + } + public void setSeguradoraEmpresaId(Integer seguradoraEmpresaId) { + this.seguradoraEmpresaId = seguradoraEmpresaId; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public String getSerie() { + return serie; + } + public void setSerie(String serie) { + this.serie = serie; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/SeguroKm.java b/src/com/rjconsultores/ventaboletos/entidad/SeguroKm.java new file mode 100644 index 000000000..8130794d7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/SeguroKm.java @@ -0,0 +1,151 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "SEGURO_KM_SEQ", sequenceName = "SEGURO_KM_SEQ", allocationSize = 1) +@Table(name = "SEGURO_KM") +public class SeguroKm implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEGURO_KM_SEQ") + @Column(name = "SEGUROKM_ID") + private Integer segurokmId; + @Column(name = "KMATE") + private Integer kmate; + @Column(name = "VALORTAXA") + private BigDecimal valortaxa; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgaoconcedente; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "TIPO_SEGURO") + private String tipoSeguro; + + public SeguroKm() { + } + + public String getTipoSeguro() { + return tipoSeguro; + } + + public void setTipoSeguro(String tipoSeguro) { + this.tipoSeguro = tipoSeguro; + } + + public SeguroKm(Integer segurokmId) { + this.segurokmId = segurokmId; + } + + public Integer getSegurokmId() { + return segurokmId; + } + + public void setSegurokmId(Integer segurokmId) { + this.segurokmId = segurokmId; + } + + public Integer getKmate() { + return kmate; + } + + public void setKmate(Integer kmate) { + this.kmate = kmate; + } + + public BigDecimal getValortaxa() { + return valortaxa; + } + + public void setValortaxa(BigDecimal valortaxa) { + this.valortaxa = valortaxa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (segurokmId != null ? segurokmId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof SeguroKm)) { + return false; + } + SeguroKm other = (SeguroKm) object; + if ((this.segurokmId == null && other.segurokmId != null) || (this.segurokmId != null && !this.segurokmId.equals(other.segurokmId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.SeguroKm[ segurokmId=" + segurokmId + " ]"; + } + + public OrgaoConcedente getOrgaoconcedente() { + return orgaoconcedente; + } + + public void setOrgaoconcedente(OrgaoConcedente orgaoconcedente) { + this.orgaoconcedente = orgaoconcedente; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/SeguroTarifa.java b/src/com/rjconsultores/ventaboletos/entidad/SeguroTarifa.java new file mode 100644 index 000000000..0ab67174a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/SeguroTarifa.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "SEGURO_TARIFA_SEQ", sequenceName = "SEGURO_TARIFA_SEQ", allocationSize = 1) +@Table(name = "SEGURO_TARIFA") +public class SeguroTarifa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SEGURO_TARIFA_SEQ") + @Column(name = "SEGUROTARIFA_ID") + private Integer segurotarifaId; + @Column(name = "VALORTAXA") + private BigDecimal valortarifa; + @Column(name = "VALORTARIFAATE") + private BigDecimal valortarifaate; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgaoconcedente; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public SeguroTarifa() { + } + + public SeguroTarifa(Integer segurotarifaId) { + this.segurotarifaId = segurotarifaId; + } + + public Integer getSegurotarifaId() { + return segurotarifaId; + } + + public void setSegurotarifaId(Integer segurotarifaId) { + this.segurotarifaId = segurotarifaId; + } + + public BigDecimal getValortarifa() { + return valortarifa; + } + + public void setValortarifa(BigDecimal valortarifa) { + this.valortarifa = valortarifa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (segurotarifaId != null ? segurotarifaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof SeguroTarifa)) { + return false; + } + SeguroTarifa other = (SeguroTarifa) object; + if ((this.segurotarifaId == null && other.segurotarifaId != null) || (this.segurotarifaId != null && !this.segurotarifaId.equals(other.segurotarifaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.SeguroTarifa[ segurotarifaId=" + segurotarifaId + " ]"; + } + + public BigDecimal getValortarifaate() { + return valortarifaate; + } + + public void setValortarifaate(BigDecimal valortarifaate) { + this.valortarifaate = valortarifaate; + } + + public OrgaoConcedente getOrgaoconcedente() { + return orgaoconcedente; + } + + public void setOrgaoconcedente(OrgaoConcedente orgaoconcedente) { + this.orgaoconcedente = orgaoconcedente; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Sistema.java b/src/com/rjconsultores/ventaboletos/entidad/Sistema.java new file mode 100644 index 000000000..0a98752ea --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Sistema.java @@ -0,0 +1,128 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@Table(name = "SISTEMA") +@SequenceGenerator(name = "SISTEMA_SEQ", sequenceName = "SISTEMA_SEQ", allocationSize = 1) +public class Sistema implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SISTEMA_SEQ") + @Column(name = "SISTEMA_ID") + private Integer sistemaId; + @Column(name = "NOMBSISTEMA") + private String nombsistema; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "sistema") + private List funcionSistemaList; + + public Sistema() { + } + + public Sistema(Integer sistemaId) { + this.sistemaId = sistemaId; + } + + public Integer getSistemaId() { + return sistemaId; + } + + public void setSistemaId(Integer sistemaId) { + this.sistemaId = sistemaId; + } + + public String getNombsistema() { + return nombsistema; + } + + public void setNombsistema(String nombsistema) { + this.nombsistema = nombsistema; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getFuncionSistemaList() { + return funcionSistemaList; + } + + public void setFuncionSistemaList(List funcionSistemaList) { + this.funcionSistemaList = funcionSistemaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (sistemaId != null ? sistemaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Sistema)) { + return false; + } + Sistema other = (Sistema) object; + if ((this.sistemaId == null && other.sistemaId != null) || (this.sistemaId != null && !this.sistemaId.equals(other.sistemaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNombsistema(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Tarifa.java b/src/com/rjconsultores/ventaboletos/entidad/Tarifa.java new file mode 100644 index 000000000..16be316b4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Tarifa.java @@ -0,0 +1,436 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import br.com.rjconsultores.auditador.annotations.AuditarAtributo; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarID; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; +import br.com.rjconsultores.auditador.interfaces.AuditavelTelaAlternativa; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "TARIFA_SEQ", sequenceName = "TARIFA_SEQ", allocationSize = 1) +@Table(name = "TARIFA") +@AuditarClasse(nome = "TARIFA", tela = "Alteração de Preço") +public class Tarifa implements Serializable, Auditavel, AuditavelTelaAlternativa { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_SEQ") + @Column(name = "TARIFA_ID") + @AuditarID + private Integer tarifaId; + + @Column(name = "PRECIO") + @AuditarAtributo(nome = "Tarifa") + private BigDecimal precio; + + @Column(name = "IMPORTETAXAEMBARQUE") + @AuditarAtributo(nome = "Taxa de Embarque") + private BigDecimal importetaxaembarque; + + @Column(name = "IMPORTEPEDAGIO") + @AuditarAtributo(nome = "Pedagio") + private BigDecimal importepedagio; + + @Column(name = "IMPORTEOUTROS") + @AuditarAtributo(nome = "Outros") + private BigDecimal importeoutros; + + @Column(name = "IMPORTESEGURO") + @AuditarAtributo(nome = "Seguro") + private BigDecimal importeseguro; + + @Column(name = "IMPORTETPP") + @AuditarAtributo(nome = "Tarifa TPP") + private BigDecimal importeTPP; + + @Column(name = "PRECIOORIGINAL") + @AuditarAtributo(nome = "Tarifa Original") + private BigDecimal preciooriginal; + + @Column(name = "STATUSTARIFA") + @AuditarAtributo(nome = "Status Tarifa") + private String statustarifa; + + @Column(name = "ACTIVO") + @NaoAuditar + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + @NaoAuditar + private Date fecmodif; + @Column(name = "USUARIO_ID") + @NaoAuditar + private Integer usuarioId; + + @OneToOne + @JoinColumn(name = "TRAMO_ID") + @NaoAuditar + private Tramo tramo; + + @OneToOne + @JoinColumn(name = "MARCA_ID") + @NaoAuditar + private Marca marca; + + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + @NaoAuditar + private ClaseServicio claseServicio; + + @OneToOne + @JoinColumn(name = "MONEDA_ID") + @NaoAuditar + private Moneda moneda; + + @OneToOne + @JoinColumn(name = "VIGENCIATARIFA_ID") + @NaoAuditar + private VigenciaTarifa vigenciaTarifa; + + @Column(name = "PRECIOREDABIERTO") + @AuditarAtributo(nome = "Tarifa volta em aberto") + private BigDecimal precioredabierto; + + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TARIFA_ID", referencedColumnName = "TARIFA_ID") + @NaoAuditar + private List lsTarifaTipoptovta; + + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TARIFA_ID", referencedColumnName = "TARIFA_ID") + @NaoAuditar + private List lsTarifaCategoria; + + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + @NaoAuditar + private Parada origen; + + @OneToOne + @JoinColumn(name = "DESTINO_ID") + @NaoAuditar + private Parada destino; + + @OneToOne + @JoinColumn(name = "RUTA_ID") + @NaoAuditar + private Ruta ruta; + + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + @NaoAuditar + private OrgaoConcedente orgaoConcedente; + + @Transient + @NaoAuditar + private Tarifa tarifaClone; + + @NaoAuditar + @Transient + private String telaAlternativa; + + public Tarifa() { + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public BigDecimal getImporteTPP() { + return importeTPP; + } + + public void setImporteTPP(BigDecimal importeTPP) { + this.importeTPP = importeTPP; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + public Tarifa(Integer tarifaId) { + this.tarifaId = tarifaId; + } + + public Integer getTarifaId() { + return tarifaId; + } + + public void setTarifaId(Integer tarifaId) { + this.tarifaId = tarifaId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getPreciooriginal() { + return preciooriginal; + } + + public void setPreciooriginal(BigDecimal preciooriginal) { + this.preciooriginal = preciooriginal; + } + + public String getStatustarifa() { + return statustarifa; + } + + public void setStatustarifa(String statustarifa) { + this.statustarifa = statustarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public VigenciaTarifa getVigenciaTarifa() { + return vigenciaTarifa; + } + + public void setVigenciaTarifa(VigenciaTarifa vigenciaTarifa) { + this.vigenciaTarifa = vigenciaTarifa; + } + + public BigDecimal getPrecioredabierto() { + return precioredabierto; + } + + public void setPrecioredabierto(BigDecimal precioredabierto) { + this.precioredabierto = precioredabierto; + } + + public List getLsTarifaCategoria() { + List tmp = new ArrayList(); + if (lsTarifaCategoria != null) { + for (TarifaCategoria ddab : this.lsTarifaCategoria) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + + this.lsTarifaCategoria = tmp; + + return tmp; + } + + public void setLsTarifaCategoria(List lsTarifaCategoria) { + this.lsTarifaCategoria = lsTarifaCategoria; + } + + public List getLsTarifaTipoptovta() { + List tmp = new ArrayList(); + if (lsTarifaTipoptovta != null) { + for (TarifaTipoptovta ddab : this.lsTarifaTipoptovta) { + if (ddab.getActivo()) { + tmp.add(ddab); + } + } + } + + this.lsTarifaTipoptovta = tmp; + + return tmp; + } + + public void setLsTarifaTipoptovta(List lsTarifaTipoptovta) { + this.lsTarifaTipoptovta = lsTarifaTipoptovta; + } + + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifaId != null ? tarifaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Tarifa)) { + return false; + } + Tarifa other = (Tarifa) object; + if ((this.tarifaId == null && other.tarifaId != null) || (this.tarifaId != null && !this.tarifaId.equals(other.tarifaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Tarifa[tarifaId=" + tarifaId + "]"; + } + + public BigDecimal getImportetaxaembarque() { + return importetaxaembarque; + } + + public void setImportetaxaembarque(BigDecimal importetaxaembarque) { + this.importetaxaembarque = importetaxaembarque; + } + + public BigDecimal getImportepedagio() { + return importepedagio; + } + + public void setImportepedagio(BigDecimal importepedagio) { + this.importepedagio = importepedagio; + } + + public BigDecimal getImporteoutros() { + return importeoutros; + } + + public void setImporteoutros(BigDecimal importeoutros) { + this.importeoutros = importeoutros; + } + + public BigDecimal getImporteseguro() { + return importeseguro; + } + + public void setImporteseguro(BigDecimal importeseguro) { + this.importeseguro = importeseguro; + } + + @Override + public void clonar() throws CloneNotSupportedException { + tarifaClone = new Tarifa(); + tarifaClone = (Tarifa) this.clone(); + } + + @Override + public Tarifa getCloneObject() throws CloneNotSupportedException { + return tarifaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getTarifaId()); + } + + public void setTelaAlternativa(String telaAlternativa) { + this.telaAlternativa = telaAlternativa; + } + + @Override + public String getTelaAlternativa() { + return telaAlternativa; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarifaCategoria.java b/src/com/rjconsultores/ventaboletos/entidad/TarifaCategoria.java new file mode 100644 index 000000000..9164e26b5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarifaCategoria.java @@ -0,0 +1,155 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@Table(name = "TARIFA_CATEGORIA") +@SequenceGenerator(name = "TARIFA_CATEGORIA_SEQ", sequenceName = "TARIFA_CATEGORIA_SEQ", allocationSize = 1) +public class TarifaCategoria implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_CATEGORIA_SEQ") + @Column(name = "TARIFACATEGORIA_ID") + private Integer tarifacategoriaId; + @Column(name = "PRECIO") + private BigDecimal precio; + @Column(name = "PRECIOREDABIERTO") + private BigDecimal precioredabierto; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "CATEGORIA_ID") + private Categoria categoria; + @JoinColumn(name = "TARIFA_ID", referencedColumnName = "TARIFA_ID") + @ManyToOne(fetch=FetchType.LAZY) + private Tarifa tarifa; + + public TarifaCategoria() { + } + + public TarifaCategoria(Integer tarifacategoriaId) { + this.tarifacategoriaId = tarifacategoriaId; + } + + public Integer getTarifacategoriaId() { + return tarifacategoriaId; + } + + public void setTarifacategoriaId(Integer tarifacategoriaId) { + this.tarifacategoriaId = tarifacategoriaId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getPrecioredabierto() { + return precioredabierto; + } + + public void setPrecioredabierto(BigDecimal precioredabierto) { + this.precioredabierto = precioredabierto; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + + public Tarifa getTarifa() { + return tarifa; + } + + public void setTarifa(Tarifa tarifa) { + this.tarifa = tarifa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifacategoriaId != null ? tarifacategoriaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarifaCategoria)) { + return false; + } + TarifaCategoria other = (TarifaCategoria) object; + if ((this.tarifacategoriaId == null && other.tarifacategoriaId != null) || (this.tarifacategoriaId != null && !this.tarifacategoriaId.equals(other.tarifacategoriaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaCategoria[tarifacategoriaId=" + tarifacategoriaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarifaDemanda.java b/src/com/rjconsultores/ventaboletos/entidad/TarifaDemanda.java new file mode 100644 index 000000000..ca3ad2df9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarifaDemanda.java @@ -0,0 +1,311 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Wallace + */ +@Entity +@SequenceGenerator(name = "TARIFA_DEMANDA_SEQ", sequenceName = "TARIFA_DEMANDA_SEQ", allocationSize = 1) +@Table(name = "TARIFA_DEMANDA") +public class TarifaDemanda implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_SEQ") + @Column(name = "TARIFADEMANDA_ID") + private Integer tarifaDemandaId; + @Column(name = "PRECIO") + private BigDecimal precio; + @Column(name = "IMPORTETAXAEMBARQUE") + private BigDecimal importetaxaembarque; + @Column(name = "IMPORTEPEDAGIO") + private BigDecimal importepedagio; + @Column(name = "IMPORTEOUTROS") + private BigDecimal importeoutros; + @Column(name = "IMPORTESEGURO") + private BigDecimal importeseguro; + @Column(name = "IMPORTETPP") + private BigDecimal importeTPP; + @Column(name = "PRECIOORIGINAL") + private BigDecimal preciooriginal; + @Column(name = "STATUSTARIFA") + private String statustarifa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "TRAMO_ID") + private Tramo tramo; + @OneToOne + @JoinColumn(name = "MARCA_ID") + private Marca marca; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @OneToOne + @JoinColumn(name = "VIGENCIATARIFA_ID") + private VigenciaTarifa vigenciaTarifa; + @Column(name = "PRECIOREDABIERTO") + private BigDecimal precioredabierto; + @Column(name = "CATEGORIAS") + private String categorias; + @Column(name = "PUNTOVENTAS") + private String puntoVentas; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origen; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + + public TarifaDemanda() { + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public BigDecimal getImporteTPP() { + return importeTPP; + } + + public void setImporteTPP(BigDecimal importeTPP) { + this.importeTPP = importeTPP; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + public TarifaDemanda(Integer tarifaDemandaId) { + this.tarifaDemandaId = tarifaDemandaId; + } + + public Integer getTarifaDemandaId() { + return tarifaDemandaId; + } + + public void setTarifaId(Integer tarifaDemandaId) { + this.tarifaDemandaId = tarifaDemandaId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getPreciooriginal() { + return preciooriginal; + } + + public void setPreciooriginal(BigDecimal preciooriginal) { + this.preciooriginal = preciooriginal; + } + + public String getStatustarifa() { + return statustarifa; + } + + public void setStatustarifa(String statustarifa) { + this.statustarifa = statustarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public VigenciaTarifa getVigenciaTarifa() { + return vigenciaTarifa; + } + + public void setVigenciaTarifa(VigenciaTarifa vigenciaTarifa) { + this.vigenciaTarifa = vigenciaTarifa; + } + + public BigDecimal getPrecioredabierto() { + return precioredabierto; + } + + public void setPrecioredabierto(BigDecimal precioredabierto) { + this.precioredabierto = precioredabierto; + } + + public String getCategorias() { + return categorias; + } + + public void setCategorias(String categorias) { + this.categorias = categorias; + } + + public String getPuntoVentas() { + return puntoVentas; + } + + public void setPuntoVentas(String puntoVentas) { + this.puntoVentas = puntoVentas; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifaDemandaId != null ? tarifaDemandaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Tarifa)) { + return false; + } + TarifaDemanda other = (TarifaDemanda) object; + if ((this.tarifaDemandaId == null && other.tarifaDemandaId != null) || (this.tarifaDemandaId != null && !this.tarifaDemandaId.equals(other.tarifaDemandaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Tarifa[tarifaId=" + tarifaDemandaId + "]"; + } + + public BigDecimal getImportetaxaembarque() { + return importetaxaembarque; + } + + public void setImportetaxaembarque(BigDecimal importetaxaembarque) { + this.importetaxaembarque = importetaxaembarque; + } + + public BigDecimal getImportepedagio() { + return importepedagio; + } + + public void setImportepedagio(BigDecimal importepedagio) { + this.importepedagio = importepedagio; + } + + public BigDecimal getImporteoutros() { + return importeoutros; + } + + public void setImporteoutros(BigDecimal importeoutros) { + this.importeoutros = importeoutros; + } + + public BigDecimal getImporteseguro() { + return importeseguro; + } + + public void setImporteseguro(BigDecimal importeseguro) { + this.importeseguro = importeseguro; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarifaEmbarcada.java b/src/com/rjconsultores/ventaboletos/entidad/TarifaEmbarcada.java new file mode 100644 index 000000000..0005258c2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarifaEmbarcada.java @@ -0,0 +1,323 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import br.com.rjconsultores.auditador.annotations.NaoAuditar; + +@Entity +@SequenceGenerator(name = "TARIFA_EMBARCADA_SEQ", sequenceName = "TARIFA_EMBARCADA_SEQ", allocationSize = 1) +@Table(name = "TARIFA_EMBARCADA") +public class TarifaEmbarcada implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_EMBARCADA_SEQ") + @Column(name = "TARIFAEMBARCADA_ID") + private Integer tarifaembarcadaId; + @Column(name = "PRECIO") + private BigDecimal precio; + @Column(name = "IMPORTETAXAEMBARQUE") + private BigDecimal importetaxaembarque; + @Column(name = "IMPORTEPEDAGIO") + private BigDecimal importepedagio; + @Column(name = "IMPORTEOUTROS") + private BigDecimal importeoutros; + @Column(name = "IMPORTESEGURO") + private BigDecimal importeseguro; + @Column(name = "IMPORTETPP") + private BigDecimal importeTPP; + @Column(name = "PRECIOORIGINAL") + private BigDecimal preciooriginal; + @Column(name = "STATUSTARIFA") + private String statustarifa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "TRAMO_ID") + private Tramo tramo; + @OneToOne + @JoinColumn(name = "MARCA_ID") + private Marca marca; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @OneToOne + @JoinColumn(name = "MONEDA_ID") + private Moneda moneda; + @OneToOne + @JoinColumn(name = "VIGENCIATARIFA_ID") + private VigenciaTarifa vigenciaTarifa; + @Column(name = "PRECIOREDABIERTO") + private BigDecimal precioredabierto; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origen; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + @Transient + @NaoAuditar + private TarifaEmbarcada tarifaClone; + @NaoAuditar + @Transient + private String telaAlternativa; + + public TarifaEmbarcada() { + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public BigDecimal getImporteTPP() { + return importeTPP; + } + + public void setImporteTPP(BigDecimal importeTPP) { + this.importeTPP = importeTPP; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + public TarifaEmbarcada(Integer tarifaembarcadaId) { + this.tarifaembarcadaId = tarifaembarcadaId; + } + + public Integer getTarifaembarcadaId() { + return tarifaembarcadaId; + } + + public void setTarifaembarcadaId(Integer tarifaembarcadaId) { + this.tarifaembarcadaId = tarifaembarcadaId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getPreciooriginal() { + return preciooriginal; + } + + public void setPreciooriginal(BigDecimal preciooriginal) { + this.preciooriginal = preciooriginal; + } + + public String getStatustarifa() { + return statustarifa; + } + + public void setStatustarifa(String statustarifa) { + this.statustarifa = statustarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public VigenciaTarifa getVigenciaTarifa() { + return vigenciaTarifa; + } + + public void setVigenciaTarifa(VigenciaTarifa vigenciaTarifa) { + this.vigenciaTarifa = vigenciaTarifa; + } + + public BigDecimal getPrecioredabierto() { + return precioredabierto; + } + + public void setPrecioredabierto(BigDecimal precioredabierto) { + this.precioredabierto = precioredabierto; + } + + + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public void clonar() throws CloneNotSupportedException { + tarifaClone = new TarifaEmbarcada(); + tarifaClone = (TarifaEmbarcada) this.clone(); + } + + public TarifaEmbarcada getCloneObject() throws CloneNotSupportedException { + return tarifaClone; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifaembarcadaId != null ? tarifaembarcadaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarifaEmbarcada)) { + return false; + } + TarifaEmbarcada other = (TarifaEmbarcada) object; + if ((this.tarifaembarcadaId == null && other.tarifaembarcadaId != null) || (this.tarifaembarcadaId != null && !this.tarifaembarcadaId.equals(other.tarifaembarcadaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaEmbarcada[tarifaembarcadaId=" + tarifaembarcadaId + "]"; + } + + public BigDecimal getImportetaxaembarque() { + return importetaxaembarque; + } + + public void setImportetaxaembarque(BigDecimal importetaxaembarque) { + this.importetaxaembarque = importetaxaembarque; + } + + public BigDecimal getImportepedagio() { + return importepedagio; + } + + public void setImportepedagio(BigDecimal importepedagio) { + this.importepedagio = importepedagio; + } + + public BigDecimal getImporteoutros() { + return importeoutros; + } + + public void setImporteoutros(BigDecimal importeoutros) { + this.importeoutros = importeoutros; + } + + public BigDecimal getImporteseguro() { + return importeseguro; + } + + public void setImporteseguro(BigDecimal importeseguro) { + this.importeseguro = importeseguro; + } + + public String getTelaAlternativa() { + return telaAlternativa; + } + + public void setTelaAlternativa(String telaAlternativa) { + this.telaAlternativa = telaAlternativa; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarifaEmbarcadaHist.java b/src/com/rjconsultores/ventaboletos/entidad/TarifaEmbarcadaHist.java new file mode 100644 index 000000000..76e9c8cc6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarifaEmbarcadaHist.java @@ -0,0 +1,179 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TARIFA_EMBARCADA_HIST_SEQ", sequenceName = "TARIFA_EMBARCADA_HIST_SEQ", allocationSize=1) +@Table(name = "TARIFA_EMBARCADA_HIST") +public class TarifaEmbarcadaHist implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_EMBARCADA_HIST_SEQ") + @Column(name = "TARIFAEMBARCADAHIST_ID") + private Long tarifaembarcadahistId; + @Column(name = "PRECIO") + private BigDecimal precio; + @Column(name = "PRECIOORIGINAL") + private BigDecimal preciooriginal; + @Column(name = "STATUSTARIFA") + private String statustarifa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "VIGENCIATARIFA_ID", referencedColumnName = "VIGENCIATARIFA_ID") + @ManyToOne + private VigenciaTarifa vigenciaTarifa; + @JoinColumn(name = "MONEDA_ID", referencedColumnName = "MONEDA_ID") + @ManyToOne + private Moneda moneda; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public TarifaEmbarcadaHist() { + } + + public TarifaEmbarcadaHist(Long tarifaembarcadahistId) { + this.tarifaembarcadahistId = tarifaembarcadahistId; + } + + public Long getTarifaembarcadahistId() { + return tarifaembarcadahistId; + } + + public void setTarifaembarcadahistId(Long tarifaembarcadahistId) { + this.tarifaembarcadahistId = tarifaembarcadahistId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getPreciooriginal() { + return preciooriginal; + } + + public void setPreciooriginal(BigDecimal preciooriginal) { + this.preciooriginal = preciooriginal; + } + + public String getStatustarifa() { + return statustarifa; + } + + public void setStatustarifa(String statustarifa) { + this.statustarifa = statustarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public VigenciaTarifa getVigenciaTarifa() { + return vigenciaTarifa; + } + + public void setVigenciaTarifa(VigenciaTarifa vigenciaTarifa) { + this.vigenciaTarifa = vigenciaTarifa; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifaembarcadahistId != null ? tarifaembarcadahistId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarifaEmbarcadaHist)) { + return false; + } + TarifaEmbarcadaHist other = (TarifaEmbarcadaHist) object; + if ((this.tarifaembarcadahistId == null && other.tarifaembarcadahistId != null) || (this.tarifaembarcadahistId != null && !this.tarifaembarcadahistId.equals(other.tarifaembarcadahistId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaEmbarcadaHist[tarifaembarcadahistId=" + tarifaembarcadahistId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarifaHist.java b/src/com/rjconsultores/ventaboletos/entidad/TarifaHist.java new file mode 100644 index 000000000..237d5c101 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarifaHist.java @@ -0,0 +1,183 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "TARIFA_HIST_SEQ", sequenceName = "TARIFA_HIST_SEQ", allocationSize=1) +@Table(name = "TARIFA_HIST") +public class TarifaHist implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_HIST_SEQ") + @Column(name = "TARIFAHIST_ID") + private Long tarifahistId; + @Column(name = "PRECIO") + private BigDecimal precio; + @Column(name = "PRECIOORIGINAL") + private BigDecimal preciooriginal; + @Column(name = "STATUSTARIFA") + private String statustarifa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "VIGENCIATARIFA_ID", referencedColumnName = "VIGENCIATARIFA_ID") + @ManyToOne + private VigenciaTarifa vigenciaTarifa; + @JoinColumn(name = "MONEDA_ID", referencedColumnName = "MONEDA_ID") + @ManyToOne + private Moneda moneda; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public TarifaHist() { + } + + public TarifaHist(Long tarifahistId) { + this.tarifahistId = tarifahistId; + } + + public Long getTarifahistId() { + return tarifahistId; + } + + public void setTarifahistId(Long tarifahistId) { + this.tarifahistId = tarifahistId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getPreciooriginal() { + return preciooriginal; + } + + public void setPreciooriginal(BigDecimal preciooriginal) { + this.preciooriginal = preciooriginal; + } + + public String getStatustarifa() { + return statustarifa; + } + + public void setStatustarifa(String statustarifa) { + this.statustarifa = statustarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public VigenciaTarifa getVigenciaTarifa() { + return vigenciaTarifa; + } + + public void setVigenciaTarifa(VigenciaTarifa vigenciaTarifa) { + this.vigenciaTarifa = vigenciaTarifa; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifahistId != null ? tarifahistId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarifaHist)) { + return false; + } + TarifaHist other = (TarifaHist) object; + if ((this.tarifahistId == null && other.tarifahistId != null) || (this.tarifahistId != null && !this.tarifahistId.equals(other.tarifahistId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaHist[tarifahistId=" + tarifahistId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarifaKm.java b/src/com/rjconsultores/ventaboletos/entidad/TarifaKm.java new file mode 100644 index 000000000..31d7e5294 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarifaKm.java @@ -0,0 +1,157 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** +* +* @author daniel.zauli +*/ +@Entity +@SequenceGenerator(name = "TARIFA_KM_SEQ", sequenceName = "TARIFA_KM_SEQ", allocationSize = 1) +@Table(name = "TARIFA_KM") +public class TarifaKm implements Serializable, Comparable{ + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_KM_SEQ") + @Column(name = "TARIFAKM_ID") + private Integer tarifakmId; + + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgaoconcedenteId; + + @Column(name = "KMATE") + private BigDecimal kmate; + + // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation + @Column(name = "VALORTAXA") // tarifa + private BigDecimal valortaxa; + + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TarifaKm(){} + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifakmId != null ? tarifakmId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarifaKm)) { + return false; + } + TarifaKm other = (TarifaKm) object; + if ((this.tarifakmId == null && other.tarifakmId != null) || (this.tarifakmId != null && !this.tarifakmId.equals(other.tarifakmId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaKm[ tarifakmId=" + tarifakmId + " ]"; + } + + public Integer getTarifakmId() { + return tarifakmId; + } + + public void setTarifakmId(Integer tarifakmId) { + this.tarifakmId = tarifakmId; + } + + public OrgaoConcedente getOrgaoconcedenteId() { + return orgaoconcedenteId; + } + + public void setOrgaoconcedenteId(OrgaoConcedente orgaoconcedenteId) { + this.orgaoconcedenteId = orgaoconcedenteId; + } + + public BigDecimal getKmate() { + return kmate; + } + + public void setKmate(BigDecimal kmate) { + this.kmate = kmate; + } + + public BigDecimal getValortaxa() { + return valortaxa; + } + + public void setValortaxa(BigDecimal valortaxa) { + this.valortaxa = valortaxa; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int compareTo(TarifaKm tkm) { + return this.getKmate().intValue() - tkm.getKmate().intValue(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarifaMinima.java b/src/com/rjconsultores/ventaboletos/entidad/TarifaMinima.java new file mode 100644 index 000000000..b122baebc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarifaMinima.java @@ -0,0 +1,262 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.Where; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "TARIFA_MINIMA_SEQ", sequenceName = "TARIFA_MINIMA_SEQ", allocationSize = 1) +@Table(name = "TARIFA_MINIMA") +public class TarifaMinima implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_MINIMA_SEQ") + @Column(name = "TARIFAMINIMA_ID") + private Integer tarifaminimaId; + @Column(name = "IMPORTETARIFA") + private BigDecimal importetarifa; + @OneToOne + @JoinColumn(name = "PLAZA_ID") + private Plaza plaza; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + @OneToOne + @JoinColumn(name = "MARCA_ID") + private Marca marca; + @OneToOne + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + private Parada origem; + @OneToOne + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + private Parada destino; + @OneToOne + @JoinColumn(name = "MONEDA_ID", referencedColumnName = "MONEDA_ID") + private Moneda moneda; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @OneToMany(mappedBy = "tarifaMinima") + @Where(clause = "ACTIVO = 1") + private List tarifaMinimaCategorias; + + @OneToOne + @JoinColumn(name = "VIGENCIATARIFA_ID") + private VigenciaTarifa vigenciaTarifa; + + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + + @JoinColumn(name = "REGIONMETROPOLITANA_ID", referencedColumnName = "REGIONMETROPOLITANA_ID") + @ManyToOne + private RegionMetropolitana regionMetropolitana; + + @JoinColumn(name = "COEFICIENTETARIFA_ID", referencedColumnName = "COEFICIENTETARIFA_ID") + @ManyToOne + private CoeficienteTarifa coeficienteTarifa; + + public TarifaMinima() { + } + + public TarifaMinima(Integer tarifaminimaId) { + this.tarifaminimaId = tarifaminimaId; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public Integer getTarifaminimaId() { + return tarifaminimaId; + } + + public void setTarifaminimaId(Integer tarifaminimaId) { + this.tarifaminimaId = tarifaminimaId; + } + + public BigDecimal getImportetarifa() { + return importetarifa; + } + + public void setImportetarifa(BigDecimal importetarifa) { + this.importetarifa = importetarifa; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Plaza getPlaza() { + return plaza; + } + + public void setPlaza(Plaza plaza) { + this.plaza = plaza; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifaminimaId != null ? tarifaminimaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarifaMinima)) { + return false; + } + TarifaMinima other = (TarifaMinima) object; + if ((this.tarifaminimaId == null && other.tarifaminimaId != null) || (this.tarifaminimaId != null && !this.tarifaminimaId.equals(other.tarifaminimaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaMinima[tarifaminimaId=" + tarifaminimaId + "]"; + } + + public java.util.List getTarifaMinimaCategorias() { + return tarifaMinimaCategorias; + } + + public void setTarifaMinimaCategorias(java.util.List tarifaMinimaCategorias) { + this.tarifaMinimaCategorias = tarifaMinimaCategorias; + } + + public VigenciaTarifa getVigenciaTarifa() { + return vigenciaTarifa; + } + + public void setVigenciaTarifa(VigenciaTarifa vigenciaTarifa) { + this.vigenciaTarifa = vigenciaTarifa; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public RegionMetropolitana getRegionMetropolitana() { + return regionMetropolitana; + } + + public void setRegionMetropolitana(RegionMetropolitana regionMetropolitana) { + this.regionMetropolitana = regionMetropolitana; + } + + public CoeficienteTarifa getCoeficienteTarifa() { + return coeficienteTarifa; + } + + public void setCoeficienteTarifa(CoeficienteTarifa coeficienteTarifa) { + this.coeficienteTarifa = coeficienteTarifa; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarifaMinimaCategoria.java b/src/com/rjconsultores/ventaboletos/entidad/TarifaMinimaCategoria.java new file mode 100644 index 000000000..1eb0a10f3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarifaMinimaCategoria.java @@ -0,0 +1,120 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TARIFA_MINIMA_CATEGORIA_SEQ", sequenceName = "TARIFA_MINIMA_CATEGORIA_SEQ", allocationSize = 1) +@Table(name = "TARIFA_MINIMA_CATEGORIA") +public class TarifaMinimaCategoria implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "TARIFAMINIMACATEGORIA_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_MINIMA_CATEGORIA_SEQ") + private Long tarifaminimacategoriaId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CATEGORIA_ID") + private Categoria categoria; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "TARIFAMINIMA_ID") + private TarifaMinima tarifaMinima; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Long getTarifaminimacategoriaId() { + return tarifaminimacategoriaId; + } + + public void setTarifaminimacategoriaId(Long tarifaminimacategoriaId) { + this.tarifaminimacategoriaId = tarifaminimacategoriaId; + } + + public Categoria getCategoria() { + return categoria; + } + + public void setCategoria(Categoria categoria) { + this.categoria = categoria; + } + + public TarifaMinima getTarifaMinima() { + return tarifaMinima; + } + + public void setTarifaMinima(TarifaMinima tarifaMinima) { + this.tarifaMinima = tarifaMinima; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((tarifaminimacategoriaId == null) ? 0 : tarifaminimacategoriaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + TarifaMinimaCategoria other = (TarifaMinimaCategoria) obj; + if (categoria == null) { + if (other.categoria != null) + return false; + } else if (!categoria.equals(other.categoria)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarifaOficial.java b/src/com/rjconsultores/ventaboletos/entidad/TarifaOficial.java new file mode 100644 index 000000000..06dc2a4b4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarifaOficial.java @@ -0,0 +1,370 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import br.com.rjconsultores.auditador.annotations.AuditarAtributo; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarID; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@Entity +@SequenceGenerator(name = "TARIFA_OFICIAL_SEQ", sequenceName = "TARIFA_OFICIAL_SEQ", allocationSize = 1) +@Table(name = "TARIFA_OFICIAL") +@AuditarClasse(nome = "TARIFA", tela = "Alteração de Preço / Tarifa Oficial") +public class TarifaOficial implements Serializable, Auditavel { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_OFICIAL_SEQ") + @Column(name = "TARIFAOFICIAL_ID") + @AuditarID + private Integer tarifaOficialId; + + @Column(name = "PRECIO") + @AuditarAtributo(nome = "Tarifa") + private BigDecimal precio; + + @Column(name = "PRECIOORIGINAL") + @AuditarAtributo(nome = "Tarifa Original") + private BigDecimal preciooriginal; + + @Column(name = "IMPORTETAXAEMBARQUE") + @AuditarAtributo(nome = "Taxa de Embarque") + private BigDecimal importetaxaembarque; + + @Column(name = "IMPORTEPEDAGIO") + @AuditarAtributo(nome = "Pedagio") + private BigDecimal importepedagio; + + @Column(name = "IMPORTEOUTROS") + @AuditarAtributo(nome = "Outros") + private BigDecimal importeoutros; + + @Column(name = "IMPORTESEGURO") + @AuditarAtributo(nome = "Seguro") + private BigDecimal importeseguro; + + @Column(name = "IMPORTETPP") + @AuditarAtributo(nome = "Tarifa TPP") + private BigDecimal importetpp; + + @Column(name = "STATUSTARIFA") + @AuditarAtributo(nome = "Status Tarifa") + private String statustarifa; + + @Column(name = "ACTIVO") + @NaoAuditar + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + @NaoAuditar + private Date fecmodif; + + @Column(name = "USUARIO_ID") + @NaoAuditar + private Integer usuarioId; + + @OneToOne + @JoinColumn(name = "TRAMO_ID") + @NaoAuditar + private Tramo tramo; + + @OneToOne + @JoinColumn(name = "MARCA_ID") + @NaoAuditar + private Marca marca; + + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + @NaoAuditar + private ClaseServicio claseServicio; + + @OneToOne + @JoinColumn(name = "MONEDA_ID") + @NaoAuditar + private Moneda moneda; + + @OneToOne + @JoinColumn(name = "VIGENCIATARIFA_ID") + @NaoAuditar + private VigenciaTarifa vigenciaTarifa; + + @Column(name = "PRECIOREDABIERTO") + @AuditarAtributo(nome = "Tarifa volta em aberto") + private BigDecimal precioredabierto; + + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + @NaoAuditar + private Parada origen; + + @OneToOne + @JoinColumn(name = "DESTINO_ID") + @NaoAuditar + private Parada destino; + + @OneToOne + @JoinColumn(name = "RUTA_ID") + @NaoAuditar + private Ruta ruta; + + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + @NaoAuditar + private OrgaoConcedente orgaoConcedente; + + @Transient + @NaoAuditar + private TarifaOficial tarifaOficialClone; + + @Transient + private Integer empresaId; + + public TarifaOficial() { + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public BigDecimal getImportetpp() { + return importetpp; + } + + public void setImportetpp(BigDecimal importetpp) { + this.importetpp = importetpp; + } + + public Integer getTarifaOficialId() { + return tarifaOficialId; + } + + public void setTarifaOficialId(Integer tarifaOficialId) { + this.tarifaOficialId = tarifaOficialId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getPreciooriginal() { + return preciooriginal; + } + + public void setPreciooriginal(BigDecimal preciooriginal) { + this.preciooriginal = preciooriginal; + } + + public String getStatustarifa() { + return statustarifa; + } + + public void setStatustarifa(String statustarifa) { + this.statustarifa = statustarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Moneda getMoneda() { + return moneda; + } + + public void setMoneda(Moneda moneda) { + this.moneda = moneda; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public VigenciaTarifa getVigenciaTarifa() { + return vigenciaTarifa; + } + + public void setVigenciaTarifa(VigenciaTarifa vigenciaTarifa) { + this.vigenciaTarifa = vigenciaTarifa; + } + + public BigDecimal getPrecioredabierto() { + return precioredabierto; + } + + public void setPrecioredabierto(BigDecimal precioredabierto) { + this.precioredabierto = precioredabierto; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifaOficialId != null ? tarifaOficialId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof TarifaOficial)) { + return false; + } + TarifaOficial other = (TarifaOficial) object; + if ((this.tarifaOficialId == null && other.tarifaOficialId != null) || (this.tarifaOficialId != null && !this.tarifaOficialId.equals(other.tarifaOficialId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaOficial[tarifaOficialId=" + tarifaOficialId + "]"; + } + + public BigDecimal getImportetaxaembarque() { + return importetaxaembarque; + } + + public void setImportetaxaembarque(BigDecimal importetaxaembarque) { + this.importetaxaembarque = importetaxaembarque; + } + + public BigDecimal getImportepedagio() { + return importepedagio; + } + + public void setImportepedagio(BigDecimal importepedagio) { + this.importepedagio = importepedagio; + } + + public BigDecimal getImporteoutros() { + return importeoutros; + } + + public void setImporteoutros(BigDecimal importeoutros) { + this.importeoutros = importeoutros; + } + + public BigDecimal getImporteseguro() { + return importeseguro; + } + + public void setImporteseguro(BigDecimal importeseguro) { + this.importeseguro = importeseguro; + } + + @Override + public void clonar() throws CloneNotSupportedException { + tarifaOficialClone = new TarifaOficial(); + tarifaOficialClone = (TarifaOficial) this.clone(); + tarifaOficialClone.setEmpresaId(this.getMarca() != null && this.getMarca().getEmpresa() != null ? this.getMarca().getEmpresa().getEmpresaId() : null); + } + + @Override + public TarifaOficial getCloneObject() throws CloneNotSupportedException { + return tarifaOficialClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getTarifaOficialId()); + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarifaTipoptovta.java b/src/com/rjconsultores/ventaboletos/entidad/TarifaTipoptovta.java new file mode 100644 index 000000000..b3fda13aa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarifaTipoptovta.java @@ -0,0 +1,156 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@Table(name = "TARIFA_TIPOPTOVTA") +@SequenceGenerator(name = "TARIFA_TIPOPTOVTA_SEQ", sequenceName = "TARIFA_TIPOPTOVTA_SEQ", allocationSize = 1) +public class TarifaTipoptovta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARIFA_TIPOPTOVTA_SEQ") + @Column(name = "TARIFATIPOPTOVTA_ID") + private Integer tarifatipoptovtaId; + @Column(name = "PRECIO") + private BigDecimal precio; + @Column(name = "PRECIOREDABIERTO") + private BigDecimal precioredabierto; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "TIPOPTOVTA_ID") + private TipoPuntoVenta tipoPuntoVenta; + @JoinColumn(name = "TARIFA_ID", referencedColumnName = "TARIFA_ID") + @ManyToOne(fetch=FetchType.LAZY) + private Tarifa tarifa; + + public TarifaTipoptovta() { + } + + public TarifaTipoptovta(Integer tarifatipoptovtaId) { + this.tarifatipoptovtaId = tarifatipoptovtaId; + } + + public Integer getTarifatipoptovtaId() { + return tarifatipoptovtaId; + } + + public void setTarifatipoptovtaId(Integer tarifatipoptovtaId) { + this.tarifatipoptovtaId = tarifatipoptovtaId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getPrecioredabierto() { + return precioredabierto; + } + + public void setPrecioredabierto(BigDecimal precioredabierto) { + this.precioredabierto = precioredabierto; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public TipoPuntoVenta getTipoPuntoVenta() { + return tipoPuntoVenta; + } + + public void setTipoPuntoVenta(TipoPuntoVenta tipoPuntoVenta) { + this.tipoPuntoVenta = tipoPuntoVenta; + } + + + + public Tarifa getTarifa() { + return tarifa; + } + + public void setTarifa(Tarifa tarifa) { + this.tarifa = tarifa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarifatipoptovtaId != null ? tarifatipoptovtaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarifaTipoptovta)) { + return false; + } + TarifaTipoptovta other = (TarifaTipoptovta) object; + if ((this.tarifatipoptovtaId == null && other.tarifatipoptovtaId != null) || (this.tarifatipoptovtaId != null && !this.tarifatipoptovtaId.equals(other.tarifatipoptovtaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarifaTipoptovta[tarifatipoptovtaId=" + tarifatipoptovtaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarifaVendaPacote.java b/src/com/rjconsultores/ventaboletos/entidad/TarifaVendaPacote.java new file mode 100644 index 000000000..9c7044d7b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarifaVendaPacote.java @@ -0,0 +1,145 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; + +@Entity +@SequenceGenerator(name = "TARIFA_VENDA_PACOTE_SEQ", sequenceName = "TARIFA_VENDA_PACOTE_SEQ", allocationSize = 1) +@Table(name = "TARIFA_VENDA_PACOTE") +public class TarifaVendaPacote implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "TARIFAVENDAPACOTE_ID") + private Long tarifavendapacoteId; + + @Column(name = "VALOR") + private BigDecimal valor; + + @ManyToOne + @JoinColumn(name = "VENDAPACOTE_ID") + private VendaPacote vendaPacote; + + @ManyToOne + @JoinColumn(name = "PACOTETARIFA_ID") + private PacoteTarifa pacoteTarifa; + + @Column(name = "NOMEPASSAGEIRO") + private String nomepassageiro; + + @Column(name = "DOCUMENTO") + private String documento; + + @Column(name = "TIPODOC") + private String tipodoc; + + @Column(name = "IDIOMA") + private String idioma; + + @Column(name = "DESCEMAIL") + private String descemail; + + @Column(name = "DESCTELEFONE") + private String desctelefone; + + @Column(name = "NOMCONVENIO") + private String nomconvenio; + + public Long getTarifavendapacoteId() { + return tarifavendapacoteId; + } + + public void setTarifavendapacoteId(Long tarifavendapacoteId) { + this.tarifavendapacoteId = tarifavendapacoteId; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public VendaPacote getVendaPacote() { + return vendaPacote; + } + + public void setVendaPacote(VendaPacote vendaPacote) { + this.vendaPacote = vendaPacote; + } + + public PacoteTarifa getPacoteTarifa() { + return pacoteTarifa; + } + + public void setPacoteTarifa(PacoteTarifa pacoteTarifa) { + this.pacoteTarifa = pacoteTarifa; + } + + public String getNomepassageiro() { + return nomepassageiro; + } + + public void setNomepassageiro(String nomepassageiro) { + this.nomepassageiro = nomepassageiro; + } + + public String getDocumento() { + return documento; + } + + public void setDocumento(String documento) { + this.documento = documento; + } + + public String getTipodoc() { + return tipodoc; + } + + public void setTipodoc(String tipodoc) { + this.tipodoc = tipodoc; + } + + public String getIdioma() { + return idioma; + } + + public void setIdioma(String idioma) { + this.idioma = idioma; + } + + public String getDescemail() { + return descemail; + } + + public void setDescemail(String descemail) { + this.descemail = descemail; + } + + public String getDesctelefone() { + return desctelefone; + } + + public void setDesctelefone(String desctelefone) { + this.desctelefone = desctelefone; + } + + public String getNomconvenio() { + return nomconvenio; + } + + public void setNomconvenio(String nomconvenio) { + this.nomconvenio = nomconvenio; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarjetaCredito.java b/src/com/rjconsultores/ventaboletos/entidad/TarjetaCredito.java new file mode 100644 index 000000000..24461299b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarjetaCredito.java @@ -0,0 +1,146 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TARJETA_CREDITO_SEQ", sequenceName = "TARJETA_CREDITO_SEQ", allocationSize = 1) +@Table(name = "TARJETA_CREDITO") +public class TarjetaCredito implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARJETA_CREDITO_SEQ") + @Column(name = "TARJETACREDITO_ID") + private Integer tarjetaCreditoId; + @Column(name = "DESCTARJETACREDITO") + private String descTarjetaCredito; + @Column(name = "CANTMAXSINTASA") + private Integer cantMaxSinTasa; + @Column(name = "CANMAXCONTASA") + private Integer canMaxConTasa; + @Column(name = "TASA") + private BigDecimal tasa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + public Integer getTarjetaCreditoId() { + return tarjetaCreditoId; + } + + public void setTarjetaCreditoId(Integer tarjetaCreditoId) { + this.tarjetaCreditoId = tarjetaCreditoId; + } + + public String getDescTarjetaCredito() { + return descTarjetaCredito; + } + + public void setDescTarjetaCredito(String descTarjetaCredito) { + this.descTarjetaCredito = descTarjetaCredito; + } + + public Integer getCantMaxSinTasa() { + return cantMaxSinTasa; + } + + public void setCantMaxSinTasa(Integer cantMaxSinTasa) { + this.cantMaxSinTasa = cantMaxSinTasa; + } + + public Integer getCanMaxConTasa() { + return canMaxConTasa; + } + + public void setCanMaxConTasa(Integer canMaxConTasa) { + this.canMaxConTasa = canMaxConTasa; + } + + public BigDecimal getTasa() { + return tasa; + } + + public void setTasa(BigDecimal tasa) { + this.tasa = tasa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((tarjetaCreditoId == null) ? 0 : tarjetaCreditoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + TarjetaCredito other = (TarjetaCredito) obj; + if (tarjetaCreditoId == null) { + if (other.tarjetaCreditoId != null) + return false; + } else if (!tarjetaCreditoId.equals(other.tarjetaCreditoId)) + return false; + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidad.java b/src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidad.java new file mode 100644 index 000000000..0b0d517bd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidad.java @@ -0,0 +1,119 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "TARJETA_FIDELIDAD_SEQ", sequenceName = "TARJETA_FIDELIDAD_SEQ", allocationSize = 1) +@Table(name = "TARJETA_FIDELIDAD") +public class TarjetaFidelidad implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TARJETA_FIDELIDAD_SEQ") + @Column(name = "TARJETAFIDELIDAD_ID") + private Integer tarjetaFidelidadId; + @Column(name = "NUMTARJETA") + private String numTarjeta; + @Column(name = "DESCGENERACION") + private String descGeneracion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getDescGeneracion() { + return descGeneracion; + } + + public void setDescGeneracion(String descGeneracion) { + this.descGeneracion = descGeneracion; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public String getNumTarjeta() { + return numTarjeta; + } + + public void setNumTarjeta(String numTarjeta) { + this.numTarjeta = numTarjeta; + } + + public Integer getTarjetaFidelidadId() { + return tarjetaFidelidadId; + } + + public void setTarjetaFidelidadId(Integer tarjetaFidelidadId) { + this.tarjetaFidelidadId = tarjetaFidelidadId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarjetaFidelidadId != null ? tarjetaFidelidadId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof TarjetaFidelidad)) { + return false; + } + TarjetaFidelidad other = (TarjetaFidelidad) object; + if ((this.tarjetaFidelidadId == null && other.tarjetaFidelidadId != null) || (this.tarjetaFidelidadId != null && !this.tarjetaFidelidadId.equals(other.tarjetaFidelidadId))) { + return false; + } + return true; + } + + @Override + public String toString() { + // return "com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad[tarjetaFidelidadId=" + tarjetaFidelidadId + "]"; + return this.getDescGeneracion(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidadCuenta.java b/src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidadCuenta.java new file mode 100644 index 000000000..bcf410bc2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarjetaFidelidadCuenta.java @@ -0,0 +1,38 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +/** + * + * @author Shiro + */ +public class TarjetaFidelidadCuenta { + + private String descGeneracion; + private Integer cantidad; + + public TarjetaFidelidadCuenta(){ + } + public Integer getCantidad() { + return cantidad; + } + + public void setCantidad(Integer cantidad) { + this.cantidad = cantidad; + } + + public String getDescGeneracion() { + return descGeneracion; + } + + public void setDescGeneracion(String descGeneracion) { + this.descGeneracion = descGeneracion; + } + @Override + public String toString() { + //return "com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad[tarjetaFidelidadId=" + tarjetaFidelidadId + "]"; + return this.getDescGeneracion(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacion.java b/src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacion.java new file mode 100644 index 000000000..0b7033c07 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacion.java @@ -0,0 +1,222 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import javax.persistence.Column; +import javax.persistence.EmbeddedId; +import javax.persistence.Entity; +import javax.persistence.JoinColumn; +import javax.persistence.JoinColumns; +import javax.persistence.OneToOne; +import javax.persistence.Table; + +/** + * + * @author Administrador + */ +@Entity +@Table(name = "TARJETAS_RECAUDACION") +public class TarjetaRecaudacion implements Serializable { + + private static final long serialVersionUID = 1L; + @EmbeddedId + protected TarjetaRecaudacionPK tarjetasRecaudacionPK; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "INGRESO_CORRIDA") + private Double ingresoCorrida; + @Column(name = "PAGADO") + private Boolean pagado; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @OneToOne + @JoinColumn(name = "AUTOBUS_ID") + private Autobus autobus; + @OneToOne + @JoinColumn(name = "CLASESERVICIO_ID") + private ClaseServicio claseServicio; + @OneToOne + @JoinColumn(name = "MARCA_ID") + private Marca marca; + @Column(name = "ACTUALIZAR") + private Boolean actualizar; + @Column(name = "OBSERVACIONES") + private String observaciones; + @Column(name = "CONDUCTOR_ID") + private Integer conductorId; + @OneToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origen; + @OneToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + @Column(name = "ACTIVO") + private Boolean activo; + @OneToOne + @JoinColumns({ + @JoinColumn(name = "CORRIDA_ID", referencedColumnName = "CORRIDA_ID"), + @JoinColumn(name = "FECCORRIDA", referencedColumnName = "FECCORRIDA") + }) + private Corrida corrida; + + public TarjetaRecaudacion() { + } + + public TarjetaRecaudacion(TarjetaRecaudacionPK tarjetasRecaudacionPK) { + this.tarjetasRecaudacionPK = tarjetasRecaudacionPK; + } + + public TarjetaRecaudacion(Integer tarjetarecaudacionId, Boolean manual) { + this.tarjetasRecaudacionPK = new TarjetaRecaudacionPK(tarjetarecaudacionId, manual); + } + + public TarjetaRecaudacionPK getTarjetasRecaudacionPK() { + return tarjetasRecaudacionPK; + } + + public void setTarjetasRecaudacionPK(TarjetaRecaudacionPK tarjetasRecaudacionPK) { + this.tarjetasRecaudacionPK = tarjetasRecaudacionPK; + } + + public Double getIngresoCorrida() { + return ingresoCorrida; + } + + public void setIngresoCorrida(Double ingresoCorrida) { + this.ingresoCorrida = ingresoCorrida; + } + + public Boolean getPagado() { + return pagado; + } + + public void setPagado(Boolean pagado) { + this.pagado = pagado; + } + + public Boolean getActualizar() { + return actualizar; + } + + public void setActualizar(Boolean actualizar) { + this.actualizar = actualizar; + } + + public String getObservaciones() { + return observaciones; + } + + public void setObservaciones(String observaciones) { + this.observaciones = observaciones; + } + + public Integer getConductorId() { + return conductorId; + } + + public void setConductorId(Integer conductorId) { + this.conductorId = conductorId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Autobus getAutobus() { + return autobus; + } + + public void setAutobus(Autobus autobus) { + this.autobus = autobus; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Corrida getCorrida() { + return corrida; + } + + public void setCorrida(Corrida corrida) { + this.corrida = corrida; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarjetasRecaudacionPK != null ? tarjetasRecaudacionPK.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarjetaRecaudacion)) { + return false; + } + TarjetaRecaudacion other = (TarjetaRecaudacion) object; + if ((this.tarjetasRecaudacionPK == null && other.tarjetasRecaudacionPK != null) || (this.tarjetasRecaudacionPK != null && !this.tarjetasRecaudacionPK.equals(other.tarjetasRecaudacionPK))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarjetasRecaudacion[ tarjetasRecaudacionPK=" + tarjetasRecaudacionPK + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacionPK.java b/src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacionPK.java new file mode 100644 index 000000000..a64771941 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarjetaRecaudacionPK.java @@ -0,0 +1,80 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Embeddable; + +/** + * + * @author Administrador + */ +@Embeddable +public class TarjetaRecaudacionPK implements Serializable { + + private static final long serialVersionUID = 1L; + @Basic(optional = false) + @Column(name = "TARJETARECAUDACION_ID") + private Integer tarjetarecaudacionId; + @Basic(optional = false) + @Column(name = "MANUAL") + private Boolean manual; + + public TarjetaRecaudacionPK() { + } + + public TarjetaRecaudacionPK(Integer tarjetarecaudacionId, Boolean manual) { + this.tarjetarecaudacionId = tarjetarecaudacionId; + this.manual = manual; + } + + public Integer getTarjetarecaudacionId() { + return tarjetarecaudacionId; + } + + public void setTarjetarecaudacionId(Integer tarjetarecaudacionId) { + this.tarjetarecaudacionId = tarjetarecaudacionId; + } + + public Boolean getManual() { + return manual; + } + + public void setManual(Boolean manual) { + this.manual = manual; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarjetarecaudacionId != null ? tarjetarecaudacionId.hashCode() : 0); + hash += (manual != null ? manual.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof TarjetaRecaudacionPK)) { + return false; + } + TarjetaRecaudacionPK other = (TarjetaRecaudacionPK) object; + if ((this.tarjetarecaudacionId == null && other.tarjetarecaudacionId != null) || (this.tarjetarecaudacionId != null && !this.tarjetarecaudacionId.equals(other.tarjetarecaudacionId))) { + return false; + } + if ((this.manual == null && other.manual != null) || (this.manual != null && !this.manual.equals(other.manual))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TarjetasRecaudacionPK[ tarjetarecaudacionId=" + tarjetarecaudacionId + ", manual=" + manual + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarjetaViaje.java b/src/com/rjconsultores/ventaboletos/entidad/TarjetaViaje.java new file mode 100644 index 000000000..431d4b257 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TarjetaViaje.java @@ -0,0 +1,324 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author cassio + */ +@Entity +@Table(name = "TARJETA_VIAJE") +@NamedQueries({ + @NamedQuery(name = "TarjetaViaje.findAll", query = "SELECT t FROM TarjetaViaje t")}) +public class TarjetaViaje implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO) + @Column(name = "TARJETAVIAJE_ID", nullable = false) + private Integer tarjetaviajeId; + @Column(name = "NUMSECUENCIA") + private Integer numsecuencia; + @Column(name = "INDREBOTE") + private Integer indRebote; + @Column(name = "INDSTATUSTARJETA", length = 20) + private String indstatustarjeta; + @Column(name = "FOLIOTARJETAVIAJE", length = 10) + private String foliotarjetaviaje; + @Column(name = "FECENVIONOMINA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecenvionomina; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") + @ManyToOne + private Marca marca; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @JoinColumn(name = "CONDUCTOR1_ID", referencedColumnName = "CONDUCTOR_ID") + @ManyToOne + private Conductor conductor; + @JoinColumn(name = "CONDUCTOR2_ID", referencedColumnName = "CONDUCTOR_ID") + @ManyToOne + private Conductor conductor1; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "AUTOBUS_ID", referencedColumnName = "AUTOBUS_ID") + @ManyToOne + private Autobus autobus; + private transient boolean eCorridaDuplicada; + @Column(name = "CANTKMREAL") + private BigDecimal kmReal; + @Column(name = "CANTKMPAGOCONDUCTOR") + private BigDecimal kmPagoConductor; + @Column(name = "TARJETAVIAJEREF_ID") + private BigDecimal tarjetaViajeRef; + @Column(name = "DESCPARADAORIGEN") + private String origen; + @Column(name = "DESCPARADADESTINO") + private String destino; + @Column(name = "FECCORRIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecInicial; + @Column(name = "FECHORSALIDA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecHorSalida; + @Column(name = "NUMCORRIDA") + private Integer numCorrida; + + public Integer getNumAutobusAux() { + return Integer.parseInt(this.autobus.getNumautobus()); + } + + public Integer getNumCorrida() { + return numCorrida; + } + + public void setNumCorrida(Integer numCorrida) { + this.numCorrida = numCorrida; + } + + public Integer getIndRebote() { + return indRebote; + } + + public void setIndRebote(Integer indRebote) { + this.indRebote = indRebote; + } + + public String getOrigen() { + return origen; + } + + public void setOrigen(String origen) { + this.origen = origen; + } + + public String getDestino() { + return destino; + } + + public void setDestino(String destino) { + this.destino = destino; + } + + public Date getFecInicial() { + return fecInicial; + } + + public void setFecInicial(Date fecInicial) { + this.fecInicial = fecInicial; + } + + public BigDecimal getTarjetaViajeRef() { + return tarjetaViajeRef; + } + + public void setTarjetaViajeRef(BigDecimal tarjetaViajeRef) { + this.tarjetaViajeRef = tarjetaViajeRef; + } + + public BigDecimal getKmReal() { + return kmReal; + } + + public void setKmReal(BigDecimal kmReal) { + this.kmReal = kmReal; + } + + public BigDecimal getKmPagoConductor() { + return kmPagoConductor; + } + + public void setKmPagoConductor(BigDecimal kmPagoConductor) { + this.kmPagoConductor = kmPagoConductor; + } + + public boolean geteCorridaDuplicada() { + return eCorridaDuplicada; + } + + public void seteCorridaDuplicada(boolean eCorridaDuplicada) { + this.eCorridaDuplicada = eCorridaDuplicada; + } + + public TarjetaViaje() { + } + + public TarjetaViaje(Integer tarjetaviajeId) { + this.tarjetaviajeId = tarjetaviajeId; + } + + public Integer getTarjetaviajeId() { + return tarjetaviajeId; + } + + public void setTarjetaviajeId(Integer tarjetaviajeId) { + this.tarjetaviajeId = tarjetaviajeId; + } + + public Integer getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Integer numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public String getIndstatustarjeta() { + return indstatustarjeta; + } + + public void setIndstatustarjeta(String indstatustarjeta) { + this.indstatustarjeta = indstatustarjeta; + } + + public String getFoliotarjetaviaje() { + return foliotarjetaviaje; + } + + public void setFoliotarjetaviaje(String foliotarjetaviaje) { + this.foliotarjetaviaje = foliotarjetaviaje; + } + + public Date getFecenvionomina() { + return fecenvionomina; + } + + public void setFecenvionomina(Date fecenvionomina) { + this.fecenvionomina = fecenvionomina; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Marca getMarca() { + return marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Conductor getConductor() { + return conductor; + } + + public void setConductor(Conductor conductor) { + this.conductor = conductor; + } + + public Conductor getConductor1() { + return conductor1; + } + + public void setConductor1(Conductor conductor1) { + this.conductor1 = conductor1; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Autobus getAutobus() { + return autobus; + } + + public void setAutobus(Autobus autobus) { + this.autobus = autobus; + } + + public Date getFecHorSalida() { + return fecHorSalida; + } + + public void setFecHorSalida(Date fecHorSalida) { + this.fecHorSalida = fecHorSalida; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tarjetaviajeId != null ? tarjetaviajeId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TarjetaViaje)) { + return false; + } + TarjetaViaje other = (TarjetaViaje) object; + if ((this.tarjetaviajeId == null && other.tarjetaviajeId != null) || (this.tarjetaviajeId != null && !this.tarjetaviajeId.equals(other.tarjetaviajeId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "entidadeteste.TarjetaViaje[tarjetaviajeId=" + tarjetaviajeId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevante.java b/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevante.java new file mode 100644 index 000000000..153e5d179 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevante.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TAXA_EMB_LEVANTE_SEQ", sequenceName = "TAXA_EMB_LEVANTE_SEQ", allocationSize = 1) +@Table(name = "TAXA_EMB_LEVANTE") +public class TaxaEmbLevante implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TAXA_EMB_LEVANTE_SEQ") + @Column(name = "TAXAEMBLEVANTE_ID") + private Integer taxaEmbLevanteId; + @JoinColumn(name = "TAXAEMBLEVANTECTRL_ID", referencedColumnName = "TAXAEMBLEVANTECTRL_ID") + @ManyToOne + private TaxaEmbLevanteCtrl taxaEmbLevanteCtrl; + @JoinColumn(name = "PARADA_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada parada; + @Column(name = "IMPORTE") + private BigDecimal importe; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TaxaEmbLevante() { + } + + public TaxaEmbLevante(Integer taxaEmbLevanteId) { + this.taxaEmbLevanteId = taxaEmbLevanteId; + } + + public TaxaEmbLevante(Integer taxaEmbLevanteId, BigDecimal importe, Boolean activo, Date fecmodif, Integer usuarioId) { + this.taxaEmbLevanteId = taxaEmbLevanteId; + this.importe = importe; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Integer getTaxaEmbLevanteId() { + return taxaEmbLevanteId; + } + + public void setTaxaEmbLevanteId(Integer taxaEmbLevanteId) { + this.taxaEmbLevanteId = taxaEmbLevanteId; + } + + public TaxaEmbLevanteCtrl getTaxaEmbLevanteCtrl() { + return taxaEmbLevanteCtrl; + } + + public void setTaxaEmbLevanteCtrl(TaxaEmbLevanteCtrl taxaEmbLevanteCtrl) { + this.taxaEmbLevanteCtrl = taxaEmbLevanteCtrl; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (taxaEmbLevanteId != null ? taxaEmbLevanteId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof TaxaEmbLevante)) { + return false; + } + TaxaEmbLevante other = (TaxaEmbLevante) object; + if ((this.taxaEmbLevanteId == null && other.taxaEmbLevanteId != null) || (this.taxaEmbLevanteId != null && !this.taxaEmbLevanteId.equals(other.taxaEmbLevanteId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TaxaEmbLevante[taxaEmbLevanteId=" + taxaEmbLevanteId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevanteCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevanteCtrl.java new file mode 100644 index 000000000..0cd599649 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbLevanteCtrl.java @@ -0,0 +1,157 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TAXA_EMB_LEVANTE_CTRL_SEQ", sequenceName = "TAXA_EMB_LEVANTE_CTRL_SEQ", allocationSize = 1) +@Table(name = "TAXA_EMB_LEVANTE_CTRL") +public class TaxaEmbLevanteCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TAXA_EMB_LEVANTE_CTRL_SEQ") + @Column(name = "TAXAEMBLEVANTECTRL_ID") + private Integer taxaEmbLevanteCtrlId; + @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") + @ManyToOne + private Ruta ruta; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "taxaEmbLevanteCtrl", cascade = CascadeType.ALL) + private List taxaEmbLevanteList; + + public TaxaEmbLevanteCtrl() { + } + + public TaxaEmbLevanteCtrl(Integer taxaEmbLevanteCtrlId) { + this.taxaEmbLevanteCtrlId = taxaEmbLevanteCtrlId; + } + + public Integer getTaxaEmbLevanteCtrlId() { + return taxaEmbLevanteCtrlId; + } + + public void setTaxaEmbLevanteCtrlId(Integer taxaEmbLevanteCtrlId) { + this.taxaEmbLevanteCtrlId = taxaEmbLevanteCtrlId; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getTaxaEmbLevanteList() { + if (this.taxaEmbLevanteList == null) + this.taxaEmbLevanteList = new ArrayList(); + + List list = new ArrayList(); + for (TaxaEmbLevante taxaEmbLevante : this.taxaEmbLevanteList) { + if (taxaEmbLevante.getActivo().equals(true)) { + list.add(taxaEmbLevante); + } + } + return list; + } + + public void setTaxaEmbLevanteList(List taxaEmbLevanteList) { + this.taxaEmbLevanteList = taxaEmbLevanteList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (taxaEmbLevanteCtrlId != null ? taxaEmbLevanteCtrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof TaxaEmbLevanteCtrl)) { + return false; + } + TaxaEmbLevanteCtrl other = (TaxaEmbLevanteCtrl) object; + if ((this.taxaEmbLevanteCtrlId == null && other.taxaEmbLevanteCtrlId != null) || (this.taxaEmbLevanteCtrlId != null && !this.taxaEmbLevanteCtrlId.equals(other.taxaEmbLevanteCtrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TaxaEmbLevanteCtrl[taxaEmbLevanteCtrlId=" + taxaEmbLevanteCtrlId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueKm.java b/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueKm.java new file mode 100644 index 000000000..f28f74703 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueKm.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "TAXA_EMBARQUE_KM_SEQ", sequenceName = "TAXA_EMBARQUE_KM_SEQ", allocationSize = 1) +@Table(name = "TAXA_EMBARQUE_KM") +public class TaxaEmbarqueKm implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TAXA_EMBARQUE_KM_SEQ") + @Column(name = "TAXAEMBARQUEKM_ID") + private Integer taxaembarquekmId; + @Column(name = "KMATE") + private Integer kmate; + // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation + @Column(name = "VALORTAXA") + private BigDecimal valortaxa; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgaoconcedenteId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TaxaEmbarqueKm() { + } + + public TaxaEmbarqueKm(Integer taxaembarquekmId) { + this.taxaembarquekmId = taxaembarquekmId; + } + + public Integer getTaxaembarquekmId() { + return taxaembarquekmId; + } + + public void setTaxaembarquekmId(Integer taxaembarquekmId) { + this.taxaembarquekmId = taxaembarquekmId; + } + + public Integer getKmate() { + return kmate; + } + + public void setKmate(Integer kmate) { + this.kmate = kmate; + } + + public BigDecimal getValortaxa() { + return valortaxa; + } + + public void setValortaxa(BigDecimal valortaxa) { + this.valortaxa = valortaxa; + } + + public OrgaoConcedente getOrgaoconcedenteId() { + return orgaoconcedenteId; + } + + public void setOrgaoconcedenteId(OrgaoConcedente orgaoconcedenteId) { + this.orgaoconcedenteId = orgaoconcedenteId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (taxaembarquekmId != null ? taxaembarquekmId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TaxaEmbarqueKm)) { + return false; + } + TaxaEmbarqueKm other = (TaxaEmbarqueKm) object; + if ((this.taxaembarquekmId == null && other.taxaembarquekmId != null) || (this.taxaembarquekmId != null && !this.taxaembarquekmId.equals(other.taxaembarquekmId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueKm[ taxaembarquekmId=" + taxaembarquekmId + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueParada.java b/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueParada.java new file mode 100644 index 000000000..c29152d49 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TaxaEmbarqueParada.java @@ -0,0 +1,180 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author gleimar + */ +@Entity +@SequenceGenerator(name = "TAXA_EMBARQUE_PARADA_SEQ", sequenceName = "TAXA_EMBARQUE_PARADA_SEQ", allocationSize = 1) +@Table(name = "TAXA_EMBARQUE_PARADA") +public class TaxaEmbarqueParada implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TAXA_EMBARQUE_PARADA_SEQ") + @Column(name = "TAXAEMBARQUEPARADA_ID") + private Integer taxaembarqueparadaId; + @Basic(optional = false) + @Column(name = "INDTIPO") + private char indtipo; + @Column(name = "KMATE") + private Integer kmate; + // @Max(value=?) @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation + @Column(name = "VALORTAXA") + private BigDecimal valortaxa; + @JoinColumn(name = "PARADA_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada paradaId; + @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") + @ManyToOne + private OrgaoConcedente orgaoconcedenteId; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TaxaEmbarqueParada() { + } + + public TaxaEmbarqueParada(Integer taxaembarqueparadaId) { + this.taxaembarqueparadaId = taxaembarqueparadaId; + } + + public TaxaEmbarqueParada(Integer taxaembarqueparadaId, char indtipo) { + this.taxaembarqueparadaId = taxaembarqueparadaId; + this.indtipo = indtipo; + } + + public Integer getTaxaembarqueparadaId() { + return taxaembarqueparadaId; + } + + public void setTaxaembarqueparadaId(Integer taxaembarqueparadaId) { + this.taxaembarqueparadaId = taxaembarqueparadaId; + } + + public char getIndtipo() { + return indtipo; + } + + public void setIndtipo(char indtipo) { + this.indtipo = indtipo; + } + + public Integer getKmate() { + return kmate; + } + + public void setKmate(Integer kmate) { + this.kmate = kmate; + } + + public BigDecimal getValortaxa() { + return valortaxa; + } + + public void setValortaxa(BigDecimal valortaxa) { + this.valortaxa = valortaxa; + } + + public Parada getParadaId() { + return paradaId; + } + + public void setParadaId(Parada paradaId) { + this.paradaId = paradaId; + } + + public OrgaoConcedente getOrgaoconcedenteId() { + return orgaoconcedenteId; + } + + public void setOrgaoconcedenteId(OrgaoConcedente orgaoconcedenteId) { + this.orgaoconcedenteId = orgaoconcedenteId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (taxaembarqueparadaId != null ? taxaembarqueparadaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TaxaEmbarqueParada)) { + return false; + } + TaxaEmbarqueParada other = (TaxaEmbarqueParada) object; + if ((this.taxaembarqueparadaId == null && other.taxaembarqueparadaId != null) || (this.taxaembarqueparadaId != null && !this.taxaembarqueparadaId.equals(other.taxaembarqueparadaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada[ taxaembarqueparadaId=" + taxaembarqueparadaId + " ]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoCambioCiudad.java b/src/com/rjconsultores/ventaboletos/entidad/TipoCambioCiudad.java new file mode 100644 index 000000000..382e47655 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoCambioCiudad.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "TIPO_CAMBIO_CIUDAD") +@SequenceGenerator(name = "TIPO_CAMBIO_CIUDAD_SEQ", sequenceName = "TIPO_CAMBIO_CIUDAD_SEQ", allocationSize = 1) +public class TipoCambioCiudad implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_CAMBIO_CIUDAD_SEQ") + @Column(name = "TIPOCAMBIOCIUDAD_ID") + private Integer tipocambiociudadId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "CIUDAD_ID", referencedColumnName = "CIUDAD_ID") + @ManyToOne + private Ciudad ciudad; + @JoinColumn(name = "TIPOCAMBIOCTRL_ID", referencedColumnName = "TIPOCAMBIOCTRL_ID") + @ManyToOne + private TipoCambioCtrl tipoCambioCtrl; + + public TipoCambioCiudad() { + } + + public TipoCambioCiudad(Integer tipocambiociudadId) { + this.tipocambiociudadId = tipocambiociudadId; + } + + public Integer getTipocambiociudadId() { + return tipocambiociudadId; + } + + public void setTipocambiociudadId(Integer tipocambiociudadId) { + this.tipocambiociudadId = tipocambiociudadId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Ciudad getCiudad() { + return ciudad; + } + + public void setCiudad(Ciudad ciudad) { + this.ciudad = ciudad; + } + + public TipoCambioCtrl getTipoCambioCtrl() { + return tipoCambioCtrl; + } + + public void setTipoCambioCtrl(TipoCambioCtrl tipoCambioCtrl) { + this.tipoCambioCtrl = tipoCambioCtrl; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipocambiociudadId != null ? tipocambiociudadId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoCambioCiudad)) { + return false; + } + TipoCambioCiudad other = (TipoCambioCiudad) object; + if ((this.tipocambiociudadId == null && other.tipocambiociudadId != null) || (this.tipocambiociudadId != null && !this.tipocambiociudadId.equals(other.tipocambiociudadId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.dao.TipoCambioCiudad[tipocambiociudadId=" + tipocambiociudadId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoCambioCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/TipoCambioCtrl.java new file mode 100644 index 000000000..0b5e1daf0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoCambioCtrl.java @@ -0,0 +1,173 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "TIPO_CAMBIO_CTRL") +@SequenceGenerator(name = "TIPO_CAMBIO_CTRL_SEQ", sequenceName = "TIPO_CAMBIO_CTRL_SEQ", allocationSize = 1) +public class TipoCambioCtrl implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_CAMBIO_CTRL_SEQ") + @Column(name = "TIPOCAMBIOCTRL_ID") + private Integer tipocambioctrlId; + @Column(name = "IMPORTECAMBIO") + private BigDecimal importecambio; + @Column(name = "FECAPLICACION") + @Temporal(TemporalType.TIMESTAMP) + private Date fecaplicacion; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TIPOCAMBIOCTRL_ID", referencedColumnName = "TIPOCAMBIOCTRL_ID") + private List tipoCambioCiudadList; + @JoinColumn(name = "MONEDADESTINO_ID", referencedColumnName = "MONEDA_ID") + @ManyToOne + private Moneda monedaDestino; + @JoinColumn(name = "MONEDAORIGEN_ID", referencedColumnName = "MONEDA_ID") + @ManyToOne + private Moneda monedaOrigen; + + public TipoCambioCtrl() { + } + + public TipoCambioCtrl(Integer tipocambioctrlId) { + this.tipocambioctrlId = tipocambioctrlId; + } + + public Integer getTipocambioctrlId() { + return tipocambioctrlId; + } + + public void setTipocambioctrlId(Integer tipocambioctrlId) { + this.tipocambioctrlId = tipocambioctrlId; + } + + public BigDecimal getImportecambio() { + return importecambio; + } + + public void setImportecambio(BigDecimal importecambio) { + this.importecambio = importecambio; + } + + public Date getFecaplicacion() { + return fecaplicacion; + } + + public void setFecaplicacion(Date fecaplicacion) { + this.fecaplicacion = fecaplicacion; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getTipoCambioCiudadList() { + List pcList = new ArrayList(); + for (TipoCambioCiudad pc : this.tipoCambioCiudadList) { + if (pc.getActivo() == Boolean.TRUE) { + pcList.add(pc); + } + } + return pcList; + } + + public void setTipoCambioCiudadList(List tipoCambioCiudadList) { + this.tipoCambioCiudadList = tipoCambioCiudadList; + } + + public Moneda getMonedaDestino() { + return monedaDestino; + } + + public void setMonedaDestino(Moneda monedaDestino) { + this.monedaDestino = monedaDestino; + } + + public Moneda getMonedaOrigen() { + return monedaOrigen; + } + + public void setMonedaOrigen(Moneda monedaOrigen) { + this.monedaOrigen = monedaOrigen; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipocambioctrlId != null ? tipocambioctrlId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoCambioCtrl)) { + return false; + } + TipoCambioCtrl other = (TipoCambioCtrl) object; + if ((this.tipocambioctrlId == null && other.tipocambioctrlId != null) || (this.tipocambioctrlId != null && !this.tipocambioctrlId.equals(other.tipocambioctrlId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.dao.TipoCambioCtrl[tipocambioctrlId=" + tipocambioctrlId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoConvenio.java b/src/com/rjconsultores/ventaboletos/entidad/TipoConvenio.java new file mode 100644 index 000000000..17bb84c78 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoConvenio.java @@ -0,0 +1,122 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "TIPO_CONVENIO_SEQ", sequenceName = "TIPO_CONVENIO_SEQ", allocationSize = 1) +@Table(name = "TIPO_CONVENIO") +public class TipoConvenio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_CONVENIO_SEQ") + @Column(name = "TIPOCONVENIO_ID") + private Integer tipoConvenioID; + @Column(name = "DESCTIPO") + private String descTipo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "tipoConvenio") + private List cuponConvenioList; + + public List getCuponConvenioList() { + return cuponConvenioList; + } + + public void setCuponConvenioList(List cuponConvenioList) { + this.cuponConvenioList = cuponConvenioList; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getDescTipo() { + return descTipo; + } + + public void setDescTipo(String descTipo) { + this.descTipo = descTipo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getTipoConvenioID() { + return tipoConvenioID; + } + + public void setTipoConvenioID(Integer tipoConvenioID) { + this.tipoConvenioID = tipoConvenioID; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoConvenioID != null ? tipoConvenioID.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoConvenio)) { + return false; + } + TipoConvenio other = (TipoConvenio) object; + if ((this.tipoConvenioID == null && other.tipoConvenioID != null) || (this.tipoConvenioID != null && !this.tipoConvenioID.equals(other.tipoConvenioID))) { + return false; + } + return true; + } + + @Override + public String toString() { + //return "com.rjconsultores.ventaboletos.entidad.Cortesia[cortesiaId=" + productoServicioID + "]"; + return this.getDescTipo(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoCorte.java b/src/com/rjconsultores/ventaboletos/entidad/TipoCorte.java new file mode 100644 index 000000000..6ab2e5ad2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoCorte.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TIPO_CORTE_SEQ", sequenceName = "TIPO_CORTE_SEQ", allocationSize = 1) +@Table(name = "TIPO_CORTE") +public class TipoCorte implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_CORTE_SEQ") + @Column(name = "TIPOCORTE_ID") + private Short tipocorteId; + @Column(name = "DESCTIPO") + private String desctipo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + + public TipoCorte() { + } + + public TipoCorte(Short tipocorteId) { + this.tipocorteId = tipocorteId; + } + + public Short getTipocorteId() { + return tipocorteId; + } + + public void setTipocorteId(Short tipocorteId) { + this.tipocorteId = tipocorteId; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipocorteId != null ? tipocorteId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoCorte)) { + return false; + } + TipoCorte other = (TipoCorte) object; + if ((this.tipocorteId == null && other.tipocorteId != null) || (this.tipocorteId != null && !this.tipocorteId.equals(other.tipocorteId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TipoCorte[tipocorteId=" + tipocorteId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoCortesia.java b/src/com/rjconsultores/ventaboletos/entidad/TipoCortesia.java new file mode 100644 index 000000000..a33cb8d57 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoCortesia.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "TIPO_CORTESIA_SEQ", sequenceName = "TIPO_CORTESIA_SEQ", allocationSize = 1) +@Table(name = "TIPO_CORTESIA") +public class TipoCortesia implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_CORTESIA_SEQ") + @Column(name = "TIPOCORTESIA_ID") + private Short tipocortesiaId; + @Column(name = "DESCTIPO") + private String desctipo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "tipoCortesia") + private List tipoCortesiaDescuentoList; + @JoinColumn(name = "GRUPOCORTESIA_ID", referencedColumnName = "GRUPOCORTESIA_ID") + @ManyToOne + private GrupoCortesia grupoCortesia; + + public TipoCortesia() { + } + + public TipoCortesia(Short tipocortesiaId) { + this.tipocortesiaId = tipocortesiaId; + } + + public Short getTipocortesiaId() { + return tipocortesiaId; + } + + public void setTipocortesiaId(Short tipocortesiaId) { + this.tipocortesiaId = tipocortesiaId; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getTipoCortesiaDescuentoList() { + return tipoCortesiaDescuentoList; + } + + public void setTipoCortesiaDescuentoList(List tipoCortesiaDescuentoList) { + this.tipoCortesiaDescuentoList = tipoCortesiaDescuentoList; + } + + public GrupoCortesia getGrupoCortesia() { + return grupoCortesia; + } + + public void setGrupoCortesia(GrupoCortesia grupoCortesia) { + this.grupoCortesia = grupoCortesia; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipocortesiaId != null ? tipocortesiaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoCortesia)) { + return false; + } + TipoCortesia other = (TipoCortesia) object; + if ((this.tipocortesiaId == null && other.tipocortesiaId != null) || (this.tipocortesiaId != null && !this.tipocortesiaId.equals(other.tipocortesiaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDesctipo(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoCortesiaDescuento.java b/src/com/rjconsultores/ventaboletos/entidad/TipoCortesiaDescuento.java new file mode 100644 index 000000000..62cc61f84 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoCortesiaDescuento.java @@ -0,0 +1,134 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.NotFound; +import org.hibernate.annotations.NotFoundAction; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "TIPOCORTESIA_DESCUENTO_SEQ", sequenceName = "TIPOCORTESIA_DESCUENTO_SEQ", allocationSize = 1) +@Table(name = "TIPOCORTESIA_DESCUENTO") +public class TipoCortesiaDescuento implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPOCORTESIA_DESCUENTO_SEQ") + @Column(name = "TIPOCORTESIADESCUENTO_ID") + private Integer tipocortesiadescuentoId; + @Column(name = "PORCDESCUENTO") + private BigDecimal porcdescuento; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TIPOCORTESIA_ID", referencedColumnName = "TIPOCORTESIA_ID") + @ManyToOne + @NotFound(action=NotFoundAction.IGNORE) + private TipoCortesia tipoCortesia; + + public TipoCortesiaDescuento() { + } + + public TipoCortesiaDescuento(Integer tipocortesiadescuentoId) { + this.tipocortesiadescuentoId = tipocortesiadescuentoId; + } + + public Integer getTipocortesiadescuentoId() { + return tipocortesiadescuentoId; + } + + public void setTipocortesiadescuentoId(Integer tipocortesiadescuentoId) { + this.tipocortesiadescuentoId = tipocortesiadescuentoId; + } + + public BigDecimal getPorcdescuento() { + return porcdescuento; + } + + public void setPorcdescuento(BigDecimal porcdescuento) { + this.porcdescuento = porcdescuento; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public TipoCortesia getTipoCortesia() { + return tipoCortesia; + } + + public void setTipoCortesia(TipoCortesia tipoCortesia) { + this.tipoCortesia = tipoCortesia; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipocortesiadescuentoId != null ? tipocortesiadescuentoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoCortesiaDescuento)) { + return false; + } + TipoCortesiaDescuento other = (TipoCortesiaDescuento) object; + if ((this.tipocortesiadescuentoId == null && other.tipocortesiadescuentoId != null) || (this.tipocortesiadescuentoId != null && !this.tipocortesiadescuentoId.equals(other.tipocortesiadescuentoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getPorcdescuento().toString(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoDocAutobus.java b/src/com/rjconsultores/ventaboletos/entidad/TipoDocAutobus.java new file mode 100644 index 000000000..dd88de6d2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoDocAutobus.java @@ -0,0 +1,72 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TIPO_DOC_AUTOBUS_SEQ", sequenceName = "TIPO_DOC_AUTOBUS_SEQ", allocationSize = 1) +@Table(name = "TIPO_DOC_AUTOBUS") +public class TipoDocAutobus { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @Column(name = "TIPODOCAUTOBUS_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_DOC_AUTOBUS_SEQ") + private Integer tipoDocAutobusId; + @Column(name = "DESCDOC") + private String descDoc; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + public Integer getTipoDocAutobusId() { + return tipoDocAutobusId; + } + public void setTipoDocAutobusId(Integer tipoDocAutobusId) { + this.tipoDocAutobusId = tipoDocAutobusId; + } + public String getDescDoc() { + return descDoc; + } + public void setDescDoc(String descDoc) { + this.descDoc = descDoc; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString(){ + return this.descDoc; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoDomicilio.java b/src/com/rjconsultores/ventaboletos/entidad/TipoDomicilio.java new file mode 100644 index 000000000..ca16cf743 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoDomicilio.java @@ -0,0 +1,136 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TIPO_DOMICILIO_SEQ", sequenceName = "TIPO_DOMICILIO_SEQ", allocationSize = 1) +@Table(name = "TIPO_DOMICILIO") +public class TipoDomicilio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_DOMICILIO_SEQ") + @Column(name = "TIPODOMICILIO_ID") + private Short tipodomicilioId; + @Column(name = "CVETIPODOMICILIO") + private String cvetipodomicilio; + @Column(name = "DESCTIPO") + private String desctipo; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoDomicilio() { + } + + public TipoDomicilio(Short tipodomicilioId) { + this.tipodomicilioId = tipodomicilioId; + } + + public Short getTipodomicilioId() { + return tipodomicilioId; + } + + public void setTipodomicilioId(Short tipodomicilioId) { + this.tipodomicilioId = tipodomicilioId; + } + + public String getCvetipodomicilio() { + return cvetipodomicilio; + } + + public void setCvetipodomicilio(String cvetipodomicilio) { + this.cvetipodomicilio = cvetipodomicilio; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipodomicilioId != null ? tipodomicilioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoDomicilio)) { + return false; + } + TipoDomicilio other = (TipoDomicilio) object; + if ((this.tipodomicilioId == null && other.tipodomicilioId != null) || (this.tipodomicilioId != null && !this.tipodomicilioId.equals(other.tipodomicilioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.desctipo; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoEmpleado.java b/src/com/rjconsultores/ventaboletos/entidad/TipoEmpleado.java new file mode 100644 index 000000000..f0284fafd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoEmpleado.java @@ -0,0 +1,114 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Shiro + */ +@Entity +@SequenceGenerator(name = "TIPO_EMPLEADO_SEQ", sequenceName = "TIPO_EMPLEADO_SEQ", allocationSize = 1) +@Table(name = "TIPO_EMPLEADO") +public class TipoEmpleado implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_EMPLEADO_SEQ") + @Column(name = "TIPOEMPLEADO_ID") + private Integer tipoEmpleadoId; + @Column(name = "DESCTIPO") + private String descTipo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "tipoEmpleado") + private List empleadoList; + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getDescTipo() { + return descTipo; + } + + public void setDescTipo(String descTipo) { + this.descTipo = descTipo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getTipoEmpleadoId() { + return tipoEmpleadoId; + } + + public void setTipoEmpleadoId(Integer tipoEmpleadoId) { + this.tipoEmpleadoId = tipoEmpleadoId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoEmpleadoId != null ? tipoEmpleadoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoEmpleado)) { + return false; + } + TipoEmpleado other = (TipoEmpleado) object; + if ((this.tipoEmpleadoId == null && other.tipoEmpleadoId != null) || (this.tipoEmpleadoId != null && !this.tipoEmpleadoId.equals(other.tipoEmpleadoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + //return "com.rjconsultores.ventaboletos.entidad.GrupoCortesias[grupocortesiaId=" + grupocortesiaId + "]"; + return this.getDescTipo(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java new file mode 100644 index 000000000..8358ecd50 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtra.java @@ -0,0 +1,452 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.LazyCollection; +import org.hibernate.annotations.LazyCollectionOption; + +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Entity +@Table(name = "TIPO_EVENTO_EXTRA") +@SequenceGenerator(name = "TIPO_EVENTO_EXTRA_SEQ", sequenceName = "TIPO_EVENTO_EXTRA_SEQ", allocationSize = 1) +public class TipoEventoExtra implements Serializable { + + public static short OPERACION_NORMAL = 1; + public static short OPERACION_AJUSTE = 2; + public static short OPERACION_CAMBIO_CHEQUE = 3; + + public static String TIPO_CREDITO = "1"; + public static String TIPO_DEBITO = "0"; + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_EVENTO_EXTRA_SEQ") + @Column(name = "TIPOEVENTOEXTRA_ID") + private Integer tipoeventoextraId; + // @Column(name = "DESCINGRESO") + // private String descingreso; + @Column(name = "INDTIPO") + private String indtipo; + @Column(name = "IMPMAX") + private BigDecimal impmax; + @Column(name = "INDVALIDACORTE") + private Boolean indvalidacorte; + @Column(name = "INDVALIDADOCUMENTO") + private Boolean indvalidadocumento; + @Column(name = "INDCONTRAPARTIDA") + private Boolean indcontrapartida; + @Column(name = "INDBOLETO") + private Boolean indboleto; + // @Column(name = "INDAJUSTE") + // private Boolean indajuste; + @Column(name = "INDORDENSERVICIO") + private Boolean indordenservicio; + @Column(name = "INDOPERACION") + private Short indoperacion; + @Column(name = "PORCIVA") + private BigDecimal porciva; + + @Column(name = "PROVEEDOR") + private String proveedor; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + // @Column(name = "DESCINGRESO2") + // private String descingreso2; + @Column(name = "INDTIPO2") + private String indtipo2; + @Column(name = "DESCTIPOEVENTO") + private String descTipoEvento; + @Column(name = "NATUREZA") + private String natureza; + @Column(name = "CONTACONTABIL") + private String contaContabil; + @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoeventoextra") + @LazyCollection(LazyCollectionOption.FALSE) + private List empresas = new ArrayList(); + @Column(name = "INDCONFERENCIAFISICACOMISSAO") + private Boolean indconferenciafisicacomissao; + + @Enumerated(EnumType.STRING) + @Column(name = "CVETIPOEVENTO") + private com.rjconsultores.ventaboletos.constantes.TipoEventoExtra cvetipoevento; + + @Column(name="CVESISTEMA") + private String cveSistema; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "tipoeventoextra") + @LazyCollection(LazyCollectionOption.FALSE) + private List pontosventa = new ArrayList(); + + @Column(name = "INDVALIDAESTOQUE") + private Boolean indValidarEstoque; + + public TipoEventoExtraEmpresa addEmpresa(Empresa e) { + TipoEventoExtraEmpresa t = new TipoEventoExtraEmpresa(); + t.setEmpresa(e); + t.setTipoeventoextra(this); + t.setActivo(Boolean.TRUE); + t.setFecmodif(Calendar.getInstance().getTime()); + t.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + this.empresas.add(t); + return t; + } + + public void removeEmpresa(TipoEventoExtraEmpresa t) { + this.empresas.remove(t); + } + + public TipoEventoExtraPtoVta addPuntoVenta(PuntoVenta p) { + TipoEventoExtraPtoVta t = new TipoEventoExtraPtoVta(); + t.setPuntoventa(p); + t.setTipoeventoextra(this); + t.setActivo(Boolean.TRUE); + t.setFecmodif(Calendar.getInstance().getTime()); + t.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + this.pontosventa.add(t); + return t; + } + + public void removePuntoVenta(PuntoVenta p) { + for (TipoEventoExtraPtoVta t : this.pontosventa){ + if (t.getPuntoventa().equals(p)){ + this.pontosventa.remove(t); + } + } + } + + public void removePuntoVenta(TipoEventoExtraPtoVta t){ + this.pontosventa.remove(t); + } + + public String getDescTipoEvento() { + return descTipoEvento; + } + + public void setDescTipoEvento(String descTipoEvento) { + this.descTipoEvento = descTipoEvento; + } + + @JoinColumn(name = "FORMAPAGO_ID", referencedColumnName = "FORMAPAGO_ID") + @ManyToOne + private FormaPago formaPago; + @JoinColumn(name = "FORMAPAGO2_ID", referencedColumnName = "FORMAPAGO_ID") + @ManyToOne + private FormaPago formaPago2; + + @JoinColumn(name = "PARAMARTICULO_ID", referencedColumnName = "PARAMARTICULO_ID") + @ManyToOne + private ParamArticulo paramArticulo; + + @JoinColumn(name = "PARAMARTICULO2_ID", referencedColumnName = "PARAMARTICULO_ID") + @ManyToOne + private ParamArticulo paramArticulo2; + + public TipoEventoExtra() { + } + + public TipoEventoExtra(Integer tipoeventoextraId) { + this.tipoeventoextraId = tipoeventoextraId; + } + + public Integer getTipoeventoextraId() { + return tipoeventoextraId; + } + + public void setTipoeventoextraId(Integer tipoeventoextraId) { + this.tipoeventoextraId = tipoeventoextraId; + } + + // public String getDescingreso() { + // return descingreso; + // } + // + // public void setDescingreso(String descingreso) { + // this.descingreso = descingreso; + // } + + public String getIndtipo() { + return indtipo; + } + + public void setIndtipo(String indtipo) { + this.indtipo = indtipo; + } + + public BigDecimal getImpmax() { + return impmax; + } + + public void setImpmax(BigDecimal impmax) { + this.impmax = impmax; + } + + public Boolean getIndvalidacorte() { + return indvalidacorte; + } + + public void setIndvalidacorte(Boolean indvalidacorte) { + this.indvalidacorte = indvalidacorte; + } + + public Boolean getIndvalidadocumento() { + return indvalidadocumento; + } + + public void setIndvalidadocumento(Boolean indvalidadocumento) { + this.indvalidadocumento = indvalidadocumento; + } + + public Boolean getIndcontrapartida() { + return indcontrapartida; + } + + public void setIndcontrapartida(Boolean indcontrapartida) { + this.indcontrapartida = indcontrapartida; + } + + public Boolean getIndboleto() { + return indboleto; + } + + public void setIndboleto(Boolean indboleto) { + this.indboleto = indboleto; + } + + public Boolean getIndordenservicio() { + return indordenservicio; + } + + public void setIndordenservicio(Boolean indordenservicio) { + this.indordenservicio = indordenservicio; + } + + public BigDecimal getPorciva() { + return porciva; + } + + public void setPorciva(BigDecimal porciva) { + this.porciva = porciva; + } + + public String getProveedor() { + return proveedor; + } + + public void setProveedor(String proveedor) { + this.proveedor = proveedor; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public String getIndtipo2() { + return indtipo2; + } + + public void setIndtipo2(String indtipo2) { + this.indtipo2 = indtipo2; + } + + public FormaPago getFormaPago() { + return formaPago; + } + + public void setFormaPago(FormaPago formaPago) { + this.formaPago = formaPago; + } + + public FormaPago getFormaPago2() { + return formaPago2; + } + + public void setFormaPago2(FormaPago formaPago2) { + this.formaPago2 = formaPago2; + } + + public ParamArticulo getParamArticulo() { + return paramArticulo; + } + + public void setParamArticulo(ParamArticulo paramArticulo) { + this.paramArticulo = paramArticulo; + } + + public ParamArticulo getParamArticulo2() { + return paramArticulo2; + } + + public void setParamArticulo2(ParamArticulo paramArticulo2) { + this.paramArticulo2 = paramArticulo2; + } + + public Short getIndoperacion() { + return indoperacion; + } + + public void setIndoperacion(Short indoperacion) { + this.indoperacion = indoperacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoeventoextraId != null ? tipoeventoextraId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof TipoEventoExtra)) { + return false; + } + TipoEventoExtra other = (TipoEventoExtra) object; + if ((this.tipoeventoextraId == null && other.tipoeventoextraId != null) + || (this.tipoeventoextraId != null && !this.tipoeventoextraId + .equals(other.tipoeventoextraId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return descTipoEvento; + } + + public String getNatureza() { + return natureza; + } + + public void setNatureza(String natureza) { + this.natureza = natureza; + } + + public String getContaContabil() { + return contaContabil; + } + + public void setContaContabil(String contaContabil) { + this.contaContabil = contaContabil; + } + + public Boolean getIndconferenciafisicacomissao() { + return indconferenciafisicacomissao; + } + + public void setIndconferenciafisicacomissao(Boolean indconferenciafisicacomissao) { + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + } + + public List getEmpresas() { + List lista = new ArrayList(); + for (TipoEventoExtraEmpresa t : empresas) { + if (t.getActivo()) { + lista.add(t); + } + } + return lista; + } + + public void setEmpresas(List empresas) { + this.empresas = empresas; + } + + public com.rjconsultores.ventaboletos.constantes.TipoEventoExtra getCvetipoevento() { + return cvetipoevento; + } + + public void setCvetipoevento(com.rjconsultores.ventaboletos.constantes.TipoEventoExtra cvetipoevento) { + this.cvetipoevento = cvetipoevento; + } + + /** + * @return the cveSistema + */ + public String getCveSistema() { + return cveSistema; + } + + /** + * @param cveSistema the cveSistema to set + */ + public void setCveSistema(String cveSistema) { + this.cveSistema = cveSistema; + } + + public List getPontosventa() { + return pontosventa; + } + + public void setPontosventa(List pontosventa) { + this.pontosventa = pontosventa; + } + + public Boolean getIndValidarEstoque() { + return indValidarEstoque; + } + + public void setIndValidarEstoque(Boolean indValidarEstoque) { + this.indValidarEstoque = indValidarEstoque; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraEmpresa.java new file mode 100644 index 000000000..a5706917f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraEmpresa.java @@ -0,0 +1,104 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "TIPO_EVENTO_EXTRA_EMPRESA") +@SequenceGenerator(name = "TIPO_EVENTO_EXTRA_EMPRESA_SEQ", sequenceName = "TIPO_EVENTO_EXTRA_EMPRESA_SEQ", allocationSize = 1) +public class TipoEventoExtraEmpresa { + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_EVENTO_EXTRA_EMPRESA_SEQ") + @Column(name = "TIPOEVENTOEXTRAEMPRESA_ID") + private Integer tipoeventoextraempresaId; + @ManyToOne + @JoinColumn(name = "TIPOEVENTOEXTRA_ID") + private TipoEventoExtra tipoeventoextra; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + + public Integer getTipoeventoextraempresaId() { + return tipoeventoextraempresaId; + } + public void setTipoeventoextraempresaId(Integer tipoeventoextraempresaId) { + this.tipoeventoextraempresaId = tipoeventoextraempresaId; + } + public TipoEventoExtra getTipoeventoextra() { + return tipoeventoextra; + } + public void setTipoeventoextra(TipoEventoExtra tipoeventoextra) { + this.tipoeventoextra = tipoeventoextra; + } + public Empresa getEmpresa() { + return empresa; + } + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + @Override + public String toString() { + return empresa.getNombempresa(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoeventoextraempresaId != null ? tipoeventoextraempresaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoEventoExtraEmpresa)) { + return false; + } + TipoEventoExtraEmpresa other = (TipoEventoExtraEmpresa) object; + if ((this.tipoeventoextraempresaId == null && other.tipoeventoextraempresaId != null) || (this.tipoeventoextraempresaId != null && !this.tipoeventoextraempresaId.equals(other.tipoeventoextraempresaId))) { + return false; + } + return true; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraPtoVta.java b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraPtoVta.java new file mode 100644 index 000000000..ddf7500cb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoEventoExtraPtoVta.java @@ -0,0 +1,102 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "TIPO_EVENTO_EXTRA_PTOVTA") +@SequenceGenerator(name = "TIPOEVENTOEXTRAPTOVTA_SEQ", sequenceName = "TIPOEVENTOEXTRAPTOVTA_SEQ", allocationSize = 1) +public class TipoEventoExtraPtoVta { + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPOEVENTOEXTRAPTOVTA_SEQ") + @Column(name = "TIPOEVENTOEXTRAPTOVTA_ID") + private Integer tipoeventoextraptovtaId; + @ManyToOne + @JoinColumn(name = "TIPOEVENTOEXTRA_ID") + private TipoEventoExtra tipoeventoextra; + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoventa; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "ACTIVO") + private Boolean activo; + + public Integer getTipoeventoextraptovtaId() { + return tipoeventoextraptovtaId; + } + public void setTipoeventoextraptovtaId(Integer tipoeventoextraptovtaId) { + this.tipoeventoextraptovtaId = tipoeventoextraptovtaId; + } + public TipoEventoExtra getTipoeventoextra() { + return tipoeventoextra; + } + public void setTipoeventoextra(TipoEventoExtra tipoeventoextra) { + this.tipoeventoextra = tipoeventoextra; + } + public PuntoVenta getPuntoventa() { + return puntoventa; + } + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public String toString(){ + return this.puntoventa.getNombpuntoventa(); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoeventoextraptovtaId != null ? tipoeventoextraptovtaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoEventoExtraPtoVta)) { + return false; + } + TipoEventoExtraPtoVta other = (TipoEventoExtraPtoVta) object; + if ((this.tipoeventoextraptovtaId == null && other.tipoeventoextraptovtaId != null) || (this.tipoeventoextraptovtaId != null && !this.tipoeventoextraptovtaId.equals(other.tipoeventoextraptovtaId))) { + return false; + } + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoIdentificacion.java b/src/com/rjconsultores/ventaboletos/entidad/TipoIdentificacion.java new file mode 100644 index 000000000..4197002a0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoIdentificacion.java @@ -0,0 +1,103 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "TIPO_IDENTIFICACION") +public class TipoIdentificacion implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "TIPOIDENTIFICACION_ID") + private Integer tipoIdentificacionId; + + @Column(name = "DESCTIPO") + private String desctipo; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getTipoIdentificacionId() { + return tipoIdentificacionId; + } + + public void setTipoIdentificacionId(Integer tipoIdentificacionId) { + this.tipoIdentificacionId = tipoIdentificacionId; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return getDesctipo(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((tipoIdentificacionId == null) ? 0 : tipoIdentificacionId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + TipoIdentificacion other = (TipoIdentificacion) obj; + if (tipoIdentificacionId == null) { + if (other.tipoIdentificacionId != null) + return false; + } else if (!tipoIdentificacionId.equals(other.tipoIdentificacionId)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoInformativoComissao.java b/src/com/rjconsultores/ventaboletos/entidad/TipoInformativoComissao.java new file mode 100644 index 000000000..3cedd8da4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoInformativoComissao.java @@ -0,0 +1,101 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TIPO_INFORMATIVO_SEQ", sequenceName = "TIPO_INFORMATIVO_SEQ", allocationSize = 1) +@Table(name = "TIPO_INFORMATIVO") +public class TipoInformativoComissao implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_INFORMATIVO_SEQ") + @Column(name = "TIPOINFORMATIVO_ID") + private Short tipoinformativoId; + @Column(name = "DESCTIPO") + private String desctipo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + + public Short getTipoinformativoId() { + return tipoinformativoId; + } + + public void setTipoinformativoId(Short tipoinformativoId) { + this.tipoinformativoId = tipoinformativoId; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoinformativoId != null ? tipoinformativoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoInformativoComissao)) { + return false; + } + TipoInformativoComissao other = (TipoInformativoComissao) object; + if ((this.tipoinformativoId == null && other.tipoinformativoId != null) || (this.tipoinformativoId != null && !this.tipoinformativoId.equals(other.tipoinformativoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return desctipo; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoMovimentacion.java b/src/com/rjconsultores/ventaboletos/entidad/TipoMovimentacion.java new file mode 100644 index 000000000..b4ff2fabe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoMovimentacion.java @@ -0,0 +1,125 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * TipoMovimentacion generated by hbm2java + */ +@Entity +@Table(name = "TIPO_MOVIMENTACION") +public class TipoMovimentacion implements java.io.Serializable { + + public static final int TIPO_ADQUISICION = 1; + public static final int TIPO_ENVIO = 2; + public static final int TIPO_VOLVER = 3; + public static final int TIPO_TRANSFERENCIA = 4; + public static final int TIPO_PERDIDO = 5; + public static final int TIPO_AJUSTE = 6; + public static final int TIPO_MIGRACAO = 99; + + private Integer tipomovimentacionId; + private String desctipomovimentacion; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public TipoMovimentacion() { + } + + public TipoMovimentacion(Integer tipomovimentacionId) { + this.tipomovimentacionId = tipomovimentacionId; + } + + public TipoMovimentacion(Integer tipomovimentacionId, String desctipomovimentacion, Boolean activo, Date fecmodif, Integer usuarioId) { + this.tipomovimentacionId = tipomovimentacionId; + this.desctipomovimentacion = desctipomovimentacion; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return desctipomovimentacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipomovimentacionId != null ? tipomovimentacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoMovimentacion)) + return false; + + TipoMovimentacion other = (TipoMovimentacion) object; + if ((this.tipomovimentacionId == null && other.tipomovimentacionId != null) || (this.tipomovimentacionId != null && !this.tipomovimentacionId.equals(other.tipomovimentacionId))) { + return false; + } + return true; + } + + + @Id + @Column(name = "TIPOMOVIMENTACION_ID", unique = true, nullable = false, precision = 4, scale = 0) + public Integer getTipomovimentacionId() { + return this.tipomovimentacionId; + } + + public void setTipomovimentacionId(Integer tipomovimentacionId) { + this.tipomovimentacionId = tipomovimentacionId; + } + + @Column(name = "DESCTIPOMOVIMENTACION", length = 20) + public String getDesctipomovimentacion() { + return this.desctipomovimentacion; + } + + public void setDesctipomovimentacion(String desctipomovimentacion) { + this.desctipomovimentacion = desctipomovimentacion; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoMovimiento.java b/src/com/rjconsultores/ventaboletos/entidad/TipoMovimiento.java new file mode 100644 index 000000000..7323cb8bd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoMovimiento.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TIPO_MOVIMIENTO_SEQ", sequenceName = "TIPO_MOVIMIENTO_SEQ", allocationSize = 1) +@Table(name = "TIPO_MOVIMIENTO") +public class TipoMovimiento implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_MOVIMIENTO_SEQ") + @Column(name = "TIPOMOVIMIENTO_ID") + private Short tipomovimientoId; + @Column(name = "DESCMOVIMIENTO") + private String descmovimiento; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoMovimiento() { + } + + public TipoMovimiento(Short tipomovimientoId) { + this.tipomovimientoId = tipomovimientoId; + } + + public Short getTipomovimientoId() { + return tipomovimientoId; + } + + public void setTipomovimientoId(Short tipomovimientoId) { + this.tipomovimientoId = tipomovimientoId; + } + + public String getDescmovimiento() { + return descmovimiento; + } + + public void setDescmovimiento(String descmovimiento) { + this.descmovimiento = descmovimiento; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipomovimientoId != null ? tipomovimientoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoMovimiento)) { + return false; + } + TipoMovimiento other = (TipoMovimiento) object; + if ((this.tipomovimientoId == null && other.tipomovimientoId != null) || (this.tipomovimientoId != null && !this.tipomovimientoId.equals(other.tipomovimientoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TipoMovimiento[tipomovimientoId=" + tipomovimientoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoOcupacion.java b/src/com/rjconsultores/ventaboletos/entidad/TipoOcupacion.java new file mode 100644 index 000000000..f523c0a82 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoOcupacion.java @@ -0,0 +1,137 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TIPO_OCUPACION_SEQ", sequenceName = "TIPO_OCUPACION_SEQ", allocationSize = 1) +@Table(name = "TIPO_OCUPACION") +public class TipoOcupacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_OCUPACION_SEQ") + @Column(name = "TIPOOCUPACION_ID") + private Short tipoocupacionId; + @Column(name = "CVETIPOOCUPACION") + private String cvetipoocupacion; + @Column(name = "DESCTIPO") + private String desctipo; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoOcupacion() { + } + + public TipoOcupacion(Short tipoocupacionId) { + this.tipoocupacionId = tipoocupacionId; + } + + public Short getTipoocupacionId() { + return tipoocupacionId; + } + + public void setTipoocupacionId(Short tipoocupacionId) { + this.tipoocupacionId = tipoocupacionId; + } + + public String getCvetipoocupacion() { + return cvetipoocupacion; + } + + public void setCvetipoocupacion(String cvetipoocupacion) { + this.cvetipoocupacion = cvetipoocupacion; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoocupacionId != null ? tipoocupacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoOcupacion)) { + return false; + } + TipoOcupacion other = (TipoOcupacion) object; + if ((this.tipoocupacionId == null && other.tipoocupacionId != null) || (this.tipoocupacionId != null && !this.tipoocupacionId.equals(other.tipoocupacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + // return "com.rjconsultores.ventaboletos.entidad.TipoOcupacion[tipoocupacionId=" + tipoocupacionId + "]"; + return this.desctipo; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoOperacionCC.java b/src/com/rjconsultores/ventaboletos/entidad/TipoOperacionCC.java new file mode 100644 index 000000000..64bd29f86 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoOperacionCC.java @@ -0,0 +1,131 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "TIPO_OPERACION_CC") +public class TipoOperacionCC implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Column(name = "TIPOOPERACIONCC_ID") + private Integer tipoOperacionCCId; + + @Column(name = "DESCTIPO") + private String descTipo; + + @Column(name = "CVETIPO") + private String cveTipo; + + @Column(name = "INDCREDITO") + private Boolean indCredito; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF") + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoOperacionCC() { + super(); + } + + public TipoOperacionCC(Integer tipoOperacionCCId) { + this(); + this.tipoOperacionCCId = tipoOperacionCCId; + } + + public Integer getTipoOperacionCCId() { + return tipoOperacionCCId; + } + + public void setTipoOperacionCCId(Integer tipoOperacionCCId) { + this.tipoOperacionCCId = tipoOperacionCCId; + } + + public String getDescTipo() { + return descTipo; + } + + public void setDescTipo(String descTipo) { + this.descTipo = descTipo; + } + + public String getCveTipo() { + return cveTipo; + } + + public void setCveTipo(String cveTipo) { + this.cveTipo = cveTipo; + } + + public Boolean getIndCredito() { + return indCredito; + } + + public void setIndCredito(Boolean indCredito) { + this.indCredito = indCredito; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((tipoOperacionCCId == null) ? 0 : tipoOperacionCCId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + TipoOperacionCC other = (TipoOperacionCC) obj; + if (tipoOperacionCCId == null) { + if (other.tipoOperacionCCId != null) + return false; + } else if (!tipoOperacionCCId.equals(other.tipoOperacionCCId)) + return false; + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoParada.java b/src/com/rjconsultores/ventaboletos/entidad/TipoParada.java new file mode 100644 index 000000000..b25a61a08 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoParada.java @@ -0,0 +1,119 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.GenericGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TIPO_PARADA_SEQ", sequenceName = "TIPO_PARADA_SEQ", allocationSize = 1) +@Table(name = "TIPO_PARADA") +public class TipoParada implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GenericGenerator(name = "TIPO_PARADA_GEN_ID", strategy = "com.rjconsultores.ventaboletos.dao.util.TipoParadaGenerator") + @GeneratedValue(generator = "TIPO_PARADA_GEN_ID") + @Column(name = "TIPOPARADA_ID") + private Short tipoparadaId; + @Column(name = "DESCTIPO") + private String desctipo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoParada() { + } + + public TipoParada(Short tipoparadaId) { + this.tipoparadaId = tipoparadaId; + } + + public Short getTipoparadaId() { + return tipoparadaId; + } + + public void setTipoparadaId(Short tipoparadaId) { + this.tipoparadaId = tipoparadaId; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoparadaId != null ? tipoparadaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoParada)) { + return false; + } + TipoParada other = (TipoParada) object; + if ((this.tipoparadaId == null && other.tipoparadaId != null) || (this.tipoparadaId != null && !this.tipoparadaId.equals(other.tipoparadaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDesctipo(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/TipoPuntoVenta.java new file mode 100644 index 000000000..1e99162d8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoPuntoVenta.java @@ -0,0 +1,155 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TIPO_PTOVTA_SEQ", sequenceName = "TIPO_PTOVTA_SEQ", allocationSize = 1) +@Table(name = "TIPO_PTOVTA") +public class TipoPuntoVenta implements Serializable { + + public static final Short TODOS = -1; + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_PTOVTA_SEQ") + @Column(name = "TIPOPTOVTA_ID") + private Short tipoptovtaId; + @Column(name = "DESCTIPO") + private String desctipo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "EQUIVALENCIA_ID") + private String equivalenciaId; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TIPOPTOVTA_ID") + private List lsCategoriaTipoPtoVta; + + public TipoPuntoVenta() { + } + + public TipoPuntoVenta(Short tipoptovtaId) { + this.tipoptovtaId = tipoptovtaId; + } + + public Short getTipoptovtaId() { + return tipoptovtaId; + } + + public void setTipoptovtaId(Short tipoptovtaId) { + this.tipoptovtaId = tipoptovtaId; + } + + public String getDesctipo() { + return desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getEquivalenciaId() { + return equivalenciaId; + } + + public void setEquivalenciaId(String equivalenciaId) { + this.equivalenciaId = equivalenciaId; + } + + public List getLsCategoriaTipoPtoVta() { + List tmp = new ArrayList(); + if (lsCategoriaTipoPtoVta != null) { + for (CategoriaTipoPtoVta cp : this.lsCategoriaTipoPtoVta) { + if (cp.getActivo()) { + tmp.add(cp); + } + } + } + + return tmp; + } + + public void setLsCategoriaTipoPtoVta(List lsCategoriaTipoPtoVta) { + this.lsCategoriaTipoPtoVta = lsCategoriaTipoPtoVta; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (getTipoptovtaId() != null ? getTipoptovtaId().hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are + // not set + if (!(object instanceof TipoPuntoVenta)) { + return false; + } + TipoPuntoVenta other = (TipoPuntoVenta) object; + if ((this.getTipoptovtaId() == null && other.getTipoptovtaId() != null) || (this.getTipoptovtaId() != null && !this.getTipoptovtaId().equals(other.getTipoptovtaId()))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.getDesctipo(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoServicio.java b/src/com/rjconsultores/ventaboletos/entidad/TipoServicio.java new file mode 100644 index 000000000..4443afb67 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoServicio.java @@ -0,0 +1,118 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "TIPO_SERVICIO_SEQ", sequenceName = "TIPO_SERVICIO_SEQ", allocationSize = 1) +@Table(name = "TIPO_SERVICIO") +public class TipoServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_SERVICIO_SEQ") + @Column(name = "TIPOSERVICIO_ID") + private Integer tiposervicioId; + @Column(name = "DESCSERVICIO") + private String descservicio; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoServicio() { + super(); + } + + public TipoServicio(Integer tiposervicioId) { + this(); + this.tiposervicioId = tiposervicioId; + } + + public Integer getTiposervicioId() { + return tiposervicioId; + } + + public void setTiposervicioId(Integer tiposervicioId) { + this.tiposervicioId = tiposervicioId; + } + + public String getDescservicio() { + return descservicio; + } + + public void setDescservicio(String descservicio) { + this.descservicio = descservicio; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tiposervicioId != null ? tiposervicioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoServicio)) { + return false; + } + TipoServicio other = (TipoServicio) object; + if ((this.tiposervicioId == null && other.tiposervicioId != null) || (this.tiposervicioId != null && !this.tiposervicioId.equals(other.tiposervicioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return this.descservicio; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoTarifaPacote.java b/src/com/rjconsultores/ventaboletos/entidad/TipoTarifaPacote.java new file mode 100644 index 000000000..2a4359d7e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoTarifaPacote.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "TIPO_TARIFA_PACOTE") +@SequenceGenerator(name = "TIPO_TARIFA_PACOTE_SEQ", sequenceName = "TIPO_TARIFA_PACOTE_SEQ", allocationSize = 1) +public class TipoTarifaPacote implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_TARIFA_PACOTE_SEQ") + @Column(name = "TIPOTARIFAPACOTE_ID") + private Integer tipotarifapacoteId; + @Column(name = "DESCTIPOTARIFA") + private String desctipotarifa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToMany + @JoinTable(name = "PACOTE_TARIFA", joinColumns = { @JoinColumn(name = "TIPOTARIFAPACOTE_ID") }, + inverseJoinColumns = { @JoinColumn(name = "PACOTE_ID") }) + private List pacoteList; + + public TipoTarifaPacote() { + super(); + } + + public TipoTarifaPacote(Integer tipotarifapacoteId, String desctipotarifa) { + this(); + this.tipotarifapacoteId = tipotarifapacoteId; + this.desctipotarifa = desctipotarifa; + } + + public TipoTarifaPacote(Integer tipotarifapacoteId, String desctipotarifa, Boolean activo, Date fecmodif, Integer usuarioId) { + this(); + this.tipotarifapacoteId = tipotarifapacoteId; + this.desctipotarifa = desctipotarifa; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Integer getTipotarifapacoteId() { + return tipotarifapacoteId; + } + + public void setTipotarifapacoteId(Integer tipotarifapacoteId) { + this.tipotarifapacoteId = tipotarifapacoteId; + } + + public String getDesctipotarifa() { + return desctipotarifa; + } + + public void setDesctipotarifa(String desctipotarifa) { + this.desctipotarifa = desctipotarifa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getPacoteList() { + return pacoteList; + } + + public void setPacoteList(List pacoteList) { + this.pacoteList = pacoteList; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((tipotarifapacoteId == null) ? 0 : tipotarifapacoteId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + TipoTarifaPacote other = (TipoTarifaPacote) obj; + if (tipotarifapacoteId == null) { + if (other.tipotarifapacoteId != null) + return false; + } else if (!tipotarifapacoteId.equals(other.tipotarifapacoteId)) + return false; + return true; + } + + @Override + public String toString() { + return getDesctipotarifa(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/TipoVenta.java new file mode 100644 index 000000000..a3c3361c8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoVenta.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "TIPO_VENTA_SEQ", sequenceName = "TIPO_VENTA_SEQ", allocationSize=1) +@Table(name = "TIPO_VENTA") +public class TipoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TIPO_VENTA_SEQ") + @Column(name = "TIPOVENTA_ID") + private Short tipoventaId; + @Column(name = "DESCTIPOVENTA") + private String desctipoventa; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TipoVenta() { + } + + public TipoVenta(Short tipoventaId) { + this.tipoventaId = tipoventaId; + } + + public Short getTipoventaId() { + return tipoventaId; + } + + public void setTipoventaId(Short tipoventaId) { + this.tipoventaId = tipoventaId; + } + + public String getDesctipoventa() { + return desctipoventa; + } + + public void setDesctipoventa(String desctipoventa) { + this.desctipoventa = desctipoventa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipoventaId != null ? tipoventaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof TipoVenta)) { + return false; + } + TipoVenta other = (TipoVenta) object; + if ((this.tipoventaId == null && other.tipoventaId != null) || (this.tipoventaId != null && !this.tipoventaId.equals(other.tipoventaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getDesctipoventa(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Tramo.java b/src/com/rjconsultores/ventaboletos/entidad/Tramo.java new file mode 100644 index 000000000..3b6cc2039 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Tramo.java @@ -0,0 +1,344 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.commons.lang.BooleanUtils; +import org.hibernate.LazyInitializationException; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TRAMO_SEQ", sequenceName = "TRAMO_SEQ", allocationSize = 1) +@Table(name = "TRAMO") +public class Tramo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TRAMO_SEQ") + @Column(name = "TRAMO_ID") + private Integer tramoId; + @Column(name = "DESCTRAMO") + private String desctramo; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "VIA_ID", referencedColumnName = "VIA_ID") + @ManyToOne + private Via via; + @JoinColumn(name = "ORIGEN_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada origem; + @JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID") + @ManyToOne + private Parada destino; + @OneToMany(mappedBy = "tramo") + private List rutaSecuenciaList; + @OneToMany(mappedBy = "tramo") + private List rutaCombinacionList; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + private List lsTramoTiempo; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + private List tramoServicioList; + @Column(name = "CANTKMPAGOCONDUCTOR") + private BigDecimal kmPagoConductor; + @Column(name = "CANTKMREAL") + private BigDecimal kmReal; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + private List tramoKms; + @OneToMany(cascade = CascadeType.ALL) + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + private List lsOrgaoTramo; + @Column(name = "CANTKMENTRADASAIDA") + private BigDecimal kmEntradaSaida; + @Column(name = "CANTKMENTRADASAIDADESTINO") + private BigDecimal kmEntradaSaidaDestino; + @Column(name = "INDKMENTRADASAIDAORIGEM") + private Boolean indKMEntradaSaidaOrigem; + + public Tramo() { + this.kmEntradaSaida = BigDecimal.ZERO; + } + + public Tramo(Integer tramoId) { + this.tramoId = tramoId; + this.kmEntradaSaida = BigDecimal.ZERO; + } + + public Integer getTramoId() { + return tramoId; + } + + public void setTramoId(Integer tramoId) { + this.tramoId = tramoId; + } + + public String getDesctramo() { + return desctramo; + } + + public void setDesctramo(String desctramo) { + this.desctramo = desctramo; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Via getVia() { + return via; + } + + public void setVia(Via via) { + this.via = via; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public BigDecimal getKmEntradaSaidaDestino() { + if(kmEntradaSaidaDestino == null) { + return BigDecimal.ZERO; + } + return kmEntradaSaidaDestino; + } + + public void setKmEntradaSaidaDestino(BigDecimal kmEntradaSaidaDestino) { + this.kmEntradaSaidaDestino = kmEntradaSaidaDestino; + } + + public List getRutaSecuenciaList() { + List lsRutaSecuencia = new ArrayList(); + if (this.rutaSecuenciaList != null) { + for (RutaSecuencia rSecuencia : this.rutaSecuenciaList) { + if (rSecuencia.getActivo()) { + lsRutaSecuencia.add(rSecuencia); + } + } + + this.rutaSecuenciaList = lsRutaSecuencia; + } + + return lsRutaSecuencia; + } + + public void setRutaSecuenciaList(List rutaSecuenciaList) { + this.rutaSecuenciaList = rutaSecuenciaList; + } + + public List getRutaCombinacionList() { + List lsRutaCombinacion = new ArrayList(); + for (RutaCombinacion rCombinacion : this.rutaCombinacionList) { + if (rCombinacion.getActivo()) { + lsRutaCombinacion.add(rCombinacion); + } + } + + this.rutaCombinacionList = lsRutaCombinacion; + + return lsRutaCombinacion; + } + + public void setRutaCombinacionList(List rutaCombinacionList) { + this.rutaCombinacionList = rutaCombinacionList; + } + + public List getTramoServicioList() throws LazyInitializationException{ + List lsTramoServicio = new ArrayList(); + + for (TramoServicio tramoServicio : this.tramoServicioList) { + if (tramoServicio.getActivo()) { + lsTramoServicio.add(tramoServicio); + } + } + + this.tramoServicioList = lsTramoServicio; + + return lsTramoServicio; + } + + public void setTramoServicioList(List tramoServicioList) { + this.tramoServicioList = tramoServicioList; + } + + public List getLsTramoTiempo() { + List lsTmp = new ArrayList(); + for (TramoTiempo tramoAtributo : this.lsTramoTiempo) { + if (tramoAtributo.getActivo()) { + lsTmp.add(tramoAtributo); + } + } + + this.lsTramoTiempo = lsTmp; + + return lsTmp; + } + + public void setLsTramoTiempo(List lsTramoTiempo) { + this.lsTramoTiempo = lsTramoTiempo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tramoId != null ? tramoId.hashCode() : 0); + return hash; + } + + public BigDecimal getKmPagoConductor() { + return kmPagoConductor; + } + + public void setKmPagoConductor(BigDecimal kmPagoConductor) { + this.kmPagoConductor = kmPagoConductor; + } + + public BigDecimal getKmReal() { + return kmReal; + } + + public BigDecimal getKmRealSemKmEntradaSaida(){ + return kmReal.subtract(kmEntradaSaida != null ? kmEntradaSaida : BigDecimal.ZERO).subtract(kmEntradaSaidaDestino != null ? kmEntradaSaidaDestino : BigDecimal.ZERO); + } + + public void setKmReal(BigDecimal kmReal) { + this.kmReal = kmReal; + } + + public BigDecimal getKmEntradaSaida() { + if(kmEntradaSaida == null) { + return BigDecimal.ZERO; + } + return kmEntradaSaida; + } + + public void setKmEntradaSaida(BigDecimal kmEntradaSaida) { + this.kmEntradaSaida = kmEntradaSaida; + } + + public List getLsOrgaoTramo() { + List tmp = new ArrayList(); + for (OrgaoTramo orgaoTramo : this.lsOrgaoTramo) { + if (orgaoTramo.getActivo()) { + tmp.add(orgaoTramo); + } + } + + this.lsOrgaoTramo = tmp; + + return tmp; + } + + public void setLsOrgaoTramo(List lsOrgaoTramo) { + this.lsOrgaoTramo = lsOrgaoTramo; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Tramo)) { + return false; + } + Tramo other = (Tramo) object; + if ((this.tramoId == null && other.tramoId != null) || (this.tramoId != null && !this.tramoId.equals(other.tramoId))) { + return false; + } + return true; + } + + public List getTramoKms() { + return tramoKms; + } + + public void setTramoKms(List tramoKms) { + this.tramoKms = tramoKms; + } + /** + * @return the indKMEntradaSaidaOrigem + */ + public Boolean getIndKMEntradaSaidaOrigem() { + return BooleanUtils.toBoolean(indKMEntradaSaidaOrigem); + } + + /** + * @param indKMEntradaSaidaOrigem the indKMEntradaSaidaOrigem to set + */ + public void setIndKMEntradaSaidaOrigem(Boolean indKMEntradaSaidaOrigem) { + this.indKMEntradaSaidaOrigem = indKMEntradaSaidaOrigem; + } + + @Override + public String toString() { + return getDesctramo().concat(" - ").concat(this.getVia().getNombvia()); + } + + public String toStringComplete() { + return "Tramo [tramoId=" + tramoId + ", desctramo=" + desctramo + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + ", via=" + via + ", origem=" + origem + ", destino=" + destino + ", rutaSecuenciaList=" + rutaSecuenciaList + ", rutaCombinacionList=" + rutaCombinacionList + ", lsTramoTiempo=" + lsTramoTiempo + ", tramoServicioList=" + tramoServicioList + ", kmPagoConductor=" + kmPagoConductor + ", kmReal=" + kmReal + ", tramoKms=" + tramoKms + ", lsOrgaoTramo=" + lsOrgaoTramo + ", kmEntradaSaida=" + kmEntradaSaida + ", kmEntradaSaidaDestino=" + kmEntradaSaidaDestino + ", indKMEntradaSaidaOrigem=" + indKMEntradaSaidaOrigem + "]"; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TramoKm.java b/src/com/rjconsultores/ventaboletos/entidad/TramoKm.java new file mode 100644 index 000000000..d23f3a7bd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TramoKm.java @@ -0,0 +1,112 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 10/01/2012 11:38:41 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * TramoKm generated by hbm2java + */ +@Entity +@SequenceGenerator(name = "TRAMO_KM_SEQ", sequenceName = "TRAMO_KM_SEQ", allocationSize = 1) +@Table(name = "TRAMO_KM") +public class TramoKm implements java.io.Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Column(name = "TRAMOKM_ID") + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TRAMO_KM_SEQ") + @Basic(optional = false) + private int tramokmId; + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @ManyToOne + @JoinColumn(name = "TRAMO_ID") + private Tramo tramo; + @Column(name = "CANTKMPAGOCONDUCTOR") + private Integer cantkmpagoconductor; + @Column(name = "ACTIVO") + private Boolean activo; + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public TramoKm() { + } + + public TramoKm(int tramokmId) { + this.tramokmId = tramokmId; + } + + public int getTramokmId() { + return this.tramokmId; + } + + public void setTramokmId(int tramokmId) { + this.tramokmId = tramokmId; + } + + public Integer getCantkmpagoconductor() { + return this.cantkmpagoconductor; + } + + public void setCantkmpagoconductor(Integer cantkmpagoconductor) { + this.cantkmpagoconductor = cantkmpagoconductor; + } + + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TramoKmServicio.java b/src/com/rjconsultores/ventaboletos/entidad/TramoKmServicio.java new file mode 100644 index 000000000..92273356e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TramoKmServicio.java @@ -0,0 +1,165 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Desenvolvimento + */ +@Entity +@SequenceGenerator(name = "TRAMO_SERVICIO_SEQ", sequenceName = "TRAMO_SERVICIO_SEQ", allocationSize = 1) +@Table(name = "TRAMO_KM_SERVICIO") +public class TramoKmServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TRAMO_SERVICIO_SEQ") + @Column(name = "TRAMOKMSERVICIO") + private Integer tramokmservicioId; + @Basic(optional = false) + @Column(name = "CANTKMPAGOCONDUCTOR") + private BigDecimal cantkmpagoconductor; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + public TramoKmServicio() { + } + + public TramoKmServicio(Integer tramokmservicio) { + this.tramokmservicioId = tramokmservicio; + } + + public TramoKmServicio(Integer tramokmservicio, BigDecimal cantkmpagoconductor, Boolean activo) { + this.tramokmservicioId = tramokmservicio; + this.cantkmpagoconductor = cantkmpagoconductor; + this.activo = activo; + } + + public Integer getTramokmservicioId() { + return tramokmservicioId; + } + + public void setTramokmservicioId(Integer tramokmservicioId) { + this.tramokmservicioId = tramokmservicioId; + } + + + + public BigDecimal getCantkmpagoconductor() { + return cantkmpagoconductor; + } + + public void setCantkmpagoconductor(BigDecimal cantkmpagoconductor) { + this.cantkmpagoconductor = cantkmpagoconductor; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tramokmservicioId != null ? tramokmservicioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TramoKmServicio)) { + return false; + } + TramoKmServicio other = (TramoKmServicio) object; + if ((this.tramokmservicioId == null && other.tramokmservicioId != null) || (this.tramokmservicioId != null && !this.tramokmservicioId.equals(other.tramokmservicioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TramoKmServicio[tramokmservicio=" + tramokmservicioId + "]"; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TramoServicio.java b/src/com/rjconsultores/ventaboletos/entidad/TramoServicio.java new file mode 100644 index 000000000..de0ad9a84 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TramoServicio.java @@ -0,0 +1,155 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "TRAMO_SERVICIO_SEQ", sequenceName = "TRAMO_SERVICIO_SEQ", allocationSize = 1) +@Table(name = "TRAMO_SERVICIO") +public class TramoServicio implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TRAMO_SERVICIO_SEQ") + @Column(name = "TRAMOSERVICIO_ID") + private Integer tramoservicioId; + @Column(name = "TIEMPORECORRIDO") + @Temporal(TemporalType.TIMESTAMP) + private Date tiemporecorrido; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public TramoServicio() { + } + + public TramoServicio(Integer tramoservicioId) { + this.tramoservicioId = tramoservicioId; + } + + public Integer getTramoservicioId() { + return tramoservicioId; + } + + public void setTramoservicioId(Integer tramoservicioId) { + this.tramoservicioId = tramoservicioId; + } + + public Date getTiemporecorrido() { + return tiemporecorrido; + } + + public void setTiemporecorrido(Date tiemporecorrido) { + this.tiemporecorrido = tiemporecorrido; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final TramoServicio other = (TramoServicio) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.tramo != other.tramo && (this.tramo == null || !this.tramo.equals(other.tramo))) { + return false; + } + if (this.claseServicio != other.claseServicio && (this.claseServicio == null || !this.claseServicio.equals(other.claseServicio))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + return hash; + } + + + public String toStringComplete() { + return "TramoServicio [tramoservicioId=" + tramoservicioId + ", tiemporecorrido=" + tiemporecorrido + ", activo=" + activo + ", fecmodif=" + fecmodif + ", usuarioId=" + usuarioId + ", tramo=[" + (tramo == null?"-":tramo.toStringComplete()) + "], claseServicio=" + claseServicio + "]"; + } + + @Override + public String toString() { + return "teste.TramoServicio[tramoservicioId=" + tramoservicioId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/TramoTiempo.java b/src/com/rjconsultores/ventaboletos/entidad/TramoTiempo.java new file mode 100644 index 000000000..0687b3392 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TramoTiempo.java @@ -0,0 +1,236 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "TRAMO_TIEMPO_SEQ", sequenceName = "TRAMO_TIEMPO_SEQ", allocationSize = 1) +@Table(name = "TRAMO_TIEMPO") +public class TramoTiempo implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TRAMO_TIEMPO_SEQ") + @Column(name = "TRAMOTIEMPO_ID") + private Integer tramotiempoId; + @Column(name = "TIEMPORECORRIDO") + @Temporal(TemporalType.TIMESTAMP) + private Date tiemporecorrido; + @Column(name = "HORAINICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date horainicio; + @Column(name = "HORAFIN") + @Temporal(TemporalType.TIMESTAMP) + private Date horafin; + @Column(name = "INDAPLICLUN") + private Boolean indapliclun; + @Column(name = "INDAPLICMAR") + private Boolean indaplicmar; + @Column(name = "INDAPLICMIE") + private Boolean indaplicmie; + @Column(name = "INDAPLICJUE") + private Boolean indaplicjue; + @Column(name = "INDAPLICVIE") + private Boolean indaplicvie; + @Column(name = "INDAPLICSAB") + private Boolean indaplicsab; + @Column(name = "INDAPLICDOM") + private Boolean indaplicdom; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @JoinColumn(name = "TRAMO_ID", referencedColumnName = "TRAMO_ID") + @ManyToOne + private Tramo tramo; + @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") + @ManyToOne + private ClaseServicio claseServicio; + + public TramoTiempo() { + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Date getHorafin() { + return horafin; + } + + public void setHorafin(Date horafin) { + this.horafin = horafin; + } + + public Date getHorainicio() { + return horainicio; + } + + public void setHorainicio(Date horainicio) { + this.horainicio = horainicio; + } + + public Boolean getIndaplicdom() { + return indaplicdom; + } + + public void setIndaplicdom(Boolean indaplicdom) { + this.indaplicdom = indaplicdom; + } + + public Boolean getIndaplicjue() { + return indaplicjue; + } + + public void setIndaplicjue(Boolean indaplicjue) { + this.indaplicjue = indaplicjue; + } + + public Boolean getIndapliclun() { + return indapliclun; + } + + public void setIndapliclun(Boolean indapliclun) { + this.indapliclun = indapliclun; + } + + public Boolean getIndaplicmar() { + return indaplicmar; + } + + public void setIndaplicmar(Boolean indaplicmar) { + this.indaplicmar = indaplicmar; + } + + public Boolean getIndaplicmie() { + return indaplicmie; + } + + public void setIndaplicmie(Boolean indaplicmie) { + this.indaplicmie = indaplicmie; + } + + public Boolean getIndaplicsab() { + return indaplicsab; + } + + public void setIndaplicsab(Boolean indaplicsab) { + this.indaplicsab = indaplicsab; + } + + public Boolean getIndaplicvie() { + return indaplicvie; + } + + public void setIndaplicvie(Boolean indaplicvie) { + this.indaplicvie = indaplicvie; + } + + public Date getTiemporecorrido() { + return tiemporecorrido; + } + + public void setTiemporecorrido(Date tiemporecorrido) { + this.tiemporecorrido = tiemporecorrido; + } + + public Tramo getTramo() { + return tramo; + } + + public void setTramo(Tramo tramo) { + this.tramo = tramo; + } + + public Integer getTramotiempoId() { + return tramotiempoId; + } + + public void setTramotiempoId(Integer tramotiempoId) { + this.tramotiempoId = tramotiempoId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final TramoTiempo other = (TramoTiempo) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.tramo != other.tramo && (this.tramo == null || !this.tramo.equals(other.tramo))) { + return false; + } + if (this.claseServicio != other.claseServicio && (this.claseServicio == null || !this.claseServicio.equals(other.claseServicio))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 3; + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.TramoTiempo[tramotiempoId=" + tramotiempoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Turno.java b/src/com/rjconsultores/ventaboletos/entidad/Turno.java new file mode 100644 index 000000000..cbbdf6522 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Turno.java @@ -0,0 +1,116 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "TURNO_SEQ", sequenceName = "TURNO_SEQ", allocationSize = 1) +@Table(name = "TURNO") +public class Turno implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TURNO_SEQ") + @Column(name = "TURNO_ID") + private Short turnoId; + @Column(name = "DESCTURNO") + private String descturno; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "ACTIVO") + private Boolean activo; + + public Turno() { + } + + public Turno(Short turnoId) { + this.turnoId = turnoId; + } + + public Short getTurnoId() { + return turnoId; + } + + public void setTurnoId(Short turnoId) { + this.turnoId = turnoId; + } + + public String getDescturno() { + return descturno; + } + + public void setDescturno(String descturno) { + this.descturno = descturno; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (turnoId != null ? turnoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Turno)) { + return false; + } + Turno other = (Turno) object; + if ((this.turnoId == null && other.turnoId != null) || (this.turnoId != null && !this.turnoId.equals(other.turnoId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Turno[turnoId=" + turnoId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Usuario.java b/src/com/rjconsultores/ventaboletos/entidad/Usuario.java new file mode 100644 index 000000000..3135789a0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Usuario.java @@ -0,0 +1,544 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.apache.commons.lang.BooleanUtils; +import org.apache.commons.lang.StringUtils; +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; +import org.springframework.security.core.GrantedAuthority; +import org.springframework.security.core.userdetails.UserDetails; + +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarID; +import br.com.rjconsultores.auditador.annotations.AuditarLista; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * + * @author rodrigo + */ +@AuditarClasse(nome = "USUARIO", tela = "Alteração de Usuário") +@Entity +@SequenceGenerator(name = "USUARIO_SEQ", sequenceName = "USUARIO_SEQ", allocationSize = 1) +@Table(name = "USUARIO") + +public class Usuario implements Serializable, UserDetails, Auditavel { + + public final static int CANT_DIAS_CONTRASENA = 999; + + private static final long serialVersionUID = 1L; + @AuditarID + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_SEQ") + @Basic(optional = false) + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "NOMBUSUARIO") + private String nombusuario; + @Column(name = "NOMBPATERNO") + private String nombpaterno; + @Column(name = "NOMBMATERNO") + private String nombmaterno; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIOMODIF_ID") + private Integer usuariomodifId; + @Column(name = "DESCCONTRASENA") + private String senha; + @Column(name = "CVEUSUARIO") + private String claveUsuario; + @Column(name = "DESCCORREO") + private String descCorreo; + @OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @Fetch(FetchMode.SELECT) + @AuditarLista(auditarEntidades = true, nome = "Perfil") + private List usuarioPerfilList; + @Column(name = "INDCORTEAUTOMATICO") + private Boolean indCorteAutomatico; + @OneToOne + @JoinColumn(name = "EMPLEADO_ID") + private Empleado empleado; + @OneToMany(mappedBy = "usuarioLog", cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @Fetch(FetchMode.SELECT) + @NaoAuditar + private List usuarioEmpresaList; + + @OneToMany(mappedBy = "usuario", cascade = CascadeType.ALL, fetch = FetchType.EAGER) + @Fetch(FetchMode.SELECT) + @NaoAuditar + private List usuarioUbicacionList; + + @Column(name = "FECCONTRASENA") + @Temporal(TemporalType.TIMESTAMP) + private Date fecContrasena; + + @Column(name = "DESCMAC") + private String descMac; + + @Column(name = "TEMPODEVOLUCAOPASSAGEM") + private Integer tempoDevolucaoPassagem; + + @Column(name = "INDEXPIRASENHA") + private Boolean indExpiraSenha; + + @Column(name = "ESTACIONINTERNET_ID") + private Long estacionInternetId; + + @Column(name = "TIPOVENTAINTEGRACAO_ID") + private Long tipoVentaIntegracaoId; + + /* Lista de permissoes do usuario */ + @Transient + private List listClavesPermisos; + + @Column(name = "INDRETORNATODASLOCALIDADES") + private Boolean indRetornaTodasLocalidades; + + @Transient + @NaoAuditar + private Usuario usuarioClone; + + public String getClaveUsuario() { + return claveUsuario; + } + + public void setClaveUsuario(String claveUsuario) { + this.claveUsuario = claveUsuario; + } + + public Usuario() { + tempoDevolucaoPassagem = -1; + indExpiraSenha = false; + } + + public Usuario(Integer usuarioId) { + this.usuarioId = usuarioId; + tempoDevolucaoPassagem = -1; + indExpiraSenha = false; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getNombusuario() { + return nombusuario; + } + + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + + public String getNombpaterno() { + return nombpaterno; + } + + public void setNombpaterno(String nombpaterno) { + this.nombpaterno = nombpaterno; + } + + public String getNombmaterno() { + return nombmaterno; + } + + public void setNombmaterno(String nombmaterno) { + this.nombmaterno = nombmaterno; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuariomodifId() { + return usuariomodifId; + } + + public void setUsuariomodifId(Integer usuariomodifId) { + this.usuariomodifId = usuariomodifId; + } + + public String getSenha() { + return senha; + } + + public void setSenha(String senha) { + this.senha = senha; + } + + public List getUsuarioEmpresaList() { + List tmp = new ArrayList(); + if (usuarioEmpresaList != null) { + for (UsuarioEmpresa ce : this.usuarioEmpresaList) { + if (ce.getActivo()) { + tmp.add(ce); + } + } + } + + return tmp; + } + + public void setUsuarioEmpresaList(List usuarioEmpresaList) { + this.usuarioEmpresaList = usuarioEmpresaList; + } + + public List getUsuarioPerfilList() { + List tmp = new ArrayList(); + if (usuarioPerfilList != null) { + for (UsuarioPerfil cp : this.usuarioPerfilList) { + if (cp.getActivo()) { + tmp.add(cp); + } + } + } + + return tmp; + } + + public List getEmpresa() { + List tmp = new ArrayList(); + if (usuarioEmpresaList != null) { + for (UsuarioEmpresa cp : this.usuarioEmpresaList) { + if ((cp.getActivo())) { + tmp.add(cp.getEmpresa()); + } + } + } + + return tmp; + } + + public void setUsuarioPerfilList(List usuarioPerfilList) { + this.usuarioPerfilList = usuarioPerfilList; + } + + public Empleado getEmpleado() { + return empleado; + } + + public void setEmpleado(Empleado empleado) { + this.empleado = empleado; + } + + public void updateUsuarioUbicacionForClonedUser(){ + for (UsuarioUbicacion ub : usuarioUbicacionList){ + ub.setUsuarioubicacionId(null); + } + } + + public void updateUsuarioEmpresaForClonedUser(){ + for (UsuarioEmpresa ue : usuarioEmpresaList){ + ue.setUsuarioEmpresaId(null); + } + } + + public void updateUsuarioPerfilForClonedUser(){ + for (UsuarioPerfil ub : usuarioPerfilList){ + ub.setUsuarioperfilId(null); + } + } + + @Override + public int hashCode() { + int hash = 0; + hash += (usuarioId != null ? usuarioId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + if (!(object instanceof Usuario)) { + return false; + } + Usuario other = (Usuario) object; + if ((this.usuarioId == null && other.usuarioId != null) || (this.usuarioId != null && !this.usuarioId.equals(other.usuarioId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNombUsuarioCompleto(); + } + + public Collection getAuthorities() { + return new ArrayList(); + } + + public String getPassword() { + return this.senha; + } + + public String getUsername() { + return this.nombusuario; + } + + public boolean isAccountNonExpired() { + return true; + } + + public boolean isAccountNonLocked() { + return true; + } + + public boolean isCredentialsNonExpired() { + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CONTRASENA_VALIDA_COMPLEJIDAD.getDescricao())) { + if (getFecContrasena() != null) { + ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService"); + Constante contante = constanteService.buscarPorNomeConstante("CANT_DIAS_CONTRASENA"); + + Integer maxPrazoCambioContrasena = CANT_DIAS_CONTRASENA; + + if ( (contante != null && (StringUtils.isNotBlank(contante.getValorconstante() )))){ + maxPrazoCambioContrasena = Integer.valueOf(contante.getValorconstante()); + } + + Date maxFechaContrasena = DateUtil.somarDias(getFecContrasena(), maxPrazoCambioContrasena); + + if (Calendar.getInstance().getTime().after(maxFechaContrasena)) { + return false; + } + } else { + return false; + } + } + + return true; + } + + public boolean isEnabled() { + return true; + } + + public Object getCredentials() { + return new Object(); + } + + public Object getDetails() { + return new Object(); + } + + public Object getPrincipal() { + return this; + } + + public boolean isAuthenticated() { + return Boolean.TRUE; + } + + public void setAuthenticated(boolean bln) throws IllegalArgumentException { + } + + public String getName() { + return this.getNombusuario(); + } + + public String getDescCorreo() { + return descCorreo; + } + + public void setDescCorreo(String descCorreo) { + this.descCorreo = descCorreo; + } + + public Boolean getIndCorteAutomatico() { + return indCorteAutomatico; + } + + public void setIndCorteAutomatico(Boolean indCorteAutomatico) { + this.indCorteAutomatico = indCorteAutomatico; + } + + public List getUsuarioUbicacionActivoList() { + List ubicacionActivos = new ArrayList(); + + if (usuarioUbicacionList != null) + for (UsuarioUbicacion ubicacion : usuarioUbicacionList) + if (ubicacion.getActivo()) + ubicacionActivos.add(ubicacion); + + return ubicacionActivos; + } + + public List getUsuarioUbicacionList() { + return usuarioUbicacionList; + } + + public void setUsuarioUbicacionList(List usuarioUbicacionList) { + this.usuarioUbicacionList = usuarioUbicacionList; + } + + public Date getFecContrasena() { + return fecContrasena; + } + + public void setFecContrasena(Date fecContrasena) { + this.fecContrasena = fecContrasena; + } + + public String getNombUsuarioCompleto() { + StringBuilder sNome = new StringBuilder(getNombusuario()); + if(StringUtils.isNotBlank(getNombpaterno())) { + sNome.append(" ") + .append(getNombpaterno()); + } + if(StringUtils.isNotBlank(getNombmaterno())) { + sNome.append(" ") + .append(getNombmaterno()); + } + + return sNome.toString(); + } + + public List getListClavesPermisos() { + return listClavesPermisos; + } + + public void setListClavesPermisos(List listClavesPermisos) { + this.listClavesPermisos = listClavesPermisos; + } + + @Transient + public boolean isPermisoClave(String clave) { + return listClavesPermisos != null && listClavesPermisos.contains(clave); + } + + public String getDescMac() { + return descMac; + } + + public void setDescMac(String descMac) { + this.descMac = descMac; + } + + public Integer getTempoDevolucaoPassagem() { + return tempoDevolucaoPassagem; + } + + public void setTempoDevolucaoPassagem(Integer tempoDevolucaoPassagem) { + if(tempoDevolucaoPassagem == null){ + tempoDevolucaoPassagem = 0; + } + this.tempoDevolucaoPassagem = tempoDevolucaoPassagem; + } + + public Boolean getIndExpiraSenha() { + return indExpiraSenha; + } + + public void setIndExpiraSenha(Boolean indExpiraSenha) { + this.indExpiraSenha = indExpiraSenha; + } + + public Long getEstacionInternetId() { + return estacionInternetId; + } + + public void setEstacionInternetId(Long estacionInternetId) { + this.estacionInternetId = estacionInternetId; + } + + public Long getTipoVentaIntegracaoId() { + return tipoVentaIntegracaoId; + } + + public void setTipoVentaIntegracaoId(Long tipoVentaIntegracaoId) { + this.tipoVentaIntegracaoId = tipoVentaIntegracaoId; + } + + public Boolean getIndRetornaTodasLocalidades() { + return indRetornaTodasLocalidades; + } + + public void setIndRetornaTodasLocalidades(Boolean indRetornaTodasLocalidades) { + this.indRetornaTodasLocalidades = indRetornaTodasLocalidades; + } + + + + + @Override + public void clonar() throws CloneNotSupportedException { + + usuarioClone = new Usuario(); + usuarioClone = (Usuario) this.clone(); + + + if(this.getUsuarioPerfilList() != null) { + List lsClones = new ArrayList(); + for (UsuarioPerfil usuarioPerfil : this.getUsuarioPerfilList()) { + if(BooleanUtils.isTrue(usuarioPerfil.getActivo())) { + usuarioPerfil.clonar(); + lsClones.add(usuarioPerfil.getCloneObject()); + } + } + usuarioClone.setUsuarioPerfilList((lsClones)); + } + } + + @Override + public Usuario getCloneObject() throws CloneNotSupportedException { + return usuarioClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getUsuarioId()); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/UsuarioBancario.java b/src/com/rjconsultores/ventaboletos/entidad/UsuarioBancario.java new file mode 100644 index 000000000..f176eedbc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/UsuarioBancario.java @@ -0,0 +1,157 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Rafius + */ +@Entity +@SequenceGenerator(name = "USUARIO_BANCARIO_SEQ", sequenceName = "USUARIO_BANCARIO_SEQ", allocationSize = 1) +@Table(name = "USUARIO_BANCARIO") +public class UsuarioBancario implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_BANCARIO_SEQ") + @Column(name = "USUARIOBANCARIO_ID") + private Integer usuariobancarioId; + @Column(name = "CVEUSUARIO") + private String cveusuario; + @Column(name = "PASSWORD") + private String password; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Basic(optional = false) + @Column(name = "ACTIVO") + private Boolean activo; + @JoinColumn(name = "COMPANIABANCARIA_ID", referencedColumnName = "COMPANIABANCARIA_ID") + @ManyToOne(optional = false) + private CompaniaBancaria companiaBancaria; + + public UsuarioBancario() { + } + + public UsuarioBancario(Integer usuariobancarioId) { + this.usuariobancarioId = usuariobancarioId; + } + + public UsuarioBancario(Integer usuariobancarioId, Boolean activo) { + this.usuariobancarioId = usuariobancarioId; + this.activo = activo; + } + + public Integer getUsuariobancarioId() { + return usuariobancarioId; + } + + public void setUsuariobancarioId(Integer usuariobancarioId) { + this.usuariobancarioId = usuariobancarioId; + } + + public String getCveusuario() { + return cveusuario; + } + + public void setCveusuario(String cveusuario) { + this.cveusuario = cveusuario; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public CompaniaBancaria getCompaniaBancaria() { + return companiaBancaria; + } + + public void setCompaniaBancaria(CompaniaBancaria companiaBancaria) { + this.companiaBancaria = companiaBancaria; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final UsuarioBancario other = (UsuarioBancario) obj; + if ((this.cveusuario == null) ? (other.cveusuario != null) : !this.cveusuario.equals(other.cveusuario)) { + return false; + } + if ((this.password == null) ? (other.password != null) : !this.password.equals(other.password)) { + return false; + } + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 67 * hash + (this.cveusuario != null ? this.cveusuario.hashCode() : 0); + hash = 67 * hash + (this.password != null ? this.password.hashCode() : 0); + hash = 67 * hash + (this.activo != null ? this.activo.hashCode() : 0); + return hash; + } + + + + @Override + public String toString() { + return getCveusuario(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/UsuarioEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/UsuarioEmpresa.java new file mode 100644 index 000000000..3d679f374 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/UsuarioEmpresa.java @@ -0,0 +1,190 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + + +@Entity +@SequenceGenerator(name = "USUARIO_EMPRESA_SEQ", sequenceName = "USUARIO_EMPRESA_SEQ", allocationSize = 1) +@Table(name = "USUARIO_EMPRESA") +public class UsuarioEmpresa implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_EMPRESA_SEQ") + @Basic(optional = false) + @Column(name = " USUARIOEMPRESA_ID") + private Integer usuarioEmpresaId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIOMODIF_ID") + private Integer usuariomodifId; + + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + private Usuario usuarioLog; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @Column(name = "INDVALIDAPREIMPRESO") + private Boolean indValidaPreimpreso; + + public UsuarioEmpresa() { + } + + public UsuarioEmpresa(Integer usuarioEmpresaId) { + this.usuarioEmpresaId = usuarioEmpresaId; + } + + + + public Integer getUsuarioEmpresaId() { + return usuarioEmpresaId; + } + + public void setUsuarioEmpresaId(Integer usuarioEmpresaId) { + this.usuarioEmpresaId = usuarioEmpresaId; + } + + + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuariomodifId() { + return usuariomodifId; + } + + public void setUsuariomodifId(Integer usuariomodifId) { + this.usuariomodifId = usuariomodifId; + } + + + + public Empresa getEmpresa() { + return empresa; + } + + + public Usuario getUsuarioLog() { + return usuarioLog; + } + + public void setUsuarioLog(Usuario usuario) { + this.usuarioLog = usuario; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getIndValidaPreimpreso() { + return indValidaPreimpreso; + } + + public void setIndValidaPreimpreso(Boolean indValidaPreimpreso) { + this.indValidaPreimpreso = indValidaPreimpreso; + } + + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((activo == null) ? 0 : activo.hashCode()); + result = prime * result + ((empresa == null) ? 0 : empresa.hashCode()); + result = prime * result + ((fecmodif == null) ? 0 : fecmodif.hashCode()); + result = prime * result + ((indValidaPreimpreso == null) ? 0 : indValidaPreimpreso.hashCode()); + result = prime * result + ((usuarioEmpresaId == null) ? 0 : usuarioEmpresaId.hashCode()); + result = prime * result + ((usuarioLog == null) ? 0 : usuarioLog.hashCode()); + result = prime * result + ((usuariomodifId == null) ? 0 : usuariomodifId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + UsuarioEmpresa other = (UsuarioEmpresa) obj; + if (activo == null) { + if (other.activo != null) + return false; + } else if (!activo.equals(other.activo)) + return false; + if (empresa == null) { + if (other.empresa != null) + return false; + } else if (!empresa.equals(other.empresa)) + return false; + if (fecmodif == null) { + if (other.fecmodif != null) + return false; + } else if (!fecmodif.equals(other.fecmodif)) + return false; + if (indValidaPreimpreso == null) { + if (other.indValidaPreimpreso != null) + return false; + } else if (!indValidaPreimpreso.equals(other.indValidaPreimpreso)) + return false; + if (usuarioEmpresaId == null) { + if (other.usuarioEmpresaId != null) + return false; + } else if (!usuarioEmpresaId.equals(other.usuarioEmpresaId)) + return false; + if (usuarioLog == null) { + if (other.usuarioLog != null) + return false; + } else if (!usuarioLog.equals(other.usuarioLog)) + return false; + if (usuariomodifId == null) { + if (other.usuariomodifId != null) + return false; + } else if (!usuariomodifId.equals(other.usuariomodifId)) + return false; + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa[usuarioEmpresaId=" + usuarioEmpresaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/UsuarioPerfil.java b/src/com/rjconsultores/ventaboletos/entidad/UsuarioPerfil.java new file mode 100644 index 000000000..12f0b8318 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/UsuarioPerfil.java @@ -0,0 +1,161 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarEntidade; +import br.com.rjconsultores.auditador.annotations.AuditarID; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * + * @author Rafius + */ +@AuditarClasse(nome = "USUARIO_PERFIL", tela = "Alteração de Usuário") +@Entity +@SequenceGenerator(name = "USUARIO_PERFIL_SEQ", sequenceName = "USUARIO_PERFIL_SEQ", allocationSize = 1) +@Table(name = "USUARIO_PERFIL") +public class UsuarioPerfil implements Serializable, Auditavel { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_PERFIL_SEQ") + @Column(name = "USUARIOPERFIL_ID") + @AuditarID + private Integer usuarioperfilId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIOMODIF_ID") + private Integer usuariomodifId; + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + @ManyToOne + @AuditarEntidade + private Usuario usuario; + @JoinColumn(name = "PERFIL_ID", referencedColumnName = "PERFIL_ID") + @ManyToOne + private Perfil perfil; + @Transient + @NaoAuditar + private UsuarioPerfil usuarioPerfilClone; + + public UsuarioPerfil() { + + } + + public UsuarioPerfil(Integer usuarioperfilId) { + this.usuarioperfilId = usuarioperfilId; + } + + public Integer getUsuarioperfilId() { + return usuarioperfilId; + } + + public void setUsuarioperfilId(Integer usuarioperfilId) { + this.usuarioperfilId = usuarioperfilId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuariomodifId() { + return usuariomodifId; + } + + public void setUsuariomodifId(Integer usuariomodifId) { + this.usuariomodifId = usuariomodifId; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public Perfil getPerfil() { + return perfil; + } + + public void setPerfil(Perfil perfil) { + this.perfil = perfil; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (usuarioperfilId != null ? usuarioperfilId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof UsuarioPerfil)) { + return false; + } + UsuarioPerfil other = (UsuarioPerfil) object; + if ((this.usuarioperfilId == null && other.usuarioperfilId != null) || (this.usuarioperfilId != null && !this.usuarioperfilId.equals(other.usuarioperfilId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.dao.hibernate.UsuarioPerfil[usuarioperfilId=" + usuarioperfilId + "]"; + } + + + @Override + public void clonar() throws CloneNotSupportedException { + usuarioPerfilClone = new UsuarioPerfil(); + usuarioPerfilClone = (UsuarioPerfil) this.clone(); + } + + @Override + public UsuarioPerfil getCloneObject() throws CloneNotSupportedException { + return usuarioPerfilClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getUsuarioperfilId()); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/UsuarioSesion.java b/src/com/rjconsultores/ventaboletos/entidad/UsuarioSesion.java new file mode 100644 index 000000000..3be3ed28e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/UsuarioSesion.java @@ -0,0 +1,167 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author RJ Consultores + */ +@Entity +@SequenceGenerator(name = "USUARIO_SESION_SEQ", sequenceName = "USUARIO_SESION_SEQ", allocationSize = 1) +@Table(name = "USUARIO_SESION") +public class UsuarioSesion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_SESION_SEQ") + @Basic(optional = false) + @Column(name = "USUARIOSESION_ID") + private Integer usuarioSesionId; + + @JoinColumn(name = "SISTEMA_ID", referencedColumnName = "SISTEMA_ID") + @ManyToOne + private Sistema sistema; + + @Column(name = "INDFIRMADO") + private Boolean indFirmado; + + @Column(name = "FECHORINICIO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecHorInicio; + + @Column(name = "FECHORACTIVIDAD") + @Temporal(TemporalType.TIMESTAMP) + private Date fecHorActividad; + + @OneToOne + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + private Usuario usuario; + + @JoinColumn(name = "EMPRESA_ID", referencedColumnName = "EMPRESA_ID") + @ManyToOne + private Empresa empresa; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + public Integer getUsuarioSesionId() { + return usuarioSesionId; + } + + public void setUsuarioSesionId(Integer usuarioSesionId) { + this.usuarioSesionId = usuarioSesionId; + } + + public Sistema getSistema() { + return sistema; + } + + public void setSistema(Sistema sistema) { + this.sistema = sistema; + } + + public Boolean getIndFirmado() { + return indFirmado; + } + + public void setIndFirmado(Boolean indFirmado) { + this.indFirmado = indFirmado; + } + + public Date getFecHorInicio() { + return fecHorInicio; + } + + public void setFecHorInicio(Date fecHorInicio) { + this.fecHorInicio = fecHorInicio; + } + + public Date getFecHorActividad() { + return fecHorActividad; + } + + public void setFecHorActividad(Date fecHorActividad) { + this.fecHorActividad = fecHorActividad; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (usuarioSesionId != null ? usuarioSesionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof UsuarioSesion)) { + return false; + } + UsuarioSesion other = (UsuarioSesion) object; + if ((this.usuarioSesionId == null && other.usuarioSesionId != null) || (this.usuarioSesionId != null && !this.usuarioSesionId.equals(other.usuarioSesionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.UsuarioSesion[usuarioSesionId=" + usuarioSesionId + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/UsuarioUbicacion.java b/src/com/rjconsultores/ventaboletos/entidad/UsuarioUbicacion.java new file mode 100644 index 000000000..aeffb5bdb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/UsuarioUbicacion.java @@ -0,0 +1,141 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@Table(name = "USUARIO_UBICACION") +@SequenceGenerator(name = "USUARIO_UBICACION_SEQ", sequenceName = "USUARIO_UBICACION_SEQ", allocationSize = 1) +public class UsuarioUbicacion implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "USUARIO_UBICACION_SEQ") + @Column(name = "USUARIOUBICACION_ID") + private Integer usuarioubicacionId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIOMODIF_ID") + private Integer usuariomodifId; + @OneToOne + @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID") + private Usuario usuario; + @OneToOne + @JoinColumn(name = "PARADA_ID", referencedColumnName = "PARADA_ID") + private Parada parada; + @OneToOne + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + public UsuarioUbicacion() { + } + + public UsuarioUbicacion(Integer usuarioubicacionId) { + this.usuarioubicacionId = usuarioubicacionId; + } + + public Integer getUsuarioubicacionId() { + return usuarioubicacionId; + } + + public void setUsuarioubicacionId(Integer usuarioubicacionId) { + this.usuarioubicacionId = usuarioubicacionId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuariomodifId() { + return usuariomodifId; + } + + public void setUsuariomodifId(Integer usuariomodifId) { + this.usuariomodifId = usuariomodifId; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (usuarioubicacionId != null ? usuarioubicacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof UsuarioUbicacion)) { + return false; + } + UsuarioUbicacion other = (UsuarioUbicacion) object; + if ((this.usuarioubicacionId == null && other.usuarioubicacionId != null) || (this.usuarioubicacionId != null && !this.usuarioubicacionId.equals(other.usuarioubicacionId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion[usuarioubicacionId=" + usuarioubicacionId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/VendaPacote.java b/src/com/rjconsultores/ventaboletos/entidad/VendaPacote.java new file mode 100644 index 000000000..1481ab906 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/VendaPacote.java @@ -0,0 +1,254 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.annotations.Where; + +import com.rjconsultores.ventaboletos.enums.SituacaoVendaPacote; + +@Entity +@Table(name = "VENDA_PACOTE") +@SequenceGenerator(name = "VENDA_PACOTE_SEQ", sequenceName = "VENDA_PACOTE_SEQ", allocationSize = 1) +public class VendaPacote implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "VENDA_PACOTE_SEQ") + @Column(name = "VENDAPACOTE_ID") + private Long vendapacoteId; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "DATAVENDA") + private Date datavenda; + + @Temporal(TemporalType.DATE) + @Column(name = "DATAPACOTE") + private Date datapacote; + + @Column(name = "NUMOPERACION") + private String numoperacion; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "PACOTE_ID") + private Pacote pacote; + + @OneToMany(fetch = FetchType.LAZY, mappedBy = "vendaPacote") + @Where(clause = "activo=1") + private List enderecoApanhes; + + @Column(name = "INDCANCELADO") + private Boolean indcancelado; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "DATACANCELAMENTO") + private Date datacancelamento; + + @Column(name = "USUARIO_CANCELAMENTO_ID") + private Integer usuarioCancelamentoId; + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "USUARIO_ID") + private Usuario usuario; + + @Column(name = "SUBTOTAL") + private BigDecimal subtotal; + + @Column(name = "DESCONTO") + private BigDecimal desconto; + + @Column(name = "TOTAL") + private BigDecimal total; + + @ManyToOne + @JoinColumn(name = "CLIENTEPACOTE_ID") + private ClientePacote clientePacote; + + @Column(name = "MOTIVOCANCELVENDAPACOTE_ID") + private Integer motivoCancelVendaPacoteId; + + @Column(name = "SITUACAO") + private SituacaoVendaPacote situacao; + + @Column(name = "DATA_CONFIRMACAO_RESERVA") + private Date dataConfirmacaoReserva; + + @Column(name = "USUARIO_CONFIRMACAO_RESERVA_ID") + private Long usuarioConfirmacaoReserva; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF") + private Date fecmodif; + + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + + public Date getDatavenda() { + return datavenda; + } + + public void setDatavenda(Date datavenda) { + this.datavenda = datavenda; + } + + public Date getDatapacote() { + return datapacote; + } + + public void setDatapacote(Date datapacote) { + this.datapacote = datapacote; + } + + public Pacote getPacote() { + return pacote; + } + + public void setPacote(Pacote pacote) { + this.pacote = pacote; + } + + public Boolean getIndcancelado() { + return indcancelado; + } + + public void setIndcancelado(Boolean indcancelado) { + this.indcancelado = indcancelado; + } + + public Date getDatacancelamento() { + return datacancelamento; + } + + public void setDatacancelamento(Date datacancelamento) { + this.datacancelamento = datacancelamento; + } + + public Integer getUsuarioCancelamentoId() { + return usuarioCancelamentoId; + } + + public void setUsuarioCancelamentoId(Integer usuarioCancelamentoId) { + this.usuarioCancelamentoId = usuarioCancelamentoId; + } + + public BigDecimal getSubtotal() { + return subtotal; + } + + public void setSubtotal(BigDecimal subtotal) { + this.subtotal = subtotal; + } + + public BigDecimal getDesconto() { + return desconto; + } + + public void setDesconto(BigDecimal desconto) { + this.desconto = desconto; + } + + public BigDecimal getTotal() { + return total; + } + + public void setTotal(BigDecimal total) { + this.total = total; + } + + public String getNumoperacion() { + return numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public List getEnderecoApanhes() { + return enderecoApanhes; + } + + public void setEnderecoApanhes(List enderecoApanhes) { + this.enderecoApanhes = enderecoApanhes; + } + + public Usuario getUsuario() { + return usuario; + } + + public void setUsuario(Usuario usuario) { + this.usuario = usuario; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public ClientePacote getClientePacote() { + return clientePacote; + } + + public void setClientePacote(ClientePacote clientePacote) { + this.clientePacote = clientePacote; + } + + public Integer getMotivoCancelVendaPacoteId() { + return motivoCancelVendaPacoteId; + } + + public void setMotivoCancelVendaPacoteId(Integer motivoCancelVendaPacoteId) { + this.motivoCancelVendaPacoteId = motivoCancelVendaPacoteId; + } + + public SituacaoVendaPacote getSituacao() { + return situacao; + } + + public void setSituacao(SituacaoVendaPacote situacao) { + this.situacao = situacao; + } + + public Date getDataConfirmacaoReserva() { + return dataConfirmacaoReserva; + } + + public void setDataConfirmacaoReserva(Date dataConfirmacaoReserva) { + this.dataConfirmacaoReserva = dataConfirmacaoReserva; + } + + public Long getUsuarioConfirmacaoReserva() { + return usuarioConfirmacaoReserva; + } + + public void setUsuarioConfirmacaoReserva(Long usuarioConfirmacaoReserva) { + this.usuarioConfirmacaoReserva = usuarioConfirmacaoReserva; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Via.java b/src/com/rjconsultores/ventaboletos/entidad/Via.java new file mode 100644 index 000000000..735e7c394 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Via.java @@ -0,0 +1,128 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.SequenceGenerator; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "VIA_SEQ", sequenceName = "VIA_SEQ", allocationSize = 1) +@Table(name = "VIA") +public class Via implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "VIA_SEQ") + @Basic(optional = false) + @Column(name = "VIA_ID") + private Integer viaId; + @Column(name = "NOMBVIA") + private String nombvia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "via") + private List tramoList; + + public Via() { + } + + public Via(Integer viaId) { + this.viaId = viaId; + } + + public Integer getViaId() { + return viaId; + } + + public void setViaId(Integer viaId) { + this.viaId = viaId; + } + + public String getNombvia() { + return nombvia; + } + + public void setNombvia(String nombvia) { + this.nombvia = nombvia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getTramoList() { + return tramoList; + } + + public void setTramoList(List tramoList) { + this.tramoList = tramoList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (viaId != null ? viaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Via)) { + return false; + } + Via other = (Via) object; + if ((this.viaId == null && other.viaId != null) || (this.viaId != null && !this.viaId.equals(other.viaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return getNombvia(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/VigenciaTarifa.java b/src/com/rjconsultores/ventaboletos/entidad/VigenciaTarifa.java new file mode 100644 index 000000000..abedf08e7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/VigenciaTarifa.java @@ -0,0 +1,159 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author rodrigo + */ +@Entity +@SequenceGenerator(name = "VIGENCIA_TARIFA_SEQ", sequenceName = "VIGENCIA_TARIFA_SEQ", allocationSize = 1) +@Table(name = "VIGENCIA_TARIFA") +public class VigenciaTarifa implements Serializable { + + @OneToMany(mappedBy = "vigenciaTarifa") + private List tarifaHistList; + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "VIGENCIA_TARIFA_SEQ") + @Basic(optional = false) + @Column(name = "VIGENCIATARIFA_ID") + private Integer vigenciatarifaId; + @Column(name = "FECINICIOVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private java.util.Date feciniciovigencia; + @Column(name = "FECFINVIGENCIA") + @Temporal(TemporalType.TIMESTAMP) + private java.util.Date fecfinvigencia; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @Column(name = "FECHABILITACIONVENTA") + @Temporal(TemporalType.TIMESTAMP) + private java.util.Date fechabilitacionventa; + + public VigenciaTarifa() { + } + + public VigenciaTarifa(Integer vigenciatarifaId) { + this.vigenciatarifaId = vigenciatarifaId; + } + + public VigenciaTarifa(Date inicioVigencia, Date fimVigencia) { + feciniciovigencia = inicioVigencia; + fecfinvigencia = fimVigencia; + } + + public Integer getVigenciatarifaId() { + return vigenciatarifaId; + } + + public void setVigenciatarifaId(Integer vigenciatarifaId) { + this.vigenciatarifaId = vigenciatarifaId; + } + + public Date getFecfinvigencia() { + return fecfinvigencia; + } + + public void setFecfinvigencia(Date fecfinvigencia) { + this.fecfinvigencia = fecfinvigencia; + } + + public Date getFeciniciovigencia() { + return feciniciovigencia; + } + + public void setFeciniciovigencia(Date feciniciovigencia) { + this.feciniciovigencia = feciniciovigencia; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public java.util.Date getFechabilitacionventa() { + return fechabilitacionventa; + } + + public void setFechabilitacionventa(java.util.Date fechabilitacionventa) { + this.fechabilitacionventa = fechabilitacionventa; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (vigenciatarifaId != null ? vigenciatarifaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof VigenciaTarifa)) { + return false; + } + VigenciaTarifa other = (VigenciaTarifa) object; + if ((this.vigenciatarifaId == null && other.vigenciatarifaId != null) || (this.vigenciatarifaId != null && !this.vigenciatarifaId.equals(other.vigenciatarifaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + SimpleDateFormat f = new SimpleDateFormat("dd/MM/yyyy HH:mm"); + + return f.format(feciniciovigencia) + " - " + f.format(fecfinvigencia); + } + + public List getTarifaHistList() { + return tarifaHistList; + } + + public void setTarifaHistList(List tarifaHistList) { + this.tarifaHistList = tarifaHistList; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Zona.java b/src/com/rjconsultores/ventaboletos/entidad/Zona.java new file mode 100644 index 000000000..a9c59a26a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Zona.java @@ -0,0 +1,128 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author Administrador + */ +@Entity +@SequenceGenerator(name = "ZONA_SEQ", sequenceName = "ZONA_SEQ", allocationSize=1) +@Table(name = "ZONA") +public class Zona implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ZONA_SEQ") + @Column(name = "ZONA_ID") + private Integer zonaId; + @Column(name = "DESCZONA") + private String desczona; + @Column(name = "ACTIVO") + private Short activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @OneToMany(mappedBy = "zona") + private List corridaList; + + public Zona() { + } + + public Zona(Integer zonaId) { + this.zonaId = zonaId; + } + + public Integer getZonaId() { + return zonaId; + } + + public void setZonaId(Integer zonaId) { + this.zonaId = zonaId; + } + + public String getDesczona() { + return desczona; + } + + public void setDesczona(String desczona) { + this.desczona = desczona; + } + + public Short getActivo() { + return activo; + } + + public void setActivo(Short activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public List getCorridaList() { + return corridaList; + } + + public void setCorridaList(List corridaList) { + this.corridaList = corridaList; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (zonaId != null ? zonaId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Zona)) { + return false; + } + Zona other = (Zona) object; + if ((this.zonaId == null && other.zonaId != null) || (this.zonaId != null && !this.zonaId.equals(other.zonaId))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.Zona[zonaId=" + zonaId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/enums/CtrlFechamentoCaixaStatus.java b/src/com/rjconsultores/ventaboletos/enums/CtrlFechamentoCaixaStatus.java new file mode 100644 index 000000000..ebbbd0e73 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/CtrlFechamentoCaixaStatus.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum CtrlFechamentoCaixaStatus { + + LIBERADO_RETENCAO_COMISSAO, + RETENCAO_COMISSAO_EM_ANDAMENTO, + RETENCAO_COMISSAO_CONCLUIDA; + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/CustomTipo.java b/src/com/rjconsultores/ventaboletos/enums/CustomTipo.java new file mode 100644 index 000000000..0e54d2438 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/CustomTipo.java @@ -0,0 +1,36 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum CustomTipo { + + TIPO_CLIENTE(1, "Cliente"), + TIPO_SKIN(2, "Skin"), + TIPO_MENU(3, "Menu"), + TIPO_SERVIDOR(4, "Servidor"); + + private Integer valor; + private String descricao; + + private CustomTipo(Integer valor, String descricao) { + this.valor = valor; + this.descricao = descricao; + } + + public Integer getValor() { + return valor; + } + + @Override + public String toString() { + return this.descricao; + } + + public static CustomTipo getCustomTipo(Integer tValor) { + for (CustomTipo valor : CustomTipo.values()) { + if (valor.getValor().equals(tValor)) { + return valor; + } + } + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/EAmbienteContingencia.java b/src/com/rjconsultores/ventaboletos/enums/EAmbienteContingencia.java new file mode 100644 index 000000000..1175b980b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/EAmbienteContingencia.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum EAmbienteContingencia { + + PRODUCAO(1, "Produção"), + HOMOLOGACAO(2, "Homologação"); + + private Integer id; + private String descricao; + + private EAmbienteContingencia(Integer id, String descricao) { + this.id = id; + this.descricao = descricao; + } + + public Integer getId() { + return id; + } + + public String getDescricao() { + return descricao; + } + + public static EAmbienteContingencia getAmbienteContingencia(Integer id) { + for (EAmbienteContingencia ambiente : EAmbienteContingencia.values()) { + if (ambiente.getId().equals(id)) { + return ambiente; + } + } + throw new IllegalArgumentException("Ambiente contigência não definido"); + } +} diff --git a/src/com/rjconsultores/ventaboletos/enums/EStatusContingencia.java b/src/com/rjconsultores/ventaboletos/enums/EStatusContingencia.java new file mode 100644 index 000000000..072b16eb0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/EStatusContingencia.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum EStatusContingencia { + + NORMAL(1, "Normal"), + CONTINGENCIA(2, "Contingência"); + + private Integer id; + private String descricao; + + private EStatusContingencia(Integer id, String descricao) { + this.id = id; + this.descricao = descricao; + } + + public Integer getId() { + return id; + } + + public String getDescricao() { + return descricao; + } + + public static EStatusContingencia getStatusContingencia(Integer id) { + for (EStatusContingencia status : EStatusContingencia.values()) { + if (status.getId().equals(id)) { + return status; + } + } + throw new IllegalArgumentException("Status contigência não definido"); + } +} diff --git a/src/com/rjconsultores/ventaboletos/enums/EnumTipoVenda.java b/src/com/rjconsultores/ventaboletos/enums/EnumTipoVenda.java new file mode 100644 index 000000000..bb7d716aa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/EnumTipoVenda.java @@ -0,0 +1,93 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum EnumTipoVenda { + + /** + * Venda Normal => 1 + */ + TPV_NORMAL(1, true), + TPV_ALTA_FREQUENCIA(2, true), + TPV_MANUAL(3, false), + TPV_HAND_HELD(4, true), + TPV_CENTRAL_TELEFONICA(5, false), + TPV_CARGO_A_OUTROS(6, false), + TPV_RESERVA(7, true), + TPV_TRANSFERENCIAS_TROCA(8, true), + /** + * Venda em Aberto => 9 + */ + TPV_ABERTO(9, true), + TPV_CON_BUSPASS(10, true), + TPV_DOMICILIO(11, true), + TPV_POR_INTERNET(12, true), + TPV_INTERMEDIO_SIN_HOR_SIN_AS(13, true), + TPV_INTERMEDIO_CON_HOR_SIN_AS(14, true), + TPV_RESERVA_NORMAL(15, true), + TPV_RESERVA_POR_INTERNET(16, true), + TPV_BOLETO_REMOTO(18, false), + TPV_AGENCIA_WEB(19, true), + TPV_RESERVACION_LISTA_ESPERA(23, true), + TPV_TRANSF_TURISSSTE(26, true), + TPV_TRANSFERENCIA_CUPON(27, true), + TPV_VENTA_FAMSA(28, true), + TPV_TRANSFERENCIA_FAMSA(29, true), + TPV_EMPRESA_AMERICANA(31, true), + TPV_VENDA_BOLETO_ABERTO_MANUAL(39, false), + TPV_CHECKIN_VIAGEM(41, true), + TPV_BOLETO_ABERTO_PREPAGADO(49, false), + TPV_CANCELAMENTO(51, true), + TPV_CANCELAMENTO_CARGO_OTROS(52, true), + TPV_CANCELAMENTO_CIT(53, true), + TPV_RESERVACION_PAQUETE_VIAJE(57, true), + TPV_TRANSFERENCIA_CIT(54, true), + TPV_TRANSFERENCIA_A_RESERVA(55, true), + TPV_VENTA_PAQUETE_VIAJE(56, true), + TPV_CANCELAMENTO_PAQUETE(58, true), + TPV_CANCELAMENTO_TURISSSTE(59, true), + TPV_CANCELAMENTO_FAMSA(60, true), + TPV_TRANSFERENCIA_TARJETA(61, true), + TPV_TRANSFERENCIA_ORDEN_SERV(62, true), + TPV_TRANSFERENCIA_PASE_VAC_TRASLADO(63, true), + TPV_TRANSFERENCIA_CUPON_COTEMAR(64, true), + TPV_TRANSFERENCIA_CUPON_AM(65, true), + TPV_TRANSFERENCIA_CUPON_RASPA_GANA(66, true), + TPV_TRANSFERENCIA_SI_VALE(67, true), + TPV_TIEMPO_AIRE(69, true), // Venta Tiempo aire + TPV_TRANSFERENCIA_OXXO(70, true), + TPV_TRANSFERENCIA_CUPON_MONEDERO(71, true), + TPV_VENTA_RESERVACION_OXXO(72, true), + TPV_VENTA_EXTRAVIADO(73, true), + TPV_CAMBIO_VIAJE(81, true),// é a transferência de passagens + /** + * Confirmação de Venda em Aberto => 82 + */ + TPV_CONFIRMA_ABIERTO(82, true), + TPV_VENDA_PACOTE(83, true), + TPV_RESERVA_EMBARCADA(98, true), + TPV_VENTA_EMBARCADA(99, true); + + private Integer id; + private boolean isValidarFolio; + + private EnumTipoVenda(Integer id, boolean isValidarFolio) { + this.id = id; + this.isValidarFolio = isValidarFolio; + } + + public Integer getId() { + return id; + } + + public boolean isValidarFolio() { + return isValidarFolio; + } + + public static EnumTipoVenda getTipoVenda(Integer id) { + for (EnumTipoVenda tipoVenda : EnumTipoVenda.values()) { + if (tipoVenda.id.equals(id)) { + return tipoVenda; + } + } + throw new IllegalArgumentException("Tipo de venda não encontrada."); + } +} diff --git a/src/com/rjconsultores/ventaboletos/enums/FuncionSistemaEnum.java b/src/com/rjconsultores/ventaboletos/enums/FuncionSistemaEnum.java new file mode 100644 index 000000000..2d20319b9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/FuncionSistemaEnum.java @@ -0,0 +1,36 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum FuncionSistemaEnum { + + FUNCION_COBRANCA_ADICIONAL("COM.RJCONSULTORES.ADMINISTRACION.PUNTOVENTA.COBRANCAADICIONAL"), + PAINEL_VENDA_EMBARCADA("COM.RJCONSULTORES.ADMINISTRACION.GUI.SEGURIDAD.MENU.PAINELVENDAEMBARCADA"); + + + private String valor; + + + + public String getValor() { + return valor; + } + + + public void setValor(String valor) { + this.valor = valor; + } + + private FuncionSistemaEnum(String valor) { + this.valor = valor; + } + + + public static FuncionSistemaEnum getFuncionSistema(String funcionSistema) { + for (FuncionSistemaEnum funcionSistemaEnum : FuncionSistemaEnum.values()) { + if (funcionSistemaEnum.getValor().equals(funcionSistema)) { + return funcionSistemaEnum; + } + } + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/HorarioLiberacaoVendaPassagem.java b/src/com/rjconsultores/ventaboletos/enums/HorarioLiberacaoVendaPassagem.java new file mode 100644 index 000000000..d30336b61 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/HorarioLiberacaoVendaPassagem.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum HorarioLiberacaoVendaPassagem { + + HORARIO_LIBERACAO_VENDA_ORIGEM, + HORARIO_LIBERACAO_VENDA_TRECHO; + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/IndRestricaoFormaPago.java b/src/com/rjconsultores/ventaboletos/enums/IndRestricaoFormaPago.java new file mode 100644 index 000000000..dec246631 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/IndRestricaoFormaPago.java @@ -0,0 +1,33 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.enums; + +/** + * @author Thiago + * + */ +public enum IndRestricaoFormaPago { + + NORMAL("NO"), + TARIFA_E_TAXAS("TT"), + SOMENTE_TARIFA("ST"); + + String sigla; + + IndRestricaoFormaPago(String sigla) { + this.sigla = sigla; + } + + public String getSigla() { + return sigla; + } + + @Override + public String toString() { + return sigla; + } + + +} + diff --git a/src/com/rjconsultores/ventaboletos/enums/IndStatusBoleto.java b/src/com/rjconsultores/ventaboletos/enums/IndStatusBoleto.java new file mode 100644 index 000000000..e2b74bf1c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/IndStatusBoleto.java @@ -0,0 +1,74 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum IndStatusBoleto { + + V("VENDIDO", "V"), + C("CANCELADO", "C"), + T("TRANSFERIDO", "T"), + E("ENTREGUE", "E"), + S("RESERVADO", "S"), + X("EXTRAVIADO", "X"), + R("REIMPRESSO", "R"), + M("MARCADO", "M"); + + private String value; + private String shortValue; + + private IndStatusBoleto(String value, String shortValue) { + this.value = value; + this.shortValue = shortValue; + } + + public String getValue() { + return value; + } + + public String getShortValue() { + return shortValue; + } + + public static IndStatusBoleto getIndStatusBoleto(String shortValue) { + if(V.getShortValue().equals(shortValue)) { + return V; + } else if(C.getShortValue().equals(shortValue)) { + return C; + } else if(T.getShortValue().equals(shortValue)) { + return T; + } else if(E.getShortValue().equals(shortValue)) { + return E; + } else if(S.getShortValue().equals(shortValue)) { + return S; + } else if(X.getShortValue().equals(shortValue)) { + return X; + } else if(R.getShortValue().equals(shortValue)) { + return R; + } else if(M.getShortValue().equals(shortValue)) { + return M; + } + + return null; + } + + public static String getDescricao(String shortValue) { + if(V.getShortValue().equals(shortValue)) { + return V.value; + } else if(C.getShortValue().equals(shortValue)) { + return C.value; + } else if(T.getShortValue().equals(shortValue)) { + return T.value; + } else if(E.getShortValue().equals(shortValue)) { + return E.value; + } else if(S.getShortValue().equals(shortValue)) { + return S.value; + } else if(X.getShortValue().equals(shortValue)) { + return X.value; + } else if(R.getShortValue().equals(shortValue)) { + return R.value; + } else if(M.getShortValue().equals(shortValue)) { + return M.value; + } + + return null; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/enums/LocalEnderecoApanhe.java b/src/com/rjconsultores/ventaboletos/enums/LocalEnderecoApanhe.java new file mode 100644 index 000000000..395d1d6f6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/LocalEnderecoApanhe.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum LocalEnderecoApanhe { + + APANHE_EM_CASA(0,"Apanhe em Casa"), + HOTEL(1,"Hotel"), + NENHUM(2,"Nenhum"), + REGIAO_METROPOLITANA(3,"Região Metropolitana"); + + private Integer valor; + private String descricao; + + private LocalEnderecoApanhe(Integer valor, String descricao) { + this.valor = valor; + this.descricao = descricao; + } + + public Integer getValor() { + return this.valor; + } + + @Override + public String toString() { + return this.descricao; + } + + public static LocalEnderecoApanhe getLocalEnderecoApanhe(Integer valor) { + if(APANHE_EM_CASA.getValor().equals(valor)) { + return APANHE_EM_CASA; + } else if(HOTEL.getValor().equals(valor)) { + return HOTEL; + } else if(NENHUM.getValor().equals(valor)) { + return NENHUM; + } else if(REGIAO_METROPOLITANA.getValor().equals(valor)) { + return REGIAO_METROPOLITANA; + } + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/MDOrigem.java b/src/com/rjconsultores/ventaboletos/enums/MDOrigem.java new file mode 100644 index 000000000..af7abe193 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/MDOrigem.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum MDOrigem { + + INTERNO("IN"), + EVENTO_EXTRA("EE"), + FORMA_PAGAMENTO("FP"); + + private String value; + + private MDOrigem(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/MimeType.java b/src/com/rjconsultores/ventaboletos/enums/MimeType.java new file mode 100644 index 000000000..667b01061 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/MimeType.java @@ -0,0 +1,22 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum MimeType { + + PDF("application/pdf"), + XLS("application/vnd.ms-excel"), + DOC("application/msword"), + TXT("text/plain"), + ZIP("application/zip, application/x-compressed-zip"); + + private String descricao; + + private MimeType(String descricao) { + this.descricao = descricao; + } + + @Override + public String toString() { + return this.descricao; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/ModeloComissaoImpressaoPosterior.java b/src/com/rjconsultores/ventaboletos/enums/ModeloComissaoImpressaoPosterior.java new file mode 100644 index 000000000..e2423ff7a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/ModeloComissaoImpressaoPosterior.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum ModeloComissaoImpressaoPosterior { + + PADRAO, + COMPARTILHADA; + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/PricingOperacaoWS.java b/src/com/rjconsultores/ventaboletos/enums/PricingOperacaoWS.java new file mode 100644 index 000000000..eebcae99d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/PricingOperacaoWS.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum PricingOperacaoWS { + + INCLUIR, ALTERAR, EXCLUIR, INATIVAR; + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/RelatorioMovimentacaoBilheteStatusEnum.java b/src/com/rjconsultores/ventaboletos/enums/RelatorioMovimentacaoBilheteStatusEnum.java new file mode 100644 index 000000000..314498fb5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/RelatorioMovimentacaoBilheteStatusEnum.java @@ -0,0 +1,57 @@ +package com.rjconsultores.ventaboletos.enums; + +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public enum RelatorioMovimentacaoBilheteStatusEnum { + + VENDIDO("Vendido", "VENDIDO"), CANCELADO("Cancelado", "CANCELADO"), DEVOLVIDO("Devolvido", "DEVOLVIDO"), CANCELADO_EMERGENCIAL("Cancelado emergencial", "CANCEC. EMERG"), TROCA("Troca", "TROCA", "TROCA PASSAGEM"), TRANSFERENCIA("Transferência", "TRANSFERIDO", "TRANSFERÊNCIA"), REATIVACAO("Reativação", "CHECKIN REATIVADO", "REATIVADO"), TROCA_TITULARIDADE("Troca de Titularidade", "TITULARIDADE TROCADA", "TROCA TITULARIDADE"), TROCA_POLTRONA("Troca de Poltrona", "POLTRONA ALTERADA", "TROCA POLTRONA"), NO_SHOW("No-Show", "NO-SHOW"), CHECK_IN("Check-in", "CHECK-IN"), ENTREGA("Entrega", "ENTREGUE"), RESERVA("Reserva", "RESERVA", "CONFIRMA RESERVA", "LIBERA RESERVA"); + + private String descricaoTela; + private String statusRelatorio; + private List statusRelatorioAnterior; + + private RelatorioMovimentacaoBilheteStatusEnum(String descricaoTela, String statusRelatorio) { + this.descricaoTela = descricaoTela; + this.statusRelatorio = statusRelatorio; + } + + private RelatorioMovimentacaoBilheteStatusEnum(String descricaoTela, String statusRelatorio, String... statusRelatorioAnterior) { + this.descricaoTela = descricaoTela; + this.statusRelatorio = statusRelatorio; + if (statusRelatorioAnterior != null) { + this.statusRelatorioAnterior = Arrays.asList(statusRelatorioAnterior); + } + } + + public String getDescricaoTela() { + return descricaoTela; + } + + public String getStatusRelatorio() { + return statusRelatorio; + } + + public List getStatusRelatorioAnterior() { + return statusRelatorioAnterior; + } + + @Override + public String toString() { + return this.descricaoTela; + } + + public static List getListaOrdenada() { + List listaOrdenada = Arrays.asList(values()); + Collections.sort(listaOrdenada, new Comparator() { + @Override + public int compare(RelatorioMovimentacaoBilheteStatusEnum o1, RelatorioMovimentacaoBilheteStatusEnum o2) { + return o1.getDescricaoTela().compareToIgnoreCase(o2.getDescricaoTela()); + } + }); + + return listaOrdenada; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/enums/RelatorioVendaCartaoCashMonitorModeloEnum.java b/src/com/rjconsultores/ventaboletos/enums/RelatorioVendaCartaoCashMonitorModeloEnum.java new file mode 100644 index 000000000..c8511cfea --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/RelatorioVendaCartaoCashMonitorModeloEnum.java @@ -0,0 +1,21 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum RelatorioVendaCartaoCashMonitorModeloEnum { + + COM_VALORES_TOTAIS_VENDAS("Com valores totais das vendas"), ABERTO_POR_PARCELAS("Aberto por parcelas"); + + private String descricao; + + private RelatorioVendaCartaoCashMonitorModeloEnum(String descricao) { + this.descricao = descricao; + } + + public String getDescricao() { + return descricao; + } + + @Override + public String toString() { + return getDescricao(); + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/enums/SistemaEnum.java b/src/com/rjconsultores/ventaboletos/enums/SistemaEnum.java new file mode 100644 index 000000000..185533182 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/SistemaEnum.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum SistemaEnum { + + VENDA_CLIENTE(1, "Venda Cliente"), + VENDA_SERVIDOR(2, "Venda Servidor"), + ADM(3, "Administração"); + + private Integer valor; + private String descricao; + + private SistemaEnum(Integer valor, String descricao) { + this.valor = valor; + this.descricao = descricao; + } + + public Integer getValor() { + return this.valor; + } + + @Override + public String toString() { + return this.descricao; + } + + public static SistemaEnum getSistema(Integer tValor) { + for (SistemaEnum valor : SistemaEnum.values()) { + if (valor.getValor().equals(tValor)) { + return valor; + } + } + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/SituacaoBoleto.java b/src/com/rjconsultores/ventaboletos/enums/SituacaoBoleto.java new file mode 100644 index 000000000..68755dfee --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/SituacaoBoleto.java @@ -0,0 +1,28 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum SituacaoBoleto { + + TODAS(-1, "Todas"), ANULADO(31, "Anulado"), DEVOLVIDO(32, "Devolvido"), REMARCADO(23, "Remarcado"), TROCADO(10, "Trocado"), VENDIDO(1, "Vendido"); + + private String situacao; + private Integer codigo; + + private SituacaoBoleto(Integer codigo, String situacao) { + this.situacao = situacao; + this.codigo = codigo; + } + + public String getSituacao() { + return this.situacao; + } + + public Integer getCodigo() { + return codigo; + } + + @Override + public String toString() { + return this.situacao; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/SituacaoNotaCreditoVendaPacote.java b/src/com/rjconsultores/ventaboletos/enums/SituacaoNotaCreditoVendaPacote.java new file mode 100644 index 000000000..46159eb8a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/SituacaoNotaCreditoVendaPacote.java @@ -0,0 +1,25 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum SituacaoNotaCreditoVendaPacote { + + DISPONIVEL(0,"Disponível"), + UTILIZADA(1,"Utilizada"); + + private Integer value; + private String descricao; + + private SituacaoNotaCreditoVendaPacote(Integer value, String descricao) { + this.value = value; + this.descricao = descricao; + } + + public Integer getValue() { + return this.value; + } + + @Override + public String toString() { + return this.descricao; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/SituacaoVendaPacote.java b/src/com/rjconsultores/ventaboletos/enums/SituacaoVendaPacote.java new file mode 100644 index 000000000..653e09c72 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/SituacaoVendaPacote.java @@ -0,0 +1,39 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum SituacaoVendaPacote { + + PAGO(0,"Pago"), + RESERVA(1,"Reserva"), + CANCELADO(2,"Cancelado"); + + private Integer value; + private String descricao; + + private SituacaoVendaPacote(Integer value, String descricao) { + this.value = value; + this.descricao = descricao; + } + + @Override + public String toString() { + return this.descricao; + } + + public static SituacaoVendaPacote getSituacaoVendaPacote(Integer value) { + switch (value) { + case 0: + return PAGO; + case 1: + return RESERVA; + case 2: + return CANCELADO; + default: + return null; + } + } + + public Integer getShortValue() { + return value; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/StatusAutorizacaoRuta.java b/src/com/rjconsultores/ventaboletos/enums/StatusAutorizacaoRuta.java new file mode 100644 index 000000000..d980432d4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/StatusAutorizacaoRuta.java @@ -0,0 +1,54 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum StatusAutorizacaoRuta { + EM_ANALISE(0, "EM ANALISE"), + LIBERADO(1, "LIBERADO"), + BLOQUEADO(2, "BLOQUEADO"); + + private Integer status; + private String descricao; + + private StatusAutorizacaoRuta(Integer status, String descricao) { + this.descricao = descricao; + this.status = status; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public static String buscarStatus(Integer id) { + for (StatusAutorizacaoRuta status : StatusAutorizacaoRuta.values()) { + if (status.getStatus() == id) { + return status.getDescricao(); + } + } + return null; + } + + public static StatusAutorizacaoRuta buscarPorStatus(Integer id) { + for (StatusAutorizacaoRuta status : StatusAutorizacaoRuta.values()) { + if (status.getStatus() == id) { + return status; + } + } + return null; + } + + @Override + public String toString() { + return descricao; + } +} diff --git a/src/com/rjconsultores/ventaboletos/enums/StatusFlexBus.java b/src/com/rjconsultores/ventaboletos/enums/StatusFlexBus.java new file mode 100644 index 000000000..d3bb2af74 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/StatusFlexBus.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.enums; + +/** + * @author Valdir Cordeiro + * + */ +public enum StatusFlexBus { + + EM_RESERVA(0, "EM RESERVA"), + CONFIRMADO_AUTOMATICAMENTE(1, "CONFIRMADO AUTOMATICAMENTE"), + CONFIRMADO_MANUALMENTE(2, "CONFIRMADO MANUALMENTE"), + CANCELADO_AUTOMATICAMENTE( 3, "CANCELADO AUTOMATICAMENTE"), + CANCELADO_MANUALMENTE(4, "CANCELADO MANUALMENTE"); + + private Integer status; + private String descricao; + + private StatusFlexBus(Integer status, String descricao) { + this.descricao = descricao; + this.status = status; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public static String buscarStatus(Integer id) { + for (StatusFlexBus status : StatusFlexBus.values()) { + if (status.getStatus() == id) { + return status.getDescricao(); + } + } + return null; + } + + public static StatusFlexBus buscarPorStatus(Integer id) { + for (StatusFlexBus status : StatusFlexBus.values()) { + if (status.getStatus() == id) { + return status; + } + } + return null; + } + + @Override + public String toString() { + return descricao; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/StatusIntegracaoSap.java b/src/com/rjconsultores/ventaboletos/enums/StatusIntegracaoSap.java new file mode 100644 index 000000000..d72837cdf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/StatusIntegracaoSap.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum StatusIntegracaoSap { + INTEGRADO, + NAO_INTEGRADO, + PENDENTE; +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoAntifraude.java b/src/com/rjconsultores/ventaboletos/enums/TipoAntifraude.java new file mode 100644 index 000000000..10593096c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoAntifraude.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum TipoAntifraude { + + KONDUTO; + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoBloqueioDispositivoEmbarcadaEnum.java b/src/com/rjconsultores/ventaboletos/enums/TipoBloqueioDispositivoEmbarcadaEnum.java new file mode 100644 index 000000000..4abf17fc8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoBloqueioDispositivoEmbarcadaEnum.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum TipoBloqueioDispositivoEmbarcadaEnum { + + DISPOSITIVO_BLOQUEADO(1, "BLOQUEADO"), DISPOSITIVO_MANUTENCAO(2, "MANUTENÇÃO"), DISPOSITIVO_BAIXADO(3, "BAIXADO"); + + private Integer valor; + private String descricao; + + private TipoBloqueioDispositivoEmbarcadaEnum(Integer valor, String descricao) { + this.valor = valor; + this.descricao = descricao; + } + + public Integer getValor() { + return valor; + } + + public void setValor(Integer valor) { + this.valor = valor; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public static TipoBloqueioDispositivoEmbarcadaEnum getTipoDispositivoEmbarcada(Integer valor) { + if (valor != null) { + for (TipoBloqueioDispositivoEmbarcadaEnum tde : TipoBloqueioDispositivoEmbarcadaEnum.values()) { + if (tde.getValor().equals(valor)) { + return tde; + } + } + } + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoCarteiraDigital.java b/src/com/rjconsultores/ventaboletos/enums/TipoCarteiraDigital.java new file mode 100644 index 000000000..52c37ac8d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoCarteiraDigital.java @@ -0,0 +1,27 @@ +package com.rjconsultores.ventaboletos.enums; + +import org.zkoss.util.resource.Labels; + +public enum TipoCarteiraDigital { + + TROCO_SIMPLES(Labels.getLabel("editarFormaPagoController.lblCateiraDigitalTrocoSimples.label")), + TEF(Labels.getLabel("editarFormaPagoController.lblCateiraDigitalTef.label")), + TPI(Labels.getLabel("editarFormaPagoController.lblCateiraDigitalTpi.label")), + CIELO_LINK(Labels.getLabel("editarFormaPagoController.lblCateiraDigitalCielo.label")); + + private String descricao; + + private TipoCarteiraDigital(String descricao) { + this.descricao = descricao; + } + + public String getDescricao() { + return descricao; + } + + @Override + public String toString() { + return getDescricao(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoClasseServicoBPe.java b/src/com/rjconsultores/ventaboletos/enums/TipoClasseServicoBPe.java new file mode 100644 index 000000000..0f9e27a83 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoClasseServicoBPe.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.enums; + +import java.util.Arrays; +import java.util.List; + +import org.zkoss.util.resource.Labels; + +public enum TipoClasseServicoBPe { + + CONVENCIONAL_COM_SANITARIO(1, Labels.getLabel("editarClaseServicioController.tipoServicoBPe.1")), + CONVENCIONAL_SEMM_SANITARIO(2, Labels.getLabel("editarClaseServicioController.tipoServicoBPe.2")), + SEMILEITO(3, Labels.getLabel("editarClaseServicioController.tipoServicoBPe.3")), + LEITO_COM_AR_CONDICIONADO(4, Labels.getLabel("editarClaseServicioController.tipoServicoBPe.4")), + LEITO_SEM_AR_CONDICIONADO(5, Labels.getLabel("editarClaseServicioController.tipoServicoBPe.5")), + EXECUTIVO(6, Labels.getLabel("editarClaseServicioController.tipoServicoBPe.6")), + SEMIURBANO(7, Labels.getLabel("editarClaseServicioController.tipoServicoBPe.7")), + LONGITUDINAL(8, Labels.getLabel("editarClaseServicioController.tipoServicoBPe.8")), + TRAVESSIA(9, Labels.getLabel("editarClaseServicioController.tipoServicoBPe.9")), + CAMA(10, Labels.getLabel("editarClaseServicioController.tipoServicoBPe.10")), + MICRO_ONIBUS(11, Labels.getLabel("editarClaseServicioController.tipoServicoBPe.11")); + + private Integer codigo; + private String descricao; + + private TipoClasseServicoBPe(Integer codigo, String descricao) { + this.codigo = codigo; + this.descricao = descricao; + } + + public Integer getCodigo() { + return codigo; + } + + public String getDescricao() { + return descricao; + } + + @Override + public String toString() { + return getDescricao(); + } + + public static List getList() { + return Arrays.asList(TipoClasseServicoBPe.values()); + } + + public static TipoClasseServicoBPe getTipo(Integer codigo) { + for (TipoClasseServicoBPe tipoClasseServicoBPe : TipoClasseServicoBPe.values()) { + if(tipoClasseServicoBPe.getCodigo().equals(codigo)) { + return tipoClasseServicoBPe; + } + } + return TipoClasseServicoBPe.CONVENCIONAL_COM_SANITARIO; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoCstGratuidade.java b/src/com/rjconsultores/ventaboletos/enums/TipoCstGratuidade.java new file mode 100644 index 000000000..b531ac447 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoCstGratuidade.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum TipoCstGratuidade { + + CST00, + CST40, + CST41; + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoDescontoBPe.java b/src/com/rjconsultores/ventaboletos/enums/TipoDescontoBPe.java new file mode 100644 index 000000000..16424dda2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoDescontoBPe.java @@ -0,0 +1,48 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum TipoDescontoBPe { + + TARIFA_PROMOCIONAL("01","Tarifa promocional"), + IDOSO("02", "Idoso"), + CRIANCA("03", "Criança"), + DEFICIENTE("04", "Deficiente"), + ESTUDANTE("05", "Estudante"), + ANIMAL_DOMESTICO("06", "Animal Doméstico"), + ACORDO_COLETIVO("07", "Acordo Coletivo"), + PROFISSIONAL_EM_DESLOCAMENTO("08", "Profissional em Deslocamento"), + PROFISSIONAL_DA_EMPRESA("09", "Profissional da Empresa"), + JOVEM("10", "Jovem"), + OUTROS("99", "Outros"); + + private String valor; + private String descricao; + + private TipoDescontoBPe(String valor, String descricao) { + this.valor = valor; + this.descricao = descricao; + } + + public String getValor() { + return valor; + } + public String getDescricao() { + return descricao; + } + + public static TipoDescontoBPe geTipoDesconto(String valor) { + + for (TipoDescontoBPe desconto : TipoDescontoBPe.values()) { + if (desconto.getValor().equals(valor)) { + return desconto; + } + } + + return OUTROS; + } + + @Override + public String toString() { + return this.descricao; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoDescontoMonitrip.java b/src/com/rjconsultores/ventaboletos/enums/TipoDescontoMonitrip.java new file mode 100644 index 000000000..0f0789858 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoDescontoMonitrip.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum TipoDescontoMonitrip { + + NORMAL(1,"Tarifa Normal – sem desconto"), + TARIFA_PROMOCIONAL(2, "Tarifa Promocional"), + IDOSO_100(5, "Bilhete de Viagem do Idoso 100%"), + IDOSO_50(6, "Bilhete de Viagem do Idoso 50%"), + AUT_VIAGEM_LIVRE(7, "Autorização de Viagem - Passe Livre"), + AUDITORES_AGENTES(8, "Passe Livre Auditores e Agentes do Trabalho"), + GRATUIDADE_CRIANCA(9, "Gratuidade de Criança"), + JOVEM_BAIXA_RENDA_100(10, "Gratuidade Jovem de Baixa Renda 100%"), + JOVEM_BAIXA_RENDA_50(11, "Gratuidade Jovem de Baixa Renda 50%"), + AUT_VIAGEM_ACOMP(12, "Autorização de Viagem - Passe Livre Acompanhante"); + + private Integer valor; + private String descricao; + + private TipoDescontoMonitrip(Integer valor, String descricao) { + this.valor = valor; + this.descricao = descricao; + } + + public Integer getValor() { + return valor; + } + public String getDescricao() { + return descricao; + } + + public static TipoDescontoMonitrip geTipoDescontoMonitrip(Integer valor) { + if(NORMAL.getValor().equals(valor)) { + return NORMAL; + } else if(TARIFA_PROMOCIONAL.getValor().equals(valor)) { + return TARIFA_PROMOCIONAL; + } else if(IDOSO_100.getValor().equals(valor)) { + return IDOSO_100; + } else if(IDOSO_50.getValor().equals(valor)) { + return IDOSO_50; + } else if(AUT_VIAGEM_LIVRE.getValor().equals(valor)) { + return AUT_VIAGEM_LIVRE; + } else if(AUDITORES_AGENTES.getValor().equals(valor)) { + return AUDITORES_AGENTES; + } else if(GRATUIDADE_CRIANCA.getValor().equals(valor)) { + return GRATUIDADE_CRIANCA; + } else if(JOVEM_BAIXA_RENDA_100.getValor().equals(valor)) { + return JOVEM_BAIXA_RENDA_100; + } else if(JOVEM_BAIXA_RENDA_50.getValor().equals(valor)) { + return JOVEM_BAIXA_RENDA_50; + } else if(AUT_VIAGEM_ACOMP.getValor().equals(valor)) { + return AUT_VIAGEM_ACOMP; + } + + return NORMAL; + } + + @Override + public String toString() { + return this.descricao; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoEnvioRest.java b/src/com/rjconsultores/ventaboletos/enums/TipoEnvioRest.java new file mode 100644 index 000000000..80666c846 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoEnvioRest.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum TipoEnvioRest { + GET, + POST; +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java b/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java new file mode 100644 index 000000000..e254c14fe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java @@ -0,0 +1,74 @@ +package com.rjconsultores.ventaboletos.enums; + +import org.zkoss.util.resource.Labels; + +public enum TipoFormapago { + + DINHEIRO(0,Labels.getLabel("editarFormaPagoController.lblDinheiro.label")), + DEBITO(1,Labels.getLabel("editarFormaPagoController.lblDebito.label")), + CREDITO(2,Labels.getLabel("editarFormaPagoController.lblCredito.label")), + NOTA_CREDITO(3,Labels.getLabel("editarFormaPagoController.lblNotaCredito.label")), + TROCA_PASSAGEM(4,Labels.getLabel("editarFormaPagoController.lblTrocaPassagem.label")), + IMPRESSAO_PASSAGEM(5,Labels.getLabel("editarFormaPagoController.lblImpressaoPassagem.label")), + ORDEM_SERVICO(6,Labels.getLabel("editarFormaPagoController.lblOrdemServico.label")), + BOLETO_ABERTO(7,Labels.getLabel("editarFormaPagoController.lblBoletoAberto.label")), + PACOTE(8,Labels.getLabel("editarFormaPagoController.lblPacote.label")), + RESERVA(9,Labels.getLabel("editarFormaPagoController.lblReserva.label")), + CHEQUE(10,Labels.getLabel("editarFormaPagoController.lblCheque.label")), + DEPOSITO(11,Labels.getLabel("editarFormaPagoController.lblDeposito.label")), + CARTEIRA_DIGITAL(12,Labels.getLabel("editarFormaPagoController.lblCarteiraDigital.label")), + SMART_CARD(13,Labels.getLabel("editarFormaPagoController.lblSmartCard.label")), + LOGPAY(14,Labels.getLabel("editarFormaPagoController.lblLogpay.label")); + + private Integer valor; + private String descricao; + + private TipoFormapago(Integer valor, String descricao) { + this.valor = valor; + this.descricao = descricao; + } + + public String getDescricao() { + return descricao; + } + + @Override + public String toString() { + return getDescricao(); + } + + public Integer getValor() { + return valor; + } + + public static TipoFormapago getTipoFormapagoByValor(Integer valor) { + if(TipoFormapago.DINHEIRO.getValor().equals(valor)) { + return TipoFormapago.DINHEIRO; + } else if(TipoFormapago.DEBITO.getValor().equals(valor)) { + return TipoFormapago.DEBITO; + } else if(TipoFormapago.CREDITO.getValor().equals(valor)) { + return TipoFormapago.CREDITO; + } else if(TipoFormapago.NOTA_CREDITO.getValor().equals(valor)) { + return TipoFormapago.NOTA_CREDITO; + } else if(TipoFormapago.TROCA_PASSAGEM.getValor().equals(valor)) { + return TipoFormapago.TROCA_PASSAGEM; + } else if(TipoFormapago.IMPRESSAO_PASSAGEM.getValor().equals(valor)) { + return TipoFormapago.IMPRESSAO_PASSAGEM; + } else if(TipoFormapago.ORDEM_SERVICO.getValor().equals(valor)) { + return TipoFormapago.ORDEM_SERVICO; + } else if(TipoFormapago.BOLETO_ABERTO.getValor().equals(valor)) { + return TipoFormapago.BOLETO_ABERTO; + } else if(TipoFormapago.PACOTE.getValor().equals(valor)) { + return TipoFormapago.PACOTE; + } else if(TipoFormapago.RESERVA.getValor().equals(valor)) { + return TipoFormapago.RESERVA; + } else if(TipoFormapago.CHEQUE.getValor().equals(valor)) { + return TipoFormapago.CHEQUE; + } else if(TipoFormapago.DEPOSITO.getValor().equals(valor)) { + return TipoFormapago.DEPOSITO; + } + + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoIdentificacionDoc.java b/src/com/rjconsultores/ventaboletos/enums/TipoIdentificacionDoc.java new file mode 100644 index 000000000..61cc26088 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoIdentificacionDoc.java @@ -0,0 +1,238 @@ +package com.rjconsultores.ventaboletos.enums; + +import org.apache.commons.lang.StringUtils; +import org.brazilutils.br.cpfcnpj.Cnpj; +import org.brazilutils.br.cpfcnpj.Cpf; +import org.brazilutils.validation.ValidationException; + +public enum TipoIdentificacionDoc { + RG(1), + CPF(2), + CI(12), + PASPT(13), + RUT(14), + DOCX(22), + CNPJ(15), + CN(23), + RNE(24), + DOC_IDOSO(25), + DNI(26), + TODOS(0); + + private Integer id; + + private TipoIdentificacionDoc(Integer id) { + this.id = id; + } + + public Integer getId() { + return this.id; + } + + public static TipoIdentificacionDoc getById(Byte id) { + if (id == null) { + return null; + } + TipoIdentificacionDoc tmp = null; + switch (id.intValue()) { + case 1: + tmp = TipoIdentificacionDoc.RG; + break; + case 2: + tmp = TipoIdentificacionDoc.CPF; + break; + case 12: + tmp = TipoIdentificacionDoc.CI; + break; + case 13: + tmp = TipoIdentificacionDoc.PASPT; + break; + case 14: + tmp = TipoIdentificacionDoc.RUT; + break; + case 22: + tmp = TipoIdentificacionDoc.DOCX; + break; + case 15: + tmp = TipoIdentificacionDoc.CNPJ; + break; + case 23: + tmp = TipoIdentificacionDoc.CN; + break; + case 24: + tmp = TipoIdentificacionDoc.RNE; + break; + case 25: + tmp = TipoIdentificacionDoc.DOC_IDOSO; + break; + case 26: + tmp = TipoIdentificacionDoc.DNI; + break; + + default: + break; + } + return tmp; + } + + public static TipoIdentificacionDoc[] getTodos() { + return new TipoIdentificacionDoc[]{TipoIdentificacionDoc.RG, + TipoIdentificacionDoc.CPF, + TipoIdentificacionDoc.CI, + TipoIdentificacionDoc.PASPT, + TipoIdentificacionDoc.RUT, + TipoIdentificacionDoc.DOCX, + TipoIdentificacionDoc.CNPJ, + TipoIdentificacionDoc.CN, + TipoIdentificacionDoc.RNE, + TipoIdentificacionDoc.DOC_IDOSO, + TipoIdentificacionDoc.DNI + }; + } + + + + public static String getDescricao(Byte id) { + if (id == null) { + return null; + } + switch (id) { + case 1: case 10: + return "RG"; + case 2: case 11: + return "CPF"; + case 12: + return "CI"; + case 13: + return "PASPT"; + case 14: + return "RUT"; + case 22: + return "DOCX"; + case 15: + return "CNPJ"; + case 23: + return "CN"; + case 24: + return "RNE"; + case 25: + return "DOC_IDOSO"; + case 26: + return "DNI"; + default: + return ""; + } + } + + public static TipoIdentificacionDoc[] getTipoDocExcluindoCPF() { + return new TipoIdentificacionDoc[]{TipoIdentificacionDoc.RG, + TipoIdentificacionDoc.CI, + TipoIdentificacionDoc.PASPT, + TipoIdentificacionDoc.RUT, + TipoIdentificacionDoc.DOCX, + TipoIdentificacionDoc.CNPJ, + TipoIdentificacionDoc.CN, + TipoIdentificacionDoc.RNE, + TipoIdentificacionDoc.DOC_IDOSO, + TipoIdentificacionDoc.DNI + }; + } + + public static TipoIdentificacionDoc getTipo(String descTipoDoc) { + if(descTipoDoc != null) { + if(descTipoDoc.equals("RG")) { + return TipoIdentificacionDoc.RG; + } else if(descTipoDoc.equals("CPF")) { + return TipoIdentificacionDoc.CPF; + } else if(descTipoDoc.equals("CI")) { + return TipoIdentificacionDoc.RG; + } else if(descTipoDoc.equals("PASPT")) { + return TipoIdentificacionDoc.PASPT; + } else if(descTipoDoc.equals("RUT")) { + return TipoIdentificacionDoc.RUT; + } else if(descTipoDoc.equals("DOCX")) { + return TipoIdentificacionDoc.DOCX; + } else if(descTipoDoc.equals("CNPJ")) { + return TipoIdentificacionDoc.CNPJ; + } else if(descTipoDoc.equals("CN")) { + return TipoIdentificacionDoc.CN; + } else if(descTipoDoc.equals("RNE")) { + return TipoIdentificacionDoc.RNE; + } else if(descTipoDoc.equals("DOC_IDOSO")) { + return TipoIdentificacionDoc.DOC_IDOSO; + } else if(descTipoDoc.equals("DNI")) { + return TipoIdentificacionDoc.DNI; + }else { + return null; + } + } + + return null; + } + + public static boolean isExisteTipoIdentificacionDoc(String descTipoDoc) { + return getTipo(descTipoDoc) != null; + } + + public static boolean isRGBPeValido(String value) { + return value == null ? false : value.trim().matches("\\d.*\\d.*|[a-zA-Z]+\\d.*\\d.*"); + } + + public static boolean isCPFValido(String doc) { + try { + String tmp = StringUtils.isBlank(doc) ? "" : doc; + Cpf cpf = new Cpf(tmp.trim()); + + return cpf.isValid(); + } catch (ValidationException e1) { + return false; + } + } + + public static boolean isCNPJValido(String doc) { + try { + String tmp = StringUtils.isBlank(doc) ? "" : doc; + Cnpj cnpj = new Cnpj(tmp.trim()); + + return cnpj.isValid(); + } catch (ValidationException e1) { + return false; + } + } + + public static boolean isRUTValido(String rut) { + boolean validacion = false; + try { + rut = rut.toUpperCase(); + rut = rut.replace(".", ""); + rut = rut.replace("-", ""); + int rutAux = Integer.parseInt(rut.substring(0, rut.length() - 1)); + + char dv = rut.charAt(rut.length() - 1); + + int m = 0, s = 1; + for (; rutAux != 0; rutAux /= 10) { + s = (s + rutAux % 10 * (9 - m++ % 6)) % 11; + } + if (dv == (char) (s != 0 ? s + 47 : 75)) { + validacion = true; + } + + } catch (Exception e) { + } + return validacion; + } + + public static boolean isPASPTValido(String numDoc) { + String paspt = numDoc.replaceAll("[^\\d]", ""); + + //O passaporte não aceita menos de 4 numeros ou somente letras + if (!StringUtils.isBlank(paspt) && paspt.length() < 4) { + return false; + } else if (StringUtils.isBlank(paspt) && !StringUtils.isBlank(numDoc)) { + return false; + } + + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoImpressora.java b/src/com/rjconsultores/ventaboletos/enums/TipoImpressora.java new file mode 100644 index 000000000..4a153ef1e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoImpressora.java @@ -0,0 +1,64 @@ +package com.rjconsultores.ventaboletos.enums; + +import org.zkoss.util.resource.Labels; + +public enum TipoImpressora { + + MATRICIAL(0, Labels.getLabel("editarEstacionController.tipoImpressora.matricial"), false), + BEMATECH_FISCAL(1, Labels.getLabel("editarEstacionController.tipoImpressora.bematechFiscal"), true), + BEMATECH_FISCAL_BLINDADA(2, Labels.getLabel("editarEstacionController.tipoImpressora.bematechFiscalBlindada"), true), + CENTRAL_EMISSAO(3, Labels.getLabel("editarEstacionController.tipoImpressora.centralEmissao"), true), + DARUMA(4, Labels.getLabel("editarEstacionController.tipoImpressora.darumaFiscal"), true), + DARUMA_BLINDADA(5, Labels.getLabel("editarEstacionController.tipoImpressora.darumaFiscalBlindada"), true), + STOCK_CENTRAL(6, Labels.getLabel("editarEstacionController.tipoImpressora.stockCentral"), true), + BPE(7, Labels.getLabel("editarEstacionController.tipoImpressora.bpe"), true); + + private final int codigo; + private final String nome; + private final boolean isImpressoraFiscal; + + private TipoImpressora(int codigo, String nome, boolean isImpressoraFiscal) { + this.codigo = codigo; + this.nome = nome; + this.isImpressoraFiscal = isImpressoraFiscal; + } + + public Integer getCodigo() { + return codigo; + } + + public String getNome() { + return nome; + } + + public Boolean isImpressoraFiscal() { + return isImpressoraFiscal; + } + + public static TipoImpressora getTipoImpressora(final int value) { + for (TipoImpressora tipo : TipoImpressora.values()) { + if (tipo.getCodigo() == value) { + return tipo; + } + } + return null; + } + + public static TipoImpressora getTipoImpressoraPorNome(final String nome) { + for (TipoImpressora tipo : TipoImpressora.values()) { + if (tipo.getNome().equals(nome)) { + return tipo; + } + } + return null; + } + + public static TipoImpressora getTipoImpressoraFiscal(final int value) { + TipoImpressora tipo = getTipoImpressora(value); + if (tipo != null && tipo.isImpressoraFiscal()) { + return tipo; + } + + return null; + } +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoImpressoraRelatorio.java b/src/com/rjconsultores/ventaboletos/enums/TipoImpressoraRelatorio.java new file mode 100644 index 000000000..787759ea9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoImpressoraRelatorio.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum TipoImpressoraRelatorio { + + A4(1, "Tipo Impressora A4"), + TERMICA(2, "Tipo Impressora Térmica"); + + private Integer id; + private String descricao; + + private TipoImpressoraRelatorio(Integer id, String descricao) { + this.id = id; + this.descricao = descricao; + } + + public Integer getId() { + return id; + } + + public String getDescricao() { + return descricao; + } + + public static TipoImpressoraRelatorio getTipoImpressoraRelatorio(Integer id) { + for (TipoImpressoraRelatorio tpImpressora : TipoImpressoraRelatorio.values()) { + if (tpImpressora.getId().equals(id)) { + return tpImpressora; + } + } + throw new IllegalArgumentException("Tipo de impressora relatório não encontrado."); + } +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoIntegracaoTEF.java b/src/com/rjconsultores/ventaboletos/enums/TipoIntegracaoTEF.java new file mode 100644 index 000000000..89eef7be4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoIntegracaoTEF.java @@ -0,0 +1,28 @@ +package com.rjconsultores.ventaboletos.enums; + +import java.util.Arrays; +import java.util.List; + +public enum TipoIntegracaoTEF { + + SITEF("Sitef"), + PAYGO("PayGo"), + GRANITO("Granito"), + ; + + private String descricao; + + private TipoIntegracaoTEF(String descricao) { + this.descricao = descricao; + } + + @Override + public String toString() { + return descricao; + } + + public static List list() { + return Arrays.asList(values()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoPassagemCores.java b/src/com/rjconsultores/ventaboletos/enums/TipoPassagemCores.java new file mode 100644 index 000000000..f64e8e31b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoPassagemCores.java @@ -0,0 +1,46 @@ +package com.rjconsultores.ventaboletos.enums; + +import java.util.Arrays; +import java.util.List; + +public enum TipoPassagemCores { + + VERDE("VERDE","/gui/img/tipo_passagem/verde.png"), + VERDE_MUSGO("VERDE_MUSGO","/gui/img/tipo_passagem/verde_musgo.png"), + LARANJA("LARANJA","/gui/img/tipo_passagem/laranja.png"), + BEGE("BEGE","/gui/img/tipo_passagem/bege.png"), + LILAS("LILAS","/gui/img/tipo_passagem/lilas.png"), + MARROM("MARROM","/gui/img/tipo_passagem/marrom.png"), + ROSA("ROSA","/gui/img/tipo_passagem/rosa.png"), + ROSA_CHOQUE("ROSA_CHOQUE","/gui/img/tipo_passagem/rosa_c.png"), + ROXO("ROXO","/gui/img/tipo_passagem/roxo.png"), + AZUL("AZUL","/gui/img/tipo_passagem/azul.png"), + AZUL_MARINHO("AZUL_MARINHO","/gui/img/tipo_passagem/azul_mar.png"), + AZUL_PISCINA("AZUL_PISCINA","/gui/img/tipo_passagem/azul_p.png"); + + private String descricao; + private String url; + + private TipoPassagemCores(String descricao, String url) { + this.descricao = descricao; + this.url = url; + } + + public static List getLista() { + return Arrays.asList(TipoPassagemCores.values()); + } + + @Override + public String toString() { + return descricao; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoPessoa.java b/src/com/rjconsultores/ventaboletos/enums/TipoPessoa.java new file mode 100644 index 000000000..6799aa02e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoPessoa.java @@ -0,0 +1,34 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum TipoPessoa { + + FISICA(0,"Pessoa Física"), + JURIDICA(1, "Pessoa Jurídica"); + + private Integer valor; + private String descricao; + + private TipoPessoa(Integer valor, String descricao) { + this.valor = valor; + this.descricao = descricao; + } + + public Integer getValor() { + return this.valor; + } + + @Override + public String toString() { + return this.descricao; + } + + public static TipoPessoa getTipoPessoa(Integer tipoPessoa) { + if(FISICA.getValor().equals(tipoPessoa)) { + return FISICA; + } else if(JURIDICA.getValor().equals(tipoPessoa)) { + return JURIDICA; + } + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoSocio.java b/src/com/rjconsultores/ventaboletos/enums/TipoSocio.java new file mode 100644 index 000000000..ec82692ff --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoSocio.java @@ -0,0 +1,26 @@ +package com.rjconsultores.ventaboletos.enums; + +import org.zkoss.util.resource.Labels; + +public enum TipoSocio { + + SOCIO_ADMINISTRADOR(Labels.getLabel("editarPuntoVentaController.lbTipoSocioAdministrador.value")), + SOCIO_PROPRIETARIO(Labels.getLabel("editarPuntoVentaController.lbTipoSocioProprietario.value")), + PROPRIETARIO(Labels.getLabel("editarPuntoVentaController.lbTipoProprietario.value")); + + private String descricao; + + private TipoSocio(String descricao) { + this.descricao = descricao; + } + + public String getDescricao() { + return descricao; + } + + @Override + public String toString() { + return getDescricao(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TypeContentEmail.java b/src/com/rjconsultores/ventaboletos/enums/TypeContentEmail.java new file mode 100644 index 000000000..53ba2c4ed --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TypeContentEmail.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum TypeContentEmail { + + TEXT_HTML("text/html"); + public String valor; + + TypeContentEmail(String valorConst){ + valor = valorConst; + } +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TypeEventListener.java b/src/com/rjconsultores/ventaboletos/enums/TypeEventListener.java new file mode 100644 index 000000000..17d9a3fc6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TypeEventListener.java @@ -0,0 +1,21 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum TypeEventListener { + + ON_CHANGE("onChange"), + ON_CLICK("onClick"), + ON_DOUBLE_CLICK("onDoubleClick"), + ON_CHECK("onCheck"), + ON_CTRL_KEY("onCtrlKey"); + + private String event; + + private TypeEventListener(String event) { + this.event = event; + } + + public String getEvent() { + return event; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/auditoria/EnumAuditAction.java b/src/com/rjconsultores/ventaboletos/enums/auditoria/EnumAuditAction.java new file mode 100644 index 000000000..a279f23e3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/auditoria/EnumAuditAction.java @@ -0,0 +1,44 @@ +package com.rjconsultores.ventaboletos.enums.auditoria; + +public enum EnumAuditAction { + TODOS(-1, "Todos"), CRIACAO(1,"Criação de Registro"), ALTERACAO(2, "Alteração de registro"), EXCLUSAO(3, "Exclusão de Registro"); + + private String descricao; + private Integer id; + + private EnumAuditAction(Integer id, String descricao) { + this.descricao = descricao; + this.id = id; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public static String findAction(Integer id) { + for (EnumAuditAction action : EnumAuditAction.values()) { + if (action.getId() == id) { + return action.getDescricao(); + } + } + + return null; + } + + @Override + public String toString() { + return descricao; + } +} diff --git a/src/com/rjconsultores/ventaboletos/enums/comissao/BoletoStatusComissao.java b/src/com/rjconsultores/ventaboletos/enums/comissao/BoletoStatusComissao.java new file mode 100644 index 000000000..45a039e3f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/comissao/BoletoStatusComissao.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.enums.comissao; + +public enum BoletoStatusComissao { + + BOLETOS_VENDIDOS, + BOLETO_CANCELADO, + BOLETO_DEVOLVIDO, + BOLETO_DEVOLVIDO_TROCADO, + BOLETO_DEVOLVIDO_TRANSFERIDO, + BOLETO_DEVOLVIDO_OCD, + BOLETO_MANUAL, + GAP_VENDIDOS, + GAP_CANCELADO, + GAP_DEVOLVIDO; + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/comissao/CoresConferencia.java b/src/com/rjconsultores/ventaboletos/enums/comissao/CoresConferencia.java new file mode 100644 index 000000000..8f316d604 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/comissao/CoresConferencia.java @@ -0,0 +1,22 @@ +package com.rjconsultores.ventaboletos.enums.comissao; + +public enum CoresConferencia { + + AMARELO("/gui/img/comissao/amarelo.png"), + AZUL("/gui/img/comissao/azul.png"), + PRETO("/gui/img/comissao/preto.png"), + BRANCO("/gui/img/comissao/branco.png"), + LARANJA("/gui/img/comissao/laranja.png"), + VERMELHO("/gui/img/comissao/vermelho.png"); + + private String url; + + private CoresConferencia(String url) { + this.url = url; + } + + public String getUrl() { + return url; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/comissao/StatusLogConferencia.java b/src/com/rjconsultores/ventaboletos/enums/comissao/StatusLogConferencia.java new file mode 100644 index 000000000..be007b293 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/comissao/StatusLogConferencia.java @@ -0,0 +1,34 @@ +package com.rjconsultores.ventaboletos.enums.comissao; + +public enum StatusLogConferencia { + + CONFERIDO(0,"CONFERIDO"), + PENDENCIA(1,"PENDÊNCIA"); + + private String descricao; + private Integer value; + + private StatusLogConferencia(Integer value, String descricao) { + this.value = value; + this.descricao = descricao; + } + + @Override + public String toString() { + return this.descricao; + } + + public static StatusLogConferencia getStatusLogConferencia(Integer value) { + if(value == CONFERIDO.value) { + return CONFERIDO; + } else if(value == PENDENCIA.value) { + return PENDENCIA; + } + return null; + } + + public Integer getValue() { + return value; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/comissao/TipoLogConferencia.java b/src/com/rjconsultores/ventaboletos/enums/comissao/TipoLogConferencia.java new file mode 100644 index 000000000..bda0c21e5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/comissao/TipoLogConferencia.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.enums.comissao; + +public enum TipoLogConferencia { + + BOLETO(0, "Bilhete"), + EVENTO_FINANCEIRO(1, "Evento Financeiro"), + OCD(2, "OCD"), + AVULSO(3, "Avulso"); + + private String descricao; + private Integer value; + + private TipoLogConferencia(Integer value, String descricao) { + this.value = value; + this.descricao = descricao; + } + + @Override + public String toString() { + return this.descricao; + } + + public static TipoLogConferencia getTipoLogConferencia(Integer value) { + if(value == BOLETO.value) { + return BOLETO; + } else if(value == EVENTO_FINANCEIRO.value) { + return EVENTO_FINANCEIRO; + } else if(value == OCD.value) { + return OCD; + } else if(value == AVULSO.value) { + return AVULSO; + } + return null; + } + + public Integer getValue() { + return value; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/exception/BusinessException.java b/src/com/rjconsultores/ventaboletos/exception/BusinessException.java new file mode 100644 index 000000000..6f4348ef3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/exception/BusinessException.java @@ -0,0 +1,30 @@ +package com.rjconsultores.ventaboletos.exception; + +import java.text.MessageFormat; + +import org.zkoss.util.resource.Labels; + +public class BusinessException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + /** + * + * @param message + * - La clave del archivo de traducción + */ + public BusinessException(String message) { + super(Labels.getLabel(message) == null ? message :Labels.getLabel(message)); + } + + /** + * + * @param message- La clave del archivo de traducción + * @param oMsg - Los parametros de la mensage + */ + public BusinessException(String message,Object oMsg) { + super(new MessageFormat(Labels.getLabel(message)).format(oMsg)); + } +} diff --git a/src/com/rjconsultores/ventaboletos/exception/ComissaoException.java b/src/com/rjconsultores/ventaboletos/exception/ComissaoException.java new file mode 100644 index 000000000..d8a975f8b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/exception/ComissaoException.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.exception; + +import java.text.MessageFormat; + +import org.zkoss.util.resource.Labels; + +public class ComissaoException extends Exception { + + private static final long serialVersionUID = 1L; + + /** + * + * @param message + * - La clave del archivo de traducción + */ + public ComissaoException(String message) { + super(Labels.getLabel(message)); + } + + /** + * + * @param message- + * La clave del archivo de traducción + * @param oMsg + * - Los parametros de la mensage + */ + public ComissaoException(String message, Object oMsg) { + super(new MessageFormat(Labels.getLabel(message)).format(oMsg)); + } + + public ComissaoException(String message, Object oMsg, Object... parametros) { + super(new MessageFormat(Labels.getLabel(message, parametros)).format(oMsg)); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/exception/ConstanteEstacaoEmbarcadaException.java b/src/com/rjconsultores/ventaboletos/exception/ConstanteEstacaoEmbarcadaException.java new file mode 100644 index 000000000..bf616d679 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/exception/ConstanteEstacaoEmbarcadaException.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.exception; + +import java.text.MessageFormat; + +public class ConstanteEstacaoEmbarcadaException extends Exception { + + private static final long serialVersionUID = 3425209018899617380L; + + public ConstanteEstacaoEmbarcadaException(String message) { + super(message); + } + + public ConstanteEstacaoEmbarcadaException(String message, Object oMsg) { + super(new MessageFormat(message).format(oMsg)); + } + +} + diff --git a/src/com/rjconsultores/ventaboletos/exception/DispositivoEmbarcadaJaCadastradoException.java b/src/com/rjconsultores/ventaboletos/exception/DispositivoEmbarcadaJaCadastradoException.java new file mode 100644 index 000000000..3f0615690 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/exception/DispositivoEmbarcadaJaCadastradoException.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.exception; + +import java.text.MessageFormat; + +public class DispositivoEmbarcadaJaCadastradoException extends Exception { + + private static final long serialVersionUID = 1L; + + public DispositivoEmbarcadaJaCadastradoException(String message) { + super(message); + } + + public DispositivoEmbarcadaJaCadastradoException(String message, Object oMsg) { + super(new MessageFormat(message).format(oMsg)); + } + +} + diff --git a/src/com/rjconsultores/ventaboletos/exception/IntegracionException.java b/src/com/rjconsultores/ventaboletos/exception/IntegracionException.java new file mode 100644 index 000000000..d963ae052 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/exception/IntegracionException.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.exception; + +import java.text.MessageFormat; + +public class IntegracionException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * + * @param message + * - La clave del archivo de traducción + */ + public IntegracionException(String message) { + super(message); + } + + /** + * + * @param message + * - La clave del archivo de traducción + * @param oMsg + * - Los parametros de la mensage + */ + public IntegracionException(String message, Object oMsg) { + super(new MessageFormat(message).format(oMsg)); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/exception/SerieEmbarcadaNaoDisponivelException.java b/src/com/rjconsultores/ventaboletos/exception/SerieEmbarcadaNaoDisponivelException.java new file mode 100644 index 000000000..930fe7f65 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/exception/SerieEmbarcadaNaoDisponivelException.java @@ -0,0 +1,5 @@ +package com.rjconsultores.ventaboletos.exception; + +public class SerieEmbarcadaNaoDisponivelException extends Exception { + private static final long serialVersionUID = 2798469198513688315L; +} diff --git a/src/com/rjconsultores/ventaboletos/exception/ValidacionCampoException.java b/src/com/rjconsultores/ventaboletos/exception/ValidacionCampoException.java new file mode 100644 index 000000000..0e983ecea --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/exception/ValidacionCampoException.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.exception; + +import java.text.MessageFormat; + +import org.zkoss.util.resource.Labels; + +public class ValidacionCampoException extends Exception { + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * + * @param message + * - La clave del archivo de traducción + */ + public ValidacionCampoException(String message) { + super(Labels.getLabel(message)); + } + + /** + * + * @param message + * - La clave del archivo de traducción + * @param oMsg + * - Los parametros de la mensage + */ + public ValidacionCampoException(String message, Object oMsg) { + super(new MessageFormat(Labels.getLabel(message)).format(oMsg)); + } +} diff --git a/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoException.java b/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoException.java new file mode 100644 index 000000000..533a2caba --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoException.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.exception; + +public class VendaEmbarcadaBoletoException extends BusinessException { + + private static final long serialVersionUID = 1L; + + public VendaEmbarcadaBoletoException(String message) { + super(message); + } + + public VendaEmbarcadaBoletoException(String message, Boolean label) { + super(message, label); + } + + public VendaEmbarcadaBoletoException(String message, Object oMsg) { + super(message, oMsg); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoFormapagoException.java b/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoFormapagoException.java new file mode 100644 index 000000000..eef261e35 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaBoletoFormapagoException.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.exception; + +public class VendaEmbarcadaBoletoFormapagoException extends BusinessException { + + private static final long serialVersionUID = 1L; + + public VendaEmbarcadaBoletoFormapagoException(String message) { + super(message); + } + + public VendaEmbarcadaBoletoFormapagoException(String message, Boolean label) { + super(message, label); + } + + public VendaEmbarcadaBoletoFormapagoException(String message, Object oMsg) { + super(message, oMsg); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaException.java b/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaException.java new file mode 100644 index 000000000..ad39a9d53 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaException.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.exception; + +public class VendaEmbarcadaCajaException extends BusinessException { + + private static final long serialVersionUID = 1L; + + public VendaEmbarcadaCajaException(String message) { + super(message); + } + + public VendaEmbarcadaCajaException(String message, Boolean label) { + super(message, label); + } + + public VendaEmbarcadaCajaException(String message, Object oMsg) { + super(message, oMsg); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaFormapagoException.java b/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaFormapagoException.java new file mode 100644 index 000000000..9a140bbed --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/exception/VendaEmbarcadaCajaFormapagoException.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.exception; + +public class VendaEmbarcadaCajaFormapagoException extends BusinessException { + + private static final long serialVersionUID = 1L; + + public VendaEmbarcadaCajaFormapagoException(String message) { + super(message); + } + + public VendaEmbarcadaCajaFormapagoException(String message, Boolean label) { + super(message, label); + } + + public VendaEmbarcadaCajaFormapagoException(String message, Object oMsg) { + super(message, oMsg); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/passageirofrequente/vo/ClienteExcelVo.java b/src/com/rjconsultores/ventaboletos/passageirofrequente/vo/ClienteExcelVo.java new file mode 100644 index 000000000..a0362a2f7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/passageirofrequente/vo/ClienteExcelVo.java @@ -0,0 +1,168 @@ +package com.rjconsultores.ventaboletos.passageirofrequente.vo; + +public class ClienteExcelVo { + private String cpf; + private String rg; + private String nome; + private String email; + private String telefone; + private String celular; + private String fax; + private String nascimento; + private String sexo; + private String endereco; + private String bairro; + private String cidade; + private String estado; + private String numfidelidade; + private String tipodoc; + private String numerodoc; + private String nacionalidade; + private String paisresidencia; + private String ocupacao; + private String estadocivil; + private String cep; + private String observacao; + private String desconto; + + + public String getCpf() { + return cpf; + } + public void setCpf(String cpf) { + this.cpf = cpf; + } + public String getRg() { + return rg; + } + public void setRg(String rg) { + this.rg = rg; + } + public String getNome() { + return nome; + } + public void setNome(String nome) { + this.nome = nome; + } + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + public String getTelefone() { + return telefone; + } + public void setTelefone(String telefone) { + this.telefone = telefone; + } + public String getCelular() { + return celular; + } + public void setCelular(String celular) { + this.celular = celular; + } + public String getFax() { + return fax; + } + public void setFax(String fax) { + this.fax = fax; + } + public String getSexo() { + return sexo; + } + public void setSexo(String sexo) { + this.sexo = sexo; + } + public String getEndereco() { + return endereco; + } + public void setEndereco(String endereco) { + this.endereco = endereco; + } + public String getCidade() { + return cidade; + } + public void setCidade(String cidade) { + this.cidade = cidade; + } + public String getEstado() { + return estado; + } + public void setEstado(String estado) { + this.estado = estado; + } + public String getNascimento() { + return nascimento; + } + public void setNascimento(String nascimento) { + this.nascimento = nascimento; + } + public String getBairro() { + return bairro; + } + public void setBairro(String bairro) { + this.bairro = bairro; + } + public String getNumfidelidade() { + return numfidelidade; + } + public void setNumfidelidade(String numfidelidade) { + this.numfidelidade = numfidelidade; + } + public String getTipodoc() { + return tipodoc; + } + public void setTipodoc(String tipodoc) { + this.tipodoc = tipodoc; + } + public String getNumerodoc() { + return numerodoc; + } + public void setNumerodoc(String numerodoc) { + this.numerodoc = numerodoc; + } + public String getNacionalidade() { + return nacionalidade; + } + public void setNacionalidade(String nacionalidade) { + this.nacionalidade = nacionalidade; + } + public String getPaisresidencia() { + return paisresidencia; + } + public void setPaisresidencia(String paisresidencia) { + this.paisresidencia = paisresidencia; + } + public String getOcupacao() { + return ocupacao; + } + public void setOcupacao(String ocupacao) { + this.ocupacao = ocupacao; + } + public String getEstadocivil() { + return estadocivil; + } + public void setEstadocivil(String estadocivil) { + this.estadocivil = estadocivil; + } + public String getCep() { + return cep; + } + public void setCep(String cep) { + this.cep = cep; + } + public String getObservacao() { + return observacao; + } + public void setObservacao(String observacao) { + this.observacao = observacao; + } + public String getDesconto() { + return desconto; + } + public void setDesconto(String desconto) { + this.desconto = desconto; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/relatorios/MovimentoLinha.java b/src/com/rjconsultores/ventaboletos/relatorios/MovimentoLinha.java new file mode 100644 index 000000000..f373a61e8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/relatorios/MovimentoLinha.java @@ -0,0 +1,82 @@ +package com.rjconsultores.ventaboletos.relatorios; + +public class MovimentoLinha { + private String antt; + private String prefixo; + private Integer mes; + private Integer ano; + private Integer viagensIda; + private Integer viagensVolta; + private Integer lugaresIda; + private Integer lugaresVolta; + + public String getAntt() { + return antt; + } + + public void setAntt(String antt) { + this.antt = antt; + } + + public String getPrefixo() { + return prefixo; + } + + public void setPrefixo(String prefixo) { + this.prefixo = prefixo; + } + + public Integer getMes() { + return mes; + } + + public void setMes(Integer mes) { + this.mes = mes; + } + + public Integer getAno() { + return ano; + } + + public void setAno(Integer ano) { + this.ano = ano; + } + + public Integer getViagensIda() { + return viagensIda; + } + + public void setViagensIda(Integer viagensIda) { + this.viagensIda = viagensIda; + } + + public Integer getViagensVolta() { + return viagensVolta; + } + + public void setViagensVolta(Integer viagensVolta) { + this.viagensVolta = viagensVolta; + } + + public Integer getLugaresIda() { + return lugaresIda; + } + + public void setLugaresIda(Integer lugaresIda) { + this.lugaresIda = lugaresIda; + } + + public Integer getLugaresVolta() { + return lugaresVolta; + } + + public void setLugaresVolta(Integer lugaresVolta) { + this.lugaresVolta = lugaresVolta; + } + + @Override + public String toString() { + return antt + ";" + prefixo + ";" + mes + ";" + ano + ";" + viagensIda + ";" + viagensVolta + ";" + lugaresIda + ";" + lugaresVolta; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/relatorios/MovimentoSecoes.java b/src/com/rjconsultores/ventaboletos/relatorios/MovimentoSecoes.java new file mode 100644 index 000000000..9a8666b7c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/relatorios/MovimentoSecoes.java @@ -0,0 +1,173 @@ +package com.rjconsultores.ventaboletos.relatorios; + +public class MovimentoSecoes { + + private String antt; + private String prefixo; + private Integer mes; + private Integer ano; + private String localOrigem; + private String localDestino; + private Integer passageirosIda; + private Integer passageirosVolta; + private Integer gratuidadePasseLivreIda; + private Integer gratuidadePasseLivreVolta; + private Integer gratuidadeIdosoIda; + private Integer gratuidadeIdosoVolta; + private Integer descontoIdosoIda; + private Integer descontoIdosoVolta; + private Integer gratuidadeJovenIda; + private Integer gratuidadeJovenVolta; + private Integer descontoJovenIda; + private Integer descontoJovenVolta; + + public Integer getGratuidadeJovenIda() { + return gratuidadeJovenIda; + } + + public void setGratuidadeJovenIda(Integer gratuidadeJovenIda) { + this.gratuidadeJovenIda = gratuidadeJovenIda; + } + + public Integer getGratuidadeJovenVolta() { + return gratuidadeJovenVolta; + } + + public void setGratuidadeJovenVolta(Integer gratuidadeJovenVolta) { + this.gratuidadeJovenVolta = gratuidadeJovenVolta; + } + + public Integer getDescontoJovenIda() { + return descontoJovenIda; + } + + public void setDescontoJovenIda(Integer descontoJovenIda) { + this.descontoJovenIda = descontoJovenIda; + } + + public Integer getDescontoJovenVolta() { + return descontoJovenVolta; + } + + public void setDescontoJovenVolta(Integer descontoJovenVolta) { + this.descontoJovenVolta = descontoJovenVolta; + } + + public String getAntt() { + return antt; + } + + public void setAntt(String antt) { + this.antt = antt; + } + + public String getPrefixo() { + return prefixo; + } + + public void setPrefixo(String prefixo) { + this.prefixo = prefixo; + } + + public Integer getMes() { + return mes; + } + + public void setMes(Integer mes) { + this.mes = mes; + } + + public Integer getAno() { + return ano; + } + + public void setAno(Integer ano) { + this.ano = ano; + } + + public String getLocalOrigem() { + return localOrigem; + } + + public void setLocalOrigem(String localOrigem) { + this.localOrigem = localOrigem; + } + + public String getLocalDestino() { + return localDestino; + } + + public void setLocalDestino(String localDestino) { + this.localDestino = localDestino; + } + + public Integer getPassageirosIda() { + return passageirosIda; + } + + public void setPassageirosIda(Integer passageirosIda) { + this.passageirosIda = passageirosIda; + } + + public Integer getPassageirosVolta() { + return passageirosVolta; + } + + public void setPassageirosVolta(Integer passageirosVolta) { + this.passageirosVolta = passageirosVolta; + } + + public Integer getGratuidadePasseLivreIda() { + return gratuidadePasseLivreIda; + } + + public void setGratuidadePasseLivreIda(Integer gratuidadePasseLivreIda) { + this.gratuidadePasseLivreIda = gratuidadePasseLivreIda; + } + + public Integer getGratuidadePasseLivreVolta() { + return gratuidadePasseLivreVolta; + } + + public void setGratuidadePasseLivreVolta(Integer gratuidadePasseLivreVolta) { + this.gratuidadePasseLivreVolta = gratuidadePasseLivreVolta; + } + + public Integer getGratuidadeIdosoIda() { + return gratuidadeIdosoIda; + } + + public void setGratuidadeIdosoIda(Integer gratuidadeIdosoIda) { + this.gratuidadeIdosoIda = gratuidadeIdosoIda; + } + + public Integer getGratuidadeIdosoVolta() { + return gratuidadeIdosoVolta; + } + + public void setGratuidadeIdosoVolta(Integer gratuidadeIdosoVolta) { + this.gratuidadeIdosoVolta = gratuidadeIdosoVolta; + } + + public Integer getDescontoIdosoIda() { + return descontoIdosoIda; + } + + public void setDescontoIdosoIda(Integer descontoIdosoIda) { + this.descontoIdosoIda = descontoIdosoIda; + } + + public Integer getDescontoIdosoVolta() { + return descontoIdosoVolta; + } + + public void setDescontoIdosoVolta(Integer descontoIdosoVolta) { + this.descontoIdosoVolta = descontoIdosoVolta; + } + + @Override + public String toString() { + return antt + ";" + prefixo + ";" + localOrigem + ";" + localDestino + ";" + mes + ";" + ano + ";" + passageirosIda + ";" + passageirosVolta + ";" + gratuidadePasseLivreIda + ";" + gratuidadePasseLivreVolta + ";" + gratuidadeIdosoIda + ";" + gratuidadeIdosoVolta + ";" + descontoIdosoIda + ";" + descontoIdosoVolta + ";" + gratuidadeJovenIda + ";" + gratuidadeJovenVolta + ";" + descontoJovenIda + ";" + descontoJovenVolta; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/relatorios/PrefixoAntt.java b/src/com/rjconsultores/ventaboletos/relatorios/PrefixoAntt.java new file mode 100644 index 000000000..dea4cfd6a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/relatorios/PrefixoAntt.java @@ -0,0 +1,84 @@ +package com.rjconsultores.ventaboletos.relatorios; + +public class PrefixoAntt { + private String antt; + private String prefixo; + private String localOrigem; + private String localDestino; + + public String getAntt() { + return antt; + } + + public void setAntt(String antt) { + this.antt = antt; + } + + public String getPrefixo() { + return prefixo; + } + + public void setPrefixo(String prefixo) { + this.prefixo = prefixo; + } + + public String getLocalOrigem() { + return localOrigem; + } + + public void setLocalOrigem(String localOrigem) { + this.localOrigem = localOrigem; + } + + public String getLocalDestino() { + return localDestino; + } + + public void setLocalDestino(String localDestino) { + this.localDestino = localDestino; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((antt == null) ? 0 : antt.hashCode()); + result = prime * result + ((localDestino == null) ? 0 : localDestino.hashCode()); + result = prime * result + ((localOrigem == null) ? 0 : localOrigem.hashCode()); + result = prime * result + ((prefixo == null) ? 0 : prefixo.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + PrefixoAntt other = (PrefixoAntt) obj; + if (antt == null) { + if (other.antt != null) + return false; + } else if (!antt.equals(other.antt)) + return false; + if (localDestino == null) { + if (other.localDestino != null) + return false; + } else if (!localDestino.equals(other.localDestino)) + return false; + if (localOrigem == null) { + if (other.localOrigem != null) + return false; + } else if (!localOrigem.equals(other.localOrigem)) + return false; + if (prefixo == null) { + if (other.prefixo != null) + return false; + } else if (!prefixo.equals(other.prefixo)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/relatorios/receitaDespesa/RelatorioFinanceiroReceitasDespesasBean.java b/src/com/rjconsultores/ventaboletos/relatorios/receitaDespesa/RelatorioFinanceiroReceitasDespesasBean.java new file mode 100644 index 000000000..986011a48 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/relatorios/receitaDespesa/RelatorioFinanceiroReceitasDespesasBean.java @@ -0,0 +1,208 @@ +package com.rjconsultores.ventaboletos.relatorios.receitaDespesa; + +import java.math.BigDecimal; +import java.util.Date; + +public class RelatorioFinanceiroReceitasDespesasBean { + + public static Integer TIPO_CREDITO = 1; + public static Integer TIPO_DEBITO = 0; + + private Date fecHorVta; + private Integer puntoVentaId; + private Integer indtipo; + private String nombPuntoVenta; + private String tipoEventoExtraId; + private String numPuntoVenta; + private String formaPagamento; + private String numSeriePreImpresa; + private String numFolioPreImpreso; + private String numDocumento; + private String descTipoEvento; + private BigDecimal precio; + private BigDecimal receita; + private BigDecimal despesa; + private String formaPagamento1; + private String formaPagamento2; + private String formaPagamento3; + private BigDecimal ValorFormaPagamento1; + private BigDecimal ValorFormaPagamento2; + private BigDecimal ValorFormaPagamento3; + + + public Date getFecHorVta() { + return fecHorVta; + } + + public void setFecHorVta(Date fecHorVta) { + this.fecHorVta = fecHorVta; + } + + public Integer getPuntoVentaId() { + return puntoVentaId; + } + + public void setPuntoVentaId(Integer puntoVentaId) { + this.puntoVentaId = puntoVentaId; + } + + public String getNombPuntoVenta() { + return nombPuntoVenta; + } + + public void setNombPuntoVenta(String nombPuntoVenta) { + this.nombPuntoVenta = nombPuntoVenta; + } + + public String getTipoEventoExtraId() { + return tipoEventoExtraId; + } + + public void setTipoEventoExtraId(String tipoEventoExtraId) { + this.tipoEventoExtraId = tipoEventoExtraId; + } + + public String getDescTipoEvento() { + return descTipoEvento; + } + + public void setDescTipoEvento(String descTipoEvento) { + this.descTipoEvento = descTipoEvento; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getReceita() { + return receita != null ? receita : BigDecimal.ZERO; + } + + public void setReceita(BigDecimal receita) { + this.receita = receita; + } + + public BigDecimal getDespesa() { + return despesa != null ? despesa : BigDecimal.ZERO; + } + + public void setDespesa(BigDecimal despesa) { + this.despesa = despesa; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + + public BigDecimal getSaldo() { + return getReceita().add(getDespesa()); + } + + public Integer getIndtipo() { + return indtipo; + } + + public void setIndtipo(Integer indtipo) { + this.indtipo = indtipo; + } + + public String getDescTipo() { + if(getIndtipo() != null) { + if(getIndtipo().equals(TIPO_CREDITO)) { + return "Receita"; + } else if(getIndtipo().equals(TIPO_DEBITO)) { + return "Despesa"; + } + } + return null; + } + + public String getNumSeriePreImpresa() { + return numSeriePreImpresa; + } + + public void setNumSeriePreImpresa(String numSeriePreImpresa) { + this.numSeriePreImpresa = numSeriePreImpresa; + } + + public String getNumFolioPreImpreso() { + return numFolioPreImpreso; + } + + public void setNumFolioPreImpreso(String numFolioPreImpreso) { + this.numFolioPreImpreso = numFolioPreImpreso; + } + + public String getNumDocumento() { + return numDocumento; + } + + public void setNumDocumento(String numDocumento) { + this.numDocumento = numDocumento; + } + + public String getFormaPagamento() { + return formaPagamento; + } + + public void setFormaPagamento(String formaPagamento) { + this.formaPagamento = formaPagamento; + } + + public String getFormaPagamento1() { + return formaPagamento1; + } + + public void setFormaPagamento1(String formaPagamento1) { + this.formaPagamento1 = formaPagamento1; + } + + public String getFormaPagamento2() { + return formaPagamento2; + } + + public void setFormaPagamento2(String formaPagamento2) { + this.formaPagamento2 = formaPagamento2; + } + + public String getFormaPagamento3() { + return formaPagamento3; + } + + public void setFormaPagamento3(String formaPagamento3) { + this.formaPagamento3 = formaPagamento3; + } + + public BigDecimal getValorFormaPagamento1() { + return ValorFormaPagamento1 != null ? ValorFormaPagamento1 : BigDecimal.ZERO; + } + + public void setValorFormaPagamento1(BigDecimal valorFormaPagamento1) { + ValorFormaPagamento1 = valorFormaPagamento1; + } + + public BigDecimal getValorFormaPagamento2() { + return ValorFormaPagamento2 != null ? ValorFormaPagamento2 : BigDecimal.ZERO; + } + + public void setValorFormaPagamento2(BigDecimal valorFormaPagamento2) { + ValorFormaPagamento2 = valorFormaPagamento2; + } + + public BigDecimal getValorFormaPagamento3() { + return ValorFormaPagamento3 != null ? ValorFormaPagamento3 : BigDecimal.ZERO; + } + + public void setValorFormaPagamento3(BigDecimal valorFormaPagamento3) { + ValorFormaPagamento3 = valorFormaPagamento3; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/rest/ContingenciaClienteRest.java b/src/com/rjconsultores/ventaboletos/rest/ContingenciaClienteRest.java new file mode 100644 index 000000000..67c817864 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/rest/ContingenciaClienteRest.java @@ -0,0 +1,137 @@ +package com.rjconsultores.ventaboletos.rest; + +import java.io.IOException; + +import org.apache.commons.codec.binary.Base64; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.util.EntityUtils; +import org.apache.log4j.Logger; +import org.codehaus.jettison.json.JSONException; +import org.codehaus.jettison.json.JSONObject; +import org.zkoss.zkplus.spring.SpringUtil; + +import com.rjconsultores.ventaboletos.service.ConstanteService; +/** + * @author vjcor + * + */ +public class ContingenciaClienteRest { + + + public enum ETipoEnvio { + GET, POST; + } + + private static final String CONSTANTE_BPE_URL = "BPE_URL"; + private static final String CREDENCIAIS = "rjconsultores:RJ#C0nsul10res@2019"; + private static final String PATH_CONSULTA_STATUS = "/BPeRS/rest/adm/contingencia/tipoEmissaoEmpresa"; + private static final String PATH_DEFINIR_STATUS = "/BPeRS/rest/adm/contingencia/definirTipoEmissaoEmpresa"; + + private static Logger log = Logger.getLogger(ContingenciaClienteRest.class); + + private static ContingenciaClienteRest instance; + + private ContingenciaClienteRest() { + } + + public static synchronized ContingenciaClienteRest getInstance() { + if(instance == null) { + instance = new ContingenciaClienteRest(); + } + return instance; + } + + public Integer consultar(String bpeURL, String uf, String ambiente, String cnpj) { + try { + return verificarStatus(getURI(bpeURL, PATH_CONSULTA_STATUS, uf, ambiente, cnpj), ETipoEnvio.GET); + } catch (IOException e) { + log.error(e); + } catch (JSONException e) { + log.error(e); + } catch (IllegalStateException e) { + log.error(e); + } + return null; + } + + public Integer definir(String bpeURL,String uf, String ambiente, String cnpj, Integer idStatus) { + try { + return verificarStatus(getURI(bpeURL, PATH_DEFINIR_STATUS, uf, ambiente, cnpj, idStatus), ETipoEnvio.POST); + } catch (IOException e) { + log.error(e); + } catch (JSONException e) { + log.error(e); + } catch (IllegalStateException e) { + log.error("Erro no envio/retorno da requisicao para BPERS", e); + } + return null; + } + + private String buscarConstanteURL() { + return getConstanteService().buscarPorNomeConstante(CONSTANTE_BPE_URL).getValorconstante(); + } + + private ConstanteService getConstanteService() { + return (ConstanteService) SpringUtil.getBean("constanteService"); + } + + private Integer verificarStatus(String uri, ETipoEnvio tipoEnvio) throws IOException, JSONException, IllegalStateException { + HttpClient client = new DefaultHttpClient(); + HttpUriRequest request = getRequest(uri, tipoEnvio); + HttpResponse response = client.execute(request); + + if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK + && response.getStatusLine().getStatusCode() != HttpStatus.SC_CREATED) { + throw new IllegalStateException("Ocorreu um erro na requisição." + response.getStatusLine() !=null ? response.getStatusLine().getReasonPhrase() : ""); + } + + return getRetornoJSON(response); + } + + private Integer getRetornoJSON(HttpResponse response) throws IOException, JSONException { + HttpEntity entity = response.getEntity(); + + if (entity != null) { + String rest = EntityUtils.toString(entity); + JSONObject result = new JSONObject(rest); + return Integer.valueOf(result.get("tpEmis").toString()); + } + return null; + } + + private HttpUriRequest getRequest(String uri, ETipoEnvio tipoEnvio) { + HttpUriRequest request = ETipoEnvio.GET.equals(tipoEnvio) ? new HttpGet(uri) : new HttpPost(uri); + request.addHeader("Authorization", getAuthorization()); + return request; + } + + private String getAuthorization() { + return "Basic " + new String(Base64.encodeBase64(CREDENCIAIS.getBytes())); + } + + private String getURI(String bpeURL, String path, String uf, String ambiente, String cnpj) { + StringBuilder uri = new StringBuilder(); + uri.append(bpeURL); + uri.append(path); + uri.append("?uf=").append(uf); + uri.append("&ambiente=").append(ambiente); + uri.append("&cnpj=").append(cnpj); + + return uri.toString(); + } + + private String getURI(String bpeURL, String path, String uf, String ambiente, String cnpj, Integer idStatus) { + StringBuilder uri = new StringBuilder(); + uri.append(getURI(bpeURL, path, uf, ambiente, cnpj)); + uri.append("&tpEmis=").append(idStatus); + + return uri.toString(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/rest/IntegracaoSapRest.java b/src/com/rjconsultores/ventaboletos/rest/IntegracaoSapRest.java new file mode 100644 index 000000000..f2af51e5b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/rest/IntegracaoSapRest.java @@ -0,0 +1,130 @@ +package com.rjconsultores.ventaboletos.rest; + +import org.apache.commons.codec.binary.Base64; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.util.EntityUtils; +import org.apache.log4j.Logger; +import org.codehaus.jettison.json.JSONObject; + +import com.rjconsultores.ventaboletos.enums.TipoEnvioRest; +import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO; + +public class IntegracaoSapRest { + + private static Logger log = Logger.getLogger(IntegracaoSapRest.class); + + private static IntegracaoSapRest instance; + + public static synchronized IntegracaoSapRest getInstance() { + if(instance == null) { + instance = new IntegracaoSapRest(); + } + return instance; + } + + public JSONObject enviarIntegracaoSap( FechamentoCntCorrenteVO fechamento, String url, String credenciais ) { + try { + HttpClient client = new DefaultHttpClient(); + HttpUriRequest request = getRequest( url, TipoEnvioRest.POST, credenciais, fechamtoToJson(fechamento)); + HttpResponse response = client.execute(request); + + if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK + && response.getStatusLine().getStatusCode() != HttpStatus.SC_CREATED) { + throw new Exception("Ocorreu um erro na requisição." + response.getStatusLine() !=null ? response.getStatusLine().getReasonPhrase() : ""); + } + + return getRetornoJSON(response); + } catch (RuntimeException e) { + throw new RuntimeException("Erro na conversão do JSON na integração SAP", e); + } catch (Exception e) { + log.error("Erro no envio/retorno da requisicao para integração SAP", e); + e.printStackTrace(); + } + return null; + } + + private JSONObject getRetornoJSON(HttpResponse response){ + String rest = ""; + try { + HttpEntity entity = response.getEntity(); + + if (entity != null) { + rest = EntityUtils.toString(entity); + JSONObject result = new JSONObject(rest); + JSONObject boleto = result.getJSONObject("MT_Boleto_RES"); + return boleto.getJSONArray("ReturnERP").getJSONObject(0); + } + return null; + }catch(Exception e) { + log.error("Erro no JSON integração SAP: "+rest); + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + private String fechamtoToJson( FechamentoCntCorrenteVO fcc){ + + StringBuilder json = new StringBuilder(); + json.append("{"); + json.append(" \"ID_LEGADO\": \"010\","); + json.append(" \"AGENCIA\": {"); + json.append(" \"KUNNR\": \"").append( formatarValorPorTamanhoZeroEsquerda(fcc.getNumPuntoVenta(), 10)).append("\","); + json.append(" \"TSTCD1\": \"").append( fcc.getCnpjPuntoVenta()).append("\""); + json.append(" },"); + json.append(" \"BOLETO\": [{"); + json.append(" \"ZBUKRS\": \"").append(fcc.getEmpresaId()).append("\","); + json.append(" \"ZZFCAIXA\": \"").append(fcc.getFechamentocntcorrenteId()).append("\","); + json.append(" \"FILIAL\": {"); + json.append(" \"UF\": \"").append(fcc.getUfEmpresa()).append("\","); + json.append(" },"); + json.append(" \"GJAHR\": \"").append(fcc.getAnofechamento()).append("\","); + json.append(" \"MONAT\": \"").append(fcc.getMesfechamento()).append("\","); + json.append(" \"BLDAT\": \"").append(fcc.getFecfechamento()).append("\","); + json.append(" \"BUDAT\": \"").append(fcc.getFeclancamento()).append("\","); + json.append(" \"XBLNR\": \"").append(fcc.getNumPuntoVenta()).append("\","); + json.append(" \"WRBTR\": \"").append( fcc.getTotal().toString().replace(",", ".") ).append("\","); + json.append(" }]"); + json.append("}"); + + return json.toString(); + } + + private HttpUriRequest getRequest(String uri, TipoEnvioRest tipoEnvio, String credenciais, String json) throws Exception { + HttpPost request = new HttpPost(uri); + StringEntity entity = new StringEntity(json); + + request.addHeader("Authorization", getAuthorization(credenciais)); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-type", "application/json"); + request.setEntity(entity); +// request.addHeader(new BasicScheme().authenticate(creds, httpPost, null)); + return request; + } + + private String getAuthorization( String credenciais ) { + return "Basic " + new String(Base64.encodeBase64(credenciais.getBytes())); + } + + public static String formatarValorPorTamanhoZeroEsquerda(String value, int tamanho) { + + value = value == null ? "" : value; + + if(value.length() > tamanho){ + value = value.substring(0, tamanho); + } + + while(value.length() < tamanho){ + value = "0" + value; + } + + return value; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/AbastoBoletoService.java b/src/com/rjconsultores/ventaboletos/service/AbastoBoletoService.java new file mode 100644 index 000000000..15b7ae59f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AbastoBoletoService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; + +public interface AbastoBoletoService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/AbastoCentralService.java b/src/com/rjconsultores/ventaboletos/service/AbastoCentralService.java new file mode 100644 index 000000000..f4a3ea013 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AbastoCentralService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; + + +public interface AbastoCentralService extends GenericService { + + public List buscaBilhetesPorAidf(Aidf aidf); + public void borrarLosQueTienenAIDF(Aidf aidf); +} diff --git a/src/com/rjconsultores/ventaboletos/service/AbastoHistoService.java b/src/com/rjconsultores/ventaboletos/service/AbastoHistoService.java new file mode 100644 index 000000000..5772ebeae --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AbastoHistoService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; + +public interface AbastoHistoService extends GenericService { + public void borrarLosQueTienenAIDF(Aidf aidf); +} diff --git a/src/com/rjconsultores/ventaboletos/service/AgruparParadaService.java b/src/com/rjconsultores/ventaboletos/service/AgruparParadaService.java new file mode 100644 index 000000000..96b8b287d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AgruparParadaService.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AgrupamentoParada; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface AgruparParadaService { + + public AgrupamentoParada obtenerID(Integer id); + + public List obtenerTodos(); + + public AgrupamentoParada suscribirActualizar(AgrupamentoParada entidad) throws BusinessException; + + public void borrar(AgrupamentoParada entidad); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/AidfService.java b/src/com/rjconsultores/ventaboletos/service/AidfService.java new file mode 100644 index 000000000..8cffc42c6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AidfService.java @@ -0,0 +1,49 @@ +package com.rjconsultores.ventaboletos.service; + +import java.sql.Connection; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.AidfEspecie; +import com.rjconsultores.ventaboletos.entidad.AidfTipo; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.vo.aidf.AidfVo; + +public interface AidfService { + + public List obtenerTodos(); + + public Aidf obtenerID(Long id); + + public Aidf suscribir(Aidf entidad); + + public Aidf actualizacion(Aidf entidad); + + public void borrar(Aidf entidad); + + public List obtenerTodosAdifEspecie(); + + public List obtenerTodosAdifTipo(); + + public List buscaAidfsPorEmpresas(List empresas); + + public Long validarDocFiscalSerieFormInicialFinal(Aidf entidad, Connection conn); + + public List obtenerAidfFromSerieDocfiscal(String serie, String docfiscal, Connection conn); + + public Boolean validarDocFiscalPorEstado(Long idAidf, Integer especieId, String docFiscal, Estado estado); + + public Boolean validarTipoVenda(String tipoVenda, String serie, Integer idTipo); + + public Boolean validarVendaManual(Integer idTipo, String serie); + + public List buscaAidfEstadoEmpresa(Integer empresaId, Integer estadoId, Boolean isRMD); + + public String buscaUltimoAidfRMDUtilizado(Long idAidf, Integer empresaId, Integer estadoId); + + public boolean vaidaRMDUtilizado(Long idAidf, Integer empresaId, Integer estadoId, String folio); + + public Boolean validarDocFiscalPorEstadoAgencia(Long idAidf, Integer especieId, String docFiscal, String formInicial, String formFinal,Estado estado, PuntoVenta puntoVenta); +} diff --git a/src/com/rjconsultores/ventaboletos/service/AjusteEventoExtraService.java b/src/com/rjconsultores/ventaboletos/service/AjusteEventoExtraService.java new file mode 100644 index 000000000..1b1a83edb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AjusteEventoExtraService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.AjusteEventoExtra; + +public interface AjusteEventoExtraService extends + GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/AlertaCtrlService.java b/src/com/rjconsultores/ventaboletos/service/AlertaCtrlService.java new file mode 100644 index 000000000..d907fe2e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AlertaCtrlService.java @@ -0,0 +1,35 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.AlertaCtrl; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AlertaCtrlService { + + public List obtenerTodos(); + + public AlertaCtrl obtenerID(Integer id); + + public AlertaCtrl suscribirActualizar(AlertaCtrl entidad) throws BusinessException; + + public void borrar(AlertaCtrl entidad); + + public List buscar(Parada origem, Parada destino, Ruta ruta, ClaseServicio claseServicio, Integer tiempoAlta, Integer tiempoBaja, BigDecimal percAlta, + BigDecimal percBaja); + + public List buscarCorrida(Corrida corrida); +} diff --git a/src/com/rjconsultores/ventaboletos/service/AliasServicoService.java b/src/com/rjconsultores/ventaboletos/service/AliasServicoService.java new file mode 100644 index 000000000..cbbdf4f87 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AliasServicoService.java @@ -0,0 +1,28 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AliasServico; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface AliasServicoService{ + + public List obtenerTodos(); + + public AliasServico obtenerID(Integer id); + + public AliasServico suscribirActualizar(AliasServico entidad) throws BusinessException; + + public void borrar(AliasServico entidad); + + public List buscarPorLinhaEmpresa(List linhas, List empresas, List tiposClasses, List orgaos, String prefixo); + + public AliasServico existe(Parada origem, Parada destino, Ruta linha, Integer idCorrida); + + List buscarPorRuta(Integer rutaId); +} diff --git a/src/com/rjconsultores/ventaboletos/service/AliquotaEstadoDestinoService.java b/src/com/rjconsultores/ventaboletos/service/AliquotaEstadoDestinoService.java new file mode 100644 index 000000000..c2b7e5eeb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AliquotaEstadoDestinoService.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AliquotaEstadoDestino; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; + +public interface AliquotaEstadoDestinoService { + + public AliquotaEstadoDestino suscribir(AliquotaEstadoDestino entidad); + + public List getChildrens(EmpresaImposto parent); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ArquivoRemessaCNAB.java b/src/com/rjconsultores/ventaboletos/service/ArquivoRemessaCNAB.java new file mode 100644 index 000000000..dc4798d53 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ArquivoRemessaCNAB.java @@ -0,0 +1,26 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.ArquivoRemessa; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoBoleto; + +public interface ArquivoRemessaCNAB extends GenericService { + + public ArquivoRemessa remessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar); + + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar); + + public Boolean atualizaRemessa(Empresa empresa, ArquivoRemessa arquivoRemessa) throws Exception; + + public List getEmpresas(); + + public boolean temPermissao(); + + public boolean boletosOk(List boletos); + + public boolean boletosAEnviar(List boletos); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ArticuloService.java b/src/com/rjconsultores/ventaboletos/service/ArticuloService.java new file mode 100644 index 000000000..cb40d4ad4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ArticuloService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Articulo; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ArticuloService extends GenericService { + + public List buscar(String descarticulo); +} diff --git a/src/com/rjconsultores/ventaboletos/service/AsientoExclusivoService.java b/src/com/rjconsultores/ventaboletos/service/AsientoExclusivoService.java new file mode 100644 index 000000000..e932896fa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AsientoExclusivoService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo; + +/** + * + * @author rodrigo + */ +public interface AsientoExclusivoService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/AuditLogService.java b/src/com/rjconsultores/ventaboletos/service/AuditLogService.java new file mode 100644 index 000000000..e6d902b2f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AuditLogService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AuditLog; +import com.rjconsultores.ventaboletos.entidad.AuditModule; + +public interface AuditLogService extends GenericService{ + public List carregarLog(AuditModule modulo); + + public List filtrarLog(AuditLog log); +} diff --git a/src/com/rjconsultores/ventaboletos/service/AuditModuleService.java b/src/com/rjconsultores/ventaboletos/service/AuditModuleService.java new file mode 100644 index 000000000..30e339192 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AuditModuleService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.AuditModule; + +public interface AuditModuleService extends GenericService { + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/AuditServiceService.java b/src/com/rjconsultores/ventaboletos/service/AuditServiceService.java new file mode 100644 index 000000000..f72ea850e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AuditServiceService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.AuditService; + +public interface AuditServiceService extends GenericService { + public AuditService carregarService(AuditService auditService); +} diff --git a/src/com/rjconsultores/ventaboletos/service/AutobusDocService.java b/src/com/rjconsultores/ventaboletos/service/AutobusDocService.java new file mode 100644 index 000000000..c621263a6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AutobusDocService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.AutobusDoc; + +public interface AutobusDocService extends GenericService { + public List obtenerPorAutobus(Autobus autobus); +} diff --git a/src/com/rjconsultores/ventaboletos/service/AutobusService.java b/src/com/rjconsultores/ventaboletos/service/AutobusService.java new file mode 100644 index 000000000..e625abace --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AutobusService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AutobusService extends GenericService { + + public List buscar(String numautobus, DiagramaAutobus diagramaAutobus); +} diff --git a/src/com/rjconsultores/ventaboletos/service/AutorizaFolioService.java b/src/com/rjconsultores/ventaboletos/service/AutorizaFolioService.java new file mode 100644 index 000000000..296971feb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AutorizaFolioService.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.EstacionImpresora; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +public interface AutorizaFolioService { + + public Boolean noChequeFolioPreimpresos(Aidf aidf, Estacion origem, Estacion destino, String numfolioinicial, String numfoliofinal, String numseriepreimpresa, Empresa empresaUsuario, TipoMovimentacion tipoMovimentacion); + + public String noChequeFolioPreimpresos(EstacionImpresora estacionImpresora, boolean isImpressoraFiscal); + + public void devolverFoliosAutomaticosImpressoraFiscal(EstacionImpresora ei); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/AutorizacionPerfilService.java b/src/com/rjconsultores/ventaboletos/service/AutorizacionPerfilService.java new file mode 100644 index 000000000..f0af6782b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AutorizacionPerfilService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import com.rjconsultores.ventaboletos.entidad.AutorizacionPerfil; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AutorizacionPerfilService extends GenericService { + + public List buscar(Autorizacion autorizacion, Perfil perfil); +} diff --git a/src/com/rjconsultores/ventaboletos/service/AutorizacionService.java b/src/com/rjconsultores/ventaboletos/service/AutorizacionService.java new file mode 100644 index 000000000..792bc420f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AutorizacionService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface AutorizacionService extends GenericService { + + public List buscar(String nombautorizacion, String descautorizacion); +} diff --git a/src/com/rjconsultores/ventaboletos/service/BancoService.java b/src/com/rjconsultores/ventaboletos/service/BancoService.java new file mode 100644 index 000000000..de2ff14c2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/BancoService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Banco; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface BancoService extends GenericService{ + + public List buscar(Banco banco); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/BoletoService.java b/src/com/rjconsultores/ventaboletos/service/BoletoService.java new file mode 100644 index 000000000..2a4a6a66a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/BoletoService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; + +import com.rjconsultores.ventaboletos.entidad.Boleto; + +/** + * + * @author Fabricio + */ +public interface BoletoService { + + public Boleto buscarPeloImeiDoDispositivo(String imei); + + public Boleto suscribir(Boleto boleto); + + public void criaBoletoReserva(String unoAsientoSelec, Integer unaCorridaId, Date unaFecCorrida, Integer unoTerminalOrigenId, Integer unoTerminalDestinoId, Integer unoTipoVenta, Integer unaCategoriaSelec, String unoNumeOperacion, Integer unUsuarioId, Integer unPuntoVenta, Integer unClienteId, Integer rutaId, Float tarifa, Long tempoReserva, Integer estacionId, String cpf, String numFidelidade, Integer claseservicioId, Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro) throws Exception; + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/BpeService.java b/src/com/rjconsultores/ventaboletos/service/BpeService.java new file mode 100644 index 000000000..277177f5d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/BpeService.java @@ -0,0 +1,28 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.fiscal.vo.FiscalRdi; +import com.rjconsultores.ventaboletos.vo.bpe.BPeVO; + +public interface BpeService { + + public List buscarBpeRDI(Date inicio, Date fim, Empresa empresa, List estados, boolean isReceitaTerceiros, boolean consultaOtimizada); + + public String buscarArquivoExportacaoBPE(Date inicio, Date fim, Empresa empresa, Estado estado, String nomeArquivo, boolean consultaOtimizada); + + public String buscarXmlBPE(String chBpe); + + public List buscarBPeRejeitadosContingencia(Integer empresaId, String numBpe, String chbpe, Date dtVendaInicio, Date dtVendaFim, List estados, List codigosRejeicoes); + + public void definirBPeRejeitadoSefazReenvio(List bpesReenvio) throws BusinessException; + + public List buscarBPeVendaEEventosAutorizados(Integer empresaId, Date dtVendaInicio, Date dtVendaFim, Integer estadoId); + + public byte[] extrairXmlsBPe(List bpes); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/CalcularPeajeService.java b/src/com/rjconsultores/ventaboletos/service/CalcularPeajeService.java new file mode 100644 index 000000000..bfd547db1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CalcularPeajeService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +public interface CalcularPeajeService { + public List buscarCasetasPeajeWithinTramo(Ruta ruta); + public List buscarRutaWithCasetaPeajeFromOrgao(OrgaoConcedente oc); + public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao, boolean usaICMS) throws Exception; +} diff --git a/src/com/rjconsultores/ventaboletos/service/CalculoComissaoService.java b/src/com/rjconsultores/ventaboletos/service/CalculoComissaoService.java new file mode 100644 index 000000000..cec0d8998 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CalculoComissaoService.java @@ -0,0 +1,125 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.ComissaoException; +import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.RegistroCalculo; + +public interface CalculoComissaoService { + + public RegistroCalculo relatorioCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException, BusinessException; + + public void registrarCalculoComissao(PuntoVenta puntoVenta, Empresa empresa, Date periodo, boolean ignorarComissaoGerada, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException; + + public void cancelarCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo) throws ComissaoException, BusinessException; + + /** + * Relatorio Analitico da comissao + * @param empresaId + * @param competencia - Informe o competencia se o calculo da comissão for por mês + * @param dataInicial - Informe a data inicial se o calculo da comissao for por periodo + * @param dataFinal - Informe a data final se o calculo da comissao for por periodo + * @param usuarioId + * @param isRetencaoDiaria + * @param isRefazerCalculo + * @return + * @throws ComissaoException + * @throws BusinessException + */ + public List relatorioCalculoComissao(Integer empresaId, Date competencia, Date dataInicial, Date dataFinal, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException, BusinessException; + + public void registrarCalculoComissao(Empresa empresa, Date periodo, boolean ignorarComissaoGerada, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException; + + public void cancelarCalculoComissao(Integer empresaId, Date periodo) throws ComissaoException, BusinessException; + + public List relatorioReciboComissao(Integer puntoVentaId, Integer empresaId, String competencia) throws ComissaoException; + + public boolean enviarEmailReciboComissao(HistoricoComissao historicoComissao, byte[] recibo); + + public void registrarCalculoComissao(PuntoVenta puntoVenta, Empresa empresa, Date dataInicial, Date dataFinal, Integer usuarioId) throws ComissaoException, BusinessException; + + public void retencaoAutomaticaComissao(Date dataRetencao); + + public RegistroCalculo realizarCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo, Boolean isRetencaoDiaria, Integer usuarioId, Boolean isRefazerCalculo) throws ComissaoException, BusinessException; + + /** + * Relatorio de comissão por data inicial e data final + * @param puntoVentaId + * @param empresaId + * @param usuarioId + * @param isRetencaoDiaria + * @param isRefazerCalculo + * @param dataInicial + * @param dataFinal + * @return + * @throws ComissaoException + * @throws BusinessException + */ + public RegistroCalculo relatorioCalculoComissao(Integer puntoVentaId, Integer empresaId, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo, Date dataInicial, Date dataFinal) throws ComissaoException, BusinessException; + + /** + * Registra a comissão por periodo + * @param puntoVenta + * @param empresa + * @param ignorarComissaoGerada + * @param usuarioId + * @param isRetencaoDiaria + * @param isRefazerCalculo + * @param dataInicial + * @param dataFinal + * @throws ComissaoException + */ + public void registrarCalculoComissaoPeriodo(PuntoVenta puntoVenta, Empresa empresa, boolean ignorarComissaoGerada, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo, Date dataInicial, Date dataFinal) throws ComissaoException; + + /** + * Registra a comissão por periodo para todos os pontos de venda + * @param puntoVenta + * @param empresa + * @param ignorarComissaoGerada + * @param usuarioId + * @param isRetencaoDiaria + * @param isRefazerCalculo + * @param dataInicial + * @param dataFinal + * @throws ComissaoException + */ + public void registrarCalculoComissaoPeriodo(Empresa empresa, boolean ignorarComissaoGerada, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo, Date dataInicial, Date dataFinal) throws ComissaoException; + + /** + * Cancela o calculo de comissao por periodo + * @param puntoVentaId + * @param empresaId + * @param dataInicial + * @param dataFinal + * @throws ComissaoException + * @throws BusinessException + */ + public void cancelarCalculoComissaoPeriodo(Integer puntoVentaId, Integer empresaId, Date dataInicial, Date dataFinal) throws ComissaoException, BusinessException; + + /** + * Cancela o calculo de comissao por periodo para todas as agencas + * @param empresaId + * @param dataInicial + * @param dataFinal + * @throws ComissaoException + * @throws BusinessException + */ + public void cancelarCalculoComissaoPeriodo(Integer empresaId, Date dataInicial, Date dataFinal) throws ComissaoException, BusinessException; + + /** + * Recupera o historico de comissão por periodo + * @param puntoVentaId + * @param empresaId + * @param dataInicial + * @param dataFinal + * @return + * @throws ComissaoException + */ + public List relatorioReciboComissao(Integer puntoVentaId, Integer empresaId, Date dataInicial, Date dataFinal) throws ComissaoException; + +} diff --git a/src/com/rjconsultores/ventaboletos/service/CancelacionCargoService.java b/src/com/rjconsultores/ventaboletos/service/CancelacionCargoService.java new file mode 100644 index 000000000..419919929 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CancelacionCargoService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CancelacionCargo; + +/** + * + * @author Rafius + */ +public interface CancelacionCargoService extends GenericService{ + +} diff --git a/src/com/rjconsultores/ventaboletos/service/CancelacionCtrlService.java b/src/com/rjconsultores/ventaboletos/service/CancelacionCtrlService.java new file mode 100644 index 000000000..8e629fcc8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CancelacionCtrlService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CancelacionCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface CancelacionCtrlService extends GenericService{ + + public List buscar(Date tiempoprevsalida, PuntoVenta puntoVenta, Parada paradaOrigem, Parada paradaDestino, Marca marca); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/CasetaPeajeExcepcionService.java b/src/com/rjconsultores/ventaboletos/service/CasetaPeajeExcepcionService.java new file mode 100644 index 000000000..05055cf6f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CasetaPeajeExcepcionService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; +import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion; + +public interface CasetaPeajeExcepcionService extends GenericService { + public List buscarPorCasetaPeaje(CasetaPeaje caseta); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CasetaPeajeService.java b/src/com/rjconsultores/ventaboletos/service/CasetaPeajeService.java new file mode 100644 index 000000000..4e49ec410 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CasetaPeajeService.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; +import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion; + +public interface CasetaPeajeService extends GenericService { + public List buscar(String descricaoPracaPedagio); + public Boolean validarDescricaoCasetaPeaje(CasetaPeaje casetaPeaje); + public List buscarTodosOrdenadoPorDescricao(); + public void deletarVigencias(List cpes); + public CasetaPeaje suscribirOrActualizacion(CasetaPeaje casetaPeaje); +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaBloqueioImpPosteriorService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaBloqueioImpPosteriorService.java new file mode 100644 index 000000000..ae9c2480f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaBloqueioImpPosteriorService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaBloqueioImpPosterior; + +public interface CategoriaBloqueioImpPosteriorService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaClaseService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaClaseService.java new file mode 100644 index 000000000..f0562a709 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaClaseService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaClase; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; + +/** + * + * @author Administrador + */ +public interface CategoriaClaseService extends GenericService { + + public CategoriaClase busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaCorridaService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaCorridaService.java new file mode 100644 index 000000000..e2c9fd2fb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaCorridaService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCorrida; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; + +/** + * + * @author Administrador + */ +public interface CategoriaCorridaService extends GenericService { + + public CategoriaCorrida busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java new file mode 100644 index 000000000..dab713398 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; + +/** + * + * @author Administrador + */ +public interface CategoriaCtrlService { + + public CategoriaCtrl obtenerID(Integer id); + + public CategoriaCtrl suscribir(CategoriaCtrl entidad); + + public CategoriaCtrl checarCategoriaAdulto(CategoriaCtrl entidad); + + public CategoriaCtrl actualizacion(CategoriaCtrl entidad); + + public void borrar(CategoriaCtrl entidad); + + public boolean validaCategoriaProgramaFidelidade(Categoria categoria); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaDescuentoService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaDescuentoService.java new file mode 100644 index 000000000..3095b0ea0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaDescuentoService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; + +/** + * + * @author Administrador + */ +public interface CategoriaDescuentoService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaMarcaService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaMarcaService.java new file mode 100644 index 000000000..83c028568 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaMarcaService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMarca; + +/** + * + * @author Administrador + */ +public interface CategoriaMarcaService extends GenericService { + + public CategoriaMarca busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaMercadoService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaMercadoService.java new file mode 100644 index 000000000..5cc312922 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaMercadoService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMercado; + +/** + * + * @author Administrador + */ +public interface CategoriaMercadoService extends GenericService { + + public CategoriaMercado busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaOrgaoService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaOrgaoService.java new file mode 100644 index 000000000..c571ba457 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaOrgaoService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaOrgao; + +public interface CategoriaOrgaoService extends GenericService { + + public CategoriaOrgao busquedaPorCategoriaCtrl(CategoriaCtrl categoriaCtrl); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaPeriodoService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaPeriodoService.java new file mode 100644 index 000000000..5f7c32179 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaPeriodoService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface CategoriaPeriodoService extends GenericService { + + public List buscarPeriodoIntervalo(CategoriaPeriodo cPeriodo); + + public List obtenerPorCategoriaDescuento(CategoriaDescuento categoriaDescuento); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaService.java new file mode 100644 index 000000000..8c13bf496 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaService.java @@ -0,0 +1,31 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Categoria; + +/** + * + * @author Administrador + */ +public interface CategoriaService extends GenericService { + + public List buscar(String desccategoria); + + public Categoria buscarUmaCategoria(String desccategoria); + + public List buscarCategoriaPesquisada(String desccategoria); + + public List buscarCategoriaOrgaoConcedente(String orgaoConcedente); + + /** + * Hance una búsqueda de todas las categorias que son visibles al usuario Ejemplo de categorias que no son vis + * + * @return + */ + public List obtenerTodasCategoriasVisibles(); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaTipoPtoVtaService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaTipoPtoVtaService.java new file mode 100644 index 000000000..18b8a3917 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaTipoPtoVtaService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CategoriaTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface CategoriaTipoPtoVtaService extends + GenericService { + + public List buscarPorPuntoVenta(TipoPuntoVenta tipoPuntoVenta); + + public void borrarFisico(CategoriaTipoPtoVta cd); + } diff --git a/src/com/rjconsultores/ventaboletos/service/CiudadService.java b/src/com/rjconsultores/ventaboletos/service/CiudadService.java new file mode 100644 index 000000000..3292b34a9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CiudadService.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Plaza; + +/** + * + * @author MCosso + */ +public interface CiudadService extends GenericService { + + public List buscar(String nombciudad, Estado estado, Plaza plaza); + + public List buscaLike(String strCiudad); + + public List buscaCodMun(Integer codMun, Estado estado); + + public List buscarPorEstado(Estado estado); +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/ClaseServicioService.java b/src/com/rjconsultores/ventaboletos/service/ClaseServicioService.java new file mode 100644 index 000000000..5cf7dd4ff --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ClaseServicioService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ClaseServicioService extends GenericService { + + public List buscarPorNome(Integer idClaseServicio, String nomeClaseServicio); + + public List buscarTodosExceto(Integer ... idClase); + + public List buscarPorEmpresasDoUsuario (List empresasUsuario); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ClaseservicioEquivalenciaService.java b/src/com/rjconsultores/ventaboletos/service/ClaseservicioEquivalenciaService.java new file mode 100644 index 000000000..e2c1748a1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ClaseservicioEquivalenciaService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.ClaseservicioEquivalencia; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ClaseservicioEquivalenciaService + extends GenericService { + + public List buscar(ClaseServicio parada, ComisionistaExterno comisionistaExterno); + + public List buscarEquivalencia(ClaseservicioEquivalencia claseServicioEquivalencia); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ClienteCursoService.java b/src/com/rjconsultores/ventaboletos/service/ClienteCursoService.java new file mode 100644 index 000000000..437724051 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ClienteCursoService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteCurso; +import com.rjconsultores.ventaboletos.entidad.Curso; + +public interface ClienteCursoService extends GenericService { + + public ClienteCurso buscarClienteCurso(Cliente cliente, Curso curso); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ClienteDescuentoService.java b/src/com/rjconsultores/ventaboletos/service/ClienteDescuentoService.java new file mode 100644 index 000000000..24fab2fd0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ClienteDescuentoService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClienteDescuento; + +public interface ClienteDescuentoService extends GenericService{ + + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ClienteDireccionService.java b/src/com/rjconsultores/ventaboletos/service/ClienteDireccionService.java new file mode 100644 index 000000000..e59bae342 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ClienteDireccionService.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClienteDireccion; + + + + +public interface ClienteDireccionService extends GenericService { + + public List buscar(Integer clienteId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ClienteService.java b/src/com/rjconsultores/ventaboletos/service/ClienteService.java new file mode 100644 index 000000000..029a0649c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ClienteService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +public interface ClienteService extends GenericService { + + public List buscar(String nombCliente); + + public Cliente buscarPorNumeroFidelidade(String numeroFidelidade, Empresa empresa); + + public List buscarPorDocumento(String documento); + + public Cliente buscarPorNumeroFidelidade(String numeroFidelidade); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CobrancaAdcPuntoVentaService.java b/src/com/rjconsultores/ventaboletos/service/CobrancaAdcPuntoVentaService.java new file mode 100644 index 000000000..af24ff019 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CobrancaAdcPuntoVentaService.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CobrancaAdcPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.CobrancaAdicionalHistorico; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface CobrancaAdcPuntoVentaService extends GenericService { + + List buscarTodasAsCobrancas(PuntoVenta puntoVenta); + + List buscaHistoricoCobranca(CobrancaAdcPuntoVenta cobranca, Date dataInicial, Date dataFinal); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/CoeficienteTarifaService.java b/src/com/rjconsultores/ventaboletos/service/CoeficienteTarifaService.java new file mode 100644 index 000000000..ec560ab24 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CoeficienteTarifaService.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +public interface CoeficienteTarifaService { + + public List obtenerTodos(); + + public CoeficienteTarifa obtenerID(Integer id); + + public CoeficienteTarifa suscribir(CoeficienteTarifa entidad); + + public CoeficienteTarifa actualizacion(CoeficienteTarifa entidad); + + public void borrar(CoeficienteTarifa entidad) throws RegistroConDependenciaException; + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ColoniaService.java b/src/com/rjconsultores/ventaboletos/service/ColoniaService.java new file mode 100644 index 000000000..a63e11d5c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ColoniaService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Colonia; + +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ColoniaService extends GenericService { + + public List buscar(String desccolonia); + public List buscarPorCiudad(Ciudad ciudad); + public List buscaLike(String desccolonia); + public List buscarPorCodMun(Ciudad ciudad, String desccolonia); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ComisionistaExternoService.java b/src/com/rjconsultores/ventaboletos/service/ComisionistaExternoService.java new file mode 100644 index 000000000..d7cd83b2e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ComisionistaExternoService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ComisionistaExternoService extends GenericService { + + public List buscar(String desccomisionista); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ComissaoReceitaService.java b/src/com/rjconsultores/ventaboletos/service/ComissaoReceitaService.java new file mode 100644 index 000000000..26585872d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ComissaoReceitaService.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ComissaoReceita; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface ComissaoReceitaService extends GenericService { + + public void reterComissaoReceitaDiaria(Integer empresaId, Integer puntoVentaId, Integer usuarioId, List receitas) throws BusinessException; + + public List recuperarComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal); + + public void limparComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) throws BusinessException; + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ComissaoService.java b/src/com/rjconsultores/ventaboletos/service/ComissaoService.java new file mode 100644 index 000000000..3603f3bbe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ComissaoService.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Comissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao; + +public interface ComissaoService extends GenericService { + + public List buscaHistoricoComissao(Integer puntoVentaId, Integer empresaId, Date periodoInicio, Date periodoFim); + + public List buscaPuntoVentasEmpresaComComissaoParametrizada(Integer empresaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/CompaniaBancariaService.java b/src/com/rjconsultores/ventaboletos/service/CompaniaBancariaService.java new file mode 100644 index 000000000..4d5576ab2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CompaniaBancariaService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CompaniaBancaria; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface CompaniaBancariaService extends GenericService { + + public List buscar(CompaniaBancaria companiaBancaria); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConductorService.java b/src/com/rjconsultores/ventaboletos/service/ConductorService.java new file mode 100644 index 000000000..5b2022ab5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConductorService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Conductor; + +/** + * + * @author Administrador + */ +public interface ConductorService extends GenericService { + + public Conductor buscar(String claveConductor, String contraSenha); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionConfService.java b/src/com/rjconsultores/ventaboletos/service/ConexionConfService.java new file mode 100644 index 000000000..ab695cd35 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConexionConfService.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Collection; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionConf; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; + +public interface ConexionConfService extends GenericService { + + public ConexionConf buscar(Long conexionCtrlId, Integer numgrupo); + + public List buscarPorConexionCtrl(ConexionCtrl entidad); + + public void suscribirTodos(Collection conexionesConf); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionCtrlService.java b/src/com/rjconsultores/ventaboletos/service/ConexionCtrlService.java new file mode 100644 index 000000000..b1f52e611 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConexionCtrlService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; + +public interface ConexionCtrlService extends GenericService { + + public List buscarConexionesCtrl(Integer origenId, Integer destinoId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionDescuentoService.java b/src/com/rjconsultores/ventaboletos/service/ConexionDescuentoService.java new file mode 100644 index 000000000..cadacde01 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConexionDescuentoService.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Conexion; +import com.rjconsultores.ventaboletos.entidad.ConexionDescuento; + +public interface ConexionDescuentoService { + public List buscarPorConexion(Conexion conexion); + + public ConexionDescuento suscribir(ConexionDescuento conexionDescuento); + + public void borrar(ConexionDescuento conexionDescuento); + + public void suscribirTodos(List conexionesDescuentos); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionExcepcionRutaService.java b/src/com/rjconsultores/ventaboletos/service/ConexionExcepcionRutaService.java new file mode 100644 index 000000000..659accb32 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConexionExcepcionRutaService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta; + +public interface ConexionExcepcionRutaService extends GenericService { + + public List obtenerConexionExcepcionsActivo(Long conexionctrlId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionExcepcionService.java b/src/com/rjconsultores/ventaboletos/service/ConexionExcepcionService.java new file mode 100644 index 000000000..ed04020fc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConexionExcepcionService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcion; + +public interface ConexionExcepcionService extends GenericService { + + public List obtenerConexionExcepcionsActivo(Long conexionctrlId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionRutaCombinacionService.java b/src/com/rjconsultores/ventaboletos/service/ConexionRutaCombinacionService.java new file mode 100644 index 000000000..b3630c256 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConexionRutaCombinacionService.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.vo.parada.ConexionCtrlVO; +import com.rjconsultores.ventaboletos.vo.parada.ConexionRutaCtrlVO; +import com.rjconsultores.ventaboletos.vo.parada.ParadaVOConexionRuta; + +public interface ConexionRutaCombinacionService { + + public void gerarCombinacionEntre2Eixos(List listParada1, List rutasEixoA, List rutasEixoB, List lsLocalidadesComuns, List listParada4, List rutasEixoA2, List rutasEixoB2, List localidadesGeradas, List conexoesCtrl); + + public void gerarCombinacionEntre3Eixos(List listParada1, List rutasEixoA, List rutasEixoB, List lsLocalidadesComuns, List listParada4, List listParadasC, List rutasEixoA2, List rutasEixoB2, List rutasEixoC, List localidadesGeradas, List conexoesCtrl); + + public List extrairConexionRutaCtrl(List localidadesGeradas); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionRutaConfService.java b/src/com/rjconsultores/ventaboletos/service/ConexionRutaConfService.java new file mode 100644 index 000000000..7f4943420 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConexionRutaConfService.java @@ -0,0 +1,44 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.vo.parada.ConexionRutaConfVO; +import com.rjconsultores.ventaboletos.vo.parada.ConexionRutaCtrlVO; +import com.rjconsultores.ventaboletos.vo.parada.ParadaVOConexionRuta; + +public interface ConexionRutaConfService { + + public ConexionRutaConf suscribir(ConexionRutaConf conexion); + + public ConexionRutaConf actualizacion(ConexionRutaConf conexion); + + public void borrar(ConexionRutaConf conexion); + + public void borrar(List lsConexion); + + public void suscribirTodos(List conexiones); + + public List obtenerTodosActivo(); + + public ConexionRutaConf getByIdActivo(Integer conexionRutaConfId); + + public List buscarPorDescricao(String descricao); + + public ConexionRutaConf obtenerID(Integer id); + + public ConexionRutaConf salvarConfiguracao(ConexionRutaConf conexion, List canalVentas, List puntoVentas, + List conexoesCtrl, List rutas, List localidadesCombinadas, + boolean isConexionGerada); + + public void excluirConfiguracao(ConexionRutaConf conexion, boolean excluirConexionRutaConf, boolean isConexionGerada); + + public ConexionRutaConfVO carregarConexoesCadastradas(Integer conexionrutaconfId); + + public List> buscarRutasPorConexionConf(Integer conexionRutaConfId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionRutaCtrlService.java b/src/com/rjconsultores/ventaboletos/service/ConexionRutaCtrlService.java new file mode 100644 index 000000000..3629991d8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConexionRutaCtrlService.java @@ -0,0 +1,29 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; +import com.rjconsultores.ventaboletos.vo.conexion.ConexionRutaVO; + +public interface ConexionRutaCtrlService { + + public ConexionRutaCtrl suscribir(ConexionRutaCtrl conexion); + + public ConexionRutaCtrl actualizacion(ConexionRutaCtrl conexion); + + public void borrar(ConexionRutaCtrl conexion); + + public List buscarPorConexionCtrl(Long conexcionCtrlId); + + public void borrar(List lsConexion); + + public void suscribirTodos(List conexiones); + + public List buscarConexionesValidas(); + + public List buscarConexionesValidas(Integer rutaOrigemId, Integer rutaDestinoId); + + public List buscarPorConexionConf(ConexionRutaConf conexionRutaConf); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionRutaExcepcionPtoVtaService.java b/src/com/rjconsultores/ventaboletos/service/ConexionRutaExcepcionPtoVtaService.java new file mode 100644 index 000000000..ca8a34bf1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConexionRutaExcepcionPtoVtaService.java @@ -0,0 +1,24 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaExcepcionPtoVta; + +public interface ConexionRutaExcepcionPtoVtaService { + + public void gerarConexiones(); + + public ConexionRutaExcepcionPtoVta suscribir(ConexionRutaExcepcionPtoVta conexion); + + public ConexionRutaExcepcionPtoVta actualizacion(ConexionRutaExcepcionPtoVta conexion); + + public void borrar(ConexionRutaExcepcionPtoVta conexion); + + public List buscarPorConexionConf(ConexionRutaConf conexionRutaConf); + + public void borrar(List lsConexion); + + public void suscribirTodos(List conexiones); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionRutaExcepcionTipoPtoVtaService.java b/src/com/rjconsultores/ventaboletos/service/ConexionRutaExcepcionTipoPtoVtaService.java new file mode 100644 index 000000000..0a6cf0ef9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConexionRutaExcepcionTipoPtoVtaService.java @@ -0,0 +1,26 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaExcepcionTipoPtoVta; + +public interface ConexionRutaExcepcionTipoPtoVtaService { + + public void gerarConexiones(); + + public ConexionRutaExcepcionTipoPtoVta suscribir(ConexionRutaExcepcionTipoPtoVta conexion); + + public ConexionRutaExcepcionTipoPtoVta actualizacion(ConexionRutaExcepcionTipoPtoVta conexion); + + public void borrar(ConexionRutaExcepcionTipoPtoVta conexion); + + public List buscarPorConexionCtrl(Long conexcionCtrlId); + + public void borrar(List lsConexion); + + public void suscribirTodos(List conexiones); + + + public List buscarPorConexionConf(ConexionRutaConf conexionRutaConf); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java b/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java new file mode 100644 index 000000000..644ed4363 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java @@ -0,0 +1,39 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaTramoCtrl; +import com.rjconsultores.ventaboletos.entidad.Parada; + +public interface ConexionRutaTramoCtrlService { + + public ConexionRutaTramoCtrl suscribir(ConexionRutaTramoCtrl conexion); + + public ConexionRutaTramoCtrl actualizacion(ConexionRutaTramoCtrl conexion); + + public void borrar(ConexionRutaTramoCtrl conexion); + + public List buscarPorConexionRutaCtrl(ConexionRutaCtrl conexionRutaCtrl, Integer rutaId); + + public void borrar(List lsConexion); + + public void suscribirTodos(List conexiones); + + public ConexionRutaTramoCtrl buscarPorId(Long conexionRutaTramoId); + + public boolean validarConexioneRutasExistentes(Integer rutaOrigenId, Integer rutaDestinoId, Integer paradaOrigenId, Integer paradaDestinoId, Integer origemTrechoId, Integer destinoTrechoId, Integer integer); + + public List buscarLocalidadesOrigem(Integer conexionRutaConfId); + + public List buscarLocalidadesDestino(Integer conexionRutaConfId); + + public List buscarLocalidadesDestinoC(Integer conexionRutaConfId); + + public List buscarTodasLocalidadesOrigem(Integer conexionRutaConfId); + + public List buscarTodasLocalidadesDestino(Integer conexionRutaConfId); + + public List buscarTodasLocalidadesDestinoC(Integer conexionRutaConfId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionService.java b/src/com/rjconsultores/ventaboletos/service/ConexionService.java new file mode 100644 index 000000000..044ab4b5f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConexionService.java @@ -0,0 +1,34 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Conexion; +import com.rjconsultores.ventaboletos.vo.conexion.ConexionVO; + +public interface ConexionService { + + /** + * Gera as conexões possíveis para os tramos do sistema + * + */ + public void gerarConexiones(); + + public List buscarConexiones(Integer origenId, Integer destinoId); + + public Conexion suscribir(Conexion conexion); + + public Conexion actualizacion(Conexion conexion); + + public void borrar(Conexion conexion); + + public List buscarPorConexionCtrl(Long conexcionCtrlId); + + public List buscarConexionesValidas(); + + public void borrar(List lsConexion); + + public void suscribirTodos(List conexiones); + + public Conexion buscarPorConexionRutaTramoCtrl(Integer conexionRutaTramoId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConfContratoPuntoVentaService.java b/src/com/rjconsultores/ventaboletos/service/ConfContratoPuntoVentaService.java new file mode 100644 index 000000000..cfc9aa19b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfContratoPuntoVentaService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfContratoPuntoVenta; +import com.rjconsultores.ventaboletos.vo.configuracioneccomerciales.ConfLayoutContratoVO; + +public interface ConfContratoPuntoVentaService extends GenericService { + + ConfLayoutContratoVO buscarInformacoesPontoVendaparaGerarContratos(Integer puntoVentaId, Integer empresaIsd); + + String formatarLayout(ConfLayoutContratoVO confLayoutContratoVO, String html); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConfRestricaoCanalVentaService.java b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoCanalVentaService.java new file mode 100644 index 000000000..73fd5fdb2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoCanalVentaService.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoCanalVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface ConfRestricaoCanalVentaService{ + + public ConfRestricaoCanalVenta obtenerID(Long id); + + public void borrar(ConfRestricaoCanalVenta entidad); + + public ConfRestricaoCanalVenta suscribirActualizar(ConfRestricaoCanalVenta entidad) throws BusinessException; + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConfRestricaoExcecaoService.java b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoExcecaoService.java new file mode 100644 index 000000000..6e809b77b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoExcecaoService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoExcecao; + +public interface ConfRestricaoExcecaoService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConfRestricaoOrgaoConcedenteService.java b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoOrgaoConcedenteService.java new file mode 100644 index 000000000..fcdb81851 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoOrgaoConcedenteService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoOrgaoConcedente; + +public interface ConfRestricaoOrgaoConcedenteService extends GenericService { + + public ConfRestricaoOrgaoConcedente obtenerOrgaoCOncedenteTodos(); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConfRestricaoPtovtaService.java b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoPtovtaService.java new file mode 100644 index 000000000..a81947fce --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoPtovtaService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoPtovta; + +public interface ConfRestricaoPtovtaService extends GenericService { + + public ConfRestricaoPtovta obtenerPtovtaTodos(); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConfRestricaoRutasService.java b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoRutasService.java new file mode 100644 index 000000000..88ee91a07 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoRutasService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoRutas; + +public interface ConfRestricaoRutasService extends GenericService { + + public ConfRestricaoRutas obtenerRutasTodos(); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConfRestricaoTramoOCService.java b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoTramoOCService.java new file mode 100644 index 000000000..f79eb8f13 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoTramoOCService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoTramoOC; + +public interface ConfRestricaoTramoOCService extends GenericService { + + public ConfRestricaoTramoOC obtenerTramoOCTodos(); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConfRestricaoTramoService.java b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoTramoService.java new file mode 100644 index 000000000..13564c096 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoTramoService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoTramo; + +public interface ConfRestricaoTramoService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConfRestricaoVendaWebService.java b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoVendaWebService.java new file mode 100644 index 000000000..8f5e2dd93 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoVendaWebService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb; + +public interface ConfRestricaoVendaWebService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConfTotemService.java b/src/com/rjconsultores/ventaboletos/service/ConfTotemService.java new file mode 100644 index 000000000..4c5bf8edb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfTotemService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfTotem; + +/** + * + * @author Wallace + */ +public interface ConfTotemService extends GenericService { + + public ConfTotem buscar(String chave); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConferenciaComissaoService.java b/src/com/rjconsultores/ventaboletos/service/ConferenciaComissaoService.java new file mode 100644 index 000000000..65630fd04 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConferenciaComissaoService.java @@ -0,0 +1,98 @@ +package com.rjconsultores.ventaboletos.service; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.LogConferencia; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enums.IndStatusBoleto; +import com.rjconsultores.ventaboletos.enums.comissao.BoletoStatusComissao; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.DiaConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.EtiquetaMalote; +import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO; +import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO; +import com.rjconsultores.ventaboletos.vo.comissao.OcdVO; +import com.rjconsultores.ventaboletos.vo.comissao.ResumoComissao; + +public interface ConferenciaComissaoService extends GenericService { + + public Conferencia suscribirOrActualizacion(Conferencia entidad); + + public List carregarConferenciaComissao(String competencia, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, boolean isDesconsideraPtVendaFechados) throws BusinessException; + + public List carregarConferenciaComissao(Date dataInicial, Date dataFinal, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, boolean isDesconsideraPtVendaFechados) throws BusinessException; + + public Conferencia confirmarChegadaMalote(Conferencia conferencia) throws BusinessException; + + public Conferencia cancelarChegadaMalote(Conferencia conferencia); + + public Conferencia encerrarMovimentoDiario(Conferencia conferencia) throws BusinessException; + + public List carregarEventosFinanceiros(Conferencia conferencia) throws BusinessException; + + public List carregarLogConferencia(Conferencia conferencia) throws BusinessException; + + public LogConferencia suscribirLogConferencia(LogConferencia logConferencia) throws BusinessException; + + public void borrarLogConferencia(LogConferencia logConferencia) throws BusinessException; + + public LogConferencia obtenerLogConferenciaID(Long logconferenciaId); + + public List carregarBilhetesComissao(List boletoComissaos, Conferencia conferencia, BoletoStatusComissao boletoStatusComissao, boolean carregarDadosFaltantes) throws BusinessException; + + public List carregarBilhetesComissao(List boletoComissaos, List conferencias, BoletoStatusComissao boletoStatusComissao, boolean carregarDadosFaltantes) throws BusinessException; + + public List carregarOcds(Conferencia conferencia) throws BusinessException; + + public Conferencia reabrirMovimentoDiario(Conferencia conferencia) throws BusinessException; + + public Conferencia obtenerConferenciaDataMovimento(Date datamovimento, Integer puntoventaId, Integer empresaId) throws BusinessException; + + public boolean isBilhetesSemConferencia(List lsBoletoComissao) throws BusinessException; + + public boolean isEventosFinanceirosSemConferencia(List lsEventosFinanceiros) throws BusinessException; + + public boolean isOcdSemConferencia(List lsOcd) throws BusinessException; + + public BigDecimal totalizarBoletoComissao(List lsBoletoComissao, IndStatusBoleto... statusBilhete) throws BusinessException; + + public BigDecimal totalizarEventosFinanceiros(List lsEventosFinanceiros) throws BusinessException; + + public OcdVO totalizarOcd(List lsOcd) throws BusinessException; + + public ResumoComissao gerarResumo(Conferencia conferencia, List boletoComissaos, List lsEventosFinanceiros, BigDecimal totalBilhetesManual, BigDecimal totalBilhetesVendidos, BigDecimal totalBilhetesCancelados, + BigDecimal totalBilhetesDevolvidos, BigDecimal totalBilhetesGap, BigDecimal totalBilhetesGapCancelados, BigDecimal totalBilhetesGapDevolvidos, + BigDecimal totalCreditosEventoFinanceiros, BigDecimal totalDebitosEventoFinanceiros, OcdVO totalOcd, + BigDecimal totalBilhetesTrocados, BigDecimal totalBilhetesGapTrocados) throws BusinessException; + + public EtiquetaMalote decodificarEtiquetaMalote(String codigoBarras) throws BusinessException; + + public void confirmarChegadaMalote(EtiquetaMalote etiquetaMalote) throws BusinessException; + + public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta, boolean isDesconsideraPtVendaFechados ) throws BusinessException; + + public Map totalizarBoletoComissaoDevolvidosTrocaOcd(List lsBoletoComissao) throws BusinessException; + + public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException; + + public List quantidadeECFPorPuntoVenta(Conferencia conferencia); + + public void enviarEmailIrregularidadeECF(String email, String msg, String assunto) throws Exception; + + public void generacionAutomaticaConferencia(); + + public boolean isConferidoVenta(BoletoComissao boletoComissao); + + public void borrarLogConferenciaTransacaoId(Long transacaoId) throws BusinessException; + + public boolean isConferenciaCompetenciaEncerrada(Date dataInicial, Date dataFinal, Empresa empresa, PuntoVenta puntoVenta, boolean isDesconsideraPtVendaFechados) throws BusinessException; + + public BigDecimal getComissaoPuntoVenta(Integer puntoventaId, Integer empresaId, Date dataInicial, Date dataFinal) throws BusinessException; +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConferenciaPendenciaService.java b/src/com/rjconsultores/ventaboletos/service/ConferenciaPendenciaService.java new file mode 100644 index 000000000..c6417e2e7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConferenciaPendenciaService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConferenciaPendencia; + +/** + * + * @author Wilian + */ +public interface ConferenciaPendenciaService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConfigRestriccionPagoService.java b/src/com/rjconsultores/ventaboletos/service/ConfigRestriccionPagoService.java new file mode 100644 index 000000000..a21b70870 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfigRestriccionPagoService.java @@ -0,0 +1,33 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ConfigRestriccionPagoService + extends GenericService { + + public List buscar(FormaPago formaPago, + RestriccionPago restriccionPago, Empresa empresa); + + /** + * Verifica se puede dar de alta en el registro. + * Ej.:Para una forma de pago que ya esta configurada para "Cancelable", no se puede permitr da de alta en la misma forma de pago con + * restriccion de "No Cancelable" + * @param configRestriccionPago + * @return + */ + public boolean puedoDarDeAlta(ConfigRestriccionPago configRestriccionPago); + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConstanteService.java b/src/com/rjconsultores/ventaboletos/service/ConstanteService.java new file mode 100644 index 000000000..c3919acb4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConstanteService.java @@ -0,0 +1,30 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Constante; + +import java.util.List; + +public interface ConstanteService extends GenericService { + + public Constante buscarPorNomeConstante(String nomeConstante); + + public List buscar(String nombconstante); + + String buscarNombreAmbiente(); + + boolean pafActivo(); + + String buscarURLPainelBPe(); + + String buscarNomeConstanteURLPainelBPe(); + + public List buscarPorNomeConstanteLike(String nomeConstante); + + public String buscarURLAPI(); + + public Integer buscarValorConstantePorNomeConstante(String nomeConstante); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ContaMDService.java b/src/com/rjconsultores/ventaboletos/service/ContaMDService.java new file mode 100644 index 000000000..eb62e104f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ContaMDService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ContaMD; + +public interface ContaMDService extends GenericService { + Boolean existeConta(ContaMD conta); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ContingenciaService.java b/src/com/rjconsultores/ventaboletos/service/ContingenciaService.java new file mode 100644 index 000000000..476e4e833 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ContingenciaService.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import javax.mail.AuthenticationFailedException; +import javax.mail.SendFailedException; + +import com.rjconsultores.ventaboletos.entidad.LogHistoricoContingencia; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface ContingenciaService { + + public List buscarHistorico(Integer empresaID, Integer estadoID); + + public LogHistoricoContingencia salvarHistoricoContingencia(LogHistoricoContingencia historicoCont) throws BusinessException, SendFailedException, AuthenticationFailedException; +} diff --git a/src/com/rjconsultores/ventaboletos/service/ControleSerieEmbarcadaService.java b/src/com/rjconsultores/ventaboletos/service/ControleSerieEmbarcadaService.java new file mode 100644 index 000000000..149fd0e2e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ControleSerieEmbarcadaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CtrlSerieEmbarcada; +import com.rjconsultores.ventaboletos.vo.embarcada.SerieEmbarcada; + +public interface ControleSerieEmbarcadaService { + + public SerieEmbarcada buscarSerieEmbarcada(CtrlSerieEmbarcada controleSerieEmbarcada); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConvenioDetService.java b/src/com/rjconsultores/ventaboletos/service/ConvenioDetService.java new file mode 100644 index 000000000..74f0bb549 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConvenioDetService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ConvenioDet; + +/** + * + * @author Administrador + */ +public interface ConvenioDetService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConvenioService.java b/src/com/rjconsultores/ventaboletos/service/ConvenioService.java new file mode 100644 index 000000000..68ab7dc4d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConvenioService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Convenio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ConvenioService extends GenericService { + + public List buscar(String descconvenio, String cveconvenio); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CorridaCtrlService.java b/src/com/rjconsultores/ventaboletos/service/CorridaCtrlService.java new file mode 100644 index 000000000..6e42cb231 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CorridaCtrlService.java @@ -0,0 +1,30 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +/** + * + * @author Administrador + */ +public interface CorridaCtrlService { + + public CorridaCtrl obtenerID(Integer id); + + public CorridaCtrl suscribir(CorridaCtrl entidad); + + public CorridaCtrl actualizacion(CorridaCtrl entidad); + + public CorridaCtrl buscar(Ruta ruta, ClaseServicio claseServicio, Marca marca, Date horario, boolean pisoExtra); + + public CorridaCtrl buscar(Integer corridaId, Parada origem, Parada destino, ClaseServicio claseServicio, Marca marca); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CorridaService.java b/src/com/rjconsultores/ventaboletos/service/CorridaService.java new file mode 100644 index 000000000..34b8f0ccd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CorridaService.java @@ -0,0 +1,83 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +/** + * + * @author rodrigo + */ +public interface CorridaService extends GenericService { + + /** + * Genera las corridas de acuerdo con el parametro de cant dias. + * + * + * @return - Si fue generado exitosamente o no + */ + public boolean generarCorridaAutomatica(); + + public List buscarPorAutobusCorridasFuturas(DiagramaAutobus diagramaAutobus); + + public List buscarPorRolOperativoCorridasFuturas(DiagramaAutobus diagramaAutobus); + + public List buscarPorFecCorrida(Date value); + + public List verificarCorridaId(Integer corridaId); + + public List buscarPorId(Integer idCorrida); + + public List buscarFiltro(Parada ori, Parada des, Date hora, ClaseServicio cs); + + /** + * Regresa la fecha final para el período de generación automatica de corridas. + * + * + * @return + */ + public Date calcularDataFinalGeneracionCorrida(); + + public List buscarDistinct(Parada ori, Parada des, Date horaSalidaInicio, Date horaSalidaFin, ClaseServicio cs, Integer corridaId); + + /** + * Gera corrida a partir dos servicos selecionados e no intervalo de dias informados.
+ * + * @param lsEsquemaCorrida + * @param dataDe + * @param dataAte + * @return A quantidade de corridas geradas + * @throws BusinessException + */ + public Long generarCorridasSelecionadas(List lsEsquemaCorrida, Date dataDe, Date dataAte) throws BusinessException; + + public List buscarGroupCorrridaId(Integer corridaId, Date dateInicio, Date dateFin); + + public List buscarGroupCorrridaId(Integer corridaId, Integer origem, Integer destino, Integer ruta, Integer numRuta, Date dateInicio, Date dateFin); + + public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial); + + Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial, Integer corridaId); + + Boolean editarCorridaPorOutraCorrida(Estado estado, Date dataInicial, Integer corridaId, Date dataPadrao); + + public List buscarCorridaRelAproveitamento(Parada origem, Parada destino, Date feccorrida, Integer corridaId); + + public Corrida buscaCorrridaFutura(Ruta ruta, Date fecInicio); + + public Boolean existeCorrida(Long id); + + public Integer buscarOcupacaoCorrida(Corrida corrida); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CorridaTramoService.java b/src/com/rjconsultores/ventaboletos/service/CorridaTramoService.java new file mode 100644 index 000000000..b01b1574a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CorridaTramoService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; + +public interface CorridaTramoService extends GenericService { + + public List obtenerTramoTarjetaEmitida(); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CortesiaBeneficiarioService.java b/src/com/rjconsultores/ventaboletos/service/CortesiaBeneficiarioService.java new file mode 100644 index 000000000..980554421 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CortesiaBeneficiarioService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CortesiaBeneficiario; + +/** + * + * @author Shiro + */ +public interface CortesiaBeneficiarioService extends GenericService{ + + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/CortesiaDireccionService.java b/src/com/rjconsultores/ventaboletos/service/CortesiaDireccionService.java new file mode 100644 index 000000000..28c1f9a74 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CortesiaDireccionService.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CortesiaDireccion; +import com.rjconsultores.ventaboletos.entidad.Marca; +import java.util.Date; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface CortesiaDireccionService extends GenericService { + + public List pesquisar(Marca marca, ClaseServicio claseServicio, Date fecInicio, Date fecFinal); + + public List buscar(CortesiaDireccion cortesiaDireccion); + + public List buscarFolio(CortesiaDireccion cortesiaDireccion); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CortesiaService.java b/src/com/rjconsultores/ventaboletos/service/CortesiaService.java new file mode 100644 index 000000000..9da186c6f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CortesiaService.java @@ -0,0 +1,28 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Cortesia; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface CortesiaService extends GenericService { + + public List pesquisar(String empleadoClave); + + public Cortesia buscar(Integer cortesiaId); + + public List buscarDplicidad(Cortesia cortesia); + + /** + * Indica se la cortesia ya fue utilizada + * @param cortesia + * @return + */ + public boolean cortesiaUtilizada(Cortesia cortesia); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CotacaoService.java b/src/com/rjconsultores/ventaboletos/service/CotacaoService.java new file mode 100644 index 000000000..c20e0bee5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CotacaoService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Cotacao; +import com.rjconsultores.ventaboletos.entidad.Moneda; + +public interface CotacaoService extends GenericService { + + public void inativarCotacoesAntigas(Moneda moneda); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CtrlFechamentoCaixaService.java b/src/com/rjconsultores/ventaboletos/service/CtrlFechamentoCaixaService.java new file mode 100644 index 000000000..7ab2dba7e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CtrlFechamentoCaixaService.java @@ -0,0 +1,25 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; + +import com.rjconsultores.ventaboletos.entidad.CtrlFechamentoCaixa; +import com.rjconsultores.ventaboletos.enums.CtrlFechamentoCaixaStatus; + +public interface CtrlFechamentoCaixaService extends GenericService { + + /** + * Metodo que verifica se a rotina de retencao de comissao pode ser executada, + * baseado no fechamento automatico dos caixas + * @param feccorte + * @return + */ + public boolean autorizarExecutarRotinaRetencao(Date feccorte); + + /** + * Metodo que atualiza o controle de fechamento de caixa para retencao de comissao + * @param status + * @param dataRetencao + */ + public void atualizarCtrlFechamentoCaixaStatus(CtrlFechamentoCaixaStatus status, Date dataRetencao); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/CuponConvenioService.java b/src/com/rjconsultores/ventaboletos/service/CuponConvenioService.java new file mode 100644 index 000000000..171cdc6f2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CuponConvenioService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CuponConvenio; +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface CuponConvenioService extends GenericService{ + + public List pesquisar(TipoConvenio tipoConvenio); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/CuponSecretariaService.java b/src/com/rjconsultores/ventaboletos/service/CuponSecretariaService.java new file mode 100644 index 000000000..55f1f8f6b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CuponSecretariaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.CuponSecretaria; + +/** + * + * @author Administrador + */ +public interface CuponSecretariaService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/CursoService.java b/src/com/rjconsultores/ventaboletos/service/CursoService.java new file mode 100644 index 000000000..be9d238e7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CursoService.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Curso; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +public interface CursoService { + public List obtenerTodos(); + + public Curso obtenerID(Integer id); + + public Curso suscribir(Curso entidad); + + public Curso actualizacion(Curso entidad); + + public void borrar(Curso entidad) throws RegistroConDependenciaException; + + public List buscar(String nomcurso); +} diff --git a/src/com/rjconsultores/ventaboletos/service/CustomService.java b/src/com/rjconsultores/ventaboletos/service/CustomService.java new file mode 100644 index 000000000..7a478c78e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/CustomService.java @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.Properties; + +import com.rjconsultores.ventaboletos.entidad.Custom; +import com.rjconsultores.ventaboletos.enums.SistemaEnum; + +/** + * + * @author Lucas + */ +public interface CustomService extends GenericService { + + public Custom buscar(String chave); + + /** + * Carrega para o banco os parâmetros do arquivo properties. + * Mantis #20284 + * @param sistema + * @param arquivo + * @param substituirExistente + */ + public void carregarArquivoProperties(SistemaEnum sistema, Properties arquivo, boolean substituirExistente); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/DepositoBancarioService.java b/src/com/rjconsultores/ventaboletos/service/DepositoBancarioService.java new file mode 100644 index 000000000..41c544abb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/DepositoBancarioService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.DepositoBancario; + +/** + * + * @author Rafius + */ +public interface DepositoBancarioService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/DescontoComissaoService.java b/src/com/rjconsultores/ventaboletos/service/DescontoComissaoService.java new file mode 100644 index 000000000..ea4e4ba67 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/DescontoComissaoService.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DescontoComissao; + +public interface DescontoComissaoService extends GenericService { + + public DescontoComissao suscribirOrActualizacion(DescontoComissao entidad); + + public List buscaDescontoComissaoPeriodo(Integer puntoVentaId, Integer empresaId, Date inicioPeriodo, Date fimPeriodo); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/DetAbastoBoletoService.java b/src/com/rjconsultores/ventaboletos/service/DetAbastoBoletoService.java new file mode 100644 index 000000000..f3856b7de --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/DetAbastoBoletoService.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Estacion; + +public interface DetAbastoBoletoService extends GenericService { + + public Long getSecuencia(); + + public void desabilitaDetAbastos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa); + + public List buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa); + + public List buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(Aidf Aidf); +} diff --git a/src/com/rjconsultores/ventaboletos/service/DetDiagramaAutobusService.java b/src/com/rjconsultores/ventaboletos/service/DetDiagramaAutobusService.java new file mode 100644 index 000000000..c83fe7f45 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/DetDiagramaAutobusService.java @@ -0,0 +1,28 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; + +/** + * + * @author Administrador + */ +public interface DetDiagramaAutobusService { + + public List obtenerTodos(); + + public DetDiagramaAutobus obtenerID(Short id); + + public DetDiagramaAutobus suscribir(DetDiagramaAutobus entidad); + + public DetDiagramaAutobus actualizacion(DetDiagramaAutobus entidad); + + public void borrar(DetDiagramaAutobus entidad); + + DetDiagramaAutobus obtenerPorDiagramaAutobusAsiento(Integer diagramaAutobusId, String numAsiento); +} diff --git a/src/com/rjconsultores/ventaboletos/service/DiagramaAutobusService.java b/src/com/rjconsultores/ventaboletos/service/DiagramaAutobusService.java new file mode 100644 index 000000000..faf601420 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/DiagramaAutobusService.java @@ -0,0 +1,30 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; + +/** + * + * @author Administrador + */ +public interface DiagramaAutobusService { + + public List obtenerTodos(); + + public DiagramaAutobus obtenerID(Short id); + + public DiagramaAutobus suscribir(DiagramaAutobus entidad); + + public DiagramaAutobus actualizacion(DiagramaAutobus entidad); + + public void borrar(DiagramaAutobus entidad); + + public List buscar(String descDiagrama, Short maxparados, Short cantasientos); + + public List buscar(String descDiagrama); +} diff --git a/src/com/rjconsultores/ventaboletos/service/DispositivoEmbarcadaHistoricoService.java b/src/com/rjconsultores/ventaboletos/service/DispositivoEmbarcadaHistoricoService.java new file mode 100644 index 000000000..0a0f66fbf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/DispositivoEmbarcadaHistoricoService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcadaHistorico; + +/** + * + * @author Administrador + */ +public interface DispositivoEmbarcadaHistoricoService { + + public List obtenerTodos(); + public DispositivoEmbarcadaHistorico suscribir(DispositivoEmbarcadaHistorico entidad); + public DispositivoEmbarcadaHistorico actualizacion(DispositivoEmbarcadaHistorico entity); + public List buscarHistoricoDispositivoPorId(Long dispositivoId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/DispositivoEmbarcadaService.java b/src/com/rjconsultores/ventaboletos/service/DispositivoEmbarcadaService.java new file mode 100644 index 000000000..ec0d6e04a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/DispositivoEmbarcadaService.java @@ -0,0 +1,31 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcada; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.DispositivoEmbarcadaJaCadastradoException; + +/** + * + * @author Administrador + */ +public interface DispositivoEmbarcadaService { + + public List obtenerTodos(); + public DispositivoEmbarcada suscribirActualizar(DispositivoEmbarcada dispositivoEmbarcada) throws DispositivoEmbarcadaJaCadastradoException; + public DispositivoEmbarcada buscarVersaoUltimaSinc(String versaoUltimaSinc); + public DispositivoEmbarcada buscarImeiDuplicado(String imei); + public DispositivoEmbarcada suscribir(DispositivoEmbarcada entidad) throws DispositivoEmbarcadaJaCadastradoException; + public DispositivoEmbarcada actualizacion(DispositivoEmbarcada entity); + public DispositivoEmbarcada suscribirActualizacion(DispositivoEmbarcada entidad); + public DispositivoEmbarcada buscarDispositivoPorId(DispositivoEmbarcada dispositivoEmbarcada); + public List buscarPorEmpresaPuntoVenta(Empresa empresa, PuntoVenta puntoventa); + public List buscarAllVersaoUltimaSinc(); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/DivisionService.java b/src/com/rjconsultores/ventaboletos/service/DivisionService.java new file mode 100644 index 000000000..6af38143e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/DivisionService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Division; + +public interface DivisionService extends GenericService{ + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EmbarcadaDispOperadorService.java b/src/com/rjconsultores/ventaboletos/service/EmbarcadaDispOperadorService.java new file mode 100644 index 000000000..fcd2f3c78 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmbarcadaDispOperadorService.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EmbarcadaDispOperador; + +public interface EmbarcadaDispOperadorService extends GenericService { + + public List buscarEmbarcadaDispOperadorPorDispositivo(Long dispositivoEmbarcadaId); + + public List buscarEmbarcadaDispOperadorPorPuntoVenta(Long puntoVentaId); + + public boolean removerListEmbarcadaDispOperador(List embarcadaDisOperadorList); + + public boolean inserirListEmbarcadaDispOperador(List embarcadaDisOperadorList); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EmbarqueCatracaRodoviariaService.java b/src/com/rjconsultores/ventaboletos/service/EmbarqueCatracaRodoviariaService.java new file mode 100644 index 000000000..0b650bcc0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmbarqueCatracaRodoviariaService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EmbarqueCatracaRodoviaria; + +public interface EmbarqueCatracaRodoviariaService { + List obtenerTodos(); + + EmbarqueCatracaRodoviaria suscribir(EmbarqueCatracaRodoviaria embarqueCatracaRodoviaria); + + public void borrar(EmbarqueCatracaRodoviaria entidad); +} diff --git a/src/com/rjconsultores/ventaboletos/service/EmpleadoService.java b/src/com/rjconsultores/ventaboletos/service/EmpleadoService.java new file mode 100644 index 000000000..387dd1278 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpleadoService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +import java.util.List; + +/** + * + * @author Shiro + */ +public interface EmpleadoService extends GenericService { + + public List pesquisaClave(String empleadoClave); + + public List pesquisaEmpresa(Empresa empresa); +} diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaContaBancariaService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaContaBancariaService.java new file mode 100644 index 000000000..44bbfabc6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaContaBancariaService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface EmpresaContaBancariaService { + + public EmpresaContaBancaria suscribirActualizacion(EmpresaContaBancaria entidad) throws BusinessException; +} diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaEmailConfigService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaEmailConfigService.java new file mode 100644 index 000000000..1ad355076 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaEmailConfigService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailConfig; + +public interface EmpresaEmailConfigService extends GenericService { + + public EmpresaEmailConfig buscarPorEmpresa(Empresa empresa); +} diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaEmailFlexBusService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaEmailFlexBusService.java new file mode 100644 index 000000000..499d09be0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaEmailFlexBusService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailFlexBus; + +public interface EmpresaEmailFlexBusService extends GenericService { + + public EmpresaEmailFlexBus buscarPorEmpresa(Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaEmailService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaEmailService.java new file mode 100644 index 000000000..c3ac86507 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaEmailService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmail; + +public interface EmpresaEmailService extends GenericService { + + public EmpresaEmail buscarPorEmpresa(Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaEquivalenciaService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaEquivalenciaService.java new file mode 100644 index 000000000..37e9625ac --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaEquivalenciaService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEquivalencia; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface EmpresaEquivalenciaService extends GenericService { + + public List buscar(Empresa parada, ComisionistaExterno comisionistaExterno); + + public List buscarEquivalencia(EmpresaEquivalencia empresaEquivalencia); +} diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaImpostoService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaImpostoService.java new file mode 100644 index 000000000..a4584f905 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaImpostoService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; + +/** + * + * @author Administrador + */ +public interface EmpresaImpostoService extends GenericService { + + public List buscarByEmpresa(Empresa empresa); + + public List buscarEmpresaImposto(Integer empresaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaSaferConfigService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaSaferConfigService.java new file mode 100644 index 000000000..9d70b18da --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaSaferConfigService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaSaferConfig; + +public interface EmpresaSaferConfigService extends GenericService { + + public EmpresaSaferConfig buscarPorEmpresa(Empresa empresa); +} diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaService.java new file mode 100644 index 000000000..5f9119b8d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaService.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ComEmpCategoria; +import com.rjconsultores.ventaboletos.entidad.ComEmpConferencia; +import com.rjconsultores.ventaboletos.entidad.ComEmpFormapago; +import com.rjconsultores.ventaboletos.entidad.ComEmpTipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +/** + * + * @author Administrador + */ +public interface EmpresaService { + + public List obtenerTodos(); + + public Empresa obtenerID(Integer id); + + public Empresa suscribirActualizacion(Empresa entidad) throws BusinessException; + + public void borrar(Empresa entidad) throws RegistroConDependenciaException; + + public List buscar(String nombempresa, Boolean indExterna, Short indTipo); + + public List buscarTodosExceto(List empresa, Integer... idEmpresa); + + public List obtenerIndExternoFalse(); + + public List obtenerIndTipo2(); + + public List buscarNotInPuntoVtaComissao(PuntoVenta puntoVenta); + + public List buscaInscricoesEstaduais(Empresa empresa); + + public void actualizaInscEstadual(InscricaoEstadual inscricaoEstadual); + + public List buscaLike(String nombempresa); + + public ComEmpCategoria adicionarComissaoCategoria(ComEmpCategoria comEmpCategoria); + + public void removerComissaoCategoria(ComEmpCategoria comEmpCategoria); + + public ComEmpFormapago adicionarComissaoFormapago(ComEmpFormapago comEmpFormapago); + + public void removerComissaoFormapago(ComEmpFormapago comEmpFormapago); + + public ComEmpTipoEventoExtra adicionarComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra); + + public void removerComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra); + + public List obtenerTodosIncluindoEmpresaTodas(); + + public ComEmpConferencia suscribirOrActualizacion(ComEmpConferencia comEmpConferencia); + + public List buscarEmpresaPtoVtaComissao(); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaTrocoSimplesService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaTrocoSimplesService.java new file mode 100644 index 000000000..be4cae77b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaTrocoSimplesService.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.EmpresaTrocoSimples; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface EmpresaTrocoSimplesService { + + EmpresaTrocoSimples suscribirActualizar(EmpresaTrocoSimples empresaTroco) throws BusinessException; + + void apagar(EmpresaTrocoSimples empresaTroco) throws BusinessException; + + EmpresaTrocoSimples buscarEmpresaTrocoSimplesPorEmpresaId(Integer empresaID); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EnderecoApanheService.java b/src/com/rjconsultores/ventaboletos/service/EnderecoApanheService.java new file mode 100644 index 000000000..84078afa5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EnderecoApanheService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EnderecoApanhe; + +public interface EnderecoApanheService extends GenericService { + + public List buscar(Date datapacote, String numoperacion); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EscolaService.java b/src/com/rjconsultores/ventaboletos/service/EscolaService.java new file mode 100644 index 000000000..2c2c979ac --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EscolaService.java @@ -0,0 +1,21 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Escola; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +public interface EscolaService { + public List obtenerTodos(); + + public Escola obtenerID(Integer id); + + public Escola suscribir(Escola entidad); + + public Escola actualizacion(Escola entidad); + + public void borrar(Escola entidad) throws RegistroConDependenciaException; + + public List buscar(String nombescola, Ciudad ciudad); +} diff --git a/src/com/rjconsultores/ventaboletos/service/EsquemaAgrupacionService.java b/src/com/rjconsultores/ventaboletos/service/EsquemaAgrupacionService.java new file mode 100644 index 000000000..0137a4a97 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EsquemaAgrupacionService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EsquemaAgrupacion; + +/** + * + * @author RJ Consultores + */ +public interface EsquemaAgrupacionService extends GenericService { + + public List buscar(EsquemaAgrupacion esquemaAgrupacion); + + public EsquemaAgrupacion obtenerByEsquemaAgrupacion(Integer numAgrupacion); + + public boolean buscarNumAgrupacion(Integer numAgrupacion); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EsquemaAsientoService.java b/src/com/rjconsultores/ventaboletos/service/EsquemaAsientoService.java new file mode 100644 index 000000000..7d80e235b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EsquemaAsientoService.java @@ -0,0 +1,49 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EsquemaAsiento; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +/** + * + * @author Rafius + */ +public interface EsquemaAsientoService { + + public void borrar(EsquemaAsiento entidad); + + public List obtenerPorCorrida(EsquemaCorrida esquemaCorrida); + + public EsquemaAsiento obtenerPorCorridaeAsiento(EsquemaCorrida esquemaCorrida, String asiento); + + /*** + * Hace la configuración de bloqueo de asientos de acuerdo la origen informada.
+ * + * + * + * @param asiento + * - Indica los asientos. Ej.: 1,2,3,4 o 1-4, + * @param origenId + * @return + */ + public void bloqueoAsientoExclusivo(EsquemaCorrida esquemaCorrida, String asiento, Parada origen, Parada destino, Integer tiempoLiberacion) throws BusinessException; + + /** + * Hace la configuración de ocupación de bloqueo de asientos de acuerdo con el tramo informado (origen - destino).
+ * + * @param asiento + * - Indica los asientos. Ej.: 1,2,3,4 o 1-4, + * @param origenId + * @param destinoId + * @param motivoOcupacion + * @return + */ + public void bloqueoAsientoOcupacion(EsquemaCorrida esquemaCorrida, String asiento, Parada origen, Parada destino, Integer tiempoLiberacion, String motivoOcupacion) throws BusinessException; +} diff --git a/src/com/rjconsultores/ventaboletos/service/EsquemaCorridaEmbarqueDesembarqueService.java b/src/com/rjconsultores/ventaboletos/service/EsquemaCorridaEmbarqueDesembarqueService.java new file mode 100644 index 000000000..ca6866bf8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EsquemaCorridaEmbarqueDesembarqueService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorridaEmbarqueDesembarque; + +public interface EsquemaCorridaEmbarqueDesembarqueService extends GenericService { + + List obtenerPorEsquemaCorrida(EsquemaCorrida esquemaCorrida); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EsquemaCorridaService.java b/src/com/rjconsultores/ventaboletos/service/EsquemaCorridaService.java new file mode 100644 index 000000000..e5c3c6bfa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EsquemaCorridaService.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.ParadaEsquema; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tramo; + +/** + * + * @author Rafius + */ +public interface EsquemaCorridaService extends GenericService { + + public List buscarPorEsquemaOperacional(EsquemaOperacional eo); + + public List buscarPorEmpresaCorrida(Empresa empresa); + + public List buscar(Marca marca, RolOperativo rolOperativo, Ruta ruta, ClaseServicio claseServicio); + + public boolean buscarNumCorrida(Integer numCorrida, Integer numCorridaPisoExtra, boolean isDoublePiso); + + public void actualizaEsquemaTramo(List listParadaEsquema, EsquemaCorrida ec); + + public List buscaDentroVigencia(Date dataGeracao); + + public boolean buscarEsquemaCorridaExisteTramo(Tramo tramo); + + public EsquemaCorrida buscaEsquemaPorRuta(Ruta ruta); + + public EsquemaCorrida buscarPeloNumCorrida(Integer numCorridaPisoExtra); + + /** + * See {@link EsquemaCorridaDAO#existe(Ruta, Integer)} + * + * @param ruta + * @param paradaId + * @return + */ + public List existe(Ruta ruta, Integer paradaId); + + public List buscaDentroVigenciaQtdeDiasNull(Date dataGeracao); + + public List buscaDentroVigenciaQtdeDiasNotNull(Date dataDe); + + public EsquemaCorrida obtenerByEsquemaCorrida(Integer numCorrida); + + public EsquemaCorrida buscaEsquemaPorRutaSemVigencia(Integer rutaId, Integer numCorrida); +} diff --git a/src/com/rjconsultores/ventaboletos/service/EsquemaOperacionalService.java b/src/com/rjconsultores/ventaboletos/service/EsquemaOperacionalService.java new file mode 100644 index 000000000..77489d02b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EsquemaOperacionalService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface EsquemaOperacionalService + extends GenericService { + + public List dentroVigenciaEsquemaOperacional(Date dataGeracao); + + public List dentroVigenciaEsquemaOperacional(Date dataDe, Date dataAte); +} diff --git a/src/com/rjconsultores/ventaboletos/service/EsquemaTramoService.java b/src/com/rjconsultores/ventaboletos/service/EsquemaTramoService.java new file mode 100644 index 000000000..25d346a8d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EsquemaTramoService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaTramo; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface EsquemaTramoService extends GenericService { + + public List obtenerPorEsquemaCorrida(EsquemaCorrida ec); + + public List obtenerPorEsquemaCorridaOrderNumSec(EsquemaCorrida ec); + + public List obtenerAtivosDesativosPorEsquemaCorrida(EsquemaCorrida esquemaCorrida); +} diff --git a/src/com/rjconsultores/ventaboletos/service/EstacionService.java b/src/com/rjconsultores/ventaboletos/service/EstacionService.java new file mode 100644 index 000000000..ded2801aa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EstacionService.java @@ -0,0 +1,52 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.EstacionImpresora; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +/** + * + * @author Administrador + */ +public interface EstacionService { + + public List obtenerTodos(); + + public Estacion obtenerID(Integer id); + + /** + * Suscribe/Actualiza la entidad informada. + * + * @param entidad + * @return + * @throws BusinessException + * - Cuando la estacion es duplicada + */ + public Estacion suscribirActualizar(Estacion entidad) throws BusinessException; + + public void borrar(Estacion entidad) throws BusinessException; + + public List buscar(String descEstacion, String descMac, Long nunCaja, PuntoVenta pv); + + public List buscar(String descMac); + + public Estacion buscarPorIMEI(String imei); + + public Long getDecimalMAC(String mac); + + public List buscarEstaciones(PuntoVenta puntoVenta); + + public List buscarEstaciones(List lsPuntoVenta); + + public void devolverFoliosAutomaticosImpressoraFiscal(EstacionImpresora ei); + + public List buscarEstacionesStockCentral(PuntoVenta puntoVenta); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EstacionSitefService.java b/src/com/rjconsultores/ventaboletos/service/EstacionSitefService.java new file mode 100644 index 000000000..8d92cd94a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EstacionSitefService.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EstacionSitef; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enums.TipoIntegracaoTEF; + +/** + * + * @author Lucas + * + */ +public interface EstacionSitefService { + + EstacionSitef buscar(Empresa empresa, Integer numempresa, Integer numfilial, String numpdv); + + public EstacionSitef buscar(Empresa empresa, TipoIntegracaoTEF tipoIntegracaoTEF, String numpdv, Integer numfilial); + + public EstacionSitef parametrizacaoJahExiste(Empresa empresa, TipoIntegracaoTEF tipoIntegracaoTEF, String numpdv, Integer numfilial, PuntoVenta puntoVenta); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EstadoService.java b/src/com/rjconsultores/ventaboletos/service/EstadoService.java new file mode 100644 index 000000000..246ba1596 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EstadoService.java @@ -0,0 +1,41 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Pais; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +/** + * + * @author MCosso + */ +public interface EstadoService { + + public List obtenerTodos(); + + public Estado obtenerID(Integer id); + + public Estado suscribir(Estado entidad); + + public Estado actualizacion(Estado entidad); + + public void borrar(Estado entidad) throws RegistroConDependenciaException; + + public List buscar(String nombestado, Pais pais); + + public List buscarNotInEmpresaImposto(Empresa empresa); + + public List buscarCveEstado(String cveEstado); + + public Map getConfiguracoesFusoVeraoParada(Integer paradaId, Date data); + + public Map getConfiguracoesFusoVeraoPuntoventa(Integer puntoventaId, Date data); +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/EventoExtraService.java b/src/com/rjconsultores/ventaboletos/service/EventoExtraService.java new file mode 100644 index 000000000..b5846356d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EventoExtraService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; + +public interface EventoExtraService extends GenericService { + + public List obtenerPorTipo(TipoEventoExtra tipoEventoExtra); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ExcepcionPeajeService.java b/src/com/rjconsultores/ventaboletos/service/ExcepcionPeajeService.java new file mode 100644 index 000000000..819631846 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ExcepcionPeajeService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje; +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeajeVigencia; + +public interface ExcepcionPeajeService extends GenericService { + + public List buscar(String descconvenio, String cveconvenio); + + public void deletarVigencias(List epv); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ExcepcionRedondoService.java b/src/com/rjconsultores/ventaboletos/service/ExcepcionRedondoService.java new file mode 100644 index 000000000..de2a15542 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ExcepcionRedondoService.java @@ -0,0 +1,34 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ExcepcionRedondo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ExcepcionRedondoService{ + + public List obtenerTodos(); + + public ExcepcionRedondo obtenerID(Integer id); + + /** + * Suscribe o actualiza la exception + * @param entidad + * @return + * @throws BusinessException - Si genera una exception si hay un error de validación + */ + public ExcepcionRedondo suscribirActualizar(ExcepcionRedondo entidad) throws BusinessException; + + public void borrar(ExcepcionRedondo entidad); + + public List buscar(String indTipo, Parada origem, Parada destino); +} diff --git a/src/com/rjconsultores/ventaboletos/service/FechamentoParamgeralService.java b/src/com/rjconsultores/ventaboletos/service/FechamentoParamgeralService.java new file mode 100644 index 000000000..66864649e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/FechamentoParamgeralService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral; + +public interface FechamentoParamgeralService extends GenericService { + + public List buscaParametrosPorEmpresas(List empresasId); + public List buscaParametrosPorEmpresa(Integer empresasId); + public FechamentoParamgeral suscribirOrActualizacion(FechamentoParamgeral fechamentoParamgeral); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/FechamentoParamptovtaService.java b/src/com/rjconsultores/ventaboletos/service/FechamentoParamptovtaService.java new file mode 100644 index 000000000..c5fb2cda1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/FechamentoParamptovtaService.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface FechamentoParamptovtaService extends GenericService { + + public List buscaParametrosPorEmpresas(List empresasId); + public List buscaParametrosPorEmpresa(Integer empresasId); + public FechamentoParamptovta suscribirOrActualizacion(FechamentoParamptovta FechamentoParamptovta); + public List buscaParametrosPorPuntoventa(PuntoVenta puntoventa); + public FechamentoParamptovta buscaParametrosPorPuntoventaEmpresa(PuntoVenta puntoventa, Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/FeriadoService.java b/src/com/rjconsultores/ventaboletos/service/FeriadoService.java new file mode 100644 index 000000000..dfe6a5db6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/FeriadoService.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.service; + +import java.sql.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Feriado; + +public interface FeriadoService extends GenericService { + + public List buscar(Date descferiado); + + public List buscarDataEmpresaEstado(Date data, Empresa empresa, Estado estado); +} diff --git a/src/com/rjconsultores/ventaboletos/service/FiscalAliquotaEmpresaService.java b/src/com/rjconsultores/ventaboletos/service/FiscalAliquotaEmpresaService.java new file mode 100644 index 000000000..4c7f25139 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/FiscalAliquotaEmpresaService.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.FiscalAliquotaEmpresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface FiscalAliquotaEmpresaService { + + public List obtenerTodos(); + + public FiscalAliquotaEmpresa obtenerID(Integer id); + + public FiscalAliquotaEmpresa suscribirActualizar(FiscalAliquotaEmpresa entidad) throws BusinessException; + + public void borrar(FiscalAliquotaEmpresa entidad); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/FiscalImpressoraEstadoService.java b/src/com/rjconsultores/ventaboletos/service/FiscalImpressoraEstadoService.java new file mode 100644 index 000000000..b81b81134 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/FiscalImpressoraEstadoService.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressoraEstado; + +public interface FiscalImpressoraEstadoService{ + + public List obtenerTodos(); + public FiscalImpressoraEstado obtenerID(Integer id); + public FiscalImpressoraEstado suscribir(FiscalImpressoraEstado entidad); + public FiscalImpressoraEstado actualizacion(FiscalImpressoraEstado entidad); + public void borrar(FiscalImpressoraEstado entidad); + + public List retornaEstadosFiscalImpressora(FiscalImpressora fiscalImpressora) ; + + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/FiscalImpressoraService.java b/src/com/rjconsultores/ventaboletos/service/FiscalImpressoraService.java new file mode 100644 index 000000000..9d436c215 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/FiscalImpressoraService.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.FiscalFormapagoEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.FiscalRelgerencialEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalTotnaofiscalEmpresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface FiscalImpressoraService{ + + public List obtenerTodos(); + public FiscalImpressora obtenerID(Integer id); + public FiscalImpressora suscribir(FiscalImpressora entidad); + public FiscalImpressora actualizacion(FiscalImpressora entidad); + + + public List buscarTotsNaoFiscaisEmpresa(Integer empresaEcfId); + public List obtenerTodosTotnaofiscalEmpresa(); + public FiscalTotnaofiscalEmpresa obtenerIDTotnaofiscalEmpresa(Long id); + public FiscalTotnaofiscalEmpresa suscribirActualizarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad) throws BusinessException; + public void borrarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad); + + + public List buscarFormaPagoEmpresa(Integer empresaEcfId); + public List obtenerTodosFormapagoEmpresa(); + public FiscalFormapagoEmpresa obtenerIDFormapagoEmpresa(Long id); + public FiscalFormapagoEmpresa suscribirActualizarFormapagoEmpresa(FiscalFormapagoEmpresa entidad) throws BusinessException; + public FiscalFormapagoEmpresa borrarFormapagoEmpresa(FiscalFormapagoEmpresa entidad); + + public List buscarItensRelgerencialEmpresa(Integer empresaEcfId); + public List obtenerTodosRelgerencialEmpresa(); + public FiscalRelgerencialEmpresa obtenerIDRelgerencialEmpresa(Long id); + public FiscalRelgerencialEmpresa suscribirRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad); + public FiscalRelgerencialEmpresa actualizacionRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad); + public FiscalRelgerencialEmpresa suscribirActualizarRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad) throws BusinessException; + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/FiscalService.java b/src/com/rjconsultores/ventaboletos/service/FiscalService.java new file mode 100644 index 000000000..fc65d7af6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/FiscalService.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.service; + +import java.io.File; +import java.sql.SQLException; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.utilerias.fiscal.vo.FiscalRdi; +import com.rjconsultores.ventaboletos.utilerias.impressaormd.vo.ImpressaoRMD; + +public interface FiscalService { + + public int gerarRegistroP2_F2(List lsEsquemaCorrida, Date dataDe, Date dataAte) throws SQLException; + + public HashMap importacionFiscalECFValidaReducaoZ(Date inicio, Date fim, Empresa empresa, Estado estado, boolean isBoletoHist); + + public File importacionFiscalECF(Date inicio, Date fim, Empresa empresa, Estado estado, boolean isBoletoHist); + + public File importacionFiscalReducaoZ(Date inicio, Date fim, Empresa empresa, Estado estado); + + public File importacionFiscalReducaoZPendencia(Date inicio, Date fim, Empresa empresa, Estado estado); + + public File importacionFiscalECFManual(Date inicio, Date fim, Empresa empresa, Estado estado, boolean isBoletoHist); + + public File importacionNaoFiscal(Date inicio, Date fim, Empresa empresa, Estado estado); + + public File importacionFiscalECFCancelados(Date inicio, Date fim, Empresa empresa, Estado estado, boolean isBoletoHist); + + public File importacionFiscalECFXls(Empresa empresa, File arquivoTxt); + + public File importacionFiscalReducaoZXls(Empresa empresa, File arquivoTxt); + + public File importacionFiscalECFManualXls(Empresa empresa, File arquivoTxt); + + public File importacionNaoFiscalXls(Empresa empresa, File arquivoTxt); + + public File importacionFiscalECFCanceladosXls(Empresa empresa, File arquivoTxt); + + public File importacionFiscalECFPendencias(Date inicio, Date fim, Empresa empresa, Estado estado); + + public File buscarArquivoExportacaoECF(Date value, Date value2, Empresa empresa, Estado estado, String nomeArquivo); + + public File buscarArquivoExportacaoRMD(Date value, Date value2, Empresa empresa, Estado estado, String nomeArquivo); + + public List getRegistroImpressaoRMDTipoBPR(Date inicio, Date fim, Empresa empresa, Estado estado, String rmd, String folio); + + public List getRegistroImpressaoRMDTipoECF(Date inicio, Date fim, Empresa empresa, Estado estado, String rmd, String folio); + + public void gravarRMDBoleto(List rmds, Aidf aidf, String folio, Empresa empresa, Estado estado, boolean isECF, boolean isBPR); + + public void cancelarRMDBoleto(Date inicio, Date fim, Empresa empresa, Estado estado, Aidf aidf, String folioInicial, String folioFinal, boolean isCancela, boolean isInativa, boolean isECF, boolean isBPR); + + public List buscarRelatorioRDI(Date inicio, Date fim, Empresa empresa, List estados, boolean isReceitaTerceiros); +} diff --git a/src/com/rjconsultores/ventaboletos/service/FlywayUtilService.java b/src/com/rjconsultores/ventaboletos/service/FlywayUtilService.java new file mode 100644 index 000000000..c473d9635 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/FlywayUtilService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +public interface FlywayUtilService { + + public boolean existeErroExecucaoScript(); +} diff --git a/src/com/rjconsultores/ventaboletos/service/FolioPreimpresoService.java b/src/com/rjconsultores/ventaboletos/service/FolioPreimpresoService.java new file mode 100644 index 000000000..43752f1b0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/FolioPreimpresoService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.FolioPreimpreso; + +public interface FolioPreimpresoService extends GenericService { + + public FolioPreimpreso buscaFolioPreImpressoEstacionImpresora(Estacion estacion, Empresa empresa); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/FormaPagamentoAgenciaService.java b/src/com/rjconsultores/ventaboletos/service/FormaPagamentoAgenciaService.java new file mode 100644 index 000000000..259898174 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/FormaPagamentoAgenciaService.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +/** + * + * @author Administrador + */ +public interface FormaPagamentoAgenciaService extends GenericServiceInforme { +} diff --git a/src/com/rjconsultores/ventaboletos/service/FormaPagoDetService.java b/src/com/rjconsultores/ventaboletos/service/FormaPagoDetService.java new file mode 100644 index 000000000..ba5fcfad8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/FormaPagoDetService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; + +/** + * + * @author Administrador + */ +public interface FormaPagoDetService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/FormaPagoService.java b/src/com/rjconsultores/ventaboletos/service/FormaPagoService.java new file mode 100644 index 000000000..7370f8790 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/FormaPagoService.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface FormaPagoService extends GenericService { + + public List buscarPorDescricao(String descpago); + + + /** + * Hace las búsqueda de todas las formas de pagos, excepto las formas de pagos especiales. + * La formar de pago especiales son definidas de forma fija. No hay un campo que identifique eso. + * @return + */ + public List buscarFormasPagoExceptoEspeciales(); +} diff --git a/src/com/rjconsultores/ventaboletos/service/FuncionSistemaService.java b/src/com/rjconsultores/ventaboletos/service/FuncionSistemaService.java new file mode 100644 index 000000000..b689ada6d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/FuncionSistemaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.FuncionSistema; + +/** + * + * @author rodrigo + */ +public interface FuncionSistemaService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/GenericService.java b/src/com/rjconsultores/ventaboletos/service/GenericService.java new file mode 100644 index 000000000..400236974 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/GenericService.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface GenericService { + + public List obtenerTodos(); + + public T obtenerID(ID id); + + public T suscribir(T entidad); + + public T actualizacion(T entidad); + + public void borrar(T entidad); +} diff --git a/src/com/rjconsultores/ventaboletos/service/GenericServiceInforme.java b/src/com/rjconsultores/ventaboletos/service/GenericServiceInforme.java new file mode 100644 index 000000000..e6dfa249c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/GenericServiceInforme.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.io.InputStream; +import java.util.Map; + +import org.zkoss.util.media.AMedia; + +import com.rjconsultores.ventaboletos.exception.BusinessException; + + +/** + * + * @author Administrador + */ +public interface GenericServiceInforme { + + public AMedia gerarInforme(InputStream informe, Map parameters) throws BusinessException; +} diff --git a/src/com/rjconsultores/ventaboletos/service/GrupoCategoriaService.java b/src/com/rjconsultores/ventaboletos/service/GrupoCategoriaService.java new file mode 100644 index 000000000..cab9afaeb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/GrupoCategoriaService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.GrupoCategoria; + +public interface GrupoCategoriaService extends GenericService { + + public List buscar(String descricao); +} diff --git a/src/com/rjconsultores/ventaboletos/service/GrupoCortesiasService.java b/src/com/rjconsultores/ventaboletos/service/GrupoCortesiasService.java new file mode 100644 index 000000000..4747d06a9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/GrupoCortesiasService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.GrupoCortesia; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface GrupoCortesiasService extends GenericService { + + public List buscar(String descgrupo); +} diff --git a/src/com/rjconsultores/ventaboletos/service/GrupoRutaService.java b/src/com/rjconsultores/ventaboletos/service/GrupoRutaService.java new file mode 100644 index 000000000..af3ff2ebc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/GrupoRutaService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.GrupoRuta; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +public interface GrupoRutaService extends GenericService { + + public List buscarPorNome(String descgrupo); +} diff --git a/src/com/rjconsultores/ventaboletos/service/HotelService.java b/src/com/rjconsultores/ventaboletos/service/HotelService.java new file mode 100644 index 000000000..bcb5fab0e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/HotelService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Hotel; + +public interface HotelService extends GenericService { + + public List buscar(String deschotel); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ImagemService.java b/src/com/rjconsultores/ventaboletos/service/ImagemService.java new file mode 100644 index 000000000..dcafe8a19 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ImagemService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Imagem; + +public interface ImagemService extends GenericService { + + public Imagem buscarPorNomeImagem(String nomeImagem); + + public List buscar(String nombimagem); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ImportacaoClientesService.java b/src/com/rjconsultores/ventaboletos/service/ImportacaoClientesService.java new file mode 100644 index 000000000..f60fd219d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ImportacaoClientesService.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.service; + + +import java.io.Reader; +import java.util.List; + +import org.zkoss.util.media.Media; + +import com.rjconsultores.ventaboletos.entidad.Empresa; + +public interface ImportacaoClientesService { + public String[] lerArquivo(Reader reader, List empresas); + + public String[] lerArquivoExcel(Media media, List empresas); + + public Integer[] salvarClientes(String[] cliente, List empresas) throws Exception; +} diff --git a/src/com/rjconsultores/ventaboletos/service/ImportacaoClientesSrvpService.java b/src/com/rjconsultores/ventaboletos/service/ImportacaoClientesSrvpService.java new file mode 100644 index 000000000..335006b68 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ImportacaoClientesSrvpService.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.service; + + +import java.io.Reader; +import java.util.List; + +import org.zkoss.util.media.Media; + +import com.rjconsultores.ventaboletos.entidad.Empresa; + +public interface ImportacaoClientesSrvpService { + public String[] lerArquivo(Reader reader, List empresas); + + public String[] lerArquivoExcel(Media media, List empresas); + + public Integer[] salvarClientes(String[] cliente, List empresas) throws Exception; +} diff --git a/src/com/rjconsultores/ventaboletos/service/InformeCategoriaVentaService.java b/src/com/rjconsultores/ventaboletos/service/InformeCategoriaVentaService.java new file mode 100644 index 000000000..b15cc88aa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/InformeCategoriaVentaService.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +/** + * + * @author Administrador + */ +public interface InformeCategoriaVentaService extends GenericServiceInforme { +} diff --git a/src/com/rjconsultores/ventaboletos/service/InformePasajeroServicioService.java b/src/com/rjconsultores/ventaboletos/service/InformePasajeroServicioService.java new file mode 100644 index 000000000..9016f83d9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/InformePasajeroServicioService.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +/** + * + * @author Administrador + */ +public interface InformePasajeroServicioService extends GenericServiceInforme { +} diff --git a/src/com/rjconsultores/ventaboletos/service/InformeServicioDiarioService.java b/src/com/rjconsultores/ventaboletos/service/InformeServicioDiarioService.java new file mode 100644 index 000000000..17b90d65c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/InformeServicioDiarioService.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +/** + * + * @author Administrador + */ +public interface InformeServicioDiarioService extends GenericServiceInforme { +} diff --git a/src/com/rjconsultores/ventaboletos/service/InformeVentasPuntoVentaService.java b/src/com/rjconsultores/ventaboletos/service/InformeVentasPuntoVentaService.java new file mode 100644 index 000000000..117d64ca4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/InformeVentasPuntoVentaService.java @@ -0,0 +1,12 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +/** + * + * @author Administrador + */ +public interface InformeVentasPuntoVentaService extends GenericServiceInforme { +} diff --git a/src/com/rjconsultores/ventaboletos/service/InstiFinanceiraService.java b/src/com/rjconsultores/ventaboletos/service/InstiFinanceiraService.java new file mode 100644 index 000000000..624520bac --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/InstiFinanceiraService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; +import com.rjconsultores.ventaboletos.entidad.InstiFinanceira; + +public interface InstiFinanceiraService { + + public List obtenerTodos(); + public List buscarContasBancariasPorIdEmpresa(Integer empresaId); +} diff --git a/src/com/rjconsultores/ventaboletos/service/IntegracaoService.java b/src/com/rjconsultores/ventaboletos/service/IntegracaoService.java new file mode 100644 index 000000000..e4f733fb9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/IntegracaoService.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.service; + +import java.io.File; +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +public interface IntegracaoService { + + public File importacaoQdmpDer(Date inicio, Date fim, Empresa empresa, List lslinhas); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/IntegracaoTotvsService.java b/src/com/rjconsultores/ventaboletos/service/IntegracaoTotvsService.java new file mode 100644 index 000000000..a1586a384 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/IntegracaoTotvsService.java @@ -0,0 +1,22 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface IntegracaoTotvsService { + public Integer atualizaStstausBilhetesIntegrar(Empresa empresa, Date dataIncial, Date dataFinal, PuntoVenta puntoVenta) throws BusinessException; + + public Integer atualizaStstausServicosIntegrar(Empresa empresa, Integer numServico) throws BusinessException; + + public Integer atualizaStstausCorridasIntegrar(Empresa empresa, Integer numCorrida, Date dataInicial, Date dataFinal) throws BusinessException; + + public List buscaPuntoVentaEmpresa(Empresa empresa) throws Exception; + + public Integer solicitaReIntegracaoBilhete(Empresa empresa, Date dataInicial, Date dataFinal, PuntoVenta puntoVenta, Usuario usuario) throws BusinessException; + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/ItemAdicionalService.java b/src/com/rjconsultores/ventaboletos/service/ItemAdicionalService.java new file mode 100644 index 000000000..0373d0369 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ItemAdicionalService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; + +public interface ItemAdicionalService extends GenericService { + + public List buscaItemAdicionalPacote(Pacote pacote); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ItemDescontoService.java b/src/com/rjconsultores/ventaboletos/service/ItemDescontoService.java new file mode 100644 index 000000000..586ce54c0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ItemDescontoService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ItemDesconto; + +public interface ItemDescontoService extends GenericService { + + public List buscarPorNome(String nomitemdesconto); +} diff --git a/src/com/rjconsultores/ventaboletos/service/LogAuditoriaService.java b/src/com/rjconsultores/ventaboletos/service/LogAuditoriaService.java new file mode 100644 index 000000000..b217ede59 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/LogAuditoriaService.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.LogAuditoria; + +import br.com.rjconsultores.auditador.model.AuditadorObjects; + +public interface LogAuditoriaService extends GenericService { + + public void auditar(Object objetoOriginal, Object objetoNovo, Integer empresaId); + + public void auditarExclusao(Object objeto, Integer empresaId); + + public List listarTodasAsTelas(); + + public void suscribir(List lsObjects, Integer empresaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/LogDespesasReceitasDivService.java b/src/com/rjconsultores/ventaboletos/service/LogDespesasReceitasDivService.java new file mode 100644 index 000000000..e3b9655c9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/LogDespesasReceitasDivService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.LogDespesaReceitaDiversa; + +public interface LogDespesasReceitasDivService extends GenericService { + public List obterPorPeriodo(Date inicio, Date fim); +} diff --git a/src/com/rjconsultores/ventaboletos/service/MarcaAutobusService.java b/src/com/rjconsultores/ventaboletos/service/MarcaAutobusService.java new file mode 100644 index 000000000..70705007c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MarcaAutobusService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.MarcaAutobus; + +public interface MarcaAutobusService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/MarcaClaseServicioService.java b/src/com/rjconsultores/ventaboletos/service/MarcaClaseServicioService.java new file mode 100644 index 000000000..3bb46d265 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MarcaClaseServicioService.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicioPK; +import com.rjconsultores.ventaboletos.entidad.Usuario; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface MarcaClaseServicioService + extends GenericService { + + public List buscar(ClaseServicio clase); + + public List buscarPorEmpresasPermitidas(ClaseServicio clase, Usuario usuarioLoggado); + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/MarcaService.java b/src/com/rjconsultores/ventaboletos/service/MarcaService.java new file mode 100644 index 000000000..cbd92c86b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MarcaService.java @@ -0,0 +1,36 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Usuario; + +import java.util.List; + +/** + * + * @author Administrador + */ +public interface MarcaService { + + public List obtenerTodos(); + + public Marca obtenerID(Short id); + + public Marca suscribir(Marca entidad); + + public Marca actualizacion(Marca entidad); + + public void borrar(Marca entidad); + + public List buscarPorNome(String nomeMarca); + + public List buscarTodosExceto(Usuario usuario,Integer ... idMarca); + + public List buscarDescricaoIdMarca(); + + public List buscarMarcaPorEmpresa(List empresa); +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/MensagemRecusaService.java b/src/com/rjconsultores/ventaboletos/service/MensagemRecusaService.java new file mode 100644 index 000000000..6ba1202a7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MensagemRecusaService.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.MensagemRecusa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface MensagemRecusaService { + + public List obtenerTodos(); + + public MensagemRecusa obtenerID(Integer id); + + public void borrar(MensagemRecusa entidad); + + public MensagemRecusa suscribirActualizar(MensagemRecusa entidad) throws BusinessException; + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/MensajeEmpresaService.java b/src/com/rjconsultores/ventaboletos/service/MensajeEmpresaService.java new file mode 100644 index 000000000..3e438772b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MensajeEmpresaService.java @@ -0,0 +1,21 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeEmpresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface MensajeEmpresaService { + + public List obtenerTodos(); + + public List obtenerPorMensaje(Mensaje mensaje); + + public MensajeEmpresa obtenerID(Integer id); + + public void borrar(MensajeEmpresa entidad); + + public MensajeEmpresa suscribirActualizar(MensajeEmpresa entidad) throws BusinessException; + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/MensajePuntaVentaService.java b/src/com/rjconsultores/ventaboletos/service/MensajePuntaVentaService.java new file mode 100644 index 000000000..aace4b375 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MensajePuntaVentaService.java @@ -0,0 +1,21 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajePuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface MensajePuntaVentaService { + + public List obtenerTodos(); + + public List obtenerPorMensaje(Mensaje mensaje); + + public MensajePuntoVenta obtenerID(Integer id); + + public void borrar(MensajePuntoVenta entidad); + + public MensajePuntoVenta suscribirActualizar(MensajePuntoVenta entidad) throws BusinessException; + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/MensajeService.java b/src/com/rjconsultores/ventaboletos/service/MensajeService.java new file mode 100644 index 000000000..cb40aad5a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MensajeService.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface MensajeService { + + public List obtenerTodos(); + + public Mensaje obtenerID(Integer id); + + public void borrar(Mensaje entidad); + + public Mensaje suscribirActualizar(Mensaje entidad) throws BusinessException; + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/MensajeUsuarioService.java b/src/com/rjconsultores/ventaboletos/service/MensajeUsuarioService.java new file mode 100644 index 000000000..ce9372184 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MensajeUsuarioService.java @@ -0,0 +1,21 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeUsuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface MensajeUsuarioService { + + public List obtenerTodos(); + + public List obtenerPorMensaje(Mensaje mensaje); + + public MensajeUsuario obtenerID(Integer id); + + public void borrar(MensajeUsuario entidad); + + public MensajeUsuario suscribirActualizar(MensajeUsuario entidad) throws BusinessException; + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/MercadoCompetidoService.java b/src/com/rjconsultores/ventaboletos/service/MercadoCompetidoService.java new file mode 100644 index 000000000..112c5df8d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MercadoCompetidoService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MercadoCompetido; +import com.rjconsultores.ventaboletos.entidad.Parada; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface MercadoCompetidoService extends GenericService { + + public boolean existe(ClaseServicio claseServicio, + Parada origem, Parada destino); + + public List buscar(Parada origem, Parada destino); +} diff --git a/src/com/rjconsultores/ventaboletos/service/MerchantBancarioService.java b/src/com/rjconsultores/ventaboletos/service/MerchantBancarioService.java new file mode 100644 index 000000000..5b87810f6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MerchantBancarioService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.MerchantBancario; + +/** + * + * @author Rafius + */ +public interface MerchantBancarioService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/MigracaoControleEstoqueService.java b/src/com/rjconsultores/ventaboletos/service/MigracaoControleEstoqueService.java new file mode 100644 index 000000000..270dbed3b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MigracaoControleEstoqueService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface MigracaoControleEstoqueService { + + public void migraDadosBoletosPuntoVenta(PuntoVenta puntoVenta); + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/MonedaService.java b/src/com/rjconsultores/ventaboletos/service/MonedaService.java new file mode 100644 index 000000000..a1f1a100e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MonedaService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Moneda; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface MonedaService extends GenericService { + public List buscar(String descmoneda); + + public List obterTodosExcetoReais(); + + public List obtenerTodosSortedByID(); +} diff --git a/src/com/rjconsultores/ventaboletos/service/MonitoramentoCCFService.java b/src/com/rjconsultores/ventaboletos/service/MonitoramentoCCFService.java new file mode 100644 index 000000000..9336f7f1e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MonitoramentoCCFService.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.service; + +import java.sql.Connection; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCCF; + +public interface MonitoramentoCCFService extends GenericService { + public List buscaQuebraCCF(final String numserie20, final Date data, final Integer ccfInicial); + public void gravarListaCCFQuebrados(Map impressoras, Date data); + public Map obterImpressorasComCCFInicial(Date data); + public void openConnection(); + public void closeConnection(); +} diff --git a/src/com/rjconsultores/ventaboletos/service/MonitoramentoCRZService.java b/src/com/rjconsultores/ventaboletos/service/MonitoramentoCRZService.java new file mode 100644 index 000000000..52d79749f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MonitoramentoCRZService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCRZ; + +public interface MonitoramentoCRZService extends GenericService { + public List buscaQuebraCRZ(Date data); +} diff --git a/src/com/rjconsultores/ventaboletos/service/MotivoCancelVendaPacoteService.java b/src/com/rjconsultores/ventaboletos/service/MotivoCancelVendaPacoteService.java new file mode 100644 index 000000000..28345bea5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MotivoCancelVendaPacoteService.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.MotivoCancelVendaPacote; + +/** + * + * @author Bruno + * + */ +public interface MotivoCancelVendaPacoteService extends GenericService { + + public List buscar(String descmotivocancel, String tipomotivocancel); + + public List obtenerTodosTipoMotivoCancel(); + + public List obtenerTodosEspecificos(Integer[] motivos); + + public boolean validaMotivoCancelVendaPacoteConstante(MotivoCancelVendaPacote motivoCancelVendaPacote); +} diff --git a/src/com/rjconsultores/ventaboletos/service/MotivoCancelacionService.java b/src/com/rjconsultores/ventaboletos/service/MotivoCancelacionService.java new file mode 100644 index 000000000..06810163c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MotivoCancelacionService.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface MotivoCancelacionService extends GenericService { + + public List buscar(String descmotivo, String tipomotivo); + + public List obtenerTodosTipoMotivoB(); + + public List obtenerTodosEspecificos(Integer[] motivos); + + public boolean validaMotivoCancelacionConstante(MotivoCancelacion motivoCancelacion); + + public MotivoCancelacion findByCveSistema(String cveSistema) ; +} diff --git a/src/com/rjconsultores/ventaboletos/service/MotivoDevolucaoBilheteService.java b/src/com/rjconsultores/ventaboletos/service/MotivoDevolucaoBilheteService.java new file mode 100644 index 000000000..f37bb7b51 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MotivoDevolucaoBilheteService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.MotivoDevolucaoBilhete; +import java.util.List; + +/** + * + * @author Bruno Neves + */ +public interface MotivoDevolucaoBilheteService extends GenericService { + + public List buscar(String descmotivo, String tipomotivo); + + public List obtenerTodosTipoMotivoB(); + + public List obtenerTodosEspecificos(Integer[] motivos); + + public boolean validaMotivoDevolucaoBilheteConstante(MotivoDevolucaoBilhete motivoDevolucaoBilhete); +} diff --git a/src/com/rjconsultores/ventaboletos/service/MotivoReimpresionService.java b/src/com/rjconsultores/ventaboletos/service/MotivoReimpresionService.java new file mode 100644 index 000000000..0a9f2deb0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MotivoReimpresionService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.MotivoReimpresion; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface MotivoReimpresionService extends GenericService { + + public List buscar(String descmotivo); +} diff --git a/src/com/rjconsultores/ventaboletos/service/MotivoViajeService.java b/src/com/rjconsultores/ventaboletos/service/MotivoViajeService.java new file mode 100644 index 000000000..5fae57531 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MotivoViajeService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.MotivoViaje; + +/** + * + * @author Shiro + */ +public interface MotivoViajeService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/MotivocancelacionEquivalenciaService.java b/src/com/rjconsultores/ventaboletos/service/MotivocancelacionEquivalenciaService.java new file mode 100644 index 000000000..b6f9cc932 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MotivocancelacionEquivalenciaService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import com.rjconsultores.ventaboletos.entidad.MotivocancelacionEquivalencia; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface MotivocancelacionEquivalenciaService + extends GenericService { + + public List buscar(ComisionistaExterno comisionistaExterno, + MotivoCancelacion motivoCancelacion); + + public List buscarEquivalencia(MotivocancelacionEquivalencia motivoCancelacionEquivalencia); +} diff --git a/src/com/rjconsultores/ventaboletos/service/MovimentacionBilhetesService.java b/src/com/rjconsultores/ventaboletos/service/MovimentacionBilhetesService.java new file mode 100644 index 000000000..9e7d850ce --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MovimentacionBilhetesService.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +public interface MovimentacionBilhetesService { + + public List obtenerHistoricoMovimetacion(String numBilhete); + public List obtenerHistoricoMovimetacion(Aidf aidf); + public List obtenerHistoricoMovimetacion(Aidf aidf, Date fecInicial, Date fecFinal); + public List obtenerTiposMovimetacion(); + + + public void realizaAdquisicionBilhetes(Aidf aidf); + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, TipoMovimentacion tipoMovimentacion); + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, Long cantidad, TipoMovimentacion tipoMovimentacion); + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion); + + public PuntoVenta buscarAgSuprimento(); + public PuntoVenta buscarAgContabilidade(); + + public List obtenerTiposMovimetacionPuntoVenta(); + public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String numSerie, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion); + + public List buscarSeriesBilhetesPorEstacion(Estacion estacion); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/NodoService.java b/src/com/rjconsultores/ventaboletos/service/NodoService.java new file mode 100644 index 000000000..663fbb269 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/NodoService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Nodo; + +/** + * + * @author Administrador + */ +public interface NodoService { + + public List obtenerTodos(); + + public Nodo obtenerId(Integer id); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/NotaCreditoVendaPacoteService.java b/src/com/rjconsultores/ventaboletos/service/NotaCreditoVendaPacoteService.java new file mode 100644 index 000000000..e9b877647 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/NotaCreditoVendaPacoteService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.vo.reembolsoocdnotacredito.ReembolsoOcdNotaCreditoVO; + +public interface NotaCreditoVendaPacoteService { + + List busquedaDatosReembolsoOcdNotaCreditoRS(Date fecInicial, Date fecFinal, + Date fecPagamentoInicial, Date fecPagamentoFinal, Boolean indPago); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/OCDParamService.java b/src/com/rjconsultores/ventaboletos/service/OCDParamService.java new file mode 100644 index 000000000..266bf8ae2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/OCDParamService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OCDParam; + +public interface OCDParamService extends GenericService { + + public OCDParam suscribirActualizar(OCDParam entidad); + public OCDParam buscaOCDParamPorEmpresa(Empresa empresa); + public List buscaOCDParams(Empresa empresa); +} diff --git a/src/com/rjconsultores/ventaboletos/service/OCDPtoVtaParamService.java b/src/com/rjconsultores/ventaboletos/service/OCDPtoVtaParamService.java new file mode 100644 index 000000000..f2c7b3a19 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/OCDPtoVtaParamService.java @@ -0,0 +1,22 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OCDPtoVtaParam; + +/** + * @author Thiago + * + */ +public interface OCDPtoVtaParamService extends GenericService { + + public List obtenerTodos(); + + public OCDPtoVtaParam obtenerID(Long id); + + public void borrar(OCDPtoVtaParam entidad); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/OCDService.java b/src/com/rjconsultores/ventaboletos/service/OCDService.java new file mode 100644 index 000000000..b5a04a1db --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/OCDService.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OCD; +import com.rjconsultores.ventaboletos.vo.reembolsoocdnotacredito.ReembolsoOcdNotaCreditoVO; + +public interface OCDService extends GenericService { + + List busquedaDatosReembolsoOcdNotaCreditoRS(Date fecInicial, Date fecFinal, + Date fecPagamentoInicial, Date fecPagamentoFinal, Boolean indPago); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/OperadorEmbarcadaService.java b/src/com/rjconsultores/ventaboletos/service/OperadorEmbarcadaService.java new file mode 100644 index 000000000..ec69bd74f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/OperadorEmbarcadaService.java @@ -0,0 +1,26 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcada; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcadaLinha; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcadaServico; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.corrida.CorridaVO; + +public interface OperadorEmbarcadaService { + + public OperadorEmbarcada suscribirActualizar(OperadorEmbarcada operador, List linhas, List listaServicos) throws BusinessException; + + public void apagar(OperadorEmbarcada operador) throws BusinessException; + + public OperadorEmbarcada buscarOperadorEmbarcadaPorUsuario(Integer idUsuario); + + public PuntoVentaVO getPuntoVentaVO(Integer operador); + + public List getListaCorridaVO(Integer operador, Empresa empresa, Date dtIni, Date dtFim, PuntoVenta puntoVenta); +} diff --git a/src/com/rjconsultores/ventaboletos/service/OrgaoCancelacionService.java b/src/com/rjconsultores/ventaboletos/service/OrgaoCancelacionService.java new file mode 100644 index 000000000..fbffde167 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/OrgaoCancelacionService.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoCancelacion; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +public interface OrgaoCancelacionService { + + public List buscarPorOrgao(OrgaoConcedente orgaoConcedente); + + public List obtenerTodos(); + + public OrgaoCancelacion obtenerID(Integer id); + + public void borrar(OrgaoCancelacion entidad); + + public OrgaoCancelacion suscribirActualizacion(OrgaoCancelacion entidad); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/OrgaoConcedenteService.java b/src/com/rjconsultores/ventaboletos/service/OrgaoConcedenteService.java new file mode 100644 index 000000000..89437f9b7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/OrgaoConcedenteService.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +public interface OrgaoConcedenteService { + + public List buscar(String desc); + + + public List obtenerTodos(); + + public List obtenerTodosExceto(Integer... id); + + public OrgaoConcedente obtenerID(Integer id); + + public OrgaoConcedente actualizacion(OrgaoConcedente entidad); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/OrgaoEmpParamService.java b/src/com/rjconsultores/ventaboletos/service/OrgaoEmpParamService.java new file mode 100644 index 000000000..746493723 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/OrgaoEmpParamService.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.OrgaoEmpParam; + +public interface OrgaoEmpParamService { + + public List obterPorOrgao(Integer orgaoConcedenteId); + + public List obterPorEmpresa(Integer empresaId); + + public OrgaoEmpParam obterPorOrgaoEmpresa(Integer orgaoConcedenteId, Integer empresaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/OrgaoTramoService.java b/src/com/rjconsultores/ventaboletos/service/OrgaoTramoService.java new file mode 100644 index 000000000..6fc963d54 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/OrgaoTramoService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + + +public interface OrgaoTramoService{ + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PacoteConvenioService.java b/src/com/rjconsultores/ventaboletos/service/PacoteConvenioService.java new file mode 100644 index 000000000..28bdf1258 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PacoteConvenioService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PacoteConvenio; + +public interface PacoteConvenioService extends GenericService { + + public List buscar(String nomconvenio); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PacoteDescontoBilheteService.java b/src/com/rjconsultores/ventaboletos/service/PacoteDescontoBilheteService.java new file mode 100644 index 000000000..c62a75e94 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PacoteDescontoBilheteService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PacoteDescontoBilhete; + +public interface PacoteDescontoBilheteService extends GenericService { + + public List obtenerTodos(Integer pacoteId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PacoteItemService.java b/src/com/rjconsultores/ventaboletos/service/PacoteItemService.java new file mode 100644 index 000000000..c3f0714fa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PacoteItemService.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteItem; + +public interface PacoteItemService extends GenericService { + + public PacoteItem vincularItemPacote(PacoteItem pacoteItem, Pacote pacote, ItemAdicional item); + + public PacoteItem buscaPacoteItem(Pacote pacote, ItemAdicional item); + + public List buscaItensPacote(Pacote pacote); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PacoteService.java b/src/com/rjconsultores/ventaboletos/service/PacoteService.java new file mode 100644 index 000000000..13cedaa70 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PacoteService.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +public interface PacoteService extends GenericService { + + public Boolean verificaCadastroTarifa(Pacote pacote, TipoTarifaPacote tarifa); + + public Boolean verificaCadastroItemAdicional(Pacote pacote, ItemAdicional item); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PacoteTarifaService.java b/src/com/rjconsultores/ventaboletos/service/PacoteTarifaService.java new file mode 100644 index 000000000..4ccfbd23c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PacoteTarifaService.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.service; + +import java.math.BigDecimal; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteTarifa; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +public interface PacoteTarifaService extends GenericService { + + public PacoteTarifa vincularPacoteTarifa(PacoteTarifa pacoteTarifa, Pacote pacote, TipoTarifaPacote tipoTarifaPacote, BigDecimal tarifa, Boolean indvendaweb, Categoria categoria); + + public PacoteTarifa buscaPacoteTarifa(Pacote pacote, TipoTarifaPacote tipoTarifaPacote); + + public List buscaTarifasPacote(Pacote pacote); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PaisService.java b/src/com/rjconsultores/ventaboletos/service/PaisService.java new file mode 100644 index 000000000..e1a25c29d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PaisService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Pais; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PaisService extends GenericService { + + public List buscar(String nombpais); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ParadaCodOrgaoConcedenteService.java b/src/com/rjconsultores/ventaboletos/service/ParadaCodOrgaoConcedenteService.java new file mode 100644 index 000000000..221f501de --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ParadaCodOrgaoConcedenteService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ParadaCodOrgaoConcedente; + +public interface ParadaCodOrgaoConcedenteService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ParadaEquivalenciaService.java b/src/com/rjconsultores/ventaboletos/service/ParadaEquivalenciaService.java new file mode 100644 index 000000000..3faddb60a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ParadaEquivalenciaService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaEquivalencia; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ParadaEquivalenciaService extends GenericService { + + public List buscar(Parada parada, ComisionistaExterno comisionistaExterno, String equivalencia); + + public List buscarEquivalencia(String equivalencia); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ParadaService.java b/src/com/rjconsultores/ventaboletos/service/ParadaService.java new file mode 100644 index 000000000..6f0b64a65 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ParadaService.java @@ -0,0 +1,46 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Nodo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.RegionMetropolitana; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TipoParada; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +/** + * + * @author Administrador + */ +public interface ParadaService { + + public Parada obtenerID(Integer id); + + public Parada suscribirActualizar(Parada entidad) throws BusinessException; + + public void borrar(Parada entidad) throws RegistroConDependenciaException; + + public List buscar(String descparada, String cveparada, Ciudad ciudad, + TipoParada tipoParada, Nodo nodo); + + public List buscarCVE(String cveparada); + + public List buscar(String descparada); + + public List buscaLike(String descparada); + + public List obtenerOrigenPorRuta(Ruta ruta); + + public List obtenerTodos(); + + public List obterPossiveisDestinos(Parada origem); + + public List buscaParadaRegionMetropolitana(RegionMetropolitana regionMetropolitana); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ParamAcumulaMasivoService.java b/src/com/rjconsultores/ventaboletos/service/ParamAcumulaMasivoService.java new file mode 100644 index 000000000..aa8707207 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ParamAcumulaMasivoService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaMasivo; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamAcumulaMasivoService extends GenericService { + + public List buscar(Empresa emp, Integer min, Integer max, Date fecIni, Date fecFim); + + public List buscar(ParamAcumulaMasivo paramAcumulaMasivo); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ParamAcumulaPuntoService.java b/src/com/rjconsultores/ventaboletos/service/ParamAcumulaPuntoService.java new file mode 100644 index 000000000..15c940a51 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ParamAcumulaPuntoService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaPunto; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamAcumulaPuntoService extends GenericService { + + public List buscar(Parada origem, Parada destino, Date ini, Date fim); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ParamArticuloService.java b/src/com/rjconsultores/ventaboletos/service/ParamArticuloService.java new file mode 100644 index 000000000..3fcc501c1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ParamArticuloService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ParamArticulo; + +public interface ParamArticuloService extends + GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ParamCanjePuntoService.java b/src/com/rjconsultores/ventaboletos/service/ParamCanjePuntoService.java new file mode 100644 index 000000000..ceb96f63b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ParamCanjePuntoService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamCanjePunto; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamCanjePuntoService extends GenericService { + + public List buscar(Parada origem, Parada destino, Date ini, Date fim); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ParamCompraPuntoService.java b/src/com/rjconsultores/ventaboletos/service/ParamCompraPuntoService.java new file mode 100644 index 000000000..60de1ac96 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ParamCompraPuntoService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ParamCompraPunto; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamCompraPuntoService extends GenericService { + + public List buscar(Date ini, Date fim); + + public List buscar(Date ini, Date fim, Integer cantPuntos, BigDecimal costoPunto); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ParamConexionService.java b/src/com/rjconsultores/ventaboletos/service/ParamConexionService.java new file mode 100644 index 000000000..fa8e16285 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ParamConexionService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ParamConexion; + +public interface ParamConexionService { + + public ParamConexion actualizacion(ParamConexion paramConexion); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ParamCostoTarjetaService.java b/src/com/rjconsultores/ventaboletos/service/ParamCostoTarjetaService.java new file mode 100644 index 000000000..89e7ef132 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ParamCostoTarjetaService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ParamCostoTarjeta; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ParamCostoTarjetaService extends GenericService { + + public List buscar(ParamCostoTarjeta paramCostoTarjeta); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ParamRecoleccionService.java b/src/com/rjconsultores/ventaboletos/service/ParamRecoleccionService.java new file mode 100644 index 000000000..22db5dfe9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ParamRecoleccionService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ParamRecoleccion; + +/** + * + * @author Desenvolvimento + */ +public interface ParamRecoleccionService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/PerfilFuncionService.java b/src/com/rjconsultores/ventaboletos/service/PerfilFuncionService.java new file mode 100644 index 000000000..3fc92b753 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PerfilFuncionService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PerfilFuncion; + +/** + * + * @author rodrigo + */ +public interface PerfilFuncionService extends GenericService { + + public boolean usuarioPossuiPermissaoFuncionalidade(Integer usuarioId, String descRuta); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PerfilService.java b/src/com/rjconsultores/ventaboletos/service/PerfilService.java new file mode 100644 index 000000000..e38060be8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PerfilService.java @@ -0,0 +1,33 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Perfil; + +/** + * + * @author rodrigo + */ +public interface PerfilService { + + public List obtenerTodos(); + + public Perfil obtenerID(Integer id); + + public Perfil suscribir(Perfil entidad); + + public Perfil actualizacion(Perfil entidad); + + public void borrar(Perfil entidad); + + public List buscar(String dscPerfil); + + public List buscaPerfilJerarquia(Perfil perfilUsuario); + + public Boolean clonarPerfil(Integer perfilId, String nomePerfil); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PeriodoVacacionalService.java b/src/com/rjconsultores/ventaboletos/service/PeriodoVacacionalService.java new file mode 100644 index 000000000..af0481d58 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PeriodoVacacionalService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PeriodoVacacional; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PeriodoVacacionalService extends GenericService { + + public List buscar(Date dataInicio, Date dataFim); + + public List buscarFechaTraslapa(PeriodoVacacional periodoVacacional); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PlazaService.java b/src/com/rjconsultores/ventaboletos/service/PlazaService.java new file mode 100644 index 000000000..4f72de132 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PlazaService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Plaza; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface PlazaService extends GenericService { + + public List buscar(String nombplaza); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PrecioFixoPedagioService.java b/src/com/rjconsultores/ventaboletos/service/PrecioFixoPedagioService.java new file mode 100644 index 000000000..da7e21e12 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PrecioFixoPedagioService.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PrecioFixoPedagio; + +/** + * + * @author Administrador + */ +public interface PrecioFixoPedagioService extends GenericService { + + public List buscarPorNome(String nomeClaseServicio); + + public List buscarTodosExceto(Integer ... idClase); + + public List buscarPorEmpresasDoUsuario (List empresasUsuario); + + public Boolean validarInclusaoPrecoFixo(PrecioFixoPedagio precoFixoPedagio); + + public List buscarPrecioFixoPedagio(PrecioFixoPedagio obj); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PrecioVentajaService.java b/src/com/rjconsultores/ventaboletos/service/PrecioVentajaService.java new file mode 100644 index 000000000..fc3ce15cb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PrecioVentajaService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PrecioVentaja; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +/** + * + * @author Igor + */ +public interface PrecioVentajaService { + + public PrecioVentaja suscribirActualizacion(PrecioVentaja entidad) throws BusinessException; + public void borrar(PrecioVentaja entidad) throws RegistroConDependenciaException; + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PrecoApanheService.java b/src/com/rjconsultores/ventaboletos/service/PrecoApanheService.java new file mode 100644 index 000000000..0c4a7be10 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PrecoApanheService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PrecoApanhe; + +public interface PrecoApanheService extends GenericService { + + public List buscar(String deschotel, String desccolonia, String nombciudad); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingAsientoService.java b/src/com/rjconsultores/ventaboletos/service/PricingAsientoService.java new file mode 100644 index 000000000..24c4040dc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingAsientoService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingAsiento; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingAsientoService extends GenericService { + + public List obtenerPricingCategoria(Pricing pricing, Integer value); + + public void borrar(List pricingAsientos); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingCategoriaService.java b/src/com/rjconsultores/ventaboletos/service/PricingCategoriaService.java new file mode 100644 index 000000000..dc87b04bb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingCategoriaService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCategoria; + +/** + * + * @author Rafius + */ +public interface PricingCategoriaService extends GenericService { + + public Boolean obtenerPricingCategoria(Pricing pricing, Categoria categoria); + + public void borrar(List pricingCategorias); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingClaseService.java b/src/com/rjconsultores/ventaboletos/service/PricingClaseService.java new file mode 100644 index 000000000..3eb6fed61 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingClaseService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingClase; + +/** + * + * @author Rafius + */ +public interface PricingClaseService extends GenericService { + + public Boolean obtenerPricingClase(Pricing pricing, ClaseServicio claseServicio); + + public void borrar(List pricingClases); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingClasseTarifariaService.java b/src/com/rjconsultores/ventaboletos/service/PricingClasseTarifariaService.java new file mode 100644 index 000000000..fac9b162f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingClasseTarifariaService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PricingClasseTarifaria; + +public interface PricingClasseTarifariaService extends GenericService { + + public Boolean validacionSigla(String sigla); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingCorridaService.java b/src/com/rjconsultores/ventaboletos/service/PricingCorridaService.java new file mode 100644 index 000000000..dac7f8a3b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingCorridaService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCorrida; + +/** + * + * @author Rafius + */ +public interface PricingCorridaService extends GenericService { + + public Boolean obtenerPricingCorrida(Pricing pricing, CorridaCtrl corrida); + + public void borrar(List pricingCorridas); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingCtrlService.java b/src/com/rjconsultores/ventaboletos/service/PricingCtrlService.java new file mode 100644 index 000000000..09215455c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingCtrlService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PricingCtrl; + +public interface PricingCtrlService extends GenericService { + + public PricingCtrl obtenerPricingCtrl(); + + public PricingCtrl suscribirOrActualizacion(PricingCtrl entidad); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingDiaService.java b/src/com/rjconsultores/ventaboletos/service/PricingDiaService.java new file mode 100644 index 000000000..e60c20fad --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingDiaService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PricingDia; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingDiaService extends GenericService { + + public List buscarTraslapa(PricingDia pricingDia); + + public void borrar(List pricingDias); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingEspecificoAgenciaService.java b/src/com/rjconsultores/ventaboletos/service/PricingEspecificoAgenciaService.java new file mode 100644 index 000000000..6e737bd14 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingEspecificoAgenciaService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoAgencia; + +public interface PricingEspecificoAgenciaService extends GenericService { + + Boolean existeAgenciaPricing(PricingEspecificoAgencia entidad); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingEspecificoCanalVendasService.java b/src/com/rjconsultores/ventaboletos/service/PricingEspecificoCanalVendasService.java new file mode 100644 index 000000000..246b58228 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingEspecificoCanalVendasService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCanalVendas; + +public interface PricingEspecificoCanalVendasService extends GenericService { + + Boolean existeCanalVendasPricing(PricingEspecificoCanalVendas entidad); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingEspecificoCategoriaService.java b/src/com/rjconsultores/ventaboletos/service/PricingEspecificoCategoriaService.java new file mode 100644 index 000000000..e4a464690 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingEspecificoCategoriaService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCategoria; + +public interface PricingEspecificoCategoriaService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingEspecificoOcupacionService.java b/src/com/rjconsultores/ventaboletos/service/PricingEspecificoOcupacionService.java new file mode 100644 index 000000000..0719cf6f1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingEspecificoOcupacionService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoOcupacion; + +public interface PricingEspecificoOcupacionService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingEspecificoService.java b/src/com/rjconsultores/ventaboletos/service/PricingEspecificoService.java new file mode 100644 index 000000000..cf5b3566f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingEspecificoService.java @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PricingEspecifico; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCategoria; + +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingEspecificoService extends GenericService { + + public List buscarPorNome(PricingEspecifico pricingEspecifico); + + public List buscarPorNome(String nome); + + public PricingEspecifico clonarPricing(Long id, String nome, List pricingCategoriaList); + + public List buscar(List empresas, List tipoClasses, List origens, List destinos, Date vigenciaInicial, Date vigenciaFinal); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingFormapagoService.java b/src/com/rjconsultores/ventaboletos/service/PricingFormapagoService.java new file mode 100644 index 000000000..8ae14d807 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingFormapagoService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PricingFormapago; + +public interface PricingFormapagoService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingImporteService.java b/src/com/rjconsultores/ventaboletos/service/PricingImporteService.java new file mode 100644 index 000000000..a675f621c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingImporteService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.PricingImporte; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingImporteService extends GenericService { + + public List buscarMoneda(PricingImporte pricingImporte, Moneda moneda); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingMarcaService.java b/src/com/rjconsultores/ventaboletos/service/PricingMarcaService.java new file mode 100644 index 000000000..f261320b9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingMarcaService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMarca; + +/** + * + * @author Rafius + */ +public interface PricingMarcaService extends GenericService { + + public Boolean obtenerPricingMarca(Pricing pricing, Marca marca); + + public void borrar(List pricingMarcaList); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingMercadoService.java b/src/com/rjconsultores/ventaboletos/service/PricingMercadoService.java new file mode 100644 index 000000000..6d2f06b8c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingMercadoService.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMercado; + +/** + * + * @author Rafius + */ +public interface PricingMercadoService extends GenericService { + + public Boolean obtenerPricingMercado(Pricing pricing, Parada origen, Parada destino); + + public void borrar(List pricingMercados); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingOcupaAntecipaService.java b/src/com/rjconsultores/ventaboletos/service/PricingOcupaAntecipaService.java new file mode 100644 index 000000000..c5cb9cf54 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingOcupaAntecipaService.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface PricingOcupaAntecipaService { + + public PricingOcupaAntecipa suscribir(PricingOcupaAntecipa entidad) throws BusinessException; + + public PricingOcupaAntecipa actualizacion(PricingOcupaAntecipa entidad) throws BusinessException; + + public void borrar(PricingOcupaAntecipa entidad); + + public List updateList(PricingOcupaAntecipa entidad); + + public void borrar(List pricingOcupaAntecipas); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingPuntoVentaService.java b/src/com/rjconsultores/ventaboletos/service/PricingPuntoVentaService.java new file mode 100644 index 000000000..18235ae48 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingPuntoVentaService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +/** + * + * @author Rafius + */ +public interface PricingPuntoVentaService extends GenericService { + + public Boolean obtenerPricingPuntoVenta(Pricing pricing, PuntoVenta puntoVenta); + + public void borrar(List pricingPuntoVentas); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingRutaService.java b/src/com/rjconsultores/ventaboletos/service/PricingRutaService.java new file mode 100644 index 000000000..7ae511e2e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingRutaService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingRuta; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +/** + * + * @author Rafius + */ +public interface PricingRutaService extends GenericService { + + public Boolean obtenerPricingRuta(Pricing pricing, Ruta ruta); + + public void borrar(List pricingRutas); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingService.java b/src/com/rjconsultores/ventaboletos/service/PricingService.java new file mode 100644 index 000000000..9d013b96a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingService.java @@ -0,0 +1,43 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Pricing; + +/** + * + * @author Rafius + */ +public interface PricingService extends GenericService { + + public void borrarFisico(Pricing pricing); + + public List buscar(String nombPricing, Empresa empresa, + Short cantboleto, Integer cantdiasanticipacion, + BigDecimal descuentoporcentaje, BigDecimal descuentoporcredondo); + + public List buscarPorNombre(String nombPricing); + + public void inativar(Pricing entidad); + + public void ativar(Pricing entidad); + + public Boolean clonarPricing(Integer pricingId, String nomePricing, boolean incluirPadraoPricingTipoPassagemPET); + + public List buscar(Integer pricingId, String nomepricing, Integer empresaId, Date dataViagemInicio, + Date dataViagemFim, Integer origemId, Integer destinoId); + + /** + * Exclui pricings que possuem viagens com dias finalizadas iguais ou acima do informados. + * @param diasFimViagem + */ + public void excluirPricing(Integer diasFimViagem); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingTipoPtoVtaService.java b/src/com/rjconsultores/ventaboletos/service/PricingTipoPtoVtaService.java new file mode 100644 index 000000000..afd63e5e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingTipoPtoVtaService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; + +/** + * + * @author Rafius + */ +public interface PricingTipoPtoVtaService extends GenericService { + + public Boolean obtenerPricingTipoPuntoVenta(Pricing pricing, TipoPuntoVenta tipoPuntoVenta); + + public void borrar(List pricingTipoPtoVtas); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingTipoServicioService.java b/src/com/rjconsultores/ventaboletos/service/PricingTipoServicioService.java new file mode 100644 index 000000000..5ea65ecf4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingTipoServicioService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; +import com.rjconsultores.ventaboletos.entidad.TipoServicio; + +/** + * + * @author Desenvolvimento + */ +public interface PricingTipoServicioService extends GenericService { + + public Boolean obtenerPricingTipoServicio(Pricing pricing, TipoServicio tipoServicio); + + public void borrar(List pricingTipoServicios); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PricingVigenciaService.java b/src/com/rjconsultores/ventaboletos/service/PricingVigenciaService.java new file mode 100644 index 000000000..5219608c3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PricingVigenciaService.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingVigencia; +import java.util.Date; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface PricingVigenciaService extends GenericService { + + public List buscarPorVigencias(PricingVigencia pv); + + public Boolean podeSalvar(Pricing pricing, PricingVigencia pricingVigencia, + Date inicio, Date fim); + + public void borrar(List pricingVigenciaList); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ProdClaseServicioService.java b/src/com/rjconsultores/ventaboletos/service/ProdClaseServicioService.java new file mode 100644 index 000000000..56d03df84 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ProdClaseServicioService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdClaseServicio; + +/** + * + * @author Rafius + */ +public interface ProdClaseServicioService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/ProdFormaPagoService.java b/src/com/rjconsultores/ventaboletos/service/ProdFormaPagoService.java new file mode 100644 index 000000000..4db91a45f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ProdFormaPagoService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdFormaPago; + +/** + * + * @author Rafius + */ +public interface ProdFormaPagoService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/ProdMarcaService.java b/src/com/rjconsultores/ventaboletos/service/ProdMarcaService.java new file mode 100644 index 000000000..1f7f176ef --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ProdMarcaService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdMarca; +import com.rjconsultores.ventaboletos.entidad.ProdPrecio; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ProdMarcaService extends GenericService { + + public ProdMarca actualizacion(ProdMarca entidad,List listPrecios); + public ProdMarca suscribir(ProdMarca entidad,List listPrecios); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ProdMercadoService.java b/src/com/rjconsultores/ventaboletos/service/ProdMercadoService.java new file mode 100644 index 000000000..39bc9024c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ProdMercadoService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdMercado; + +/** + * + * @author Rafius + */ +public interface ProdMercadoService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/ProdPrecioService.java b/src/com/rjconsultores/ventaboletos/service/ProdPrecioService.java new file mode 100644 index 000000000..b3c7b12c6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ProdPrecioService.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.ProdPrecio; +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ProdPrecioService extends GenericService { + + /** + * Hace una busqueda en los prodPrecio que estan ativos y con los filtros indicados + * @param marca + * @param productoservicio + * @return + */ + public List buscar(Marca marca, ProductoServicio productoservicio); + + public void borrar(Marca marca); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ProdPuntoVentaService.java b/src/com/rjconsultores/ventaboletos/service/ProdPuntoVentaService.java new file mode 100644 index 000000000..d3652cd6a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ProdPuntoVentaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdPuntoVenta; + +/** + * + * @author Rafius + */ +public interface ProdPuntoVentaService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/ProdRutaService.java b/src/com/rjconsultores/ventaboletos/service/ProdRutaService.java new file mode 100644 index 000000000..a3fa379e0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ProdRutaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdRuta; + +/** + * + * @author Rafius + */ +public interface ProdRutaService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/ProdTipoptovtaService.java b/src/com/rjconsultores/ventaboletos/service/ProdTipoptovtaService.java new file mode 100644 index 000000000..cd130e42b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ProdTipoptovtaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdTipoptovta; + +/** + * + * @author Rafius + */ +public interface ProdTipoptovtaService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/ProdVigenciaService.java b/src/com/rjconsultores/ventaboletos/service/ProdVigenciaService.java new file mode 100644 index 000000000..d82572df6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ProdVigenciaService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProdVigencia; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ProdVigenciaService extends GenericService { + + public List buscarTraslapa(ProdVigencia prodVigencia); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ProductoServicioService.java b/src/com/rjconsultores/ventaboletos/service/ProductoServicioService.java new file mode 100644 index 000000000..5f41a0649 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ProductoServicioService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface ProductoServicioService extends GenericService { + + public void borrarFisico(ProductoServicio productoServicio); + + public List obtener(ProductoServicio ps); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PtoVtaCheckinService.java b/src/com/rjconsultores/ventaboletos/service/PtoVtaCheckinService.java new file mode 100644 index 000000000..cb98362a9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtoVtaCheckinService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtoVtaCheckin; + +public interface PtoVtaCheckinService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PtoVtaSeguroService.java b/src/com/rjconsultores/ventaboletos/service/PtoVtaSeguroService.java new file mode 100644 index 000000000..4e8ca10b1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtoVtaSeguroService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro; + +public interface PtoVtaSeguroService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PtoVtaUsuarioBancarioService.java b/src/com/rjconsultores/ventaboletos/service/PtoVtaUsuarioBancarioService.java new file mode 100644 index 000000000..9ddfbc912 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtoVtaUsuarioBancarioService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtoVtaUsuarioBancario; + +/** + * + * @author Desenvolvimento + */ +public interface PtoVtaUsuarioBancarioService extends GenericService { + + public void borrarFisico(PtoVtaUsuarioBancario pto2); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaAgenciaService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaAgenciaService.java new file mode 100644 index 000000000..377bf3e9a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaAgenciaService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaAgencia; + + +public interface PtovtaAgenciaService extends GenericService { + + public List buscar(String numagencia); + public void borrarFisico(PtovtaAgencia pto); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaAntecipacomissaoService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaAntecipacomissaoService.java new file mode 100644 index 000000000..0b4efdce6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaAntecipacomissaoService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + + +import com.rjconsultores.ventaboletos.entidad.PtovtaAntecipacomissao; + + +public interface PtovtaAntecipacomissaoService extends GenericService { + + public List buscar(int id); + +} + diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaAntifraudeService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaAntifraudeService.java new file mode 100644 index 000000000..0b2791177 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaAntifraudeService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtovtaAntifraude; + +public interface PtovtaAntifraudeService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaCatIndService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaCatIndService.java new file mode 100644 index 000000000..d551073ae --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaCatIndService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd; + +public interface PtovtaCatIndService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaComissaoService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaComissaoService.java new file mode 100644 index 000000000..de60377b8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaComissaoService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaComissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface PtovtaComissaoService extends GenericService { + + public List buscar(int id); + + public List buscarByPuntaVenta(PuntoVenta puntaVenta); + + public PtovtaComissao buscarPuntaVentaEmpresa(Integer puntaVentaId, Integer empresaId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaContaMDService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaContaMDService.java new file mode 100644 index 000000000..8815c61e8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaContaMDService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtovtaContaMD; + +public interface PtovtaContaMDService extends GenericService { + + public boolean contemItem(PtovtaContaMD ptovtaContaMD); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaDiversosService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaDiversosService.java new file mode 100644 index 000000000..4dc686add --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaDiversosService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaDiversos; + + + + + +public interface PtovtaDiversosService extends GenericService { + + public List buscar(int id); + +} + diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaBloqueadaService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaBloqueadaService.java new file mode 100644 index 000000000..945006a3d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaBloqueadaService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaBloqueada; + +public interface PtovtaEmpresaBloqueadaService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaContaBancariaService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaContaBancariaService.java new file mode 100644 index 000000000..79dc131ce --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaContaBancariaService.java @@ -0,0 +1,15 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaContaBancaria; + +/** + * + * @author Desenvolvimento + */ +public interface PtovtaEmpresaContaBancariaService extends GenericService { + public void borrarFisico(PtovtaEmpresaContaBancaria pto); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaService.java new file mode 100644 index 000000000..f43857c89 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaEmpresaService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface PtovtaEmpresaService extends GenericService { + + public List buscar(PtovtaEmpresa ptovtaEmpresa); + + public void borrarFisico(PtovtaEmpresa pto); +} diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaEstoqueService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaEstoqueService.java new file mode 100644 index 000000000..0a616f9cd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaEstoqueService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaEstoque; + + + + + +public interface PtovtaEstoqueService extends GenericService { + + public List buscar(int id); + +} + diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaHorarioService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaHorarioService.java new file mode 100644 index 000000000..661de0d7c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaHorarioService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaHorario; + + + + + +public interface PtovtaHorarioService extends GenericService { + + public List buscar(int id); + +} + diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaTitularService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaTitularService.java new file mode 100644 index 000000000..2d4e71a94 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaTitularService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PtovtaTitular; + + +public interface PtovtaTitularService extends GenericService { + + public List buscar(int id); + +} + diff --git a/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java b/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java new file mode 100644 index 000000000..937c5695a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java @@ -0,0 +1,51 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.IntegracionException; +import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; + +/** + * + * @author Administrador + */ +public interface PuntoVentaService { + + public List obtenerTodos(); + + public PuntoVenta obtenerID(Integer id); + + public PuntoVenta suscribir(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException; + + public PuntoVenta actualizacion(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException; + + public void borrar(PuntoVenta entidad)throws BusinessException; + + public List buscaLike(String strEstacion, boolean sinTodos); + + public List buscar(String nomPuntoVenta, String numPuntoVenta); + + public List buscaPuntoVenta(String numPuntoVenta); + + public List buscaPuntoVentaParada(Parada parada); + + public List buscarPuntoVentaSubordinados(PuntoVenta puntoVenta); + + public List buscarPuntosVentaMovimentacionBilhetes(List empresas); + + public List buscarPuntosVentaPorUsuario(Usuario usuario); + + public List buscaPuntoVentaEmpresaSemECF(Empresa empresa); + + List buscarPuntoVentaPtoVtaComissao(List empresas); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ReceitaDespesaService.java b/src/com/rjconsultores/ventaboletos/service/ReceitaDespesaService.java new file mode 100644 index 000000000..dce8f2969 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ReceitaDespesaService.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.relatorios.receitaDespesa.RelatorioFinanceiroReceitasDespesasBean; + +public interface ReceitaDespesaService { + + public List getRelatorioDetalhado(Map parametros) throws BusinessException; + + public List getRelatorioSintetico(Map parametros) throws BusinessException; + + public List getRelatorioAgencia(Map parametros) throws BusinessException; + + public List getRelatorioEvento(Map parametros) throws BusinessException; + +} diff --git a/src/com/rjconsultores/ventaboletos/service/RedondeoCtrlService.java b/src/com/rjconsultores/ventaboletos/service/RedondeoCtrlService.java new file mode 100644 index 000000000..57fcea718 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RedondeoCtrlService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.RedondeoCtrl; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface RedondeoCtrlService extends GenericService { + + public List buscar(RedondeoCtrl redondeoCtrl); + + public List buscarTraslapa(Short[] iDMarcas, BigDecimal valorinicial, BigDecimal valorfinal, Boolean indaplicadescuento, + Boolean indaplicapricing, Boolean indaplicaAtersp); +} diff --git a/src/com/rjconsultores/ventaboletos/service/RedondeoMarcaService.java b/src/com/rjconsultores/ventaboletos/service/RedondeoMarcaService.java new file mode 100644 index 000000000..d51a037a3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RedondeoMarcaService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.RedondeoMarca; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface RedondeoMarcaService extends GenericService { + + public List buscar(Marca marca); + + public List obtenerTodasMarcas(Short[] iDMarcas); +} diff --git a/src/com/rjconsultores/ventaboletos/service/RedondeoService.java b/src/com/rjconsultores/ventaboletos/service/RedondeoService.java new file mode 100644 index 000000000..fe24eeebb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RedondeoService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Redondeo; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface RedondeoService extends GenericService { + + public List buscar(BigDecimal valorInicial, BigDecimal valorFinal, + BigDecimal valorRedondeo); + + public List buscarVlrIniVlrFin(BigDecimal valorinicial, BigDecimal valorfinal); +} diff --git a/src/com/rjconsultores/ventaboletos/service/RegionMetropolitanaService.java b/src/com/rjconsultores/ventaboletos/service/RegionMetropolitanaService.java new file mode 100644 index 000000000..a73671c6c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RegionMetropolitanaService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.RegionMetropolitana; + +public interface RegionMetropolitanaService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/RelatorioAgepanService.java b/src/com/rjconsultores/ventaboletos/service/RelatorioAgepanService.java new file mode 100644 index 000000000..dd9d8ab56 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RelatorioAgepanService.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.service; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.OrgaoConcedente.RelatorioGratuidadeAgepanVO; + +public interface RelatorioAgepanService { + + public List listar(Map parametros) throws BusinessException; + + public InputStream gerarArquivoGratuidadeAgepan(Map parametros) throws IOException, BusinessException; + +} diff --git a/src/com/rjconsultores/ventaboletos/service/RequisicionBoletoService.java b/src/com/rjconsultores/ventaboletos/service/RequisicionBoletoService.java new file mode 100644 index 000000000..8094f85ca --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RequisicionBoletoService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.RequisicionBoleto; + +public interface RequisicionBoletoService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ReservaEspecialClienteService.java b/src/com/rjconsultores/ventaboletos/service/ReservaEspecialClienteService.java new file mode 100644 index 000000000..cd578c1b8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ReservaEspecialClienteService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ReservaEspecialCliente; + +public interface ReservaEspecialClienteService extends GenericService { + + public List bucarReservaEspecialByClienteId(Long clienteId) ; + + public List bucarReservaEspecialByCorridaId(Long corridaId) ; + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ReservacionCategoriaService.java b/src/com/rjconsultores/ventaboletos/service/ReservacionCategoriaService.java new file mode 100644 index 000000000..b0ca3150d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ReservacionCategoriaService.java @@ -0,0 +1,15 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ReservacionCategoria; + +/** + * + * @author Administrador + */ +public interface ReservacionCategoriaService + extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/ReservacionClaseService.java b/src/com/rjconsultores/ventaboletos/service/ReservacionClaseService.java new file mode 100644 index 000000000..e2706a5c3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ReservacionClaseService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ReservacionClase; + +/** + * + * @author Administrador + */ +public interface ReservacionClaseService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/ReservacionCtrlService.java b/src/com/rjconsultores/ventaboletos/service/ReservacionCtrlService.java new file mode 100644 index 000000000..0afb7d90c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ReservacionCtrlService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ReservacionCtrl; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface ReservacionCtrlService extends GenericService { + + public List buscar(ReservacionCtrl reservacionCtrl); + + public List buscarFechaTraslapa(ReservacionCtrl reservacionCtrl); +} diff --git a/src/com/rjconsultores/ventaboletos/service/ReservacionMarcaService.java b/src/com/rjconsultores/ventaboletos/service/ReservacionMarcaService.java new file mode 100644 index 000000000..d9b71dbe1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ReservacionMarcaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ReservacionMarca; + +/** + * + * @author Administrador + */ +public interface ReservacionMarcaService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/ReservacionMercadoService.java b/src/com/rjconsultores/ventaboletos/service/ReservacionMercadoService.java new file mode 100644 index 000000000..435364b4c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ReservacionMercadoService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ReservacionMercado; + +/** + * + * @author Administrador + */ +public interface ReservacionMercadoService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/ReservacionPuntoVentaService.java b/src/com/rjconsultores/ventaboletos/service/ReservacionPuntoVentaService.java new file mode 100644 index 000000000..687502d38 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ReservacionPuntoVentaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ReservacionPuntoVenta; + +/** + * + * @author Rafius + */ +public interface ReservacionPuntoVentaService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/RestriccionPagoService.java b/src/com/rjconsultores/ventaboletos/service/RestriccionPagoService.java new file mode 100644 index 000000000..0c598ba11 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RestriccionPagoService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; + +/** + * + * @author Administrador + */ +public interface RestriccionPagoService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/RhPagoConductorService.java b/src/com/rjconsultores/ventaboletos/service/RhPagoConductorService.java new file mode 100644 index 000000000..b0b0d377c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RhPagoConductorService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.RhPagoConductor; + +/** + * + * @author Desenvolvimento + */ +public interface RhPagoConductorService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/RolOperativoService.java b/src/com/rjconsultores/ventaboletos/service/RolOperativoService.java new file mode 100644 index 000000000..2dd990e41 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RolOperativoService.java @@ -0,0 +1,32 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +/** + * + * @author Rafius + */ +public interface RolOperativoService { + + public List obtenerTodos(); + + public RolOperativo obtenerID(Integer id); + + public RolOperativo suscribir(RolOperativo entidad); + + public RolOperativo actualizacion(RolOperativo entidad); + + public void borrar(RolOperativo entidad) throws RegistroConDependenciaException; + + public List pesquisar(DiagramaAutobus diagrama, String rol); + + public List buscar(String descroloperativo); +} diff --git a/src/com/rjconsultores/ventaboletos/service/RutaCasetaService.java b/src/com/rjconsultores/ventaboletos/service/RutaCasetaService.java new file mode 100644 index 000000000..214b689c6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RutaCasetaService.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.service; + + +import com.rjconsultores.ventaboletos.entidad.RutaCaseta; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface RutaCasetaService { + + public RutaCaseta suscribir(RutaCaseta entidad) throws BusinessException; + public void deletarRutaCasetasFromRutaSecuenciaId(Integer id)throws BusinessException; + +} + + + + + + + diff --git a/src/com/rjconsultores/ventaboletos/service/RutaCombinacionService.java b/src/com/rjconsultores/ventaboletos/service/RutaCombinacionService.java new file mode 100644 index 000000000..99335d0fe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RutaCombinacionService.java @@ -0,0 +1,80 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +import org.apache.poi.hssf.usermodel.HSSFWorkbook; + +/** + * + * @author Rafius + */ +public interface RutaCombinacionService extends GenericService { + + public void ativar(RutaCombinacion rcExiste); + + public boolean busquedaRutaTramo(Ruta ruta, Tramo trBuscaOrigemDestino, Boolean b); + + public RutaCombinacion busquedaTramoRutaTramo(Ruta ruta, Tramo trBuscaOrigemDestino); + + public RutaCombinacion busquedaTramoRutaOrigemDestino(Ruta ruta, Parada origem, Parada destino); + + public RutaCombinacion busquedaTramoRutaOrigemDestino(Integer rutaId, Integer origemId, Integer destinoId); + + /** + * Regreso el tramo de la entidade RutaCobinacion donde el tramo tines el origen-destino igual y la Rua sea la misma de RutaCombinacion + * + * @param ruta + * @param origen + * @param destino + * @return + */ + public Tramo busqueda(Ruta ruta, Parada origen, Parada destino); + + public List obtenerPorRuta(Ruta ruta); + + public boolean buscarRutaCombinacionExisteTramo(Tramo tramo); + + public int borrarCombinaciones(Ruta ruta); + + public void activar(Ruta ruta, Tramo trBuscaOrigemDestino); + + public List pesquisaTarifaObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvCategoria, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa, List lsAddRmvOrgaoConcedente); + + public List pesquisaTarifaEmbObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvCategoria, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa, List lsAddRmvOrgaoConcedente); + + public HSSFWorkbook gerarTarifaEscala(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvCategoria, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa); + + public HSSFWorkbook gerarTarifaOficialEscala(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, ArrayList arrayList, List lsAddRmvEmpresas, List lsAddRmvRutas, ArrayList arrayList0, List lsAddRmvVigenciaTarifa); + + public List pesquisaTarifaOficialObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, ArrayList arrayList, List lsAddRmvEmpresas, List lsAddRmvRutas, ArrayList arrayList0, List lsAddRmvVigenciaTarifa); + + /** + * Indica se existe alguma combinação ativa com o tramo informado + * @param tramo + * @return + */ + public boolean existeTramo(Tramo tramo); + + public boolean isRutaCombinacionVenda(Integer rutaId, Integer origenId, Integer destinoId); + + Set rutasCombinacionVenda(List rutas); +} diff --git a/src/com/rjconsultores/ventaboletos/service/RutaEmbarqueDesembarqueService.java b/src/com/rjconsultores/ventaboletos/service/RutaEmbarqueDesembarqueService.java new file mode 100644 index 000000000..38efc2b3f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RutaEmbarqueDesembarqueService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaEmbarqueDesembarque; + +public interface RutaEmbarqueDesembarqueService extends GenericService { + + List obtenerPorRuta(Ruta ruta); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/RutaEmpresaService.java b/src/com/rjconsultores/ventaboletos/service/RutaEmpresaService.java new file mode 100644 index 000000000..779b704f0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RutaEmpresaService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; + +/** + * + * @author Administrador + */ +public interface RutaEmpresaService extends GenericService { + + public List obtenerPorEmpresa(Empresa empresa); + + public List obtenerPorRuta(Ruta ruta); +} diff --git a/src/com/rjconsultores/ventaboletos/service/RutaIcmsExcepcionService.java b/src/com/rjconsultores/ventaboletos/service/RutaIcmsExcepcionService.java new file mode 100644 index 000000000..5c22404b2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RutaIcmsExcepcionService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.RutaIcmsExcepcion; + +public interface RutaIcmsExcepcionService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/RutaSecuenciaService.java b/src/com/rjconsultores/ventaboletos/service/RutaSecuenciaService.java new file mode 100644 index 000000000..2a4b64daf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RutaSecuenciaService.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface RutaSecuenciaService extends GenericService { + + public List buscarSecuenciaOrdenado(Ruta ruta); + + public int borrarSecuencias(Ruta ruta); + + /** + * Devolver los números de secuencia de ruta en la raza, el origen y el destino. + * + * @param esquemaCorrida + * @param origem + * @param destino + * @return secuencia de pares -> 3, 6 + */ + List obtenerNumRutaSecuenciaPorCorridaOrigemDestino(EsquemaCorrida esquemaCorrida, Parada origem, Parada destino); + + List obtenerNumRutaSecuenciaPorCorridaOrigemDestinoId(EsquemaCorrida esquemaCorrida, Integer origem, Integer destino); + + /** + * Devolver los números de secuencia ocupada de ruta en la raza, el origen y el destino. + * + * @param esquemaCorrida + * @param asiento + * @return todas las secuencias ocupados ordenadas -> 3, 4, 5, 7 + */ + List obtenerNumRutaSecuenciaOcupadaPorCorridaAsiento(EsquemaCorrida esquemaCorrida, String asiento); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/RutaService.java b/src/com/rjconsultores/ventaboletos/service/RutaService.java new file mode 100644 index 000000000..3be36fad0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/RutaService.java @@ -0,0 +1,121 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia; +import com.rjconsultores.ventaboletos.entidad.ParadaSecuenciaCombinacaoLinha; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.vo.ruta.RutaVO; + +/** + * + * @author Rafius + */ +public interface RutaService { + + /** + * Regresa el destino de la ruta + * + * @param ruta + * @return + */ + public Parada getDestino(Ruta ruta); + + /** + * Regresa la origen de la ruta + * + * @param ruta + * @return + */ + public Parada getOrigem(Ruta ruta); + + public List buscarPorClaseServicio(ClaseServicio claseServicio); + + public List buscarPorClaseServicioEmpresa(ClaseServicio claseServicio, Empresa empresa); + + public List buscar(String nomeRuta, ClaseServicio claseServicio, Boolean nomeObrigatorio); + + public List obtenerPorEmpresa(Empresa empresa); + + public List buscarTodosExceto(Integer... idRuta); + + public List buscarNumRuta(String numRuta); + + public void borrar(Ruta entidad) throws RegistroConDependenciaException; + + /** + * Verifica se la parada informadad existe en la ruta informada + * + * @param parada + * @param ruta + * @return + */ + public boolean paradaExisteEnLaRuta(Parada parada, Ruta ruta); + + /** + * Hace la actualización de la ruta. + * + * Si el parametro lsParadasSequencia no es null, quieres decir que hube cambio en la secuencia y la nueva secuencia es la que esta en lsParadasSequencia.
+ * + * Si el parametro lsParadasSequencia es null, no va a cambiar ni la secuencia ni las combinaciones
+ * + * @param ruta + * @param lsParadasSequencia + * @return + * @throws BusinessException + */ + public Ruta actualizacion(Ruta ruta, List lsParadasSequencia) throws BusinessException; + + public List obtenerTodos(); + + public Ruta obtenerID(Integer id); + + public Ruta suscribir(Ruta entidad, List lsParadasSequencia) throws BusinessException; + + public void generarCombinacion(Ruta ruta) throws BusinessException; + + public List buscaRutaPorNumeroSemDadoRepetido(String palavraPesquisaRuta); + + public List buscaRuta(String palavraPesquisaRuta); + + public List buscaRuta(String palavraPesquisaRuta, OrgaoConcedente orgao); + + public List buscaRutasFromOrgao(OrgaoConcedente orgao); + public List buscaSomenteRutasFromOrgao(OrgaoConcedente orgao); + + public List buscarTodosEstos(Integer[] idRutas); + + public List buscarRutasPorEmpresas(List lsEmp); + + public Integer getNumSecuenciaOrigen(Integer rutaId, Integer origenId); + public Integer getNumSecuenciaDestino(Integer rutaId, Integer destinoId); + + /** + * Método verifica na listagem de sequencias quais precisam ser geradas + * @author Eduardo Dicarte + * @param ruta Ruta Ruta + * @param lsParadasSequencia Sequencias + * @param sequenciasInformadas Novas sequencias que foram inseridas pelo usuário + * @return Retorna a coleção de sequencias que precisam ser geradas + */ + public List verificarSeqRutaNaoGerada(Ruta ruta, List lsParadasSequencia); + + public List buscarRutasPorEmpresaOrgaoConcedente(Empresa empresa, OrgaoConcedente orgao); + + public boolean cambiarParadaRuta(Ruta ruta, Parada paradaAntiga, Parada nuevaParada, String descripcionParada) throws Exception; + + public Parada validaParada(String descripcionParada, Parada paradaAntiga) throws Exception; + + public List buscaLikeComboBox(String stringConsulta); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/SapService.java b/src/com/rjconsultores/ventaboletos/service/SapService.java new file mode 100644 index 000000000..7a00c7397 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/SapService.java @@ -0,0 +1,18 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente; +import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO; + +public interface SapService extends GenericService { + + public int remessa(List fechamentos) throws Exception ; + + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar); + + public void integracaoSapAutomatica() throws Exception; + +} diff --git a/src/com/rjconsultores/ventaboletos/service/SecretariaEmpresaService.java b/src/com/rjconsultores/ventaboletos/service/SecretariaEmpresaService.java new file mode 100644 index 000000000..6aa30a103 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/SecretariaEmpresaService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import com.rjconsultores.ventaboletos.entidad.SecretariaEmpresa; + +public interface SecretariaEmpresaService extends GenericService { + + public List buscarPorSecretaria(Secretaria secretaria); +} diff --git a/src/com/rjconsultores/ventaboletos/service/SecretariaService.java b/src/com/rjconsultores/ventaboletos/service/SecretariaService.java new file mode 100644 index 000000000..35b17db0e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/SecretariaService.java @@ -0,0 +1,24 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Secretaria; + +/** + * + * @author Administrador + */ +public interface SecretariaService extends GenericService { + + public List buscar(String descsecretaria, String cvesecretaria); + + public List buscar(String descsecretaria); + + public Secretaria buscarSecretariaVoucherRod(Short formaPagoId); + + public List buscaLike(String descsecretaria); +} diff --git a/src/com/rjconsultores/ventaboletos/service/SegVKMService.java b/src/com/rjconsultores/ventaboletos/service/SegVKMService.java new file mode 100644 index 000000000..0a64eaf37 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/SegVKMService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.math.BigDecimal; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.SegVKM; + +/** + * + * @author RJ + */ +public interface SegVKMService extends GenericService { + + public List buscar(String serie); + + public String seriePorEmpresa(Integer empresaId); + + public BigDecimal buscarSeguroPorKm(Long km, String serie, Integer orgaoConcedenteId); +} diff --git a/src/com/rjconsultores/ventaboletos/service/SeguradoraEmpresaService.java b/src/com/rjconsultores/ventaboletos/service/SeguradoraEmpresaService.java new file mode 100644 index 000000000..123e47d46 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/SeguradoraEmpresaService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa; + +public interface SeguradoraEmpresaService extends GenericService{ + public boolean existe(Empresa empresa, String serie); + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/SeguroKmService.java b/src/com/rjconsultores/ventaboletos/service/SeguroKmService.java new file mode 100644 index 000000000..fa339fa61 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/SeguroKmService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroKm; +import java.util.List; + + +public interface SeguroKmService extends GenericService{ + + public List buscarPorOrgao(OrgaoConcedente orgao); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/SeguroTarifaService.java b/src/com/rjconsultores/ventaboletos/service/SeguroTarifaService.java new file mode 100644 index 000000000..b9f4ca203 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/SeguroTarifaService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroTarifa; +import java.util.List; + + +public interface SeguroTarifaService extends GenericService{ + + public List buscarPorOrgao(OrgaoConcedente orgao); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/SisdapService.java b/src/com/rjconsultores/ventaboletos/service/SisdapService.java new file mode 100644 index 000000000..9224fa70b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/SisdapService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +public interface SisdapService { + + public List getMovimentoLinhas(Date fecInicio, Date fecFinal, Integer empresaId); + + public List getMovimentoSecoes(Date fecInicio, Date fecFinal, Integer empresaId, List pesquisaGratuidade, List pesquisaDescontoIdoso, List pesquisaGratuidadeIdoso, List pesquisaDescontoJovem, List pesquisaGratuidadeJovem); +} diff --git a/src/com/rjconsultores/ventaboletos/service/SistemaService.java b/src/com/rjconsultores/ventaboletos/service/SistemaService.java new file mode 100644 index 000000000..14f1fa372 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/SistemaService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Sistema; + +/** + * + * @author rodrigo + */ +public interface SistemaService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaCategoriaService.java b/src/com/rjconsultores/ventaboletos/service/TarifaCategoriaService.java new file mode 100644 index 000000000..94f2f2350 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TarifaCategoriaService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.TarifaCategoria; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface TarifaCategoriaService extends GenericService { + + public List buscar(Categoria categoria); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaEmbarcadaHistService.java b/src/com/rjconsultores/ventaboletos/service/TarifaEmbarcadaHistService.java new file mode 100644 index 000000000..1abac6543 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TarifaEmbarcadaHistService.java @@ -0,0 +1,10 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TarifaEmbarcadaHist; + +public interface TarifaEmbarcadaHistService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaEmbarcadaService.java b/src/com/rjconsultores/ventaboletos/service/TarifaEmbarcadaService.java new file mode 100644 index 000000000..4fd49f496 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TarifaEmbarcadaService.java @@ -0,0 +1,31 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.entidad.TarifaEmbarcada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public interface TarifaEmbarcadaService extends GenericService { + + public void excluirTodasTarifas(Moneda moneda, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Parada origem, + Parada destino, Ruta ruta, Via via, Boolean vende); + + public TarifaEmbarcada buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio,VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta); + + public Boolean podeAlterarTarifaMinima(TarifaEmbarcada tarifa, Marca marca, Parada origem,Parada destino, ClaseServicio claseServicio, Plaza plaza, Moneda moneda); + + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException; +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaHistService.java b/src/com/rjconsultores/ventaboletos/service/TarifaHistService.java new file mode 100644 index 000000000..d3bae2964 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TarifaHistService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TarifaHist; + +/** + * + * @author rodrigo + */ +public interface TarifaHistService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaKmService.java b/src/com/rjconsultores/ventaboletos/service/TarifaKmService.java new file mode 100644 index 000000000..52bedf423 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TarifaKmService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TarifaKm; + +public interface TarifaKmService extends GenericService{ + + public List buscarPorOrgaoAndClasse(OrgaoConcedente orgaoconcedenteId, ClaseServicio claseId); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaMinimaService.java b/src/com/rjconsultores/ventaboletos/service/TarifaMinimaService.java new file mode 100644 index 000000000..5e66423bf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TarifaMinimaService.java @@ -0,0 +1,50 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.TarifaMinima; +import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria; + +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface TarifaMinimaService extends GenericService { + + public List pesquisarEspecifico(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Moneda moneda); + + public List pesquisar(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Moneda moneda); + + public List buscarPorPlaza(Plaza plaza); + + public List buscarPorPlazaMoneda(Plaza plaza, Moneda moneda); + + public List pesquisar(BigDecimal valor, Moneda moneda, Plaza plaza, + Marca marca, Parada origem, Parada destino, ClaseServicio claseServicio); + + public List pesquisar(TarifaMinima tarifaMinima); + + public List pesquisarOrigemDestinoTodos(Marca marca,Parada origem, Parada destino,ClaseServicio claseServicio, Moneda moneda); + + public List buscarPorMarca(Marca marca, Moneda moneda); + + public List buscarPorClaseServico(ClaseServicio claseServicio, Moneda moneda); + + public TarifaMinimaCategoria adicionarTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria); + + public void removerTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java b/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java new file mode 100644 index 000000000..76dbcdfa4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java @@ -0,0 +1,153 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.constantes.TipoSeguro; +import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TarifaOficial; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + + +public interface TarifaOficialService { + + /** + * Gera as tarifas de acordo o cálculo do coeficiente tarifário.
+ * + * Fórmula: (KM * Coeficiente Tarifório) + * + * Se o parametro ruta não for informado, será gerado tarifas para todas as + * rutas.
+ * + * Se o parametro orgaoConcedenteId não for informado, será gerado tarifas para todos os + * órgãos.
+ * + * Obs.: Essa operação apenas gera tarifas que ainda não esão geradas
+ * + * @param rutaId + * @param orgaoConcedenteId + * @return A quantidade de registros afetadas + */ + public Integer gerarTarifaPorCoeficiente(Integer rutaId, OrgaoConcedente orgaoConcedente, List idsEmpresas); + + + /** + * Atualiza as tarifas de acordo o cálculo do coeficiente tarifário.
+ * + * Fórmula: (KM * Coeficiente Tarifário) + * + * Se o parametro ruta não for informado, seró atualizado as tarifas para + * todas as rutas.
+ * + * + * Se o parametro orgaoConcedenteId não for informado, seró atualizado as tarifas para + * todos as órgãos.
+ * + * @param rutaId + * @param orgaoConcedenteId + * @return - Quantidade de tarifas atualizadas + */ + public Integer atualizarTarifaPorCoeficiente(Integer rutaId, OrgaoConcedente orgaoConcedente); + + + /** + * Gera o calculo de preço utilizando calculo por coeficiente ou pela kilometragem da ARTESP + * + * + * @param rudaId + * @param orgaoConcedenteId + * @param empresaId + * @throws BusinessException + */ + public void gerarAtualizarTarifa(List lsRuta, OrgaoConcedente orgaoConcedenteId, List lsEmpresaSelected) throws BusinessException; + + /** + * Copia a tarifa oficial para a tabela de tarifa de acordo com a vigencia especificada.
+ * + * Se a tarifa não existe, ela é inserida. Se existe, a tarifa e os componentes do preços são atualizados
+ * + * @param vigenciaTarifa + */ + public void copiarParaTarifa(VigenciaTarifa vigenciaTarifa, Boolean calculaPegagio, Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP, Boolean calculaEmbarcada, Empresa empresa, OrgaoConcedente orgaoConcedente); + + /** + * Atualiza a taxa de embarque da entidade TarifaOficial.
+ * + * Para o cálculo, é usado a seguinte lógica:
+ * - Atualiza de acordo a tabela TAXA_EMBARQUE_PARADA por kilometragem
+ * - Atualiza de acordo a tabela TAXA_EMBARQUE por kilometragem
+ * - Atualiza de acordo a tabela TAXA_EMBARQUE_PARADA por valor fixo
+ * + * A sequencia acima indica a ordem de atualização da taxa de embarque.
+ * + * A taxa de embarque mais restritiva fica por último (TAXA_EMBARQUE_PARADA por valor fixo) + * + * @param rutaId - Se informado, será atualizado apenas a taxa de embarque da ruta informada + * @param orgaoConcedenteId - Se informado, será atualizado apenas a taxa de embarque do órgão informado + * @param gerarTabelaZerada - Indica se uma tabela zerada será gerada. Isso para a possibilidade de gerar apenas a taxa de embarque sem preço + * @param empresaId - Empresa para ser filtrada + * @throws BusinessException + */ + public void atualizarTaxaEmbarque(List lsRuta, Integer orgaoConcedenteId,boolean gerarTabelaZerada, List lsEmpresaSelected) throws BusinessException; + + + /** + * Atualiza o seguro de acordo a kilometragem do trecho + * + * @param rutaId - Se informado, será filtrado pela ruta + * @param orgaoId -Se informado, será filtrado pelo orgão + */ + public void atualizarSeguroPorKm(Integer rutaId,Integer orgaoId, TipoSeguro tipoSeguro) throws BusinessException; + + /** + * Atualiza o seguro de acordo o valor da tarifa + * + * @param rutaId - Se informado, seró filtrado pela ruta + * @param orgaoId -Se informado, será filtrado pelo orgão + * + */ + public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId) throws BusinessException; + + + /** + * Executa tanto o {@link #atualizarSeguroPorKm(Integer, Integer)} quanto {@link #atualizarSeguroPorTarifa(Integer, Integer)} + * + * @param rutaId- Se informado, seró filtrado pela ruta + * @param orgaoId-Se informado, será filtrado pelo orgão + * @throws BusinessException + */ + public void atualizarSeguro(List lsRuta, Integer orgaoId, TipoSeguro tipoSeguro) throws BusinessException; + + /** + * See {@link TarifaOficialDAO#aplicarArredondamentoTarifa(Integer, Integer)} + * @param orgaoConcedenteId -Se informado, será filtrado pelo orgão + */ + public void aplicarArredondamentoTarifa(Integer orgaoConcedenteId, Boolean taxaEmbarque); + + public void actualizacion(TarifaOficial tarifaOficial); + + public TarifaOficial obtenerID(Integer tarifaOficialId); + + public void borrar(TarifaOficial tarifaOficial); + + public void gerarAtualizarTabelaZerada(List lsRuta, Integer orgaoConcedenteId, List lsEmpresaSelected) throws BusinessException ; + + public void atualizarPedagio(); + + public void atualizarSeguroPorKmTPP(Integer rutaId, Integer orgaoId, TipoSeguro tipoSeguro) throws BusinessException; + + public void atualizarSeguroTPP(List lsRuta, Integer orgaoId, TipoSeguro tipoSeguro) throws BusinessException; + + public long obtenerCount(List lsEmpresaSelected); + + public List obterTarifaOficialPorFiltro(Moneda moneda, Marca marca,List lsMarcas,Parada origem, Parada destino, ClaseServicio claseServicio, Ruta ruta, String numRuta, Boolean vende); + +} + diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaService.java b/src/com/rjconsultores/ventaboletos/service/TarifaService.java new file mode 100644 index 000000000..e5cb7eecf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TarifaService.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +/** + * + * @author rodrigo + */ +public interface TarifaService extends GenericService { + + public List pesquisar(Marca marca, Parada origem, Parada destino, Moneda moneda,ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, + Categoria categoria, TipoPuntoVenta tipoPuntoVenta); + + /** + * Método usado para checar se uma tarifa já está cadastrada no sistema. + * + * Uma tarifa é considerada única de acordo a marca, tramo, moneda, claseServicio, vigenciaTarifa, ruta e orgaoConcedente + * + * @param marca + * @param tramo + * @param moneda + * @param claseServicio + * @param vigenciaTarifa + * @param ruta + * @param orgaoConcedente + * @return + */ + public boolean existe(Marca marca, Tramo tramo, Moneda moneda,ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Ruta ruta, OrgaoConcedente orgaoConcedente); + + public Tarifa buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio,VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta); + + public List buscarPorVigencia(VigenciaTarifa vigencia,Empresa empresa); + + public Boolean podeAlterarTarifaMinima(Tarifa tarifa, Marca marca, Parada origem,Parada destino, ClaseServicio claseServicio, Plaza plaza, Moneda moneda); + + public List buscarExisteVigencia(VigenciaTarifa vigenciaTarifa); + + public Boolean generarTarifas(VigenciaTarifa vigencia, Marca marca); + + public boolean buscarTarifaExisteTramo(Tramo tramo); + + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException; + + public boolean existeTarifas(VigenciaTarifa vigenciaTarifa); + + public void excluirTodasTarifas(Moneda moneda, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Parada origem, + Parada destino, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via, Boolean vende); + + public List obterTarifaOficialPorFiltro(Moneda moneda, Marca marca,ListlsMarcas, Parada origem, Parada destino, ClaseServicio claseServicio,VigenciaTarifa vigenciaTarifa, Categoria categoria,TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via,Boolean vende); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaTipoptovtaService.java b/src/com/rjconsultores/ventaboletos/service/TarifaTipoptovtaService.java new file mode 100644 index 000000000..8d6b28213 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TarifaTipoptovtaService.java @@ -0,0 +1,15 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TarifaTipoptovta; + +/** + * + * @author rodrigo + */ +public interface TarifaTipoptovtaService + extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/TarjetaCreditoService.java b/src/com/rjconsultores/ventaboletos/service/TarjetaCreditoService.java new file mode 100644 index 000000000..fcd00e797 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TarjetaCreditoService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TarjetaCredito; + +public interface TarjetaCreditoService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/TarjetaFidelidadService.java b/src/com/rjconsultores/ventaboletos/service/TarjetaFidelidadService.java new file mode 100644 index 000000000..d51daf1b1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TarjetaFidelidadService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidadCuenta; + +import java.util.List; + +/** + * + * @author Shiro + */ +public interface TarjetaFidelidadService extends GenericService{ + + public List obtenerCantDesc(); + public TarjetaFidelidad obtenerNumTarjeta(Integer numTarjeta); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TarjetaRecaudacionService.java b/src/com/rjconsultores/ventaboletos/service/TarjetaRecaudacionService.java new file mode 100644 index 000000000..c634eb91e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TarjetaRecaudacionService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacion; +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacionPK; + +/** + * + * @author Administrador + */ +public interface TarjetaRecaudacionService + extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/TarjetaViajeService.java b/src/com/rjconsultores/ventaboletos/service/TarjetaViajeService.java new file mode 100644 index 000000000..25d1e1065 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TarjetaViajeService.java @@ -0,0 +1,22 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import org.zkoss.zul.Comboitem; + +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; +import com.rjconsultores.ventaboletos.entidad.TarjetaViaje; + +public interface TarjetaViajeService extends GenericService { + + public void grabarTarjetaViaje(List lsCorridaTramo); + + public void verificaCorridaDuplicada(List lsTarjetaViaje, boolean todasTarjetas); + + public List buscarTarjetaPorFiltros(Integer autoIni, Integer autoFin, Date dataIni, Date dataFin, Comboitem empresa); + + public List generarArchivoNomina(Date fecIni, Date fecFin); + + public void actulizarTarjetasEnviadas(List lsTarjetas); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TaxaEmbLevanteCtrlService.java b/src/com/rjconsultores/ventaboletos/service/TaxaEmbLevanteCtrlService.java new file mode 100644 index 000000000..fd1c70d9d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TaxaEmbLevanteCtrlService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TaxaEmbLevanteCtrl; + +public interface TaxaEmbLevanteCtrlService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueKmService.java b/src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueKmService.java new file mode 100644 index 000000000..8533169ef --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueKmService.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueKm; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface TaxaEmbarqueKmService extends GenericService{ + + public List buscarPorOrgao(OrgaoConcedente orgaoconcedenteId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueParadaService.java b/src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueParadaService.java new file mode 100644 index 000000000..d40668277 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TaxaEmbarqueParadaService.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.TaxaEmbarqueW2i; + +import java.sql.SQLException; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface TaxaEmbarqueParadaService extends GenericService { + + public List buscarPorLocalidade(Parada parada); + + public List buscarEstoqueTaxaEmbarque(Parada origem, Empresa empresa, String txtKm, OrgaoConcedente orgao, Categoria categoria) throws SQLException; +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoCambioCiudadService.java b/src/com/rjconsultores/ventaboletos/service/TipoCambioCiudadService.java new file mode 100644 index 000000000..eddbfe023 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoCambioCiudadService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoCambioCiudad; + +/** + * + * @author Administrador + */ +public interface TipoCambioCiudadService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoCambioCtrlService.java b/src/com/rjconsultores/ventaboletos/service/TipoCambioCtrlService.java new file mode 100644 index 000000000..9fcb5867f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoCambioCtrlService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoCambioCtrl; + +/** + * + * @author Administrador + */ +public interface TipoCambioCtrlService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoConvenioService.java b/src/com/rjconsultores/ventaboletos/service/TipoConvenioService.java new file mode 100644 index 000000000..d88521326 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoConvenioService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; + +/** + * + * @author Shiro + */ +public interface TipoConvenioService extends GenericService{ + +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoCorteService.java b/src/com/rjconsultores/ventaboletos/service/TipoCorteService.java new file mode 100644 index 000000000..3afd5ddde --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoCorteService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoCorte; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoCorteService extends GenericService { + + public List buscar(String desctipo); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoCortesiaDescuentoService.java b/src/com/rjconsultores/ventaboletos/service/TipoCortesiaDescuentoService.java new file mode 100644 index 000000000..0d548a4c4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoCortesiaDescuentoService.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import com.rjconsultores.ventaboletos.entidad.TipoCortesiaDescuento; +import java.math.BigDecimal; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface TipoCortesiaDescuentoService extends + GenericService { + + public List pesquisar(TipoCortesia tipoCortesia); + + public List Onchangue(TipoCortesia tp); + + public List buscar(BigDecimal porcentaje, + TipoCortesia tipoCortesia); + + public List obtenerTipoCortesia(int i); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoCortesiaService.java b/src/com/rjconsultores/ventaboletos/service/TipoCortesiaService.java new file mode 100644 index 000000000..a0fbe7acc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoCortesiaService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import java.util.List; + +/** + * + * @author Shiro + */ +public interface TipoCortesiaService extends GenericService { + + public List buscar(String descTipo); + + public List obtenerGrupoCortesia(int i); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoDocAutobusService.java b/src/com/rjconsultores/ventaboletos/service/TipoDocAutobusService.java new file mode 100644 index 000000000..f0f6acdc5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoDocAutobusService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoDocAutobus; + +public interface TipoDocAutobusService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoDomicilioService.java b/src/com/rjconsultores/ventaboletos/service/TipoDomicilioService.java new file mode 100644 index 000000000..46834d8b7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoDomicilioService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoDomicilio; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoDomicilioService extends GenericService { + + public List buscar(String desctipo, String cvetipodomicilio); + + public List buscarClave(String cvetipodomicilio); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoEmpleadoService.java b/src/com/rjconsultores/ventaboletos/service/TipoEmpleadoService.java new file mode 100644 index 000000000..001dbf4df --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoEmpleadoService.java @@ -0,0 +1,16 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoEmpleado; + +/** + * + * @author Shiro + */ +public interface TipoEmpleadoService extends GenericService{ + +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraEmpresaService.java b/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraEmpresaService.java new file mode 100644 index 000000000..c7242f7db --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraEmpresaService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraEmpresa; + +public interface TipoEventoExtraEmpresaService extends GenericService { + public List buscarPorTipoEventoExtra(TipoEventoExtra tipoeventoextra); + public TipoEventoExtraEmpresa suscribir(TipoEventoExtraEmpresa entidad); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraPtovtaService.java b/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraPtovtaService.java new file mode 100644 index 000000000..8d84d5ccf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraPtovtaService.java @@ -0,0 +1,6 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraPtoVta; + +public interface TipoEventoExtraPtovtaService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraService.java b/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraService.java new file mode 100644 index 000000000..002112afe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoEventoExtraService.java @@ -0,0 +1,22 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; + +public interface TipoEventoExtraService { + + public List buscar(String descingreso); + + public List obtenerTodos(); + + public TipoEventoExtra obtenerID(Integer id); + + public TipoEventoExtra suscribir(TipoEventoExtra entidad) throws ValidacionCampoException; + + public TipoEventoExtra actualizacion(TipoEventoExtra entidad) throws ValidacionCampoException; + + public void borrar(TipoEventoExtra entidad) throws BusinessException; +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoIdentificacionService.java b/src/com/rjconsultores/ventaboletos/service/TipoIdentificacionService.java new file mode 100644 index 000000000..1ef6fa282 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoIdentificacionService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion; + +public interface TipoIdentificacionService { + + public List obtenerTodos(); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoInformativoComissaoService.java b/src/com/rjconsultores/ventaboletos/service/TipoInformativoComissaoService.java new file mode 100644 index 000000000..961645a91 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoInformativoComissaoService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoInformativoComissao; + +public interface TipoInformativoComissaoService extends GenericService { + + Boolean existeTipoInformativo(TipoInformativoComissao tipo); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoMovimientoService.java b/src/com/rjconsultores/ventaboletos/service/TipoMovimientoService.java new file mode 100644 index 000000000..b232d3238 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoMovimientoService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoMovimiento; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoMovimientoService extends GenericService { + + public List buscar(String descmovimiento); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoOcupacionService.java b/src/com/rjconsultores/ventaboletos/service/TipoOcupacionService.java new file mode 100644 index 000000000..62392e7b9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoOcupacionService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoOcupacion; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoOcupacionService extends GenericService { + + public List buscar(String desctipo, String cvetipoocupacion); + + public List buscarClave(String cvetipoocupacion); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoParadaService.java b/src/com/rjconsultores/ventaboletos/service/TipoParadaService.java new file mode 100644 index 000000000..9f231194e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoParadaService.java @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoParada; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +/** + * + * @author Administrador + */ +public interface TipoParadaService { + + public List obtenerTodos(); + + public TipoParada obtenerID(Integer id); + + public TipoParada suscribir(TipoParada entidad); + + public TipoParada actualizacion(TipoParada entidad); + + public void borrar(TipoParada entidad) throws RegistroConDependenciaException; + + public List buscar(String desctipo); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoPuntoVentaService.java b/src/com/rjconsultores/ventaboletos/service/TipoPuntoVentaService.java new file mode 100644 index 000000000..803c232a2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoPuntoVentaService.java @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TipoPuntoVentaService { + + public List obtenerTodos(); + + public List obtenerTodosExceto(Short ... id); + + public TipoPuntoVenta obtenerID(Short id); + + public TipoPuntoVenta suscribir(TipoPuntoVenta entidad); + + public TipoPuntoVenta actualizacion(TipoPuntoVenta entidad); + + public void borrar(TipoPuntoVenta entidad); + + public List buscar(String desctipo); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoServicioService.java b/src/com/rjconsultores/ventaboletos/service/TipoServicioService.java new file mode 100644 index 000000000..eea312b61 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoServicioService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoServicio; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface TipoServicioService extends GenericService { + + public List buscar(String descservicio); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoTarifaPacoteService.java b/src/com/rjconsultores/ventaboletos/service/TipoTarifaPacoteService.java new file mode 100644 index 000000000..da18dd2e2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoTarifaPacoteService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; + +public interface TipoTarifaPacoteService extends GenericService { + + public List buscaTipoTarifaPacote(Pacote pacote); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/TipoVentaService.java b/src/com/rjconsultores/ventaboletos/service/TipoVentaService.java new file mode 100644 index 000000000..919646d82 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TipoVentaService.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TipoVenta; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface TipoVentaService extends GenericService{ + + public List buscar(String desctipoventa); + + public TipoVenta obtenerID(Short tipoventaId); + + public List obterTiposVentaIntegracao(); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/TramoKmServicioService.java b/src/com/rjconsultores/ventaboletos/service/TramoKmServicioService.java new file mode 100644 index 000000000..7494b3776 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TramoKmServicioService.java @@ -0,0 +1,19 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.TramoKmServicio; +import java.util.List; + +/** + * + * @author Desenvolvimento + */ +public interface TramoKmServicioService extends GenericService { + + public List buscar(TramoKmServicio tramoKmServicio); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/TramoRutaService.java b/src/com/rjconsultores/ventaboletos/service/TramoRutaService.java new file mode 100644 index 000000000..83353dc28 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TramoRutaService.java @@ -0,0 +1,63 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.RutaTramoVO; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.SecuenciaRutaTramoCoeficienteVO; + + +/** + * + * @author Administrador + */ +public interface TramoRutaService { + /** + * Grava la nueva configuración de la ruta con los tramos. + * + * Si no existen los tramos, ellos son generados. + * + * + * @param rutaTramoVO + * @throws BusinessException - Si hay algun valor no valido; Si la ruta ya existe + */ + public Ruta generarTramosRutas(RutaTramoVO rutaTramoVO, Boolean isRegreso) throws BusinessException; + + /** + * Genera la combinacion de la ruta. + * + * @param rutaTramoVO + * @return + */ + public List generarCombinacion(RutaTramoVO rutaTramoVO); + + /** + * Renera los datos de regreso para la ruta informada + * @param rutaTramoVO + * @return + */ + public RutaTramoVO generarRutaRegreso(RutaTramoVO rutaTramoVO); + + /** + * Gera combinação na tela de Rutas + * @param rutaTramoVO + * @return + */ + public List generarCombinacionTrechoRuta(RutaTramoVO rutaTramoVO, List secuenciasDestino); + + /** + * Gera tramos para uma ruta existente + * @param rutaTramoVO + * @param ruta Ruta para qual serão criados os tramos + * @throws BusinessException + */ + public void generarTramosRutaExistente(RutaTramoVO rutaTramoVO, Ruta ruta) throws BusinessException; + + public void limparInconsistenciasTramo(); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TramoService.java b/src/com/rjconsultores/ventaboletos/service/TramoService.java new file mode 100644 index 000000000..b96735b88 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TramoService.java @@ -0,0 +1,80 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.OrgaoTramo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.exception.BusinessException; + +/** + * + * @author Administrador + */ +public interface TramoService { + + public Tramo obtenerID(Integer id); + + public void borrar(Tramo entidad) throws BusinessException; + + public Tramo obtenerPorOrigemDestino(Parada origem, Parada destino); + + public List obtenerListPorOrigemDestino(Parada origem, Parada destino); + + public Tramo obtenerTramotPorOrigemDestinoVia(Parada origem, Parada destino, Via v); + + /** + * Hace la búsqueda del tramo que tiene origen - destino - via - clase servicio. + * + * @param origem + * @param destino + * @param via + * @param claseServicio + * @return + */ + public Tramo obtenerTramoUnicoRuta(Parada origem, Parada destino, Via via, ClaseServicio claseServicio); + + public Tramo buscar(Parada origem, Parada destino, Via via); + + /** + * Regreso los tramos con las paradas en secuencia. Ej.: Paradas A,B,C. Tramos A-B; B-C + */ + public List buscar(List lsParadas, Via via); + + public List buscarCveParada(String origen, String destino, String via); + + /** + * Grava los tramos en la lista con los km real y km del conductor en la via especificada. + * + * Se el tramo ya existie, cambia los valores, sino, graba un nuebo + * @param lsTramos + * @param via + */ + public void guardarTramosKm(List lsTramos,Via via); + + public List obtenerViasOrigemDestino(Parada origem, Parada destino); + + public List obtenerPorOrigemDestinoFetchLazy(Parada origem, Parada destino) ; + + public Tramo suscribirActualizar(Tramo tramo) throws BusinessException ; + + public List getLsOrgaoTramoByTramo(Tramo tramo); + + /** + * Gerar a descrição automática do tramo + * + * @param origen + * @param destino + * @param via + * @return + */ + public String gerarDescripcionTramo(Parada origen, Parada destino, Via via); + + public Boolean existe(Parada origem, Parada destino); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TramoServicioService.java b/src/com/rjconsultores/ventaboletos/service/TramoServicioService.java new file mode 100644 index 000000000..1da68c4de --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TramoServicioService.java @@ -0,0 +1,63 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.dao.TramoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.Via; + +/** + * + * @author Rafius + */ +public interface TramoServicioService extends GenericService { + + public List buscarPorTramo(Tramo tramo); + + public List buscarPorTramoServico(Tramo tramo, ClaseServicio clase); + + /** + * Hace la búsqueda del tramo servicio activo de acuerdo los parametros. + * + * @param origen + * @param destino + * @param via + * @param clase + * @return + */ + public TramoServicio buscar(Parada origen, Parada destino, Via via, ClaseServicio clase); + + /** + * Genera un nuevo registro de tramo y tramo servicio sino ya existen. + * + * Si el tramo y tramo tiempo existen, es retornado false. + * + * @param origen + * @param destino + * @param via + * @param kmsReal + * @param kmsConductor + * @param tiempoRecorrido + * @param claseServicio + * TODO + * @return - Si el tramo existe, return FALSE. Sino, retorna TRUE + */ + public boolean generarTramoTiempo(Parada origen, Parada destino, Via via, BigDecimal kmsReal, Date tiempoRecorrido, ClaseServicio claseServicio); + + /** + * {@link TramoServicioDAO#existenTiemposTramosEsquema(Integer)} + * + * @param esquemaCorridaId + * @return + */ + public boolean existenTiemposTramosEsquema(Integer esquemaCorridaId); +} diff --git a/src/com/rjconsultores/ventaboletos/service/TramoTiempoService.java b/src/com/rjconsultores/ventaboletos/service/TramoTiempoService.java new file mode 100644 index 000000000..6a0142b5f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TramoTiempoService.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoTiempo; + +/** + * + * @author Administrador + */ +public interface TramoTiempoService extends GenericService { + + public List buscarPorTramo(Tramo tramo); + + public List buscarPorTramo(Tramo tramo,ClaseServicio clase); + + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/TurnoService.java b/src/com/rjconsultores/ventaboletos/service/TurnoService.java new file mode 100644 index 000000000..43d37a581 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TurnoService.java @@ -0,0 +1,17 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Turno; +import java.util.List; + +/** + * + * @author Administrador + */ +public interface TurnoService extends GenericService { + + public List buscar(String descturno); +} diff --git a/src/com/rjconsultores/ventaboletos/service/UsuarioBancarioService.java b/src/com/rjconsultores/ventaboletos/service/UsuarioBancarioService.java new file mode 100644 index 000000000..c1e7cb9b9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/UsuarioBancarioService.java @@ -0,0 +1,14 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.UsuarioBancario; + +/** + * + * @author Rafius + */ +public interface UsuarioBancarioService extends GenericService { +} diff --git a/src/com/rjconsultores/ventaboletos/service/UsuarioEmpresaService.java b/src/com/rjconsultores/ventaboletos/service/UsuarioEmpresaService.java new file mode 100644 index 000000000..e4ae341b1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/UsuarioEmpresaService.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa; + +public interface UsuarioEmpresaService extends GenericService { + + public List obtenerPorUsuario(Usuario usuario); + public List obtenerEmpresa(Usuario usuario) ; + public Boolean obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario); + +} + diff --git a/src/com/rjconsultores/ventaboletos/service/UsuarioPerfilService.java b/src/com/rjconsultores/ventaboletos/service/UsuarioPerfilService.java new file mode 100644 index 000000000..965b412b7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/UsuarioPerfilService.java @@ -0,0 +1,22 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; +import java.util.List; + +/** + * + * @author Rafius + */ +public interface UsuarioPerfilService extends GenericService { + + public List obtenerPorUsuario(Usuario usuario); + + public boolean validaPermissaoPerfilEdicao(String funcionSistema); + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/UsuarioService.java b/src/com/rjconsultores/ventaboletos/service/UsuarioService.java new file mode 100644 index 000000000..664bb12fd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/UsuarioService.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO; + +/** + * + * @author gleimar + */ +public interface UsuarioService { + + public List obtenerTodos(); + + public Usuario obtenerID(Integer id); + + public void borrar(Usuario entidad); + + public List buscarPeloNome(String nome); + + public Usuario buscarPeloNomeSenha(String stUsuario, String senha); + + public List buscarPorEmpleado(Empleado get); + + public List buscarPelaCveUsuario(String claveUsuario); + + public Usuario suscribirActualizar(Usuario entidad, String senha, Perfil perfil) throws BusinessException; + + public Usuario cambiarContrasena(Usuario entidad, String senha) throws BusinessException; + + public List buscarPeloNomeLike(String nome); + + public List buscarUsuariosEmbarcadaPorPontoVenda(Long puntoVentaId); + + public List buscarUsuariosEmbarcadaPorDispositivo(Long dispositivoEmbarcadaId); + + public List buscarUsuarioEmbarcadaPorUsuariosIds(List usuariosIdList); + + public List buscaUsuariosDoPuntoVenta(Long dispositivoEmbarcadaId); +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/UsuarioSesionService.java b/src/com/rjconsultores/ventaboletos/service/UsuarioSesionService.java new file mode 100644 index 000000000..e7d19054e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/UsuarioSesionService.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioSesion; + +/** + * + * @author RJ Consultores + */ +public interface UsuarioSesionService { + + public UsuarioSesion actualizacion(UsuarioSesion entidad); + + public void borrar(UsuarioSesion entidad); + + public List buscar(Usuario usuario); + + public void liberarUsuario(Usuario usuario); +} diff --git a/src/com/rjconsultores/ventaboletos/service/UsuarioUbicacionService.java b/src/com/rjconsultores/ventaboletos/service/UsuarioUbicacionService.java new file mode 100644 index 000000000..f70ec436c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/UsuarioUbicacionService.java @@ -0,0 +1,18 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface UsuarioUbicacionService extends GenericService { + + public List buscarPorUsuario(Usuario usuario); +} diff --git a/src/com/rjconsultores/ventaboletos/service/VendaEmbarcadaService.java b/src/com/rjconsultores/ventaboletos/service/VendaEmbarcadaService.java new file mode 100644 index 000000000..7a27b6fc7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/VendaEmbarcadaService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO; + +public interface VendaEmbarcadaService { + + public int gerarVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws BusinessException; + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ViaService.java b/src/com/rjconsultores/ventaboletos/service/ViaService.java new file mode 100644 index 000000000..84579ccf6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ViaService.java @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; + +/** + * + * @author Administrador + */ +public interface ViaService { + + public List obtenerTodos(); + + public Via obtenerID(Integer id); + + public Via suscribir(Via entidad); + + public Via actualizacion(Via entidad); + + public void borrar(Via entidad) throws RegistroConDependenciaException; + + public List buscar(String nombvia); +} diff --git a/src/com/rjconsultores/ventaboletos/service/VigenciaTarifaService.java b/src/com/rjconsultores/ventaboletos/service/VigenciaTarifaService.java new file mode 100644 index 000000000..082f32590 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/VigenciaTarifaService.java @@ -0,0 +1,25 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import java.util.Date; +import java.util.List; + +/** + * + * @author rodrigo + */ +public interface VigenciaTarifaService extends GenericService { + + public List pesquisar(Date inicio, Date fim); + + /** + * Regresa las vigencia que traslapa + * @param vigenciaTarifa + * @return + */ + public List buscarVigenciasIntervalo(VigenciaTarifa vigenciaTarifa); +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AbastoBoletoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AbastoBoletoServiceImpl.java new file mode 100644 index 000000000..739a3165b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AbastoBoletoServiceImpl.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AbastoBoletoDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.service.AbastoBoletoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("abastoBoletoService") +public class AbastoBoletoServiceImpl implements AbastoBoletoService { + + @Autowired + private AbastoBoletoDAO abastoBoletoDAO; + + @Override + public List obtenerTodos() { + return abastoBoletoDAO.obtenerTodos(); + } + + @Override + public AbastoBoleto obtenerID(Integer id) { + return abastoBoletoDAO.obtenerID(id); + } + + @Transactional + public AbastoBoleto suscribir(AbastoBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return abastoBoletoDAO.suscribir(entidad); + } + + @Transactional + public AbastoBoleto actualizacion(AbastoBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return abastoBoletoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(AbastoBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + abastoBoletoDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AbastoCentralServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AbastoCentralServiceImpl.java new file mode 100644 index 000000000..107488f2c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AbastoCentralServiceImpl.java @@ -0,0 +1,61 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.service.AbastoCentralService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("abastoCentralService") +public class AbastoCentralServiceImpl implements AbastoCentralService { + + @Autowired + private AbastoCentralDAO abastoCentralDAO; + + public List obtenerTodos() { + return abastoCentralDAO.obtenerTodos(); + } + + public AbastoCentral obtenerID(Long id) { + return abastoCentralDAO.obtenerID(id); + } + + public AbastoCentral suscribir(AbastoCentral entidad) { + setUsuarioFecmodifActivo(entidad); + return abastoCentralDAO.suscribir(entidad); + } + + public AbastoCentral actualizacion(AbastoCentral entidad) { + setUsuarioFecmodifActivo(entidad); + return abastoCentralDAO.actualizacion(entidad); + } + + public void borrar(AbastoCentral entidad) { + setUsuarioFecmodifActivo(entidad); + entidad.setActivo(Boolean.FALSE); + abastoCentralDAO.borrar(entidad); + } + + private void setUsuarioFecmodifActivo(AbastoCentral entidad){ + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + } + + public List buscaBilhetesPorAidf(Aidf aidf) { + List bilhetes = abastoCentralDAO.buscaBilhetesPorAidf(aidf); + return bilhetes; + } + + @Override + public void borrarLosQueTienenAIDF(Aidf aidf) { + abastoCentralDAO.borrarLosQueTienenAIDF(aidf); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AbastoHistoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AbastoHistoServiceImpl.java new file mode 100644 index 000000000..57e22e468 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AbastoHistoServiceImpl.java @@ -0,0 +1,57 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.AbastoHistoDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.service.AbastoHistoService; + +@Service("abastoHistoService") +public class AbastoHistoServiceImpl implements AbastoHistoService { + + + @Autowired + private AbastoHistoDAO abastoHistoDAO; + + @Override + public List obtenerTodos() { + // TODO Auto-generated method stub + return null; + } + + @Override + public AbastoHisto obtenerID(Long id) { + // TODO Auto-generated method stub + return null; + } + + @Override + public AbastoHisto suscribir(AbastoHisto entidad) { + // TODO Auto-generated method stub + return null; + } + + @Override + public AbastoHisto actualizacion(AbastoHisto entidad) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void borrar(AbastoHisto entidad) { + // TODO Auto-generated method stub + + } + + @Override + public void borrarLosQueTienenAIDF(Aidf aidf) { + abastoHistoDAO.borrarLosQueTienenAIDF(aidf); + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AgruparParadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AgruparParadaServiceImpl.java new file mode 100644 index 000000000..fc0472c80 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AgruparParadaServiceImpl.java @@ -0,0 +1,95 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AgruparParadaDAO; +import com.rjconsultores.ventaboletos.entidad.AgrupamentoParada; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.AgruparParadaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("agruparParadaService") +public class AgruparParadaServiceImpl implements AgruparParadaService { + @Autowired + private AgruparParadaDAO agruparParadaDAO; + + @Override + public AgrupamentoParada obtenerID(Integer id) { + // TODO Auto-generated method stub + return null; + } + + @Transactional + public AgrupamentoParada suscribir(AgrupamentoParada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return agruparParadaDAO.suscribir(entidad); + } + + @Transactional + public AgrupamentoParada actualizacion(AgrupamentoParada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return agruparParadaDAO.actualizacion(entidad); + } + + @Override + public List obtenerTodos() { + return agruparParadaDAO.obtenerTodos(); + } + + @Override + @Transactional(readOnly = false) + public AgrupamentoParada suscribirActualizar(AgrupamentoParada entidad) throws BusinessException { + + List lsAgrumaentoParadas = agruparParadaDAO.buscar(entidad.getDescAgrupamentoParada()); + + if (!lsAgrumaentoParadas.isEmpty()) { + if (entidad.getAgrupamentoParadaId() == null) { + throw new BusinessException("editarCatalogoDeParadaController.registroDESCAGRUPAMENTOPARADAexiste"); + } else { + if (!lsAgrumaentoParadas.contains(entidad)) { + throw new BusinessException("editarCatalogoDeParadaController.registroDESCAGRUPAMENTOPARADAexiste"); + } + } + } + + lsAgrumaentoParadas = agruparParadaDAO.buscarCVE(entidad.getCveAgrupamentoParada()); + + if (!lsAgrumaentoParadas.isEmpty()) { + if (entidad.getAgrupamentoParadaId() == null) { + throw new BusinessException("editarCatalogoDeParadaController.registroCVEAGRUPAMENTOPARADAexiste"); + } else { + if (!lsAgrumaentoParadas.contains(entidad)) { + throw new BusinessException("editarCatalogoDeParadaController.registroCVEAGRUPAMENTOPARADAexiste"); + } + } + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getAgrupamentoParadaId() == null) { + return agruparParadaDAO.suscribir(entidad); + } + return agruparParadaDAO.actualizacion(entidad); + + } + + @Transactional + public void borrar(AgrupamentoParada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + agruparParadaDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java new file mode 100644 index 000000000..df3993447 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java @@ -0,0 +1,155 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.sql.Connection; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AidfDAO; +import com.rjconsultores.ventaboletos.dao.AidfEspecieDAO; +import com.rjconsultores.ventaboletos.dao.AidfTipoDAO; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.AidfEspecie; +import com.rjconsultores.ventaboletos.entidad.AidfTipo; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.AidfService; +import com.rjconsultores.ventaboletos.service.MovimentacionBilhetesService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.aidf.AidfVo; + +@Service("aidfService") +public class AidfServiceImpl implements AidfService { + + private static final Integer TIPO_FORMULARIO_CONTINUO = 1; + private static final Integer TIPO_VENDA_MANUAL = 2; + + @Autowired + private AidfDAO aidfDAO; + + @Autowired + private AidfEspecieDAO aidfEspecieDAO; + + @Autowired + private AidfTipoDAO aidfTipoDAO; + + @Autowired + private MovimentacionBilhetesService movimentacionBilhetesService; + + public List obtenerTodos() { + return aidfDAO.obtenerTodos(); + } + + @Transactional + public Aidf obtenerID(Long id) { + return aidfDAO.obtenerID(id); + } + + @Transactional + public Aidf suscribir(Aidf entidad) { + setUsuarioFecmodifActivo(entidad); + + Aidf aidf = aidfDAO.suscribir(entidad); + + /* + * Mantis #9124 Desativado devido a lentidão ao criar o AbastoCentrol e AbastoHisto. if (aidf != null) movimentacionBilhetesService.realizaAdquisicionBilhetes(aidf); + */ + + return aidf; + } + + @Transactional + public Aidf actualizacion(Aidf entidad) { + setUsuarioFecmodifActivo(entidad); + return aidfDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Aidf entidad) { + setUsuarioFecmodifActivo(entidad); + entidad.setActivo(Boolean.FALSE); + aidfDAO.actualizacion(entidad); + } + + private void setUsuarioFecmodifActivo(Aidf entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + } + + public List obtenerTodosAdifEspecie() { + return aidfEspecieDAO.obtenerTodos(); + } + + public List obtenerTodosAdifTipo() { + return aidfTipoDAO.obtenerTodos(); + } + + public List buscaAidfsPorEmpresas(List empresas) { + List aidfs = aidfDAO.buscaAidfsPorEmpresas(empresas); + return aidfs; + } + + public List obtenerAidfFromSerieDocfiscal(String serie, String docfiscal, Connection conn) { + return aidfDAO.obtenerAidfFromSerieDocfiscal(serie, docfiscal, conn); + } + + public Long validarDocFiscalSerieFormInicialFinal(Aidf entidad, Connection conn) { + + List list = obtenerAidfFromSerieDocfiscal(entidad.getSerie(), entidad.getDocfiscal().replaceAll("[^a-zA-Z0-9]+", ""), conn); + + for (AidfVo aidf : list) { + // desconsiderar o próprio ID, caso contrário o erro de validação sempre acontece qdo o registro é editado. + if ((entidad.getAidfId() == null) || (aidf.getAidfId().compareTo(entidad.getAidfId()) != 0)) { + if (aidf.getDocfiscal().trim().equals(entidad.getDocfiscal().replaceAll("[^a-zA-Z0-9]+", "").trim())) { + if (aidf.getSerie().trim().equals(entidad.getSerie().trim())) { + if ((Long.parseLong(entidad.getForminicial()) >= Long.parseLong(aidf.getForminicial()) && Long.parseLong(entidad.getForminicial()) <= Long.parseLong(aidf.getFormfinal())) + || (Long.parseLong(entidad.getFormfinal()) >= Long.parseLong(aidf.getForminicial()) && Long.parseLong(entidad.getFormfinal()) <= Long.parseLong(aidf.getFormfinal()))) { + return aidf.getAidfId(); + } + } + } + } + } + return -1l; + } + + public Boolean validarDocFiscalPorEstado(Long idAidf, Integer especieId, String docFiscal, Estado estado) { + return aidfDAO.existeAidfComCodFiscalEEstado(idAidf, especieId, docFiscal, estado); + } + + public Boolean validarTipoVenda(String tipoVenda, String serie, Integer idTipo) { + return !("M".equals(tipoVenda) + && ("UNIC".equals(serie) || TIPO_FORMULARIO_CONTINUO.equals(idTipo))); + } + + public Boolean validarVendaManual(Integer idTipo, String serie) { + return !(TIPO_VENDA_MANUAL.equals(idTipo) && "UNIC".equals(serie)); + } + + @Override + public List buscaAidfEstadoEmpresa(Integer empresaId, Integer estadoId, Boolean isRMD) { + return aidfDAO.buscaAidfEstadoEmpresa(empresaId, estadoId, isRMD); + } + + @Override + public String buscaUltimoAidfRMDUtilizado(Long idAidf, Integer empresaId, Integer estadoId) { + return aidfDAO.buscaUltimoAidfRMDUtilizado(idAidf, empresaId, estadoId); + } + + @Override + public boolean vaidaRMDUtilizado(Long idAidf, Integer empresaId, Integer estadoId, String folio) { + return aidfDAO.vaidaRMDUtilizado(idAidf, empresaId, estadoId, folio); + } + + @Override + public Boolean validarDocFiscalPorEstadoAgencia(Long idAidf, Integer especieId, String docFiscal, String formInicial, String formFinal, Estado estado, PuntoVenta puntoVenta) { + return aidfDAO.validarDocFiscalPorEstadoAgencia(idAidf, especieId, docFiscal, formInicial, formFinal, estado, puntoVenta); + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AjusteEventoExtraServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AjusteEventoExtraServiceImpl.java new file mode 100644 index 000000000..227adb2a6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AjusteEventoExtraServiceImpl.java @@ -0,0 +1,63 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.AjusteEventoExtraDAO; +import com.rjconsultores.ventaboletos.entidad.AjusteEventoExtra; +import com.rjconsultores.ventaboletos.service.AjusteEventoExtraService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("ajusteEventoExtraService") +public class AjusteEventoExtraServiceImpl implements AjusteEventoExtraService { + + @Autowired + private AjusteEventoExtraDAO ajusteEventoExtraDAO; + + public List obtenerTodos() { + return ajusteEventoExtraDAO.obtenerTodos(); + } + + public AjusteEventoExtra obtenerID(Integer id) { + return ajusteEventoExtraDAO.obtenerID(id); + } + + @Transactional + public AjusteEventoExtra suscribir(AjusteEventoExtra entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ajusteEventoExtraDAO.suscribir(entidad); + } + + @Transactional + public AjusteEventoExtra actualizacion(AjusteEventoExtra entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ajusteEventoExtraDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(AjusteEventoExtra entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ajusteEventoExtraDAO.actualizacion(entidad); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AlertaCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AlertaCtrlServiceImpl.java new file mode 100644 index 000000000..3e6fe8cb0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AlertaCtrlServiceImpl.java @@ -0,0 +1,85 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AlertaCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.AlertaCtrl; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.AlertaCtrlService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("alertaCtrlService") +public class AlertaCtrlServiceImpl implements AlertaCtrlService { + + @Autowired + private AlertaCtrlDAO alertaCtrlDAO; + + @Autowired + private RutaService rutaService; + + public List obtenerTodos() { + return alertaCtrlDAO.obtenerTodos(); + } + + public AlertaCtrl obtenerID(Integer id) { + return alertaCtrlDAO.obtenerID(id); + } + + @Transactional(rollbackFor=BusinessException.class) + public AlertaCtrl suscribirActualizar(AlertaCtrl entidad) throws BusinessException { + if (entidad.getRuta() != null) { + if (!rutaService.paradaExisteEnLaRuta(entidad.getOrigem(), entidad.getRuta())) { + throw new BusinessException("editarAlertaCtrlController.MSG.origenNoExisteRuta"); + } + if (!rutaService.paradaExisteEnLaRuta(entidad.getDestino(), entidad.getRuta())) { + throw new BusinessException("editarAlertaCtrlController.MSG.destinoNoExisteRuta"); + } + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getAlertactrlId() == null) { + return alertaCtrlDAO.suscribir(entidad); + } else { + return alertaCtrlDAO.actualizacion(entidad); + } + } + @Transactional + public void borrar(AlertaCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + alertaCtrlDAO.actualizacion(entidad); + } + + public List buscar(Parada origem, Parada destino, Ruta ruta, ClaseServicio claseServicio, Integer tiempoAlta, Integer tiempoBaja, BigDecimal percAlta, + BigDecimal percBaja) { + return alertaCtrlDAO.buscar(origem, destino, ruta, claseServicio, tiempoAlta, tiempoBaja, percAlta, percBaja); + } + + public List buscarCorrida(Corrida corrida) { + return alertaCtrlDAO.buscarCorrida(corrida); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AliasServicoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AliasServicoServiceImpl.java new file mode 100644 index 000000000..b47a3d450 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AliasServicoServiceImpl.java @@ -0,0 +1,99 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Collections; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AliasServicoDAO; +import com.rjconsultores.ventaboletos.entidad.AliasServico; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.AliasServicoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("aliasServicoService") +public class AliasServicoServiceImpl implements AliasServicoService { + + @Autowired + private AliasServicoDAO aliasServicoDAO; + + public List obtenerTodos() { + return aliasServicoDAO.obtenerTodos(); + } + + public AliasServico obtenerID(Integer id) { + return aliasServicoDAO.obtenerID(id); + } + + @Transactional + public AliasServico suscribirActualizar(AliasServico entidad) throws BusinessException { + + if ( (entidad.getOrigen() == null) || (entidad.getDestino() == null) || (entidad.getAliasDestino()== null) || (entidad.getAliasOrigen()== null) || (entidad.getRuta()== null)){ + throw new BusinessException("editarAliasServicoController.MSG.camposObrigatorios"); + } + + List lsBusca = Collections.emptyList(); + + if (entidad.getCorridaId() != null){ + lsBusca = aliasServicoDAO.buscar(entidad.getOrigen().getParadaId(), entidad.getDestino().getParadaId(), entidad.getRuta().getRutaId(), entidad.getCorridaId()); + }else{ + lsBusca = aliasServicoDAO.buscarAliasSemCorrida(entidad.getOrigen().getParadaId(), entidad.getDestino().getParadaId(), entidad.getRuta().getRutaId()); + } + + if (!lsBusca.isEmpty()){ + boolean existe = false; + + for(AliasServico as : lsBusca){ + if (as.equals(entidad)){ + existe = true; + } + } + + if (!existe){ + throw new BusinessException("editarAliasServicoController.MSG.registroYaExiste"); + } + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getAliasServicoId() == null){ + return aliasServicoDAO.suscribir(entidad); + }else{ + return aliasServicoDAO.actualizacion(entidad); + } + } + + @Transactional + public void borrar(AliasServico entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + aliasServicoDAO.actualizacion(entidad); + } + + @Override + public List buscarPorRuta(Integer rutaId) { + return aliasServicoDAO.buscarPorRuta(rutaId); + } + + @Override + public List buscarPorLinhaEmpresa(List linhas, List empresas, List tiposClasses, List orgaos, String prefixo) { + return aliasServicoDAO.buscarPorLinhaEmpresa(linhas, empresas, tiposClasses, orgaos, prefixo); + } + + @Override + public AliasServico existe(Parada origem, Parada destino, Ruta linha, Integer idCorrida) { + return aliasServicoDAO.existe(origem, destino, linha, idCorrida); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AliquotaEstadoDestinoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AliquotaEstadoDestinoServiceImpl.java new file mode 100644 index 000000000..04dc93b58 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AliquotaEstadoDestinoServiceImpl.java @@ -0,0 +1,37 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AliquotaEstadoDestinoDAO; +import com.rjconsultores.ventaboletos.entidad.AliquotaEstadoDestino; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; +import com.rjconsultores.ventaboletos.service.AliquotaEstadoDestinoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("aliquotaEstadoDestinoService") +public class AliquotaEstadoDestinoServiceImpl implements AliquotaEstadoDestinoService { + + @Autowired + private AliquotaEstadoDestinoDAO aliquotaEstadoDestinoDAO; + + @Transactional + public AliquotaEstadoDestino suscribir(AliquotaEstadoDestino entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + entidad = aliquotaEstadoDestinoDAO.suscribir(entidad); + + return entidad; + } + + public List getChildrens(EmpresaImposto parent){ + return aliquotaEstadoDestinoDAO.getChildrens(parent); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ArquivoRemessaCNABImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ArquivoRemessaCNABImpl.java new file mode 100644 index 000000000..5fb986906 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ArquivoRemessaCNABImpl.java @@ -0,0 +1,153 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.ArquivoRemessa; +import com.rjconsultores.ventaboletos.dao.ConstanteDAO; +import com.rjconsultores.ventaboletos.dao.RemessaCNABBancosDAO; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoBoleto; +import com.rjconsultores.ventaboletos.enuns.BancoLayout; +import com.rjconsultores.ventaboletos.service.ArquivoRemessaCNAB; +import com.rjconsultores.ventaboletos.utils.NossoNumeroUtils; + +@Service("arquivoRemessaCNAB") +public class ArquivoRemessaCNABImpl implements ArquivoRemessaCNAB { + + @Autowired + private RemessaCNABBancosDAO remessaCNABBancosDAO; + + @Autowired + private ConstanteDAO constanteDAO; + + @Override + public List obtenerTodos() { + return remessaCNABBancosDAO.obtenerTodos(); + } + + @Override + public FechamentoBoleto obtenerID(Long id) { + return remessaCNABBancosDAO.obtenerID(id); + } + + @Override + @Transactional + public FechamentoBoleto suscribir(FechamentoBoleto entidad) { + return remessaCNABBancosDAO.suscribir(entidad); + } + + @Override + @Transactional + public FechamentoBoleto actualizacion(FechamentoBoleto entidad) { + return remessaCNABBancosDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(FechamentoBoleto entidad) { + remessaCNABBancosDAO.borrar(entidad); + + } + + @Override + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) { + return remessaCNABBancosDAO.obtenerTodosParaRemessa(empresa, dataDe, dataAte, reenviar); + } + + @Override + public ArquivoRemessa remessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) { + + BancoLayout banco = BancoLayout.getInstanceByCodBanco(remessaCNABBancosDAO.findBanco(empresa)); + + try{ + if(BancoLayout.BRADESCO_400_Envio.equals(banco)){ + return remessaCNABBancosDAO.remessaBradesco(empresa, dataDe, dataAte, reenviar); + }else if(BancoLayout.SANTANDER_400_Envio.equals(banco)){ + return remessaCNABBancosDAO.remessaSantander(empresa, dataDe, dataAte, reenviar); + }else if(BancoLayout.MERCANTIL_400_Envio.equals(banco)){ + return remessaCNABBancosDAO.remessaMercantil(empresa, dataDe, dataAte, reenviar); + }else if(BancoLayout.ITAU_400_Envio.equals(banco)){ + return remessaCNABBancosDAO.remessaItau(empresa, dataDe, dataAte, reenviar); + }else if(BancoLayout.BB_240_Envio.equals(banco)){ + return remessaCNABBancosDAO.remessaBancoBrasil(empresa, dataDe, dataAte, reenviar); + }else if(BancoLayout.SICOOB_240_Envio.equals(banco)){ + return remessaCNABBancosDAO.remessaSicoob(empresa, dataDe, dataAte, reenviar); + }else if(BancoLayout.CAIXA_400_Envio.equals(banco)){ + return remessaCNABBancosDAO.remessaCaixa(empresa, dataDe, dataAte, reenviar); + } + + }catch(RuntimeException re){ + throw re; + }catch(Exception e){ + e.printStackTrace(); + } + + return null; + } + + @Override + public Boolean atualizaRemessa(Empresa empresa, ArquivoRemessa arquivoRemessa) throws Exception { + return remessaCNABBancosDAO.atualizaRemessa(empresa, arquivoRemessa); + } + + @Override + public List getEmpresas() { + return remessaCNABBancosDAO.getEmpresas(); + } + + @Override + public boolean temPermissao(){ + Constante cons = constanteDAO.buscarPorNomeConstante("USA_REMESSA_CNAB"); + return cons != null && cons.getActivo() && cons.getValorconstante() != null && cons.getValorconstante().equalsIgnoreCase("true"); + } + + @Override + public boolean boletosOk(List boletos) { + + BancoLayout banco = null; + boolean toReturn = Boolean.TRUE; + + if(boletos != null && !boletos.isEmpty()) { + for (java.util.Iterator it = boletos.iterator(); it.hasNext();) { + + FechamentoBoleto fechamentoBoleto = it.next(); + + if(banco == null){ + banco = BancoLayout.getInstanceByCodBanco(remessaCNABBancosDAO.findBanco(fechamentoBoleto.getFechamentoCntcorrente().getEmpresa())); + } + + if(!NossoNumeroUtils.validaNossoNumero(fechamentoBoleto.getNossonumero(), banco)){ + it.remove(); + toReturn = Boolean.FALSE; + } + } + } + + return toReturn; + } + + @Override + public boolean boletosAEnviar(List boletos) { + + boolean toReturn = Boolean.FALSE; + + if(boletos != null && !boletos.isEmpty()) { + for (java.util.Iterator it = boletos.iterator(); it.hasNext();) { + + FechamentoBoleto fechamentoBoleto = it.next(); + + if(fechamentoBoleto.getRemessaId() == null){ + return Boolean.TRUE; + } + } + } + + return toReturn; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ArticuloServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ArticuloServiceImpl.java new file mode 100644 index 000000000..1f537cc74 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ArticuloServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ArticuloDAO; +import com.rjconsultores.ventaboletos.entidad.Articulo; +import com.rjconsultores.ventaboletos.service.ArticuloService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("articuloService") +public class ArticuloServiceImpl implements ArticuloService { + + @Autowired + private ArticuloDAO articuloDAO; + + public List obtenerTodos() { + return articuloDAO.obtenerTodos(); + } + + public Articulo obtenerID(Integer id) { + return articuloDAO.obtenerID(id); + } + + @Transactional + public Articulo suscribir(Articulo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return articuloDAO.suscribir(entidad); + } + + @Transactional + public Articulo actualizacion(Articulo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return articuloDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Articulo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + articuloDAO.actualizacion(entidad); + } + + public List buscar(String descarticulo) { + return articuloDAO.buscar(descarticulo); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AsientoExclusivoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AsientoExclusivoServiceImpl.java new file mode 100644 index 000000000..08fb0e71b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AsientoExclusivoServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.AsientoExclusivoDAO; +import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo; +import com.rjconsultores.ventaboletos.service.AsientoExclusivoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("asientoExclusivoService") +public class AsientoExclusivoServiceImpl implements AsientoExclusivoService { + + @Autowired + private AsientoExclusivoDAO asientoExclusivoDAO; + + public List obtenerTodos() { + return asientoExclusivoDAO.obtenerTodos(); + } + + public AsientoExclusivo obtenerID(Integer id) { + return asientoExclusivoDAO.obtenerID(id); + } + + @Transactional + public AsientoExclusivo suscribir(AsientoExclusivo entidad) { + Integer usuarioId = 1; + if (UsuarioLogado.getUsuarioLogado() != null){ + usuarioId = UsuarioLogado.getUsuarioLogado().getUsuarioId(); + } + entidad.setUsuarioId(usuarioId); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return asientoExclusivoDAO.suscribir(entidad); + } + + @Transactional + public AsientoExclusivo actualizacion(AsientoExclusivo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return asientoExclusivoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(AsientoExclusivo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + asientoExclusivoDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AuditLogServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AuditLogServiceImpl.java new file mode 100644 index 000000000..e1a2e207c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AuditLogServiceImpl.java @@ -0,0 +1,53 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.AuditLogDAO; +import com.rjconsultores.ventaboletos.entidad.AuditLog; +import com.rjconsultores.ventaboletos.entidad.AuditModule; +import com.rjconsultores.ventaboletos.service.AuditLogService; + +@Service("auditLogService") +public class AuditLogServiceImpl implements AuditLogService { + + @Autowired + private AuditLogDAO auditLogDAO; + + @Override + public List obtenerTodos() { + return auditLogDAO.obtenerTodos(); + } + + @Override + public AuditLog obtenerID(Long id) { + return auditLogDAO.obtenerID(id); + } + + @Override + public AuditLog suscribir(AuditLog auditLog) { + return auditLogDAO.suscribir(auditLog); + } + + @Override + public AuditLog actualizacion(AuditLog auditLog) { + return auditLogDAO.actualizacion(auditLog); + } + + @Override + public void borrar(AuditLog auditLog) { + auditLogDAO.borrar(auditLog); + } + + @Override + public List carregarLog(AuditModule modulo) { + return auditLogDAO.carregarLog(modulo); + } + + @Override + public List filtrarLog(AuditLog auditLog) { + return auditLogDAO.filtrarLog(auditLog); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AuditModuleServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AuditModuleServiceImpl.java new file mode 100644 index 000000000..1fa9537b7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AuditModuleServiceImpl.java @@ -0,0 +1,46 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.AuditModuleDAO; +import com.rjconsultores.ventaboletos.entidad.AuditModule; +import com.rjconsultores.ventaboletos.service.AuditModuleService; + +@Service("auditModuleService") +public class AuditModuleServiceImpl implements AuditModuleService { + + @Autowired + private AuditModuleDAO auditModuleDAO; + + @Override + public List obtenerTodos() { + return auditModuleDAO.obtenerTodos(); + } + + @Override + public AuditModule obtenerID(Long id) { + // TODO Auto-generated method stub + return null; + } + + @Override + public AuditModule suscribir(AuditModule entidad) { + // TODO Auto-generated method stub + return null; + } + + @Override + public AuditModule actualizacion(AuditModule entidad) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void borrar(AuditModule entidad) { + // TODO Auto-generated method stub + + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AuditServiceServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AuditServiceServiceImpl.java new file mode 100644 index 000000000..46df8f029 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AuditServiceServiceImpl.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.AuditServiceDAO; +import com.rjconsultores.ventaboletos.entidad.AuditService; +import com.rjconsultores.ventaboletos.service.AuditServiceService; + +@Service("auditServiceService") +public class AuditServiceServiceImpl implements AuditServiceService { + + @Autowired + private AuditServiceDAO auditServiceDAO; + + @Override + public List obtenerTodos() { + return auditServiceDAO.obtenerTodos(); + } + + @Override + public AuditService obtenerID(Long id) { + return auditServiceDAO.obtenerID(id); + } + + @Override + public AuditService suscribir(AuditService entidad) { + return auditServiceDAO.suscribir(entidad); + } + + @Override + public AuditService actualizacion(AuditService entidad) { + return auditServiceDAO.actualizacion(entidad); + } + + @Override + public void borrar(AuditService entidad) { + auditServiceDAO.borrar(entidad); + } + + @Override + public AuditService carregarService(AuditService auditService) { + return auditServiceDAO.carregarService(auditService); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AutobusDocServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AutobusDocServiceImpl.java new file mode 100644 index 000000000..165089617 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AutobusDocServiceImpl.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AutobusDocDAO; +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.AutobusDoc; +import com.rjconsultores.ventaboletos.service.AutobusDocService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("autobusDocService") +public class AutobusDocServiceImpl implements AutobusDocService { + + @Autowired + private AutobusDocDAO autobusDocDAO; + + public List obtenerTodos() { + return autobusDocDAO.obtenerTodos(); + } + + public AutobusDoc obtenerID(Integer id) { + return autobusDocDAO.obtenerID(id); + } + + public List obtenerPorAutobus(Autobus autobus){ + return autobusDocDAO.obtenerPorAutobus(autobus); + } + + @Transactional + public AutobusDoc suscribir(AutobusDoc entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autobusDocDAO.suscribir(entidad); + } + + @Transactional + public AutobusDoc actualizacion(AutobusDoc entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autobusDocDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(AutobusDoc entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + autobusDocDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AutobusServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AutobusServiceImpl.java new file mode 100644 index 000000000..a05d846e0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AutobusServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AutobusDAO; +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.service.AutobusService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("autobusService") +public class AutobusServiceImpl implements AutobusService { + + @Autowired + private AutobusDAO autobusDAO; + public List obtenerTodos() { + return autobusDAO.obtenerTodos(); + } + + public Autobus obtenerID(Integer id) { + return autobusDAO.obtenerID(id); + } + + @Transactional + public Autobus suscribir(Autobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autobusDAO.suscribir(entidad); + } + + @Transactional + public Autobus actualizacion(Autobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autobusDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Autobus entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + autobusDAO.actualizacion(entidad); + } + + public List buscar(String numautobus, DiagramaAutobus diagramaAutobus) { + return autobusDAO.buscar(numautobus, diagramaAutobus); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AutorizaFolioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AutorizaFolioServiceImpl.java new file mode 100644 index 000000000..18eaec354 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AutorizaFolioServiceImpl.java @@ -0,0 +1,286 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Articulo; +import com.rjconsultores.ventaboletos.entidad.Clasificacion; +import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.EstacionImpresora; +import com.rjconsultores.ventaboletos.entidad.FolioPreimpreso; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.RequisicionBoleto; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; +import com.rjconsultores.ventaboletos.service.AbastoBoletoService; +import com.rjconsultores.ventaboletos.service.ArticuloService; +import com.rjconsultores.ventaboletos.service.AutorizaFolioService; +import com.rjconsultores.ventaboletos.service.DetAbastoBoletoService; +import com.rjconsultores.ventaboletos.service.FolioPreimpresoService; +import com.rjconsultores.ventaboletos.service.RequisicionBoletoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("autorizaFolioService") +public class AutorizaFolioServiceImpl implements AutorizaFolioService { + // Numero max de folios por estacion + public static final Integer MAX_CANT_FOLIOS = Integer.MAX_VALUE; + public static final Integer INICIO_FOLIO = 1; + + @Autowired + private ArticuloService articuloService; + @Autowired + private RequisicionBoletoService requisicionBoletoService; + @Autowired + private AbastoBoletoService abastoBoletoService; + @Autowired + private DetAbastoBoletoService detAbastoBoletoService; + @Autowired + private FolioPreimpresoService folioPreimpresoService; + + @Override + public void devolverFoliosAutomaticosImpressoraFiscal(final EstacionImpresora ei) { + + Empresa empresa = ei.getEmpresa(); + FolioPreimpreso folio = folioPreimpresoService.buscaFolioPreImpressoEstacionImpresora(ei.getEstacion(), empresa); + + if (folio != null) { + List lsDetAbasto = detAbastoBoletoService.buscabDetAbastoBoletoAutomatico(ei.getEstacion(), folio.getNumeserie()); + if (!lsDetAbasto.isEmpty()) { + + DetAbastoBoleto dab = lsDetAbasto.get(0); + + abastoBoletoService.borrar(dab.getAbastoBoleto()); + detAbastoBoletoService.borrar(dab); + folioPreimpresoService.borrar(folio); + } + } + } + + @Override + public Boolean noChequeFolioPreimpresos(Aidf aidf, Estacion origem, Estacion destino, String numfolioinicial, String numfoliofinal, String numseriepreimpresa, + Empresa empresaUsuario, TipoMovimentacion tipoMovimentacion) { + + if (TipoMovimentacion.TIPO_ENVIO == tipoMovimentacion.getTipomovimentacionId() || + TipoMovimentacion.TIPO_TRANSFERENCIA == tipoMovimentacion.getTipomovimentacionId()) { + + FolioPreimpreso folio = folioPreimpresoService.buscaFolioPreImpressoEstacionImpresora(destino, empresaUsuario); + + RequisicionBoleto requisicionBoleto = geraRequisicionBoleto(aidf, destino, empresaUsuario); + AbastoBoleto abastoBoleto = geraAbastoBoleto(requisicionBoleto); + DetAbastoBoleto detAbastoBoleto = geraDetAbastoBoleto(abastoBoleto, numfolioinicial, numfoliofinal, numseriepreimpresa); + actualizaStatusRequisicion(requisicionBoleto); + + if (folio == null) { + FolioPreimpreso folioPreimpreso = geraFolioPreimpreso(detAbastoBoleto, numfolioinicial); + + if (folioPreimpreso.getFoliopreimpresoId() == null) + return Boolean.FALSE; + + } else { + actualizaFolioPreimpreso(folio, numseriepreimpresa, numfolioinicial); + } + } + + if (TipoMovimentacion.TIPO_TRANSFERENCIA == tipoMovimentacion.getTipomovimentacionId() || + TipoMovimentacion.TIPO_VOLVER == tipoMovimentacion.getTipomovimentacionId() || + TipoMovimentacion.TIPO_PERDIDO == tipoMovimentacion.getTipomovimentacionId()) + + detAbastoBoletoService.desabilitaDetAbastos(origem, numfolioinicial, numfoliofinal, numseriepreimpresa); + + return Boolean.TRUE; + + } + + private RequisicionBoleto geraRequisicionBoleto(Aidf aidf, Estacion estacion, Empresa empresa) { + + Articulo articulo = articuloService.obtenerID(aidf.getAidfTipo().getAidftipoId()); + Clasificacion clasificacion = articulo.getClasificacion(); + + PuntoVenta puntoVenta = estacion.getPuntoVenta(); + + RequisicionBoleto requisicionBoleto = new RequisicionBoleto(); + requisicionBoleto.setArticulo(articulo); + requisicionBoleto.setCantfajilla(1L); + requisicionBoleto.setClasificacion(clasificacion); + requisicionBoleto.setEstacion(estacion); + requisicionBoleto.setPuntoVenta(puntoVenta); + requisicionBoleto.setStatusenvio(Boolean.TRUE); + requisicionBoleto.setEmpresa(empresa); + + return requisicionBoletoService.suscribir(requisicionBoleto); + } + + private DetAbastoBoleto geraDetAbastoBoleto(AbastoBoleto abastoBoleto, String numfolioinicial, String numfoliofinal, String numseriepreimpresa) { + + Integer statusoperacion = 1; + Long nummovimiento = detAbastoBoletoService.getSecuencia(); + + DetAbastoBoleto detAbastoBoleto = new DetAbastoBoleto(); + detAbastoBoleto.setAbastoBoleto(abastoBoleto); + detAbastoBoleto.setNummovimiento(nummovimiento); + detAbastoBoleto.setNumseriepreimpresa(numseriepreimpresa.trim()); + detAbastoBoleto.setNumfolioinicial(numfolioinicial.trim()); + detAbastoBoleto.setNumfoliofinal(numfoliofinal.trim()); + detAbastoBoleto.setStatusfirma(Boolean.TRUE); + detAbastoBoleto.setStatusoperacion(statusoperacion); + detAbastoBoleto.setStatusenvio(Boolean.TRUE); + + return detAbastoBoletoService.suscribir(detAbastoBoleto); + } + + private void actualizaStatusRequisicion(RequisicionBoleto requisicionBoleto) { + requisicionBoleto.setStatusenvio(Boolean.FALSE); + requisicionBoletoService.actualizacion(requisicionBoleto); + } + + private FolioPreimpreso geraFolioPreimpreso(DetAbastoBoleto detAbastoBoleto, String numfoliopreimpreso) { + + AbastoBoleto abastoBoleto = detAbastoBoleto.getAbastoBoleto(); + + FolioPreimpreso folioPreimpreso = new FolioPreimpreso(); + folioPreimpreso.setEmpresa(abastoBoleto.getEmpresa()); + folioPreimpreso.setEstacion(abastoBoleto.getEstacion()); + folioPreimpreso.setFoliopreimpreso(numfoliopreimpreso); + folioPreimpreso.setNodoId(1); + folioPreimpreso.setNumeserie(detAbastoBoleto.getNumseriepreimpresa()); + folioPreimpreso.setPuntoVenta(abastoBoleto.getPuntoventa()); + folioPreimpreso.setIndreplica(NumberUtils.LONG_ZERO); + + return folioPreimpresoService.suscribir(folioPreimpreso); + } + + private FolioPreimpreso actualizaFolioPreimpreso(FolioPreimpreso folioPreimpreso, String serieFoliopreimpreso, String numfoliopreimpreso) { + + folioPreimpreso.setFoliopreimpreso(numfoliopreimpreso); + folioPreimpreso.setNumeserie(serieFoliopreimpreso); + + return folioPreimpresoService.actualizacion(folioPreimpreso); + } + + @Override + public String noChequeFolioPreimpresos(EstacionImpresora estacionImpresora, boolean isImpressoraFiscal) { + + Empresa empresa = estacionImpresora.getEmpresa(); + FolioPreimpreso folio = folioPreimpresoService.buscaFolioPreImpressoEstacionImpresora(estacionImpresora.getEstacion(), empresa); + + // condição para qd o folio foi gerado indevidamente pelo cliente de venda. + // antes de a rotina abaixo ter sido executada se o numserie é 0, é um folio inválido + if ((folio != null) && (folio.getNumeserie().equals("0"))) { + folioPreimpresoService.borrar(folio); + folio = null; + } + + if ((folio != null) && isImpressoraFiscal) { + return "estacionServiceImpl.msg.noChequeFolioPreimpresos"; + } + + if (folio == null && estacionImpresora.getEstacionCentral() == null) { + RequisicionBoleto requisicionBoleto = geraRequisicionBoleto(estacionImpresora.getEstacion(), empresa); + AbastoBoleto abastoBoleto = geraAbastoBoleto(requisicionBoleto); + DetAbastoBoleto detAbastoBoleto = geraDetAbastoBoleto(abastoBoleto); + actualizaStatusRequisicion(requisicionBoleto); + + FolioPreimpreso folioPreimpreso = geraFolioPreimpreso(detAbastoBoleto); + if (folioPreimpreso.getFoliopreimpresoId() == null) { + return "MSG.Error"; + } + } + + return StringUtils.EMPTY; + } + + private RequisicionBoleto geraRequisicionBoleto(Estacion estacion, Empresa empresa) { + + Articulo articulo = articuloService.obtenerID(Articulo.TIPO_VENDA); + Clasificacion clasificacion = articulo.getClasificacion(); + + PuntoVenta puntoVenta = estacion.getPuntoVenta(); + + RequisicionBoleto requisicionBoleto = new RequisicionBoleto(); + requisicionBoleto.setArticulo(articulo); + requisicionBoleto.setCantfajilla(1L); + requisicionBoleto.setClasificacion(clasificacion); + requisicionBoleto.setEstacion(estacion); + requisicionBoleto.setPuntoVenta(puntoVenta); + requisicionBoleto.setStatusenvio(Boolean.TRUE); + requisicionBoleto.setEmpresa(empresa); + + return requisicionBoletoService.suscribir(requisicionBoleto); + } + + private AbastoBoleto geraAbastoBoleto(RequisicionBoleto requisicionBoleto) { + + Date fechaHrReq = requisicionBoleto.getFecmodif(); + + Date now = Calendar.getInstance().getTime(); + + Long numRequisicion = Long.parseLong(requisicionBoleto.getRequisicionboletoId().toString()); + + AbastoBoleto abastoboleto = new AbastoBoleto(); + abastoboleto.setNumservidor(1); + abastoboleto.setNumrequisicion(numRequisicion); + abastoboleto.setCantfajilla(requisicionBoleto.getCantfajilla()); + abastoboleto.setEstacion(requisicionBoleto.getEstacion()); + abastoboleto.setArticulo(requisicionBoleto.getArticulo()); + abastoboleto.setClasificacion(requisicionBoleto.getClasificacion()); + abastoboleto.setPuntoventa(requisicionBoleto.getPuntoVenta()); + abastoboleto.setPuntoventacentral(requisicionBoleto.getPuntoVenta()); + abastoboleto.setEmpresa(requisicionBoleto.getEmpresa()); + abastoboleto.setFechorreq(fechaHrReq); + abastoboleto.setStatusfirma(2); + abastoboleto.setStatusEnvio(1); + abastoboleto.setUsuarioreqId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + abastoboleto.setFechorfirma(now); + abastoboleto.setFechorgeneracion(now); + abastoboleto.setUsuariogeneracionId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + return abastoBoletoService.suscribir(abastoboleto); + } + + private DetAbastoBoleto geraDetAbastoBoleto(AbastoBoleto abastoBoleto) { + + Long nummovimiento = detAbastoBoletoService.getSecuencia(); + + Integer statusoperacion = 1; + String numseriepreimpresa = nummovimiento.toString() + abastoBoleto.getEmpresa().getEmpresaId().toString(); + String numfolioinicial = INICIO_FOLIO.toString(); + String numfoliofinal = MAX_CANT_FOLIOS.toString(); + + DetAbastoBoleto detAbastoBoleto = new DetAbastoBoleto(); + detAbastoBoleto.setAbastoBoleto(abastoBoleto); + detAbastoBoleto.setNummovimiento(nummovimiento); + detAbastoBoleto.setNumseriepreimpresa(numseriepreimpresa.trim()); + detAbastoBoleto.setNumfolioinicial(numfolioinicial.trim()); + detAbastoBoleto.setNumfoliofinal(numfoliofinal.trim()); + detAbastoBoleto.setStatusfirma(Boolean.TRUE); + detAbastoBoleto.setStatusoperacion(statusoperacion); + detAbastoBoleto.setStatusenvio(Boolean.TRUE); + + return detAbastoBoletoService.suscribir(detAbastoBoleto); + } + + private FolioPreimpreso geraFolioPreimpreso(DetAbastoBoleto detAbastoBoleto) { + + AbastoBoleto abastoBoleto = detAbastoBoleto.getAbastoBoleto(); + + FolioPreimpreso folioPreimpreso = new FolioPreimpreso(); + folioPreimpreso.setEmpresa(abastoBoleto.getEmpresa()); + folioPreimpreso.setEstacion(abastoBoleto.getEstacion()); + folioPreimpreso.setFoliopreimpreso(INICIO_FOLIO.toString()); + folioPreimpreso.setNodoId(1); + folioPreimpreso.setNumeserie(detAbastoBoleto.getNumseriepreimpresa()); + folioPreimpreso.setPuntoVenta(abastoBoleto.getPuntoventa()); + folioPreimpreso.setIndreplica(NumberUtils.LONG_ZERO); + + return folioPreimpresoService.suscribir(folioPreimpreso); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AutorizacionPerfilServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AutorizacionPerfilServiceImpl.java new file mode 100644 index 000000000..3cf2b3431 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AutorizacionPerfilServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.AutorizacionPerfilDAO; +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import com.rjconsultores.ventaboletos.entidad.AutorizacionPerfil; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import com.rjconsultores.ventaboletos.service.AutorizacionPerfilService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("autorizacionPerfilService") +public class AutorizacionPerfilServiceImpl implements AutorizacionPerfilService { + + @Autowired + private AutorizacionPerfilDAO autorizacionPerfilDAO; + + public List obtenerTodos() { + return autorizacionPerfilDAO.obtenerTodos(); + } + + public AutorizacionPerfil obtenerID(Integer id) { + return autorizacionPerfilDAO.obtenerID(id); + } + + @Transactional + public AutorizacionPerfil suscribir(AutorizacionPerfil entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autorizacionPerfilDAO.suscribir(entidad); + } + + @Transactional + public AutorizacionPerfil actualizacion(AutorizacionPerfil entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autorizacionPerfilDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(AutorizacionPerfil entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + autorizacionPerfilDAO.actualizacion(entidad); + } + + public List buscar(Autorizacion autorizacion, Perfil perfil) { + return autorizacionPerfilDAO.buscar(autorizacion, perfil); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AutorizacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AutorizacionServiceImpl.java new file mode 100644 index 000000000..feed90bdb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AutorizacionServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.AutorizacionDAO; +import com.rjconsultores.ventaboletos.entidad.Autorizacion; +import com.rjconsultores.ventaboletos.service.AutorizacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("autorizacionService") +public class AutorizacionServiceImpl implements AutorizacionService { + + @Autowired + private AutorizacionDAO autorizacionDAO; + + public List obtenerTodos() { + return autorizacionDAO.obtenerTodos(); + } + + public Autorizacion obtenerID(Integer id) { + return autorizacionDAO.obtenerID(id); + } + + @Transactional + public Autorizacion suscribir(Autorizacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autorizacionDAO.suscribir(entidad); + } + + @Transactional + public Autorizacion actualizacion(Autorizacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return autorizacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Autorizacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + autorizacionDAO.actualizacion(entidad); + } + + public List buscar(String nombautorizacion, String descautorizacion) { + return autorizacionDAO.buscar(nombautorizacion, descautorizacion); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/BancoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/BancoServiceImpl.java new file mode 100644 index 000000000..cc972dd03 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/BancoServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.BancoDAO; +import com.rjconsultores.ventaboletos.entidad.Banco; +import com.rjconsultores.ventaboletos.service.BancoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("bancoService") +public class BancoServiceImpl implements BancoService { + + @Autowired + private BancoDAO bancoDAO; + + public List obtenerTodos() { + return bancoDAO.obtenerTodos(); + } + + public Banco obtenerID(Integer id) { + return bancoDAO.obtenerID(id); + } + + @Transactional + public Banco suscribir(Banco entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return bancoDAO.suscribir(entidad); + } + + @Transactional + public Banco actualizacion(Banco entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return bancoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Banco entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + bancoDAO.actualizacion(entidad); + } + + public List buscar(Banco banco) { + return bancoDAO.buscar(banco); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/BoletoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/BoletoServiceImpl.java new file mode 100644 index 000000000..81d491d57 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/BoletoServiceImpl.java @@ -0,0 +1,168 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.Date; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.dao.BoletoDAO; +import com.rjconsultores.ventaboletos.entidad.Boleto; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.service.BoletoService; +import com.rjconsultores.ventaboletos.service.PuntoVentaService; +import com.rjconsultores.ventaboletos.service.RutaCombinacionService; +import com.rjconsultores.ventaboletos.service.UsuarioService; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; + +/** + * + * @author Fabricio + */ +@Service("boletoService") +public class BoletoServiceImpl implements BoletoService { + + @Autowired + private BoletoDAO boletoDAO; + + + @Autowired + private PuntoVentaService puntoVentaService; + + @Autowired + private UsuarioService usuarioService; + + @Autowired + private RutaCombinacionService rutaCombinacionService; + + + public Boleto buscarPeloImeiDoDispositivo(String imei) { + return boletoDAO.buscarPeloImeiDoDispositivo(imei); + } + + @Override + @Transactional + public Boleto suscribir(Boleto boleto) { + return boletoDAO.suscribir(boleto); + } + + @Override + @Transactional + public void criaBoletoReserva(String unoAsientoSelec, Integer unaCorridaId, Date unaFecCorrida, + Integer unoTerminalOrigenId, Integer unoTerminalDestinoId, Integer unoTipoVenta, Integer unaCategoriaSelec, + String unoNumeOperacion, Integer unUsuarioId, Integer unPuntoVenta, + Integer unClienteId, Integer rutaId, Float tarifa, Long tempoReserva, + Integer estacionId, String docCPF, String numFidelidade, Integer claseservicioId, Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro) throws Exception { + + PuntoVenta miPuntoVenta = puntoVentaService.obtenerID(unPuntoVenta.intValue()); + + Boleto miBoletoTemporal = new Boleto(); + BigDecimal miPrecio = MoneyHelper.arredondar(tarifa) ; + miBoletoTemporal = new Boleto(); + miBoletoTemporal.setBoletoId(formataBoletoId(getSequenciaBoletoId())); + miBoletoTemporal.setBoletooriginalId(miBoletoTemporal.getBoletoId()); + // Sempre Categoria Normal (1) + miBoletoTemporal.setCategoriaId(Constantes.TPV_DIRECTO_NORMAL.intValue() ); + miBoletoTemporal.setClienteId(unClienteId); + miBoletoTemporal.setClaseservicioId(claseservicioId.byteValue()); + miBoletoTemporal.setDestinoId(unoTerminalDestinoId); + miBoletoTemporal.setDesctipodoc("CPF"); + miBoletoTemporal.setDescnumdoc(docCPF); + miBoletoTemporal.setEmpresacorridaId(empresaCorridaId); + miBoletoTemporal.setEmpresapuntoventaId(miPuntoVenta.getEmpresa().getEmpresaId()); + miBoletoTemporal.setEstacionId(estacionId); + miBoletoTemporal.setFeccreacion(new Date()); + miBoletoTemporal.setFecmodif(new Date()); + miBoletoTemporal.setFechorventa(new Date()); + miBoletoTemporal.setFechorventaH(new Date()); + miBoletoTemporal.setFechorviaje(fecViaje); + miBoletoTemporal.setFeccorrida(unaFecCorrida); + miBoletoTemporal.setCorridaId(unaCorridaId); + miBoletoTemporal.setIndcancelacion(Boolean.FALSE); + miBoletoTemporal.setIndreimpresion(Boolean.FALSE); + miBoletoTemporal.setIndextraviado(Boolean.FALSE); + miBoletoTemporal.setIndstatusoperacion("F"); + miBoletoTemporal.setIndcancelacion(Boolean.FALSE); + miBoletoTemporal.setIndreplica(Boolean.FALSE); + miBoletoTemporal.setIndstatusboleto("S"); + miBoletoTemporal.setIndreimpresion(Boolean.FALSE); + miBoletoTemporal.setImportetaxaembarque(BigDecimal.ZERO); + miBoletoTemporal.setImporteseguro(BigDecimal.ZERO); + miBoletoTemporal.setImportepedagio(BigDecimal.ZERO); + miBoletoTemporal.setImporteoutros(BigDecimal.ZERO); + miBoletoTemporal.setMarcaId(marcaId); + miBoletoTemporal.setMonedaId(1); + miBoletoTemporal.setNodoId((byte) 1); + miBoletoTemporal.setNumkmviaje( + calcularKmViaje(rutaId, unoTerminalOrigenId, unoTerminalDestinoId)); + miBoletoTemporal.setNombpasajero(nombPassageiro); + miBoletoTemporal.setNumasiento(unoAsientoSelec); + miBoletoTemporal.setNumfidelidad(numFidelidade); + miBoletoTemporal.setNumoperacion(formataNumOperacion(getSequenciaNumOperacion())); + miBoletoTemporal.setNumreservacion(formataNumReservacion(getSequenciaNumReservacion())); + miBoletoTemporal.setOrigenId(unoTerminalOrigenId); + miBoletoTemporal.setPreciopricing(BigDecimal.ZERO); + miBoletoTemporal.setPorccategoria(null); + miBoletoTemporal.setPreciopagado(miPrecio); + miBoletoTemporal.setPreciobase(miPrecio); + miBoletoTemporal.setPuntoVenta(miPuntoVenta); + miBoletoTemporal.setPtovtaventaId(miPuntoVenta.getPuntoventaId()); + miBoletoTemporal.setRutaId(rutaId); + miBoletoTemporal.setTemporeservafidelidade(tempoReserva!=null ? tempoReserva.intValue() : 0); + miBoletoTemporal.setTipoventaId(unoTipoVenta.byteValue()); + Usuario usuario = usuarioService.obtenerID(unUsuarioId); + miBoletoTemporal.setUsuarioautorizacionId(usuario.getUsuarioUbicacionActivoList().get(0).getUsuarioubicacionId()); + miBoletoTemporal.setUsuario(usuario); + miBoletoTemporal.setActivo(true); + // Cria boleto de reserva + boletoDAO.insertBoletoRserva(miBoletoTemporal); + + } + + public BigDecimal calcularKmViaje(int rutaId, Integer unoOrigenId, Integer unoDestinoId) { + RutaCombinacion rutaCombinacion = rutaCombinacionService.busquedaTramoRutaOrigemDestino(rutaId, unoOrigenId, unoDestinoId); + return rutaCombinacion.getTramo().getKmReal(); + + } + + String getSequenciaBoletoId(){ + return boletoDAO.getSequenciaBoletoId(); + } + + String getSequenciaNumOperacion(){ + return boletoDAO.getSequenciaNumOperacion(); + } + + String getSequenciaNumReservacion(){ + return boletoDAO.getSequenciaNumReservacion(); + } + + /** + * Foemata boleto Id com 15 dígitos conforme Totalbus + * @param boletoSeq + * @return + */ + public Long formataBoletoId(String boletoSeq){ + String valor = "1" + String.format("%013d", Integer.valueOf(boletoSeq).intValue()); + return Long.valueOf(valor); + } + + public String formataNumOperacion(String numOperacionSeq){ + return "01" + (String.format("%010d", Integer.valueOf(numOperacionSeq).intValue())); + } + + public String formataNumReservacion(String numReservacopnSeq){ + return "01" + (String.format("%010d", Integer.valueOf(numReservacopnSeq).intValue())); + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/BpeServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/BpeServiceImpl.java new file mode 100644 index 000000000..1c8b488bf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/BpeServiceImpl.java @@ -0,0 +1,154 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.InputStream; +import java.sql.Connection; +import java.sql.SQLException; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.sql.DataSource; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.datasource.DataSourceUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.BpeDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.BpeService; +import com.rjconsultores.ventaboletos.utilerias.exportacao.ExportacaoBpe; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.ExportacaoBPEVo; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.xml.BPeUtil; +import com.rjconsultores.ventaboletos.utilerias.fiscal.vo.FiscalRdi; +import com.rjconsultores.ventaboletos.vo.bpe.BPeVO; + +@Service("bpeService") +public class BpeServiceImpl implements BpeService { + private static Logger log = Logger.getLogger(BpeServiceImpl.class); + + @Autowired + private BpeDAO bpeDAO; + + @Autowired + private ExportacaoBpe exportacaoBpe; + + @Autowired + private DataSource dataSourceRead; + + @Override + public List buscarBpeRDI(Date inicio, Date fim, Empresa empresa, List estados, boolean isReceitaTerceiros, boolean consultaOtimizada) { + Connection connection = null; + try { + connection = getConnectionRead(); + return bpeDAO.buscarBpeRDI(connection, inicio, fim, empresa.getEmpresaId(), estados, isReceitaTerceiros, consultaOtimizada); + } catch (Exception e) { + log.error("", e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public String buscarArquivoExportacaoBPE(Date inicio, Date fim, Empresa empresa, Estado estado, String nomeArquivo, boolean consultaOtimizada) { + Connection connection = null; + + try { + connection = getConnectionRead(); + ExportacaoBPEVo registro = bpeDAO.buscarRegistroExportacaoBpe(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado(), consultaOtimizada, empresa.getCodContPrevidencia()); + + return exportacaoBpe.gerarArquivoBPE(inicio, fim, nomeArquivo, empresa.getNombempresa(), registro); + + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + + throw new RuntimeException(e); + } + } + } + + @Override + public String buscarXmlBPE(String chBpe) { + Connection connection = null; + try { + connection = getConnectionRead(); + return bpeDAO.buscarXmlBPE(connection, chBpe); + + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + + throw new RuntimeException(e); + } + } + } + + private Connection getConnectionRead() { + return DataSourceUtils.getConnection(dataSourceRead); + } + + @Override + @Transactional + public List buscarBPeRejeitadosContingencia(Integer empresaId, String numBpe, String chbpe, Date dtVendaInicio, Date dtVendaFim, List estados, List codigosRejeicoes) { + return bpeDAO.buscarBPeRejeitadosContingencia(empresaId, numBpe, chbpe, dtVendaInicio, dtVendaFim, estados, codigosRejeicoes); + } + + @Override + @Transactional + public void definirBPeRejeitadoSefazReenvio(List bpesReenvio) throws BusinessException { + for (BPeVO bpe : bpesReenvio) { + bpeDAO.definirBPeRejeitadoSefazReenvio(bpe.getBpeId(), bpe.getCodstat()); + } + } + + @Override + public List buscarBPeVendaEEventosAutorizados(Integer empresaId, Date dtVendaInicio, Date dtVendaFim, Integer estadoId) { + return bpeDAO.buscarBPeVendaEEventosAutorizados(empresaId, dtVendaInicio, dtVendaFim, estadoId); + } + + @Override + public byte[] extrairXmlsBPe(List bpes) { + if(bpes != null && !bpes.isEmpty()) { + Map arquivos = new HashMap(); + for (BPeVO bpe : bpes) { + Map arquivo = null; + if(StringUtils.isNotBlank(bpe.getTipoevento())) { + arquivo = BPeUtil.convertBPeXmlRegularEventoToArquivoXml(bpe); + arquivos.put(arquivo.entrySet().iterator().next().getKey(), arquivo.entrySet().iterator().next().getValue()); + arquivo = BPeUtil.convertBPeXmlRepostaEventoToArquivoXml(bpe); + arquivos.put(arquivo.entrySet().iterator().next().getKey(), arquivo.entrySet().iterator().next().getValue()); + } else { + arquivo = BPeUtil.convertBPeXmlRegularToArquivoXml(bpe); + arquivos.put(arquivo.entrySet().iterator().next().getKey(), arquivo.entrySet().iterator().next().getValue()); + arquivo = BPeUtil.convertBPeXmlRepostaToArquivoXml(bpe); + arquivos.put(arquivo.entrySet().iterator().next().getKey(), arquivo.entrySet().iterator().next().getValue()); + } + } + return BPeUtil.zipFiles(arquivos); + } + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CalcularPeajeServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CalcularPeajeServiceImpl.java new file mode 100644 index 000000000..b73cf3d94 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CalcularPeajeServiceImpl.java @@ -0,0 +1,36 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CalcularPeajeDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.CalcularPeajeService; + +@Service("calcularPeajeService") +public class CalcularPeajeServiceImpl implements CalcularPeajeService{ + + @Autowired + private CalcularPeajeDAO calcularPeajeDAO; + + @Override + public List buscarCasetasPeajeWithinTramo(Ruta ruta){ + return calcularPeajeDAO.buscarCasetasPeajeWithinTramo(ruta); + } + + @Override + public List buscarRutaWithCasetaPeajeFromOrgao(OrgaoConcedente oc){ + return calcularPeajeDAO.buscarRutaWithCasetaPeajeFromOrgao(oc); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao, boolean usaICMS) throws Exception { + return calcularPeajeDAO.gerarSQLInserirPeajes(lsRuta, orgao, usaICMS); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CalculoComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CalculoComissaoServiceImpl.java new file mode 100644 index 000000000..9b3c52657 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CalculoComissaoServiceImpl.java @@ -0,0 +1,1687 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.ByteArrayOutputStream; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.BooleanUtils; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.constantes.TipoEventoExtra; +import com.rjconsultores.ventaboletos.dao.ComissaoDAO; +import com.rjconsultores.ventaboletos.dao.ConferenciaComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.Comissao; +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.DescontoComissao; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailConfig; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; +import com.rjconsultores.ventaboletos.entidad.PtovtaComissao; +import com.rjconsultores.ventaboletos.entidad.PtovtaComissao.Receita; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enums.CtrlFechamentoCaixaStatus; +import com.rjconsultores.ventaboletos.enums.IndStatusBoleto; +import com.rjconsultores.ventaboletos.enums.MimeType; +import com.rjconsultores.ventaboletos.enums.ModeloComissaoImpressaoPosterior; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.ComissaoException; +import com.rjconsultores.ventaboletos.service.CalculoComissaoService; +import com.rjconsultores.ventaboletos.service.ComissaoReceitaService; +import com.rjconsultores.ventaboletos.service.ComissaoService; +import com.rjconsultores.ventaboletos.service.ConferenciaComissaoService; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.service.CtrlFechamentoCaixaService; +import com.rjconsultores.ventaboletos.service.DescontoComissaoService; +import com.rjconsultores.ventaboletos.service.EmpresaEmailConfigService; +import com.rjconsultores.ventaboletos.service.EmpresaImpostoService; +import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.service.PtovtaComissaoService; +import com.rjconsultores.ventaboletos.service.PuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; +import com.rjconsultores.ventaboletos.utilerias.SendMail; +import com.rjconsultores.ventaboletos.utilerias.SendMail.AuthType; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.ComissaoDesconto; +import com.rjconsultores.ventaboletos.vo.comissao.ComissaoDesconto.TipoDesconto; +import com.rjconsultores.ventaboletos.vo.comissao.ComissaoLogVO; +import com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita; +import com.rjconsultores.ventaboletos.vo.comissao.EmailConfigVO; +import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO; +import com.rjconsultores.ventaboletos.vo.comissao.FormapagoVO; +import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.RegistroCalculo; + +@Service("calculoComissaoService") +public class CalculoComissaoServiceImpl implements CalculoComissaoService { + + private static final Logger log = LoggerFactory.getLogger(CalculoComissaoServiceImpl.class); + private static final BigDecimal CEM = BigDecimal.TEN.multiply(BigDecimal.TEN); + + @Autowired + private PtovtaComissaoService ptovtaComissaoService; + + @Autowired + private EmpresaImpostoService empresaImpostoService; + + @Autowired + private ComissaoService comissaoService; + + @Autowired + private ComissaoDAO comissaoDAO; + + @Autowired + private ConferenciaComissaoDAO conferenciaComissaoDAO; + + @Autowired + private ConferenciaComissaoService conferenciaComissaoService; + + @Autowired + private DescontoComissaoService descontoComissaoService; + + @Autowired + private ConstanteService constanteService; + + @Autowired + private ComissaoReceitaService comissaoReceitaService; + + @Autowired + private EmpresaService empresaService; + + @Autowired + private PuntoVentaService puntoVentaService; + + @Autowired + private CtrlFechamentoCaixaService ctrlFechamentoCaixaService; + + @Autowired + private EmpresaEmailConfigService empresaEmailConfigService; + + public boolean validaCompetencia(Date periodo) { + Calendar calendario = Calendar.getInstance(); + calendario.setTime(periodo); + + int mes = calendario.get(Calendar.MONTH) + 1; + int ano = calendario.get(Calendar.YEAR); + + Calendar now = Calendar.getInstance(); + int mesNow = now.get(Calendar.MONTH) + 1; + int anoNow = now.get(Calendar.YEAR); + + if (anoNow == ano) { + if (mesNow > mes) { + return true; + } + + } else if (anoNow > ano) { + return true; + } + + return false; + } + + public boolean validaPeriodo(Date dataInicial, Date dataFinal) { + Calendar cal = Calendar.getInstance(); + cal.setTime(dataInicial); + int monthInicial = cal.get(Calendar.MONTH); + int yearInicial = cal.get(Calendar.YEAR); + + cal.setTime(dataFinal); + int monthFinal = cal.get(Calendar.MONTH); + int yearFinal = cal.get(Calendar.YEAR); + + if(monthInicial != monthFinal || yearFinal != yearInicial){ + return false; + } + + return true; + } + + @Override + public void registrarCalculoComissao(PuntoVenta puntoVenta, Empresa empresa, Date periodo, boolean ignorarComissaoGerada, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException { + + try { + + if (validaCompetencia(periodo)) { + + String competencia = DateUtil.getStringDate(periodo, "MM/yyyy"); + + if(isRetencaoDiaria || conferenciaComissaoService.isConferenciaCompetenciaEncerrada(competencia, empresa, puntoVenta, false)) { + Comissao comissaoCadastrada = comissaoDAO.buscaComissaoVigencia(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), competencia); + if (comissaoCadastrada == null) { + + RegistroCalculo rc = realizarCalculoComissao(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), periodo, isRetencaoDiaria, usuarioId, isRefazerCalculo); + + gravarComissao(puntoVenta, empresa, rc, competencia, null, null); + } else if(!ignorarComissaoGerada){ + throw new ComissaoException("busquedaCalculoComissaoController.registro.exception", null, comissaoCadastrada.getPuntoVenta().getNombpuntoventa()); + } + } else { + throw new ComissaoException("busquedaCalculoComissaoController.conferenciaNaoEncerrada.exception", null, puntoVenta.getNombpuntoventa()); + } + } else { + throw new ComissaoException("busquedaCalculoComissaoController.competencia.exception"); + } + + } catch (ComissaoException e) { + log.error(e.getMessage(), e); + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new ComissaoException(e.getMessage(), e); + } + } + + /** + * Grava a comissao gerada + * @param puntoVenta + * @param empresa + * @param registroCalculo + * @param competencia + * @throws ComissaoException + */ + private void gravarComissao(PuntoVenta puntoVenta, Empresa empresa, RegistroCalculo registroCalculo, String competencia, Date dataInicial, Date dataFinal) throws ComissaoException { + try { + Comissao comissao = new Comissao(); + + if(StringUtils.isNotBlank(competencia)) { + comissao.setCompetencia(competencia); + } else if(dataInicial != null && dataFinal != null){ + comissao.setDataInicial(dataInicial); + comissao.setDataFinal(dataFinal); + } + + comissao.setEmpresaId(empresa.getEmpresaId()); + comissao.setPuntoVenta(puntoVenta); + comissao.setBonificacaoMetas(registroCalculo.getComissaoBonificaoMetas()); + comissao.setComissaoBpr(registroCalculo.getComissaoBPR()); + comissao.setEntregasPassagem(registroCalculo.getComissaoEntregaPassagem()); + comissao.setReceitaExcessobagagem(registroCalculo.getComissaoExcessoBagagem()); + comissao.setReceitaSeguroopcional(registroCalculo.getComissaoSegOpcional()); + comissao.setReceitaSeguro(registroCalculo.getComissaoSeguro()); + comissao.setReceitaOutros(registroCalculo.getComissaoOutros()); + comissao.setRoyaties(registroCalculo.getRoyaties()); + comissao.setIssRetido(registroCalculo.getRetidoISS()); + + comissao.setIndPago(false); + comissao.setUsuarioPagamentoId(null); + comissao.setDataPagamento(null); + comissao.setDescontosEventuais(BigDecimal.ZERO); + comissao.setDescontosFixos(BigDecimal.ZERO); + + for (ComissaoDesconto cd : registroCalculo.getLsDescontos()) { + if (cd.getTipo().equals(TipoDesconto.EVENTUAL)) { + comissao.setDescontosEventuais(MoneyHelper.somar(comissao.getDescontosEventuais(), cd.getValorDesconto())); + } else if (cd.getTipo().equals(TipoDesconto.FIXO)) { + comissao.setDescontosFixos(MoneyHelper.somar(comissao.getDescontosFixos(), cd.getValorDesconto())); + } + } + + for (ComissaoReceita comissaoReceita : registroCalculo.getLsReceitas()) { + comissao.setReceitaBPR(MoneyHelper.somar(comissao.getReceitaBPR(), comissaoReceita.getReceitaBPR(), 2)); + comissao.setReceitaGAP(MoneyHelper.somar(comissao.getReceitaGAP(), comissaoReceita.getReceitaGAP(), 2)); + comissao.setDevolvidos(MoneyHelper.somar(comissao.getDevolvidos(), comissaoReceita.getDevolvidosRelatorio(), 2)); + comissao.setDevolvidos(MoneyHelper.somar(comissao.getDevolvidos(), comissaoReceita.getDevolvidosGAPRelatorio(), 2)); + comissao.setDevolvidos(MoneyHelper.somar(comissao.getDevolvidos(), comissaoReceita.getCancelados(), 2)); + comissao.setDevolvidos(MoneyHelper.somar(comissao.getDevolvidos(), comissaoReceita.getCanceladosGAP(), 2)); + comissao.setDevolvidos(MoneyHelper.somar(comissao.getDevolvidos(), comissaoReceita.getCanceladosGAP(), 2)); + comissao.setReceitaBrutaExcessoBagagem(MoneyHelper.somar(comissao.getReceitaBrutaExcessoBagagem(), comissaoReceita.getReceitaExcessoBagagem(), 2)); + comissao.setReceitaBrutaSeguroopcional(MoneyHelper.somar(comissao.getReceitaBrutaSeguroopcional(), comissaoReceita.getReceitaSeguroOpcional(), 2)); + comissao.setReceitaBrutaSeguro(MoneyHelper.somar(comissao.getReceitaBrutaSeguro(), comissaoReceita.getReceitaSeguro(), 2)); + } + + comissao = comissaoService.suscribir(comissao); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new ComissaoException(e.getMessage(), e); + } + } + + @Override + public void cancelarCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo) throws ComissaoException, BusinessException { + try { + String competencia = DateUtil.getStringDate(periodo, "MM/yyyy"); + Comissao comissao = comissaoDAO.buscaComissaoVigencia(puntoVentaId, empresaId, competencia); + if (comissao != null) { + comissaoService.borrar(comissao); + } else { + throw new ComissaoException("busquedaCalculoComissaoController.comissao.exception"); + } + } catch (ComissaoException e) { + log.error(e.getMessage(), e); + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public RegistroCalculo relatorioCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException, BusinessException { + return realizarCalculoComissao(puntoVentaId, empresaId, periodo, isRetencaoDiaria, usuarioId, isRefazerCalculo); + } + + private BigDecimal calculoComisssaoBPR(boolean isAltaTemporada, PtovtaComissao ptovtaComissao, BigDecimal bpr, BigDecimal gap, boolean isBilheteGap, ComissaoLogVO comissaoLog) { + + // Comissão BPR = Receita Comissão * (% Com BPR) + BigDecimal recbpr = BigDecimal.ZERO; + BigDecimal receitaBPR = MoneyHelper.somar(bpr, gap, 2); + + BigDecimal percentualComissao = BigDecimal.ZERO; + if (isAltaTemporada) { + percentualComissao = ptovtaComissao.getPassagemAlta() != null ? ptovtaComissao.getPassagemAlta() : BigDecimal.ZERO; + } else { + percentualComissao = ptovtaComissao.getPassagemBaixa() != null ? ptovtaComissao.getPassagemBaixa() : BigDecimal.ZERO; + } + + log.info(String.format(":: Percentual Comissão: %s ::", percentualComissao)); + + if(isBilheteGap && ModeloComissaoImpressaoPosterior.COMPARTILHADA.equals(ptovtaComissao.getModeloComissaoImpressaoPosterior())) { + if (isAltaTemporada) { + percentualComissao = ptovtaComissao.getValorVendaGapCompAlta() != null ? ptovtaComissao.getValorVendaGapCompAlta() : BigDecimal.ZERO; + } else { + percentualComissao = ptovtaComissao.getValorVendaGapComp() != null ? ptovtaComissao.getValorVendaGapComp() : BigDecimal.ZERO; + } + log.info(String.format(":: Comissao Compartilhada Configurada para Bilhetes Imp. Post. - Percentual Comissão Alterado para: %s ::", percentualComissao)); + } + + comissaoLog.setPorcComissao(percentualComissao); + + recbpr = MoneyHelper.multiplicar(receitaBPR, MoneyHelper.dividir(percentualComissao,CEM,4), 4); + + return recbpr; + } + + private BigDecimal calculoEntregaPassagem(boolean isAltaTemporada, PtovtaComissao ptovtaComissao, BigDecimal gapImpressa, BigDecimal internet, int contImpressa) { + + // EntregaPassagem (Internet/Venda Impressão Posterior/Outros) + BigDecimal entregaPassagem = BigDecimal.ZERO; + BigDecimal receitaEntrega = MoneyHelper.somar(gapImpressa, internet, 2); + + log.info(String.format(":: Modelo Comissao Configurado Para Entrega Passagem: %s ::", ptovtaComissao.getModeloComissaoImpressaoPosterior())); + if(ModeloComissaoImpressaoPosterior.PADRAO.equals(ptovtaComissao.getModeloComissaoImpressaoPosterior())) { + if(isAltaTemporada) { + if(ptovtaComissao.getValorImpressaoGapAlta() != null) { + if (BooleanUtils.toBoolean(ptovtaComissao.getIndimpressaogapporc())) { + entregaPassagem = MoneyHelper.multiplicar(receitaEntrega, ptovtaComissao.getValorImpressaoGapAlta() != null ? MoneyHelper.dividir(ptovtaComissao.getValorImpressaoGapAlta(),CEM,4) : BigDecimal.ZERO, 4); + } else { + entregaPassagem = ptovtaComissao.getValorImpressaoGapAlta() != null ? MoneyHelper.multiplicar(ptovtaComissao.getValorImpressaoGapAlta(),new BigDecimal(contImpressa), 2) : BigDecimal.ZERO; + } + } + } else { + if(ptovtaComissao.getValorImpressaoGap() != null) { + if (BooleanUtils.toBoolean(ptovtaComissao.getIndimpressaogapporc())) { + entregaPassagem = MoneyHelper.multiplicar(receitaEntrega, ptovtaComissao.getValorImpressaoGap() != null ? MoneyHelper.dividir(ptovtaComissao.getValorImpressaoGap(),CEM,4) : BigDecimal.ZERO, 4); + } else { + entregaPassagem = ptovtaComissao.getValorImpressaoGap() != null ? MoneyHelper.multiplicar(ptovtaComissao.getValorImpressaoGap(),new BigDecimal(contImpressa), 2) : BigDecimal.ZERO; + } + } + } + } else if(ModeloComissaoImpressaoPosterior.COMPARTILHADA.equals(ptovtaComissao.getModeloComissaoImpressaoPosterior())) { + if(isAltaTemporada) { + entregaPassagem = MoneyHelper.multiplicar(receitaEntrega, ptovtaComissao.getValorImpGapCompAlta() != null ? MoneyHelper.dividir(ptovtaComissao.getValorImpGapCompAlta(),CEM,4) : BigDecimal.ZERO, 4); + } else { + entregaPassagem = MoneyHelper.multiplicar(receitaEntrega, ptovtaComissao.getValorImpGapComp() != null ? MoneyHelper.dividir(ptovtaComissao.getValorImpGapComp(),CEM,4) : BigDecimal.ZERO, 4); + } + } + + return entregaPassagem; + } + + private BigDecimal calculoExcessoBagagem(boolean isAltaTemporada, PtovtaComissao ptovtaComissao, BigDecimal excBag, ComissaoLogVO comissaoLog) { + + // Comissão Excesso = Receita Excesso Bagagem * (% Com. Exc. Bag) + BigDecimal excessoBagagem = BigDecimal.ZERO; + if (isAltaTemporada) { + comissaoLog.setPorcComissao(ptovtaComissao.getExcessoAlta()); + excessoBagagem = MoneyHelper.multiplicar(excBag, ptovtaComissao.getExcessoAlta() != null ? MoneyHelper.dividir(ptovtaComissao.getExcessoAlta(), CEM, 4) : BigDecimal.ZERO, 4); + } else { + comissaoLog.setPorcComissao(ptovtaComissao.getExcessoBaixa()); + excessoBagagem = MoneyHelper.multiplicar(excBag, ptovtaComissao.getExcessoBaixa() != null ? MoneyHelper.dividir(ptovtaComissao.getExcessoBaixa(), CEM, 4) : BigDecimal.ZERO, 4); + } + + return excessoBagagem; + } + + private BigDecimal calculoSeguroObrigatorio(boolean isAltaTemporada, PtovtaComissao ptovtaComissao, BigDecimal seguroObrigatorio) { + + // Comissão Seg. Obrigatorio = Receita Seguro Obrigatorio * (% Com. Seg. Pol) + BigDecimal recSeguroObrigatorio = BigDecimal.ZERO; + if (isAltaTemporada) { + recSeguroObrigatorio = MoneyHelper.multiplicar(seguroObrigatorio, ptovtaComissao.getSeguroobrigatorioAlta() != null ? MoneyHelper.dividir(ptovtaComissao.getSeguroobrigatorioAlta(), CEM, 4) : BigDecimal.ZERO, 4); + } else { + recSeguroObrigatorio = MoneyHelper.multiplicar(seguroObrigatorio, ptovtaComissao.getSeguroobrigatorioBaixa() != null ? MoneyHelper.dividir(ptovtaComissao.getSeguroobrigatorioBaixa(), CEM, 4) : BigDecimal.ZERO, 4); + } + return recSeguroObrigatorio; + } + + private BigDecimal calculoSeguroOpcional(boolean isAltaTemporada, PtovtaComissao ptovtaComissao, BigDecimal segOpcional, ComissaoLogVO comissaoLog) { + + // Comissão Seg. Opcional = Receita Seguro Opcional * (% Com. Seg. Pol) + BigDecimal recsegOpcional = BigDecimal.ZERO; + if (isAltaTemporada) { + comissaoLog.setPorcComissao(ptovtaComissao.getSeguroAlta()); + recsegOpcional = MoneyHelper.multiplicar(segOpcional, ptovtaComissao.getSeguroAlta() != null ? MoneyHelper.dividir(ptovtaComissao.getSeguroAlta(), CEM, 4) : BigDecimal.ZERO, 4); + } else { + comissaoLog.setPorcComissao(ptovtaComissao.getSeguroBaixa()); + recsegOpcional = MoneyHelper.multiplicar(segOpcional, ptovtaComissao.getSeguroBaixa() != null ? MoneyHelper.dividir(ptovtaComissao.getSeguroBaixa(), CEM, 4) : BigDecimal.ZERO, 4); + } + return recsegOpcional; + } + + private BigDecimal calculoOutros(boolean isAltaTemporada, PtovtaComissao ptovtaComissao, BigDecimal outros, ComissaoLogVO comissaoLog) { + + // Comissão Seg. Opcional = Receita Seguro Opcional * (% Com. Seg. Pol) + BigDecimal recoutros = BigDecimal.ZERO; + if (isAltaTemporada) { + comissaoLog.setPorcComissao(ptovtaComissao.getOutrosAlta()); + recoutros = MoneyHelper.multiplicar(outros, ptovtaComissao.getOutrosAlta() != null ? MoneyHelper.dividir(ptovtaComissao.getOutrosAlta(), CEM, 4) : BigDecimal.ZERO, 4); + } else { + comissaoLog.setPorcComissao(ptovtaComissao.getOutrosBaixa()); + recoutros = MoneyHelper.multiplicar(outros, ptovtaComissao.getOutrosBaixa() != null ? MoneyHelper.dividir(ptovtaComissao.getOutrosBaixa(), CEM, 4) : BigDecimal.ZERO, 4); + } + return recoutros; + } + + private Map calculoDescontos(Integer puntoVentaId, Integer empresaId, Date dataInicial, Date dataFinal, PtovtaComissao ptovtaComissao) { + + List lsDescontos = new ArrayList(); + BigDecimal valorDescontoTotal = BigDecimal.ZERO; + + List itensDescontos = descontoComissaoService.buscaDescontoComissaoPeriodo(puntoVentaId, empresaId, dataInicial, dataFinal); + + for (DescontoComissao dc : itensDescontos) { + + BigDecimal valorDesconto = dc.getPreco(); + valorDescontoTotal = MoneyHelper.somar(valorDescontoTotal, valorDesconto, 2); + + ComissaoDesconto desconto = new ComissaoDesconto(); + if (dc.getDatafinal() == null) { + desconto.setTipo(TipoDesconto.FIXO); + } else { + desconto.setTipo(TipoDesconto.EVENTUAL); + } + desconto.setNomeDesconto(dc.getItemDesconto().getNomitemdesconto()); + desconto.setValorDesconto(valorDesconto); + + lsDescontos.add(desconto); + } + + Map respDescontos = new HashMap(); + respDescontos.put("LISTA_DESCONTOS", lsDescontos); + respDescontos.put("VALOR_DESCONTOS", valorDescontoTotal); + + return respDescontos; + } + + @Override + public RegistroCalculo realizarCalculoComissao(Integer puntoVentaId, Integer empresaId, Date periodo, Boolean isRetencaoDiaria, Integer usuarioId, Boolean isRefazerCalculo) throws ComissaoException, BusinessException { + + Conferencia conferencia = new Conferencia(); + conferencia.setPuntoVenta(new PuntoVenta(puntoVentaId)); + conferencia.setEmpresa(new Empresa(empresaId)); + + Calendar calendario = Calendar.getInstance(); + calendario.setTime(periodo); + int diaInicial = -1; + int diaFinal = -1; + int mes = calendario.get(Calendar.MONTH); + int ano = calendario.get(Calendar.YEAR); + + if(isRetencaoDiaria) { + conferencia.setDatamovimento(periodo); + diaInicial = calendario.get(Calendar.DAY_OF_MONTH); + diaFinal = calendario.get(Calendar.DAY_OF_MONTH); + } else { + conferencia.setCompetencia(DateUtil.getStringDate(periodo, "MM/yyyy")); + diaInicial = calendario.getActualMinimum(Calendar.DAY_OF_MONTH); + diaFinal = calendario.getActualMaximum(Calendar.DAY_OF_MONTH); + } + + Date dataInicial = getDate(diaInicial, mes, ano); + Date dataFinal = getDate(diaFinal, mes, ano); + + return realizarCalculoComissao(puntoVentaId, empresaId, usuarioId, isRefazerCalculo, conferencia, dataInicial, dataFinal, isRetencaoDiaria); + + } + + /** + * Realiza calculo da comissao + * @param puntoVentaId + * @param empresaId + * @param usuarioId + * @param isRefazerCalculo + * @param conferencia + * @param dataInicial + * @param dataFinal + * @param isRetencaoDiaria + * @return + * @throws BusinessException + * @throws ComissaoException + */ + private RegistroCalculo realizarCalculoComissao(Integer puntoVentaId, Integer empresaId, Integer usuarioId, Boolean isRefazerCalculo, Conferencia conferencia, Date dataInicial, Date dataFinal, boolean isRetencaoDiaria) throws BusinessException, ComissaoException { + try { + PtovtaComissao ptovtaComissao = ptovtaComissaoService.buscarPuntaVentaEmpresa(puntoVentaId, empresaId); + if (ptovtaComissao != null && (ptovtaComissao.getIndretercomissao() == null || !ptovtaComissao.getIndretercomissao())) { + //Abate no valor da comissão bpr as saídas de caixa + boolean consideraBilhetesDevolvidosEmOutraAgencia = (ptovtaComissao.getIndbilhetesdevcanorigem() == null)?false:ptovtaComissao.getIndbilhetesdevcanorigem(); + + List receitas = null; + if(isRefazerCalculo) { + comissaoReceitaService.limparComissaoReceita(empresaId, puntoVentaId, dataInicial, dataFinal); + List receitasBoleto = conferenciaComissaoDAO.carregarBilhetesComissao(conferencia, true, consideraBilhetesDevolvidosEmOutraAgencia); + log.info("Total de bilhetes: " + receitasBoleto.size()); + List eventosFinanceirosVOs = conferenciaComissaoDAO.carregarEventosFinanceiros(conferencia); + log.info("Total de eventos extras: " + eventosFinanceirosVOs.size()); + receitas = calculaReceitaComissao(empresaId, ptovtaComissao, receitasBoleto, eventosFinanceirosVOs, dataInicial, dataFinal); + reterComissaoReceitaDiaria(empresaId, puntoVentaId, usuarioId, receitas); + } else { + receitas = recuperarComissaoReceita(empresaId, puntoVentaId, dataInicial, dataFinal); + } + + if(!isRetencaoDiaria) { + return calcularRegistroCalculo(ptovtaComissao, puntoVentaId, empresaId, dataInicial, dataFinal, receitas); + } + } else { + if(ptovtaComissao != null && ptovtaComissao.getIndretercomissao() != null && ptovtaComissao.getIndretercomissao()) { + throw new ComissaoException("busquedaCalculoComissaoController.PtovtaComissaoReterComissao.exception", null, ptovtaComissao.getDescComissaoId() != null ? ptovtaComissao.getPuntoventaId().getNombpuntoventa() : ""); + } else if(!isRefazerCalculo) { + throw new ComissaoException("busquedaCalculoComissaoController.PtovtaComissao.exception"); + } + } + + }catch(ComissaoException e ){ + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException("busquedaCalculoComissaoController.PtovtaComissao.exception"); + } + + return null; + } + + private List recuperarComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) { + return comissaoReceitaService.recuperarComissaoReceita(empresaId, puntoVentaId, dataInicial, dataFinal); + } + + /** + * Retem dados para calculo da comissao + * @param empresaId + * @param puntoVentaId + * @param usuarioId + * @param receitas + * @throws BusinessException + */ + private void reterComissaoReceitaDiaria(Integer empresaId, Integer puntoVentaId, Integer usuarioId, List receitas) throws BusinessException { + comissaoReceitaService.reterComissaoReceitaDiaria(empresaId, puntoVentaId, usuarioId, receitas); + } + + /** + * Carrega os dados de registro de calculo, conforme receitas + * @param ptovtaComissao + * @param puntoVentaId + * @param empresaId + * @param dataInicial + * @param dataFinal + * @param receitas + * @return + * @throws BusinessException + */ + @SuppressWarnings("unchecked") + private RegistroCalculo calcularRegistroCalculo(PtovtaComissao ptovtaComissao, Integer puntoVentaId, Integer empresaId, Date dataInicial, Date dataFinal, List receitas) throws BusinessException { + try { + RegistroCalculo rc = new RegistroCalculo(); + rc.setNombpuntoventa(ptovtaComissao.getPuntoventaId().getNombpuntoventa()); + rc.setNumPuntoVenta(ptovtaComissao.getPuntoventaId().getNumPuntoVenta()); + + BigDecimal comissaoBPR = BigDecimal.ZERO; + BigDecimal comissaoExcessoBagagem = BigDecimal.ZERO; + BigDecimal comissaoSegOpcional = BigDecimal.ZERO; + BigDecimal comissaoSeguro = BigDecimal.ZERO; + BigDecimal comissaoEntregaPassagem = BigDecimal.ZERO; + BigDecimal comissaoOutros = BigDecimal.ZERO; + BigDecimal receitaTotal = BigDecimal.ZERO; + BigDecimal comissaoTotal = BigDecimal.ZERO; + + for (ComissaoReceita cr : receitas) { + receitaTotal = MoneyHelper.somar(receitaTotal, cr.getReceitaComissao()); + comissaoBPR = MoneyHelper.somar(comissaoBPR, cr.getComissaoBPRDiaria()); + comissaoEntregaPassagem = MoneyHelper.somar(comissaoEntregaPassagem, cr.getComissaoEntregaPassagemDiaria()); + comissaoExcessoBagagem = MoneyHelper.somar(comissaoExcessoBagagem, cr.getComissaoExcessoBagagemDiaria()); + comissaoSegOpcional = MoneyHelper.somar(comissaoSegOpcional, cr.getComissaoSegOpcionalDiaria()); + comissaoSeguro = MoneyHelper.somar(comissaoSeguro, cr.getComissaoSeguroObrigatorioDiaria()); + comissaoOutros = MoneyHelper.somar(comissaoOutros, cr.getComissaoOutrosDiaria()); + comissaoTotal = MoneyHelper.somar(comissaoTotal, cr.getTotalComissao()); + } + + rc.setLsReceitas(receitas); + + rc.setComissaoBPR(comissaoBPR); + rc.setComissaoExcessoBagagem(comissaoExcessoBagagem); + rc.setComissaoSegOpcional(comissaoSegOpcional); + rc.setComissaoSeguro(comissaoSeguro); + rc.setComissaoEntregaPassagem(comissaoEntregaPassagem); + rc.setComissaoOutros(comissaoOutros); + + // Descontos (Fixos e Eventuais) + Map respDescontos = calculoDescontos(puntoVentaId, empresaId, dataInicial, dataFinal, ptovtaComissao); + rc.setDescontos((BigDecimal) respDescontos.get("VALOR_DESCONTOS")); + rc.setLsDescontos((List) respDescontos.get("LISTA_DESCONTOS")); + + /** + * Bonificação Metas - Meta = Eh o valor estipulado de receita dentro do periodo que a agencia deve alcançar. - Bonificação = Eh uma porcentagem paga encima da comissao, por alcançar a meta. + */ + BigDecimal comissaoBonificaoMetas = BigDecimal.ZERO; + rc.setComissaoBonificaoMetas(comissaoBonificaoMetas); + + // Royaties + BigDecimal royaties = BigDecimal.ZERO; + if(ptovtaComissao.getRoyalties() != null) { + royaties = MoneyHelper.multiplicar(receitaTotal, MoneyHelper.dividir(ptovtaComissao.getRoyalties(), CEM)); + } + rc.setRoyaties(royaties); + + // ISS retido + BigDecimal issRetido = BigDecimal.ZERO; + if(ptovtaComissao.getIssretido() != null) { + issRetido = MoneyHelper.multiplicar(comissaoTotal, MoneyHelper.dividir(ptovtaComissao.getIssretido(), CEM)); + } + rc.setRetidoISS(issRetido); + + // Comissão à pagar = Comissão BPR + Comissão Excesso Bagagem + Comissão Seg. Opcional + Bonificação Metas + Internet(EntregaPassagem) + BigDecimal comissaoPagar = BigDecimal.ZERO; + comissaoPagar = MoneyHelper.somar(comissaoPagar,comissaoBPR); + comissaoPagar = MoneyHelper.somar(comissaoPagar,comissaoExcessoBagagem); + comissaoPagar = MoneyHelper.somar(comissaoPagar,comissaoSeguro); + comissaoPagar = MoneyHelper.somar(comissaoPagar,comissaoSegOpcional); + comissaoPagar = MoneyHelper.somar(comissaoPagar,comissaoEntregaPassagem); + comissaoPagar = MoneyHelper.somar(comissaoPagar,comissaoOutros); + comissaoPagar = MoneyHelper.somar(comissaoPagar,comissaoBonificaoMetas); + + // - Descontos (Fixos e Eventuais) - Royaties - ISS retido + comissaoPagar = MoneyHelper.subtrair(comissaoPagar,rc.getDescontos()); + comissaoPagar = MoneyHelper.subtrair(comissaoPagar,royaties); + comissaoPagar = MoneyHelper.subtrair(comissaoPagar,issRetido); + rc.setComissaoPagar(comissaoPagar); + + return rc; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + private boolean validaAltaTemporada(List impostos, Integer mes, Integer estadoId) { + if(impostos != null && mes != null && estadoId != null) { + + for (EmpresaImposto ei : impostos) { + if(ei.getEstado() != null) { + if (ei.getEstado().getEstadoId().equals(estadoId)) { + switch (mes) { + case Calendar.JANUARY: + return ei.getIndJaneiro() == null ? false : ei.getIndJaneiro(); + case Calendar.FEBRUARY: + return ei.getIndFevereiro() == null ? false : ei.getIndFevereiro(); + case Calendar.MARCH: + return ei.getIndMarco() == null ? false : ei.getIndMarco(); + case Calendar.APRIL: + return ei.getIndAbril() == null ? false : ei.getIndAbril(); + case Calendar.MAY: + return ei.getIndMaio() == null ? false : ei.getIndMaio(); + case Calendar.JUNE: + return ei.getIndJunho() == null ? false : ei.getIndJunho(); + case Calendar.JULY: + return ei.getIndJulho() == null ? false : ei.getIndJulho(); + case Calendar.AUGUST: + return ei.getIndAgosto() == null ? false : ei.getIndAgosto(); + case Calendar.SEPTEMBER: + return ei.getIndSetembro() == null ? false : ei.getIndSetembro(); + case Calendar.OCTOBER: + return ei.getIndOutubro() == null ? false : ei.getIndOutubro(); + case Calendar.NOVEMBER: + return ei.getIndNovembro() == null ? false : ei.getIndNovembro(); + case Calendar.DECEMBER: + return ei.getIndDezembro() == null ? false : ei.getIndDezembro(); + default: + break; + } + } + } + } + + } + + return false; + } + + private List calculaReceitaComissao(Integer empresaId, PtovtaComissao ptovtaComissao, List receitasBoleto, List eventosFinanceirosVOs, Date dataInicial, Date dataFinal) { + + Calendar cDataInicial = Calendar.getInstance(); + cDataInicial.setTime(dataInicial); + Integer diaInicial = cDataInicial.get(Calendar.DAY_OF_MONTH); + + Calendar cDataFinal = Calendar.getInstance(); + cDataFinal.setTime(dataInicial); + Integer diaFinal = cDataFinal.get(Calendar.DAY_OF_MONTH); + + Integer mes = cDataInicial.get(Calendar.MONTH); + Integer ano = cDataInicial.get(Calendar.YEAR); + + List impostos = empresaImpostoService.buscarEmpresaImposto(empresaId); + boolean isConsideraBilhetesDevolvidosEmOutraAgencia = ptovtaComissao.getIndbilhetesdevcanorigem() == null ? false : ptovtaComissao.getIndbilhetesdevcanorigem(); + boolean isPagaComissaoBilheteOrdemServico = ptovtaComissao.getIndPagaComissaoBilheteOS() != null ? ptovtaComissao.getIndPagaComissaoBilheteOS() : false; + boolean isDevolucaoComissaoTransferenciaGeraCaja = ptovtaComissao.getEmpresaId().getIndComTransfGeraCaja(); + boolean isSeguroObrigatorioReceitaBPR = ptovtaComissao.getSeguroReceita() || ptovtaComissao.getSeguroDev(); + + List receitas = new ArrayList(); + for (int dia = diaInicial; dia <= diaFinal; dia++) { + Calendar cDataRegistro = Calendar.getInstance(); + cDataRegistro.set(Calendar.DAY_OF_MONTH, dia); + cDataRegistro.set(Calendar.MONTH, mes); + cDataRegistro.set(Calendar.YEAR, ano); + + Date dataRegistro = DateUtil.normalizarToFecha(cDataRegistro.getTime()); + + List list = verificaCalculoComissaoProDia(receitasBoleto, dataRegistro); + + ComissaoReceita cr = new ComissaoReceita(); + cr.setData(dataRegistro); + + BigDecimal receitaComissao = BigDecimal.ZERO; + + BigDecimal receitaBPR = BigDecimal.ZERO; + BigDecimal receitaGAP = BigDecimal.ZERO; + BigDecimal internet = BigDecimal.ZERO; + BigDecimal receitaSeguroObrigatorio = BigDecimal.ZERO; + BigDecimal receitaExcessoBagagem = BigDecimal.ZERO; + BigDecimal receitaSeguroOpcional = BigDecimal.ZERO; + BigDecimal receitaSeguroOutros = BigDecimal.ZERO; + + BigDecimal cancelados = BigDecimal.ZERO; + BigDecimal canceladosOrigem = BigDecimal.ZERO; + BigDecimal devolvidos = BigDecimal.ZERO; + BigDecimal devolvidosOrigem = BigDecimal.ZERO; + BigDecimal canceladosGAP = BigDecimal.ZERO; + BigDecimal canceladosGAPOrigem = BigDecimal.ZERO; + BigDecimal devolvidosGAP = BigDecimal.ZERO; + BigDecimal devolvidosGAPOrigem = BigDecimal.ZERO; + + BigDecimal gapImpressa = BigDecimal.ZERO; + int contImpressa = 0; + + BigDecimal comissaoBPR = BigDecimal.ZERO; + BigDecimal comissaoExcessoBagagem = BigDecimal.ZERO; + BigDecimal comissaoSegOpcional = BigDecimal.ZERO; + BigDecimal comissaoEntregaPassagem = BigDecimal.ZERO; + BigDecimal comissaoOutros = BigDecimal.ZERO; + BigDecimal comissaoSeguroObrigatorio = BigDecimal.ZERO; + + // Receita Total -- bruta/liquida - abatimento do valor do icms + boolean isReceitaLiquida = false; + Receita receita = Receita.getByValor(ptovtaComissao.getReceita()); + if (receita.equals(Receita.RECEITALIQUIDA)) { + isReceitaLiquida = true; + } + + /* Calculando comissão para os boletos */ + for (BoletoComissao rcc : list) { + + /* + * Mantis #12391 + * Verifica se a agencia paga comissão para bilhete de ordem de servico, + * caso não faça pagamento, o bilhete é ignorado */ + if(!isPagaComissaoBilheteOrdemServico && isBilheteOrdemServico(rcc)) { + continue; + } + + boolean isAltaTemporada = validaAltaTemporada(impostos, mes, rcc.getEstadoId()); + + IndStatusBoleto statusBoleto = IndStatusBoleto.valueOf(rcc.getIndstatusboleto()); + boolean isSaidaCaixa = rcc.getMotivoCancelacionId() != null; + boolean isEntregaPassagem = statusBoleto.equals(IndStatusBoleto.E) && (rcc.getMotivoCancelacionId() == null); + + /* + * Exclui os bilhetes que não foram entregues na agencia da comissão que está sendo calculada + */ + if(isEntregaPassagem && !ptovtaComissao.getPuntoventaId().getPuntoventaId().equals(rcc.getPuntoVentaId())) { + continue; + } + + if(rcc.isMotivocancelacionQuitacaoOcd() || rcc.isDiferencaTrocaGeracaoOcd()) { + continue; + } + + if(rcc.isMotivocancelacionTransferido() && (rcc.getIndreimpresion() || !isDevolucaoComissaoTransferenciaGeraCaja)) { + continue; + } + + ComissaoLogVO comissaoLog = new ComissaoLogVO(); + comissaoLog.setFeccorte(dataRegistro); + comissaoLog.setCajaId(rcc.getCajaId()); + comissaoLog.setEmpresaId(empresaId); + comissaoLog.setPuntoventaId(rcc.getPuntoVentaId()); + comissaoLog.setTurnoId(rcc.getTurnoId()); + comissaoLog.setUsuarioId(rcc.getUsuarioId()); + comissaoLog.setOrigem("ADM"); + + StringBuilder sTextoLog = new StringBuilder(); + sTextoLog.append("[CAJA_ID: ") + .append(rcc.getCajaId()) + .append("] ") + .append("[BILHETE: ") + .append(rcc.getNumFolioSistema()) + .append("] ") + .append("[INDSTATUSBOLETO: ") + .append(rcc.getIndstatusboleto()) + .append("] ") + .append("[MOTIVO_CANCELAMENTO: ") + .append(rcc.getMotivoCancelacionId() != null ? rcc.getMotivoCancelacionId() : "") + .append("] ") + .append("[TIPO_VENDA: ") + .append(rcc.getTipoVenta()) + .append("] "); + + BigDecimal receitaItem = BigDecimal.ZERO; + BigDecimal receitaDevItem = BigDecimal.ZERO; + BigDecimal receitaSeguroObrigatorioItem = BigDecimal.ZERO; + BigDecimal receitaSeguroObrigatorioDevItem = BigDecimal.ZERO; + + if (!isSaidaCaixa){ + // Totais + if (BooleanUtils.toBoolean(ptovtaComissao.getTarifaReceita())) { + receitaItem = MoneyHelper.somar(receitaItem, rcc.getValorpagado()); + } + + if (BooleanUtils.toBoolean(ptovtaComissao.getTaxaReceita())) { + receitaItem = MoneyHelper.somar(receitaItem, rcc.getEmbarque()); + } + + if (BooleanUtils.toBoolean(ptovtaComissao.getPedagioReceita())) { + receitaItem = MoneyHelper.somar(receitaItem, rcc.getPedagio()); + } + + if(isSeguroObrigatorioReceitaBPR) { + if (BooleanUtils.toBoolean(ptovtaComissao.getSeguroReceita())) { + receitaItem = MoneyHelper.somar(receitaItem, rcc.getSeguro()); + } + } else { + receitaSeguroObrigatorioItem = MoneyHelper.somar(receitaSeguroObrigatorioItem, rcc.getSeguro()); + } + + } + + if (isSaidaCaixa){ + // Totais de Devolução / Cancelamento + if (BooleanUtils.toBoolean(ptovtaComissao.getTarifaDev())) { + receitaDevItem = MoneyHelper.somar(receitaDevItem, rcc.getValorpagado()); + } + + if (BooleanUtils.toBoolean(ptovtaComissao.getTaxaDev())) { + receitaDevItem = MoneyHelper.somar(receitaDevItem, rcc.getEmbarque()); + } + + if (BooleanUtils.toBoolean(ptovtaComissao.getPedagioDev())) { + receitaDevItem = MoneyHelper.somar(receitaDevItem, rcc.getPedagio()); + } + + if(isSeguroObrigatorioReceitaBPR) { + if (BooleanUtils.toBoolean(ptovtaComissao.getSeguroDev())) { + receitaDevItem = MoneyHelper.somar(receitaDevItem, rcc.getSeguro()); + } + } else { + receitaSeguroObrigatorioDevItem = MoneyHelper.somar(receitaSeguroObrigatorioDevItem, rcc.getSeguro()); + } + + } + + // Calculo de ICMS sobre o valor do bilhete + if (isReceitaLiquida) { + BigDecimal icms = MoneyHelper.multiplicar(receitaItem, MoneyHelper.dividir(rcc.getIcmsBase() != null ? rcc.getIcmsBase() : BigDecimal.ZERO, CEM)); + receitaItem = MoneyHelper.subtrair(receitaItem, icms); + + BigDecimal icmsDev = MoneyHelper.multiplicar(receitaDevItem, MoneyHelper.dividir(rcc.getIcmsBase() != null ? rcc.getIcmsBase() : BigDecimal.ZERO, CEM)); + receitaDevItem = MoneyHelper.subtrair(receitaDevItem,icmsDev); + + icms = MoneyHelper.multiplicar(receitaSeguroObrigatorioItem, MoneyHelper.dividir(rcc.getIcmsBase() != null ? rcc.getIcmsBase() : BigDecimal.ZERO, CEM)); + receitaSeguroObrigatorioItem = MoneyHelper.subtrair(receitaSeguroObrigatorioItem, icms); + + icmsDev = MoneyHelper.multiplicar(receitaSeguroObrigatorioDevItem, MoneyHelper.dividir(rcc.getIcmsBase() != null ? rcc.getIcmsBase() : BigDecimal.ZERO, CEM)); + receitaSeguroObrigatorioDevItem = MoneyHelper.subtrair(receitaSeguroObrigatorioDevItem,icmsDev); + + } + + BigDecimal bpr = BigDecimal.ZERO; + BigDecimal tmpComissaoSeguroObrigatorio = BigDecimal.ZERO; + // Boletos impressos no punto venta + if (isEntregaPassagem) { + contImpressa++; + gapImpressa = MoneyHelper.somar(gapImpressa, receitaItem, receitaSeguroObrigatorioItem); + + BigDecimal receitaTotalPassagem = MoneyHelper.somar(receitaItem, receitaSeguroObrigatorioItem); + + BigDecimal entregaPassagem = calculoEntregaPassagem(isAltaTemporada, ptovtaComissao, receitaTotalPassagem, BigDecimal.ZERO, 1); + comissaoEntregaPassagem = MoneyHelper.somar(comissaoEntregaPassagem, entregaPassagem, 4); + + sTextoLog.append("[RECEITA_IMPRESSAO_IMP_POS: ") + .append(receitaTotalPassagem) + .append("] ") + .append("[COMISSAO_IMPRESSAO_IMP_POS: ") + .append(comissaoEntregaPassagem) + .append("] "); + + } else { + + // Receita GAP + if (rcc.getTipoVenta().equals(Constantes.TPV_BOLETO_REMOTO.intValue()) || rcc.getTipoVenta().equals(Constantes.TPV_CALL_CENTER.intValue())) { + receitaGAP = MoneyHelper.somar(receitaGAP, receitaItem); + receitaGAP = MoneyHelper.somar(receitaGAP, receitaSeguroObrigatorioItem); + + bpr = calculoComisssaoBPR(isAltaTemporada, ptovtaComissao, BigDecimal.ZERO, receitaItem, rcc.isBilheteGap(), comissaoLog); + + } + // Internet + else if (rcc.getTipoVenta().equals(Constantes.TPV_POR_INTERNET.intValue())) { + internet = MoneyHelper.somar(internet, receitaItem); + internet = MoneyHelper.somar(internet, receitaSeguroObrigatorioItem); + + bpr = calculoComisssaoBPR(isAltaTemporada, ptovtaComissao, BigDecimal.ZERO, receitaItem, rcc.isBilheteGap(), comissaoLog); + + } + + // Receita BPR + else { + receitaBPR = MoneyHelper.somar(receitaBPR, receitaItem); + receitaSeguroObrigatorio = MoneyHelper.somar(receitaSeguroObrigatorio, receitaSeguroObrigatorioItem); + + bpr = calculoComisssaoBPR(isAltaTemporada, ptovtaComissao, receitaItem, BigDecimal.ZERO, rcc.isBilheteGap(), comissaoLog); + + } + + tmpComissaoSeguroObrigatorio = calculoSeguroObrigatorio(isAltaTemporada, ptovtaComissao, receitaSeguroObrigatorioItem); + comissaoSeguroObrigatorio = MoneyHelper.somar(comissaoSeguroObrigatorio, tmpComissaoSeguroObrigatorio, 4); + + comissaoBPR = MoneyHelper.somar(comissaoBPR, bpr, 4); + + if(!isSaidaCaixa) { + BigDecimal valorBase = MoneyHelper.somar(receitaItem, receitaSeguroObrigatorioItem); + BigDecimal valorComissao = MoneyHelper.somar(bpr, tmpComissaoSeguroObrigatorio); + + comissaoLog.setValorBase(valorBase); + comissaoLog.setValorComissao(valorComissao); + + sTextoLog.append("[RECEITA_ITEM: ") + .append(receitaItem) + .append("] ") + .append("[COMISSAO_BPR: ") + .append(bpr) + .append("] ") + .append("[COMISSAO_BPR_ATUAL: ") + .append(comissaoBPR) + .append("] ") + .append("[RECEITA_SEGURO_OBRIGATORIO: ") + .append(receitaSeguroObrigatorioItem) + .append("] ") + .append("[COMISSAO_SEGURO_OBRIGATORIO: ") + .append(tmpComissaoSeguroObrigatorio) + .append("] ") + .append("[COMISSAO_SEGURO_OBRIGATORIO_ATUAL: ") + .append(comissaoSeguroObrigatorio) + .append("] "); + } + } + + if (isSaidaCaixa) { + receitaSeguroObrigatorio = MoneyHelper.somar( receitaSeguroObrigatorio , receitaSeguroObrigatorioDevItem.negate(), 4 ); + // Devolução Receita + if (isBilheteDevolucao(rcc, isDevolucaoComissaoTransferenciaGeraCaja)) { + + // Devolução Receita GAP + if (rcc.getTipoVenta().equals(Constantes.TPV_BOLETO_REMOTO.intValue()) || rcc.getTipoVenta().equals(Constantes.TPV_CALL_CENTER.intValue()) || rcc.getTipoVenta().equals(Constantes.TPV_POR_INTERNET.intValue())) { + + // Impresso Venta de otro punto venta + if (!rcc.getPtoVtaOrigem()) { + devolvidosGAPOrigem = MoneyHelper.somar(devolvidosGAPOrigem, receitaDevItem); + //devolvidosGAPOrigem = MoneyHelper.somar(devolvidosGAPOrigem, receitaSeguroObrigatorioDevItem); + } + + /* + * Adiciona o valor nos devolvidos caso o bilhete seja do proprio ponto de venda, + * ou caso o parametro de considerar cancelamento/devolução no ponto de venda onde + * foi feita a operação esteja desmarcado + * Mantis #11015 + */ + if(rcc.getPtoVtaOrigem() || !isConsideraBilhetesDevolvidosEmOutraAgencia) { + devolvidosGAP = MoneyHelper.somar(devolvidosGAP, receitaDevItem); + //devolvidosGAP = MoneyHelper.somar(devolvidosGAP, receitaSeguroObrigatorioDevItem); + } + + } else { + // Impresso Venta de otro punto venta + if (!rcc.getPtoVtaOrigem()) { + devolvidosOrigem = MoneyHelper.somar(devolvidosOrigem, receitaDevItem); + //devolvidosOrigem = MoneyHelper.somar(devolvidosOrigem, receitaSeguroObrigatorioDevItem); + } + + /* + * Adiciona o valor nos devolvidos caso o bilhete seja do proprio ponto de venda, + * ou caso o parametro de considerar cancelamento/devolução no ponto de venda onde + * foi feita a operação esteja desmarcado + * Mantis #11015 + */ + if(rcc.getPtoVtaOrigem() || !isConsideraBilhetesDevolvidosEmOutraAgencia) { + devolvidos = MoneyHelper.somar(devolvidos, receitaDevItem); + //devolvidos = MoneyHelper.somar(devolvidos, receitaSeguroObrigatorioDevItem); + } + } + + } + + // Cancelamento Receita + else { + // Cancelamento Receita GAP + if (rcc.getTipoVenta().equals(Constantes.TPV_BOLETO_REMOTO.intValue()) || rcc.getTipoVenta().equals(Constantes.TPV_CALL_CENTER.intValue()) || rcc.getTipoVenta().equals(Constantes.TPV_POR_INTERNET.intValue())) { + if (!rcc.getPtoVtaOrigem()) { + canceladosGAPOrigem = MoneyHelper.somar(canceladosGAPOrigem, receitaDevItem); + //canceladosGAPOrigem = MoneyHelper.somar(canceladosGAPOrigem, receitaSeguroObrigatorioDevItem); + } + + /* + * Adiciona o valor nos devolvidos caso o bilhete seja do proprio ponto de venda, + * ou caso o parametro de considerar cancelamento/devolução no ponto de venda onde + * foi feita a operação esteja desmarcado + * Mantis #11015 + */ + if(rcc.getPtoVtaOrigem() || !isConsideraBilhetesDevolvidosEmOutraAgencia) { + canceladosGAP = MoneyHelper.somar(canceladosGAP, receitaDevItem); + //canceladosGAP = MoneyHelper.somar(canceladosGAP, receitaSeguroObrigatorioDevItem); + } + } else { + if (!rcc.getPtoVtaOrigem()) { + canceladosOrigem = MoneyHelper.somar(canceladosOrigem, receitaDevItem); + //canceladosOrigem = MoneyHelper.somar(canceladosOrigem, receitaSeguroObrigatorioDevItem); + } + + /* + * Adiciona o valor nos devolvidos caso o bilhete seja do proprio ponto de venda, + * ou caso o parametro de considerar cancelamento/devolução no ponto de venda onde + * foi feita a operação esteja desmarcado + * Mantis #11015 + */ + if(rcc.getPtoVtaOrigem() || !isConsideraBilhetesDevolvidosEmOutraAgencia) { + cancelados = MoneyHelper.somar(cancelados, receitaDevItem); + //cancelados = MoneyHelper.somar(cancelados, receitaSeguroObrigatorioDevItem); + } + } + } + + /* + * Calcula a comissão caso o bilhete seja do proprio ponto de venda, + * ou caso o parametro de considerar cancelamento/devolução no ponto de venda onde + * foi feita a operação esteja desmarcado + * Mantis #11015 + */ + if(rcc.getPtoVtaOrigem() || !isConsideraBilhetesDevolvidosEmOutraAgencia) { + bpr = calculoComisssaoBPR(isAltaTemporada, ptovtaComissao, receitaDevItem, BigDecimal.ZERO, rcc.isBilheteGap(), comissaoLog); + + tmpComissaoSeguroObrigatorio = calculoSeguroObrigatorio(isAltaTemporada, ptovtaComissao, receitaSeguroObrigatorioDevItem); + comissaoSeguroObrigatorio = MoneyHelper.somar(comissaoSeguroObrigatorio, tmpComissaoSeguroObrigatorio.negate(), 4); + + //bpr = MoneyHelper.somar(bpr, tmpComissaoSeguroObrigatorio, 4); + + comissaoBPR = MoneyHelper.somar(comissaoBPR, bpr.negate(), 4); + + BigDecimal valorBase = MoneyHelper.somar(receitaDevItem.negate(), receitaSeguroObrigatorioDevItem.negate()); + BigDecimal valorComissao = MoneyHelper.somar(bpr.negate(), tmpComissaoSeguroObrigatorio.negate()); + + comissaoLog.setValorBase(valorBase); + comissaoLog.setValorComissao(valorComissao); + + sTextoLog.append("[RECEITA_DEV_ITEM: ") + .append(receitaDevItem.negate()) + .append("] ") + .append("[COMISSAO_BPR_DEV: ") + .append(bpr.negate()) + .append("] ") + .append("[COMISSAO_BPR_ATUAL: ") + .append(comissaoBPR) + .append("] ") + .append("[RECEITA_SEGURO_OBRIGATORIO_DEV: ") + .append(receitaSeguroObrigatorioDevItem.negate()) + .append("] ") + .append("[COMISSAO_SEGURO_OBRIGATORIO_DEV: ") + .append(tmpComissaoSeguroObrigatorio.negate()) + .append("] ") + .append("[COMISSAO_SEGURO_OBRIGATORIO_ATUAL: ") + .append(comissaoSeguroObrigatorio) + .append("] "); + } + } + + comissaoLog.setTexto(sTextoLog.toString()); + cr.getLsComissaoLog().add(comissaoLog); + + /* + log.info("---------"); + log.info("CajaId=" + rcc.getCajaId() + ", numFolioSistema=" + rcc.getNumFolioSistema() + ", nombpasajero=" + rcc.getNombpasajero() + ", indstatusboleto=" + rcc.getIndstatusboleto() + ", motivocancelacionId=" + rcc.getMotivoCancelacionId() + ", PuntoventaId=" + rcc.getPuntoVentaId() + ", PtovtaventaId=" + rcc.getPtovtaventaId()); + log.info("Total Bilhete: " + rcc.getTotal()); + log.info("PtoVtaOrigem: " + rcc.getPtoVtaOrigem()); + log.info("Status: " + rcc.getIndstatusboleto()); + log.info("receitaItem: " + receitaItem); + log.info("receitaDevItem: " + receitaDevItem); + log.info("receitaSeguroObrigatorioItem: " + receitaSeguroObrigatorioItem); + log.info("receitaSeguroObrigatorioDevItem: " + receitaSeguroObrigatorioDevItem); + log.info("comissaoBPRItem: " + bpr); + log.info("receitaGAP: " + receitaGAP); + log.info("receitaBPR: " + receitaBPR); + log.info("ComissaoBPR: " + comissaoBPR); + log.info("comissaoSeguroObrigatorio: " + comissaoSeguroObrigatorio); + log.info("cancelados: " + cancelados); + log.info("canceladosOrigem: " + canceladosOrigem); + log.info("devolvidos: " + devolvidos); + log.info("devolvidosOrigem: " + devolvidosOrigem); + log.info("canceladosGAP: " + canceladosGAP); + log.info("canceladosGAPOrigem: " + canceladosGAPOrigem); + log.info("devolvidosGAP: " + devolvidosGAP); + log.info("devolvidosGAPOrigem: " + devolvidosGAPOrigem); + */ + } + + /* Calculando comissão para os eventos extras */ + List listEventosFinanceiros = verificaEventoFinanceiroProDia(eventosFinanceirosVOs, dataRegistro); + for (EventosFinanceirosVO eventosFinanceiros : listEventosFinanceiros) { + ComissaoLogVO comissaoLog = new ComissaoLogVO(); + comissaoLog.setFeccorte(dataRegistro); + comissaoLog.setCajadiversosId(eventosFinanceiros.getCajaDiversosId()); + comissaoLog.setEmpresaId(empresaId); + comissaoLog.setPuntoventaId(ptovtaComissao.getPuntoventaId().getPuntoventaId()); + comissaoLog.setTurnoId(eventosFinanceiros.getTurnoId()); + comissaoLog.setUsuarioId(eventosFinanceiros.getUsuarioId()); + comissaoLog.setOrigem("ADM"); + + boolean isAltaTemporada = validaAltaTemporada(impostos, mes, eventosFinanceiros.getEstadoId()); + + if(TipoEventoExtra.EXCESSO_BAGAGEM.toString().equals(eventosFinanceiros.getCvetipoevento())) { + receitaExcessoBagagem = MoneyHelper.somar(receitaExcessoBagagem, eventosFinanceiros.getImpingreso()); + BigDecimal excessoBagagem = calculoExcessoBagagem(isAltaTemporada, ptovtaComissao, eventosFinanceiros.getImpingreso(), comissaoLog); + comissaoExcessoBagagem = MoneyHelper.somar(comissaoExcessoBagagem, excessoBagagem, 4); + + adicionarTextoComissaoLog(comissaoLog, TipoEventoExtra.EXCESSO_BAGAGEM.toString(), receitaExcessoBagagem, excessoBagagem); + } else if(TipoEventoExtra.SEGURO_OPCIONAL.toString().equals(eventosFinanceiros.getCvetipoevento())) { + receitaSeguroOpcional = MoneyHelper.somar(receitaSeguroOpcional, eventosFinanceiros.getImpingreso()); + BigDecimal segOpcional = calculoSeguroOpcional(isAltaTemporada, ptovtaComissao, eventosFinanceiros.getImpingreso(), comissaoLog); + comissaoSegOpcional = MoneyHelper.somar(comissaoSegOpcional, segOpcional, 4); + + adicionarTextoComissaoLog(comissaoLog, TipoEventoExtra.SEGURO_OPCIONAL.toString(), receitaSeguroOpcional, segOpcional); + } else { + receitaSeguroOutros = MoneyHelper.somar(receitaSeguroOutros, eventosFinanceiros.getImpingreso()); + BigDecimal outros = calculoOutros(isAltaTemporada, ptovtaComissao, eventosFinanceiros.getImpingreso(), comissaoLog); + comissaoOutros = MoneyHelper.somar(comissaoOutros, outros, 4); + + adicionarTextoComissaoLog(comissaoLog, "OUTROS", receitaSeguroOutros, outros); + } + + cr.getLsComissaoLog().add(comissaoLog); + } + + cr.setCancelados(cancelados); + cr.setCanceladosGAP(canceladosGAP); + cr.setDevolvidos(devolvidos); + cr.setDevolvidosGAP(devolvidosGAP); + cr.setDevolucoesOrigem(devolvidosOrigem); + cr.setDevolucoesOrigemGAP(devolvidosGAPOrigem); + + cr.setReceitaBPR(receitaBPR); + cr.setReceitaSeguro(receitaSeguroObrigatorio); + cr.setReceitaExcessoBagagem(receitaExcessoBagagem); + cr.setReceitaGAP(receitaGAP); + cr.setReceitaSeguroOpcional(receitaSeguroOpcional); + cr.setReceitaSeguroOutros(receitaSeguroOutros); + cr.setInternet(internet); + + cr.setGapImpressa(gapImpressa); + cr.setContImpressa(contImpressa); + + // Receita Comissão = Receita BPR + Receita GAP + Internet - Cancelados - Cancelados GAP - Devoluções - Devoluções GAP + receitaComissao = MoneyHelper.somar(receitaComissao,receitaBPR); + receitaComissao = MoneyHelper.somar(receitaComissao,receitaGAP); + receitaComissao = MoneyHelper.somar(receitaComissao,internet); + + receitaComissao = MoneyHelper.subtrair(receitaComissao,cancelados); + receitaComissao = MoneyHelper.subtrair(receitaComissao,devolvidos); + receitaComissao = MoneyHelper.subtrair(receitaComissao,devolvidosGAP); + receitaComissao = MoneyHelper.subtrair(receitaComissao,canceladosGAP); + + cr.setReceitaComissao(receitaComissao); + + cr.setComissaoBPRDiaria(comissaoBPR); + cr.setComissaoEntregaPassagemDiaria(comissaoEntregaPassagem); + cr.setComissaoExcessoBagagemDiaria(comissaoExcessoBagagem); + cr.setComissaoSegOpcionalDiaria(comissaoSegOpcional); + cr.setComissaoOutrosDiaria(comissaoOutros); + cr.setComissaoSeguroObrigatorioDiaria(comissaoSeguroObrigatorio); + + receitas.add(cr); + } + + return receitas; + + } + + private void adicionarTextoComissaoLog(ComissaoLogVO comissaoLog, String campo, BigDecimal receitaComissao, BigDecimal comissao) { + comissaoLog.setValorBase(receitaComissao); + comissaoLog.setValorComissao(comissao); + + StringBuilder sTexto = new StringBuilder(); + sTexto.append("[CAJADIVERSOS_ID: ") + .append(comissaoLog.getCajadiversosId()) + .append(": ") + .append("[RECEITA_") + .append(campo) + .append(": ") + .append(receitaComissao) + .append("] [COMISSAO_") + .append(campo) + .append(": ") + .append(comissao) + .append("]"); + + comissaoLog.setTexto(sTexto.toString()); + } + + private boolean isBilheteDevolucao(BoletoComissao rcc, boolean isDevolucaoComissaoTransferenciaGeraCaja) { + return rcc.isMotivocancelacionDevolvido() || + rcc.isMotivocancelacionGeracaoOcd() || + rcc.isMotivocancelacionTrocado() || + rcc.isMotivocancelacionQuitacaoOcd() || + (rcc.isMotivocancelacionTransferido() && !rcc.getIndreimpresion() && isDevolucaoComissaoTransferenciaGeraCaja); + } + + /** + * Verifica se o bilhete possui forma de pagamento Orden de Serviço + * Mantis #12391 + * @param rcc + * @return + */ + private boolean isBilheteOrdemServico(BoletoComissao rcc) { + for (FormapagoVO formapago : rcc.getFormapagos()) { + if(formapago.getFormapagoId() == Constantes.FORMA_PAGO_ORDEN_SERVICIO.intValue()) { + return true; + } + } + return false; + } + + private List verificaEventoFinanceiroProDia(List eventosFinanceirosVOs, Date dataRegistro) { + List aux = new ArrayList(); + if(eventosFinanceirosVOs != null) { + for (EventosFinanceirosVO rcc : eventosFinanceirosVOs) { + if(rcc.getFeccorte() != null) { + if (DateUtil.compareOnlyDate(rcc.getFeccorte(), dataRegistro) == 0) { + aux.add(rcc); + } + } + } + } + return aux; + } + + private List verificaCalculoComissaoProDia(List list, Date dataRegistro) { + List aux = new ArrayList(); + for (BoletoComissao rcc : list) { + if (DateUtil.compareOnlyDate(rcc.getFeccorte(), dataRegistro) == 0) { + aux.add(rcc); + } + } + return aux; + } + + @Override + public List relatorioCalculoComissao(Integer empresaId, Date competencia, Date dataInicial, Date dataFinal, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException, BusinessException { + List registrosCalculo = new ArrayList(); + List puntoventas = comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresaId); + Empresa empresa = empresaService.obtenerID(empresaId); + boolean indExibeComissaoZeradaAgencia = empresa.getIndExibeComissaoZeradaAgencia() != null ? empresa.getIndExibeComissaoZeradaAgencia() : false; + for (PuntoVenta puntoVenta : puntoventas) { + RegistroCalculo registroCalculo = null; + if(competencia != null) { + registroCalculo = relatorioCalculoComissao(puntoVenta.getPuntoventaId(), empresaId, competencia, usuarioId, isRetencaoDiaria, isRefazerCalculo); + } else if(dataInicial != null && dataFinal != null) { + registroCalculo = relatorioCalculoComissao(puntoVenta.getPuntoventaId(), empresaId, usuarioId, isRetencaoDiaria, isRefazerCalculo, dataInicial, dataFinal); + } + + if(registroCalculo == null) { + continue; + } + + /* + * Caso parametro de não exibir as agencias com comissão zerada esteja ativado + * o registro de calculo não deverá ser adicionado + * Mantis #12260 + */ + totalizarRegistroCalculo(registroCalculo, indExibeComissaoZeradaAgencia); + if(registroCalculo.getLsReceitas() != null && !registroCalculo.getLsReceitas().isEmpty()) { + registrosCalculo.add(registroCalculo); + } + } + ordernarResultado(registrosCalculo); + return registrosCalculo; + } + + private void ordernarResultado(List registrosCalculo) { + Collections.sort(registrosCalculo, new Comparator() { + @Override + public int compare(RegistroCalculo o1, RegistroCalculo o2) { + return o1.getNombpuntoventa().compareToIgnoreCase(o2.getNombpuntoventa()); + } + }); + } + + private void totalizarRegistroCalculo(RegistroCalculo registroCalculo, boolean indExibeComissaoZeradaAgencia) { + ComissaoReceita comissaoReceitaTotal = new ComissaoReceita(); + for (ComissaoReceita comissaoReceita : registroCalculo.getLsReceitas()) { + comissaoReceitaTotal.setNumPuntoVenta(registroCalculo.getNumPuntoVenta()); + comissaoReceitaTotal.setNombpuntoventa(registroCalculo.getNombpuntoventa()); + comissaoReceitaTotal.setReceitaComissao(comissaoReceitaTotal.getReceitaComissao().add(comissaoReceita.getReceitaComissao())); + comissaoReceitaTotal.setReceitaBPR(comissaoReceitaTotal.getReceitaBPR().add(comissaoReceita.getReceitaBPR())); + comissaoReceitaTotal.setReceitaGAP(comissaoReceitaTotal.getReceitaGAP().add(comissaoReceita.getReceitaGAP())); + comissaoReceitaTotal.setGapImpressa(comissaoReceitaTotal.getGapImpressa().add(comissaoReceita.getGapImpressa())); + comissaoReceitaTotal.setInternet(comissaoReceitaTotal.getInternet().add(comissaoReceita.getInternet())); + comissaoReceitaTotal.setCancelados(comissaoReceitaTotal.getCancelados().add(comissaoReceita.getCancelados())); + comissaoReceitaTotal.setCanceladosGAP(comissaoReceitaTotal.getCanceladosGAP().add(comissaoReceita.getCanceladosGAP())); + comissaoReceitaTotal.setDevolvidos(comissaoReceitaTotal.getDevolvidos().add(comissaoReceita.getDevolvidos())); + comissaoReceitaTotal.setDevolvidosGAP(comissaoReceitaTotal.getDevolvidosGAP().add(comissaoReceita.getDevolvidosGAP())); + comissaoReceitaTotal.setDevolucoesOrigem(comissaoReceitaTotal.getDevolucoesOrigem().add(comissaoReceita.getDevolucoesOrigem())); + comissaoReceitaTotal.setDevolucoesOrigemGAP(comissaoReceitaTotal.getDevolucoesOrigemGAP().add(comissaoReceita.getDevolucoesOrigemGAP())); + comissaoReceitaTotal.setReceitaExcessoBagagem(comissaoReceitaTotal.getReceitaExcessoBagagem().add(comissaoReceita.getReceitaExcessoBagagem())); + comissaoReceitaTotal.setReceitaSeguroOpcional(comissaoReceitaTotal.getReceitaSeguroOpcional().add(comissaoReceita.getReceitaSeguroOpcional())); + comissaoReceitaTotal.setReceitaSeguroOutros(comissaoReceitaTotal.getReceitaSeguroOutros().add(comissaoReceita.getReceitaSeguroOutros())); + comissaoReceitaTotal.setContImpressa(comissaoReceitaTotal.getContImpressa() + comissaoReceita.getContImpressa()); + comissaoReceitaTotal.setComissaoBPRDiaria(comissaoReceitaTotal.getComissaoBPRDiaria().add(comissaoReceita.getComissaoBPRDiaria())); + comissaoReceitaTotal.setComissaoExcessoBagagemDiaria(comissaoReceitaTotal.getComissaoExcessoBagagemDiaria().add(comissaoReceita.getComissaoExcessoBagagemDiaria())); + comissaoReceitaTotal.setComissaoSegOpcionalDiaria(comissaoReceitaTotal.getComissaoSegOpcionalDiaria().add(comissaoReceita.getComissaoSegOpcionalDiaria())); + comissaoReceitaTotal.setComissaoEntregaPassagemDiaria(comissaoReceitaTotal.getComissaoEntregaPassagemDiaria().add(comissaoReceita.getComissaoEntregaPassagemDiaria())); + comissaoReceitaTotal.setComissaoOutrosDiaria(comissaoReceitaTotal.getComissaoOutrosDiaria().add(comissaoReceita.getComissaoOutrosDiaria())); + } + registroCalculo.getLsReceitas().clear(); + if(indExibeComissaoZeradaAgencia || + (MoneyHelper.isMaior(comissaoReceitaTotal.getTotal(), BigDecimal.ZERO) || MoneyHelper.isMaior(comissaoReceitaTotal.getTotalComissao(), BigDecimal.ZERO))) { + registroCalculo.getLsReceitas().add(comissaoReceitaTotal); + } + } + + @Override + public void registrarCalculoComissao(Empresa empresa, Date periodo, boolean ignorarComissaoGerada, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo) throws ComissaoException { + List puntoventas = comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresa.getEmpresaId()); + for (PuntoVenta puntoVenta : puntoventas) { + registrarCalculoComissao(puntoVenta, empresa, periodo, ignorarComissaoGerada, usuarioId, isRetencaoDiaria, isRefazerCalculo); + } + } + + @Override + public void cancelarCalculoComissao(Integer empresaId, Date periodo) throws ComissaoException, BusinessException { + try { + List puntoventas = comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresaId); + for (PuntoVenta puntoVenta : puntoventas) { + try { + cancelarCalculoComissao(puntoVenta.getPuntoventaId(), empresaId, periodo); + } catch (ComissaoException e) { + /* Ignora a comissa quando o cancelamento é feito para todas as agencias */ + } catch (Exception e) { + throw e; + } + } + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public List relatorioReciboComissao(Integer puntoVentaId, Integer empresaId, String competencia) throws ComissaoException { + try { + Map parametros = new HashMap(); + if(StringUtils.isNotBlank(competencia)) { + parametros.put("competenciaInicial", competencia); + parametros.put("competenciaFinal", competencia); + } + if(puntoVentaId != null && puntoVentaId > -1) { + parametros.put("puntoventaId", puntoVentaId); + } + if(empresaId != null) { + parametros.put("empresaId", empresaId); + } + + return comissaoDAO.buscaHistoricoComissao(parametros); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new ComissaoException(e.getMessage(), e); + } + } + + @Override + public boolean enviarEmailReciboComissao(HistoricoComissao historicoComissao, byte[] recibo) { + try { + EmailConfigVO emailConfig = carregarConfiguracoesEmail(historicoComissao); + + if(emailConfig != null && StringUtils.isNotBlank(historicoComissao.getDescCorreo())) { + SendMail mail = new SendMail(); + mail.setEmailTo(historicoComissao.getDescCorreo()); + mail.setEmailFrom(emailConfig.getSmtpEmail()); + mail.setSmtpHost(emailConfig.getSmtp()); + mail.setSmtpPassword(emailConfig.getSenha()); + mail.setSmtpPort(emailConfig.getSmtpPorta()); + mail.setSmtpUser(emailConfig.getSmtpEmail()); + mail.setAuth(emailConfig.isAutenticacao()); + + if (StringUtils.isNotEmpty(emailConfig.getTipoAutorizacao())) { + mail.setAuthType(AuthType.valueOf(emailConfig.getTipoAutorizacao())); + } + + String assunto = null; + String texto = null; + String nomeArquivo = null; + if(StringUtils.isNotBlank(historicoComissao.getCompetencia())) { + assunto = Labels.getLabel("busquedaCalculoComissaoController.recibo.email.assunto", new String[] {Labels.getLabel("busquedaImportacionFiscalController.lbCompetencia.label"), historicoComissao.getCompetencia()}); + texto = Labels.getLabel("busquedaCalculoComissaoController.recibo.email.texto", new String[] {Labels.getLabel("busquedaImportacionFiscalController.lbCompetencia.label"), historicoComissao.getCompetencia()}); + nomeArquivo = historicoComissao.getCompetencia(); + } else if(historicoComissao.getDataInicial() != null && historicoComissao.getDataFinal() != null){ + StringBuilder sDatas = new StringBuilder(); + sDatas.append(DateUtil.getStringDate(historicoComissao.getDataInicial(), "dd/MM/yyyy")) + .append(" ") + .append(Labels.getLabel("lb.ate")) + .append(" ") + .append(DateUtil.getStringDate(historicoComissao.getDataFinal(), "dd/MM/yyyy")); + assunto = Labels.getLabel("busquedaCalculoComissaoController.recibo.email.assunto", new String[] {"Periodo", sDatas.toString()}); + texto = Labels.getLabel("busquedaCalculoComissaoController.recibo.email.texto", new String[] {"Periodo", sDatas.toString()}); + nomeArquivo = sDatas.toString().replaceAll(" ", "_"); + } + + mail.setSubject(assunto); + mail.setText(texto); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(recibo.length); + baos.write(recibo, 0, recibo.length); + + + mail.addAnexo(Labels.getLabel("busquedaCalculoComissaoController.recibo.email.nomeAnexo", new String[] {nomeArquivo}).concat(".pdf"), baos, MimeType.PDF); + mail.send(); + + return true; + } + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return false; + } + + private EmailConfigVO carregarConfiguracoesEmail(HistoricoComissao historicoComissao) { + EmailConfigVO emailConfigVO = carregarConstantesEmail(); + if(emailConfigVO == null && historicoComissao.getEmpresaId() != null) { + EmpresaEmailConfig empresaEmailConfig = empresaEmailConfigService.buscarPorEmpresa(new Empresa(historicoComissao.getEmpresaId())); + if(empresaEmailConfig != null) { + emailConfigVO = new EmailConfigVO(); + emailConfigVO.setAutenticacao(BooleanUtils.toBoolean(empresaEmailConfig.getIndAutenticacao())); + emailConfigVO.setSenha(empresaEmailConfig.getSenha()); + emailConfigVO.setSmtp(empresaEmailConfig.getSmtp()); + emailConfigVO.setSmtpEmail(empresaEmailConfig.getSmtpEmail()); + emailConfigVO.setSmtpUser(empresaEmailConfig.getSmtpEmail()); + emailConfigVO.setSmtpPorta(empresaEmailConfig.getSmtpPorta()); + if (emailConfigVO.getTipoAutorizacao() != null) { + emailConfigVO.setTipoAutorizacao(empresaEmailConfig.getTipoAutorizacao()); + } + } + } + return emailConfigVO; + } + + private EmailConfigVO carregarConstantesEmail() { + EmailConfigVO emailConfigVO = new EmailConfigVO(); + Constante constante = constanteService.buscarPorNomeConstante(Constantes.SMTP_COMISSAO_EMAIL); + if(constante == null) { + return null; + } + emailConfigVO.setSmtpEmail(constante.getValorconstante()); + + constante = constanteService.buscarPorNomeConstante(Constantes.SMTP_COMISSAO_HOST); + if(constante == null) { + return null; + } + emailConfigVO.setSmtp(constante.getValorconstante()); + + constante = constanteService.buscarPorNomeConstante(Constantes.SMTP_COMISSAO_AUTENTICACAO); + if(constante == null) { + return null; + } + emailConfigVO.setAutenticacao(BooleanUtils.toBoolean(constante.getValorconstante())); + + constante = constanteService.buscarPorNomeConstante(Constantes.SMTP_COMISSAO_PASS); + if(constante == null) { + return null; + } + emailConfigVO.setSenha(constante.getValorconstante()); + + constante = constanteService.buscarPorNomeConstante(Constantes.SMTP_COMISSAO_PORT); + if(constante == null) { + return null; + } + emailConfigVO.setSmtpPorta(constante.getValorconstante()); + + constante = constanteService.buscarPorNomeConstante(Constantes.SMTP_COMISSAO_USER); + if(constante == null) { + return null; + } + emailConfigVO.setSmtpUser(constante.getValorconstante()); + + return emailConfigVO; + } + + private Date getDate(int dia, int mes, int ano) { + Calendar cData = Calendar.getInstance(); + cData.set(Calendar.DAY_OF_MONTH, dia); + cData.set(Calendar.MONTH, mes); + cData.set(Calendar.YEAR, ano); + return DateUtil.normalizarToFecha(cData.getTime()); + } + + @Override + public void registrarCalculoComissao(PuntoVenta puntoVenta, Empresa empresa, Date dataInicial, Date dataFinal, Integer usuarioId) throws ComissaoException, BusinessException { + try { + Calendar cDataAtual = Calendar.getInstance(); + cDataAtual.setTime(dataInicial); + while(DateUtil.compareOnlyDate(cDataAtual.getTime(), dataFinal) <= 0) { + realizarCalculoComissao(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), cDataAtual.getTime(), true, usuarioId, true); + cDataAtual.add(Calendar.DAY_OF_MONTH, 1); + } + } catch (ComissaoException e) { + log.error(e.getMessage(), e); + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) + public void retencaoAutomaticaComissao(Date dataRetencao) { + Integer usuarioId = 1; + if (UsuarioLogado.getUsuarioLogado() != null && UsuarioLogado.getUsuarioLogado().getUsuarioId() != null) { + usuarioId = UsuarioLogado.getUsuarioLogado().getUsuarioId(); + } + + List empresas = empresaService.buscarEmpresaPtoVtaComissao(); + List puntoVentas = puntoVentaService.buscarPuntoVentaPtoVtaComissao(empresas); + + String sDataRetencao = DateUtil.getStringDate(dataRetencao, "dd/MM/yyyy"); + + for (Empresa empresa : empresas) { + for (PuntoVenta puntoVenta : puntoVentas) { + String descretencao = "Empresa: "+ empresa.getNombempresa() + " - Agencia: " + puntoVenta.getNombpuntoventa() +" data: " + sDataRetencao; + log.info("Inicio Retencao " + descretencao); + try { + registrarCalculoComissao(puntoVenta, empresa, dataRetencao, dataRetencao, usuarioId); + log.info("Fim Retencao " + descretencao); + } catch (Exception e) { + log.info("Erro retencao " + descretencao); + log.error(e.getMessage(), e); + } + } + } + + /* Atualizando controle da retencao automatica */ + try { + ctrlFechamentoCaixaService.atualizarCtrlFechamentoCaixaStatus(CtrlFechamentoCaixaStatus.RETENCAO_COMISSAO_CONCLUIDA, dataRetencao); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + + @Override + public RegistroCalculo relatorioCalculoComissao(Integer puntoVentaId, Integer empresaId, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo, Date dataInicial, Date dataFinal) throws ComissaoException, BusinessException { + Conferencia conferencia = new Conferencia(); + conferencia.setPuntoVenta(new PuntoVenta(puntoVentaId)); + conferencia.setEmpresa(new Empresa(empresaId)); + conferencia.setDataInicial(dataInicial); + conferencia.setDataFinal(dataFinal); + + return realizarCalculoComissao(puntoVentaId, empresaId, usuarioId, isRefazerCalculo, conferencia, dataInicial, dataFinal, false); + } + + @Override + public void registrarCalculoComissaoPeriodo(PuntoVenta puntoVenta, Empresa empresa, boolean ignorarComissaoGerada, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo, Date dataInicial, Date dataFinal) throws ComissaoException { + + try { + + if (validaPeriodo(dataInicial, dataFinal)) { + + if(isRetencaoDiaria || conferenciaComissaoService.isConferenciaCompetenciaEncerrada(dataInicial, dataFinal, empresa, puntoVenta, false)) { + Comissao comissaoCadastrada = comissaoDAO.buscaComissaoVigencia(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), dataInicial, dataFinal); + if (comissaoCadastrada == null) { + + Conferencia conferencia = new Conferencia(); + conferencia.setPuntoVenta(puntoVenta); + conferencia.setEmpresa(empresa); + conferencia.setDataInicial(dataInicial); + conferencia.setDataFinal(dataFinal); + + RegistroCalculo rc = realizarCalculoComissao(puntoVenta.getPuntoventaId(), empresa.getEmpresaId(), usuarioId, isRefazerCalculo, conferencia, dataInicial, dataFinal, isRetencaoDiaria); + + gravarComissao(puntoVenta, empresa, rc, null, dataInicial, dataFinal); + } else if(!ignorarComissaoGerada){ + StringBuilder sDatas = new StringBuilder(); + sDatas.append(DateUtil.getStringDate(comissaoCadastrada.getDataInicial(), "dd/MM/yyyy")) + .append(" ") + .append(Labels.getLabel("lb.ate")) + .append(" ") + .append(DateUtil.getStringDate(comissaoCadastrada.getDataFinal(), "dd/MM/yyyy")); + throw new ComissaoException("busquedaCalculoComissaoController.registroPeriodo.exception", null, comissaoCadastrada.getPuntoVenta().getNombpuntoventa(), sDatas.toString()); + } + } else { + StringBuilder sDatas = new StringBuilder(); + sDatas.append(DateUtil.getStringDate(dataInicial, "dd/MM/yyyy")) + .append(" ") + .append(Labels.getLabel("lb.ate")) + .append(" ") + .append(DateUtil.getStringDate(dataFinal, "dd/MM/yyyy")); + throw new ComissaoException("busquedaCalculoComissaoController.conferenciaNaoEncerradaPeriodo.exception", null, puntoVenta.getNombpuntoventa(), sDatas.toString()); + } + } else { + throw new ComissaoException("busquedaCalculoComissaoController.periodo.exception"); + } + + } catch (ComissaoException e) { + log.error(e.getMessage(), e); + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new ComissaoException(e.getMessage(), e); + } + } + + @Override + public void registrarCalculoComissaoPeriodo(Empresa empresa, boolean ignorarComissaoGerada, Integer usuarioId, Boolean isRetencaoDiaria, Boolean isRefazerCalculo, Date dataInicial, Date dataFinal) throws ComissaoException { + List puntoventas = comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresa.getEmpresaId()); + for (PuntoVenta puntoVenta : puntoventas) { + registrarCalculoComissaoPeriodo(puntoVenta, empresa, ignorarComissaoGerada, usuarioId, isRetencaoDiaria, isRefazerCalculo, dataInicial, dataFinal); + } + } + + @Override + public void cancelarCalculoComissaoPeriodo(Integer puntoVentaId, Integer empresaId, Date dataInicial, Date dataFinal) throws ComissaoException, BusinessException { + try { + Comissao comissao = comissaoDAO.buscaComissaoVigencia(puntoVentaId, empresaId, dataInicial, dataFinal); + if (comissao != null) { + comissaoService.borrar(comissao); + } else { + throw new ComissaoException("busquedaCalculoComissaoController.comissao.exception"); + } + } catch (ComissaoException e) { + log.error(e.getMessage(), e); + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public void cancelarCalculoComissaoPeriodo(Integer empresaId, Date dataInicial, Date dataFinal) throws ComissaoException, BusinessException { + try { + List puntoventas = comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresaId); + for (PuntoVenta puntoVenta : puntoventas) { + try { + cancelarCalculoComissaoPeriodo(puntoVenta.getPuntoventaId(), empresaId, dataInicial, dataFinal); + } catch (ComissaoException e) { + } catch (Exception e) { + throw e; + } + } + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public List relatorioReciboComissao(Integer puntoVentaId, Integer empresaId, Date dataInicial, Date dataFinal) throws ComissaoException { + try { + Map parametros = new HashMap(); + if(dataInicial != null) { + parametros.put("dataInicial", DateUtil.getStringDate(dataInicial, "dd/MM/yyyy")); + } + if(dataFinal != null) { + parametros.put("dataFinal", DateUtil.getStringDate(dataFinal, "dd/MM/yyyy")); + } + if(puntoVentaId != null && puntoVentaId > -1) { + parametros.put("puntoventaId", puntoVentaId); + } + if(empresaId != null) { + parametros.put("empresaId", empresaId); + } + + return comissaoDAO.buscaHistoricoComissao(parametros); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new ComissaoException(e.getMessage(), e); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CancelacionCargoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CancelacionCargoServiceImpl.java new file mode 100644 index 000000000..661c644c9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CancelacionCargoServiceImpl.java @@ -0,0 +1,57 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CancelacionCargoDAO; +import com.rjconsultores.ventaboletos.entidad.CancelacionCargo; +import com.rjconsultores.ventaboletos.service.CancelacionCargoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +/** + * + * @author Rafius + */ +@Service("cancelacionCargoService") +public class CancelacionCargoServiceImpl implements CancelacionCargoService { + + @Autowired + private CancelacionCargoDAO cancelacionCargoDAO; + + public List obtenerTodos() { + return cancelacionCargoDAO.obtenerTodos(); + } + + public CancelacionCargo obtenerID(Integer id) { + return cancelacionCargoDAO.obtenerID(id); + } + + public CancelacionCargo suscribir(CancelacionCargo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cancelacionCargoDAO.suscribir(entidad); + } + + public CancelacionCargo actualizacion(CancelacionCargo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cancelacionCargoDAO.actualizacion(entidad); + } + + public void borrar(CancelacionCargo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cancelacionCargoDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CancelacionCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CancelacionCtrlServiceImpl.java new file mode 100644 index 000000000..ebac25784 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CancelacionCtrlServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CancelacionCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.CancelacionCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.CancelacionCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("cancelacionCtrlService") +public class CancelacionCtrlServiceImpl implements CancelacionCtrlService { + + @Autowired + private CancelacionCtrlDAO cancelacionCtrlDAO; + + public List obtenerTodos() { + return cancelacionCtrlDAO.obtenerTodos(); + } + + public CancelacionCtrl obtenerID(Integer id) { + return cancelacionCtrlDAO.obtenerID(id); + } + + @Transactional + public CancelacionCtrl suscribir(CancelacionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cancelacionCtrlDAO.suscribir(entidad); + } + + @Transactional + public CancelacionCtrl actualizacion(CancelacionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cancelacionCtrlDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CancelacionCtrl entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cancelacionCtrlDAO.actualizacion(entidad); + } + + public List buscar(Date tiempoprevsalida, PuntoVenta puntoVenta, Parada paradaOrigem, Parada paradaDestino, Marca marca) { + return cancelacionCtrlDAO.buscar(tiempoprevsalida,puntoVenta,paradaOrigem,paradaDestino,marca); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CasetaPeajeExcepcionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CasetaPeajeExcepcionServiceImpl.java new file mode 100644 index 000000000..0a667716f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CasetaPeajeExcepcionServiceImpl.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CasetaPeajeExcepcionDAO; +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; +import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion; +import com.rjconsultores.ventaboletos.service.CasetaPeajeExcepcionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("casetaPeajeExcepcionService") +public class CasetaPeajeExcepcionServiceImpl implements CasetaPeajeExcepcionService { + + @Autowired + private CasetaPeajeExcepcionDAO casetaPeajeExcepcionDAO; + + @Override + public List buscarPorCasetaPeaje(CasetaPeaje caseta){ + return casetaPeajeExcepcionDAO.obtenerPorCasetaPeaje(caseta); + } + + @Override + public List obtenerTodos() { + return casetaPeajeExcepcionDAO.obtenerTodos(); + } + + @Override + public CasetaPeajeExcepcion obtenerID(Integer id) { + return casetaPeajeExcepcionDAO.obtenerID(id); + } + + @Transactional + public CasetaPeajeExcepcion suscribir(CasetaPeajeExcepcion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return casetaPeajeExcepcionDAO.suscribir(entidad); + } + + @Transactional + public CasetaPeajeExcepcion actualizacion(CasetaPeajeExcepcion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return casetaPeajeExcepcionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CasetaPeajeExcepcion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + casetaPeajeExcepcionDAO.borrar(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CasetaPeajeServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CasetaPeajeServiceImpl.java new file mode 100644 index 000000000..a00d13fab --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CasetaPeajeServiceImpl.java @@ -0,0 +1,99 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CasetaPeajeDAO; +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; +import com.rjconsultores.ventaboletos.entidad.CasetaPeajeExcepcion; +import com.rjconsultores.ventaboletos.service.CasetaPeajeService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("casetaPeajeService") +public class CasetaPeajeServiceImpl implements CasetaPeajeService { + + @Autowired + private CasetaPeajeDAO casetaPeajeDAO; + + @Override + public List obtenerTodos() { + return casetaPeajeDAO.obtenerTodos(); + } + + @Override + public List buscarTodosOrdenadoPorDescricao() { + return casetaPeajeDAO.buscarTodosOrdenadoPorDescricao(); + } + + @Transactional + public CasetaPeaje obtenerID(Integer id) { + return casetaPeajeDAO.obtenerID(id); + } + + @Transactional + public CasetaPeaje suscribir(CasetaPeaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return casetaPeajeDAO.suscribir(entidad); + } + + @Transactional + public CasetaPeaje actualizacion(CasetaPeaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return casetaPeajeDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CasetaPeaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + casetaPeajeDAO.actualizacion(entidad); + } + + @Override + public List buscar(String descricaoCasetaPeaje) { + return casetaPeajeDAO.buscar(descricaoCasetaPeaje); + } + + @Override + public Boolean validarDescricaoCasetaPeaje(CasetaPeaje casetaPeaje) { + List pracas = buscar(casetaPeaje.getDesccaseta()); + + if(casetaPeaje.getCasetaPeajeId() == null) { + if(pracas.isEmpty()){ + return Boolean.TRUE; + } + } else { + if(pracas.isEmpty() || pracas.get(0).getCasetaPeajeId().equals(casetaPeaje.getCasetaPeajeId())) { + return Boolean.TRUE; + } else { + return Boolean.FALSE; + } + } + + return Boolean.FALSE; + } + + @Override + public void deletarVigencias(List cpes) { + casetaPeajeDAO.deletarVigencias(cpes); + } + + @Override + @Transactional + public CasetaPeaje suscribirOrActualizacion(CasetaPeaje casetaPeaje) { + if(casetaPeaje.getCasetaPeajeId() == null) { + return suscribir(casetaPeaje); + } else { + return actualizacion(casetaPeaje); + } + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaBloqueioImpPosteriorServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaBloqueioImpPosteriorServiceImpl.java new file mode 100644 index 000000000..1f8b102e3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaBloqueioImpPosteriorServiceImpl.java @@ -0,0 +1,44 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CategoriaBloqueioImpPosteriorDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaBloqueioImpPosterior; +import com.rjconsultores.ventaboletos.service.CategoriaBloqueioImpPosteriorService; + +@Service("categoriaBloqueioImpPosteriorService") +public class CategoriaBloqueioImpPosteriorServiceImpl implements CategoriaBloqueioImpPosteriorService { + + @Autowired + private CategoriaBloqueioImpPosteriorDAO categoriaDAO; + + public List obtenerTodos() { + return categoriaDAO.obtenerTodos(); + } + + public CategoriaBloqueioImpPosterior obtenerID(Integer id) { + return categoriaDAO.obtenerID(id); + } + + @Transactional + public CategoriaBloqueioImpPosterior suscribir(CategoriaBloqueioImpPosterior entidad) { + + return categoriaDAO.suscribir(entidad); + } + + @Transactional + public CategoriaBloqueioImpPosterior actualizacion(CategoriaBloqueioImpPosterior entidad) { + + return categoriaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaBloqueioImpPosterior entidad) { + + categoriaDAO.borrar(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaClaseServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaClaseServiceImpl.java new file mode 100644 index 000000000..58f8a6f8a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaClaseServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaClaseDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaClase; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.service.CategoriaClaseService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaClaseService") +public class CategoriaClaseServiceImpl implements CategoriaClaseService { + + @Autowired + private CategoriaClaseDAO categoriaClaseDAO; + + public List obtenerTodos() { + return categoriaClaseDAO.obtenerTodos(); + } + + public CategoriaClase obtenerID(Integer id) { + return categoriaClaseDAO.obtenerID(id); + } + + @Transactional + public CategoriaClase suscribir(CategoriaClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaClaseDAO.suscribir(entidad); + } + + @Transactional + public CategoriaClase actualizacion(CategoriaClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaClaseDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + + categoriaClaseDAO.actualizacion(entidad); + } + + public CategoriaClase busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + return categoriaClaseDAO.busquedaPoCategoriaCtrl(categoriaCtrl); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCorridaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCorridaServiceImpl.java new file mode 100644 index 000000000..d9f5e822c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCorridaServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaCorridaDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCorrida; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.service.CategoriaCorridaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaCorridaService") +public class CategoriaCorridaServiceImpl implements CategoriaCorridaService { + + @Autowired + private CategoriaCorridaDAO categoriaCorridaDAO; + + public List obtenerTodos() { + return categoriaCorridaDAO.obtenerTodos(); + } + + public CategoriaCorrida obtenerID(Integer id) { + return categoriaCorridaDAO.obtenerID(id); + } + + @Transactional + public CategoriaCorrida suscribir(CategoriaCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaCorridaDAO.suscribir(entidad); + } + + @Transactional + public CategoriaCorrida actualizacion(CategoriaCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaCorridaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + + categoriaCorridaDAO.actualizacion(entidad); + } + + public CategoriaCorrida busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + return categoriaCorridaDAO.busquedaPoCategoriaCtrl(categoriaCtrl); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java new file mode 100644 index 000000000..d493d7c5b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java @@ -0,0 +1,197 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CategoriaCtrlDAO; +import com.rjconsultores.ventaboletos.dao.CategoriaDAO; +import com.rjconsultores.ventaboletos.dao.ConstanteDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.CategoriaClase; +import com.rjconsultores.ventaboletos.entidad.CategoriaCorrida; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import com.rjconsultores.ventaboletos.entidad.CategoriaMarca; +import com.rjconsultores.ventaboletos.entidad.CategoriaMercado; +import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.service.CategoriaCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("categoriaCtrlService") +public class CategoriaCtrlServiceImpl implements CategoriaCtrlService { + + public static final int CATEGORIA_ADULTO = 1; + private static final String CVE_SISTEMA_CATEGORIA_FIDELIDADE = "FIDELIDADE"; + private static final String CONSTANTE_URL_WS_FIDELIDADE = "URL_WS_FIDELIDADE"; + private static final String CONSTANTE_SENHA_WS_FIDELIDADE = "SENHA_WS_FIDELIDADE"; + private static final String CONSTANTE_USUARIO_WS_FIDELIDADE = "USUARIO_WS_FIDELIDADE"; + private static final int CANT_MAX_CATEGORIA_ADULTO = 200; + @Autowired + private CategoriaCtrlDAO categoriaCtrlDAO; + @Autowired + private CategoriaDAO categoriaDAO; + + @Autowired + private ConstanteDAO constanteDAO; + + @Override + public CategoriaCtrl obtenerID(Integer id) { + return categoriaCtrlDAO.obtenerID(id); + } + + @Override + @Transactional + public CategoriaCtrl suscribir(CategoriaCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaCtrlDAO.suscribir(entidad); + } + + /** + * Verifica se existe la categoria adulto. Sino existe, la adicciona. + * + * @param categoriaCtrl + */ + @Override + public CategoriaCtrl checarCategoriaAdulto(CategoriaCtrl categoriaCtrl) { + boolean existeAdulto = false; + List lsCategorias = new ArrayList(); + lsCategorias.addAll(categoriaCtrl.getCategoriaDescuentoList()); + + for (CategoriaDescuento cd : categoriaCtrl.getCategoriaDescuentoList()) { + if (cd.getCategoria().getCategoriaId().equals(CATEGORIA_ADULTO)) { + existeAdulto = true; + } + } + if (!existeAdulto) { + CategoriaDescuento categoriaDescuentoAdulto = this.getCategoriaDescuentoAdulto(categoriaCtrl); + lsCategorias.add(categoriaDescuentoAdulto); + } + categoriaCtrl.setCategoriaDescuentoList(lsCategorias); + return categoriaCtrl; + } + + @Override + @Transactional + public CategoriaCtrl actualizacion(CategoriaCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaCtrlDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(CategoriaCtrl entidad) { + + for (CategoriaClase cc : entidad.getCategoriaClaseList()) { + cc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cc.setFecmodif(Calendar.getInstance().getTime()); + cc.setActivo(Boolean.FALSE); + } + for (CategoriaCorrida cc : entidad.getCategoriaCorridaList()) { + cc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cc.setFecmodif(Calendar.getInstance().getTime()); + cc.setActivo(Boolean.FALSE); + } + for (CategoriaDescuento cc : entidad.getCategoriaDescuentoList()) { + cc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cc.setFecmodif(Calendar.getInstance().getTime()); + cc.setActivo(Boolean.FALSE); + } + for (CategoriaMarca cc : entidad.getCategoriaMarcaList()) { + cc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cc.setFecmodif(Calendar.getInstance().getTime()); + cc.setActivo(Boolean.FALSE); + } + for (CategoriaMercado cc : entidad.getCategoriaMercadoList()) { + cc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cc.setFecmodif(Calendar.getInstance().getTime()); + cc.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaCtrlDAO.actualizacion(entidad); + } + + private CategoriaDescuento getCategoriaDescuentoAdulto(CategoriaCtrl categoriaCtrl) { + CategoriaDescuento cd = new CategoriaDescuento(); + cd.setActivo(Boolean.TRUE); + cd.setCantautorizada(CANT_MAX_CATEGORIA_ADULTO); + cd.setCategoria(categoriaDAO.obtenerID(CATEGORIA_ADULTO)); + cd.setDescuentoimporte(BigDecimal.ZERO); + cd.setDescuentoporc(BigDecimal.ZERO); + + CategoriaPeriodo cp = new CategoriaPeriodo(); + cp.setActivo(Boolean.TRUE); + cp.setCategoriaDescuento(cd); + + Calendar datFin = Calendar.getInstance(); + datFin.set(2300, 11, 31); + + Calendar datInicio = Calendar.getInstance(); + datInicio.set(2000, 11, 31); + + cp.setFecfin(datFin.getTime()); + cp.setFecinicio(datInicio.getTime()); + + cp.setFecmodif(new java.util.Date()); + cp.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + List lsCatPeriodo = new ArrayList(); + lsCatPeriodo.add(cp); + + cd.setCategoriaPeriodoList(lsCatPeriodo); + cd.setCategoriaCtrl(categoriaCtrl); + cd.setFecmodif(new java.util.Date()); + cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + cd.setIndAplicaFeriado(CategoriaDescuento.DisponibilidadeFeriado.GERARSEMPRE.valor()); + cd.setIndImporteOutros(true); + cd.setIndImportePedagio(true); + cd.setIndImporteSeguro(true); + cd.setIndImporteTxEmbarque(true); + + return cd; + } + + @Override + public boolean validaCategoriaProgramaFidelidade(Categoria categoria){ + + if(categoria.getCvesistema() != null && categoria.getCvesistema().equals(CVE_SISTEMA_CATEGORIA_FIDELIDADE)){ + Constante url = constanteDAO.buscarPorNomeConstante(CONSTANTE_URL_WS_FIDELIDADE); + Constante usuario = constanteDAO.buscarPorNomeConstante(CONSTANTE_USUARIO_WS_FIDELIDADE); + Constante senha = constanteDAO.buscarPorNomeConstante(CONSTANTE_SENHA_WS_FIDELIDADE); + + if(url == null || url.getValorconstante() == null || url.getValorconstante().isEmpty() || + usuario == null || usuario.getValorconstante() == null || usuario.getValorconstante().isEmpty() || + senha == null || senha.getValorconstante() == null || senha.getValorconstante().isEmpty()){ + + return Boolean.FALSE; + } + } + + return Boolean.TRUE; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaDescuentoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaDescuentoServiceImpl.java new file mode 100644 index 000000000..2fba5f7f1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaDescuentoServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaDescuentoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import com.rjconsultores.ventaboletos.service.CategoriaDescuentoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaDescuentoService") +public class CategoriaDescuentoServiceImpl implements CategoriaDescuentoService { + + @Autowired + private CategoriaDescuentoDAO categoriaDescuentoDAO; + + public List obtenerTodos() { + return categoriaDescuentoDAO.obtenerTodos(); + } + + public CategoriaDescuento obtenerID(Integer id) { + return categoriaDescuentoDAO.obtenerID(id); + } + + @Transactional + public CategoriaDescuento suscribir(CategoriaDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaDescuentoDAO.suscribir(entidad); + } + + @Transactional + public CategoriaDescuento actualizacion(CategoriaDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaDescuentoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaDescuentoDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaMarcaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaMarcaServiceImpl.java new file mode 100644 index 000000000..9831bc3cf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaMarcaServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMarca; +import com.rjconsultores.ventaboletos.service.CategoriaMarcaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaMarcaService") +public class CategoriaMarcaServiceImpl implements CategoriaMarcaService { + + @Autowired + private CategoriaMarcaDAO categoriaMarcaDAO; + + public List obtenerTodos() { + return categoriaMarcaDAO.obtenerTodos(); + } + + public CategoriaMarca obtenerID(Integer id) { + return categoriaMarcaDAO.obtenerID(id); + } + + @Transactional + public CategoriaMarca suscribir(CategoriaMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaMarcaDAO.suscribir(entidad); + } + + @Transactional + public CategoriaMarca actualizacion(CategoriaMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaMarcaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaMarcaDAO.actualizacion(entidad); + } + + public CategoriaMarca busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + return categoriaMarcaDAO.busquedaPoCategoriaCtrl(categoriaCtrl); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaMercadoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaMercadoServiceImpl.java new file mode 100644 index 000000000..b25b42bbc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaMercadoServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaMercado; +import com.rjconsultores.ventaboletos.service.CategoriaMercadoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaMercadoService") +public class CategoriaMercadoServiceImpl implements CategoriaMercadoService { + + @Autowired + private CategoriaMercadoDAO categoriaMercadoDAO; + + public List obtenerTodos() { + return categoriaMercadoDAO.obtenerTodos(); + } + + public CategoriaMercado obtenerID(Integer id) { + return categoriaMercadoDAO.obtenerID(id); + } + + @Transactional + public CategoriaMercado suscribir(CategoriaMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaMercadoDAO.suscribir(entidad); + } + + @Transactional + public CategoriaMercado actualizacion(CategoriaMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaMercadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaMercadoDAO.actualizacion(entidad); + } + + public CategoriaMercado busquedaPoCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + return categoriaMercadoDAO.busquedaPoCategoriaCtrl(categoriaCtrl); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaOrgaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaOrgaoServiceImpl.java new file mode 100644 index 000000000..a282250bb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaOrgaoServiceImpl.java @@ -0,0 +1,63 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaOrgaoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.entidad.CategoriaOrgao; +import com.rjconsultores.ventaboletos.service.CategoriaOrgaoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + + +@Service("categoriaOrgaoService") +public class CategoriaOrgaoServiceImpl implements CategoriaOrgaoService { + + @Autowired + private CategoriaOrgaoDAO categoriaOrgaoDAO; + + public List obtenerTodos() { + return categoriaOrgaoDAO.obtenerTodos(); + } + + public CategoriaOrgao obtenerID(Integer id) { + return categoriaOrgaoDAO.obtenerID(id); + } + + @Transactional + public CategoriaOrgao suscribir(CategoriaOrgao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaOrgaoDAO.suscribir(entidad); + } + + @Transactional + public CategoriaOrgao actualizacion(CategoriaOrgao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaOrgaoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaOrgao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaOrgaoDAO.actualizacion(entidad); + } + + public CategoriaOrgao busquedaPorCategoriaCtrl(CategoriaCtrl categoriaCtrl) { + return categoriaOrgaoDAO.busquedaPorCategoriaCtrl(categoriaCtrl); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaPeriodoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaPeriodoServiceImpl.java new file mode 100644 index 000000000..a788fa353 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaPeriodoServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaPeriodoDAO; +import com.rjconsultores.ventaboletos.entidad.CategoriaDescuento; +import com.rjconsultores.ventaboletos.entidad.CategoriaPeriodo; +import com.rjconsultores.ventaboletos.service.CategoriaPeriodoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaPeriodoService") +public class CategoriaPeriodoServiceImpl implements CategoriaPeriodoService { + + @Autowired + private CategoriaPeriodoDAO categoriaPeriodoDAO; + + public List obtenerTodos() { + return categoriaPeriodoDAO.obtenerTodos(); + } + + public CategoriaPeriodo obtenerID(Integer id) { + return categoriaPeriodoDAO.obtenerID(id); + } + + @Transactional + public CategoriaPeriodo suscribir(CategoriaPeriodo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaPeriodoDAO.suscribir(entidad); + } + + @Transactional + public CategoriaPeriodo actualizacion(CategoriaPeriodo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaPeriodoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaPeriodo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaPeriodoDAO.actualizacion(entidad); + } + + public List buscarPeriodoIntervalo(CategoriaPeriodo cPeriodo) { + return categoriaPeriodoDAO.buscarPeriodoIntervalo(cPeriodo); + } + + public List obtenerPorCategoriaDescuento(CategoriaDescuento categoriaDescuento) { + return categoriaPeriodoDAO.obtenerPorCategoriaDescuento(categoriaDescuento); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaServiceImpl.java new file mode 100644 index 000000000..a076b0a48 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaServiceImpl.java @@ -0,0 +1,114 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.CategoriaCtrl; +import com.rjconsultores.ventaboletos.service.CategoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("categoriaService") +public class CategoriaServiceImpl implements CategoriaService { + + @Autowired + private CategoriaDAO categoriaDAO; + + public List obtenerTodos() { + return categoriaDAO.obtenerTodos(); + } + + public Categoria obtenerID(Integer id) { + return categoriaDAO.obtenerID(id); + } + + @Transactional + public Categoria suscribir(Categoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaDAO.suscribir(entidad); + } + + @Transactional + public Categoria actualizacion(Categoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Categoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaDAO.actualizacion(entidad); + } + + public List buscar(String desccategoria) { + return categoriaDAO.buscar(desccategoria); + } + + @Override + public List buscarCategoriaPesquisada(String desccategoria) { + return categoriaDAO.buscarCategoriaPesquisada(desccategoria); + } + + public List obtenerTodasCategoriasVisibles() { + List listCategoriasVisibles = new ArrayList(); + List lsCategorias = obtenerTodos(); + + for (Categoria c : lsCategorias) { + boolean esVisible = true; + for (Integer id : CategoriaCtrl.idsCategoriasNoVisible) { + if (id.equals(c.getCategoriaId())) { + esVisible = false; + } + } + if (esVisible) { + listCategoriasVisibles.add(c); + } + + } + return listCategoriasVisibles; + } + + @Override + public Categoria buscarUmaCategoria(String desccategoria) { + List categoriaList = buscar(desccategoria); + if (categoriaList.isEmpty()) { + return null; + } + return categoriaList.get(0); + } + + @Override + public List buscarCategoriaOrgaoConcedente(String orgaoConcedente) { + List listCategorias = new ArrayList(); + List categoriaList = categoriaDAO.buscarCategoriaOrgaoConcedente(orgaoConcedente); + int listSize = categoriaList.size(); + + for (int c =0; c obtenerTodos() { + return categoriaTipoPtoVtaDAO.obtenerTodos(); + } + + public CategoriaTipoPtoVta obtenerID(Integer id) { + return categoriaTipoPtoVtaDAO.obtenerID(id); + } + + @Transactional + public CategoriaTipoPtoVta suscribir(CategoriaTipoPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaTipoPtoVtaDAO.suscribir(entidad); + } + + @Transactional + public CategoriaTipoPtoVta actualizacion(CategoriaTipoPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return categoriaTipoPtoVtaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CategoriaTipoPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + categoriaTipoPtoVtaDAO.actualizacion(entidad); + } + + public List buscarPorPuntoVenta(TipoPuntoVenta tipoPuntoVenta) { + return categoriaTipoPtoVtaDAO.buscarPorPuntoVenta(tipoPuntoVenta); + } + + public void borrarFisico(CategoriaTipoPtoVta cd) { + categoriaTipoPtoVtaDAO.borrarFisico(cd); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CiudadServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CiudadServiceImpl.java new file mode 100644 index 000000000..44fd7d0a8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CiudadServiceImpl.java @@ -0,0 +1,103 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CiudadDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.service.CiudadService; +import com.rjconsultores.ventaboletos.service.PlazaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author MCosso + */ +@Service("ciudadService") +public class CiudadServiceImpl implements CiudadService { + + private static Logger log = Logger.getLogger(CiudadServiceImpl.class); + + @Autowired + private CiudadDAO ciudadDAO; + @Autowired + private PlazaService plazaService; + + public List obtenerTodos() { + return ciudadDAO.obtenerTodos(); + } + + public Ciudad obtenerID(Integer id) { + return ciudadDAO.obtenerID(id); + } + + @Transactional + public Ciudad suscribir(Ciudad entidad) { + + if (entidad.getPlaza() == null) { + entidad.setPlaza(getPlazaCiudad()); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ciudadDAO.suscribir(entidad); + } + + @Transactional + public Ciudad actualizacion(Ciudad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ciudadDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Ciudad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ciudadDAO.actualizacion(entidad); + } + + private Plaza getPlazaCiudad() { + try { + return plazaService.obtenerTodos().iterator().next(); + } catch (Exception e) { + log.error("", e); + } + return null; + } + + public List buscar(String nombciudad, Estado estado, Plaza plaza) { + return ciudadDAO.buscar(nombciudad, estado, plaza); + } + + public List buscaLike(String strCiudad) { + return ciudadDAO.buscaLike(strCiudad); + } + + @Override + public List buscarPorEstado(Estado estado) { + return ciudadDAO.buscarPorEstado(estado); + } + + @Override + public List buscaCodMun(Integer codMun, Estado estado) { + return ciudadDAO.buscaCodMun(codMun, estado); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ClaseServicioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ClaseServicioServiceImpl.java new file mode 100644 index 000000000..942ba52ec --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ClaseServicioServiceImpl.java @@ -0,0 +1,92 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ClasseServicoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.service.ClaseServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("claseServicioService") +public class ClaseServicioServiceImpl implements ClaseServicioService { + + @Autowired + private ClasseServicoDAO claseServicoDAO; + + public List obtenerTodos() { + return claseServicoDAO.obtenerTodos(); + } + + public ClaseServicio obtenerID(Integer id) { + return claseServicoDAO.obtenerID(id); + } + + @Transactional + public ClaseServicio suscribir(ClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return claseServicoDAO.suscribir(entidad); + } + + @Transactional + public ClaseServicio actualizacion(ClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return claseServicoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + claseServicoDAO.actualizacion(entidad); + } + + public List buscarPorNome(Integer idClaseServicio, String nomeClaseServicio) { + return claseServicoDAO.buscarPorNome(idClaseServicio, nomeClaseServicio); + } + + public List buscarTodosExceto(Integer ... idClase){ + return claseServicoDAO.buscarTodosExceto(idClase); + } + + public List buscarPorEmpresasDoUsuario (List empresasUsuario) { + + if(empresasUsuario == null || empresasUsuario.isEmpty()) { + return null; + } + + StringBuilder idEmpresasBuilder = new StringBuilder(); + String idEmpresas = ""; + + for (Empresa empresa : empresasUsuario) { + idEmpresasBuilder.append(empresa.getEmpresaId().toString()).append(","); + } + + idEmpresasBuilder = idEmpresasBuilder.deleteCharAt(idEmpresasBuilder.length() -1); + idEmpresas = idEmpresasBuilder.toString(); + + List result = (List) claseServicoDAO.buscarPorEmpresasDoUsuario(idEmpresas); + return result; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ClaseservicioEquivalenciaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ClaseservicioEquivalenciaServiceImpl.java new file mode 100644 index 000000000..f048a6e28 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ClaseservicioEquivalenciaServiceImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ClaseservicioEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.ClaseservicioEquivalencia; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.service.ClaseservicioEquivalenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("claseservicioEquivalenciaService") +public class ClaseservicioEquivalenciaServiceImpl + implements ClaseservicioEquivalenciaService { + + @Autowired + private ClaseservicioEquivalenciaDAO claseservicioEquivalenciaDAO; + + public List obtenerTodos() { + return claseservicioEquivalenciaDAO.obtenerTodos(); + } + + public ClaseservicioEquivalencia obtenerID(Integer id) { + return claseservicioEquivalenciaDAO.obtenerID(id); + } + + @Transactional + public ClaseservicioEquivalencia suscribir(ClaseservicioEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return claseservicioEquivalenciaDAO.suscribir(entidad); + } + + @Transactional + public ClaseservicioEquivalencia actualizacion(ClaseservicioEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return claseservicioEquivalenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ClaseservicioEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + claseservicioEquivalenciaDAO.actualizacion(entidad); + } + + public List buscar(ClaseServicio claseServicio, ComisionistaExterno comisionistaExterno) { + return claseservicioEquivalenciaDAO.buscar(claseServicio, comisionistaExterno); + } + + public List buscarEquivalencia(ClaseservicioEquivalencia claseServicioEquivalencia) { + return claseservicioEquivalenciaDAO.buscarEquivalencia(claseServicioEquivalencia); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ClienteCursoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ClienteCursoServiceImpl.java new file mode 100644 index 000000000..9fa6b96ea --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ClienteCursoServiceImpl.java @@ -0,0 +1,71 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ClienteCursoDAO; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteCurso; +import com.rjconsultores.ventaboletos.entidad.Curso; +import com.rjconsultores.ventaboletos.service.ClienteCursoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("clienteCursoService") +public class ClienteCursoServiceImpl implements ClienteCursoService { + + @Autowired + private ClienteCursoDAO clienteCursoDAO; + + @Override + public List obtenerTodos() { + return clienteCursoDAO.obtenerTodos(); + } + + @Override + public ClienteCurso obtenerID(Integer id) { + return clienteCursoDAO.obtenerID(id); + } + + @Transactional + @Override + public ClienteCurso suscribir(ClienteCurso entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return clienteCursoDAO.suscribir(entidad); + } + + @Transactional + @Override + public ClienteCurso actualizacion(ClienteCurso entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return clienteCursoDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(ClienteCurso entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + clienteCursoDAO.actualizacion(entidad); + } + + @Override + public ClienteCurso buscarClienteCurso(Cliente cliente, Curso curso) { + return clienteCursoDAO.buscarClienteCurso(cliente, curso); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ClienteDescuentoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ClienteDescuentoServiceImpl.java new file mode 100644 index 000000000..477f7ce66 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ClienteDescuentoServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ClienteDescuentoDAO; +import com.rjconsultores.ventaboletos.entidad.ClienteDescuento; +import com.rjconsultores.ventaboletos.service.ClienteDescuentoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("clienteDescuentoService") +public class ClienteDescuentoServiceImpl implements ClienteDescuentoService { + + @Autowired + private ClienteDescuentoDAO clienteDescuentoDAO; + + @Transactional + public ClienteDescuento suscribir(ClienteDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(0); + + return clienteDescuentoDAO.suscribir(entidad); + } + + public ClienteDescuento obtenerID(Integer id) { + return clienteDescuentoDAO.obtenerID(id); + } + + + public List obtenerTodos() { + return clienteDescuentoDAO.obtenerTodos(); + } + + @Transactional + public void borrar(ClienteDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(0); + + clienteDescuentoDAO.borrar(entidad); + } + + @Transactional + public ClienteDescuento actualizacion(ClienteDescuento entidad) { + return clienteDescuentoDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ClienteDireccionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ClienteDireccionServiceImpl.java new file mode 100644 index 000000000..5db246afa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ClienteDireccionServiceImpl.java @@ -0,0 +1,63 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ClienteDireccionDAO; +import com.rjconsultores.ventaboletos.entidad.ClienteDireccion; +import com.rjconsultores.ventaboletos.service.ClienteDireccionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Desenvolvimento + */ +@Service("clienteDireccionService") +public class ClienteDireccionServiceImpl implements ClienteDireccionService { + + @Autowired + private ClienteDireccionDAO clienteDAO; + + public List obtenerTodos() { + return clienteDAO.obtenerTodos(); + } + + public ClienteDireccion obtenerID(Integer id) { + return clienteDAO.obtenerID(id); + } + + @Transactional + public ClienteDireccion suscribir(ClienteDireccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return clienteDAO.suscribir(entidad); + } + + @Transactional + public ClienteDireccion actualizacion(ClienteDireccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return clienteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ClienteDireccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + clienteDAO.actualizacion(entidad); + } + + public List buscar(Integer clienteId) { + return clienteDAO.buscar(clienteId); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ClienteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ClienteServiceImpl.java new file mode 100644 index 000000000..bb1f3d41d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ClienteServiceImpl.java @@ -0,0 +1,84 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ClienteDAO; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.service.ClienteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Desenvolvimento + */ +@Service("clienteService") +public class ClienteServiceImpl implements ClienteService { + + @Autowired + private ClienteDAO clienteDAO; + + public List obtenerTodos() { + return clienteDAO.obtenerTodos(); + } + + public Cliente obtenerID(Integer id) { + return clienteDAO.obtenerID(id); + } + + @Transactional + public Cliente suscribir(Cliente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return clienteDAO.suscribir(entidad); + } + + @Transactional + public Cliente actualizacion(Cliente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return clienteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Cliente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + clienteDAO.actualizacion(entidad); + } + + public List buscar(String nombCliente) { + return clienteDAO.buscar(nombCliente); + } + + @Override + public Cliente buscarPorNumeroFidelidade(String numeroFidelidade, Empresa empresa) { + return clienteDAO.buscarPorNumeroFidelidade(numeroFidelidade, empresa); + } + + @Override + public List buscarPorDocumento(String documento) { + return clienteDAO.buscarPorDocumento(documento); + } + + @Override + public Cliente buscarPorNumeroFidelidade(String numeroFidelidade) { + // TODO Auto-generated method stub + return clienteDAO.buscarPorNumeroFidelidade(numeroFidelidade); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CobrancaAdcPuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CobrancaAdcPuntoVentaServiceImpl.java new file mode 100644 index 000000000..b8d88eb8d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CobrancaAdcPuntoVentaServiceImpl.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CobrancaAdcPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.CobrancaAdcPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.CobrancaAdicionalHistorico; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.CobrancaAdcPuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("cobrancaAdcPuntoVentaService") +public class CobrancaAdcPuntoVentaServiceImpl implements CobrancaAdcPuntoVentaService { + + @Autowired + CobrancaAdcPuntoVentaDAO cobrancaAdcPuntoVentaDAO; + + @Override + public List obtenerTodos() { + return cobrancaAdcPuntoVentaDAO.obtenerTodos(); + } + + @Override + public CobrancaAdcPuntoVenta obtenerID(Integer id) { + return cobrancaAdcPuntoVentaDAO.obtenerID(id); + } + + @Override + @Transactional + public CobrancaAdcPuntoVenta suscribir(CobrancaAdcPuntoVenta entidad) { + entidad.setActivo(true); + entidad.setFecmodif(new Date()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return cobrancaAdcPuntoVentaDAO.suscribir(entidad); + } + + @Override + @Transactional + public CobrancaAdcPuntoVenta actualizacion(CobrancaAdcPuntoVenta entidad) { + entidad.setFecmodif(new Date()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return cobrancaAdcPuntoVentaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(CobrancaAdcPuntoVenta entidad) { + entidad.setActivo(false); + entidad.setFecmodif(new Date()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cobrancaAdcPuntoVentaDAO.actualizacion(entidad); + } + + public List buscaHistoricoCobranca(CobrancaAdcPuntoVenta cobranca, Date dataInicial, Date dataFinal) { + return cobrancaAdcPuntoVentaDAO.buscaHistoricoCobranca(cobranca, dataInicial, dataFinal); + } + + @Override + public List buscarTodasAsCobrancas(PuntoVenta puntoVenta) { + return cobrancaAdcPuntoVentaDAO.buscarTodasAsCobrancas(puntoVenta); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java new file mode 100644 index 000000000..136f62ab2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java @@ -0,0 +1,72 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CoeficienteTarifaDAO; +import com.rjconsultores.ventaboletos.dao.OrgaoTramoDAO; +import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; +import com.rjconsultores.ventaboletos.service.CoeficienteTarifaService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("coeficienteTarifaService") +public class CoeficienteTarifaServiceImpl implements CoeficienteTarifaService { + + @Autowired + private CoeficienteTarifaDAO coeficienteTarifaDAO; + @Autowired + private OrgaoTramoDAO orgaoTramoDAO; + + public List obtenerTodos() { + return coeficienteTarifaDAO.obtenerTodos(); + } + + public CoeficienteTarifa obtenerID(Integer id) { + return coeficienteTarifaDAO.obtenerID(id); + } + + @Transactional + public CoeficienteTarifa suscribir(CoeficienteTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return coeficienteTarifaDAO.suscribir(entidad); + } + + @Transactional + public CoeficienteTarifa actualizacion(CoeficienteTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return coeficienteTarifaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CoeficienteTarifa entidad) throws RegistroConDependenciaException { + long count =0; + count +=orgaoTramoDAO.count("coeficienteTarifa1", entidad); + count +=orgaoTramoDAO.count("coeficienteTarifa2", entidad); + count +=orgaoTramoDAO.count("coeficienteTarifa3", entidad); + + if (count >0 ){ + throw new RegistroConDependenciaException(); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + coeficienteTarifaDAO.actualizacion(entidad); + } + + public List buscar(String nomb) { + return coeficienteTarifaDAO.buscar(nomb); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ColoniaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ColoniaServiceImpl.java new file mode 100644 index 000000000..b4ce8beba --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ColoniaServiceImpl.java @@ -0,0 +1,83 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ColoniaDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Colonia; +import com.rjconsultores.ventaboletos.service.ColoniaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import org.springframework.stereotype.Service; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("coloniaService") +public class ColoniaServiceImpl implements ColoniaService { + + @Autowired + private ColoniaDAO coloniaDAO; + + public List obtenerTodos() { + return coloniaDAO.obtenerTodos(); + } + + public Colonia obtenerID(Integer id) { + return coloniaDAO.obtenerID(id); + } + + @Transactional + public Colonia suscribir(Colonia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return coloniaDAO.suscribir(entidad); + } + + @Transactional + public Colonia actualizacion(Colonia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return coloniaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Colonia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + coloniaDAO.actualizacion(entidad); + } + + public List buscar(String desccolonia) { + return coloniaDAO.buscar(desccolonia); + } + + public List buscarPorCiudad(Ciudad ciudad) { + return coloniaDAO.buscarPorCiudad(ciudad); + } + + @Override + public List buscaLike(String desccolonia) { + return coloniaDAO.buscaLike(desccolonia); + } + + @Override + public List buscarPorCodMun(Ciudad ciudad, String desccolonia) { + return coloniaDAO.buscarPorCodMun(ciudad, desccolonia); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ComisionistaExternoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ComisionistaExternoServiceImpl.java new file mode 100644 index 000000000..c35b29986 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ComisionistaExternoServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ComisionistaExternoDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.service.ComisionistaExternoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("comisionistaExternoService") +public class ComisionistaExternoServiceImpl implements ComisionistaExternoService { + + @Autowired + private ComisionistaExternoDAO comisionistaExternoDAO; + + public List obtenerTodos() { + return comisionistaExternoDAO.obtenerTodos(); + } + + public ComisionistaExterno obtenerID(Integer id) { + return comisionistaExternoDAO.obtenerID(id); + } + + @Transactional + public ComisionistaExterno suscribir(ComisionistaExterno entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return comisionistaExternoDAO.suscribir(entidad); + } + + @Transactional + public ComisionistaExterno actualizacion(ComisionistaExterno entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return comisionistaExternoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ComisionistaExterno entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + comisionistaExternoDAO.actualizacion(entidad); + } + + public List buscar(String desccomisionista) { + return comisionistaExternoDAO.buscar(desccomisionista); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ComissaoReceitaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ComissaoReceitaServiceImpl.java new file mode 100644 index 000000000..946cc2969 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ComissaoReceitaServiceImpl.java @@ -0,0 +1,153 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ComissaoLogDAO; +import com.rjconsultores.ventaboletos.dao.ComissaoReceitaDAO; +import com.rjconsultores.ventaboletos.entidad.ComissaoReceita; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.ComissaoReceitaService; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("comissaoReceitaService") +public class ComissaoReceitaServiceImpl implements ComissaoReceitaService { + + private static final Logger log = LoggerFactory.getLogger(CalculoComissaoServiceImpl.class); + + @Autowired + private ComissaoReceitaDAO comissaoReceitaDAO; + + @Autowired + private ComissaoLogDAO comissaoLogDAO; + + @Override + public List obtenerTodos() { + return comissaoReceitaDAO.obtenerTodos(); + } + + @Override + public ComissaoReceita obtenerID(Integer id) { + return comissaoReceitaDAO.obtenerID(id); + } + + @Override + @Transactional + public ComissaoReceita suscribir(ComissaoReceita entidad) { + entidad.setActivo(Boolean.TRUE); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + return comissaoReceitaDAO.suscribir(entidad); + } + + @Override + @Transactional + public ComissaoReceita actualizacion(ComissaoReceita entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + return comissaoReceitaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(ComissaoReceita entidad) { + entidad.setActivo(Boolean.TRUE); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + comissaoReceitaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void reterComissaoReceitaDiaria(Integer empresaId, Integer puntoVentaId, Integer usuarioId, List receitas) throws BusinessException { + try { + Empresa empresa = new Empresa(empresaId); + PuntoVenta puntoVenta = new PuntoVenta(puntoVentaId); + for (com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita comissaoReceitaVO : receitas) { + ComissaoReceita comissaoReceita = new ComissaoReceita(comissaoReceitaVO); + comissaoReceita.setEmpresa(empresa); + comissaoReceita.setPuntoVenta(puntoVenta); + comissaoReceita.setUsuarioId(usuarioId); + comissaoReceitaDAO.suscribir(comissaoReceita); + comissaoLogDAO.suscribirTodos(comissaoReceitaVO.getLsComissaoLog()); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + + @Override + public List recuperarComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) { + + List lsComissaoReceitasVO = new ArrayList(); + List lsComissaoReceitas = comissaoReceitaDAO.recuperarComissaoReceita(empresaId, puntoVentaId, dataInicial, dataFinal); + for (ComissaoReceita comissaoReceita : lsComissaoReceitas) { + com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita comissaoReceitaVO = new com.rjconsultores.ventaboletos.vo.comissao.ComissaoReceita(); + comissaoReceitaVO.setCancelados(comissaoReceita.getCancelados()); + comissaoReceitaVO.setCanceladosGAP(comissaoReceita.getCancelgap()); + comissaoReceitaVO.setComissaoBPRDiaria(comissaoReceita.getComissaoBpr()); + comissaoReceitaVO.setComissaoEntregaPassagemDiaria(comissaoReceita.getComissaoEntregaPassagem()); + comissaoReceitaVO.setComissaoExcessoBagagemDiaria(comissaoReceita.getComissaoExcessoBagagem()); + comissaoReceitaVO.setComissaoOutrosDiaria(comissaoReceita.getComissaoOutros()); + comissaoReceitaVO.setComissaoSegOpcionalDiaria(comissaoReceita.getComissaoSegOpcional()); + comissaoReceitaVO.setComissaoSeguroObrigatorioDiaria(comissaoReceita.getComissaoSegObrigatorio()); + comissaoReceitaVO.setContImpressa(comissaoReceita.getQtdeImpgap()); + comissaoReceitaVO.setData(comissaoReceita.getDatamovimento()); + comissaoReceitaVO.setDevolucoesOrigem(comissaoReceita.getDevolvidosOrigem()); + comissaoReceitaVO.setDevolucoesOrigemGAP(comissaoReceita.getDevolvidosOrigemGap()); + comissaoReceitaVO.setDevolvidos(comissaoReceita.getDevolvidos()); + comissaoReceitaVO.setDevolvidosGAP(comissaoReceita.getDevgap()); + comissaoReceitaVO.setGapImpressa(comissaoReceita.getImpgap()); + comissaoReceitaVO.setInternet(comissaoReceita.getInternet()); + comissaoReceitaVO.setReceitaBPR(comissaoReceita.getBpr()); + comissaoReceitaVO.setReceitaExcessoBagagem(comissaoReceita.getExcessoBagagem()); + comissaoReceitaVO.setReceitaGAP(comissaoReceita.getGap()); + comissaoReceitaVO.setReceitaSeguroOpcional(comissaoReceita.getSegOpcional()); + comissaoReceitaVO.setReceitaSeguro(comissaoReceita.getSegObrigatorio()); + comissaoReceitaVO.setReceitaSeguroOutros(comissaoReceita.getReceitaOutros()); + + BigDecimal receitaComissao = BigDecimal.ZERO; + receitaComissao = MoneyHelper.somar(receitaComissao,comissaoReceitaVO.getReceitaBPR()); + receitaComissao = MoneyHelper.somar(receitaComissao,comissaoReceitaVO.getReceitaSeguro()); + receitaComissao = MoneyHelper.somar(receitaComissao,comissaoReceitaVO.getReceitaGAP()); + + receitaComissao = MoneyHelper.subtrair(receitaComissao,comissaoReceitaVO.getCancelados()); + receitaComissao = MoneyHelper.subtrair(receitaComissao,comissaoReceitaVO.getDevolvidos()); + receitaComissao = MoneyHelper.subtrair(receitaComissao,comissaoReceitaVO.getDevolvidosGAP()); + receitaComissao = MoneyHelper.subtrair(receitaComissao,comissaoReceitaVO.getCanceladosGAP()); + + comissaoReceitaVO.setReceitaComissao(receitaComissao); + + lsComissaoReceitasVO.add(comissaoReceitaVO); + + } + + return lsComissaoReceitasVO; + } + + @Override + @Transactional + public void limparComissaoReceita(Integer empresaId, Integer puntoVentaId, Date dataInicial, Date dataFinal) throws BusinessException { + try { + comissaoReceitaDAO.limparComissaoReceita(empresaId, puntoVentaId, dataInicial, dataFinal); + comissaoLogDAO.limparComissaoLog(empresaId, puntoVentaId, dataInicial, dataFinal); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ComissaoServiceImpl.java new file mode 100644 index 000000000..22b46efe7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ComissaoServiceImpl.java @@ -0,0 +1,88 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.Comissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.ComissaoService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.comissao.HistoricoComissao; + +@Service("comissaoService") +public class ComissaoServiceImpl implements ComissaoService { + + @Autowired + private ComissaoDAO comissaoDAO; + + @Override + public List obtenerTodos() { + return comissaoDAO.obtenerTodos(); + } + + @Override + public Comissao obtenerID(Integer id) { + return comissaoDAO.obtenerID(id); + } + + @Override + @Transactional + public Comissao suscribir(Comissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return comissaoDAO.suscribir(entidad); + } + + @Override + @Transactional + public Comissao actualizacion(Comissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + + return comissaoDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(Comissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + comissaoDAO.actualizacion(entidad); + } + + @Override + public List buscaHistoricoComissao(Integer puntoVentaId, Integer empresaId, Date periodoInicio, Date periodoFim) { + String competenciaInicial = DateUtil.getStringDate(periodoInicio, "MM/yyyy"); + String competenciaFinal = DateUtil.getStringDate(periodoFim, "MM/yyyy"); + + Map parametros = new HashMap(); + parametros.put("competenciaInicial", competenciaInicial); + parametros.put("competenciaFinal", competenciaFinal); + parametros.put("empresaId", empresaId); + + if(puntoVentaId != null && puntoVentaId > -1) { + parametros.put("puntoventaId", puntoVentaId); + } + + return comissaoDAO.buscaHistoricoComissao(parametros); + } + + @Override + public List buscaPuntoVentasEmpresaComComissaoParametrizada(Integer empresaId) { + return comissaoDAO.buscaPuntoVentasEmpresaComComissaoParametrizada(empresaId); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CompaniaBancariaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CompaniaBancariaServiceImpl.java new file mode 100644 index 000000000..9858e6d6e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CompaniaBancariaServiceImpl.java @@ -0,0 +1,81 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CompaniaBancariaDAO; +import com.rjconsultores.ventaboletos.entidad.CompaniaBancaria; +import com.rjconsultores.ventaboletos.entidad.MerchantBancario; +import com.rjconsultores.ventaboletos.entidad.UsuarioBancario; +import com.rjconsultores.ventaboletos.service.CompaniaBancariaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("companiaBancariaService") +public class CompaniaBancariaServiceImpl implements CompaniaBancariaService { + + @Autowired + private CompaniaBancariaDAO companiaBancariaDAO; + + public List obtenerTodos() { + return companiaBancariaDAO.obtenerTodos(); + } + + public CompaniaBancaria obtenerID(Integer id) { + return companiaBancariaDAO.obtenerID(id); + } + + @Transactional + public CompaniaBancaria suscribir(CompaniaBancaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return companiaBancariaDAO.suscribir(entidad); + } + + @Transactional + public CompaniaBancaria actualizacion(CompaniaBancaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return companiaBancariaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CompaniaBancaria entidad) { + entidad = this.obtenerID(entidad.getCompaniabancariaId()); + + for (UsuarioBancario u : entidad.getUsuarioBancarioList()) { + u.setActivo(Boolean.FALSE); + u.setFecmodif(Calendar.getInstance().getTime()); + u.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + for (MerchantBancario m : entidad.getMerchantBancarioList()) { + m.setActivo(Boolean.FALSE); + m.setFecmodif(Calendar.getInstance().getTime()); + m.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + companiaBancariaDAO.actualizacion(entidad); + } + + public List buscar(CompaniaBancaria companiaBancaria) { + return companiaBancariaDAO.buscar(companiaBancaria); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConductorServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConductorServiceImpl.java new file mode 100644 index 000000000..9e8dcb04c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConductorServiceImpl.java @@ -0,0 +1,55 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ConductorDAO; +import com.rjconsultores.ventaboletos.entidad.Conductor; +import com.rjconsultores.ventaboletos.service.ConductorService; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("conductorService") +public class ConductorServiceImpl implements ConductorService { + + @Autowired + private ConductorDAO conductorDAO; + + public List obtenerTodos() { + return conductorDAO.obtenerTodos(); + } + + public Conductor obtenerID(Integer id) { + return conductorDAO.obtenerID(id); + } + + @Transactional + public Conductor suscribir(Conductor entidad) { + return conductorDAO.suscribir(entidad); + } + + @Transactional + public Conductor actualizacion(Conductor entidad) { + return conductorDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Conductor entidad) { + conductorDAO.borrar(entidad); + } + + public Conductor buscar(String claveConductor, String contraSenha) { + return conductorDAO.buscar(claveConductor, contraSenha); + } + + public Conductor buscarPorEmpleado(int empleadoId){ + return conductorDAO.buscarPorEmpleado(empleadoId); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionConfServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionConfServiceImpl.java new file mode 100644 index 000000000..5b5936a70 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionConfServiceImpl.java @@ -0,0 +1,73 @@ + +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Collection; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionConfDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionConf; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; +import com.rjconsultores.ventaboletos.service.ConexionConfService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("conexionConfService") +public class ConexionConfServiceImpl implements ConexionConfService { + @Autowired + private ConexionConfDAO conexionConfDAO; + + public List obtenerTodos() { + return conexionConfDAO.obtenerTodos(); + } + + public ConexionConf obtenerID(Long id) { + return conexionConfDAO.obtenerID(id); + } + + @Transactional + public ConexionConf suscribir(ConexionConf entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionConfDAO.suscribir(entidad); + } + + @Transactional + public ConexionConf actualizacion(ConexionConf entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionConfDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ConexionConf entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + conexionConfDAO.actualizacion(entidad); + } + + @Override + public ConexionConf buscar(Long conexionCtrlId, Integer numgrupo) { + return conexionConfDAO.buscar(conexionCtrlId, numgrupo); + } + + @Override + public List buscarPorConexionCtrl(ConexionCtrl entidad) { + return conexionConfDAO.buscarPorConexionCtrl(entidad); + } + + @Override + @Transactional + public void suscribirTodos(Collection conexionesConf) { + conexionConfDAO.suscribirTodos(conexionesConf); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionCtrlServiceImpl.java new file mode 100644 index 000000000..742ed3070 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionCtrlServiceImpl.java @@ -0,0 +1,111 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionCtrlDAO; +import com.rjconsultores.ventaboletos.dao.ConexionRutaCtrlDAO; +import com.rjconsultores.ventaboletos.dao.ConexionRutaTramoCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.Conexion; +import com.rjconsultores.ventaboletos.entidad.ConexionConf; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaTramoCtrl; +import com.rjconsultores.ventaboletos.service.ConexionConfService; +import com.rjconsultores.ventaboletos.service.ConexionCtrlService; +import com.rjconsultores.ventaboletos.service.ConexionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("conexionCtrlService") +public class ConexionCtrlServiceImpl implements ConexionCtrlService { + @Autowired + private ConexionCtrlDAO conexionCtrlDAO; + @Autowired + private ConexionService conexionService; + @Autowired + private ConexionConfService conexionConfDAO; + @Autowired + private ConexionRutaTramoCtrlDAO conexionRutaTramoCtrlDAO; + @Autowired + private ConexionRutaCtrlDAO conexionRutaCtrlDAO; + + + public List obtenerTodos() { + return conexionCtrlDAO.obtenerTodos(); + } + + public ConexionCtrl obtenerID(Long id) { + return conexionCtrlDAO.obtenerID(id); + } + + @Transactional + public ConexionCtrl suscribir(ConexionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionCtrlDAO.suscribir(entidad); + } + + @Transactional + public ConexionCtrl actualizacion(ConexionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionCtrlDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ConexionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + List lsConexion = conexionService.buscarPorConexionCtrl(entidad.getConexionctrlId()); + for (Conexion conexion : lsConexion) { + conexionService.borrar(conexion); + + if(conexion.getRutaId() != null) { + borrarConexionRuta(conexion); + } + } + + List lsConexionConf = conexionConfDAO.buscarPorConexionCtrl(entidad); + for (ConexionConf conexionConf : lsConexionConf) { + conexionConfDAO.borrar(conexionConf); + } + + conexionCtrlDAO.actualizacion(entidad); + } + + @Transactional + private void borrarConexionRuta(Conexion conexion) { + + ConexionRutaCtrl conexionRutaCtrl = null; + + if(conexion.getConexionRutaTramoId() != null) { + ConexionRutaTramoCtrl conexionRutaTramoCtrl = conexionRutaTramoCtrlDAO.obtenerID(conexion.getConexionRutaTramoId()); + conexionRutaTramoCtrl.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexionRutaTramoCtrl.setFecmodif(Calendar.getInstance().getTime()); + conexionRutaTramoCtrl.setActivo(Boolean.FALSE); + conexionRutaTramoCtrlDAO.actualizacion(conexionRutaTramoCtrl); + + conexionRutaCtrl = conexionRutaTramoCtrl.getConexionRutaCtrl(); + conexionRutaCtrl.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexionRutaCtrl.setFecmodif(Calendar.getInstance().getTime()); + conexionRutaCtrl.setActivo(Boolean.FALSE); + conexionRutaCtrlDAO.actualizacion(conexionRutaCtrl); + } + + } + + @Override + public List buscarConexionesCtrl(Integer origenId, Integer destinoId) { + return conexionCtrlDAO.buscarConexionesCtrl(origenId, destinoId); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionDescuentoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionDescuentoServiceImpl.java new file mode 100644 index 000000000..a1a102df3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionDescuentoServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.hibernate.ConexionDescuentoHibernateDAO; +import com.rjconsultores.ventaboletos.entidad.Conexion; +import com.rjconsultores.ventaboletos.entidad.ConexionDescuento; +import com.rjconsultores.ventaboletos.service.ConexionDescuentoService; + +@Service("conexionDescuentoService") +public class ConexionDescuentoServiceImpl implements ConexionDescuentoService { + @Autowired + ConexionDescuentoHibernateDAO conexionDescuentoHDAO; + + @Override + public List buscarPorConexion(Conexion conexion) { + return conexionDescuentoHDAO.bucarPorConexion(conexion.getConexionId()); + } + + @Override + @Transactional + public ConexionDescuento suscribir(ConexionDescuento conexionDescuento) { + conexionDescuento.setActivo(true); + conexionDescuento.setFecModif(Calendar.getInstance().getTime()); + if (conexionDescuento.getIdConexionDescuento() == null) { + return conexionDescuentoHDAO.suscribir(conexionDescuento); + } + return conexionDescuentoHDAO.actualizacion(conexionDescuento); + } + + @Override + @Transactional + public void borrar(ConexionDescuento conexionDescuento) { + conexionDescuento.setActivo(false); + this.suscribir(conexionDescuento); + } + + @Override + @Transactional + public void suscribirTodos(List conexionesDescuentos) { + for (ConexionDescuento conexionDescuento : conexionesDescuentos) { + conexionDescuento.setFecModif(Calendar.getInstance().getTime()); + } + conexionDescuentoHDAO.suscribirTodos(conexionesDescuentos); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionRutaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionRutaServiceImpl.java new file mode 100644 index 000000000..3b391d702 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionRutaServiceImpl.java @@ -0,0 +1,66 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionExcepcionRutaDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta; +import com.rjconsultores.ventaboletos.service.ConexionExcepcionRutaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("conexionExcepcionRutaService") +public class ConexionExcepcionRutaServiceImpl implements ConexionExcepcionRutaService { + + @Autowired + private ConexionExcepcionRutaDAO conexionExcepcionRutaDAO; + + @Override + public List obtenerTodos() { + return conexionExcepcionRutaDAO.obtenerTodos(); + } + + @Override + public List obtenerConexionExcepcionsActivo(Long conexionctrlId) { + return conexionExcepcionRutaDAO.obtenerConexionExcepcionsActivo(conexionctrlId); + } + + @Override + public ConexionExcepcionRuta obtenerID(Long id) { + return conexionExcepcionRutaDAO.obtenerID(id); + } + + @Override + @Transactional + public ConexionExcepcionRuta suscribir(ConexionExcepcionRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionExcepcionRutaDAO.suscribir(entidad); + } + + @Override + @Transactional + public ConexionExcepcionRuta actualizacion(ConexionExcepcionRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionExcepcionRutaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(ConexionExcepcionRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + conexionExcepcionRutaDAO.actualizacion(entidad); + + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionServiceImpl.java new file mode 100644 index 000000000..c234efe05 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionExcepcionServiceImpl.java @@ -0,0 +1,67 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionExcepcionDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionExcepcion; +import com.rjconsultores.ventaboletos.service.ConexionExcepcionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("conexionExcepcionService") +public class ConexionExcepcionServiceImpl implements ConexionExcepcionService { + + @Autowired + private ConexionExcepcionDAO conexionExcepcionDAO; + + @Override + public List obtenerTodos() { + return conexionExcepcionDAO.obtenerTodos(); + } + + @Override + public List obtenerConexionExcepcionsActivo(Long conexionctrlId) { + return conexionExcepcionDAO.obtenerConexionExcepcionsActivo(conexionctrlId); + } + + @Override + public ConexionExcepcion obtenerID(Long id) { + return conexionExcepcionDAO.obtenerID(id); + } + + @Override + @Transactional + public ConexionExcepcion suscribir(ConexionExcepcion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionExcepcionDAO.suscribir(entidad); + } + + @Override + @Transactional + public ConexionExcepcion actualizacion(ConexionExcepcion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return conexionExcepcionDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(ConexionExcepcion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + conexionExcepcionDAO.actualizacion(entidad); + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java new file mode 100644 index 000000000..87b1af738 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java @@ -0,0 +1,314 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.service.ConexionRutaCombinacionService; +import com.rjconsultores.ventaboletos.service.RutaCombinacionService; +import com.rjconsultores.ventaboletos.vo.conexion.OrdenarLocalidadesGeradas; +import com.rjconsultores.ventaboletos.vo.parada.ConexionCtrlVO; +import com.rjconsultores.ventaboletos.vo.parada.ConexionRutaCtrlVO; +import com.rjconsultores.ventaboletos.vo.parada.ParadaVOConexionRuta; + +@Service("conexionRutaCombinacionFactory") +public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinacionService { + + @Autowired + private RutaCombinacionService rutaCombinacionService; + + private Map criandoCacheLocalidades(List list) { + Map cacheLocalidades = new HashMap(); + for (Parada parada : list) { + cacheLocalidades.put(parada.getParadaId(), parada); + } + return cacheLocalidades; + } + + private void gerarCombinacao(LinkedList> lists, List rutasEixoA, List rutasEixoB, List rutasEixoC, List localidadesGeradas, List conexoesCtrl, Map cacheLocalidades) { + + + Set combinacoes = new TreeSet(); + + for (Parada s : lists.removeFirst()) + combinacoes.add(s.getParadaId().toString()); + + while (!lists.isEmpty()) { + List next = lists.removeFirst(); + Set novasCombinacoes = new TreeSet(); + for (String s1 : combinacoes) { + for (Parada s2 : next) { + novasCombinacoes.add(s1 + ";" + s2.getParadaId()); + } + } + combinacoes = novasCombinacoes; + } + //System.out.println(combinacoes); + + Set rutasVendaA = rutaCombinacionService.rutasCombinacionVenda(rutasEixoA); + Set rutasVendaB = rutaCombinacionService.rutasCombinacionVenda(rutasEixoB); + + if(rutasEixoC == null) { + gerarLocalidadesEixoAB(rutasEixoA, rutasEixoB, localidadesGeradas, combinacoes, conexoesCtrl, cacheLocalidades, rutasVendaA, rutasVendaB); + }else { + Set rutasVendaC = rutaCombinacionService.rutasCombinacionVenda(rutasEixoC); + gerarLocalidadesEixoABC(rutasEixoA, rutasEixoB,rutasEixoC, localidadesGeradas, combinacoes, conexoesCtrl, cacheLocalidades, rutasVendaA, rutasVendaB, rutasVendaC ); + } + + Collections.sort(localidadesGeradas, new OrdenarLocalidadesGeradas()); + } + + + private void gerarLocalidadesEixoAB(List rutasEixoA, List rutasEixoB, List localidadesGeradas, Set combinacoes, List conexoesCtrl, Map cacheLocalidades, Set rutasVendaA, Set rutasVendaB) { + short i = 1; + String[] valoresCalculados; + + for (Ruta rutaEixoA : rutasEixoA) { + for (Ruta rutaEixoB : rutasEixoB) { + for (String comb : combinacoes) { + valoresCalculados = comb.split(";"); + if(valoresCalculados != null && valoresCalculados.length == 4) { + Integer origemConexaoCtrl = Integer.parseInt(valoresCalculados[0]); + Integer destinoConexaoCtrl = Integer.parseInt(valoresCalculados[3]); + if(origemConexaoCtrl == null || cacheLocalidades.get(origemConexaoCtrl) == null || + destinoConexaoCtrl == null || cacheLocalidades.get(destinoConexaoCtrl) == null) { + continue; + } + + ConexionCtrlVO conexionCtrl = adicionarConexao(conexoesCtrl, origemConexaoCtrl, destinoConexaoCtrl); + ConexionRutaCtrlVO conexionRutaCtrl = new ConexionRutaCtrlVO(rutaEixoA.getRutaId(), rutaEixoB.getRutaId(), null); + + ParadaVOConexionRuta trechoA = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[1])), rutaEixoA.getRutaId(), rutaEixoA.getNumRuta(), i, true, + cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])), + conexionCtrl, conexionRutaCtrl, rutaEixoA.getDescSentido()); + i++; + + ParadaVOConexionRuta trechoB = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[2])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])), rutaEixoB.getRutaId(), rutaEixoB.getNumRuta(), i, true, + cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])), + conexionCtrl, conexionRutaCtrl, rutaEixoB.getDescSentido()); + i++; + + adicionarLocalidadeGerada(conexionCtrl, localidadesGeradas, trechoA, trechoB, null, rutasVendaA, rutasVendaB, new HashSet()); + + i = 1; + } + + } + } + } + + removerConexionCtrlInvalida(conexoesCtrl); + } + + /** + * @param conexoesCtrl + * @param origemConexaoCtrl + * @param destinoConexaoCtrl + * @return + */ + private ConexionCtrlVO adicionarConexao(List conexoesCtrl, Integer origemConexaoCtrl, Integer destinoConexaoCtrl) { + ConexionCtrlVO conexionCtrl = null; + Integer indice = 0; + for (ConexionCtrlVO conexionCtrlTemp : conexoesCtrl) { + if(conexionCtrlTemp.isOrigemDestinoIgual(origemConexaoCtrl, destinoConexaoCtrl)) { + conexionCtrl = conexionCtrlTemp; + break; + } + indice++; + } + + if(conexionCtrl == null) { + conexionCtrl = new ConexionCtrlVO(origemConexaoCtrl, destinoConexaoCtrl); + indice = -1; + } + + conexionCtrl.incrementarGrupo(); + + if(indice > -1) { + conexoesCtrl.set(indice, conexionCtrl); + } else { + conexoesCtrl.add(conexionCtrl); + } + + return conexionCtrl; + + } + + private void adicionarLocalidadeGerada(ConexionCtrlVO conexionCtrl, List localidadesGeradas, ParadaVOConexionRuta trechoA, ParadaVOConexionRuta trechoB, ParadaVOConexionRuta trechoC, Set rutasVendaA, Set rutasVendaB, Set rutasVendaC) { + boolean isTrechoAVende = false; + boolean isTrechoBVende = false; + + if(isDadosNotNull(trechoA)) { + isTrechoAVende = rutasVendaA == null ? false : rutasVendaA.contains(trechoA.getRutaId() + "-" + trechoA.getParadaOrigem().getParadaId() + "-" + trechoA.getParadaDestino().getParadaId()); + } + + if(isDadosNotNull(trechoB)) { + isTrechoBVende = rutasVendaB == null ? false : rutasVendaB.contains(trechoB.getRutaId() + "-" + trechoB.getParadaOrigem().getParadaId() + "-" + trechoB.getParadaDestino().getParadaId()); + } + + boolean isTrechoCVende = true; + if(trechoC != null) { + if(isDadosNotNull(trechoC)) { + isTrechoCVende = rutasVendaC == null ? false : rutasVendaC.contains(trechoC.getRutaId() + "-" + trechoC.getParadaOrigem().getParadaId() + "-" + trechoC.getParadaDestino().getParadaId()); + } else { + isTrechoCVende = false; + } + } + + if(isTrechoAVende && isTrechoBVende && isTrechoCVende) { + localidadesGeradas.add(trechoA); + localidadesGeradas.add(trechoB); + if(trechoC != null) { + localidadesGeradas.add(trechoC); + } + conexionCtrl.setValida(true); + } else { + conexionCtrl.decrementarGrupo(); + } + } + + private void gerarLocalidadesEixoABC(List rutasEixoA, List rutasEixoB, List rutasEixoC, List localidadesGeradas, Set combinations, List conexoesCtrl, Map cacheLocalidades, Set rutasVendaA, Set rutasVendaB, Set rutasVendaC) { + + short i = 1; + String[] valoresCalculados = null; + for (Ruta rutaEixoA : rutasEixoA) { + + for (Ruta rutaEixoB : rutasEixoB) { + for (Ruta rutaEixoC : rutasEixoC) { + for (String comb : combinations) { + valoresCalculados = comb.split(";"); + if(valoresCalculados != null && valoresCalculados.length == 5) { + Integer origemConexaoCtrl = Integer.parseInt(valoresCalculados[0]); + Integer destinoConexaoCtrl = Integer.parseInt(valoresCalculados[4]); + if(origemConexaoCtrl == null || cacheLocalidades.get(origemConexaoCtrl) == null || + destinoConexaoCtrl == null || cacheLocalidades.get(destinoConexaoCtrl) == null) { + continue; + } + + ConexionCtrlVO conexionCtrl = adicionarConexao(conexoesCtrl, origemConexaoCtrl, destinoConexaoCtrl); + ConexionRutaCtrlVO conexionRutaCtrl = new ConexionRutaCtrlVO(rutaEixoA.getRutaId(), rutaEixoB.getRutaId(), rutaEixoC.getRutaId()); + + ParadaVOConexionRuta trechoA = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[1])), rutaEixoA.getRutaId(), rutaEixoA.getNumRuta(), i, true, + cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[4])), + conexionCtrl, conexionRutaCtrl, rutaEixoA.getDescSentido()); + i++; + + ParadaVOConexionRuta trechoB = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[2])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])), rutaEixoB.getRutaId(), rutaEixoB.getNumRuta(), i, true, + cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[4])), + conexionCtrl, conexionRutaCtrl, rutaEixoB.getDescSentido()); + i++; + + ParadaVOConexionRuta trechoC = new ParadaVOConexionRuta(conexionCtrl.getGrupo(), cacheLocalidades.get(Integer.parseInt(valoresCalculados[3])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[4])), rutaEixoC.getRutaId(), rutaEixoC.getNumRuta(), i, true, + cacheLocalidades.get(Integer.parseInt(valoresCalculados[0])), cacheLocalidades.get(Integer.parseInt(valoresCalculados[4])), + conexionCtrl, conexionRutaCtrl, rutaEixoC.getDescSentido()); + i++; + + adicionarLocalidadeGerada(conexionCtrl, localidadesGeradas, trechoA, trechoB, trechoC, rutasVendaA, rutasVendaB, rutasVendaC); + + i = 1; + } + } + } + + } + } + + removerConexionCtrlInvalida(conexoesCtrl); + } + + private void removerConexionCtrlInvalida(List conexoesCtrl) { + List temp = new ArrayList(0); + for (ConexionCtrlVO conexionCtrl : conexoesCtrl) { + if(conexionCtrl.isValida()) { + temp.add(conexionCtrl); + } + } + conexoesCtrl.clear(); + conexoesCtrl.addAll(temp); + } + + public void gerarCombinacionEntre2Eixos(List listParada1, List rutasEixoA, List rutasEixoB, List lsLocalidadesComuns, List listParada4, List rutasEixoA2, List rutasEixoB2, List localidadesGeradas, List conexoesCtrl) { + + for (int i = 0; i < lsLocalidadesComuns.size(); i++) { + + List listParada2 = Arrays.asList(lsLocalidadesComuns.get(i)); + List listParada3 = Arrays.asList(lsLocalidadesComuns.get(i)); + + LinkedList> lists = new LinkedList>(); + + lists.add(listParada1); + lists.add(listParada2); + lists.add(listParada3); + lists.add(listParada4); + + List localidades = new ArrayList(); + localidades.addAll(listParada1); + localidades.addAll(listParada2); + localidades.addAll(listParada3); + localidades.addAll(listParada4); + + Map cacheLocalidades = criandoCacheLocalidades(localidades); + gerarCombinacao(lists, rutasEixoA, rutasEixoB, null, localidadesGeradas, conexoesCtrl, cacheLocalidades); + + } + + } + + public void gerarCombinacionEntre3Eixos(List listParada1, List rutasEixoA, List rutasEixoB, List lsLocalidadesComuns, List listParada4, List listParadasC, List rutasEixoA2, List rutasEixoB2, List rutasEixoC, List localidadesGeradas, List conexoesCtrl) { + + for (int i = 0; i < lsLocalidadesComuns.size(); i++) { + + List listParada2 = Arrays.asList(lsLocalidadesComuns.get(i)); + List listParada3 = Arrays.asList(lsLocalidadesComuns.get(i)); + + LinkedList> lists = new LinkedList>(); + + lists.add(listParada1); + lists.add(listParada2); + lists.add(listParada3); + lists.add(listParada4); + lists.add(listParadasC); + + List localidades = new ArrayList(); + localidades.addAll(listParada1); + localidades.addAll(listParada2); + localidades.addAll(listParada3); + localidades.addAll(listParada4); + localidades.addAll(listParadasC); + + Map cacheLocalidades = criandoCacheLocalidades(localidades); + gerarCombinacao(lists, rutasEixoA, rutasEixoB, rutasEixoC, localidadesGeradas, conexoesCtrl, cacheLocalidades); + + } + } + + public List extrairConexionRutaCtrl(List localidadesGeradas) { + List list = new ArrayList(0); + for (ParadaVOConexionRuta paradaVOConexionRuta : localidadesGeradas) { + if(!list.contains(paradaVOConexionRuta.getConexionRutaCtrl())) { + list.add(paradaVOConexionRuta.getConexionRutaCtrl()); + } + } + return list; + } + + private boolean isDadosNotNull(ParadaVOConexionRuta trecho) { + return trecho != null && + trecho.getRutaId() != null && + trecho.getParadaOrigem() != null && + trecho.getParadaDestino() != null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaConfServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaConfServiceImpl.java new file mode 100644 index 000000000..e35c69e17 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaConfServiceImpl.java @@ -0,0 +1,292 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionRutaConfDAO; +import com.rjconsultores.ventaboletos.entidad.Conexion; +import com.rjconsultores.ventaboletos.entidad.ConexionConf; +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaExcepcionPtoVta; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaExcepcionTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaTramoCtrl; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.service.ConexionConfService; +import com.rjconsultores.ventaboletos.service.ConexionCtrlService; +import com.rjconsultores.ventaboletos.service.ConexionRutaConfService; +import com.rjconsultores.ventaboletos.service.ConexionRutaCtrlService; +import com.rjconsultores.ventaboletos.service.ConexionRutaExcepcionPtoVtaService; +import com.rjconsultores.ventaboletos.service.ConexionRutaExcepcionTipoPtoVtaService; +import com.rjconsultores.ventaboletos.service.ConexionRutaTramoCtrlService; +import com.rjconsultores.ventaboletos.service.ConexionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.parada.ConexionRutaConfVO; +import com.rjconsultores.ventaboletos.vo.parada.ConexionRutaCtrlVO; +import com.rjconsultores.ventaboletos.vo.parada.ParadaVOConexionRuta; + +@Service("conexionRutaConfService") +public class ConexionRutaConfServiceImpl implements ConexionRutaConfService { + + @Autowired + private ConexionRutaConfDAO conexionRutaConfDAO; + + @Autowired + private ConexionRutaExcepcionTipoPtoVtaService conexionRutaExcepcionTipoPtoVtaService; + + @Autowired + private ConexionRutaExcepcionPtoVtaService conexionRutaRestricaoPtoVtaService; + + @Autowired + private ConexionRutaCtrlService conexionRutaCtrlService; + + @Autowired + private ConexionRutaTramoCtrlService conexionRutaTramoCtrlService; + + @Autowired + private ConexionCtrlService conexionCtrlService; + + @Autowired + private ConexionConfService conexionConfService; + + @Autowired + private ConexionService conexionService; + + @Override + @Transactional + public ConexionRutaConf suscribir(ConexionRutaConf conexionRutaConf) { + + conexionRutaConf.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexionRutaConf.setFecmodif(Calendar.getInstance().getTime()); + conexionRutaConf.setActivo(Boolean.TRUE); + + return conexionRutaConfDAO.suscribir(conexionRutaConf); + } + + @Override + @Transactional + public ConexionRutaConf actualizacion(ConexionRutaConf conexionRutaConf) { + conexionRutaConf.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexionRutaConf.setFecmodif(Calendar.getInstance().getTime()); + conexionRutaConf.setActivo(Boolean.TRUE); + return conexionRutaConfDAO.actualizacion(conexionRutaConf); + } + + @Override + @Transactional + public void borrar(ConexionRutaConf conexionRutaTramoCtrl) { + + conexionRutaTramoCtrl.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexionRutaTramoCtrl.setFecmodif(Calendar.getInstance().getTime()); + conexionRutaTramoCtrl.setActivo(Boolean.FALSE); + + conexionRutaConfDAO.actualizacion(conexionRutaTramoCtrl); + + } + + @Transactional + @Override + public void borrar(List lsConexionRutaConf) { + for (ConexionRutaConf conexion : lsConexionRutaConf) { + borrar(conexion); + } + } + + @Override + @Transactional + public void suscribirTodos(List lsConexionRutaConf) { + for (ConexionRutaConf conexion : lsConexionRutaConf) { + suscribir(conexion); + } + } + + @Override + public List obtenerTodosActivo() { + return conexionRutaConfDAO.obtenerTodosActivo(); + } + + @Override + public List buscarPorDescricao(String descricao) { + return conexionRutaConfDAO.buscarPorDescricao(descricao); + } + + @Transactional + @Override + public ConexionRutaConf obtenerID(Integer id) { + return conexionRutaConfDAO.obtenerID(id); + } + + @Override + @Transactional + public void excluirConfiguracao(ConexionRutaConf conexion, boolean excluirConexionRutaConf, boolean isConexionGerada) { + conexionRutaConfDAO.excluirConfiguracao(conexion, UsuarioLogado.getUsuarioLogado().getUsuarioId(), excluirConexionRutaConf, isConexionGerada); + } + + @Override + @Transactional + public ConexionRutaConf salvarConfiguracao(ConexionRutaConf conexionRutaConf, List canalVentas, List puntoVentas, + List conexoesCtrl, List rutas, List localidadesCombinadas, + boolean isConexionGerada) { + conexionRutaConf = suscribirOrActualizacion(conexionRutaConf); + + salvarCanalVentasRutaCtrl(conexionRutaConf, canalVentas); + salvarPuntoVentasRutaCtrl(conexionRutaConf, puntoVentas); + + if(isConexionGerada) { + salvarConexionesRutaCtrl(conexionRutaConf, conexoesCtrl, rutas, localidadesCombinadas); + } else { + conexionRutaConfDAO.atualizarTempoMinimoEMaximo(conexionRutaConf); + } + + return conexionRutaConf; + } + + private ConexionRutaConf suscribirOrActualizacion(ConexionRutaConf conexion) { + if(conexion.getConexionRutaConfId() != null) { + return actualizacion(conexion); + } else { + return suscribir(conexion); + } + } + + private void salvarCanalVentasRutaCtrl(ConexionRutaConf conexionRutaConf, List canalVentas) { + for (TipoPuntoVenta tipoPuntoVenta : canalVentas) { + ConexionRutaExcepcionTipoPtoVta conexionRutaExcepcionPtoVta = new ConexionRutaExcepcionTipoPtoVta(); + conexionRutaExcepcionPtoVta.setTipoPtovta(tipoPuntoVenta); + conexionRutaExcepcionPtoVta.setConexionRutaConf(conexionRutaConf); + conexionRutaExcepcionPtoVta = conexionRutaExcepcionTipoPtoVtaService.suscribir(conexionRutaExcepcionPtoVta); + } + } + + private void salvarPuntoVentasRutaCtrl(ConexionRutaConf conexionRutaConf, List puntoVentas) { + for (PuntoVenta puntoVenta : puntoVentas) { + ConexionRutaExcepcionPtoVta conexionRutaExcepcionPtoVta = new ConexionRutaExcepcionPtoVta(); + conexionRutaExcepcionPtoVta.setConexionRutaConf(conexionRutaConf); + conexionRutaExcepcionPtoVta.setPuntoVenta(puntoVenta); + conexionRutaExcepcionPtoVta = conexionRutaRestricaoPtoVtaService.suscribir(conexionRutaExcepcionPtoVta); + } + } + + private void salvarConexionesRutaCtrl(ConexionRutaConf conexionRutaConf, List conexoesCtrl, List rutas, List localidadesCombinadas) { + List lsConexionRutaCtrl = new ArrayList(); + for (ConexionRutaCtrlVO conexionRutaCtrlVO : rutas) { + ConexionRutaCtrl conexionRutaCtrl = new ConexionRutaCtrl(); + conexionRutaCtrl.setRutaOrigen(new Ruta(conexionRutaCtrlVO.getRutaIdA())); + conexionRutaCtrl.setRutaDestino(new Ruta(conexionRutaCtrlVO.getRutaIdB())); + if(conexionRutaCtrlVO.getRutaIdC() != null) { + conexionRutaCtrl.setRutaDestinoC(new Ruta(conexionRutaCtrlVO.getRutaIdC())); + } + conexionRutaCtrl.setConexionRutaConf(conexionRutaConf); + conexionRutaCtrl = conexionRutaCtrlService.suscribir(conexionRutaCtrl); + lsConexionRutaCtrl.add(conexionRutaCtrl); + } + List lsConexionRutaTramo = salvarConexionesRutaTramoCtrl(lsConexionRutaCtrl, localidadesCombinadas); + salvarConexao(conexionRutaConf, conexoesCtrl, lsConexionRutaTramo, localidadesCombinadas); + } + + private List salvarConexionesRutaTramoCtrl(List rutasEntidades, List localidadesCombinadas) { + List lsConexionRutaTramo = new ArrayList(0); + for (ParadaVOConexionRuta vo : localidadesCombinadas) { + ConexionRutaTramoCtrl conexionRutaTramoCtrl = new ConexionRutaTramoCtrl(); + conexionRutaTramoCtrl.setOrigen(vo.getParadaOrigem()); + conexionRutaTramoCtrl.setDestino(vo.getParadaDestino()); + conexionRutaTramoCtrl.setRuta(new Ruta(vo.getRutaId())); + conexionRutaTramoCtrl.setSecuencia(vo.getSecuencia()); + + if(vo.getConexionRutaCtrl() != null && vo.getConexionRutaCtrl().getRutaIdC() == null) { + conexionRutaTramoCtrl.setConexionRutaCtrl(ConexionRutaCtrl.getConexionRutaCtrl(rutasEntidades, + vo.getConexionRutaCtrl().getRutaIdA(), + vo.getConexionRutaCtrl().getRutaIdB())); + } else if(vo.getConexionRutaCtrl() != null && vo.getConexionRutaCtrl().getRutaIdC() != null) { + conexionRutaTramoCtrl.setConexionRutaCtrl(ConexionRutaCtrl.getConexionRutaCtrl(rutasEntidades, + vo.getConexionRutaCtrl().getRutaIdA(), + vo.getConexionRutaCtrl().getRutaIdB(), + vo.getConexionRutaCtrl().getRutaIdC())); + } else { + conexionRutaTramoCtrl.setConexionRutaCtrl(ConexionRutaCtrl.getConexionRutaCtrl(rutasEntidades)); + } + + conexionRutaTramoCtrl.setValido(true); + conexionRutaTramoCtrl.setGrupo(vo.getGrupo()); + conexionRutaTramoCtrl = conexionRutaTramoCtrlService.suscribir(conexionRutaTramoCtrl); + vo.setConexionRutaTramoId(conexionRutaTramoCtrl.getConexionRutaTramoId()); + + lsConexionRutaTramo.add(conexionRutaTramoCtrl); + } + + return lsConexionRutaTramo; + } + + private void salvarConexao(ConexionRutaConf conexionRutaConf, List conexoesCtrl, List lsConexionRutaTramo, List localidadesCombinadas) { + for (ConexionCtrl conexionCtrl : conexoesCtrl) { + conexionCtrl = conexionCtrlService.suscribir(conexionCtrl); + salvarConexionesConf(conexionRutaConf, conexionCtrl); + salvarConexiones(conexionCtrl, lsConexionRutaTramo, localidadesCombinadas); + } + } + + private void salvarConexionesConf(ConexionRutaConf conexionRutaConf, ConexionCtrl conexionCtrl) { + for (int i = 1; i <= conexionCtrl.getGrupos(); i++) { + ConexionConf conexionConf = new ConexionConf(); + conexionConf.setConexionCtrl(conexionCtrl); + conexionConf.setGrupo(i); + conexionConf.setIndisponible(false); + conexionConf.setTiempoMin(conexionRutaConf.getTiempoMin()); + conexionConf.setTiempoMax(conexionRutaConf.getTiempoMax()); + conexionConf = conexionConfService.suscribir(conexionConf); + } + } + + private void salvarConexiones(ConexionCtrl conexionCtrl, List lsConexionRutaTramo, List localidadesCombinadas) { + List conexionRutaTramoCtrls = recuperarConexionRutaTramoCtrl(conexionCtrl, lsConexionRutaTramo, localidadesCombinadas); + for (ConexionRutaTramoCtrl conexionRutaTramoCtrl : conexionRutaTramoCtrls) { + Conexion conexion = new Conexion(); + conexion.setConexionctrlId(conexionCtrl.getConexionctrlId()); + conexion.setOrigenId(conexionRutaTramoCtrl.getOrigen().getParadaId()); + conexion.setDestinoId(conexionRutaTramoCtrl.getDestino().getParadaId()); + conexion.setNumgrupo(conexionRutaTramoCtrl.getGrupo()); + conexion.setNumsecuencia(conexionRutaTramoCtrl.getSecuencia()); + conexion.setRutaId(conexionRutaTramoCtrl.getRuta().getRutaId()); + conexion.setConexionRutaTramoId(conexionRutaTramoCtrl.getConexionRutaTramoId()); + conexion = conexionService.suscribir(conexion); + } + } + + private List recuperarConexionRutaTramoCtrl(ConexionCtrl conexionCtrl, List lsConexionRutaTramo, List localidadesCombinadas) { + List list = new ArrayList(0); + for (ParadaVOConexionRuta trecho: localidadesCombinadas) { + if(trecho.getConexionCtrl().isOrigemDestinoIgual(conexionCtrl.getOrigenId(), conexionCtrl.getDestinoId())) { + ConexionRutaTramoCtrl aux = new ConexionRutaTramoCtrl(trecho.getConexionRutaTramoId()); + Integer idx = lsConexionRutaTramo.indexOf(aux); + if(idx > -1) { + list.add(lsConexionRutaTramo.get(idx)); + } + } + } + return list; + } + + @Override + public ConexionRutaConfVO carregarConexoesCadastradas(Integer conexionrutaconfId) { + return conexionRutaConfDAO.carregarConexoesCadastradas(conexionrutaconfId); + } + + @Override + public List> buscarRutasPorConexionConf(Integer conexionRutaConfId) { + return conexionRutaConfDAO.buscarRutasPorConexionConf(conexionRutaConfId); + } + + @Override + public ConexionRutaConf getByIdActivo(Integer conexionRutaConfId) { + return conexionRutaConfDAO.getByIdActivo(conexionRutaConfId); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCtrlServiceImpl.java new file mode 100644 index 000000000..8231a1e1d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCtrlServiceImpl.java @@ -0,0 +1,84 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionRutaCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; +import com.rjconsultores.ventaboletos.service.ConexionRutaCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.conexion.ConexionRutaVO; + +@Service("conexionServiceRutaCtrl") +public class ConexionRutaCtrlServiceImpl implements ConexionRutaCtrlService { + + @Autowired + private ConexionRutaCtrlDAO conexionRutaCtrlDAO; + + @Override + @Transactional + public ConexionRutaCtrl suscribir(ConexionRutaCtrl conexionRutaCtrl) { + + conexionRutaCtrl.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexionRutaCtrl.setFecmodif(Calendar.getInstance().getTime()); + conexionRutaCtrl.setActivo(Boolean.TRUE); + + return conexionRutaCtrlDAO.suscribir(conexionRutaCtrl); + } + + @Override + public ConexionRutaCtrl actualizacion(ConexionRutaCtrl conexion) { + // TODO Auto-generated method stub + return null; + } + + @Override + @Transactional + public void borrar(ConexionRutaCtrl conexionRutaCtrl) { + + conexionRutaCtrl.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexionRutaCtrl.setFecmodif(Calendar.getInstance().getTime()); + conexionRutaCtrl.setActivo(Boolean.FALSE); + + conexionRutaCtrlDAO.actualizacion(conexionRutaCtrl); + + } + + @Override + public List buscarPorConexionCtrl(Long conexcionCtrlId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void borrar(List lsConexion) { + + } + + @Override + public void suscribirTodos(List conexiones) { + // TODO Auto-generated method stub + + } + + @Override + public List buscarConexionesValidas() { + return conexionRutaCtrlDAO.buscarConexionesValidas(); + } + + @Override + public List buscarConexionesValidas(Integer rutaOrigemId, Integer rutaDestinoId) { + return conexionRutaCtrlDAO.buscarConexionesValidas(rutaOrigemId, rutaDestinoId); + } + + @Override + public List buscarPorConexionConf(ConexionRutaConf conexionRutaConf) { + return conexionRutaCtrlDAO.buscarPorConexionConf(conexionRutaConf); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaExcepcionPtoVtaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaExcepcionPtoVtaServiceImpl.java new file mode 100644 index 000000000..d19bb2a1b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaExcepcionPtoVtaServiceImpl.java @@ -0,0 +1,79 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionRutaExcepcionPtoVtaDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaExcepcionPtoVta; +import com.rjconsultores.ventaboletos.service.ConexionRutaExcepcionPtoVtaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("conexionRutaExcepcionPtoVtaService") +public class ConexionRutaExcepcionPtoVtaServiceImpl implements ConexionRutaExcepcionPtoVtaService { + + @Autowired + private ConexionRutaExcepcionPtoVtaDAO conexionRutaExcepcionPtoVtaDAO; + + @Override + public void gerarConexiones() { + // TODO Auto-generated method stub + + } + + @Override + @Transactional + public ConexionRutaExcepcionPtoVta suscribir(ConexionRutaExcepcionPtoVta conexionRutaPtoVta) { + + conexionRutaPtoVta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexionRutaPtoVta.setFecmodif(Calendar.getInstance().getTime()); + conexionRutaPtoVta.setActivo(Boolean.TRUE); + + return conexionRutaExcepcionPtoVtaDAO.actualizacion(conexionRutaPtoVta); + } + + @Override + public ConexionRutaExcepcionPtoVta actualizacion(ConexionRutaExcepcionPtoVta conexion) { + return null; + } + + @Override + @Transactional + public void borrar(ConexionRutaExcepcionPtoVta entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); +// conexionRutaExcepcionPtoVtaDAO.update(entidad); + conexionRutaExcepcionPtoVtaDAO.actualizacion(entidad); + + } + + @Override + @Transactional + public void borrar(List lsConexion) { + for (ConexionRutaExcepcionPtoVta conexionRutaExcepcionPtoVta : lsConexion) { + borrar(conexionRutaExcepcionPtoVta); + } + } + + @Override + @Transactional + public void suscribirTodos(List conexionRutaExcepcionPtoVtas) { + + for (ConexionRutaExcepcionPtoVta conexion : conexionRutaExcepcionPtoVtas) { + suscribir(conexion); + } + + } + + @Override + public List buscarPorConexionConf(ConexionRutaConf conexionRutaConf) { + return conexionRutaExcepcionPtoVtaDAO.buscarPorConexionConf(conexionRutaConf); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTipoPtoVtaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTipoPtoVtaServiceImpl.java new file mode 100644 index 000000000..d5bc801a2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTipoPtoVtaServiceImpl.java @@ -0,0 +1,86 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionRutaExcepcionTipoPtoVtaDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaExcepcionTipoPtoVta; +import com.rjconsultores.ventaboletos.service.ConexionRutaExcepcionTipoPtoVtaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("conexionRutaExcepcionTipoPtoVtaService") +public class ConexionRutaTipoPtoVtaServiceImpl implements ConexionRutaExcepcionTipoPtoVtaService { + + @Autowired + private ConexionRutaExcepcionTipoPtoVtaDAO conexionRutaExcepcionTipoPtoVtaDAO; + + @Override + public void gerarConexiones() { + // TODO Auto-generated method stub + + } + + @Override + @Transactional + public ConexionRutaExcepcionTipoPtoVta suscribir(ConexionRutaExcepcionTipoPtoVta conexionRutaExcepcionTipoPtoVta) { + + conexionRutaExcepcionTipoPtoVta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexionRutaExcepcionTipoPtoVta.setFecmodif(Calendar.getInstance().getTime()); + conexionRutaExcepcionTipoPtoVta.setActivo(Boolean.TRUE); + + return conexionRutaExcepcionTipoPtoVtaDAO.suscribir(conexionRutaExcepcionTipoPtoVta); + } + + @Override + public ConexionRutaExcepcionTipoPtoVta actualizacion(ConexionRutaExcepcionTipoPtoVta conexion) { + // TODO Auto-generated method stub + return null; + } + + @Override + @Transactional + public void borrar(ConexionRutaExcepcionTipoPtoVta entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + conexionRutaExcepcionTipoPtoVtaDAO.actualizacion(entidad); + + } + + @Override + public List buscarPorConexionCtrl(Long conexcionCtrlId) { + // TODO Auto-generated method stub + return null; + } + + @Override + @Transactional + public void borrar(List lsConexion) { + for (ConexionRutaExcepcionTipoPtoVta conexionRutaExcepcionTipoPtoVta : lsConexion) { + borrar(conexionRutaExcepcionTipoPtoVta); + } + + } + + @Override + @Transactional + public void suscribirTodos(List cnexionRutaExcepcionTipoPtoVtas) { + + for (ConexionRutaExcepcionTipoPtoVta conexion : cnexionRutaExcepcionTipoPtoVtas) { + suscribir(conexion); + } + } + + @Override + public List buscarPorConexionConf(ConexionRutaConf conexionRutaCtrl) { + return conexionRutaExcepcionTipoPtoVtaDAO.buscarPorConexionConf(conexionRutaCtrl); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java new file mode 100644 index 000000000..7f64e39b2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java @@ -0,0 +1,113 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionRutaTramoCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaTramoCtrl; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.service.ConexionRutaTramoCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("conexionRutaTramoCtrlService") +public class ConexionRutaTramoCtrlServiceImpl implements ConexionRutaTramoCtrlService { + + @Autowired + private ConexionRutaTramoCtrlDAO conexionRutaTramoCtrlDAO; + + @Override + @Transactional + public ConexionRutaTramoCtrl suscribir(ConexionRutaTramoCtrl conexionRutaTramoCtrl) { + + conexionRutaTramoCtrl.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexionRutaTramoCtrl.setFecmodif(Calendar.getInstance().getTime()); + conexionRutaTramoCtrl.setActivo(Boolean.TRUE); + + return conexionRutaTramoCtrlDAO.suscribir(conexionRutaTramoCtrl); + } + + @Override + public ConexionRutaTramoCtrl actualizacion(ConexionRutaTramoCtrl conexion) { + // TODO Auto-generated method stub + return null; + } + + @Override + @Transactional + public void borrar(ConexionRutaTramoCtrl conexionRutaTramoCtrl) { + + conexionRutaTramoCtrl.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexionRutaTramoCtrl.setFecmodif(Calendar.getInstance().getTime()); + conexionRutaTramoCtrl.setActivo(Boolean.FALSE); + + conexionRutaTramoCtrlDAO.actualizacion(conexionRutaTramoCtrl); + + } + + @Override + public List buscarPorConexionRutaCtrl(ConexionRutaCtrl conexionRutaCtrl, Integer rutaId) { + return conexionRutaTramoCtrlDAO.buscarPorConexionRutaCtrl(conexionRutaCtrl, rutaId); + } + + @Transactional + @Override + public void borrar(List lsConexionRutaTramoCtrl) { + for (ConexionRutaTramoCtrl conexion : lsConexionRutaTramoCtrl) { + borrar(conexion); + } + } + + @Override + @Transactional + public void suscribirTodos(List lsConexionRutaTramoCtrl) { + for (ConexionRutaTramoCtrl conexion : lsConexionRutaTramoCtrl) { + suscribir(conexion); + } + } + + @Override + public ConexionRutaTramoCtrl buscarPorId(Long conexionRutaTramoId) { + return conexionRutaTramoCtrlDAO.obtenerID(conexionRutaTramoId); + } + + @Override + public boolean validarConexioneRutasExistentes(Integer rutaOrigenId, Integer rutaDestinoId, Integer rutaDestinoCId, Integer paradaOrigenId, Integer paradaDestinoId, Integer origemTrechoId, Integer destinoTrechoId) { + return conexionRutaTramoCtrlDAO.validarConexioneRutasExistentes(rutaOrigenId, rutaDestinoId, rutaDestinoCId, paradaOrigenId, paradaDestinoId, origemTrechoId, destinoTrechoId); + } + + @Override + public List buscarLocalidadesOrigem(Integer conexionRutaConfId) { + return conexionRutaTramoCtrlDAO.buscarPorConexionRutaConf(conexionRutaConfId, 'A'); + } + + @Override + public List buscarLocalidadesDestino(Integer conexionRutaConfId) { + return conexionRutaTramoCtrlDAO.buscarPorConexionRutaConf(conexionRutaConfId, 'B'); + } + + @Override + public List buscarLocalidadesDestinoC(Integer conexionRutaConfId) { + return conexionRutaTramoCtrlDAO.buscarPorConexionRutaConf(conexionRutaConfId, 'C'); + } + + @Override + public List buscarTodasLocalidadesOrigem(Integer conexionRutaConfId) { + return conexionRutaTramoCtrlDAO.buscarTodasLocalidadesOrigem(conexionRutaConfId); + } + + @Override + public List buscarTodasLocalidadesDestino(Integer conexionRutaConfId) { + return conexionRutaTramoCtrlDAO.buscarTodasLocalidadesDestino(conexionRutaConfId); + } + + @Override + public List buscarTodasLocalidadesDestinoC(Integer conexionRutaConfId) { + return conexionRutaTramoCtrlDAO.buscarTodasLocalidadesDestinoC(conexionRutaConfId); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java new file mode 100644 index 000000000..66f580703 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java @@ -0,0 +1,93 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionDAO; +import com.rjconsultores.ventaboletos.entidad.Conexion; +import com.rjconsultores.ventaboletos.service.ConexionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.conexion.ConexionVO; + +@Service("conexionService") +public class ConexionServiceImpl implements ConexionService { + + @Autowired + private ConexionDAO conexionDAO; + + @Override + @Transactional + public void gerarConexiones() { + conexionDAO.generarConexiones(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + @Override + public List buscarConexionesValidas() { + return conexionDAO.buscarConexionesValidas(); + } + + @Override + public List buscarConexiones(Integer origenId, Integer destinoId) { + return conexionDAO.buscarConexiones(origenId, destinoId); + } + + @Override + @Transactional + public Conexion suscribir(Conexion conexion) { + conexion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexion.setFecmodif(Calendar.getInstance().getTime()); + conexion.setActivo(Boolean.TRUE); + + return conexionDAO.suscribir(conexion); + } + + @Override + @Transactional + public Conexion actualizacion(Conexion conexion) { + conexion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexion.setFecmodif(Calendar.getInstance().getTime()); + conexion.setActivo(Boolean.TRUE); + + return conexionDAO.actualizacion(conexion); + } + + @Override + public List buscarPorConexionCtrl(Long conexcionCtrlId) { + return conexionDAO.buscarPorConexionCtrl(conexcionCtrlId); + } + + @Override + @Transactional + public void borrar(Conexion conexion) { + conexion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conexion.setFecmodif(Calendar.getInstance().getTime()); + conexion.setActivo(Boolean.FALSE); + + conexionDAO.actualizacion(conexion); + } + + @Override + @Transactional + public void borrar(List lsConexion) { + for (Conexion conexion : lsConexion) { + borrar(conexion); + } + + } + + @Override + @Transactional + public void suscribirTodos(List conexiones) { + conexionDAO.suscribirTodos(conexiones); + } + + @Override + @Transactional + public Conexion buscarPorConexionRutaTramoCtrl(Integer conexionRutaTramoId) { + return conexionDAO.buscarPorConexionRutaTramoCtrl(conexionRutaTramoId); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfContratoPuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfContratoPuntoVentaServiceImpl.java new file mode 100644 index 000000000..bb7bf514e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfContratoPuntoVentaServiceImpl.java @@ -0,0 +1,129 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.UnsupportedEncodingException; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfContratoPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ConfContratoPuntoVenta; +import com.rjconsultores.ventaboletos.service.ConfContratoPuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.configuracioneccomerciales.ConfLayoutContratoVO; + +@Service("confContratoPuntoVentaService") +public class ConfContratoPuntoVentaServiceImpl implements ConfContratoPuntoVentaService { + + @Autowired + private ConfContratoPuntoVentaDAO confContratoPuntoVentaDAO; + + @Override + public List obtenerTodos() { + return confContratoPuntoVentaDAO.obtenerTodos(); + } + + @Override + public ConfContratoPuntoVenta obtenerID(Integer id) { + return confContratoPuntoVentaDAO.obtenerID(id); + } + + @Transactional + public ConfContratoPuntoVenta suscribir(ConfContratoPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confContratoPuntoVentaDAO.suscribir(entidad); + } + + @Transactional + public ConfContratoPuntoVenta actualizacion(ConfContratoPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confContratoPuntoVentaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ConfContratoPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confContratoPuntoVentaDAO.actualizacion(entidad); + } + + @Override + public ConfLayoutContratoVO buscarInformacoesPontoVendaparaGerarContratos(Integer puntoVentaId, Integer empresaId) { + return confContratoPuntoVentaDAO.buscarInformacoesPontoVendaparaGerarContratos(puntoVentaId, empresaId ); + } + + + @Override + public String formatarLayout(ConfLayoutContratoVO confLayoutContratoVO, String html) { + + StringBuilder htmlFormatado = new StringBuilder(); + criarCabecalho(htmlFormatado); + html = html.replace("{nomeLocalidade}", confLayoutContratoVO.getNomeLocalidade()) + .replace("{CNPJ}", confLayoutContratoVO.getCNPJ()) + .replace("{dataAbertura}", confLayoutContratoVO.getDataAbertura() != null ? DateUtil.getStringDate(confLayoutContratoVO.getDataAbertura(), "dd/MM/yyyy") : "") + .replace("{razaoSocial}", confLayoutContratoVO.getRazaoSocial()) + .replace("{nomeCidade}", confLayoutContratoVO.getNomeCidade()) + .replace("{email}", confLayoutContratoVO.getEmail()) + .replace("{codigoPostal}", confLayoutContratoVO.getCodigoPostal()) + .replace("{numero}", confLayoutContratoVO.getNumero() != null ? confLayoutContratoVO.getNumero() : "") + .replace("{passagemAlta}", confLayoutContratoVO.getPassagemAlta() != null ? MoneyHelper.getValor(confLayoutContratoVO.getPassagemAlta()) : "0") + .replace("{passagemBaixa}", confLayoutContratoVO.getPassagemBaixa() != null ? MoneyHelper.getValor(confLayoutContratoVO.getPassagemBaixa()) : "0") + .replace("{seguroObrigatorioBaixa}", confLayoutContratoVO.getSeguroObrigatorioBaixa() != null ? MoneyHelper.getValor(confLayoutContratoVO.getSeguroObrigatorioBaixa()) : "0") + .replace("{seguroObrigatorioAlta}", confLayoutContratoVO.getSeguroObrigatorioAlta() != null ? MoneyHelper.getValor(confLayoutContratoVO.getSeguroObrigatorioAlta()) : "0") + .replace("{valorVendaGapBaixa}", confLayoutContratoVO.getValorVendaGapBaixa() != null ? MoneyHelper.getValor(confLayoutContratoVO.getValorVendaGapBaixa()) : "0") + .replace("{valorVendaGapAlta}", confLayoutContratoVO.getValorVendaGapAlta() != null ? MoneyHelper.getValor(confLayoutContratoVO.getValorVendaGapAlta()) : "0") + .replace("{valorVendaGapBaixaImp}", confLayoutContratoVO.getValorVendaGapBaixaImp() != null ? MoneyHelper.getValor(confLayoutContratoVO.getValorVendaGapBaixaImp()) : "0") + .replace("{valorVendaGapAltaImp}", confLayoutContratoVO.getValorVendaGapAltaImp() != null ? MoneyHelper.getValor(confLayoutContratoVO.getValorVendaGapAltaImp()) : "0") + .replace("{seguroBaixa}", confLayoutContratoVO.getSeguroBaixa() != null ? MoneyHelper.getValor(confLayoutContratoVO.getSeguroBaixa()) : "0") + .replace("{seguroAlta}", confLayoutContratoVO.getSeguroAlta()!= null ? MoneyHelper.getValor(confLayoutContratoVO.getSeguroAlta()) : "0") + .replace("{outrosBaixa}", confLayoutContratoVO.getOutrosBaixa() != null ? MoneyHelper.getValor(confLayoutContratoVO.getOutrosBaixa()) : "0") + .replace("{outrosAlta}", confLayoutContratoVO.getOutrosAlta() != null ? MoneyHelper.getValor(confLayoutContratoVO.getOutrosAlta()) : "0") + .replace("{excessoBaixa}", confLayoutContratoVO.getExcesssoBaixa() != null ? MoneyHelper.getValor(confLayoutContratoVO.getExcesssoBaixa()): "0") + .replace("{excessoAlta}", confLayoutContratoVO.getExcesssoAlta() != null ? MoneyHelper.getValor(confLayoutContratoVO.getExcesssoAlta()) :"0") + .replace("{nomeTitular}", confLayoutContratoVO.getNomeTitular()) + .replace("{nomeBanco}", confLayoutContratoVO.getNomeBanco()) + .replace("{numeroAgencia}", confLayoutContratoVO.getNumeroAgencia()) + .replace("{numeroConta}", confLayoutContratoVO.getNumeroConta()) + .replace("{tipoSocio}", confLayoutContratoVO.getTipoSocio() != null ? confLayoutContratoVO.getTipoSocio() : "") + .replace("{bairro}", confLayoutContratoVO.getBairro() != null ? confLayoutContratoVO.getBairro() : "" ) + .replace("{rua}", confLayoutContratoVO.getRua() != null ? confLayoutContratoVO.getRua() : "" ); + + htmlFormatado.append(formatarUTF(html)); + htmlFormatado.append(""); + + + + return htmlFormatado.toString(); + } + + private void criarCabecalho(StringBuilder htmlFormatado) { + + htmlFormatado.append(" "); + htmlFormatado.append(""); + htmlFormatado.append(""); + } + + private String formatarUTF(String html) { + + String output = ""; + try { + output = new String(html.getBytes("UTF-8"), "ISO-8859-1"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return output; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoCanalVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoCanalVentaServiceImpl.java new file mode 100644 index 000000000..3c7bb4c4b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoCanalVentaServiceImpl.java @@ -0,0 +1,211 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoCanalVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoCanalVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.ConfRestricaoCanalVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("confRestricaoCanalVentaService") +public class ConfRestricaoCanalVentaServiceImpl implements ConfRestricaoCanalVentaService { + @Autowired + private ConfRestricaoCanalVentaDAO confRestricaoCanalVentaDAO; + + + public ConfRestricaoCanalVenta obtenerID(Long id) { + return confRestricaoCanalVentaDAO.obtenerID(id); + } + + @Transactional + @Override + public ConfRestricaoCanalVenta suscribirActualizar(ConfRestricaoCanalVenta entidad) throws BusinessException { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getConfRestricaoCanalVentaId() == null){ + return confRestricaoCanalVentaDAO.suscribir(entidad); + }else{ + return confRestricaoCanalVentaDAO.actualizacion(entidad); + } + } + @Transactional + public void borrar(ConfRestricaoCanalVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confRestricaoCanalVentaDAO.actualizacion(entidad); + } + + @SuppressWarnings("unused") + private boolean isBloqueoExistente(ConfRestricaoCanalVenta c , List confRestricaoCanalVentaList){ + + List ls = new ArrayList() ; + + for (int i = 0; i < confRestricaoCanalVentaList.size(); i++){ + ConfRestricaoCanalVenta elementList = (ConfRestricaoCanalVenta)confRestricaoCanalVentaList.get(i); + if(c.getConfRestricaoCanalVentaId() == null){ + if(isConfRestricaoCanalVentasEquivalentes(c , elementList)){ + return true; + } + }else{ + if(!c.getConfRestricaoCanalVentaId().equals(elementList.getConfRestricaoCanalVentaId())){ + isConfRestricaoCanalVentasEquivalentes(c , elementList); + }else{ + continue; + } + } + } + return false; + } + + private boolean isConfRestricaoCanalVentasEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(isRutasTipoPvCorridaIdOrigemDestinoEquivalentes(a,b) + && (((a.getFecCorrida() != null) != (b.getFecCorrida() != null)) ? false : true) + && ((a.getFecCorrida() != null ) && (b.getFecCorrida() != null) ? true : false ) + && ((((a.getFecCorrida().compareTo(b.getFecCorrida())) == 0)) ? true : false ) + && isIntercessaoDiasSemana(a,b) + ){ + return true; + }else if(isRutasTipoPvCorridaIdOrigemDestinoEquivalentes(a,b) + && ((a.getFecCorrida() == null) ) && ( (b.getFecCorrida() == null) ) + && isIntercessaoDiasSemana(a,b) + ){ + return true; + } + return false; + } + + private boolean isRutasTipoPvCorridaIdOrigemDestinoEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(isRutasEquivalentes(a,b) + && isTipoPVEquivalentes(a,b) + && isCorridaIdEquivalentes(a,b) + && isOrigemEquivalentes(a,b) + && isDestinoEquivalentes(a,b)){ + return true; + }else{ + return false; + } + } + + private boolean isRutasEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(a.getRuta() == null && b.getRuta() == null ){ + return true; + } + if(a.getRuta() == null && b.getRuta() != null ){ + return false; + } + if(a.getRuta() != null && b.getRuta() == null ){ + return false; + } + if(a.getRuta() != null && b.getRuta() != null ){ + return a.getRuta().equals(b.getRuta()); + } + return false; + } + + private boolean isTipoPVEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(a.getTipoPuntoVenta() == null && b.getTipoPuntoVenta() == null ){ + return true; + } + if(a.getTipoPuntoVenta() == null && b.getTipoPuntoVenta() != null ){ + return false; + } + if(a.getTipoPuntoVenta() != null && b.getTipoPuntoVenta() == null ){ + return false; + } + if(a.getTipoPuntoVenta() != null && b.getTipoPuntoVenta() != null ){ + return a.getTipoPuntoVenta().equals(b.getTipoPuntoVenta()); + } + return false; + } + + private boolean isCorridaIdEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(a.getCorridaId() == null && b.getCorridaId() == null ){ + return true; + } + if(a.getCorridaId() == null && b.getCorridaId() != null ){ + return false; + } + if(a.getCorridaId() != null && b.getCorridaId() == null ){ + return false; + } + if(a.getCorridaId() != null && b.getCorridaId() != null ){ + return a.getCorridaId().equals(b.getCorridaId()); + } + return false; + } + + private boolean isOrigemEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(a.getOrigem() == null && b.getOrigem() == null ){ + return true; + } + if(a.getOrigem() == null && b.getOrigem() != null ){ + return false; + } + if(a.getOrigem() != null && b.getOrigem() == null ){ + return false; + } + if(a.getOrigem() != null && b.getOrigem() != null ){ + return a.getOrigem().equals(b.getOrigem()); + } + return false; + } + + private boolean isDestinoEquivalentes(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if(a.getDestino() == null && b.getDestino() == null ){ + return true; + } + if(a.getDestino() == null && b.getDestino() != null ){ + return false; + } + if(a.getDestino() != null && b.getDestino() == null ){ + return false; + } + if(a.getDestino() != null && b.getDestino() != null ){ + return a.getDestino().equals(b.getDestino()); + } + return false; + } + + private boolean isIntercessaoDiasSemana(ConfRestricaoCanalVenta a , ConfRestricaoCanalVenta b){ + if( ((a.getDomingo() != null ? a.getDomingo() : false) && (b.getDomingo() != null ? b.getDomingo() : false )) + || (a.getSegunda()!= null ? a.getSegunda() : false) && (b.getSegunda() != null ? b.getSegunda() : false) + || (a.getTerca() != null ? a.getTerca() : false ) && (b.getTerca() != null ? b.getTerca() : false) + || (a.getQuarta()!= null ? a.getQuarta() : false ) && (b.getQuarta() != null ? b.getQuarta() : false) + || (a.getQuinta() != null ? a.getQuinta() : false) && (b.getQuinta() != null ? b.getQuinta() : false) + || (a.getSexta() != null ? a.getSexta() : false) && (b.getSexta() != null ? b.getSexta() : false ) + || (a.getSabado() != null ? a.getSabado() : false ) && (b.getSabado() != null ? b.getSabado() : false) ){ + return true; + } + if(null == a.getSegunda() + && null == b.getSegunda() + && null == a.getTerca() + && null == b.getTerca() + && null == a.getQuarta() + && null == b.getQuarta() + && null == a.getQuinta() + && null == b.getQuinta() + && null == a.getSexta() + && null == b.getSexta() + && null == a.getSabado() + && null == b.getSabado() + && null == a.getDomingo() + && null == b.getDomingo()){ + return true; + } + + return false; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoExcecaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoExcecaoServiceImpl.java new file mode 100644 index 000000000..78be28400 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoExcecaoServiceImpl.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoExcecaoDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoExcecao; +import com.rjconsultores.ventaboletos.service.ConfRestricaoExcecaoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("confRestricaoExcecaoService") +public class ConfRestricaoExcecaoServiceImpl implements ConfRestricaoExcecaoService { + + @Autowired + private ConfRestricaoExcecaoDAO confRestricaoExcecaoDAO; + + public List obtenerTodos() { + return confRestricaoExcecaoDAO.obtenerTodos(); + } + + public ConfRestricaoExcecao obtenerID(Integer id) { + return confRestricaoExcecaoDAO.obtenerID(id); + } + + @Transactional + public ConfRestricaoExcecao suscribir(ConfRestricaoExcecao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoExcecaoDAO.suscribir(entidad); + } + + @Transactional + public ConfRestricaoExcecao actualizacion(ConfRestricaoExcecao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoExcecaoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ConfRestricaoExcecao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confRestricaoExcecaoDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoOrgaoConcedenteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoOrgaoConcedenteServiceImpl.java new file mode 100644 index 000000000..03478b53c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoOrgaoConcedenteServiceImpl.java @@ -0,0 +1,80 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoOrgaoConcedenteDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoOrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.service.ConfRestricaoOrgaoConcedenteService; +import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("confRestricaoOrgaoConcedenteService") +public class ConfRestricaoOrgaoConcedenteServiceImpl implements ConfRestricaoOrgaoConcedenteService { + + @Autowired + ConfRestricaoOrgaoConcedenteDAO confRestricaoOrgaoConcedenteDAO; + @Autowired + private OrgaoConcedenteService orgaoConcedenteService; + + @Override + public List obtenerTodos() { + return confRestricaoOrgaoConcedenteDAO.obtenerTodos(); + } + + @Override + public ConfRestricaoOrgaoConcedente obtenerID(Integer id) { + return confRestricaoOrgaoConcedenteDAO.obtenerID(id); + } + + @Override + public ConfRestricaoOrgaoConcedente obtenerOrgaoCOncedenteTodos() { + + ConfRestricaoOrgaoConcedente entidad = new ConfRestricaoOrgaoConcedente(); + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + OrgaoConcedente orgaoConcedente = orgaoConcedenteService.obtenerID(-1); + entidad.setOrgaoConcedente(orgaoConcedente); + + return entidad; + } + + @Override + @Transactional + public ConfRestricaoOrgaoConcedente suscribir(ConfRestricaoOrgaoConcedente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoOrgaoConcedenteDAO.suscribir(entidad); + } + + @Override + @Transactional + public ConfRestricaoOrgaoConcedente actualizacion(ConfRestricaoOrgaoConcedente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoOrgaoConcedenteDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(ConfRestricaoOrgaoConcedente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confRestricaoOrgaoConcedenteDAO.actualizacion(entidad); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoPtovtaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoPtovtaServiceImpl.java new file mode 100644 index 000000000..6ff1cf3a9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoPtovtaServiceImpl.java @@ -0,0 +1,79 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoPtovtaDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoPtovta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.ConfRestricaoPtovtaService; +import com.rjconsultores.ventaboletos.service.PuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("confRestricaoPtovtaService") +public class ConfRestricaoPtovtaServiceImpl implements ConfRestricaoPtovtaService { + + @Autowired + ConfRestricaoPtovtaDAO confRestricaoPtovtaDAO; + @Autowired + private PuntoVentaService puntoVentaService; + + @Override + public List obtenerTodos() { + return confRestricaoPtovtaDAO.obtenerTodos(); + } + + @Override + public ConfRestricaoPtovta obtenerID(Integer id) { + return confRestricaoPtovtaDAO.obtenerID(id); + } + + @Override + public ConfRestricaoPtovta obtenerPtovtaTodos() { + + ConfRestricaoPtovta entidad = new ConfRestricaoPtovta(); + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + PuntoVenta puntoVenta = puntoVentaService.obtenerID(-1); + entidad.setPuntoVenta(puntoVenta); + + return entidad; + } + + @Override + @Transactional + public ConfRestricaoPtovta suscribir(ConfRestricaoPtovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoPtovtaDAO.suscribir(entidad); + } + + @Override + @Transactional + public ConfRestricaoPtovta actualizacion(ConfRestricaoPtovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoPtovtaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(ConfRestricaoPtovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confRestricaoPtovtaDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoRutasServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoRutasServiceImpl.java new file mode 100644 index 000000000..9a531fbd4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoRutasServiceImpl.java @@ -0,0 +1,80 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoRutasDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoRutas; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.service.ConfRestricaoRutasService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("confRestricaoRutasService") +public class ConfRestricaoRutasServiceImpl implements ConfRestricaoRutasService { + + @Autowired + ConfRestricaoRutasDAO confRestricaoRutasDAO; + @Autowired + private RutaService rutaService; + + @Override + public List obtenerTodos() { + return confRestricaoRutasDAO.obtenerTodos(); + } + + @Override + public ConfRestricaoRutas obtenerID(Integer id) { + return confRestricaoRutasDAO.obtenerID(id); + } + + @Override + public ConfRestricaoRutas obtenerRutasTodos() { + + ConfRestricaoRutas entidad = new ConfRestricaoRutas(); + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + Ruta ruta = rutaService.obtenerID(-1); + entidad.setRuta(ruta); + + return entidad; + } + + @Override + @Transactional + public ConfRestricaoRutas suscribir(ConfRestricaoRutas entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoRutasDAO.suscribir(entidad); + } + + @Override + @Transactional + public ConfRestricaoRutas actualizacion(ConfRestricaoRutas entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoRutasDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(ConfRestricaoRutas entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confRestricaoRutasDAO.actualizacion(entidad); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoTramoOCServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoTramoOCServiceImpl.java new file mode 100644 index 000000000..87d17a430 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoTramoOCServiceImpl.java @@ -0,0 +1,78 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoTramoOCDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoTramoOC; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.service.ConfRestricaoTramoOCService; +import com.rjconsultores.ventaboletos.service.ParadaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("confRestricaoTramoOCService") +public class ConfRestricaoTramoOCServiceImpl implements ConfRestricaoTramoOCService { + + @Autowired + ConfRestricaoTramoOCDAO confRestricaoTramoOCDAO; + @Autowired + private ParadaService paradaService; + + @Override + public List obtenerTodos() { + return confRestricaoTramoOCDAO.obtenerTodos(); + } + + @Override + public ConfRestricaoTramoOC obtenerID(Integer id) { + return confRestricaoTramoOCDAO.obtenerID(id); + } + + @Override + public ConfRestricaoTramoOC obtenerTramoOCTodos() { + + ConfRestricaoTramoOC entidad = new ConfRestricaoTramoOC(); + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + Parada parada = paradaService.obtenerID(-1); + entidad.setOrigem(parada); + entidad.setDestino(parada); + return entidad; + } + + @Override + @Transactional + public ConfRestricaoTramoOC suscribir(ConfRestricaoTramoOC entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoTramoOCDAO.suscribir(entidad); + } + + @Override + @Transactional + public ConfRestricaoTramoOC actualizacion(ConfRestricaoTramoOC entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoTramoOCDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(ConfRestricaoTramoOC entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confRestricaoTramoOCDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoTramoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoTramoServiceImpl.java new file mode 100644 index 000000000..dbffc2801 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoTramoServiceImpl.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoTramoDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoTramo; +import com.rjconsultores.ventaboletos.service.ConfRestricaoTramoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("confRestricaoTramoService") +public class ConfRestricaoTramoServiceImpl implements ConfRestricaoTramoService { + + @Autowired + ConfRestricaoTramoDAO confRestricaoTramoDAO; + + @Override + public List obtenerTodos() { + return confRestricaoTramoDAO.obtenerTodos(); + } + + @Override + public ConfRestricaoTramo obtenerID(Long id) { + return confRestricaoTramoDAO.obtenerID(id); + } + @Transactional + @Override + public ConfRestricaoTramo suscribir(ConfRestricaoTramo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoTramoDAO.suscribir(entidad); + } + @Transactional + @Override + public ConfRestricaoTramo actualizacion(ConfRestricaoTramo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoTramoDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(ConfRestricaoTramo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confRestricaoTramoDAO.actualizacion(entidad); + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoVendaWebServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoVendaWebServiceImpl.java new file mode 100644 index 000000000..aec8bfb8b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoVendaWebServiceImpl.java @@ -0,0 +1,61 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfRestricaoVendaWebDAO; +import com.rjconsultores.ventaboletos.entidad.ConfRestricaoVendaWeb; +import com.rjconsultores.ventaboletos.service.ConfRestricaoVendaWebService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + + +@Service("confRestricaoVendaWebService") +public class ConfRestricaoVendaWebServiceImpl implements ConfRestricaoVendaWebService{ + + @Autowired + ConfRestricaoVendaWebDAO confRestricaoVendaWebDAO; + + @Override + @Transactional + public ConfRestricaoVendaWeb suscribir(ConfRestricaoVendaWeb entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoVendaWebDAO.suscribir(entidad); + } + + @Override + public ConfRestricaoVendaWeb obtenerID(Integer id) { + return confRestricaoVendaWebDAO.obtenerID(id); + } + + @Override + public List obtenerTodos() { + return confRestricaoVendaWebDAO.obtenerTodos(); + } + + @Override + @Transactional + public void borrar(ConfRestricaoVendaWeb entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confRestricaoVendaWebDAO.actualizacion(entidad); + } + + @Override + @Transactional + public ConfRestricaoVendaWeb actualizacion(ConfRestricaoVendaWeb entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confRestricaoVendaWebDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfTotemServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfTotemServiceImpl.java new file mode 100644 index 000000000..cf05a814a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfTotemServiceImpl.java @@ -0,0 +1,61 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfTotemDAO; +import com.rjconsultores.ventaboletos.entidad.ConfTotem; +import com.rjconsultores.ventaboletos.service.ConfTotemService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("confTotemService") +public class ConfTotemServiceImpl implements ConfTotemService { + + @Autowired + private ConfTotemDAO confTotemDAO; + + public List obtenerTodos() { + return confTotemDAO.obtenerTodos(); + } + + public ConfTotem obtenerID(Integer id) { + return confTotemDAO.obtenerID(id); + } + + @Transactional(propagation = Propagation.SUPPORTS) + public ConfTotem suscribir(ConfTotem entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado() != null ? UsuarioLogado.getUsuarioLogado().getUsuarioId() : null); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confTotemDAO.suscribir(entidad); + } + + @Transactional + public ConfTotem actualizacion(ConfTotem entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return confTotemDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ConfTotem entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + confTotemDAO.actualizacion(entidad); + } + + @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) + public ConfTotem buscar(String chave) { + return confTotemDAO.buscar(chave); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java new file mode 100644 index 000000000..9b8231160 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java @@ -0,0 +1,999 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.dao.ConferenciaComissaoDAO; +import com.rjconsultores.ventaboletos.dao.EmpresaDAO; +import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ComEmpConferencia; +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.LogConferencia; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO; +import com.rjconsultores.ventaboletos.enums.IndStatusBoleto; +import com.rjconsultores.ventaboletos.enums.comissao.BoletoStatusComissao; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.ConferenciaComissaoService; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.service.PuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.LocaleUtil; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; +import com.rjconsultores.ventaboletos.utilerias.SendMail; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; +import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.DiaConferenciaComissaoVO; +import com.rjconsultores.ventaboletos.vo.comissao.EtiquetaMalote; +import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO; +import com.rjconsultores.ventaboletos.vo.comissao.FormapagoVO; +import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO; +import com.rjconsultores.ventaboletos.vo.comissao.OcdVO; +import com.rjconsultores.ventaboletos.vo.comissao.ResumoComissao; + +@Service("conferenciaComissaoService") +public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoService { + + private static final String SMTP_HOST = "SMTP_HOST"; + private static final String SMTP_USER = "SMTP_USER"; + private static final String SMTP_EMAIL = "SMTP_EMAIL"; + private static final String SMTP_PORT = "SMTP_PORT"; + private static final String SMTP_PASS = "SMTP_PASS"; + + private static Logger log = Logger.getLogger(ConferenciaComissaoService.class); + + @Autowired + private ConferenciaComissaoDAO conferenciaComissaoDAO; + + @Autowired + private EmpresaDAO empresaDAO; + + @Autowired + private PuntoVentaDAO puntoVentaDAO; + + @Autowired + ConstanteService constanteService; + @Autowired + private EmpresaService empresaService; + @Autowired + private PuntoVentaService puntoVentaService; + + @Override + public List obtenerTodos() { + return conferenciaComissaoDAO.obtenerTodos(); + } + + @Override + public Conferencia obtenerID(Long id) { + return conferenciaComissaoDAO.obtenerID(id); + } + + @Override + public Conferencia suscribir(Conferencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return conferenciaComissaoDAO.suscribir(entidad); + } + + @Override + public Conferencia actualizacion(Conferencia entidad) { + return conferenciaComissaoDAO.actualizacion(entidad); + } + + @Override + public void borrar(Conferencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + conferenciaComissaoDAO.borrar(entidad); + } + + @Override + public List carregarConferenciaComissao(String competencia, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, boolean isDesconsideraPtVendaFechados) throws BusinessException { + return conferenciaComissaoDAO.carregarConferenciaComissao(competencia, empresa, puntoVenta, dataMovimento, isDesconsideraPtVendaFechados); + } + + @Override + public List carregarConferenciaComissao(Date dataInicial, Date dataFinal, Empresa empresa, PuntoVenta puntoVenta, Date dataMovimento, boolean isDesconsideraPtVendaFechados) throws BusinessException { + return conferenciaComissaoDAO.carregarConferenciaComissao(dataInicial, dataFinal, empresa, puntoVenta, dataMovimento, isDesconsideraPtVendaFechados); + } + + @Override + public Conferencia confirmarChegadaMalote(Conferencia conferencia) throws BusinessException { + conferencia.setDatamalote(new Date()); + if (conferencia.getUsuarioId() == null || conferencia.getUsuarioId() < 1) { + conferencia.setUsuarioMaloteId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + return conferenciaComissaoDAO.confirmarChegadaMalote(conferencia); + } + + @Override + public Conferencia suscribirOrActualizacion(Conferencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return conferenciaComissaoDAO.suscribirOrActualizacion(entidad); + } + + @Override + public Conferencia encerrarMovimentoDiario(Conferencia conferencia) throws BusinessException { + if (conferencia.getUsuarioId() == null || conferencia.getUsuarioId() < 1) { + conferencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + conferencia.setFecmodif(Calendar.getInstance().getTime()); + return conferenciaComissaoDAO.encerrarMovimentoDiario(conferencia); + } + + @Override + public List carregarEventosFinanceiros(Conferencia conferencia) throws BusinessException { + return conferenciaComissaoDAO.carregarEventosFinanceiros(conferencia); + } + + @Override + public List carregarLogConferencia(Conferencia conferencia) throws BusinessException { + return conferenciaComissaoDAO.carregarLogConferencia(conferencia); + } + + @Override + public LogConferencia suscribirLogConferencia(LogConferencia logConferencia) throws BusinessException { + return conferenciaComissaoDAO.suscribirLogConferencia(logConferencia); + } + + @Override + public void borrarLogConferencia(LogConferencia logConferencia) throws BusinessException { + conferenciaComissaoDAO.borrarLogConferencia(logConferencia); + } + + @Override + public LogConferencia obtenerLogConferenciaID(Long logconferenciaId) { + return conferenciaComissaoDAO.obtenerLogConferenciaID(logconferenciaId); + } + + @Override + public List carregarBilhetesComissao(List boletoComissaos, List conferencias, BoletoStatusComissao boletoStatusComissao, boolean carregarDadosFaltantes) throws BusinessException { + + List retorno = new ArrayList(); + Boolean retornar = false; + + for (Conferencia c : conferencias) { + + if (retornar) { + return retorno; + } + + if (boletoComissaos == null || boletoComissaos.isEmpty()) { + boletoComissaos = conferenciaComissaoDAO.carregarBilhetesComissao(c, false, false); + } + + if (boletoStatusComissao == null) { + retorno.addAll(boletoComissaos); + boletoComissaos = null; + continue; + } + + Empresa empresa = empresaDAO.obtenerID(c.getEmpresa().getEmpresaId()); + ComEmpConferencia comEmpConferencia = null; + if (empresa.getComEmpConferencias() != null && !empresa.getComEmpConferencias().isEmpty()) { + comEmpConferencia = empresa.getComEmpConferencias().iterator().next(); + } + retornar = true; + switch (boletoStatusComissao) { + case BOLETOS_VENDIDOS: + retorno.addAll(carregarBilhetesVendidos(boletoComissaos, comEmpConferencia, carregarDadosFaltantes)); + break; + case BOLETO_MANUAL: + retorno.addAll(carregarBilhetesManuais(boletoComissaos, comEmpConferencia)); + break; + case BOLETO_CANCELADO: + retorno.addAll(carregarBilhetesCancelados(boletoComissaos, comEmpConferencia, carregarDadosFaltantes)); + break; + case BOLETO_DEVOLVIDO: + retorno.addAll(carregarBilhetesDevolvidos(boletoComissaos, StringUtils.isNotBlank(c.getNumfoliosistema()), comEmpConferencia, carregarDadosFaltantes)); + break; + case GAP_VENDIDOS: + retorno.addAll(carregarBilhetesGapsVendidos(boletoComissaos, comEmpConferencia)); + break; + case GAP_CANCELADO: + retorno.addAll(carregarBilhetesGapCancelados(boletoComissaos, comEmpConferencia)); + break; + case GAP_DEVOLVIDO: + retorno.addAll(carregarBilhetesGapDevolvidos(boletoComissaos, comEmpConferencia)); + break; + default: + break; + } + return retorno; + } + + return retorno; + } + + @Override + public List carregarBilhetesComissao(List boletoComissaos, Conferencia conferencia, BoletoStatusComissao boletoStatusComissao, boolean carregarDadosFaltantes) throws BusinessException { + if (boletoComissaos == null) { + boletoComissaos = conferenciaComissaoDAO.carregarBilhetesComissao(conferencia, false, false); + } + + if (boletoStatusComissao == null) { + return boletoComissaos; + } + + Empresa empresa = empresaDAO.obtenerID(conferencia.getEmpresa().getEmpresaId()); + ComEmpConferencia comEmpConferencia = null; + if (empresa.getComEmpConferencias() != null && !empresa.getComEmpConferencias().isEmpty()) { + comEmpConferencia = empresa.getComEmpConferencias().iterator().next(); + } + + List retorno = new ArrayList(); + switch (boletoStatusComissao) { + case BOLETOS_VENDIDOS: + retorno.addAll(carregarBilhetesVendidos(boletoComissaos, comEmpConferencia, carregarDadosFaltantes)); + break; + case BOLETO_MANUAL: + retorno.addAll(carregarBilhetesManuais(boletoComissaos, comEmpConferencia)); + break; + case BOLETO_CANCELADO: + retorno.addAll(carregarBilhetesCancelados(boletoComissaos, comEmpConferencia, carregarDadosFaltantes)); + break; + case BOLETO_DEVOLVIDO: + retorno.addAll(carregarBilhetesDevolvidos(boletoComissaos, StringUtils.isNotBlank(conferencia.getNumfoliosistema()), comEmpConferencia, carregarDadosFaltantes)); + break; + case GAP_VENDIDOS: + retorno.addAll(carregarBilhetesGapsVendidos(boletoComissaos, comEmpConferencia)); + break; + case GAP_CANCELADO: + retorno.addAll(carregarBilhetesGapCancelados(boletoComissaos, comEmpConferencia)); + break; + case GAP_DEVOLVIDO: + retorno.addAll(carregarBilhetesGapDevolvidos(boletoComissaos, comEmpConferencia)); + break; + default: + break; + } + return retorno; + } + + private Set carregarBilhetesManuais(List boletoComissaos, ComEmpConferencia comEmpConferencia) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if (boletoComissao.isAbaBilheteManual()) { + + if (comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetemanual()); + } + + boletos.add(boletoComissao); + } + } + return boletos; + } + + private Set carregarBilhetesVendidos(List boletoComissaos, ComEmpConferencia comEmpConferencia, boolean carregarDadosFaltantes) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if (boletoComissao.isAbaBilheteVendido() || carregarDadosFaltantes) { + + if (comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetevendido()); + } + if (boletoComissao.isQuitacaoOCD()) { + continue; + } + boletos.add(boletoComissao); + + } + } + return boletos; + } + + private Set carregarBilhetesCancelados(List boletoComissaos, ComEmpConferencia comEmpConferencia, boolean carregarDadosFaltantes) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if (boletoComissao.isAbaBilheteCancelado() || carregarDadosFaltantes) { + + if (comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetecancelado()); + } + + boletos.add(boletoComissao); + + } + } + return boletos; + } + + private Set carregarBilhetesDevolvidos(List boletoComissaos, boolean pesquisa, ComEmpConferencia comEmpConferencia, boolean carregarDadosFaltantes) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if (boletoComissao.isAbaBilheteDevolvido() || carregarDadosFaltantes) { + + boletoComissao.setExigeConferenciaDevolvido(boletoComissao.getIndcarboletosdevolvidosconf() != null && !boletoComissao.getIndcarboletosdevolvidosconf()); + + if (comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndbilhetedevolvido()); + } + + if (pesquisa || + ((boletoComissao.getIndcarboletosdevolvidosconf() != null && boletoComissao.getIndcarboletosdevolvidosconf()) || boletoComissao.getLogconferenciaId() != null)) { + boletos.add(boletoComissao); + } + + } + } + return boletos; + } + + private Set carregarBilhetesGapsVendidos(List boletoComissaos, ComEmpConferencia comEmpConferencia) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if (boletoComissao.isAbaGapVendido()) { + + if (comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndgapvendido()); + } + + boletos.add(boletoComissao); + + } + } + return boletos; + } + + private Set carregarBilhetesGapCancelados(List boletoComissaos, ComEmpConferencia comEmpConferencia) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if (boletoComissao.isAbaGapCancelado()) { + + if (comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndgapcancelado()); + } + + boletos.add(boletoComissao); + } + } + return boletos; + } + + private Set carregarBilhetesGapDevolvidos(List boletoComissaos, ComEmpConferencia comEmpConferencia) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if (boletoComissao.isAbaGapDevolvido()) { + + if (comEmpConferencia != null) { + boletoComissao.setExigeConferenciaAba(comEmpConferencia.getIndgapdevolvido()); + } + + boletos.add(boletoComissao); + + } + } + return boletos; + } + + @Override + public List carregarOcds(Conferencia conferencia) throws BusinessException { + return conferenciaComissaoDAO.carregarOcds(conferencia); + } + + @Override + public Conferencia reabrirMovimentoDiario(Conferencia conferencia) throws BusinessException { + conferencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + conferencia.setFecmodif(Calendar.getInstance().getTime()); + return conferenciaComissaoDAO.reabrirMovimentoDiario(conferencia); + } + + @Override + public Conferencia obtenerConferenciaDataMovimento(Date datamovimento, Integer puntoventaId, Integer empresaId) throws BusinessException { + return conferenciaComissaoDAO.obtenerConferenciaDataMovimento(datamovimento, puntoventaId, empresaId); + } + + @Override + public boolean isBilhetesSemConferencia(List lsBoletoComissao) throws BusinessException { + for (BoletoComissao boletoComissao : lsBoletoComissao) { + if ((boletoComissao.isExigeConferencia() || boletoComissao.isExigeConferenciaAba() || boletoComissao.isExigeConferenciaBoletoDevolvido()) && + (!boletoComissao.isConferido() && boletoComissao.getLogconferenciaId() == null)) { + return true; + } + } + return false; + } + + @Override + public boolean isEventosFinanceirosSemConferencia(List lsEventosFinanceiros) throws BusinessException { + for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { + if ((eventosFinanceiros.isExigeConferencia() || eventosFinanceiros.getExigeConferenciaAba()) && + (!eventosFinanceiros.isConferido() && eventosFinanceiros.getLogconferenciaId() == null)) { + return true; + } + } + return false; + } + + @Override + public BigDecimal totalizarBoletoComissao(List lsBoletoComissao, IndStatusBoleto... statusBilhete) throws BusinessException { + List lStatusBilhete = null; + if (statusBilhete != null && statusBilhete.length > 0) { + lStatusBilhete = Arrays.asList(statusBilhete); + } + + BigDecimal total = BigDecimal.ZERO; + if (lsBoletoComissao != null) { + for (BoletoComissao boletoComissao : lsBoletoComissao) { + if (boletoComissao.isNotSomarBilhete()) { + continue; + } + + if ((lStatusBilhete == null || lStatusBilhete.contains(boletoComissao.getIndstatusboletoEnum())) && + !boletoComissao.isVendaBilheteConfirmaAberto(boletoComissao.getTipoVenta())) { + // log.info(boletoComissao.toString()); + total = total.add(boletoComissao.getTotal()); + } + } + } + return total; + } + + @Override + public Map totalizarBoletoComissaoDevolvidosTrocaOcd(List lsBoletoComissao) throws BusinessException { + BigDecimal totalDevolvidos = BigDecimal.ZERO; + BigDecimal totalTroca = BigDecimal.ZERO; + BigDecimal totalOcd = BigDecimal.ZERO; + if (lsBoletoComissao != null) { + for (BoletoComissao boletoComissao : lsBoletoComissao) { + if (boletoComissao.isNotSomarBilhete()) { + continue; + } + if (boletoComissao.isOcd()) { + totalOcd = totalOcd.add(boletoComissao.getTotal()); + } else if (boletoComissao.isMotivocancelacionDevolvido()) { + totalDevolvidos = totalDevolvidos.add(boletoComissao.getTotal()); + } else if (boletoComissao.isMotivocancelacionTrocado()) { + totalTroca = totalTroca.add(boletoComissao.getTotal()); + } + } + } + Map maps = new HashMap(); + maps.put(BoletoStatusComissao.BOLETO_DEVOLVIDO, totalDevolvidos); + maps.put(BoletoStatusComissao.BOLETO_DEVOLVIDO_OCD, totalOcd); + maps.put(BoletoStatusComissao.BOLETO_DEVOLVIDO_TROCADO, totalTroca); + return maps; + } + + @Override + public BigDecimal totalizarEventosFinanceiros(List lsEventosFinanceiros) throws BusinessException { + BigDecimal total = BigDecimal.ZERO; + if (lsEventosFinanceiros != null) { + for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { + /* total = total.add(eventosFinanceiros.getImpingreso()); */ + if (eventosFinanceiros.isCredito()) { + total = MoneyHelper.somar(total, eventosFinanceiros.getImpingreso()); + } else if (eventosFinanceiros.isDebito()) { + total = MoneyHelper.subtrair(total, eventosFinanceiros.getImpingreso().abs()); + } + } + } + return total; + } + + @Override + public OcdVO totalizarOcd(List lsOcd) throws BusinessException { + OcdVO total = new OcdVO(); + total.setValorPagar(BigDecimal.ZERO); + total.setPenalizacion(BigDecimal.ZERO); + + if (lsOcd != null) { + for (OcdVO ocd : lsOcd) { + total.setValorPagar(total.getValorPagar().add(ocd.getValorPagar())); + } + } + return total; + } + + @Override + public ResumoComissao gerarResumo(Conferencia conferencia, List boletoComissaos, List lsEventosFinanceiros, BigDecimal totalBilhetesManual, BigDecimal totalBilhetesVendidos, + BigDecimal totalBilhetesCancelados, BigDecimal totalBilhetesDevolvidos, BigDecimal totalBilhetesGap, BigDecimal totalBilhetesGapCancelados, + BigDecimal totalBilhetesGapDevolvidos, BigDecimal totalCreditosEventoFinanceiros, BigDecimal totalDebitosEventoFinanceiros, OcdVO totalOcd, + BigDecimal totalBilhetesTrocados, BigDecimal totalBilhetesGapTrocados) throws BusinessException { + ResumoComissao resumoComissao = new ResumoComissao(); + resumoComissao.setTotalDevolvidos(totalBilhetesDevolvidos.add(totalBilhetesGapDevolvidos)); + resumoComissao.setTotalCancelados(totalBilhetesCancelados.add(totalBilhetesGapCancelados)); + resumoComissao.setTotalVendas(totalBilhetesVendidos.add(totalBilhetesManual).add(totalBilhetesGap)); + resumoComissao.setTotalReceitas(totalCreditosEventoFinanceiros); + resumoComissao.setTotalDespesas(totalDebitosEventoFinanceiros); + resumoComissao.setTotalTroca(totalBilhetesTrocados.add(totalBilhetesGapTrocados)); + resumoComissao.setTotalOcd(totalOcd); + + carregarTotalFormapago(resumoComissao, boletoComissaos, lsEventosFinanceiros); + carregarTotalDeposito(conferencia, resumoComissao, boletoComissaos, lsEventosFinanceiros); + + resumoComissao.setListNumSerieECF(puntoVentaDAO.quantidadeECFPorPuntoVenta(conferencia)); + + return resumoComissao; + } + + /** + * Calcula o total de deposito + * @param conferencia + * @param resumoComissao + * @param boletoComissaos + * @param lsEventosFinanceiros + * @return + */ + private void carregarTotalDeposito(Conferencia conferencia, ResumoComissao resumoComissao, List boletoComissaos, List lsEventosFinanceiros) { + List formaspagosDeposito = new ArrayList(Arrays.asList(Constantes.FORMA_PAGO_DINHEIRO.intValue())); + if(conferencia != null && conferenciaComissaoDAO.isConfMovFPTrocaVlrDeposito(conferencia.getEmpresa())) { + formaspagosDeposito.add(Constantes.FORMA_PAGO_TROCA_PASSAGEM.intValue()); + } + + BigDecimal totalDeposito = BigDecimal.ZERO; + + for (BoletoComissao boletoComissao : boletoComissaos) { + if (!boletoComissao.isNotSomarBilhete()) { + for (FormapagoVO formapago : boletoComissao.getFormapagos()) { + if (formaspagosDeposito.contains(formapago.getFormapagoId())) { + // subtraindo as quitacoes de ocd + if (boletoComissao.isMotivocancelacionQuitacaoOcd()) { + totalDeposito = MoneyHelper.subtrair(totalDeposito, formapago.getImporte()); + // somando as vendas + } else if (boletoComissao.isAbaBilheteVendido() || boletoComissao.isAbaGapVendido() || boletoComissao.isAbaBilheteManual()) { + totalDeposito = MoneyHelper.somar(totalDeposito, formapago.getImporte()); + // subtraindo os cancelamentos + } else if (boletoComissao.isAbaBilheteCancelado() || boletoComissao.isAbaGapCancelado()) { + totalDeposito = MoneyHelper.subtrair(totalDeposito, formapago.getImporte()); + // subtraindo as trocas e devolucoes + } else if (boletoComissao.isAbaBilheteDevolvido() || boletoComissao.isAbaGapDevolvido()) { + if (boletoComissao.isMotivocancelacionTrocado() || boletoComissao.isMotivocancelacionDevolvido()) { + totalDeposito = MoneyHelper.subtrair(totalDeposito, formapago.getImporte()); + } + } + } + } + } + } + + // calculando os movimentos financeiros + for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { + if (formaspagosDeposito.contains(eventosFinanceiros.getFormapagoId())) { + if (eventosFinanceiros.isCredito()) { + totalDeposito = MoneyHelper.somar(totalDeposito, eventosFinanceiros.getImpingreso()); + } else if (eventosFinanceiros.isDebito()) { + totalDeposito = MoneyHelper.subtrair(totalDeposito, eventosFinanceiros.getImpingreso().abs()); + } + } + } + + resumoComissao.setValorDeposito(totalDeposito); + + } + + /** + * Totaliza os valores conforme o forma pago, apenas do bilhetes que geraram registros em caixa
+ * (+) Abas: Bilhetes Manual, Bilhetes, Gap Venda
+ * (-) Abas: Bilhetes Cancelados, Bilhetes Devolvidos, Gap Cancelados, Gap Devolvidos
+ * + * @param resumoComissao + * @param boletoComissaos + * @param lsEventosFinanceiros + */ + private void carregarTotalFormapago(ResumoComissao resumoComissao, List boletoComissaos, List lsEventosFinanceiros) { + List totalFormapagos = new ArrayList(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if (!boletoComissao.isNotSomarBilhete()) { + for (FormapagoVO formapagoBoleto : boletoComissao.getFormapagos()) { + FormapagoVO formapago; + if (totalFormapagos.contains(formapagoBoleto)) { + formapago = totalFormapagos.get(totalFormapagos.indexOf(formapagoBoleto)); + } else { + formapago = new FormapagoVO(formapagoBoleto.getFormapagoId(), formapagoBoleto.getDescpago(), null, BigDecimal.ZERO); + totalFormapagos.add(formapago); + } + + // subtraindo as quitacoes de ocd + if (boletoComissao.isMotivocancelacionQuitacaoOcd()) { + formapago.subtract(formapagoBoleto.getImporte()); + // somando as vendas + } else if (boletoComissao.isAbaBilheteVendido() || boletoComissao.isAbaGapVendido() || boletoComissao.isAbaBilheteManual()) { + formapago.add(formapagoBoleto.getImporte()); + // subtraindo os cancelamentos + } else if (boletoComissao.isAbaBilheteCancelado() || boletoComissao.isAbaGapCancelado()) { + formapago.subtract(formapagoBoleto.getImporte()); + // subtraindo as trocas e devolucoes + } else if (boletoComissao.isAbaBilheteDevolvido() || boletoComissao.isAbaGapDevolvido()) { + if (boletoComissao.isMotivocancelacionTrocado() || boletoComissao.isMotivocancelacionDevolvido() || boletoComissao.isMotivocancelacionQuitacaoOcd()) { + formapago.subtract(formapagoBoleto.getImporte()); + } + } + } + } + } + + for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { + FormapagoVO formapagoEventoFinanceiro = new FormapagoVO(eventosFinanceiros.getFormapagoId(), eventosFinanceiros.getDescpago(), null, BigDecimal.ZERO); + if (totalFormapagos.contains(formapagoEventoFinanceiro)) { + formapagoEventoFinanceiro = totalFormapagos.get(totalFormapagos.indexOf(formapagoEventoFinanceiro)); + } else { + totalFormapagos.add(formapagoEventoFinanceiro); + } + + if (eventosFinanceiros.isCredito()) { + formapagoEventoFinanceiro.add(eventosFinanceiros.getImpingreso()); + } else if (eventosFinanceiros.isDebito()) { + formapagoEventoFinanceiro.subtract(eventosFinanceiros.getImpingreso().abs()); + } + } + + resumoComissao.setTotalFormapago(totalFormapagos); + } + + @Override + public EtiquetaMalote decodificarEtiquetaMalote(String codigoBarras) throws BusinessException { + try { + EtiquetaMalote etiquetaMalote = new EtiquetaMalote(); + log.debug("Empresa: " + codigoBarras.substring(0, 4)); + etiquetaMalote.setEmpresaId(Integer.valueOf(codigoBarras.substring(0, 4))); + log.debug("Punto Venta: " + codigoBarras.substring(4, 9)); + etiquetaMalote.setPuntoventaId(Integer.valueOf(codigoBarras.substring(4, 9))); + log.debug("Numero Malote: " + codigoBarras.substring(9, 19)); + etiquetaMalote.setNumeroMalote(codigoBarras.substring(9, 19)); + log.debug("Data inicial: " + codigoBarras.substring(19, 27)); + etiquetaMalote.setDataInicial(DateUtil.getDateFromString(codigoBarras.substring(19, 27), "ddMMyyyy")); + log.debug("Data final: " + codigoBarras.substring(27, 35)); + etiquetaMalote.setDataFinal(DateUtil.getDateFromString(codigoBarras.substring(27, 35), "ddMMyyyy")); + + Empresa empresa = empresaDAO.obtenerID(etiquetaMalote.getEmpresaId()); + if (empresa == null) { + throw new BusinessException("recebimentoMaloteController.msg.erro.empresaNaoLocalizada"); + } + etiquetaMalote.setNombempresa(empresa.getNombempresa()); + PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(etiquetaMalote.getPuntoventaId()); + if (puntoVenta == null) { + throw new BusinessException("recebimentoMaloteController.msg.erro.puntoVentaNaoLocalizado"); + } + etiquetaMalote.setNombpuntoventa(puntoVenta.getNombpuntoventa()); + + return etiquetaMalote; + } catch (BusinessException e) { + log.error(e.getMessage(), e); + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return null; + } + + @Override + public void confirmarChegadaMalote(EtiquetaMalote etiquetaMalote) throws BusinessException { + try { + Calendar cDataInicial = Calendar.getInstance(LocaleUtil.getLocale()); + cDataInicial.setTime(DateUtil.normalizar(etiquetaMalote.getDataInicial())); + + Calendar cDataFinal = Calendar.getInstance(LocaleUtil.getLocale()); + cDataFinal.setTime(DateUtil.normalizar(etiquetaMalote.getDataFinal())); + + Empresa empresa = empresaDAO.obtenerID(etiquetaMalote.getEmpresaId()); + PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(etiquetaMalote.getPuntoventaId()); + + while (cDataInicial.compareTo(cDataFinal) <= 0) { + Conferencia conferencia = obtenerConferenciaDataMovimento(cDataInicial.getTime(), etiquetaMalote.getPuntoventaId(), etiquetaMalote.getEmpresaId()); + if (conferencia == null) { + conferencia = new Conferencia(); + conferencia.setDatamovimento(cDataInicial.getTime()); + conferencia.setEmpresa(empresa); + conferencia.setPuntoVenta(puntoVenta); + + conferencia = suscribirOrActualizacion(conferencia); + } + cDataInicial.add(Calendar.DAY_OF_MONTH, 1); + + if (conferencia != null && conferencia.getIndmaloterecebido()) { + continue; + } + confirmarChegadaMalote(conferencia); + + } + + } catch (BusinessException e) { + log.error(e.getMessage(), e); + throw e; + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + + @Override + public boolean isConferenciaCompetenciaEncerrada(String competencia, Empresa empresa, PuntoVenta puntoVenta, boolean isDesconsideraPtVendaFechados) throws BusinessException { + return conferenciaComissaoDAO.isConferenciaCompetenciaEncerrada(competencia, empresa, puntoVenta, isDesconsideraPtVendaFechados); + } + + @Override + public boolean isOcdSemConferencia(List lsOcd) throws BusinessException { + for (OcdVO ocd : lsOcd) { + if (ocd.isExigeConferenciaAba() && (!ocd.isConferido() && ocd.getLogconferenciaId() == null)) { + return true; + } + } + return false; + } + + @Override + public DiaConferenciaComissaoVO carregarConferenciaRegistrada(Date datamovimento, Empresa empresa, PuntoVenta puntoVenta) throws BusinessException { + return conferenciaComissaoDAO.carregarConferenciaRegistrada(datamovimento, empresa, puntoVenta); + } + + @Override + public List quantidadeECFPorPuntoVenta(Conferencia conferencia) { + return puntoVentaDAO.quantidadeECFPorPuntoVenta(conferencia); + } + + @Override + public void enviarEmailIrregularidadeECF(String email, String msg, String assunto) throws Exception { + SendMail sendMail = new SendMail(); + String host = constanteService.buscarPorNomeConstante(SMTP_HOST).getValorconstante(); + String user = constanteService.buscarPorNomeConstante(SMTP_USER).getValorconstante(); + String emailFrom = constanteService.buscarPorNomeConstante(SMTP_EMAIL).getValorconstante(); + String port = constanteService.buscarPorNomeConstante(SMTP_PORT).getValorconstante(); + String password = constanteService.buscarPorNomeConstante(SMTP_PASS).getValorconstante(); + + verificarDadosEmail(Arrays.asList(host, user, emailFrom, port, password)); + + sendMail.setSmtpHost(host); + sendMail.setSmtpUser(user); + sendMail.setSmtpPassword(password); + sendMail.setSmtpPort(port); + sendMail.setEmailFrom(emailFrom); + sendMail.setEmailTo(email); + sendMail.setSubject(assunto); + sendMail.setText(msg); + sendMail.send(); + } + + private void verificarDadosEmail(List asList) throws Exception { + for (String s : asList) { + if (s == null || s.isEmpty()) { + throw new Exception(Labels.getLabel("informeIrregularidadeController.mail.configuracoes")); + } + } + } + + @Override + @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) + public void generacionAutomaticaConferencia() { + List lsPuntoVenta; + List lsConferenciaComissao; + Conferencia conferencia; + // Perocorrer todas as empresas cadastradas + List lsEmpresa = empresaService.obtenerTodos(); + for (Empresa empresa : lsEmpresa) { + lsPuntoVenta = puntoVentaService.buscaPuntoVentaEmpresaSemECF(empresa); + for (PuntoVentaVO puntoVentaVO : lsPuntoVenta) { + try { + PuntoVenta puntoVenta = new PuntoVenta(puntoVentaVO.getPuntoventaId(), puntoVentaVO.getNombpuntoventa()); + // Busca o Movimento para o dia de ontem, caso não exista aborta para este ponto de venda + lsConferenciaComissao = carregarConferenciaComissao(null, empresa, puntoVenta, DateUtil.getYesterdayDate(), false); + if ((CollectionUtils.isEmpty(lsConferenciaComissao)) || (!CollectionUtils.isEmpty(lsConferenciaComissao.get(0).getDias()) && lsConferenciaComissao.get(0).getDias().size() < 1)) { + log.info("Não há conferência para o Ponto de Venda " + puntoVentaVO.getNombpuntoventa() + " da empresa " + empresa.getNombempresa() + " no dia " + DateUtil.getYesterdayDateString()); + continue; + } + + // Confirma chegada do malote + conferencia = obtenerConferenciaDataMovimento(DateUtil.getYesterdayDate(), puntoVentaVO.getPuntoventaId(), empresa.getEmpresaId()); + if (conferencia == null) { + conferencia = new Conferencia(); + conferencia.setActivo(Boolean.TRUE); + conferencia.setFecmodif(new Date()); + conferencia.setUsuarioId(1); + conferencia.setEmpresa(empresa); + conferencia.setPuntoVenta(new PuntoVenta(puntoVentaVO.getPuntoventaId())); + conferencia.setDatamovimento(DateUtil.getYesterdayDate()); + } else { + // Se existe a conferência com status conferido para esta empresa e ponto de venda no dia de ontem, aborta. + if (Boolean.TRUE == conferencia.getIndconferido()) { + log.info("Já existe conferência com status conferido para o Ponto de Venda " + puntoVentaVO.getNombpuntoventa() + " da empresa " + empresa.getNombempresa() + " no dia " + DateUtil.getYesterdayDateString()); + continue; + } + } + + // Valida se existe alguma pendência que impede o fechamento. + if (!validaConferencia(conferencia)) { + log.info("Não há bilhetes para conferir ou será necessário realizar Conferência Manual para o Ponto de Venda " + puntoVentaVO.getNombpuntoventa() + " da empresa " + empresa.getNombempresa() + " no dia " + DateUtil.getYesterdayDateString()); + continue; + } + + // Confirma chegada do malote + conferencia = confirmarChegadaMalote(conferencia); + log.info("Realizado confirmação de chegada do malote para o Ponto de Venda " + puntoVentaVO.getNombpuntoventa() + " da empresa " + empresa.getNombempresa() + " no dia " + DateUtil.getYesterdayDateString()); + + // Encerra Movimento + encerrarMovimentoDiario(conferencia); + log.info("Conferência de Movimento para o Ponto de Venda " + puntoVentaVO.getNombpuntoventa() + " da empresa " + empresa.getNombempresa() + " no dia " + DateUtil.getYesterdayDateString() + "realizada com sucesso."); + } catch (BusinessException e) { + log.error("Erro ao buscar/validar conferência para o dia " + DateUtil.getYesterdayDateString(), e); + continue; + } + } + } + } + + private boolean validaConferencia(Conferencia conferencia) { + try { + + List boletosComissaos = carregarBilhetesComissao(null, conferencia, null, false); + if (boletosComissaos == null || CollectionUtils.isEmpty(boletosComissaos)) { + return false; + } + + if (!validaBilhetesManual(boletosComissaos, conferencia)) { + return false; + } + + if (!validaBilhetesVendidos(boletosComissaos, conferencia)) { + return false; + } + + if (!validaBilhetesCancelados(boletosComissaos, conferencia)) { + return false; + } + + if (!validaBilhetesDevolvidos(boletosComissaos, conferencia)) { + return false; + } + + if (!validaBilhetesGap(boletosComissaos, conferencia)) { + return false; + } + + if (!validaBilhetesGapCancelados(boletosComissaos, conferencia)) { + return false; + } + + if (!validaBilhetesGapDevolvidos(boletosComissaos, conferencia)) { + return false; + } + + if (!validaEventosFinanceiros(boletosComissaos, conferencia)) { + return false; + } + + if (!validaOcds(conferencia)) { + return false; + } + return true; + } catch (BusinessException e) { + log.error(e.getMessage(), e); + return false; + } + } + + private boolean validaBilhetesManual(List boletosComissaos, Conferencia conferencia) throws BusinessException { + List lsBilhetesManual = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_MANUAL, false); + if (!CollectionUtils.isEmpty(lsBilhetesManual) && isBilhetesSemConferencia(lsBilhetesManual)) { + return false; + } else { + return true; + } + } + + private boolean validaBilhetesVendidos(List boletosComissaos, Conferencia conferencia) throws BusinessException { + List lsBilhetes = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETOS_VENDIDOS, false); + if (!CollectionUtils.isEmpty(lsBilhetes) && isBilhetesSemConferencia(lsBilhetes)) { + + return false; + } else { + return true; + } + } + + private boolean validaBilhetesCancelados(List boletosComissaos, Conferencia conferencia) throws BusinessException { + List lsBilhetesCancelados = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_CANCELADO, false); + if (!CollectionUtils.isEmpty(lsBilhetesCancelados) && isBilhetesSemConferencia(lsBilhetesCancelados)) { + return false; + } else { + return true; + } + } + + private boolean validaBilhetesDevolvidos(List boletosComissaos, Conferencia conferencia) throws BusinessException { + List lsBilhetesDevolvidos = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_DEVOLVIDO, false); + if (!CollectionUtils.isEmpty(lsBilhetesDevolvidos) && isBilhetesSemConferencia(lsBilhetesDevolvidos)) { + return false; + } else { + return true; + } + } + + private boolean validaBilhetesGap(List boletosComissaos, Conferencia conferencia) throws BusinessException { + List lsBilhetesGap = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_VENDIDOS, false); + if (!CollectionUtils.isEmpty(lsBilhetesGap) && isBilhetesSemConferencia(lsBilhetesGap)) { + return false; + } else { + return true; + } + } + + private boolean validaBilhetesGapCancelados(List boletosComissaos, Conferencia conferencia) throws BusinessException { + List lsBilhetesGapCancelados = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_CANCELADO, false); + if (!CollectionUtils.isEmpty(lsBilhetesGapCancelados) && isBilhetesSemConferencia(lsBilhetesGapCancelados)) { + return false; + } else { + return true; + } + } + + private boolean validaBilhetesGapDevolvidos(List boletosComissaos, Conferencia conferencia) throws BusinessException { + List lsBilhetesGapDevolvidos = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_DEVOLVIDO, false); + if (!CollectionUtils.isEmpty(lsBilhetesGapDevolvidos) && isBilhetesSemConferencia(lsBilhetesGapDevolvidos)) { + return false; + } else { + return true; + } + } + + private boolean validaEventosFinanceiros(List boletosComissaos, Conferencia conferencia) throws BusinessException { + List lsEventosFinanceiros = carregarEventosFinanceiros(conferencia); + if (!CollectionUtils.isEmpty(lsEventosFinanceiros) && isEventosFinanceirosSemConferencia(lsEventosFinanceiros)) { + return false; + } else { + return true; + } + } + + private boolean validaOcds(Conferencia conferencia) throws BusinessException { + List lsOcds = carregarOcds(conferencia); + if (!CollectionUtils.isEmpty(lsOcds) && isOcdSemConferencia(lsOcds)) { + return false; + } else { + return true; + } + } + + @Override + public Conferencia cancelarChegadaMalote(Conferencia conferencia) { + return conferenciaComissaoDAO.cancelarChegadaMalote(conferencia); + } + + @Override + public boolean isConferidoVenta(BoletoComissao boletoComissao) { + return conferenciaComissaoDAO.isConferidoVenta(boletoComissao); + } + + @Override + public void borrarLogConferenciaTransacaoId(Long transacaoId) throws BusinessException { + conferenciaComissaoDAO.borrarLogConferenciaTransacaoId(transacaoId); + } + + @Override + public boolean isConferenciaCompetenciaEncerrada(Date dataInicial, Date dataFinal, Empresa empresa, PuntoVenta puntoVenta, boolean isDesconsideraPtVendaFechados) throws BusinessException { + return conferenciaComissaoDAO.isConferenciaCompetenciaEncerrada(dataInicial, dataFinal, empresa, puntoVenta, isDesconsideraPtVendaFechados); + } + + @Override + public BigDecimal getComissaoPuntoVenta(Integer puntoventaId, Integer empresaId, Date dataInicial, Date dataFinal) throws BusinessException { + return conferenciaComissaoDAO.getComissaoPuntoVenta(puntoventaId, empresaId, dataInicial, dataFinal); + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaPendenciaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaPendenciaServiceImpl.java new file mode 100644 index 000000000..3e35f556e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaPendenciaServiceImpl.java @@ -0,0 +1,51 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConferenciaPendenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ConferenciaPendencia; +import com.rjconsultores.ventaboletos.service.ConferenciaPendenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("conferenciaPendenciaService") +public class ConferenciaPendenciaServiceImpl implements ConferenciaPendenciaService { + + @Autowired + ConferenciaPendenciaDAO conferenciaPendenciaDAO; + + @Override + public List obtenerTodos() { + return conferenciaPendenciaDAO.obtenerTodos(); + } + + @Override + public ConferenciaPendencia obtenerID(Integer id) { + return conferenciaPendenciaDAO.obtenerID(id); + } + + @Transactional + public ConferenciaPendencia suscribir(ConferenciaPendencia entidad) { + entidad.setFecmodif(new Date()); + entidad.setUsuario(UsuarioLogado.getUsuarioLogado()); + if (entidad.getConferenciapendenciaId() == null) { + return conferenciaPendenciaDAO.suscribir(entidad); + } + return conferenciaPendenciaDAO.actualizacion(entidad); + } + + @Override + public ConferenciaPendencia actualizacion(ConferenciaPendencia entidad) { + return conferenciaPendenciaDAO.actualizacion(entidad); + } + + @Override + public void borrar(ConferenciaPendencia entidad) { + conferenciaPendenciaDAO.borrar(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfigRestriccionPagoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfigRestriccionPagoServiceImpl.java new file mode 100644 index 000000000..7fb63fd17 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfigRestriccionPagoServiceImpl.java @@ -0,0 +1,153 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ConfigRestriccionPagoDAO; +import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; +import com.rjconsultores.ventaboletos.service.ConfigRestriccionPagoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("configRestriccionPagoService") +public class ConfigRestriccionPagoServiceImpl implements ConfigRestriccionPagoService { + + public static final Integer RESTRICCION_CANCELABLE = 1; + public static final Integer RESTRICCION_TRANSFERIBLE = 2; + public static final Integer RESTRICCION_RESERVABLE = 3; + public static final Integer RESTRICCION_NO_CANCELABLE = 4; + public static final Integer RESTRICCION_NO_TRANSFERIBLE = 5; + public static final Integer RESTRICCION_NO_RESERVABLE = 6; + @Autowired + private ConfigRestriccionPagoDAO configRestriccionPagoDAO; + + public List obtenerTodos() { + return configRestriccionPagoDAO.obtenerTodos(); + } + + public ConfigRestriccionPago obtenerID(Integer id) { + return configRestriccionPagoDAO.obtenerID(id); + } + + @Transactional + public ConfigRestriccionPago suscribir(ConfigRestriccionPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return configRestriccionPagoDAO.suscribir(entidad); + } + + @Transactional + public ConfigRestriccionPago actualizacion(ConfigRestriccionPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return configRestriccionPagoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ConfigRestriccionPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + configRestriccionPagoDAO.actualizacion(entidad); + } + + public List buscar(FormaPago formaPago, + RestriccionPago restriccionPago, Empresa empresa) { + return configRestriccionPagoDAO.buscar(formaPago, restriccionPago, empresa); + } + + public boolean puedoDarDeAlta(ConfigRestriccionPago configRestriccionPago) { + if (configRestriccionPago == null) { + throw new IllegalArgumentException("Debe de informar la configuracion de restricción"); + } + if ((configRestriccionPago.getFormaPago() == null) || (configRestriccionPago.getRestriccion() == null)) { + throw new IllegalArgumentException("Debe de informar los atributos formaPago y Restriccion"); + } + Map mapConsulta = configRestriccionPagoDAO.buscar(configRestriccionPago.getFormaPago()); + + if (!mapConsulta.isEmpty()) { + + if (configRestriccionPago.getConfigrestriccionId() != null) { + Collection values = mapConsulta.values(); + Integer restriccionId = null; + for (ConfigRestriccionPago c : values) { + if (c.equals(configRestriccionPago) || (!c.getRestriccion().getRestriccionId().equals(configRestriccionPago.getRestriccion().getRestriccionId()))) { + restriccionId = c.getRestriccion().getRestriccionId().intValue(); + } + } + if (restriccionId != null) { + mapConsulta.remove(restriccionId); + } + } + + if ((configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_CANCELABLE.shortValue()) + && (mapConsulta.get(RESTRICCION_NO_CANCELABLE) != null) && isMesmaEmpresaOrEmpresaTodas(configRestriccionPago, mapConsulta.get(RESTRICCION_NO_CANCELABLE))) + || (configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_NO_CANCELABLE.shortValue()) + && (mapConsulta.get(RESTRICCION_CANCELABLE) != null) && isMesmaEmpresaOrEmpresaTodas(configRestriccionPago, mapConsulta.get(RESTRICCION_CANCELABLE)))) { + + return false; + } + + if ((configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_TRANSFERIBLE.shortValue()) + && (mapConsulta.get(RESTRICCION_NO_TRANSFERIBLE) != null) && isMesmaEmpresaOrEmpresaTodas(configRestriccionPago, mapConsulta.get(RESTRICCION_NO_TRANSFERIBLE))) + || (configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_NO_TRANSFERIBLE.shortValue()) + && (mapConsulta.get(RESTRICCION_TRANSFERIBLE) != null) && isMesmaEmpresaOrEmpresaTodas(configRestriccionPago, mapConsulta.get(RESTRICCION_TRANSFERIBLE)))) { + return false; + } + + if ((configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_RESERVABLE.shortValue()) + && (mapConsulta.get(RESTRICCION_NO_RESERVABLE) != null) && isMesmaEmpresaOrEmpresaTodas(configRestriccionPago, mapConsulta.get(RESTRICCION_NO_RESERVABLE))) + || (configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_NO_RESERVABLE.shortValue()) + && (mapConsulta.get(RESTRICCION_RESERVABLE) != null) && isMesmaEmpresaOrEmpresaTodas(configRestriccionPago, mapConsulta.get(RESTRICCION_RESERVABLE)))) { + return false; + } + + + + if (configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_RESERVABLE.shortValue()) + && (mapConsulta.get(RESTRICCION_RESERVABLE) != null) && isMesmaEmpresaOrEmpresaTodas(configRestriccionPago, mapConsulta.get(RESTRICCION_RESERVABLE))) { + return false; + } + if (configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_TRANSFERIBLE.shortValue()) + && (mapConsulta.get(RESTRICCION_TRANSFERIBLE) != null) && isMesmaEmpresaOrEmpresaTodas(configRestriccionPago, mapConsulta.get(RESTRICCION_TRANSFERIBLE))) { + return false; + } + if (configRestriccionPago.getRestriccion().getRestriccionId().equals(RESTRICCION_CANCELABLE.shortValue()) + && (mapConsulta.get(RESTRICCION_CANCELABLE) != null) && isMesmaEmpresaOrEmpresaTodas(configRestriccionPago, mapConsulta.get(RESTRICCION_CANCELABLE))) { + return false; + } + + } + + return true; + } + + private boolean isMesmaEmpresaOrEmpresaTodas(ConfigRestriccionPago configRestriccionPago, ConfigRestriccionPago configRestriccionPagoExistente) { + return configRestriccionPagoExistente.getEmpresa() == null || + configRestriccionPagoExistente.getEmpresa().getEmpresaId() == -1 || + configRestriccionPago.getEmpresa() == null || + configRestriccionPago.getEmpresa().getEmpresaId() == -1 || + configRestriccionPago.getEmpresa().equals(configRestriccionPagoExistente.getEmpresa()); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java new file mode 100644 index 000000000..7ffb7d733 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java @@ -0,0 +1,147 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ConstanteDAO; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("constanteService") +public class ConstanteServiceImpl implements ConstanteService { + @Autowired + private ConstanteDAO constanteDAO; + + public static final String URL_PAINEL_BPE = "URL_PAINEL_BPE"; + public static final String URL_API = "URL_API"; + + public List obtenerTodos() { + return constanteDAO.obtenerTodos(); + } + + public Constante obtenerID(Integer id) { + return constanteDAO.obtenerID(id); + } + + @Transactional + public Constante suscribir(Constante entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return constanteDAO.suscribir(entidad); + } + + @Transactional + public Constante actualizacion(Constante entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return constanteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Constante entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + constanteDAO.actualizacion(entidad); + } + + @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) + public Constante buscarPorNomeConstante(String nomeConstante) { + return constanteDAO.buscarPorNomeConstante(nomeConstante); + } + + @Override + public Integer buscarValorConstantePorNomeConstante(String nomeConstante){ + Constante constante = buscarPorNomeConstante(nomeConstante); + try { + if(constante!=null && StringUtils.isNotEmpty(constante.getValorconstante()) ) { + return Integer.valueOf(constante.getValorconstante().trim()); + } + }catch (Exception e) { + return null; + } + return null; + } + + public List buscar(String nombconstante) { + return constanteDAO.buscar(nombconstante); + } + + @Override + public String buscarNombreAmbiente(){ + Constante constante = constanteDAO.buscarPorNomeConstante("NOMBRE_AMBIENTE"); + if (constante == null){ + return ""; + } + + return constante.getValorconstante(); + } + + + + @Override + public String buscarNomeConstanteURLPainelBPe(){ + return URL_PAINEL_BPE; + } + @Override + public String buscarURLPainelBPe(){ + Constante constante = constanteDAO.buscarPorNomeConstante(URL_PAINEL_BPE); + if (constante == null){ + return ""; + } + + return constante.getValorconstante(); + } + + @Override + public boolean pafActivo(){ + List list = constanteDAO.buscar("HOMOLOGACAO_PAF"); + if (list.isEmpty()){ + return false; + } + + Constante constante = list.get(0); + + if (StringUtils.isBlank(constante.getValorconstante())){ + return false; + } + + return constante.getValorconstante().equalsIgnoreCase("true"); + } + + @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) + public List buscarPorNomeConstanteLike(String nombconstante) { + return constanteDAO.buscarPorNomeConstanteLike(nombconstante); + } + + @Override + public String buscarURLAPI(){ + Constante constante = constanteDAO.buscarPorNomeConstante(URL_API); + + if (constante == null) { + return ""; + } + + return constante.getValorconstante(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ContaMDServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ContaMDServiceImpl.java new file mode 100644 index 000000000..3e0cb727e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ContaMDServiceImpl.java @@ -0,0 +1,61 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ContaMDDAO; +import com.rjconsultores.ventaboletos.entidad.ContaMD; +import com.rjconsultores.ventaboletos.service.ContaMDService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("contaMDService") +public class ContaMDServiceImpl implements ContaMDService { + + @Autowired + private ContaMDDAO contaMDDAO; + + public List obtenerTodos() { + return contaMDDAO.obtenerTodos(); + } + + public ContaMD obtenerID(Integer id) { + return contaMDDAO.obtenerID(id); + } + + @Transactional + public ContaMD suscribir(ContaMD entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return contaMDDAO.suscribir(entidad); + } + + @Transactional + public ContaMD actualizacion(ContaMD entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return contaMDDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ContaMD entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + contaMDDAO.actualizacion(entidad); + } + + @Override + public Boolean existeConta(ContaMD conta) { + return contaMDDAO.existeConta(conta); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ContingenciaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ContingenciaServiceImpl.java new file mode 100644 index 000000000..9f032d20a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ContingenciaServiceImpl.java @@ -0,0 +1,199 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + +import javax.mail.AuthenticationFailedException; +import javax.mail.SendFailedException; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.dao.LogHistoricoContingenciaDAO; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmail; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailConfig; +import com.rjconsultores.ventaboletos.entidad.LogHistoricoContingencia; +import com.rjconsultores.ventaboletos.enums.EAmbienteContingencia; +import com.rjconsultores.ventaboletos.enums.EStatusContingencia; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.rest.ContingenciaClienteRest; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.service.ContingenciaService; +import com.rjconsultores.ventaboletos.service.EmpresaEmailConfigService; +import com.rjconsultores.ventaboletos.service.EmpresaEmailService; +import com.rjconsultores.ventaboletos.utilerias.SendMail; +import com.rjconsultores.ventaboletos.utilerias.StringHelper; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.utilerias.SendMail.AuthType; + +/** + * @author vjcor + * + */ +@Service("contingenciaService") +public class ContingenciaServiceImpl implements ContingenciaService { + + private static final String EMAIL_COPIA_OCULTA = "suportesco@rjconsultores.com.br"; + + private static Logger log = Logger.getLogger(ContingenciaServiceImpl.class); + + @Autowired + private LogHistoricoContingenciaDAO histContingenciaDAO; + + @Autowired + private EmpresaEmailService empresaEmailService; + + @Autowired + private EmpresaEmailConfigService empresaEmailConfigService; + + @Autowired + private ConstanteService constanteService; + + public List buscarHistorico(Integer empresaID, Integer estadoID) { + return histContingenciaDAO.buscarHistorico(empresaID, estadoID); + } + + @Transactional + public LogHistoricoContingencia salvarHistoricoContingencia(LogHistoricoContingencia historicoCont) throws BusinessException, SendFailedException, AuthenticationFailedException{ + historicoCont.setUsuario(UsuarioLogado.getUsuarioLogado()); + historicoCont.setDataHora(Calendar.getInstance().getTime()); + + if (historicoCont.getEmpresa() == null) { + throw new BusinessException("Não é possível salvar sem a empresa"); + } + + if (historicoCont.getEstado() == null) { + throw new BusinessException("Não é possível salvar sem o estado referente"); + } + + if (historicoCont.getMotivo() == null) { + throw new BusinessException("Não é possível salvar sem o motivo referente"); + } + + try { + Integer retorno = definirStatusContingencia(historicoCont); + + if (retorno == null) { + throw new BusinessException(" entre em contato com o administrador do sistema."); + } + + if (EStatusContingencia.CONTINGENCIA.equals(getStatusContingencia(historicoCont))) { + enviaEmail(historicoCont); + } + } catch (SendFailedException e2 ) { + setMotivoNaoTrocaStatus(historicoCont, e2); + histContingenciaDAO.suscribir(historicoCont); + throw e2; + }catch (AuthenticationFailedException e2) { + setMotivoNaoTrocaStatus(historicoCont, e2); + histContingenciaDAO.suscribir(historicoCont); + throw e2; + } + + return histContingenciaDAO.suscribir(historicoCont); + } + + private void setMotivoNaoTrocaStatus(LogHistoricoContingencia historicoCont, Exception e) { + log.error(String.format("Erro no envio de e-mail de contingência da empresa %s para o estado %s.", historicoCont.getEmpresa().getEmpresaId(),historicoCont.getEstado()), e); + + String motivo = historicoCont.getMotivo(); + motivo = motivo.concat("**Problema no envio de E-mail de notificação. Favor checar."); + + historicoCont.setMotivo(motivo); + } + + private Integer definirStatusContingencia(LogHistoricoContingencia historicoCont) { + + Integer statusEnviado = Integer.valueOf(historicoCont.getStatus()); + + List constantesContig = constanteService.buscarPorNomeConstanteLike(Constantes.BPE_URL_CONTIG); + if (CollectionUtils.isEmpty(constantesContig)) { + Constante constanteBPeURL = constanteService.buscarPorNomeConstante(Constantes.BPE_URL); + constantesContig.add(constanteBPeURL); + } + + HashMap retornos = new HashMap(); + + for (Constante constante : constantesContig) { + + try { + String url = constante.getValorconstante(); + Integer retorno = ContingenciaClienteRest.getInstance().consultar(url, historicoCont.getEstado().getCveestado(), historicoCont.getAmbiente().toString(), StringHelper.retornaSomenteNumeros(historicoCont.getEmpresa().getCnpj())); + retornos.put(constante, retorno); + } catch (Exception e) { + log.error("", e); + } + } + + for (Entry entry : retornos.entrySet()) { + if (entry.getValue() == null || (entry.getValue() != null && entry.getValue().equals(statusEnviado))) { + log.info("O Servidor:" + entry.getKey().getValorconstante() + "enviou: " + statusEnviado + " recebeu " + entry.getValue()); + return null; + } + } + + for (Constante constante : constantesContig) { + + try { + String bpeURL = constante.getValorconstante(); + + Integer retorno = ContingenciaClienteRest.getInstance().definir(bpeURL, historicoCont.getEstado().getCveestado(), + historicoCont.getAmbiente().toString(), StringHelper.retornaSomenteNumeros(historicoCont.getEmpresa().getCnpj()), + Integer.valueOf(historicoCont.getStatus())); + + log.info("Servidor:" + bpeURL + " status:" + retorno); + + } catch (Exception e) { + log.error("", e); + } + } + + return statusEnviado; + + } + + private EStatusContingencia getStatusContingencia(LogHistoricoContingencia historicoCont) { + return EStatusContingencia.getStatusContingencia(Integer.valueOf(historicoCont.getStatus())); + } + + private void enviaEmail(LogHistoricoContingencia historicoCont) throws SendFailedException, AuthenticationFailedException { + SendMail mail = new SendMail(); + EmpresaEmail empresaEmail = empresaEmailService.buscarPorEmpresa(historicoCont.getEmpresa()); + EmpresaEmailConfig empresaEmailConfig = empresaEmailConfigService.buscarPorEmpresa(historicoCont.getEmpresa()); + mail.setAuth(empresaEmailConfig.getIndAutenticacao()); + if (StringUtils.isNotEmpty(empresaEmailConfig.getTipoAutorizacao())) { + mail.setAuthType(AuthType.valueOf(empresaEmailConfig.getTipoAutorizacao())); + } + mail.setEmailFrom(empresaEmail.getEmailDe()); + mail.setSmtpHost(empresaEmailConfig.getSmtp()); + mail.setSmtpPassword(empresaEmailConfig.getSenha()); + mail.setSmtpPort(empresaEmailConfig.getSmtpPorta()); + mail.setSmtpUser(empresaEmailConfig.getSmtpEmail()); + mail.setSubject("Contingência Off-line BP-e"); + mail.setText(getMensagem(historicoCont)); + mail.setEmailTo(empresaEmail.getDestinatario()); + mail.setEmailToCO(EMAIL_COPIA_OCULTA); + mail.send(); + } + + private String getMensagem(LogHistoricoContingencia historicoContingencia) { + StringBuilder mensagem = new StringBuilder(); + mensagem.append(String.format("A empresa %s está com a emissão do BP-e em contingência off-line para a UF %s no ambiente de %s. ", + historicoContingencia.getEmpresa().getNombempresa(), historicoContingencia.getEstado().getCveestado(), + EAmbienteContingencia.getAmbienteContingencia(historicoContingencia.getAmbiente()).getDescricao())); + mensagem.append("A emissão em contingência deve ser tratada como exceção, sendo que a regra deve ser a emissão com autorização em tempo real."); + mensagem.append("O Fisco poderá solicitar esclarecimentos, e até mesmo restringir ao contribuinte a utilização da modalidade de contingência off-line, caso seja identificado que o emissor do BP-e utiliza a contingência em demasia e sem justificativa aceitável, quando comparado a outros contribuintes em situação similar."); + mensagem.append("Na utilização de contingência off-line, o contribuinte assume o risco de perda da informação dos "); + mensagem.append("BP-e emitidos em contingência, até que os mesmos constem da base de dados do Fisco."); + return mensagem.toString(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ControleSerieEmbarcadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ControleSerieEmbarcadaServiceImpl.java new file mode 100644 index 000000000..45ff6b92f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ControleSerieEmbarcadaServiceImpl.java @@ -0,0 +1,76 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CtrlSerieBPeDAO; +import com.rjconsultores.ventaboletos.dao.CtrlSerieEmbarcadaDAO; +import com.rjconsultores.ventaboletos.entidad.CtrlSerieBPe; +import com.rjconsultores.ventaboletos.entidad.CtrlSerieEmbarcada; +import com.rjconsultores.ventaboletos.exception.SerieEmbarcadaNaoDisponivelException; +import com.rjconsultores.ventaboletos.service.ControleSerieEmbarcadaService; +import com.rjconsultores.ventaboletos.vo.embarcada.SerieEmbarcada; + +@Service("controleSerieEmbarcadaService") +public class ControleSerieEmbarcadaServiceImpl implements ControleSerieEmbarcadaService { + + private static final Logger log = LoggerFactory.getLogger(ControleSerieEmbarcadaServiceImpl.class); + + @Autowired + private CtrlSerieEmbarcadaDAO ctrlSerieEmbarcadaDAO; + + @Autowired + private CtrlSerieBPeDAO ctrlSerieBPeDAO; + + @Override + @Transactional + public SerieEmbarcada buscarSerieEmbarcada(CtrlSerieEmbarcada controleSerieEmbarcada) { + SerieEmbarcada serieembarcada = null; + + log.info(String.format("BuscarSerieEmbarcada :: Empresa:%s Estado:%s" , controleSerieEmbarcada.getEmpresa().getEmpresaId(),controleSerieEmbarcada.getEstado())); + + // Verificando se há Serie Embarcada disponível para reaproveitamento + int tentativas = 0; + + do { + tentativas++; + + try { + serieembarcada = ctrlSerieEmbarcadaDAO.buscarSerieEmbarcadaDisponivel(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getEstadoId()); + } catch (SerieEmbarcadaNaoDisponivelException e) { + break; + } + + if (tentativas >= 5) { + break; + } + + } while (serieembarcada == null); + + // Caso não haja reaproveitamento de série, devo buscar a próxima série disponível na sequência padrão + if (serieembarcada == null) { + log.info("BuscarSerieEmbarcada :: Reaproveitamento nao disponivel"); + + CtrlSerieBPe ctrlSerieBpe = ctrlSerieBPeDAO.buscarPorEmpresaEstado(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getEstadoId()); + + Integer serie = (ctrlSerieBpe == null ? 1 : Integer.valueOf(ctrlSerieBpe.getSerie()) + 1); + + log.info(String.format("BuscarSerieEmbarcada :: Serie em uso [%d]", serie)); + + ctrlSerieBPeDAO.gerarSeqSerieBPe(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getCveestado(), serie); + + serie = ctrlSerieBPeDAO.buscarSequencia(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getCveestado()); + + log.info(String.format("BuscarSerieEmbarcada :: Serie selecionada [%d]", serie)); + + serieembarcada = new SerieEmbarcada(); + serieembarcada.setSerie(serie.toString()); + serieembarcada.setNumero("0"); + } + + return serieembarcada; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConvenioDetServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConvenioDetServiceImpl.java new file mode 100644 index 000000000..14ad2d573 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConvenioDetServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ConvenioDetDAO; +import com.rjconsultores.ventaboletos.entidad.ConvenioDet; +import com.rjconsultores.ventaboletos.service.ConvenioDetService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("convenioDetService") +public class ConvenioDetServiceImpl implements ConvenioDetService { + + @Autowired + private ConvenioDetDAO convenioDetDAO; + + public List obtenerTodos() { + return convenioDetDAO.obtenerTodos(); + } + + public ConvenioDet obtenerID(Integer id) { + return convenioDetDAO.obtenerID(id); + } + + @Transactional + public ConvenioDet suscribir(ConvenioDet entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return convenioDetDAO.suscribir(entidad); + } + + @Transactional + public ConvenioDet actualizacion(ConvenioDet entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return convenioDetDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ConvenioDet entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + convenioDetDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConvenioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConvenioServiceImpl.java new file mode 100644 index 000000000..c612dd1b8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConvenioServiceImpl.java @@ -0,0 +1,95 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.Convenio; +import com.rjconsultores.ventaboletos.entidad.ConvenioDet; +import com.rjconsultores.ventaboletos.entidad.ConvenioPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.ConvenioTramo; +import com.rjconsultores.ventaboletos.entidad.ConvenioUsuario; +import com.rjconsultores.ventaboletos.service.ConvenioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("convenioService") +public class ConvenioServiceImpl implements ConvenioService { + + @Autowired + private ConvenioDAO convenioDAO; + + public List obtenerTodos() { + return convenioDAO.obtenerTodos(); + } + + public Convenio obtenerID(Integer id) { + return convenioDAO.obtenerID(id); + } + + @Transactional + public Convenio suscribir(Convenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return convenioDAO.suscribir(entidad); + } + + @Transactional + public Convenio actualizacion(Convenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return convenioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Convenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + for (ConvenioDet cd : entidad.getConvenioDetList()) { + cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cd.setFecmodif(Calendar.getInstance().getTime()); + cd.setActivo(Boolean.FALSE); + } + + for (ConvenioPuntoVenta cpv: entidad.getConvenioPuntoVentaList()) { + cpv.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cpv.setFecmodif(Calendar.getInstance().getTime()); + cpv.setActivo(Boolean.FALSE); + } + + for (ConvenioUsuario cu : entidad.getConvenioUsuarioList()) { + cu.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cu.setFecmodif(Calendar.getInstance().getTime()); + cu.setActivo(Boolean.FALSE); + } + + for (ConvenioTramo ct : entidad.getConvenioTramoList()) { + ct.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + ct.setFecmodif(Calendar.getInstance().getTime()); + ct.setActivo(Boolean.FALSE); + } + + convenioDAO.actualizacion(entidad); + } + + public List buscar(String descconvenio, String cveconvenio) { + return convenioDAO.buscar(descconvenio, cveconvenio); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CorridaCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CorridaCtrlServiceImpl.java new file mode 100644 index 000000000..65ef4a1de --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CorridaCtrlServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CorridaCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.service.CorridaCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("corridaCtrlService") +public class CorridaCtrlServiceImpl implements CorridaCtrlService { + + @Autowired + private CorridaCtrlDAO corridaCtrlDAO; + + public CorridaCtrl obtenerID(Integer id) { + return corridaCtrlDAO.obtenerID(id); + } + + @Transactional + public CorridaCtrl suscribir(CorridaCtrl entidad) { + Integer usuarioId = null; + if (UsuarioLogado.getUsuarioLogado() != null) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + entidad.setUsuarioId(usuarioId); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return corridaCtrlDAO.suscribir(entidad); + } + + @Transactional + public CorridaCtrl actualizacion(CorridaCtrl entidad) { + Integer usuarioId = 1; + if (UsuarioLogado.getUsuarioLogado() != null) { + usuarioId = UsuarioLogado.getUsuarioLogado().getUsuarioId(); + } + entidad.setUsuarioId(usuarioId); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return corridaCtrlDAO.actualizacion(entidad); + } + + public CorridaCtrl buscar(Ruta ruta, ClaseServicio claseServicio, Marca marca, Date horario, boolean pisoExtra) { + return corridaCtrlDAO.buscar(ruta, claseServicio, marca, horario, pisoExtra); + } + + @Override + public CorridaCtrl buscar(Integer corridaId, Parada origem, Parada destino, ClaseServicio claseServicio, Marca marca) { + return corridaCtrlDAO.buscar(corridaId, origem, destino, claseServicio, marca); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java new file mode 100644 index 000000000..8b155b2da --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java @@ -0,0 +1,1493 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.List; + +import javax.persistence.Transient; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.math.NumberUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Service; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.TransactionStatus; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.support.DefaultTransactionDefinition; + +import com.rjconsultores.ventaboletos.dao.CorridaDAO; +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.dao.TramoTiempoDAO; +import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.Corrida.Id; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaAsiento; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaTramo; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ReservaEspecialCliente; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.TramoTiempo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.enums.StatusFlexBus; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.AsientoExclusivoService; +import com.rjconsultores.ventaboletos.service.BoletoService; +import com.rjconsultores.ventaboletos.service.ClienteService; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.service.CorridaCtrlService; +import com.rjconsultores.ventaboletos.service.CorridaService; +import com.rjconsultores.ventaboletos.service.DetDiagramaAutobusService; +import com.rjconsultores.ventaboletos.service.EsquemaAsientoService; +import com.rjconsultores.ventaboletos.service.EsquemaCorridaService; +import com.rjconsultores.ventaboletos.service.EsquemaTramoService; +import com.rjconsultores.ventaboletos.service.ReservaEspecialClienteService; +import com.rjconsultores.ventaboletos.service.RutaSecuenciaService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.service.TarifaService; +import com.rjconsultores.ventaboletos.service.TramoService; +import com.rjconsultores.ventaboletos.service.TramoServicioService; +import com.rjconsultores.ventaboletos.service.VigenciaTarifaService; +import com.rjconsultores.ventaboletos.utilerias.ActivoUtil; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.FeriadoCache; +import com.rjconsultores.ventaboletos.utilerias.HoraSistema; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; + +/** + * + * @author rodrigo + */ +@Service("corridaService") +public class CorridaServiceImpl implements CorridaService { + + private static Logger log = Logger.getLogger(CorridaServiceImpl.class); + private static int CANT_MAX_CORRIDA_GERA_MANUAL = 40; + private static SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + // Tipo de venda Reserva + private static final Integer TPV_RESERVA_NORMAL = 15; + + @Autowired + private CorridaDAO corridaDAO; + @Autowired + private EsquemaAsientoService esquemaAsientoService; + @Autowired + private CorridaCtrlService corridaCtrlService; + @Autowired + private RutaService rutaService; + @Autowired + private TramoServicioService tramoServicioService; + @Autowired + private TramoTiempoDAO tramoTiempoDAO; + @Autowired + private AsientoExclusivoService asientoExclusivoService; + @Autowired + private EsquemaTramoService esquemaTramoService; + @Autowired + private EsquemaCorridaService esquemaCorridaService; + @Autowired + private EsquemaCorridaDAO esquemaCorridaDAO; + @Autowired + private DetDiagramaAutobusService detDiagramaAutobusService; + @Autowired + private ConstanteService constanteService; + @Autowired + private RutaSecuenciaService rutaSecuenciaService; + private PlatformTransactionManager transactionManager; + @Transient + private int cantCorridaGenerada; + @Transient + private int cantCorridaCommit; + @Autowired + private FeriadoCache feriadoCache; + @Autowired + private BoletoService boletoService; + @Autowired + private ReservaEspecialClienteService reservaEspecialClientService; + @Autowired + private TarifaService tarifaService; + @Autowired + TramoService tramoService; + @Autowired + VigenciaTarifaService vigenciaTarifaService; + @Autowired + ClienteService clienteService; + + + @Autowired + public CorridaServiceImpl(@Qualifier("transactionManager") PlatformTransactionManager transactionManager) { + this.transactionManager = transactionManager; + } + + @Override + public List obtenerTodos() { + return corridaDAO.obtenerTodos(); + } + + @Override + public Corrida obtenerID(Corrida.Id id) { + return corridaDAO.obtenerID(id); + } + + @Override + public List buscarPorFecCorrida(Date value) { + return corridaDAO.buscarPorFecCorrida(value); + } + + @Override + public List buscarPorId(Integer idCorrida) { + return corridaDAO.buscarPorId(idCorrida); + } + + @Override + public List verificarCorridaId(Integer corridaId) { + return corridaDAO.verificarCorridaId(corridaId); + } + + @Override + public List buscarDistinct(Parada ori, Parada des, Date horaSalidaInicio, Date horaSalidaFin, ClaseServicio cs, Integer corridaId) { + return corridaDAO.buscarDistinct(ori, des, (horaSalidaInicio == null) ? null : DateUtil.getFecInicio(horaSalidaInicio).getTime(), (horaSalidaFin == null) ? null : DateUtil.getFecInicio(horaSalidaFin).getTime(), cs, corridaId); + } + + @Transactional + public Corrida suscribir(Corrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(ActivoUtil.ATIVO); + + return corridaDAO.suscribir(entidad); + } + + @Transactional + public Corrida actualizacion(Corrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(ActivoUtil.ATIVO); + + return corridaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Corrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(ActivoUtil.ATIVO); + + corridaDAO.actualizacion(entidad); + } + + @Override + public List buscarPorAutobusCorridasFuturas(DiagramaAutobus diagramaAutobus) { + return corridaDAO.buscarPorAutobusCorridasFuturas(diagramaAutobus); + } + + @Override + public List buscarPorRolOperativoCorridasFuturas(DiagramaAutobus diagramaAutobus) { + return corridaDAO.buscarPorRolOperativoCorridasFuturas(diagramaAutobus); + } + + @Override + public List buscarFiltro(Parada ori, Parada des, Date hora, ClaseServicio cs) { + return corridaDAO.buscarFiltro(ori, des, hora, cs); + } + + public Boolean existeCorrida(Long id){ + return corridaDAO.existeCorrida(id); + } + + private Boolean geraDiaSemana(Integer diaSemana, EsquemaCorrida esquemaCorrida) { + Boolean retorno = Boolean.FALSE; + switch (diaSemana) { + case 1: { + // diaSemana = "Domingo"; + if (esquemaCorrida.getInddomingo() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getInddomingo()) { + retorno = Boolean.TRUE; + } + break; + } + case 2: { + // diaSemana = "Segunda"; + if (esquemaCorrida.getIndlunes() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getIndlunes()) { + retorno = Boolean.TRUE; + } + break; + } + case 3: { + // diaSemana = "Terca"; + if (esquemaCorrida.getIndmartes() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getIndmartes()) { + retorno = Boolean.TRUE; + } + break; + } + case 4: { + // diaSemana = "Quarta"; + if (esquemaCorrida.getIndmiercoles() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getIndmiercoles()) { + retorno = Boolean.TRUE; + } + break; + } + case 5: { + // diaSemana = "Quinta"; + if (esquemaCorrida.getIndjueves() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getIndjueves()) { + + retorno = Boolean.TRUE; + } + break; + } + case 6: { + // diaSemana = "Sexta"; + if (esquemaCorrida.getIndviernes() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getIndviernes()) { + retorno = Boolean.TRUE; + } + break; + } + case 7: { + // diaSemana = "Sabado"; + if (esquemaCorrida.getIndsabado() == null) { + retorno = Boolean.FALSE; + } else if (esquemaCorrida.getIndsabado()) { + retorno = Boolean.TRUE; + } + break; + } + } + + return retorno; + } + + private boolean temCorridaDiaSemana(Integer diaSemana, EsquemaCorrida esquemaCorrida, Boolean isFeriado) { + Boolean retorno = Boolean.FALSE; + + if (esquemaCorrida.getIndGeneraFeriado() != null) { + if (esquemaCorrida.getIndGeneraFeriado().equals("S")) { + retorno = geraDiaSemana(diaSemana, esquemaCorrida); + } else if (isFeriado) { + if (esquemaCorrida.getIndGeneraFeriado().equals("F")) { + retorno = geraDiaSemana(diaSemana, esquemaCorrida); + } + } else if (esquemaCorrida.getIndGeneraFeriado().equals("N")) { + retorno = geraDiaSemana(diaSemana, esquemaCorrida); + } + } else { + retorno = geraDiaSemana(diaSemana, esquemaCorrida); + } + + return retorno; + } + + private Date calcularFechorllegada(EsquemaTramo esquemaTramo, ClaseServicio clase, Date dataGeracao, Date horaChegada) { + GregorianCalendar gHoraChegada = new GregorianCalendar(); + gHoraChegada.setTime(horaChegada); + HoraSistema hs = null; + + if (esquemaTramo.getExcepcionRecorrido() != null) { + hs = new HoraSistema(esquemaTramo.getExcepcionRecorrido()); + + gHoraChegada.add(Calendar.HOUR_OF_DAY, hs.getHora()); + gHoraChegada.add(Calendar.MINUTE, hs.getMinuto()); + } else { + Tramo tramo = esquemaTramo.getTramo(); + List lsTramoServicio = tramoServicioService.buscarPorTramoServico(tramo, clase); + + for (TramoServicio ts : lsTramoServicio) { + hs = new HoraSistema(ts.getTiemporecorrido()); + + gHoraChegada.add(Calendar.HOUR_OF_DAY, hs.getHora()); + gHoraChegada.add(Calendar.MINUTE, hs.getMinuto()); + } + } + + return gHoraChegada.getTime(); + } + + @SuppressWarnings("deprecation") + private Date calcularFechorsalida(EsquemaTramo esquemaTramo, Date dataGeracao, Date horaChegadaAnterior, java.util.Date tiempoEstanciaAnterior) { + Date horaSaida; + + if (horaChegadaAnterior == null) { + horaSaida = truncarDataHora(dataGeracao, esquemaTramo.getEsquemaCorrida().getHorasalida()); + } else { + GregorianCalendar gHoraSaidaProximo = new GregorianCalendar(); + gHoraSaidaProximo.setTime(horaChegadaAnterior); + + log.debug("Tempo Recorrido : " + sdf.format(gHoraSaidaProximo.getTime())); + + if (tiempoEstanciaAnterior != null) { + gHoraSaidaProximo.add(Calendar.MINUTE, tiempoEstanciaAnterior.getMinutes()); + gHoraSaidaProximo.add(Calendar.HOUR_OF_DAY, tiempoEstanciaAnterior.getHours()); + + log.debug("Tempo Recorrido + Estancia: " + sdf.format(gHoraSaidaProximo.getTime())); + } + + horaSaida = gHoraSaidaProximo.getTime(); + } + + GregorianCalendar gHoraSaida = new GregorianCalendar(); + gHoraSaida.setTime(horaSaida); + + return gHoraSaida.getTime(); + } + + /** + * Adiciciona as horas do parametro hora na data dataGeracao. + * + * Alem disso eh zerado os campos segundos e milisegundos. + * + * @param dataGeracao + * @param hora + * @return + */ + private Date truncarDataHora(Date dataGeracao, Date hora) { + Date dataCorreta = new Date(); + + GregorianCalendar gAux = new GregorianCalendar(); + gAux.setTime(hora); + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(dataGeracao); + gcalendar.set(Calendar.HOUR_OF_DAY, gAux.get(Calendar.HOUR_OF_DAY)); + gcalendar.set(Calendar.MINUTE, gAux.get(Calendar.MINUTE)); + gcalendar.set(Calendar.SECOND, 0); + gcalendar.set(Calendar.MILLISECOND, 0); + + dataCorreta = gcalendar.getTime(); + + return dataCorreta; + } + + private boolean isFeriado(java.sql.Date data, EsquemaCorrida esquemaCorrida) { + Empresa empresa = esquemaCorrida.getEmpresa(); + + Estado estadoOrigem = null; + List lsRutaSequencia = rutaSecuenciaService.buscarSecuenciaOrdenado(esquemaCorrida.getRuta()); + if (!lsRutaSequencia.isEmpty()) { + Tramo tramoOrigem = lsRutaSequencia.get(0).getTramo(); + Parada origem = tramoOrigem.getOrigem(); + estadoOrigem = origem.getCiudad().getEstado(); + } + + return feriadoCache.ehFeriado(data, empresa, estadoOrigem); + } + + /** + * Indica si el esquemaCorrida informado tiene una vigencia válida para la data de generacion + * + * @param esquemaCorrida + * @param dataGeracao + * @return + */ + private boolean vigenciaValida(EsquemaCorrida esquemaCorrida, Date dataGeracao) { + if ((DateUtil.compareOnlyDate(dataGeracao, esquemaCorrida.getEsquemaOperacional().getFecfinvigencia()) <= 0) && + (DateUtil.compareOnlyDate(dataGeracao, esquemaCorrida.getEsquemaOperacional().getFecniciovigencia()) >= 0)) { + + return true; + } + return false; + } + + /** + * Genera una corrida para el esquemaCorrida informado en la fecha informada.
+ * + * Cuando la corrida no es generada :
+ * - corrida ya existe : eso es checado por el numCorrida e dataGeneracion
+ * - la fecha de generacion no tiene una vigencia válida
+ * - el status del esquema corrida no es autorizado ("A")
+ * + * + * @param esquemaCorrida + * @param diaSemana + * @param dataGeracao + * @return - La corrida generada o null si no fue generada. + */ + @SuppressWarnings("deprecation") + private Corrida generarCorrida(EsquemaCorrida esquemaCorrida, Date dataGeracao, boolean isPisoExtra, Boolean isFeriado) { + + GregorianCalendar calendario = new GregorianCalendar(); + calendario.setTime(dataGeracao); + + Integer diaSemana = calendario.get(Calendar.DAY_OF_WEEK); + Corrida corrida = null; + + if (!vigenciaValida(esquemaCorrida, dataGeracao)) { + log.info("vigencia invalida=" + dataGeracao); + + return null; + } + + if (!((esquemaCorrida.getStatusCorrida() != null) && (esquemaCorrida.getStatusCorrida().equals("A") || esquemaCorrida.getStatusCorrida().equals("L")))) { + log.info("status corrida invalido=" + esquemaCorrida.getStatusCorrida()); + + return null; + } + + if (esquemaCorrida.getIndDiaSimDiaNao() == null || esquemaCorrida.getIndDiaSimDiaNao() == Boolean.FALSE) { + if (!temCorridaDiaSemana(diaSemana, esquemaCorrida, isFeriado)) { + log.info("dia semana no valido=" + diaSemana); + return null; + } + } + + if (!tramoServicioService.existenTiemposTramosEsquema(esquemaCorrida.getEsquemacorridaId())) { + log.info("nao foi cadastrado o tempo de todos os trechos do esquema corrida=" + esquemaCorrida.getEsquemacorridaId()); + return null; + } + + try { + + Ruta ruta = esquemaCorrida.getRuta(); + ClaseServicio claseServicio = esquemaCorrida.getClaseServicio(); + Marca marca = esquemaCorrida.getMarca(); + Date horario = esquemaCorrida.getHorasalida(); + horario = DateUtil.normalizar(horario); + Integer numCorrida = esquemaCorrida.getNumCorrida(); + + Corrida.Id id = new Corrida.Id(); + + id.setCorridaId(numCorrida); + id.setFeccorrida(DateUtil.normalizarToFecha(dataGeracao)); + + if (esquemaCorrida.getIndDiaSimDiaNao() != null && esquemaCorrida.getIndDiaSimDiaNao()) { + Calendar calendarData = Calendar.getInstance(); + calendarData.setTime(dataGeracao); + calendarData.add(Calendar.DATE, -1); + + Corrida.Id corridaOntem = new Corrida.Id(); + + corridaOntem.setCorridaId(numCorrida); + corridaOntem.setFeccorrida(DateUtil.normalizarToFecha(calendarData.getTime())); + + if (corridaDAO.existe(corridaOntem)) { + log.info("Esquema configurado para gerar dia sim dia não e já possui corrida gerado no dia anterior, por isso não está data: " + DateUtil.getStringDate(dataGeracao)); + return null; + } + } + + if (corridaDAO.existe(id)) { + log.info("corrida existe = " + numCorrida + ";" + ruta.getDescruta() + ";" + DateUtil.getStringDate(dataGeracao) + ";" + DateUtil.getStringDate(horario, "HH:mm") + ";" + claseServicio.getDescclase() + ";" + marca.getDescmarca() + " Piso: " + isPisoExtra); + return null; + } + + // Como o numCorrida corresponde ao corrida_id do corridaCtrl, ou seja, à chave primaria, temos que buscar somente por esse campo + // Caso o registro já exista, atualizamos os dados dele. + // Sendo assim, o que vai indicar a "duplicidade" de uma corrida será apenas o número dela e não mais o conjunto : clase + marca + horario + ruta + + CorridaCtrl corridaCtrl = corridaCtrlService.obtenerID(numCorrida); + + boolean novoRegistro = false; + + if (corridaCtrl == null) { + corridaCtrl = new CorridaCtrl(); + novoRegistro = true; + } + + corridaCtrl.setCorridaId(numCorrida); + corridaCtrl.setMarca(marca); + corridaCtrl.setRuta(ruta); + corridaCtrl.setClaseServicio(claseServicio); + corridaCtrl.setHorario(horario); + + // parada origem + Parada origen = rutaService.getOrigem(ruta); + if (origen == null) { + log.info("origen nao encontrado para a ruta = " + ruta.getRutaId()); + } + corridaCtrl.setNodo((origen == null) ? null : origen.getNodo()); + + corridaCtrl.setActivo(Boolean.TRUE); + corridaCtrl.setFecmodif(Calendar.getInstance().getTime()); + + if (UsuarioLogado.getUsuarioLogado() != null) { + corridaCtrl.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + corridaCtrl.setPisoExtra(isPisoExtra); + if (novoRegistro) { + corridaCtrl = corridaCtrlService.suscribir(corridaCtrl); + } else { + corridaCtrl = corridaCtrlService.actualizacion(corridaCtrl); + } + + corrida = new Corrida(); + corrida.setId(id); + corrida.setEsquemaCorrida(esquemaCorrida); + corrida.setCorridaCtrl(corridaCtrl); + corrida.setAutobus(esquemaCorrida.getAutoBus()!= null ? esquemaCorrida.getAutoBus() : null); + corrida.setClaseServicio(corridaCtrl.getClaseServicio()); + corrida.setConductor(null); + if (esquemaCorrida.getIndCorridaExtra()) { + corrida.setTipoServicio(new Short("2")); + } else { + corrida.setTipoServicio(new Short("1")); + } + corrida.setInfoCorrida(esquemaCorrida.getInfoCorrida()); + Integer cantparados = esquemaCorrida.getCantparados(); + if (cantparados != null) { + corrida.setCantParados(cantparados.shortValue()); + } + + corrida.setEsquemaAgrupacionId(esquemaCorrida.getEsquemaAgrupacionId()); + + corrida.setEmpresa(esquemaCorrida.getEmpresa()); + corrida.setEmpresa1(esquemaCorrida.getEmpresa1()); + + corrida.setFechorsalida(truncarDataHora(dataGeracao, esquemaCorrida.getHorasalida())); + corrida.setFechorSalidaOriginal(corrida.getFechorsalida()); + + if (esquemaCorrida.getStatusCorrida().equals("A")) { + corrida.setIndstatuscorrida("H"); + corrida.setActivo(ActivoUtil.ATIVO); + } else if (esquemaCorrida.getStatusCorrida().equals("L")) { + corrida.setIndstatuscorrida("P"); + corrida.setActivo(ActivoUtil.INATIVO); + } + + corrida.setMarca(esquemaCorrida.getMarca()); + corrida.setNodo(corridaCtrl.getNodo()); + corrida.setDivision(esquemaCorrida.getDivision()); + corrida.setRuta(esquemaCorrida.getRuta()); + +// corrida.setRuta(corridaCtrl.getRuta()); + corrida.setRolOperativo(esquemaCorrida.getRolOperativo()); + corrida.setZona(null); + + // corrida Tramo: + List lsCorridaTramo = new ArrayList(); + Integer numSec = 1; + List lsEsquemaTramo = esquemaTramoService.obtenerPorEsquemaCorridaOrderNumSec(esquemaCorrida); + Date horaChegadaAnterior = null; + + Date husoHorVeranoLlegadaAnterior = null; + + if (lsEsquemaTramo == null) { + return null; + } + + EsquemaTramo primeiro = lsEsquemaTramo.get(0); + Parada origem = primeiro.getTramo().getOrigem(); + if (origem == null) { + return null; + } + corrida.setOrigem(origem); + + EsquemaTramo ultimo = lsEsquemaTramo.get(lsEsquemaTramo.size() - 1); + Parada destino = ultimo.getTramo().getDestino(); + if (destino == null) { + return null; + } + corrida.setDestino(destino); + + if(esquemaCorrida.getIsFlexBus()) { + corrida.setOcupacaoMinima(esquemaCorrida.getOcupacaoMinima()); + corrida.setHorasParaConfirmacao(esquemaCorrida.getHorasParaConfirmacao()); + corrida.setMinutosParaConfirmacao(esquemaCorrida.getMinutosParaConfirmacao()); + corrida.setIsFlexBus(Boolean.TRUE); + + corrida.setStatusFlexBus(StatusFlexBus.EM_RESERVA.getStatus()); + } + + for (EsquemaTramo esquemaTramo : lsEsquemaTramo) { + + CorridaTramo corridaTramo = new CorridaTramo(); + + corridaTramo.setAutobus(esquemaCorrida.getAutoBus()!= null ? esquemaCorrida.getAutoBus() : null); + corridaTramo.setConductor(null); + corridaTramo.setConductor1(null); + corridaTramo.setPlataforma(esquemaTramo.getPlataforma()); + corridaTramo.setTipoPassagem(esquemaTramo.getTipoPassagem()); + + corridaTramo.setTiempoEstancia(esquemaTramo.getTiempoEstancia()); + + // numSec: 1-2, 2-3, 3-4... + corridaTramo.setNumsecorigen(numSec.shortValue()); + numSec = numSec + 1; + corridaTramo.setNumsecdestino(numSec.shortValue()); + + Calendar salida = Calendar.getInstance(); + Date fecHorSalida = calcularFechorsalida(esquemaTramo, dataGeracao, horaChegadaAnterior, esquemaTramo.getTiempoEstancia()); + salida.setTime(fecHorSalida); + salida.set(salida.get(Calendar.YEAR), salida.get(Calendar.MONTH), salida.get(Calendar.DATE), + salida.get(Calendar.HOUR_OF_DAY), salida.get(Calendar.MINUTE), NumberUtils.INTEGER_ZERO); + corridaTramo.setFechorsalida(salida.getTime()); + + Calendar llegada = Calendar.getInstance(); + Date fecHorallegada = calcularFechorllegada(esquemaTramo, corrida.getClaseServicio(), dataGeracao, fecHorSalida); + llegada.setTime(fecHorallegada); + llegada.set(llegada.get(Calendar.YEAR), llegada.get(Calendar.MONTH), llegada.get(Calendar.DATE), + llegada.get(Calendar.HOUR_OF_DAY), llegada.get(Calendar.MINUTE), NumberUtils.INTEGER_ZERO); + corridaTramo.setFechorllegada(llegada.getTime()); + + horaChegadaAnterior = fecHorallegada; + + corridaTramo.setFechortarjetaviaje(null); + corridaTramo.setNodo(corridaCtrl.getNodo()); + + corridaTramo.setNumsecuencia(esquemaTramo.getNumsecuencia()); + Tramo tramo = esquemaTramo.getTramo(); + if (tramo != null) { + corridaTramo.setOrigem(tramo.getOrigem()); + corridaTramo.setDestino(tramo.getDestino()); + } + corridaTramo.setTramo(tramo); + corridaTramo.setUsuariotarjetaviajeId(null); + + Date excepcionTiempo = arreglaExcepcionTiempo(corridaTramo, corrida.getClaseServicio()); + if (excepcionTiempo != null) { + corridaTramo.setFechorllegada(excepcionTiempo); + horaChegadaAnterior = excepcionTiempo; + } + + if (esquemaCorrida.getStatusCorrida().equals("A")) { + corridaTramo.setActivo(ActivoUtil.ATIVO); + } else if (esquemaCorrida.getStatusCorrida().equals("L")) { + corridaTramo.setActivo(ActivoUtil.INATIVO); + } + // + corridaTramo.setFecmodif(Calendar.getInstance().getTime()); + if (UsuarioLogado.getUsuarioLogado() != null) { + corridaTramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + corridaTramo.setCorrida(corrida); + corridaTramo.setFechorSalidaOriginal(fecHorSalida); + + if (husoHorVeranoLlegadaAnterior == null) { + corridaTramo.setFechorsalidaH(corridaTramo.getFechorsalida()); + } else { + + // Ajusta tambem o tempo de instancia do calculo do horario de verao + if (esquemaTramo.getTiempoEstancia() != null) { + GregorianCalendar tmp = new GregorianCalendar(); + tmp.setTime(husoHorVeranoLlegadaAnterior); + + tmp.add(Calendar.MINUTE, esquemaTramo.getTiempoEstancia().getMinutes()); + tmp.add(Calendar.HOUR_OF_DAY, esquemaTramo.getTiempoEstancia().getHours()); + + log.debug("Tempo Recorrido H + Estancia: " + sdf.format(tmp.getTime())); + + husoHorVeranoLlegadaAnterior = tmp.getTime(); + + } + + corridaTramo.setFechorsalidaH(husoHorVeranoLlegadaAnterior); + } + + husoHorVeranoLlegadaAnterior = calcularHusoHorVeranoLlegada(esquemaTramo, corridaTramo); + + if (husoHorVeranoLlegadaAnterior != null) { + corridaTramo.setFechorllegadaH(husoHorVeranoLlegadaAnterior); + corridaTramo.setFechorSalidaOriginalH(husoHorVeranoLlegadaAnterior); + } else { + corridaTramo.setFechorllegadaH(corridaTramo.getFechorllegada()); + corridaTramo.setFechorSalidaOriginalH(corridaTramo.getFechorSalidaOriginal()); + } + + if (numSec == 1) { + corrida.setFechorSalidaOriginalH(corridaTramo.getFechorsalidaH()); + } + + lsCorridaTramo.add(corridaTramo); + } + corrida.setCorridaTramoList(lsCorridaTramo); + // + corrida.setFecmodif(Calendar.getInstance().getTime()); + if (UsuarioLogado.getUsuarioLogado() != null) { + corrida.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } else { + corrida.setUsuarioId(1); + } + corrida.setIndTipoVenta(null); + corrida.setCodProdutoFiscal(UtiliteriasFiscal.defineCodigoProduto(corrida.getOrigem().getParadaId(), corrida.getDestino().getParadaId(), corrida.getRuta().getRutaId())); + corrida = corridaDAO.suscribir(corrida); + + cantCorridaGenerada++; + + List lsEsquemaAsiento = esquemaAsientoService.obtenerPorCorrida(esquemaCorrida); + for (EsquemaAsiento ea : lsEsquemaAsiento) { + DetDiagramaAutobus detDiagramaAutobus = detDiagramaAutobusService.obtenerPorDiagramaAutobusAsiento(esquemaCorrida.getDiagramaAutobusId(), ea.getNumasiento()); + if (detDiagramaAutobus != null && detDiagramaAutobus.getVendible()) { + AsientoExclusivo asientoExclusivo = new AsientoExclusivo(); + asientoExclusivo.setCorrida(corrida); + asientoExclusivo.setMotivobloqueo(null); + asientoExclusivo.setNodo(corrida.getNodo()); + asientoExclusivo.setNumasiento(ea.getNumasiento()); + asientoExclusivo.setVendible(ea.getIndvendible()); + asientoExclusivo.setParada(ea.getParada()); + asientoExclusivo.setTiempoLiberacion(ea.getTiempoLiberacion()); + if (ea.getIndvendible()) { + asientoExclusivo.setMotivobloqueo(null); + } else { + asientoExclusivo.setMotivobloqueo(ea.getMotivobloqueo()); + asientoExclusivo.setDestino(ea.getDestino()); + } + + asientoExclusivo.setActivo(Boolean.TRUE); + asientoExclusivo.setFecmodif(Calendar.getInstance().getTime()); + if (UsuarioLogado.getUsuarioLogado() != null) { + asientoExclusivo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + asientoExclusivo = asientoExclusivoService.suscribir(asientoExclusivo); + } + } + + } catch (org.springframework.dao.DataIntegrityViolationException ex) { + log.error("", ex); + } + + return corrida; + } + + private Date calcularHusoHorVeranoLlegada(EsquemaTramo esquemaTramo, CorridaTramo corridaTramo) { + + Ciudad ciudadOrigen = esquemaTramo.getTramo().getOrigem().getCiudad(); + Estado estadoOrigen = ciudadOrigen.getEstado(); + + int tiempoOrigen = estadoOrigen.getTiempoHorHuso() == null ? 0 : estadoOrigen.getTiempoHorHuso(); + + Date fecInicioHorVerano = estadoOrigen.getFecInicioHorVerano(); + Date fecFinHorVerano = estadoOrigen.getFecFinoHorVerano(); + + + + if ((fecInicioHorVerano != null) && (fecFinHorVerano != null)) { + if ((DateUtil.compareOnlyDate(fecInicioHorVerano, corridaTramo.getFechorsalida()) <= 0) && (DateUtil.compareOnlyDate(fecFinHorVerano, corridaTramo.getFechorsalida()) >= 0)) { + tiempoOrigen += estadoOrigen.getTiempoHorVerano(); + } + } + // 21688 + Ciudad ciudadDestino = esquemaTramo.getTramo().getDestino().getCiudad(); + Estado estadoDestino = ciudadDestino.getEstado(); + int tiempoDestino = 0; + + if (!estadoDestino.equals(estadoOrigen)) { + tiempoDestino = estadoDestino.getTiempoHorHuso() == null ? 0 : estadoDestino.getTiempoHorHuso(); + + + + Date fecInicioHorVeranoDestino = estadoDestino.getFecInicioHorVerano(); + Date fecFinHorVeranDestino = estadoDestino.getFecFinoHorVerano(); + + if ((fecInicioHorVeranoDestino != null) && (fecFinHorVeranDestino != null)) { + if ((DateUtil.compareOnlyDate(fecInicioHorVeranoDestino, corridaTramo.getFechorllegada()) <= 0) && (DateUtil.compareOnlyDate(fecFinHorVeranDestino, corridaTramo.getFechorllegada()) >= 0)) { + tiempoDestino += estadoDestino.getTiempoHorVerano(); + } + } + } else { + tiempoDestino =0; + tiempoOrigen=0; + } + + //Consideração do fuso por cidade. + //Nesse caso, é mandatório em relação ao estado.Ou seja, equanto que no fuso do estado, + //tem que haver mudança de estado, para a cidade não, pois pode-se considerar cada cidade + //como um único estado. Sendo assim, devendo ser considerado sempre quando preenchido + if ( (ciudadOrigen.getZonaHoraria() != null) && (ciudadOrigen.getZonaHoraria() != 0 )){ + log.info("Fuso da cidade origem " + ciudadOrigen.getNombciudad() + " : " + ciudadOrigen.getZonaHoraria()); + + tiempoOrigen += ciudadOrigen.getZonaHoraria(); + } + + if ( (ciudadDestino.getZonaHoraria() != null) && (ciudadDestino.getZonaHoraria() != 0 )){ + log.info("Fuso da cidade destino " + ciudadDestino.getNombciudad() + " : " + ciudadDestino.getZonaHoraria()); + + tiempoDestino += ciudadDestino.getZonaHoraria(); + } + //Fim consideração fuso por cidade + + Calendar horLlegada = null; + + long elapsedMinutes = DateUtil.getElapsedMinutos(corridaTramo.getFechorsalida(), corridaTramo.getFechorllegada()); + + horLlegada = Calendar.getInstance(); + horLlegada.setTime(corridaTramo.getFechorsalidaH()); + + horLlegada.add(Calendar.MINUTE, (int) elapsedMinutes); + + // Si los tiempos son distintos, hube cambio de huso horario/horario de verano + if (tiempoOrigen != tiempoDestino) { + horLlegada.add(Calendar.HOUR, difHuso(tiempoOrigen, tiempoDestino)); + + } + + return (horLlegada == null) ? null : horLlegada.getTime(); + } + + private int difHuso(int a, int b) { + return b - a; + } + + private void generarCorrida(Date dataGeracao, List lsEsquemaCorrida, boolean isGeracaoAutomaticaCorrida) { + + DefaultTransactionDefinition def = new DefaultTransactionDefinition(DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW); + + // TODO: Melhorar o tratamento às transações manuais em caso de erro,etc + TransactionStatus status = transactionManager.getTransaction(def); + cantCorridaGenerada = 0; + cantCorridaCommit = 1; + java.sql.Date data = new java.sql.Date(dataGeracao.getTime()); + + Integer unUsuarioId = constanteService.buscarValorConstantePorNomeConstante("USUARIO_RESERVA_CLIENTES"); + Integer unPuntoVenta= constanteService.buscarValorConstantePorNomeConstante("PUNTOVENTA_RESERVA_CLIENTES"); + Integer estacionId = constanteService.buscarValorConstantePorNomeConstante("ESTACION_RESERVA_CLIENTES"); + + Corrida corrida = null; + try { + + for (EsquemaCorrida esquemaCorrida : lsEsquemaCorrida) { + Boolean isFeriado = this.isFeriado(data, esquemaCorrida); + + log.info("esquema=" + esquemaCorrida.getEsquemacorridaId() + " numCorrida=" + esquemaCorrida.getNumCorrida()); + + if (isGeracaoAutomaticaCorrida) { + boolean esHijoRebote = esquemaCorridaDAO.esHijoRebote(esquemaCorrida); + boolean esSegundoPiso = esquemaCorridaDAO.esSegundoPiso(esquemaCorrida); + + //Nessas duas condições, o "filho" só é gerado a partir do esquema corrida "pai" + if (esHijoRebote || esSegundoPiso) { + log.info(String.format("Esquema nao gerado. esHijoRebote:%s ; esSegundoPiso: %s",esHijoRebote,esSegundoPiso)); + continue; + } + } + + corrida = generarCorrida(esquemaCorrida, dataGeracao, false, isFeriado); + Corrida corridaPisoExtra = null; + Corrida corridaPisoExtra2 = null; + + if (corrida == null) {// Si no genera la corrida, no va a + // generar el rebote + log.info("No fue generado corrida. Esquema " + esquemaCorrida.getEsquemacorridaId() + " Data" + dataGeracao); + continue; + } + + // PISO EXTRA + if (esquemaCorrida.getPisoExtra() != null && esquemaCorrida.getPisoExtra()) { + + EsquemaCorrida esquemaCorridaSegundoPiso = esquemaCorridaDAO.buscarPeloNumCorrida(esquemaCorrida.getNumCorridaPisoExtra()); + + String mensagemLog = String.format("Esquema/Corrida primeiro piso: %s/%s ; Esquema/Corrida segundo piso: %s/%s ",esquemaCorrida.getEsquemacorridaId(),esquemaCorrida.getNumCorrida(), esquemaCorridaSegundoPiso.getEsquemacorridaId(),esquemaCorridaSegundoPiso.getNumCorrida() ); + log.info(mensagemLog); + + corridaPisoExtra = generarCorrida(esquemaCorridaSegundoPiso, dataGeracao, true, isFeriado); + Boolean atualizarPisoExtra = false; + + // caso corrida segundo piso for gerada antes, atualizar + atualizarPisoExtra = atualizarCorridaPisoExtra(corridaPisoExtra, esquemaCorridaSegundoPiso, data, mensagemLog, atualizarPisoExtra); + + alterarNumPisoCorridaPisoExtra(corrida, corridaPisoExtra, mensagemLog, atualizarPisoExtra, false); + + if(esquemaCorrida.getNumCorridaPisoExtra2() != null) { + + EsquemaCorrida esquemaCorridaTerceiroPiso = esquemaCorridaDAO.buscarPeloNumCorrida(esquemaCorrida.getNumCorridaPisoExtra2()); + + if(esquemaCorridaTerceiroPiso != null) { + + mensagemLog = String.format("Esquema/Corrida primeiro piso: %s/%s ; Esquema/Corrida terceiro piso: %s/%s ",esquemaCorrida.getEsquemacorridaId(),esquemaCorrida.getNumCorrida(), esquemaCorridaTerceiroPiso.getEsquemacorridaId(),esquemaCorridaTerceiroPiso.getNumCorrida() ); + log.info(mensagemLog); + + corridaPisoExtra2 = generarCorrida(esquemaCorridaTerceiroPiso, dataGeracao, true, isFeriado); + atualizarPisoExtra = false; + + // caso corrida segundo piso for gerada antes, atualizar + atualizarPisoExtra = atualizarCorridaPisoExtra(corridaPisoExtra2, esquemaCorridaTerceiroPiso, data, mensagemLog, atualizarPisoExtra); + + // caso corrida segundo piso for gerada antes, atualizar + alterarNumPisoCorridaPisoExtra(corrida, corridaPisoExtra2, mensagemLog, atualizarPisoExtra, true); + } + } + } + + if (esquemaCorrida.getEsquemaCorridaRebote() != null) { + log.info("Corrida Rebote=" + esquemaCorrida.getEsquemacorridaId()); + + Corrida corridaRebote = generarCorrida(esquemaCorrida.getEsquemaCorridaRebote(), dataGeracao, false, isFeriado); + Corrida corridaPisoExtraRebote = null; + boolean generaReboteDiaSeguinte = false; + + if (corridaRebote != null) { + EsquemaCorrida ecRebote = esquemaCorrida.getEsquemaCorridaRebote(); + if (ecRebote.getPisoExtra() != null && ecRebote.getPisoExtra()) { + + EsquemaCorrida esquemaCorridaSegundoPiso = esquemaCorridaDAO.buscarPeloNumCorrida(ecRebote.getNumCorridaPisoExtra()); + + log.info(String.format("Esquema/Corrida primeiro piso: %s/%s ; Esquema/Corrida segundo piso: %s/%s ",ecRebote.getEsquemacorridaId(),ecRebote.getNumCorrida(), esquemaCorridaSegundoPiso.getEsquemacorridaId(),esquemaCorridaSegundoPiso.getNumCorrida() )); + + corridaPisoExtraRebote = generarCorrida(esquemaCorridaSegundoPiso, dataGeracao, true, isFeriado); + + if (corridaRebote != null && corridaPisoExtraRebote != null) { + // Salvando Referencia da Corrida no piso extra + corridaPisoExtraRebote.setCorridaPiso(corridaRebote); + corridaPisoExtraRebote.setNumPiso(2); + corridaPisoExtraRebote = corridaDAO.actualizacion(corridaPisoExtraRebote); + + // Referencia do Piso extra na Corrida + corridaRebote.setCorridaPiso(corridaPisoExtraRebote); + corridaRebote.setNumPiso(1); + corridaRebote = corridaDAO.actualizacion(corridaRebote); + } + } + // RebotePisoExtra + if (DateUtil.compareDate(corrida.getFechorsalida(), corridaRebote.getFechorsalida()) > 0) { + generaReboteDiaSeguinte = true; // si fue generado + // con una + // fechamenor tienes + // que generar para + // el dia seguinte + } + } else { + generaReboteDiaSeguinte = true;// si no fue encontrado + // para el dia de + // hoy,genera para + // manhana + } + + if (generaReboteDiaSeguinte) { + log.info("Haciendo la busqueda por el esquema rebote para el dia seguiente pues ya existe al dia de hoy"); + + corridaRebote = generarReboteDiaSeguinte(esquemaCorrida, dataGeracao); + + if (corridaPisoExtraRebote != null) { + corridaPisoExtraRebote = generarReboteDiaSeguinte(esquemaCorrida, dataGeracao); + } + + if (corridaRebote == null) { + log.info("No fue posible generar la corrida rebote. No fue encontrado esquema para la fecha del dia seguinte a " + dataGeracao); + } + } + if (corridaRebote != null) { + log.info("Rebote generado=" + corridaRebote.getId()); + corrida.setCorridaRebote(corridaRebote); + corridaDAO.actualizacion(corrida); + } + if (corridaPisoExtraRebote != null && corridaPisoExtra != null) { + log.info("Rebote Piso Extra Generado=" + corridaPisoExtraRebote.getId()); + corridaPisoExtra.setCorridaRebote(corridaPisoExtraRebote); + corridaDAO.actualizacion(corridaPisoExtra); + } + + if (corridaPisoExtraRebote != null && corridaPisoExtra2 != null) { + log.info("Rebote Piso Extra Generado=" + corridaPisoExtraRebote.getId()); + corridaPisoExtra2.setCorridaRebote(corridaPisoExtraRebote); + corridaDAO.actualizacion(corridaPisoExtra2); + } + } + + + + if (cantCorridaGenerada >= cantCorridaCommit) { + cantCorridaGenerada = 0; + transactionManager.commit(status); + status = transactionManager.getTransaction(def); + } + + } // for (EsquemaCorrida esquemaCorrida : lsEsquemaCorrida) + } finally { + if ((status != null) && (!status.isCompleted())) { + transactionManager.commit(status); + } + } + //Valida se existe configuração de reserva para o cliente e crria Cria reserva + if(corrida !=null) { + if(unUsuarioId!=null && unPuntoVenta!=null && estacionId!=null) { + validaCriaReservaCliente(corrida, unUsuarioId, unPuntoVenta, estacionId); + } + } + } + + private void validaCriaReservaCliente(Corrida corrida, Integer unUsuarioId, Integer unPuntoVenta, Integer estacionId) { + try { + List reservaEspecialClienteList = reservaEspecialClientService.bucarReservaEspecialByCorridaId(corrida.getId().getCorridaId().longValue()) ; + if(reservaEspecialClienteList !=null) { + for (ReservaEspecialCliente reservaEspecialCliente : reservaEspecialClienteList) { + Date dataAtual = new Date (); + //Valida se esta dentro da vigência + if(DateUtil.isMenor(reservaEspecialCliente.getFecinicio(), dataAtual) && DateUtil.isMaior(reservaEspecialCliente.getFecfinal(), dataAtual)){ + Integer unoTerminalOrigenId = reservaEspecialCliente.getOrigem().getParadaId(); + Integer unoTerminalDestinoId = reservaEspecialCliente.getDestino().getParadaId(); + String unoAsientoSelec = reservaEspecialCliente.getNumAsentoCorrida().toString(); + Integer unaCorridaId =corrida.getId().getCorridaId().intValue(); + Date unaFecCorrida= corrida.getId().getFeccorrida(); + Integer unoTipoVenta= TPV_RESERVA_NORMAL; + Integer unaCategoriaSelec= 1 ; + String unoNumeOperacion= null ; + Tramo tramo = null; + Date fecViaje = corrida.getFechorsalida(); + Ruta ruta = rutaService.obtenerID(corrida.getRuta().getRutaId()); + for(RutaCombinacion rutaCombinacion :ruta.getRutaCombinacionList()) { + if((rutaCombinacion.getTramo().getOrigem().getParadaId().intValue()==unoTerminalOrigenId.intValue()) + && (rutaCombinacion.getTramo().getDestino().getParadaId().intValue()==unoTerminalDestinoId.intValue()) ) { + tramo = rutaCombinacion.getTramo(); + break; + } + } + + for (CorridaTramo corridaTramo : corrida.getCorridaTramoList()) { + //(Se origem corridatramo = origem cadastrada && destino corridatramo = destino cadastrado) + // ou (se origem corridatramo = destino do cadastrado), tendo em vista que corridatramo são a sequencias e não as combinações + if(corridaTramo.getOrigem()!=null && corridaTramo.getOrigem().getParadaId().intValue()==unoTerminalOrigenId.intValue() + && corridaTramo.getDestino()!=null && corridaTramo.getDestino().getParadaId().intValue()==unoTerminalDestinoId.intValue()) { + fecViaje = corridaTramo.getFechorsalidaH(); + break; + } + } + + if(tramo==null) { + log.error("Reserva não será realizada. Não foi encontrado trecho com Origem:" + unoTerminalOrigenId + " Destino:" +unoTerminalDestinoId + " para a corrida:" + corrida.getId().getCorridaId()); + continue; + } + List vigenciaTarifaList = vigenciaTarifaService.buscarVigenciasIntervalo(new VigenciaTarifa(corrida.getFechorSalidaOriginal(), corrida.getFechorSalidaOriginal())); + if(vigenciaTarifaList==null || vigenciaTarifaList.isEmpty()) { + log.error("Reserva não será realizada. Não foi encontrado Vigência Tarifa com Origem:" + unoTerminalOrigenId + " Destino:" +unoTerminalDestinoId + " para a corrida:" + corrida.getId().getCorridaId()); + continue; + } + Tarifa tarifa = tarifaService.buscar(tramo, corrida.getMarca(), corrida.getClaseServicio(), vigenciaTarifaList!=null ? vigenciaTarifaList.get(0) : null, new Moneda(1), corrida.getRuta()); + if(tarifa==null ) { + log.error("Reserva não será realizada. Não foi encontrado Tarifa com Origem:" + unoTerminalOrigenId + " Destino:" +unoTerminalDestinoId + " para a corrida:" + corrida.getId().getCorridaId()); + continue; + } + Float valorTarifa= tarifa!=null ? tarifa.getPrecio().floatValue() : null ; + Long tempoReserva = null; + Cliente cliente = clienteService.obtenerID(reservaEspecialCliente.getClienteId().intValue()); + boletoService.criaBoletoReserva(unoAsientoSelec, unaCorridaId, unaFecCorrida, unoTerminalOrigenId, + unoTerminalDestinoId, unoTipoVenta, unaCategoriaSelec, unoNumeOperacion, unUsuarioId, unPuntoVenta, + reservaEspecialCliente.getClienteId().intValue(), corrida.getRuta().getRutaId(), valorTarifa, tempoReserva, + estacionId, cliente.getNumIdentificaUno(), cliente.getListClienteFidelidad().get(0).getClienteFidelidadId().toString(), + corrida.getClaseServicio().getClaseservicioId(), corrida.getMarca().getMarcaId(), fecViaje, corrida.getEmpresa().getEmpresaId(), cliente.getNombcliente()); + } + } + } + } catch (Exception e) { + log.error("Erro ao validar/criar reserva especial de clientes", e); + } + } + + private void alterarNumPisoCorridaPisoExtra(Corrida corrida, Corrida corridaPisoExtra, String mensagemLog, Boolean atualizarPisoExtra, boolean isPiso3) { + if (corrida != null && corridaPisoExtra != null) { + log.info(mensagemLog + "; atualizando as corridas do piso 1 e 2"); + // Salvando Referencia da Corrida no piso extra + corridaPisoExtra.setCorridaPiso(corrida); + corridaPisoExtra.setNumPiso(isPiso3 ? 3 : 2); + corridaPisoExtra = corridaDAO.actualizacion(corridaPisoExtra); + // Referencia do Piso extra na Corrida + corrida.setCorridaPiso(corridaPisoExtra); + corrida.setNumPiso(1); + corrida = corridaDAO.actualizacion(corrida); + + if(atualizarPisoExtra) { + corridaDAO.actualizacion(corridaPisoExtra); + } + } else { + log.info(mensagemLog + "; nao foram atualizadas as corridas do piso 1 e 2"); + } + } + + private Boolean atualizarCorridaPisoExtra(Corrida corridaPisoExtra, EsquemaCorrida esquemaCorridaSegundoPiso, java.sql.Date data, String mensagemLog, Boolean atualizarPisoExtra) { + // caso corrida segundo piso for gerada antes, atualizar + if(corridaPisoExtra == null) { + Id id = new Id(); + id.setCorridaId(esquemaCorridaSegundoPiso.getNumCorrida()); + id.setFeccorrida(data); + + corridaPisoExtra = corridaDAO.buscarPorId(id); + + atualizarPisoExtra = corridaPisoExtra == null ? false : true; + log.info(mensagemLog + "; atualizarPisoExtra=" + atualizarPisoExtra); + } + + return atualizarPisoExtra; + } + + /** + * Verifica se hay una excepcione de tiempo para el tramo informado. + * + * @param corridaTramo + * @param claseServicio + * @return - Si existe una excepcion, regresa la nueva fecLlegada para el tramo, sino, regreso null + */ + private Date arreglaExcepcionTiempo(CorridaTramo corridaTramo, ClaseServicio claseServicio) { + Date nuevaFecLlegada = null; + + Tramo tramo = corridaTramo.getTramo(); + + List lsExcepciones = tramoTiempoDAO.buscar(tramo, claseServicio, corridaTramo.getFechorsalida(), corridaTramo.getFechorllegada()); + + if (!lsExcepciones.isEmpty()) { + TramoTiempo tramoTiempo = lsExcepciones.get(0); + List diasSemana = getDiaDeLaSemana(tramoTiempo); + + Calendar fecCorrida = Calendar.getInstance(); + fecCorrida.setTime(corridaTramo.getFechorllegada()); + + if (diasSemana.contains(fecCorrida.get(Calendar.DAY_OF_WEEK))) { + log.info("Hay Excepcione de tiempo"); + + Calendar fechorsalida = Calendar.getInstance(); + fechorsalida.setTime(corridaTramo.getFechorsalida()); + + HoraSistema horaSistema = new HoraSistema(tramoTiempo.getTiemporecorrido()); + + fechorsalida.add(Calendar.HOUR, horaSistema.getHora()); + fechorsalida.add(Calendar.MINUTE, horaSistema.getMinuto()); + + nuevaFecLlegada = fechorsalida.getTime(); + } + } + + return nuevaFecLlegada; + } + + private Corrida generarReboteDiaSeguinte(EsquemaCorrida esquemaCorrida, Date dataGeracao) { + Calendar tmp = Calendar.getInstance(); + tmp.setTime(dataGeracao); + tmp.add(Calendar.DAY_OF_MONTH, 1); + java.sql.Date data = new java.sql.Date(dataGeracao.getTime()); + Boolean isFeriado = this.isFeriado(data, esquemaCorrida); + + return generarCorrida(esquemaCorrida.getEsquemaCorridaRebote(), tmp.getTime(), false, isFeriado); + } + + private List getDiaDeLaSemana(TramoTiempo tramoTiempo) { + List diasValidos = new ArrayList(); + + if (tramoTiempo.getIndapliclun()) { + diasValidos.add(Calendar.MONDAY); + } + if (tramoTiempo.getIndaplicmar()) { + diasValidos.add(Calendar.TUESDAY); + } + if (tramoTiempo.getIndaplicmie()) { + diasValidos.add(Calendar.WEDNESDAY); + } + if (tramoTiempo.getIndaplicjue()) { + diasValidos.add(Calendar.THURSDAY); + } + if (tramoTiempo.getIndaplicvie()) { + diasValidos.add(Calendar.FRIDAY); + } + if (tramoTiempo.getIndaplicsab()) { + diasValidos.add(Calendar.SATURDAY); + } + if (tramoTiempo.getIndaplicdom()) { + diasValidos.add(Calendar.SUNDAY); + } + + return diasValidos; + } + + @Override + public Date calcularDataFinalGeneracionCorrida() { + Date dataDe = new Date(); + + Constante constante = constanteService.buscarPorNomeConstante("CANT_DIAS_GENERACION_CORRIDA"); + Calendar calendarData = Calendar.getInstance(); + calendarData.setTime(dataDe); + calendarData.add(Calendar.DATE, Integer.parseInt(constante.getValorconstante())); + Date dataAte = calendarData.getTime(); + + return dataAte; + } + + @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) + public boolean generarCorridaAutomatica() { + feriadoCache.limpar(); + + Date dataDe = Calendar.getInstance().getTime(); + + Date dataAteConstante = calcularDataFinalGeneracionCorrida(); + Boolean hayErroConstante = !generarCorridaAutomaticaConstanteDias(dataDe, dataAteConstante); + + log.debug("corrida generadas por la constante. hayError=" + hayErroConstante); + + Boolean hayErroQtdeDias = !generarCorridaAutomaticaQtdeDias(dataDe); + + log.debug("corrida generadas por la cant de dias.hayError=" + hayErroQtdeDias); + + return hayErroConstante && hayErroQtdeDias; + } + + private boolean generarCorridaAutomaticaQtdeDias(Date dataDeOriginal) { + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + + log.debug(" Generacion cant dias " + sdf.format(dataDeOriginal)); + + // TODO: Melhorar o tratamento às transações manuais em caso de erro,etc + DefaultTransactionDefinition def = new DefaultTransactionDefinition(DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW); + TransactionStatus status = transactionManager.getTransaction(def); + + List lsEsquemaCorrida = esquemaCorridaService.buscaDentroVigenciaQtdeDiasNotNull(dataDeOriginal); + for (EsquemaCorrida esquemaCorrida : lsEsquemaCorrida) { + log.debug("esquemaCorrida=" + esquemaCorrida.getEsquemacorridaId()); + + Integer qtdeDiasGerar = esquemaCorrida.getCantDiasGeneracion(); + + if (qtdeDiasGerar <= 0) { + log.debug("cant dias <=0"); + + continue; + } + + log.debug("cantDiasGenerar=" + qtdeDiasGerar); + + Calendar calendarData = Calendar.getInstance(); + calendarData.setTime(dataDeOriginal); + calendarData.add(Calendar.DATE, qtdeDiasGerar - 1); + + Date dataAte = calendarData.getTime(); + Date dataDe = new Date(dataDeOriginal.getTime()); + + log.debug("Periodo generacion = " + sdf.format(dataDe) + " hasta " + sdf.format(dataAte)); + + if (DateUtil.compareOnlyDate(dataAte, esquemaCorrida.getEsquemaOperacional().getFecfinvigencia()) > 0) { + log.info("Cant dias excede final de la vigencia"); + dataAte = esquemaCorrida.getEsquemaOperacional().getFecfinvigencia(); + } + + try { + while (DateUtil.compareOnlyDate(dataDe, dataAte) <= 0) { + + + List lsTmp = new ArrayList(); + lsTmp.add(esquemaCorrida); + + this.generarCorrida(dataDe, lsTmp, true); + + calendarData.setTime(dataDe); + calendarData.add(Calendar.DATE, 1); + dataDe = calendarData.getTime(); + } + log.info("commit bloco corridas"); + transactionManager.commit(status); + status = transactionManager.getTransaction(def); + } catch (Throwable ex) { + log.error("", ex); + log.error(" Erro ao gerar corrida = " + esquemaCorrida.getNumCorrida() + " esquemaCorrida = " + esquemaCorrida.getEsquemacorridaId()); + transactionManager.rollback(status); + status = transactionManager.getTransaction(def); + } + } + + if (!status.isCompleted()) { + log.info("commit bloco final"); + transactionManager.commit(status); + } + + return Boolean.TRUE; + } + + private boolean generarCorridaAutomaticaConstanteDias(Date dataDe, Date dataAte) { + boolean generacionExitosa = true; + SimpleDateFormat sdfData = new SimpleDateFormat("dd/MM/yyyy"); + + log.debug("** AUTO - Data De: " + sdfData.format(dataDe) + " **Data Ateh: " + sdfData.format(dataAte)); + + Calendar calendarData = Calendar.getInstance(); + calendarData.setTime(dataAte); + calendarData.add(Calendar.DATE, 1); + dataAte = calendarData.getTime(); + try { + while (dataDe.before(dataAte)) { + log.debug("*** Data: " + sdfData.format(dataDe)); + + List lsEsquemaCorrida = esquemaCorridaService.buscaDentroVigenciaQtdeDiasNull(dataDe); + + Boolean dentroVigenciaEsquemaOperacional = !lsEsquemaCorrida.isEmpty(); + if (dentroVigenciaEsquemaOperacional) { + log.debug("Geracao de servicos sem cant dias especifico. Adotando o padrao"); + + this.generarCorrida(dataDe, lsEsquemaCorrida, true); + + } else { + log.info("No hay esquema vigente para la fecha " + sdfData.format(dataDe)); + } + + calendarData.setTime(dataDe); + calendarData.add(Calendar.DATE, 1); + dataDe = calendarData.getTime(); + } + } catch (Exception ex) { + log.error("Erro ao gerar corridas: " + ex, ex); + generacionExitosa = false; + } + + return generacionExitosa; + } + + private int cantDiasMaxGerarCorridasManual() { + + Constante constante = constanteService.buscarPorNomeConstante("CANT_MAX_CORRIDA_GERA_MANUAL"); + + if ((constante == null) || (StringUtils.isBlank(constante.getValorconstante()))) { + return CANT_MAX_CORRIDA_GERA_MANUAL; + } + + return Integer.valueOf(constante.getValorconstante()); + + } + + public Long generarCorridasSelecionadas(List lsEsquemaCorrida, Date dataDe, Date dataAte) throws BusinessException { + + int cantDiasGeneracion = DateUtil.getElapsedDias(dataDe, dataAte); + + int cantDiasMaxGerarCorridasManual = cantDiasMaxGerarCorridasManual(); + + log.info("cantDiasGeneracion=" + cantDiasGeneracion); + log.info("cantDiasMaxGerarCorridasManual=" + cantDiasMaxGerarCorridasManual); + + if (cantDiasGeneracion > cantDiasMaxGerarCorridasManual()) { + throw new BusinessException("corridaServiceImpl.geracaoCorrida.cantDiasManual", new Object[] { cantDiasMaxGerarCorridasManual }); + } + + SimpleDateFormat sdfData = new SimpleDateFormat("dd/MM/yyyy"); + + log.info("** SELECIONADOS - Data De: " + sdfData.format(dataDe) + " **Data Ateh: " + sdfData.format(dataAte)); + + Calendar calendarData = Calendar.getInstance(); + calendarData.setTime(dataDe); + + Long cantInicio = corridaDAO.cantCorridaGeneradasHoy(); + + while (DateUtil.compareOnlyDate(dataDe, dataAte) <= 0) { + log.info("*** Data: " + sdfData.format(dataDe)); + + this.generarCorrida(dataDe, lsEsquemaCorrida, false); + + calendarData.add(Calendar.DATE, 1); + dataDe = calendarData.getTime(); + } + + Long cantFim = corridaDAO.cantCorridaGeneradasHoy(); + + return cantFim - cantInicio; + } + + public List buscarGroupCorrridaId(Integer corridaId, Date dateInicio, Date dateFin) { + GregorianCalendar gCalendarDe = new GregorianCalendar(); + gCalendarDe.setTime(dateInicio); + gCalendarDe.set(Calendar.HOUR_OF_DAY, 0); + gCalendarDe.set(Calendar.MINUTE, 0); + gCalendarDe.set(Calendar.SECOND, 0); + gCalendarDe.set(Calendar.MILLISECOND, 0); + + GregorianCalendar gCalendarAte = new GregorianCalendar(); + gCalendarAte.setTime(dateFin); + gCalendarAte.set(Calendar.HOUR_OF_DAY, 0); + gCalendarAte.set(Calendar.MINUTE, 0); + gCalendarAte.set(Calendar.SECOND, 0); + gCalendarAte.set(Calendar.MILLISECOND, 0); + + return corridaDAO.buscarGroupCorrridaId(corridaId, gCalendarDe.getTime(), gCalendarAte.getTime()); + } + + @Override + public List buscarGroupCorrridaId(Integer corridaId, Integer origem, Integer destino, Integer ruta, Integer numRuta, Date dateInicio, Date dateFin) { + GregorianCalendar gCalendarDe = new GregorianCalendar(); + gCalendarDe.setTime(dateInicio); + gCalendarDe.set(Calendar.HOUR_OF_DAY, 0); + gCalendarDe.set(Calendar.MINUTE, 0); + gCalendarDe.set(Calendar.SECOND, 0); + gCalendarDe.set(Calendar.MILLISECOND, 0); + + GregorianCalendar gCalendarAte = new GregorianCalendar(); + gCalendarAte.setTime(dateFin); + gCalendarAte.set(Calendar.HOUR_OF_DAY, 0); + gCalendarAte.set(Calendar.MINUTE, 0); + gCalendarAte.set(Calendar.SECOND, 0); + gCalendarAte.set(Calendar.MILLISECOND, 0); + + return corridaDAO.buscarGroupCorrridaId(corridaId, origem, destino, ruta, numRuta, gCalendarDe.getTime(), gCalendarAte.getTime()); + } + + @Override + public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial, Integer corridaId) { + try { + List corridas = corridaDAO.buscarPorEstado(estado, dataInicial, corridaId); + corridaDAO.actualizaFecHusoFecVerano(corridas); + return Boolean.TRUE; + + } catch (Exception ex) { + log.error("Erro ao atualizar corridas FecHuso FecVerano: " + ex, ex); + } + return Boolean.FALSE; + + } + + @Override + public Boolean atualizarCorridaFecHusoFecVerano(Estado estado, Date dataInicial) { + return atualizarCorridaFecHusoFecVerano(estado, dataInicial, null); + } + + @Override + public List buscarCorridaRelAproveitamento(Parada origem, Parada destino, + Date feccorrida, Integer corridaId) { + + List ls = new ArrayList(); + ls =corridaDAO.buscarCorridaRelAproveitamento(origem, destino, feccorrida, corridaId); + return ls; + + } + + @Override + public Corrida buscaCorrridaFutura(Ruta ruta, Date fecInicio) { + return corridaDAO.buscaCorrridaFutura(ruta, fecInicio); + } + + @Override + @Transactional + public Boolean editarCorridaPorOutraCorrida(Estado estado, Date dataInicial, Integer corridaId, Date dataPadrao) { + List corridas = corridaDAO.buscarPorEstado(estado, dataInicial, corridaId); + + if (corridas == null || corridas.isEmpty()){ + return false; + } + + Corrida corrida = corridaDAO.buscarPorId(new Corrida(corridaId, dataPadrao).getId()); + if(corrida != null){ + corridaDAO.editarCorridaPorOutraCorrida(corridas,corrida); + }else { + return false; + } + return true; + } + + public Integer buscarOcupacaoCorrida(Corrida corrida) { + return corridaDAO.buscarOcupacaoCorrida(corrida); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CorridaTramoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CorridaTramoServiceImpl.java new file mode 100644 index 000000000..ebdb867b2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CorridaTramoServiceImpl.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.CorridaTramoDAO; +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; +import com.rjconsultores.ventaboletos.service.CorridaTramoService; + +@Service("corridaTramoService") +public class CorridaTramoServiceImpl implements CorridaTramoService { + + @Autowired + private CorridaTramoDAO corridaTramoDAO; + + @Override + public List obtenerTodos() { + return corridaTramoDAO.obtenerTodos(); + } + + @Override + public CorridaTramo obtenerID(Integer id) { + return corridaTramoDAO.obtenerID(id); + } + + @Override + public CorridaTramo suscribir(CorridaTramo entidad) { + return corridaTramoDAO.suscribir(entidad); + } + + @Override + public CorridaTramo actualizacion(CorridaTramo entidad) { + return corridaTramoDAO.actualizacion(entidad); + } + + @Override + public void borrar(CorridaTramo entidad) { + corridaTramoDAO.borrar(entidad); + } + + @Override + public List obtenerTramoTarjetaEmitida() { + return corridaTramoDAO.obtenerTramoTarjetaEmitida(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CortesiaBeneficiarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CortesiaBeneficiarioServiceImpl.java new file mode 100644 index 000000000..390f99942 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CortesiaBeneficiarioServiceImpl.java @@ -0,0 +1,64 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CortesiaBeneficiarioDAO; +import com.rjconsultores.ventaboletos.entidad.CortesiaBeneficiario; +import com.rjconsultores.ventaboletos.service.CortesiaBeneficiarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("cortesiaBeneficiarioService") +public class CortesiaBeneficiarioServiceImpl implements CortesiaBeneficiarioService{ + + @Autowired + private CortesiaBeneficiarioDAO cortesiaBeneficiarioDAO; + + public List obtenerTodos() { + return cortesiaBeneficiarioDAO.obtenerTodos(); + } + + public CortesiaBeneficiario obtenerID(Integer id) { + return cortesiaBeneficiarioDAO.obtenerID(id); + } + + @Transactional + public CortesiaBeneficiario suscribir(CortesiaBeneficiario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cortesiaBeneficiarioDAO.suscribir(entidad); + } + + @Transactional + public CortesiaBeneficiario actualizacion(CortesiaBeneficiario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cortesiaBeneficiarioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CortesiaBeneficiario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cortesiaBeneficiarioDAO.actualizacion(entidad); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CortesiaDireccionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CortesiaDireccionServiceImpl.java new file mode 100644 index 000000000..6665fbdc0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CortesiaDireccionServiceImpl.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CortesiaDireccionDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CortesiaDireccion; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.service.CortesiaDireccionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("cortesiaDireccionService") +public class CortesiaDireccionServiceImpl implements CortesiaDireccionService { + + @Autowired + private CortesiaDireccionDAO cortesiaDireccionDAO; + + public List obtenerTodos() { + return cortesiaDireccionDAO.obtenerTodos(); + } + + public CortesiaDireccion obtenerID(Integer id) { + return cortesiaDireccionDAO.obtenerID(id); + } + + @Transactional + public CortesiaDireccion suscribir(CortesiaDireccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cortesiaDireccionDAO.suscribir(entidad); + + } + + @Transactional + public CortesiaDireccion actualizacion(CortesiaDireccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cortesiaDireccionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CortesiaDireccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cortesiaDireccionDAO.actualizacion(entidad); + } + + public List pesquisar(Marca marca, ClaseServicio claseServicio, Date fecInicio, Date fecFinal) { + + return cortesiaDireccionDAO.pesquisar(marca, claseServicio, fecInicio, fecFinal); + } + + public List buscar(CortesiaDireccion cortesiaDireccion) { + return cortesiaDireccionDAO.buscar(cortesiaDireccion); + } + + public List buscarFolio(CortesiaDireccion cortesiaDireccion) { + return cortesiaDireccionDAO.buscarFolio(cortesiaDireccion); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CortesiaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CortesiaServiceImpl.java new file mode 100644 index 000000000..d7a386823 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CortesiaServiceImpl.java @@ -0,0 +1,114 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CortesiaDAO; +import com.rjconsultores.ventaboletos.dao.EmpleadoDAO; +import com.rjconsultores.ventaboletos.entidad.Cortesia; +import com.rjconsultores.ventaboletos.entidad.CortesiaBeneficiario; +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.service.CortesiaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("cortesiaService") +public class CortesiaServiceImpl implements CortesiaService { + + public static final String PENDIENTE = "P"; + @Autowired + private CortesiaDAO cortesiaDAO; + @Autowired + private EmpleadoDAO empleadoDAO; + + public List obtenerTodos() { + return cortesiaDAO.obtenerTodos(); + } + + public Cortesia obtenerID(Integer id) { + return cortesiaDAO.obtenerID(id); + } + + @Transactional + public Cortesia suscribir(Cortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cortesiaDAO.suscribir(entidad); + } + + @Transactional + public Cortesia actualizacion(Cortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cortesiaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Cortesia entidad) { + + entidad = this.obtenerID(entidad.getCortesiaId()); + + for (CortesiaBeneficiario cb : entidad.getCortesiaBeneficiarioList()) { + cb.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cb.setFecmodif(Calendar.getInstance().getTime()); + cb.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cortesiaDAO.actualizacion(entidad); + } + + public List pesquisar(String empleadoClave) { + List empleados = empleadoDAO.obtenerTodos(); + Empleado eSlec = null; + for (Empleado emp : empleados) { + if (emp.getCveEmpleado().equals(empleadoClave)) { + eSlec = emp; + } + } + + return cortesiaDAO.pesquisar(eSlec); + } + + public Cortesia buscar(Integer cortesiaId) { + List cortesias = cortesiaDAO.obtenerTodos(); + Cortesia corSelec = null; + for (Cortesia c : cortesias) { + if (c.getCortesiaId().equals(cortesiaId)) { + corSelec = c; + } + } + + return cortesiaDAO.buscar(corSelec); + } + + public List buscarDplicidad(Cortesia cortesia) { + return cortesiaDAO.buscarDplicidad(cortesia); + } + + public boolean cortesiaUtilizada(Cortesia cortesia) { + if ((cortesia == null) || (cortesia.getNdstatus() == null)) { + throw new IllegalArgumentException("Deve de infromar los datos de la cortesia"); + } + if (!cortesia.getNdstatus().equals(PENDIENTE)) { + return true; + } + return false; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CotacaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CotacaoServiceImpl.java new file mode 100644 index 000000000..df0e2ebfc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CotacaoServiceImpl.java @@ -0,0 +1,67 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CotacaoDAO; +import com.rjconsultores.ventaboletos.entidad.Cotacao; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.service.CotacaoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("cotacaoService") +public class CotacaoServiceImpl implements CotacaoService { + + private static Logger log = Logger.getLogger(CotacaoServiceImpl.class); + + @Autowired + private CotacaoDAO cotacaoDAO; + + public List obtenerTodos() { + return cotacaoDAO.obtenerTodos(); + } + + public Cotacao obtenerID(Integer id) { + return cotacaoDAO.obtenerID(id); + } + + @Transactional + public Cotacao suscribir(Cotacao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cotacaoDAO.suscribir(entidad); + } + + @Transactional + public Cotacao actualizacion(Cotacao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cotacaoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Cotacao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cotacaoDAO.actualizacion(entidad); + } + + @Override + public void inativarCotacoesAntigas(Moneda moneda) { + + cotacaoDAO.inativarCotacoesAntigas(moneda); + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CtrlFechamentoCaixaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CtrlFechamentoCaixaServiceImpl.java new file mode 100644 index 000000000..d5be68233 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CtrlFechamentoCaixaServiceImpl.java @@ -0,0 +1,96 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CtrlFechamentoCaixaDAO; +import com.rjconsultores.ventaboletos.entidad.CtrlFechamentoCaixa; +import com.rjconsultores.ventaboletos.enums.CtrlFechamentoCaixaStatus; +import com.rjconsultores.ventaboletos.service.CtrlFechamentoCaixaService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +@Service("ctrlFechamentoCaixaService") +public class CtrlFechamentoCaixaServiceImpl implements CtrlFechamentoCaixaService { + + private static Logger log = Logger.getLogger(CtrlFechamentoCaixaServiceImpl.class); + + @Autowired + CtrlFechamentoCaixaDAO ctrlFechamentoCaixaDAO; + + @Override + public List obtenerTodos() { + return ctrlFechamentoCaixaDAO.obtenerTodos(); + } + + @Override + public CtrlFechamentoCaixa obtenerID(Long id) { + return ctrlFechamentoCaixaDAO.obtenerID(id); + } + + @Override + @Transactional + public CtrlFechamentoCaixa suscribir(CtrlFechamentoCaixa entidad) { + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad = ctrlFechamentoCaixaDAO.suscribir(entidad); + return entidad; + } + + @Override + @Transactional + public CtrlFechamentoCaixa actualizacion(CtrlFechamentoCaixa entidad) { + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad = ctrlFechamentoCaixaDAO.actualizacion(entidad); + return entidad; + } + + @Override + @Transactional + public void borrar(CtrlFechamentoCaixa entidad) { + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + ctrlFechamentoCaixaDAO.borrar(entidad); + } + + @Override + @Transactional + public boolean autorizarExecutarRotinaRetencao(Date feccorte) { + try { + String sFeccorte = DateUtil.getStringDate(feccorte, "dd/MM/yyyy"); + CtrlFechamentoCaixa ctrlFechamentoCaixa = ctrlFechamentoCaixaDAO.obtenerFeccorte(feccorte); + if(ctrlFechamentoCaixa == null) { + log.info("Nenhum controle de retencao foi localizado para data: " + sFeccorte); + } else if(CtrlFechamentoCaixaStatus.RETENCAO_COMISSAO_EM_ANDAMENTO.equals(ctrlFechamentoCaixa.getStatus())) { + log.info("Retencao de comissao em andamento para data: " + sFeccorte); + } else if(CtrlFechamentoCaixaStatus.RETENCAO_COMISSAO_CONCLUIDA.equals(ctrlFechamentoCaixa.getStatus())) { + log.info("Retencao de comissao concluida para data: " + sFeccorte); + } else if(CtrlFechamentoCaixaStatus.LIBERADO_RETENCAO_COMISSAO.equals(ctrlFechamentoCaixa.getStatus())) { + log.info("Retencao de comissao liberada para data: " + sFeccorte); + ctrlFechamentoCaixa.setStatus(CtrlFechamentoCaixaStatus.RETENCAO_COMISSAO_EM_ANDAMENTO); + actualizacion(ctrlFechamentoCaixa); + return true; + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return false; + } + + @Override + @Transactional + public void atualizarCtrlFechamentoCaixaStatus(CtrlFechamentoCaixaStatus status, Date dataRetencao) { + try { + CtrlFechamentoCaixa ctrlFechamentoCaixa = ctrlFechamentoCaixaDAO.obtenerFeccorte(dataRetencao); + ctrlFechamentoCaixa.setStatus(status); + actualizacion(ctrlFechamentoCaixa); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CuponConvenioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CuponConvenioServiceImpl.java new file mode 100644 index 000000000..8505609df --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CuponConvenioServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CuponConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.CuponConvenio; +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; +import com.rjconsultores.ventaboletos.service.CuponConvenioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("cuponConvenioService") +public class CuponConvenioServiceImpl implements CuponConvenioService{ + + @Autowired + private CuponConvenioDAO cuponConvenioDAO; + public List obtenerTodos() { + return cuponConvenioDAO.obtenerTodos(); + } + + public CuponConvenio obtenerID(Integer id) { + return cuponConvenioDAO.obtenerID(id); + } + + @Transactional + public CuponConvenio suscribir(CuponConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cuponConvenioDAO.suscribir(entidad); + } + + @Transactional + public CuponConvenio actualizacion(CuponConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cuponConvenioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CuponConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cuponConvenioDAO.actualizacion(entidad); + } + + public List pesquisar(TipoConvenio tipoConvenio) { + + return cuponConvenioDAO.pesquisar(tipoConvenio); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CuponSecretariaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CuponSecretariaServiceImpl.java new file mode 100644 index 000000000..0d30145fb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CuponSecretariaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.CuponSecretariaDAO; +import com.rjconsultores.ventaboletos.entidad.CuponSecretaria; +import com.rjconsultores.ventaboletos.service.CuponSecretariaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("cuponSecretariaService") +public class CuponSecretariaServiceImpl implements CuponSecretariaService { + + @Autowired + private CuponSecretariaDAO cuponSecretariaDAO; + + public List obtenerTodos() { + return cuponSecretariaDAO.obtenerTodos(); + } + + public CuponSecretaria obtenerID(Integer id) { + return cuponSecretariaDAO.obtenerID(id); + } + + @Transactional + public CuponSecretaria suscribir(CuponSecretaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cuponSecretariaDAO.suscribir(entidad); + } + + @Transactional + public CuponSecretaria actualizacion(CuponSecretaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return cuponSecretariaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(CuponSecretaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cuponSecretariaDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CursoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CursoServiceImpl.java new file mode 100644 index 000000000..604bee690 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CursoServiceImpl.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CursoDAO; +import com.rjconsultores.ventaboletos.entidad.Curso; +import com.rjconsultores.ventaboletos.service.CursoService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("cursoService") +public class CursoServiceImpl implements CursoService { + + @Autowired + private CursoDAO CursoDAO; + + public List obtenerTodos() { + return CursoDAO.obtenerTodos(); + } + + public Curso obtenerID(Integer id) { + return CursoDAO.obtenerID(id); + } + + @Transactional + public Curso suscribir(Curso entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return CursoDAO.suscribir(entidad); + } + + @Transactional + public Curso actualizacion(Curso entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return CursoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Curso entidad) throws RegistroConDependenciaException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + CursoDAO.actualizacion(entidad); + } + + + public List buscar(String nomcurso){ + return CursoDAO.buscar(nomcurso); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CustomServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CustomServiceImpl.java new file mode 100644 index 000000000..4ea2789d8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/CustomServiceImpl.java @@ -0,0 +1,111 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; +import java.util.Map.Entry; +import java.util.Properties; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CustomDAO; +import com.rjconsultores.ventaboletos.entidad.Custom; +import com.rjconsultores.ventaboletos.enums.CustomTipo; +import com.rjconsultores.ventaboletos.enums.SistemaEnum; +import com.rjconsultores.ventaboletos.service.CustomService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Lucas + */ +@Service("customService") +public class CustomServiceImpl implements CustomService { + + @Autowired + private CustomDAO customDAO; + + public List obtenerTodos() { + return customDAO.obtenerTodos(); + } + + public Custom obtenerID(Integer id) { + return customDAO.obtenerID(id); + } + + @Transactional(propagation = Propagation.SUPPORTS) + public Custom suscribir(Custom entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado() != null ? UsuarioLogado.getUsuarioLogado().getUsuarioId() : null); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return customDAO.suscribir(entidad); + } + + @Transactional + public Custom actualizacion(Custom entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return customDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Custom entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + customDAO.actualizacion(entidad); + } + + @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) + public Custom buscar(String chave) { + return customDAO.buscar(chave); + } + + @Override + @Transactional + public void carregarArquivoProperties(SistemaEnum sistema, Properties arquivo, boolean substituirExistente) { + if(arquivo != null) { + for (Entry config : arquivo.entrySet()) { + Custom custom = customDAO.buscar(sistema.getValor(), config.getKey().toString()); + + if(custom != null && !substituirExistente) { + continue; + } + + if(custom == null) { + custom = new Custom(); + custom.setSistema(sistema.getValor()); + custom.setOrdem(0); + custom.setChave(config.getKey().toString()); + if(sistema.equals(SistemaEnum.VENDA_SERVIDOR)) { + custom.setTipo(CustomTipo.TIPO_SERVIDOR.getValor()); + } else if(sistema.equals(SistemaEnum.VENDA_CLIENTE)) { + custom.setTipo(CustomTipo.TIPO_CLIENTE.getValor()); + } + } + + custom.setValor(config.getValue().toString()); + suscribirOrActualizacion(custom); + } + } + } + + @Transactional + private Custom suscribirOrActualizacion(Custom custom) { + if(custom.getCustomId() == null) { + return suscribir(custom); + } else { + return actualizacion(custom); + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/DepositoBancarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/DepositoBancarioServiceImpl.java new file mode 100644 index 000000000..eb3d21f1d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/DepositoBancarioServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.DepositoBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.DepositoBancario; +import com.rjconsultores.ventaboletos.service.DepositoBancarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("depositoBancarioService") +public class DepositoBancarioServiceImpl implements DepositoBancarioService { + + @Autowired + private DepositoBancarioDAO depositoBancarioDAO; + + public List obtenerTodos() { + return depositoBancarioDAO.obtenerTodos(); + } + + public DepositoBancario obtenerID(Integer id) { + return depositoBancarioDAO.obtenerID(id); + } + + @Transactional + public DepositoBancario suscribir(DepositoBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return depositoBancarioDAO.suscribir(entidad); + } + + @Transactional + public DepositoBancario actualizacion(DepositoBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return depositoBancarioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(DepositoBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + depositoBancarioDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/DescontoComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/DescontoComissaoServiceImpl.java new file mode 100644 index 000000000..f015a84b3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/DescontoComissaoServiceImpl.java @@ -0,0 +1,73 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.DescontoComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.DescontoComissao; +import com.rjconsultores.ventaboletos.service.DescontoComissaoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("descontoComissaoService") +public class DescontoComissaoServiceImpl implements DescontoComissaoService { + + @Autowired + private DescontoComissaoDAO descontoComissaoDAO; + + @Override + public List obtenerTodos() { + return descontoComissaoDAO.obtenerTodos(); + } + + @Override + public DescontoComissao obtenerID(Long id) { + return descontoComissaoDAO.obtenerID(id); + } + + @Override + public List buscaDescontoComissaoPeriodo(Integer puntoVentaId, Integer empresaId, Date inicioPeriodo, Date fimPeriodo) { + return descontoComissaoDAO.buscaDescontoComissao(puntoVentaId, empresaId, inicioPeriodo, fimPeriodo); + } + + @Transactional + @Override + public DescontoComissao suscribir(DescontoComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return descontoComissaoDAO.suscribir(entidad); + } + + @Transactional + @Override + public DescontoComissao actualizacion(DescontoComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return descontoComissaoDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(DescontoComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + descontoComissaoDAO.actualizacion(entidad); + } + + @Override + @Transactional + public DescontoComissao suscribirOrActualizacion(DescontoComissao entidad) { + return entidad != null && entidad.getDescontocomissaoId() == null ? suscribir(entidad) : actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/DetAbastoBoletoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/DetAbastoBoletoServiceImpl.java new file mode 100644 index 000000000..062df9d80 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/DetAbastoBoletoServiceImpl.java @@ -0,0 +1,95 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.DetAbastoBoletoDAO; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.service.DetAbastoBoletoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("detAbastoBoletoService") +public class DetAbastoBoletoServiceImpl implements DetAbastoBoletoService { + + @Autowired + private DetAbastoBoletoDAO detAbastoBoletoDAO; + + @Override + public List obtenerTodos() { + return detAbastoBoletoDAO.obtenerTodos(); + } + + @Override + public DetAbastoBoleto obtenerID(Integer id) { + return detAbastoBoletoDAO.obtenerID(id); + } + + @Transactional + public DetAbastoBoleto suscribir(DetAbastoBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return detAbastoBoletoDAO.suscribir(entidad); + } + + @Transactional + public DetAbastoBoleto actualizacion(DetAbastoBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return detAbastoBoletoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(DetAbastoBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + detAbastoBoletoDAO.actualizacion(entidad); + } + + @Override + public Long getSecuencia() { + return detAbastoBoletoDAO.getSecuencia(); + } + + @Override + public void desabilitaDetAbastos(Estacion origem, String numfolioinicial, String numfoliofinal, String numseriepreimpresa) { + + List detAbastoBoletos = detAbastoBoletoDAO.buscaDetAbastoBoletos(origem, numfolioinicial, numfoliofinal, numseriepreimpresa); + + if (!detAbastoBoletos.isEmpty()) { + detAbastoBoletoDAO.desativaDetAbastos(detAbastoBoletos); + + DetAbastoBoleto detAbastoBoletoInicial = detAbastoBoletos.get(0); + detAbastoBoletoInicial.setNumfoliofinal(numfolioinicial); + detAbastoBoletoInicial.setActivo(Boolean.TRUE); + detAbastoBoletoDAO.actualizacion(detAbastoBoletoInicial); + + DetAbastoBoleto detAbastoBoletoFinal = detAbastoBoletos.get(detAbastoBoletos.size() - 1); + detAbastoBoletoFinal.setNumfolioinicial(numfoliofinal); + detAbastoBoletoFinal.setActivo(Boolean.TRUE); + detAbastoBoletoDAO.actualizacion(detAbastoBoletoFinal); + } + } + + @Override + public List buscabDetAbastoBoletoAutomatico(Estacion estacion, String numseriepreimpresa) { + return detAbastoBoletoDAO.buscabDetAbastoBoletoAutomatico(estacion, numseriepreimpresa); + } + + @Override + public List buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(Aidf aidf) { + return detAbastoBoletoDAO.buscabDetAbastoBoletoToVerifyIfAidfCanBeEditable(aidf); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/DetDiagramaAutobusServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/DetDiagramaAutobusServiceImpl.java new file mode 100644 index 000000000..75bb1794d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/DetDiagramaAutobusServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.DetDiagramaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; +import com.rjconsultores.ventaboletos.service.DetDiagramaAutobusService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("detDiagramaAutobusService") +public class DetDiagramaAutobusServiceImpl implements DetDiagramaAutobusService { + + @Autowired + private DetDiagramaAutobusDAO detDiagramaAtuobusDAO; + + public List obtenerTodos() { + return detDiagramaAtuobusDAO.obtenerTodos(); + } + + public DetDiagramaAutobus obtenerID(Short id) { + return detDiagramaAtuobusDAO.obtenerID(id); + } + + @Transactional + public DetDiagramaAutobus suscribir(DetDiagramaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return detDiagramaAtuobusDAO.suscribir(entidad); + } + + @Transactional + public DetDiagramaAutobus actualizacion(DetDiagramaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return detDiagramaAtuobusDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(DetDiagramaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + detDiagramaAtuobusDAO.actualizacion(entidad); + } + + @Override + public DetDiagramaAutobus obtenerPorDiagramaAutobusAsiento(Integer diagramaAutobusId, String numAsiento) { + return detDiagramaAtuobusDAO.obtenerPorDiagramaAutobusAsiento(diagramaAutobusId,numAsiento); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/DiagramaAutobusServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/DiagramaAutobusServiceImpl.java new file mode 100644 index 000000000..41dea8b55 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/DiagramaAutobusServiceImpl.java @@ -0,0 +1,79 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.DiagramaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.service.DiagramaAutobusService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("diagramaAutobusService") +public class DiagramaAutobusServiceImpl implements DiagramaAutobusService { + + @Autowired + private DiagramaAutobusDAO diagramaAutobusDAO; + + public List obtenerTodos() { + return diagramaAutobusDAO.obtenerTodos(); + } + + public DiagramaAutobus obtenerID(Short id) { + return diagramaAutobusDAO.obtenerID(id); + } + + @Transactional + public DiagramaAutobus suscribir(DiagramaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return diagramaAutobusDAO.suscribir(entidad); + } + + @Transactional + public DiagramaAutobus actualizacion(DiagramaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return diagramaAutobusDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(DiagramaAutobus entidad) { + + for (DetDiagramaAutobus dda : entidad.getDetDiagramaAutobusList()) { + dda.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + dda.setFecmodif(Calendar.getInstance().getTime()); + dda.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + diagramaAutobusDAO.actualizacion(entidad); + } + + public List buscar(String descDiagrama, Short maxparados,Short cantasientos) { + return diagramaAutobusDAO.buscar(descDiagrama, maxparados, cantasientos); + } + + public List buscar(String descDiagrama) { + return diagramaAutobusDAO.buscar(descDiagrama); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/DispositivoEmbarcadaHistoricoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/DispositivoEmbarcadaHistoricoServiceImpl.java new file mode 100644 index 000000000..8a8f4a71d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/DispositivoEmbarcadaHistoricoServiceImpl.java @@ -0,0 +1,51 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.DispositivoEmbarcadaDAO; +import com.rjconsultores.ventaboletos.dao.DispositivoEmbarcadaHistoricoDAO; +import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcada; +import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcadaHistorico; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.DispositivoEmbarcadaHistoricoService; +import com.rjconsultores.ventaboletos.service.DispositivoEmbarcadaService; + +/** + * + * @author Administrador + */ +@Service("dispositivoEmbarcadaHistoricoService") +public class DispositivoEmbarcadaHistoricoServiceImpl implements DispositivoEmbarcadaHistoricoService { + + @Autowired + private DispositivoEmbarcadaHistoricoDAO dispositivoEmbarcadaHistoricoDAO; + + @Override + public List obtenerTodos() { + return dispositivoEmbarcadaHistoricoDAO.obtenerTodos(); + } + + @Override + public DispositivoEmbarcadaHistorico suscribir(DispositivoEmbarcadaHistorico entidad) { + return dispositivoEmbarcadaHistoricoDAO.suscribir(entidad); + } + + @Override + public DispositivoEmbarcadaHistorico actualizacion(DispositivoEmbarcadaHistorico entity) { + return dispositivoEmbarcadaHistoricoDAO.actualizacion(entity); + } + + @Override + public List buscarHistoricoDispositivoPorId(Long dispositivoId) { + return dispositivoEmbarcadaHistoricoDAO.buscarHistoricoDispositivoPorId(dispositivoId); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/DispositivoEmbarcadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/DispositivoEmbarcadaServiceImpl.java new file mode 100644 index 000000000..b9d8b35a0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/DispositivoEmbarcadaServiceImpl.java @@ -0,0 +1,87 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.DispositivoEmbarcadaDAO; +import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcada; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.DispositivoEmbarcadaJaCadastradoException; +import com.rjconsultores.ventaboletos.service.DispositivoEmbarcadaService; + +/** + * + * @author Administrador + */ +@Service("dispositivoEmbarcadaService") +public class DispositivoEmbarcadaServiceImpl implements DispositivoEmbarcadaService { + + @Autowired + private DispositivoEmbarcadaDAO dispositivoEmbarcadaDAO; + + @Override + public List obtenerTodos() { + return dispositivoEmbarcadaDAO.obtenerTodos(); + } + + private void validaDispositivoJaCadastrado(DispositivoEmbarcada dispositivoEmbarcada) throws DispositivoEmbarcadaJaCadastradoException{ + if (buscarDispositivoPorId(dispositivoEmbarcada) == null) { + if (buscarImeiDuplicado(dispositivoEmbarcada.getImei()) != null) throw new DispositivoEmbarcadaJaCadastradoException("Já existe um dispositivo cadastrado com esse Imei"); + if (buscarVersaoUltimaSinc(dispositivoEmbarcada.getVersaoUltimaSinc()) != null) throw new DispositivoEmbarcadaJaCadastradoException("Já existe um dispositivo cadastrado com esse MAC"); + } + } + + @Override + public DispositivoEmbarcada suscribirActualizar(DispositivoEmbarcada dispositivoEmbarcada) throws DispositivoEmbarcadaJaCadastradoException { + validaDispositivoJaCadastrado(dispositivoEmbarcada); + return dispositivoEmbarcadaDAO.suscribirActualizar(dispositivoEmbarcada); + } + + @Override + public DispositivoEmbarcada buscarVersaoUltimaSinc(String versaoUltimaSinc) { + return dispositivoEmbarcadaDAO.buscarVersaoUltimaSinc(versaoUltimaSinc); + } + @Override + public List buscarAllVersaoUltimaSinc() { + return dispositivoEmbarcadaDAO.buscarAllVersaoUltimaSinc(); + } + + @Override + public DispositivoEmbarcada buscarImeiDuplicado(String imei) { + return dispositivoEmbarcadaDAO.buscarImeiDuplicado(imei); + } + + @Override + public DispositivoEmbarcada suscribir(DispositivoEmbarcada entidad) throws DispositivoEmbarcadaJaCadastradoException { + validaDispositivoJaCadastrado(entidad); + return dispositivoEmbarcadaDAO.suscribir(entidad); + } + + @Override + public DispositivoEmbarcada actualizacion(DispositivoEmbarcada entity) { + return dispositivoEmbarcadaDAO.actualizacion(entity); + } + + @Override + public DispositivoEmbarcada suscribirActualizacion(DispositivoEmbarcada entidad) { + return dispositivoEmbarcadaDAO.suscribirActualizar(entidad); + } + + @Override + public DispositivoEmbarcada buscarDispositivoPorId(DispositivoEmbarcada dispositivoEmbarcada) { + return dispositivoEmbarcadaDAO.buscarDispositivoPorId(dispositivoEmbarcada); + } + + @Override + public List buscarPorEmpresaPuntoVenta(Empresa empresa, PuntoVenta puntoventa) { + return dispositivoEmbarcadaDAO.buscarPorEmpresaPuntoVenta(empresa, puntoventa); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/DivisionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/DivisionServiceImpl.java new file mode 100644 index 000000000..4df426fca --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/DivisionServiceImpl.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.DivisionDAO; +import com.rjconsultores.ventaboletos.entidad.Division; +import com.rjconsultores.ventaboletos.service.DivisionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("divisionService") +public class DivisionServiceImpl implements DivisionService { + + @Autowired + private DivisionDAO divisionDAO; + + @Override + public List obtenerTodos() { + return divisionDAO.obtenerTodos(); + } + + @Override + public Division obtenerID(Integer id) { + return divisionDAO.obtenerID(id); + } + + @Override + @Transactional + public Division suscribir(Division entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return divisionDAO.suscribir(entidad); + } + + @Override + @Transactional + public Division actualizacion(Division entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return divisionDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(Division entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + divisionDAO.actualizacion(entidad); + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmbarcadaDispOperadorServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmbarcadaDispOperadorServiceImpl.java new file mode 100644 index 000000000..159e15035 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmbarcadaDispOperadorServiceImpl.java @@ -0,0 +1,73 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmbarcadaDispOperadorDAO; +import com.rjconsultores.ventaboletos.entidad.EmbarcadaDispOperador; +import com.rjconsultores.ventaboletos.service.EmbarcadaDispOperadorService; + +@Service("embarcadaDispOperadorService") +public class EmbarcadaDispOperadorServiceImpl implements EmbarcadaDispOperadorService { + + @Autowired + private EmbarcadaDispOperadorDAO embarcadaDispOperadorDAO; + @Override + public List obtenerTodos() { + return null; + } + + @Override + public EmbarcadaDispOperador obtenerID(Long id) { + return null; + } + + @Override + public EmbarcadaDispOperador suscribir(EmbarcadaDispOperador entidad) { + return null; + } + + @Override + public EmbarcadaDispOperador actualizacion(EmbarcadaDispOperador entidad) { + return null; + } + + @Override + public void borrar(EmbarcadaDispOperador entidad) { + + } + + @Override + public List buscarEmbarcadaDispOperadorPorDispositivo(Long dispositivoEmbarcadaId) { + return embarcadaDispOperadorDAO.buscarEmbarcadaDispOperadorPorDispositivo(dispositivoEmbarcadaId); + } + + @Override + public List buscarEmbarcadaDispOperadorPorPuntoVenta(Long puntoVentaId) { + return embarcadaDispOperadorDAO.buscarEmbarcadaDispOperadorPorPuntoVenta(puntoVentaId); + } + + @Override + public boolean removerListEmbarcadaDispOperador(List embarcadaDisOperadorList) { + return embarcadaDispOperadorDAO.removerListEmbarcadaDispOperador(embarcadaDisOperadorList); + + } + + @Transactional + @Override + public boolean inserirListEmbarcadaDispOperador(List embarcadaDisOperadorList) { + try { + embarcadaDispOperadorDAO.suscribirTodos(embarcadaDisOperadorList); + }catch (Exception e) { + return false; + } + return true; + } + + + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmbarqueCatracaRodoviariaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmbarqueCatracaRodoviariaServiceImpl.java new file mode 100644 index 000000000..2939142d6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmbarqueCatracaRodoviariaServiceImpl.java @@ -0,0 +1,44 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmbarqueCatracaRodoviariaDAO; +import com.rjconsultores.ventaboletos.entidad.EmbarqueCatracaRodoviaria; +import com.rjconsultores.ventaboletos.service.EmbarqueCatracaRodoviariaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("embarqueCatracaRodoviariaService") +public class EmbarqueCatracaRodoviariaServiceImpl implements EmbarqueCatracaRodoviariaService { + @Autowired + private EmbarqueCatracaRodoviariaDAO embarqueCatracaDAO; + + @Override + public List obtenerTodos() { + return embarqueCatracaDAO.obtenerTodos(); + } + + @Transactional + public EmbarqueCatracaRodoviaria suscribir(EmbarqueCatracaRodoviaria embarqueCatracaRodoviaria) { + embarqueCatracaRodoviaria.setFecModif(new Date()); + embarqueCatracaRodoviaria.setUsuario(UsuarioLogado.getUsuarioLogado()); + if (embarqueCatracaRodoviaria.getEmbarqueCatracaRodoviariaId() == null) { + return embarqueCatracaDAO.suscribir(embarqueCatracaRodoviaria); + } + return embarqueCatracaDAO.actualizacion(embarqueCatracaRodoviaria); + } + + @Transactional + public void borrar(EmbarqueCatracaRodoviaria entidad) { + entidad.setUsuario(UsuarioLogado.getUsuarioLogado()); + entidad.setFecModif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + embarqueCatracaDAO.actualizacion(entidad); + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpleadoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpleadoServiceImpl.java new file mode 100644 index 000000000..913b38a90 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpleadoServiceImpl.java @@ -0,0 +1,124 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ConductorDAO; +import com.rjconsultores.ventaboletos.dao.EmpleadoDAO; +import com.rjconsultores.ventaboletos.entidad.Conductor; +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.service.EmpleadoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("empleadoService") +public class EmpleadoServiceImpl implements EmpleadoService { + + private static int CONDUCTOR = 1; + + @Autowired + private EmpleadoDAO empleadoDAO; + @Autowired + private ConductorDAO conductorDAO; + + public List obtenerTodos() { + return empleadoDAO.obtenerTodos(); + } + + public Empleado obtenerID(Integer id) { + return empleadoDAO.obtenerID(id); + } + + @Transactional + public Empleado suscribir(Empleado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + Empleado result = empleadoDAO.suscribir(entidad); + + if (entidad.getTipoEmpleado().getTipoEmpleadoId() == CONDUCTOR){ + Conductor cond = new Conductor(); + cond.setActivo(Boolean.TRUE); + cond.setEmpleado(result); + cond.setFecmodif(Calendar.getInstance().getTime()); + cond.setNombconductor(entidad.getNombEmpleado()); + cond.setNomPaterno(entidad.getNombPaterno()); + cond.setNomMaterno(entidad.getNombMaterno()); + cond.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + conductorDAO.suscribir(cond); + } + + return result; + } + + @Transactional + public Empleado actualizacion(Empleado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getTipoEmpleado() != null && entidad.getTipoEmpleado().getTipoEmpleadoId() == CONDUCTOR){ + Conductor cond = conductorDAO.buscarPorEmpleado(entidad.getEmpleadoId()); + + if (cond == null) { + cond = new Conductor(); + } + cond.setActivo(Boolean.TRUE); + cond.setEmpleado(entidad); + cond.setFecmodif(Calendar.getInstance().getTime()); + cond.setNombconductor(entidad.getNombEmpleado()); + cond.setNomPaterno(entidad.getNombPaterno()); + cond.setNomMaterno(entidad.getNombMaterno()); + cond.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + if (cond.getConductorId() != null) { + conductorDAO.actualizacion(cond); + } else { + conductorDAO.suscribir(cond); + } + } + + return empleadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Empleado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + if (entidad.getTipoEmpleado().getTipoEmpleadoId() == CONDUCTOR) { + Conductor cond = conductorDAO.buscarPorEmpleado(entidad.getEmpleadoId()); + if (cond != null) { + cond.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cond.setFecmodif(Calendar.getInstance().getTime()); + cond.setActivo(Boolean.FALSE); + conductorDAO.actualizacion(cond); + } + } + + empleadoDAO.actualizacion(entidad); + } + + public List pesquisaClave(String empleadoClave) { + return empleadoDAO.pesquisaClave(empleadoClave); + } + + @Override + public List pesquisaEmpresa(Empresa empresa) { + return empleadoDAO.pesquisaEmpresa(empresa.getEmpresaId()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaContaBancariaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaContaBancariaServiceImpl.java new file mode 100644 index 000000000..d57237b83 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaContaBancariaServiceImpl.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaContaBancariaDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.EmpresaContaBancariaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("empresaContaBancariaService") +public class EmpresaContaBancariaServiceImpl implements EmpresaContaBancariaService { + + @Autowired + private EmpresaContaBancariaDAO empresaContaBancariaDAO; + + @Transactional + public EmpresaContaBancaria suscribirActualizacion(EmpresaContaBancaria entidad) throws BusinessException { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getEmpresaContaBancariaId() == null) { + + entidad = empresaContaBancariaDAO.suscribir(entidad); + +// gerarMarca(entidad); + + } else { + entidad = empresaContaBancariaDAO.actualizacion(entidad); + } + + return entidad; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailConfigServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailConfigServiceImpl.java new file mode 100644 index 000000000..3f4da312b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailConfigServiceImpl.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaEmailConfigDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailConfig; +import com.rjconsultores.ventaboletos.service.EmpresaEmailConfigService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("empresaEmailConfigService") +public class EmpresaEmailConfigServiceImpl implements EmpresaEmailConfigService { + + @Autowired + private EmpresaEmailConfigDAO empresaEmailConfigDAO; + + @Override + public List obtenerTodos() { + return empresaEmailConfigDAO.obtenerTodos(); + } + + @Override + public EmpresaEmailConfig obtenerID(Integer id) { + return empresaEmailConfigDAO.obtenerID(id); + } + + @Override + @Transactional + public EmpresaEmailConfig suscribir(EmpresaEmailConfig entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaEmailConfigDAO.suscribir(entidad); + } + + @Override + @Transactional + public EmpresaEmailConfig actualizacion(EmpresaEmailConfig entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaEmailConfigDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(EmpresaEmailConfig entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaEmailConfigDAO.actualizacion(entidad); + + } + + @Override + public EmpresaEmailConfig buscarPorEmpresa(Empresa empresa) { + return empresaEmailConfigDAO.buscarPorEmpresa(empresa); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailFlexBusServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailFlexBusServiceImpl.java new file mode 100644 index 000000000..cac22e366 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailFlexBusServiceImpl.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaEmailFlexBusDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailFlexBus; +import com.rjconsultores.ventaboletos.service.EmpresaEmailFlexBusService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("empresaEmailFlexBUsService") +public class EmpresaEmailFlexBusServiceImpl implements EmpresaEmailFlexBusService { + + @Autowired + private EmpresaEmailFlexBusDAO empresaEmailDAO; + + @Override + public List obtenerTodos() { + return empresaEmailDAO.obtenerTodos(); + } + + @Override + public EmpresaEmailFlexBus obtenerID(Integer id) { + return empresaEmailDAO.obtenerID(id); + } + + @Override + @Transactional + public EmpresaEmailFlexBus suscribir(EmpresaEmailFlexBus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaEmailDAO.suscribir(entidad); + } + + @Override + @Transactional + public EmpresaEmailFlexBus actualizacion(EmpresaEmailFlexBus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaEmailDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(EmpresaEmailFlexBus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaEmailDAO.actualizacion(entidad); + + } + + @Override + public EmpresaEmailFlexBus buscarPorEmpresa(Empresa empresa) { + return empresaEmailDAO.buscarPorEmpresa(empresa); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailServiceImpl.java new file mode 100644 index 000000000..5590030ef --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailServiceImpl.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaEmailDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmail; +import com.rjconsultores.ventaboletos.service.EmpresaEmailService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("empresaEmailService") +public class EmpresaEmailServiceImpl implements EmpresaEmailService { + + @Autowired + private EmpresaEmailDAO empresaEmailDAO; + + @Override + public List obtenerTodos() { + return empresaEmailDAO.obtenerTodos(); + } + + @Override + public EmpresaEmail obtenerID(Integer id) { + return empresaEmailDAO.obtenerID(id); + } + + @Override + @Transactional + public EmpresaEmail suscribir(EmpresaEmail entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaEmailDAO.suscribir(entidad); + } + + @Override + @Transactional + public EmpresaEmail actualizacion(EmpresaEmail entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaEmailDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(EmpresaEmail entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaEmailDAO.actualizacion(entidad); + + } + + @Override + public EmpresaEmail buscarPorEmpresa(Empresa empresa) { + return empresaEmailDAO.buscarPorEmpresa(empresa); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEquivalenciaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEquivalenciaServiceImpl.java new file mode 100644 index 000000000..0e6248b58 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEquivalenciaServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.EmpresaEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEquivalencia; +import com.rjconsultores.ventaboletos.service.EmpresaEquivalenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("empresaEquivalenciaService") +public class EmpresaEquivalenciaServiceImpl implements EmpresaEquivalenciaService { + + @Autowired + private EmpresaEquivalenciaDAO empresaEquivalenciaDAO; + + public List obtenerTodos() { + return empresaEquivalenciaDAO.obtenerTodos(); + } + + public EmpresaEquivalencia obtenerID(Integer id) { + return empresaEquivalenciaDAO.obtenerID(id); + } + + @Transactional + public EmpresaEquivalencia suscribir(EmpresaEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaEquivalenciaDAO.suscribir(entidad); + } + + @Transactional + public EmpresaEquivalencia actualizacion(EmpresaEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaEquivalenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EmpresaEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaEquivalenciaDAO.actualizacion(entidad); + } + + public List buscar(Empresa empresa, ComisionistaExterno comisionistaExterno) { + return empresaEquivalenciaDAO.buscar(empresa, comisionistaExterno); + } + + public List buscarEquivalencia(EmpresaEquivalencia empresaEquivalencia) { + return empresaEquivalenciaDAO.buscar(empresaEquivalencia); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaImpostoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaImpostoServiceImpl.java new file mode 100644 index 000000000..7c313e7d0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaImpostoServiceImpl.java @@ -0,0 +1,89 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaImpostoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaImposto; +import com.rjconsultores.ventaboletos.service.EmpresaImpostoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("empresaImpostoService") +public class EmpresaImpostoServiceImpl implements EmpresaImpostoService { + + @Autowired + private EmpresaImpostoDAO empresaImpostoDAO; + + @Transactional + public EmpresaImposto suscribir(EmpresaImposto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaImpostoDAO.suscribir(entidad); + } + + /* + * (non-Javadoc) + * + * @see com.rjconsultores.ventaboletos.service.GenericService#obtenerTodos() + */ + @Override + public List obtenerTodos() { + // TODO Auto-generated method stub + return null; + } + + /* + * (non-Javadoc) + * + * @see com.rjconsultores.ventaboletos.service.GenericService#obtenerID(java.lang.Object) + */ + @Override + public EmpresaImposto obtenerID(Integer id) { + return empresaImpostoDAO.obtenerID(id); + } + + @Transactional + public EmpresaImposto actualizacion(EmpresaImposto entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + return empresaImpostoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EmpresaImposto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaImpostoDAO.actualizacion(entidad); + + } + + @Override + public List buscarByEmpresa(Empresa empresa) { + return empresaImpostoDAO.buscarByEmpresa(empresa); + + } + + @Override + public List buscarEmpresaImposto(Integer empresaId) { + return empresaImpostoDAO.buscarEmpresaImposto(empresaId); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaSaferConfigServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaSaferConfigServiceImpl.java new file mode 100644 index 000000000..9715e637b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaSaferConfigServiceImpl.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaSaferConfigDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaSaferConfig; +import com.rjconsultores.ventaboletos.service.EmpresaSaferConfigService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("empresaSaferConfigService") +public class EmpresaSaferConfigServiceImpl implements EmpresaSaferConfigService { + + @Autowired + private EmpresaSaferConfigDAO empresaSaferConfigDAO; + + @Override + public List obtenerTodos() { + return empresaSaferConfigDAO.obtenerTodos(); + } + + @Override + public EmpresaSaferConfig obtenerID(Integer id) { + return empresaSaferConfigDAO.obtenerID(id); + } + + @Override + @Transactional + public EmpresaSaferConfig suscribir(EmpresaSaferConfig entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaSaferConfigDAO.suscribir(entidad); + } + + @Override + @Transactional + public EmpresaSaferConfig actualizacion(EmpresaSaferConfig entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaSaferConfigDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(EmpresaSaferConfig entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaSaferConfigDAO.actualizacion(entidad); + + } + + @Override + public EmpresaSaferConfig buscarPorEmpresa(Empresa empresa) { + return empresaSaferConfigDAO.buscarPorEmpresa(empresa); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java new file mode 100644 index 000000000..ff4ba511f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java @@ -0,0 +1,224 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaDAO; +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.dao.RutaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.ComEmpCategoria; +import com.rjconsultores.ventaboletos.entidad.ComEmpConferencia; +import com.rjconsultores.ventaboletos.entidad.ComEmpFormapago; +import com.rjconsultores.ventaboletos.entidad.ComEmpTipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.service.MarcaService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("empresaService") +public class EmpresaServiceImpl implements EmpresaService { + + @Autowired + private EmpresaDAO empresaDAO; + + @Autowired + private MarcaService marcaService; + + @Autowired + private RutaEmpresaDAO rutaEmpresaDAO; + + @Autowired + private EsquemaCorridaDAO esquemaCorridaDAO; + + public List obtenerTodos() { + return empresaDAO.obtenerTodos(); + } + + public Empresa obtenerID(Integer id) { + return empresaDAO.obtenerID(id); + } + + @Transactional + public Empresa suscribirActualizacion(Empresa entidad) throws BusinessException { + ComEmpConferencia comEmpConferencia = null; + if (entidad.getComEmpConferencias() != null && !entidad.getComEmpConferencias().isEmpty()) { + comEmpConferencia = entidad.getComEmpConferencias().iterator().next(); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getEmpresaId() == null) { + + entidad = empresaDAO.suscribir(entidad); + + gerarMarca(entidad); + + } else { + entidad = empresaDAO.actualizacion(entidad); + } + + if (comEmpConferencia != null) { + comEmpConferencia.setEmpresa(entidad); + suscribirOrActualizacion(comEmpConferencia); + } + + return entidad; + } + + private void gerarMarca(Empresa empresa) { + + Marca marca = new Marca(); + + marca.setEmpresa(empresa); + marca.setDescmarca(empresa.getNombempresa()); + + marcaService.suscribir(marca); + + } + + @Transactional + public void borrar(Empresa entidad) throws RegistroConDependenciaException { + if ((rutaEmpresaDAO.obtenerPorEmpresa(entidad).size() > 0) || + (esquemaCorridaDAO.buscarPorEmpresaCorrida(entidad).size() > 0)) { + throw new RegistroConDependenciaException(); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaDAO.actualizacion(entidad); + } + + public List buscar(String nombempresa, Boolean indExterna, Short indTipo) { + return empresaDAO.buscar(nombempresa, indExterna, indTipo); + } + + public List buscarTodosExceto(List empresa, Integer... idEmpresa) { + return empresaDAO.buscarTodosExceto(empresa, idEmpresa); + } + + public List obtenerIndExternoFalse() { + return empresaDAO.obtenerIndExternoFalse(); + } + + public List obtenerIndTipo2() { + return empresaDAO.obtenerIndTipo2(); + } + + /* + * (non-Javadoc) + * + * @see com.rjconsultores.ventaboletos.service.EmpresaService#buscarNotInPuntoVtaComissao(com.rjconsultores.ventaboletos.entidad.PuntoVenta) + */ + @Override + public List buscarNotInPuntoVtaComissao(PuntoVenta puntoVenta) { + return empresaDAO.buscarNotInPuntoVtaComissao(puntoVenta); + + } + + @Override + public List buscaInscricoesEstaduais(Empresa empresa) { + return empresaDAO.buscaInscricoesEstaduais(empresa); + } + + @Override + public void actualizaInscEstadual(InscricaoEstadual inscricaoEstadual) { + empresaDAO.actualizaInscEstadual(inscricaoEstadual); + } + + @Override + public List buscaLike(String nombempresa) { + return empresaDAO.buscaLike(nombempresa); + } + + @Override + public ComEmpCategoria adicionarComissaoCategoria(ComEmpCategoria comEmpCategoria) { + comEmpCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpCategoria.setFecmodif(Calendar.getInstance().getTime()); + comEmpCategoria.setActivo(Boolean.TRUE); + return empresaDAO.adicionarComissaoCategoria(comEmpCategoria); + } + + @Override + public void removerComissaoCategoria(ComEmpCategoria comEmpCategoria) { + comEmpCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpCategoria.setFecmodif(Calendar.getInstance().getTime()); + comEmpCategoria.setActivo(Boolean.FALSE); + empresaDAO.removerComissaoCategoria(comEmpCategoria); + } + + @Override + public ComEmpFormapago adicionarComissaoFormapago(ComEmpFormapago comEmpFormapago) { + comEmpFormapago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpFormapago.setFecmodif(Calendar.getInstance().getTime()); + comEmpFormapago.setActivo(Boolean.TRUE); + return empresaDAO.adicionarComissaoFormapago(comEmpFormapago); + } + + @Override + public void removerComissaoFormapago(ComEmpFormapago comEmpFormapago) { + comEmpFormapago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpFormapago.setFecmodif(Calendar.getInstance().getTime()); + comEmpFormapago.setActivo(Boolean.FALSE); + empresaDAO.removerComissaoFormapago(comEmpFormapago); + } + + @Override + public ComEmpTipoEventoExtra adicionarComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra) { + comEmpTipoEventoExtra.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpTipoEventoExtra.setFecmodif(Calendar.getInstance().getTime()); + comEmpTipoEventoExtra.setActivo(Boolean.TRUE); + return empresaDAO.adicionarComissaoTipoEventoExtra(comEmpTipoEventoExtra); + } + + @Override + public void removerComissaoTipoEventoExtra(ComEmpTipoEventoExtra comEmpTipoEventoExtra) { + comEmpTipoEventoExtra.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpTipoEventoExtra.setFecmodif(Calendar.getInstance().getTime()); + comEmpTipoEventoExtra.setActivo(Boolean.FALSE); + empresaDAO.removerComissaoTipoEventoExtra(comEmpTipoEventoExtra); + } + + @Override + public List obtenerTodosIncluindoEmpresaTodas() { + return empresaDAO.obtenerTodosIncluindoEmpresaTodas(); + } + + @Override + @Transactional + public ComEmpConferencia suscribirOrActualizacion(ComEmpConferencia comEmpConferencia) { + comEmpConferencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + comEmpConferencia.setFecmodif(Calendar.getInstance().getTime()); + comEmpConferencia.setActivo(Boolean.TRUE); + if (comEmpConferencia.getComempconferenciaId() == null) { + return empresaDAO.suscribir(comEmpConferencia); + } else { + return empresaDAO.actualizacion(comEmpConferencia); + } + } + + @Override + public List buscarEmpresaPtoVtaComissao() { + return empresaDAO.buscarEmpresaPtoVtaComissao(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaTrocoSimplesServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaTrocoSimplesServiceImpl.java new file mode 100644 index 000000000..baa0bfdb7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaTrocoSimplesServiceImpl.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaTrocoSimplesDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaTrocoSimples; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.EmpresaTrocoSimplesService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("empresaTrocoSimplesService") +public class EmpresaTrocoSimplesServiceImpl implements EmpresaTrocoSimplesService { + + @Autowired + private EmpresaTrocoSimplesDAO empresaTrocoDAO; + + @Transactional(rollbackFor = BusinessException.class) + @Override + public EmpresaTrocoSimples suscribirActualizar(EmpresaTrocoSimples empresaTroco) throws BusinessException { + + empresaTroco.setFecmodif(new Date()); + empresaTroco.setUsuario(UsuarioLogado.getUsuarioLogado()); + + if (empresaTroco.getEmpresaTrocoSimplesId() == null) { + empresaTroco = empresaTrocoDAO.suscribir(empresaTroco); + } else { + empresaTroco = empresaTrocoDAO.actualizacion(empresaTroco); + } + + return empresaTroco; + } + + @Transactional + @Override + public void apagar(EmpresaTrocoSimples empresaTroco) throws BusinessException { + empresaTrocoDAO.borrar(empresaTroco); + } + + @Override + public EmpresaTrocoSimples buscarEmpresaTrocoSimplesPorEmpresaId(Integer empresaID) { + return empresaTrocoDAO.buscarPorEmpresaId(empresaID); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EnderecoApanheServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EnderecoApanheServiceImpl.java new file mode 100644 index 000000000..a28c05971 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EnderecoApanheServiceImpl.java @@ -0,0 +1,74 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EnderecoApanheDAO; +import com.rjconsultores.ventaboletos.dao.VendaPacoteDAO; +import com.rjconsultores.ventaboletos.entidad.EnderecoApanhe; +import com.rjconsultores.ventaboletos.entidad.VendaPacote; +import com.rjconsultores.ventaboletos.service.EnderecoApanheService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("enderecoApanheService") +public class EnderecoApanheServiceImpl implements EnderecoApanheService { + + @Autowired + private EnderecoApanheDAO enderecoApanheDAO; + + @Autowired + private VendaPacoteDAO vendaPacoteDAO; + + public List obtenerTodos() { + return enderecoApanheDAO.obtenerTodos(); + } + + public EnderecoApanhe obtenerID(Long id) { + return enderecoApanheDAO.obtenerID(id); + } + + @Transactional + public EnderecoApanhe suscribir(EnderecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + atualizarVendaPacote(entidad.getVendaPacote()); + + return enderecoApanheDAO.suscribir(entidad); + } + + @Transactional + public EnderecoApanhe actualizacion(EnderecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + atualizarVendaPacote(entidad.getVendaPacote()); + + return enderecoApanheDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EnderecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + enderecoApanheDAO.actualizacion(entidad); + } + + public List buscar(Date datapacote, String numoperacion) { + return enderecoApanheDAO.buscar(datapacote, numoperacion); + } + + private void atualizarVendaPacote(VendaPacote vendaPacote) { + vendaPacoteDAO.actualizacion(vendaPacoteDAO.obtenerID(vendaPacote.getVendapacoteId())); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EscolaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EscolaServiceImpl.java new file mode 100644 index 000000000..c0d29812c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EscolaServiceImpl.java @@ -0,0 +1,61 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EscolaDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Escola; +import com.rjconsultores.ventaboletos.service.EscolaService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("escolaService") +public class EscolaServiceImpl implements EscolaService { + + @Autowired + private EscolaDAO EscolaDAO; + public List obtenerTodos() { + return EscolaDAO.obtenerTodos(); + } + + public Escola obtenerID(Integer id) { + return EscolaDAO.obtenerID(id); + } + + @Transactional + public Escola suscribir(Escola entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return EscolaDAO.suscribir(entidad); + } + + @Transactional + public Escola actualizacion(Escola entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return EscolaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Escola entidad) throws RegistroConDependenciaException { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + EscolaDAO.actualizacion(entidad); + } + + public List buscar(String nombEscola, Ciudad ciudad) { + return EscolaDAO.buscar(nombEscola, ciudad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAgrupacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAgrupacionServiceImpl.java new file mode 100644 index 000000000..2d9b5cf01 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAgrupacionServiceImpl.java @@ -0,0 +1,77 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EsquemaAgrupacionDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaAgrupacion; +import com.rjconsultores.ventaboletos.service.EsquemaAgrupacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author RJ Consultores + */ +@Service("esquemaAgrupacionService") +public class EsquemaAgrupacionServiceImpl implements EsquemaAgrupacionService { + + @Autowired + private EsquemaAgrupacionDAO esquemaAgrupacionDAO; + + public List obtenerTodos() { + return esquemaAgrupacionDAO.obtenerTodos(); + } + + public EsquemaAgrupacion obtenerID(Integer id) { + return esquemaAgrupacionDAO.obtenerID(id); + } + + @Transactional + public EsquemaAgrupacion suscribir(EsquemaAgrupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaAgrupacionDAO.suscribir(entidad); + } + + @Transactional + public EsquemaAgrupacion actualizacion(EsquemaAgrupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaAgrupacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EsquemaAgrupacion entidad) { + entidad = (entidad.getEsquemaagrupacionId() == null) ? entidad : esquemaAgrupacionDAO.obtenerID(entidad.getEsquemaagrupacionId()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + esquemaAgrupacionDAO.actualizacion(entidad); + } + + public List buscar(EsquemaAgrupacion esquemaAgrupacion) { + return esquemaAgrupacionDAO.buscar(esquemaAgrupacion); + } + + @Override + public EsquemaAgrupacion obtenerByEsquemaAgrupacion(Integer id) { + return esquemaAgrupacionDAO.obtenerByEsquemaAgrupacion(id); + } + + public boolean buscarNumAgrupacion(Integer numAgrupacion) { + return esquemaAgrupacionDAO.buscarNumAgrupacion(numAgrupacion); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAsientoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAsientoServiceImpl.java new file mode 100644 index 000000000..fd5bb9fa2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaAsientoServiceImpl.java @@ -0,0 +1,235 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EsquemaAsientoDAO; +import com.rjconsultores.ventaboletos.dao.RutaSecuenciaDAO; +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.EsquemaAsiento; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.DiagramaAutobusService; +import com.rjconsultores.ventaboletos.service.EsquemaAsientoService; +import com.rjconsultores.ventaboletos.service.RutaSecuenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("esquemaAsientoService") +public class EsquemaAsientoServiceImpl implements EsquemaAsientoService { + + private static Logger log = LoggerFactory.getLogger(EsquemaAsientoServiceImpl.class); + private static final String BLOQUEO_EXCLUSIVO = "BLOQUEO_EXCLUSIVO"; + private static final String BLOQUEO_OCUPACION = "BLOQUEO_OCUPACION"; + + @Autowired + private EsquemaAsientoDAO esquemaAsientoDAO; + + @Autowired + private RutaSecuenciaDAO rutaSecuenciaDAO; + + @Autowired + private DiagramaAutobusService diagramaAutobusService; + + @Autowired + private RutaSecuenciaService rutaSecuenciaService; + + private EsquemaAsiento suscribir(EsquemaAsiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaAsientoDAO.suscribir(entidad); + } + + @Transactional + public void borrar(EsquemaAsiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + esquemaAsientoDAO.actualizacion(entidad); + } + + public List obtenerPorCorrida(EsquemaCorrida esquemaCorrida) { + return esquemaAsientoDAO.obtenerPorCorrida(esquemaCorrida); + } + + public EsquemaAsiento obtenerPorCorridaeAsiento(EsquemaCorrida esquemaCorrida, String asiento) { + return esquemaAsientoDAO.obtenerPorCorridaeAsiento(esquemaCorrida, asiento); + } + + @Transactional(rollbackFor = BusinessException.class) + @Override + public void bloqueoAsientoExclusivo(EsquemaCorrida esquemaCorrida, String strAsiento, Parada origen, Parada destino, Integer tiempoLiberacion) throws BusinessException { + + if (origen == null) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.origenObligatoria"); + } + + hacerBloqueo(BLOQUEO_EXCLUSIVO, esquemaCorrida, strAsiento, origen, destino, null, tiempoLiberacion); + } + + private boolean hacerBloqueo(String tipoBloqueo, EsquemaCorrida esquemaCorrida, String strAsiento, Parada origen, Parada destino, String motivoOcupacion, Integer tiempoLiberacion) throws BusinessException { + List asientos = cargarAsientos(strAsiento); + + DiagramaAutobus da = diagramaAutobusService.obtenerID(esquemaCorrida.getRolOperativo().getDiagramaAutobus().getDiagramaautobusId()); + + for (String asiento : asientos) { + + boolean vende = true; + boolean existe = false; + List listDda = da.getDetDiagramaAutobusList(); + for (DetDiagramaAutobus dd : listDda) { + if (dd.getAsiento().equals(asiento)) { + existe = true; + if (!dd.getVendible()) { + vende = false; + } + } + } + if (!existe) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.invalido"); + } + + if (vende) { + + if (reviseAsientoBloqueado(asiento, esquemaCorrida, origen, destino)) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.poltronaJahConfigurada", new Object[] { asiento }); + } + + EsquemaAsiento es = new EsquemaAsiento(); + es.setActivo(Boolean.TRUE); + es.setFecmodif(Calendar.getInstance().getTime()); + es.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + es.setNumasiento(asiento.toString()); + es.setTiempoLiberacion(tiempoLiberacion); + + if (tipoBloqueo.equals(BLOQUEO_EXCLUSIVO)) { + es.setIndvendible(Boolean.TRUE); + es.setParada(origen); + } else { + es.setIndvendible(Boolean.FALSE); + es.setParada(origen); + es.setDestino(destino); + es.setMotivobloqueo(motivoOcupacion); + } + + es.setEsquemaCorrida(esquemaCorrida); + es = suscribir(es); + + // validação extra para garantir que salvou corretamente + if (tipoBloqueo.equals(BLOQUEO_EXCLUSIVO)) { + + if (!(es.getIndvendible() && (es.getParada() != null) && (es.getDestino() == null))) { + + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.validacionGrabacion"); + } + + } else { + // validação extra para garantir que salvou corretamente + if (!(!es.getIndvendible() && (es.getParada() != null) && (es.getDestino() != null))) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.validacionGrabacion"); + } + } + + } else { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.poltronaNoVendible", new Object[] { asiento }); + } + } + + return true; + } + + private boolean reviseAsientoBloqueado(String asiento, EsquemaCorrida esquemaCorrida, Parada origen, Parada destino) { + + List numSequenciaOcupada = rutaSecuenciaService.obtenerNumRutaSecuenciaOcupadaPorCorridaAsiento(esquemaCorrida, asiento); + List numSequenciaSeleccionado = rutaSecuenciaService.obtenerNumRutaSecuenciaPorCorridaOrigemDestino(esquemaCorrida, origen, destino); + for (Short numSequencia : numSequenciaSeleccionado) { + if (numSequenciaOcupada.contains(numSequencia.intValue())) { + return true; + } + } + + return false; + + } + + @Transactional(rollbackFor = BusinessException.class) + @Override + public void bloqueoAsientoOcupacion(EsquemaCorrida esquemaCorrida, String strAsiento, Parada origen, Parada destino, Integer tiempoLiberacion, String motivoOcupacion) throws BusinessException { + + if (origen == null) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.origenObligatoria"); + } + if (destino == null) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.destinoObligatoria"); + } + if (StringUtils.isBlank(motivoOcupacion)) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.motivo"); + } + + if (!rutaSecuenciaDAO.paradaSecuenciaValida(esquemaCorrida.getRuta(), origen, destino)) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.tramo"); + } + + hacerBloqueo(BLOQUEO_OCUPACION, esquemaCorrida, strAsiento, origen, destino, motivoOcupacion, tiempoLiberacion); + } + + /** + * Hace la conversion de la string strAsientos en una lista de asientos válidos
+ * + * @param strAsientos + * @return + * @throws BusinessException + */ + private List cargarAsientos(String strAsientos) throws BusinessException { + List todosAsientos = new ArrayList(); + + try { + String asientos[] = strAsientos.split(","); + + for (int i = 0; i < asientos.length; i++) { + if (asientos[i].contains("-")) { + String intervalo[] = asientos[i].split("-"); + Integer ini = Integer.parseInt(intervalo[0]); + Integer fim = Integer.parseInt(intervalo[1]); + + while (ini <= fim) { + todosAsientos.add(ini.toString()); + ini++; + } + } else { + Integer.parseInt(asientos[i]);// para validar + todosAsientos.add(asientos[i]); + } + } + } catch (NumberFormatException t) { + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.invalido"); + } catch (Throwable t) { + log.error("", t); + + throw new BusinessException("editarConfiguracionCorridaAsientoController.MSG.invalido"); + } + + return todosAsientos; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EsquemaCorridaEmbarqueDesembarqueServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaCorridaEmbarqueDesembarqueServiceImpl.java new file mode 100644 index 000000000..f21d80e52 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaCorridaEmbarqueDesembarqueServiceImpl.java @@ -0,0 +1,54 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaEmbarqueDesembarqueDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorridaEmbarqueDesembarque; +import com.rjconsultores.ventaboletos.service.EsquemaCorridaEmbarqueDesembarqueService; + +@Service("esquemaCorridaEmbarqueDesembarqueService") +public class EsquemaCorridaEmbarqueDesembarqueServiceImpl implements EsquemaCorridaEmbarqueDesembarqueService { + + @Autowired + private EsquemaCorridaEmbarqueDesembarqueDAO esquemaCorridaEmbarqueDesembarqueDAO; + + @Override + public List obtenerTodos() { + return esquemaCorridaEmbarqueDesembarqueDAO.obtenerTodos(); + } + + @Override + public EsquemaCorridaEmbarqueDesembarque obtenerID(Integer id) { + return esquemaCorridaEmbarqueDesembarqueDAO.obtenerID(id); + } + + @Transactional + @Override + public EsquemaCorridaEmbarqueDesembarque suscribir(EsquemaCorridaEmbarqueDesembarque entidad) { + return esquemaCorridaEmbarqueDesembarqueDAO.suscribir(entidad); + } + + @Transactional + @Override + public EsquemaCorridaEmbarqueDesembarque actualizacion(EsquemaCorridaEmbarqueDesembarque entidad) { + return esquemaCorridaEmbarqueDesembarqueDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(EsquemaCorridaEmbarqueDesembarque entidad) { + esquemaCorridaEmbarqueDesembarqueDAO.borrar(entidad); + } + + @Override + public List obtenerPorEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + return esquemaCorridaEmbarqueDesembarqueDAO.obtenerPorEsquemaCorrida(esquemaCorrida); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EsquemaCorridaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaCorridaServiceImpl.java new file mode 100644 index 000000000..f753c5b39 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaCorridaServiceImpl.java @@ -0,0 +1,303 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EsquemaAsientoDAO; +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.dao.EsquemaTramoDAO; +import com.rjconsultores.ventaboletos.dao.RutaCombinacionDAO; +import com.rjconsultores.ventaboletos.entidad.Autobus; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaAsiento; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import com.rjconsultores.ventaboletos.entidad.EsquemaTramo; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaEsquema; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.service.EsquemaAsientoService; +import com.rjconsultores.ventaboletos.service.EsquemaCorridaService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("esquemaCorridaService") +public class EsquemaCorridaServiceImpl implements EsquemaCorridaService { + + private static Logger log = Logger.getLogger(EsquemaCorridaServiceImpl.class); + + @Autowired + private EsquemaCorridaDAO esquemaCorridaDAO; + @Autowired + private RutaCombinacionDAO rutaCombinacionDAO; + @Autowired + private EsquemaTramoDAO esquemaTramoDAO; + @Autowired + private EsquemaAsientoService esquemaAsientoService; + @Autowired + private EsquemaAsientoDAO esquemaAsientoDAO; + + @Autowired + private LogAuditoriaService logAuditoriaService; + + public List obtenerTodos() { + return esquemaCorridaDAO.obtenerTodos(); + } + + public EsquemaCorrida obtenerID(Integer id) { + EsquemaCorrida esquemaCorrida = esquemaCorridaDAO.obtenerID(id); + try { + esquemaCorrida.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return esquemaCorrida; + } + + @Override + public List buscarPorEmpresaCorrida(Empresa empresa) { + return esquemaCorridaDAO.buscarPorEmpresaCorrida(empresa); + } + + @Transactional + public EsquemaCorrida suscribir(EsquemaCorrida entidad) { + List asientos = new ArrayList(); + // org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing + asientos.addAll(entidad.getEsquemaAsientoList()); + entidad.clearEsquemaAsiento(); + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + Autobus a = entidad.getAutoBus(); + ClaseServicio c = entidad.getClaseServicio(); + RolOperativo r = entidad.getRolOperativo(); + + entidad.setAutoBus(null); + entidad.setClaseServicio(null); + entidad.setRolOperativo(null); + + entidad = esquemaCorridaDAO.suscribir(entidad); + + for (EsquemaAsiento esquemaAsiento : asientos) { + esquemaAsiento = esquemaAsientoDAO.suscribir(esquemaAsiento); + } + + entidad.setAutoBus(a); + entidad.setClaseServicio(c); + entidad.setRolOperativo(r); + entidad.setEsquemaAsientoList(asientos); + + entidad = esquemaCorridaDAO.actualizacion(entidad); + + logAuditoriaService.auditar(null, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + + return entidad; + } + + @Transactional + public EsquemaCorrida actualizacion(EsquemaCorrida entidad) { + try { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + EsquemaCorrida clone = entidad.getCloneObject(); + + entidad = esquemaCorridaDAO.actualizacion(entidad); + entidad.clonar(); + EsquemaCorrida novoClone = entidad.getCloneObject(); + + novoClone.setEsquemaAsientoList(null); + List lsAsientos = esquemaAsientoService.obtenerPorCorrida(entidad); + if(lsAsientos != null) { + List lsNovoAsientos = new ArrayList(); + for (EsquemaAsiento esquemaAsiento : lsAsientos) { + esquemaAsiento.clonar(); + lsNovoAsientos.add(esquemaAsiento.getCloneObject()); + } + novoClone.setEsquemaAsientoList(lsNovoAsientos); + } + + logAuditoriaService.auditar(clone, novoClone, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + + return entidad; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new RuntimeException(e.getMessage(), e); + } + + } + + @Transactional + public void borrar(EsquemaCorrida entidad) { + entidad = (entidad.getEsquemacorridaId() == null) ? entidad : esquemaCorridaDAO.obtenerID(entidad.getEsquemacorridaId()); + for (EsquemaAsiento pricing : entidad.getEsquemaAsientoList()) { + pricing.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricing.setFecmodif(Calendar.getInstance().getTime()); + pricing.setActivo(Boolean.FALSE); + pricing = esquemaAsientoDAO.actualizacion(pricing); + } + + for (EsquemaTramo pricing : entidad.getEsquemaTramoList()) { + pricing.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricing.setFecmodif(Calendar.getInstance().getTime()); + pricing.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + logAuditoriaService.auditarExclusao(entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + + esquemaCorridaDAO.actualizacion(entidad); + } + + public List buscarPorEsquemaOperacional(EsquemaOperacional eo) { + return esquemaCorridaDAO.buscarPorEsquemaOperacional(eo); + } + + public List buscar(Marca marca, RolOperativo rolOperativo, + Ruta ruta, ClaseServicio claseServicio) { + return esquemaCorridaDAO.buscar(marca, rolOperativo, ruta, claseServicio); + } + + public boolean buscarNumCorrida(Integer numCorrida, Integer numCorridaPisoExtra, boolean isDoublePiso) { + return esquemaCorridaDAO.buscarNumCorrida(numCorrida, numCorridaPisoExtra, isDoublePiso); + } + + public EsquemaCorrida buscarPeloNumCorrida(Integer numCorridaPisoExtra) { + return esquemaCorridaDAO.buscarPeloNumCorrida(numCorridaPisoExtra); + } + + @Transactional + public void actualizaEsquemaTramo(List listParadaEsquema, EsquemaCorrida ec) { + + try { + + ec = this.obtenerID(ec.getEsquemacorridaId()); + ec.clonar(); + EsquemaCorrida originalClone = ec.getCloneObject(); + ec.clonar(); + EsquemaCorrida novoClone = ec.getCloneObject(); + List lsTramosNovo = new ArrayList(); + + if (ec.getEsquemaTramoList() != null) { + for (EsquemaTramo et : ec.getEsquemaTramoList()) { + et.setActivo(Boolean.FALSE); + et.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + et.setFecmodif(Calendar.getInstance().getTime()); + esquemaTramoDAO.actualizacion(et); + } + } + + Date dataHorInicioSistema = DateUtil.getFecInicio().getTime(); + for (int i = 0; (i < listParadaEsquema.size() - 1); i++) { + Parada paradaOrigen = listParadaEsquema.get(i).getParada(); + Parada paradaDestino = listParadaEsquema.get(i + 1).getParada(); + + Tramo t = rutaCombinacionDAO.busqueda(ec.getRuta(), paradaOrigen, paradaDestino); + + if (t == null) { + throw new RuntimeException("No fue encontrado el tramo para el origen:" + paradaOrigen + " y destino:" + paradaDestino); + } + + EsquemaTramo et = new EsquemaTramo(); + et.setActivo(Boolean.TRUE); + et.setEsquemaCorrida(ec); + et.setFecmodif(Calendar.getInstance().getTime()); + et.setNumsecuencia((short) (i + 1)); + et.setTramo(t); + et.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + et.setPlataforma(listParadaEsquema.get(i).getPlataforma()); + et.setTipoPassagem(listParadaEsquema.get(i).getTipoPassagem()); + Date tiempoEstancia = listParadaEsquema.get(i).getTiempoEstancia(); + if ((tiempoEstancia != null) && (DateUtil.compareDate(tiempoEstancia, dataHorInicioSistema) == 0)) { + et.setTiempoEstancia(null); + } else { + et.setTiempoEstancia(tiempoEstancia); + } + + Date excepcionRecorrido = listParadaEsquema.get(i).getExcepcionRecorrido(); + if ((excepcionRecorrido != null) && (DateUtil.compareDate(excepcionRecorrido, dataHorInicioSistema) == 0)) { + et.setExcepcionRecorrido(null); + } else { + et.setExcepcionRecorrido(excepcionRecorrido); + } + if(esquemaTramoDAO.verificarDuplicidadeEsquemaTramo(et)){ + throw new RuntimeException("No es possible suscribir tramos duplicados."); + } + esquemaTramoDAO.suscribir(et); + + lsTramosNovo.add(et); + } + novoClone.setEsquemaTramoList(lsTramosNovo); + + logAuditoriaService.auditar(originalClone, novoClone, ec.getEmpresa() != null ? ec.getEmpresa().getEmpresaId() : null); + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new RuntimeException(e.getMessage(), e); + } + } + + @Override + public List buscaDentroVigencia(Date dataGeracao) { + return esquemaCorridaDAO.buscaDentroVigencia(dataGeracao); + } + + public List buscaDentroVigenciaQtdeDiasNull(Date dataGeracao) { + return esquemaCorridaDAO.buscaDentroVigenciaQtdeDiasNull(dataGeracao); + } + + @Override + public List buscaDentroVigenciaQtdeDiasNotNull(Date dataDe) { + return esquemaCorridaDAO.buscaDentroVigenciaQtdeDiasNotNull(dataDe); + } + + public boolean buscarEsquemaCorridaExisteTramo(Tramo tramo) { + return esquemaCorridaDAO.buscarEsquemaCorridaExisteTramo(tramo); + } + + @Override + public List existe(Ruta ruta, Integer paradaId) { + return esquemaCorridaDAO.existe(ruta, paradaId); + } + + @Override + public EsquemaCorrida obtenerByEsquemaCorrida(Integer id) { + return esquemaCorridaDAO.obtenerByEsquemaCorrida(id); + } + + @Override + public EsquemaCorrida buscaEsquemaPorRuta(Ruta ruta) { + return esquemaCorridaDAO.buscaEsquemaPorRuta(ruta); + } + + @Override + public EsquemaCorrida buscaEsquemaPorRutaSemVigencia(Integer rutaId, Integer numCorrida) { + return esquemaCorridaDAO.buscaEsquemaPorRutaSemVigencia(rutaId, numCorrida); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EsquemaOperacionalServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaOperacionalServiceImpl.java new file mode 100644 index 000000000..ff8c1e036 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaOperacionalServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.EsquemaOperacionalDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaOperacional; +import com.rjconsultores.ventaboletos.service.EsquemaOperacionalService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("esquemaOperacionalService") +public class EsquemaOperacionalServiceImpl implements EsquemaOperacionalService { + + @Autowired + private EsquemaOperacionalDAO esquemaOperacionalDAO; + + public List obtenerTodos() { + return esquemaOperacionalDAO.obtenerTodos(); + } + + public EsquemaOperacional obtenerID(Integer id) { + return esquemaOperacionalDAO.obtenerID(id); + } + + @Transactional + public EsquemaOperacional suscribir(EsquemaOperacional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaOperacionalDAO.suscribir(entidad); + } + + @Transactional + public EsquemaOperacional actualizacion(EsquemaOperacional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaOperacionalDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EsquemaOperacional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + esquemaOperacionalDAO.actualizacion(entidad); + } + + public List dentroVigenciaEsquemaOperacional(Date dataGeracao) { + return esquemaOperacionalDAO.dentroVigenciaEsquemaOperacional(dataGeracao); + } + + public List dentroVigenciaEsquemaOperacional(Date dataDe, Date dataAte) { + return esquemaOperacionalDAO.dentroVigenciaEsquemaOperacional(dataDe, dataAte); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EsquemaTramoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaTramoServiceImpl.java new file mode 100644 index 000000000..3d9cac67f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EsquemaTramoServiceImpl.java @@ -0,0 +1,74 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.EsquemaTramoDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.EsquemaTramo; +import com.rjconsultores.ventaboletos.service.EsquemaTramoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("esquemaTramoService") +public class EsquemaTramoServiceImpl implements EsquemaTramoService { + + @Autowired + private EsquemaTramoDAO esquemaTramoDAO; + + public List obtenerTodos() { + return esquemaTramoDAO.obtenerTodos(); + } + + public EsquemaTramo obtenerID(Integer id) { + return esquemaTramoDAO.obtenerID(id); + } + + @Transactional + public EsquemaTramo suscribir(EsquemaTramo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaTramoDAO.suscribir(entidad); + } + + @Transactional + public EsquemaTramo actualizacion(EsquemaTramo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return esquemaTramoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EsquemaTramo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + esquemaTramoDAO.actualizacion(entidad); + } + + public List obtenerPorEsquemaCorrida(EsquemaCorrida ec) { + return esquemaTramoDAO.obtenerPorEsquemaCorrida(ec); + } + + public List obtenerPorEsquemaCorridaOrderNumSec(EsquemaCorrida ec) { + return esquemaTramoDAO.obtenerPorEsquemaCorridaOrderNumSec(ec); + } + + public List obtenerAtivosDesativosPorEsquemaCorrida(EsquemaCorrida esquemaCorrida) { + return esquemaTramoDAO.obtenerAtivosDesativosPorEsquemaCorrida(esquemaCorrida); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java new file mode 100644 index 000000000..a133e81ae --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java @@ -0,0 +1,236 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +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 com.rjconsultores.ventaboletos.dao.EstacionDAO; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.EstacionImpresora; +import com.rjconsultores.ventaboletos.entidad.EstacionSitef; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enums.TipoImpressora; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.AutorizaFolioService; +import com.rjconsultores.ventaboletos.service.EstacionService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("estacionService") +public class EstacionServiceImpl implements EstacionService { + + @Autowired + private EstacionDAO estacionDAO; + + @Autowired + private AutorizaFolioService autorizaFolioService; + + public List obtenerTodos() { + return estacionDAO.obtenerTodos(); + } + + public Estacion obtenerID(Integer id) { + return estacionDAO.obtenerID(id); + } + + @Transactional(rollbackFor = BusinessException.class) + public Estacion suscribirActualizar(Estacion estacion) throws BusinessException { + validarEstoqueUpdate(estacion); + + if (estacion.getDescmac() != null && !estacion.getDescmac().isEmpty()) + validarDuplicidade(estacionDAO.buscarEstacionDuplicadaPorMAC(estacion.getDescmac(), estacion.getEstacionId())); + + if (estacion.getImei() != null && !estacion.getImei().isEmpty()) + validarDuplicidade(estacionDAO.buscarEstacionDuplicadaPorIMEI(estacion.getImei(), estacion.getEstacionId())); + + boolean esCajaDuplicado = false; + List lsEstacion = estacionDAO.buscar(estacion.getNumcaja(), estacion.getPuntoVenta()); + + if (!lsEstacion.isEmpty()) { + if (estacion.getEstacionId() == null) { + esCajaDuplicado = true; + } else { + esCajaDuplicado = !lsEstacion.get(0).getEstacionId().equals(estacion.getEstacionId()); + } + } + + if (esCajaDuplicado) { + throw new BusinessException("estacionServiceImpl.msg.cajaDuplicado"); + } + + estacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + estacion.setFecmodif(Calendar.getInstance().getTime()); + estacion.setActivo(Boolean.TRUE); + + boolean isNuevaFiscal = validacionNuevaImpressoraFiscal(estacion); + + if (estacion.getEstacionId() == null) { + estacion = estacionDAO.suscribir(estacion); + } else { + estacion = estacionDAO.actualizacion(estacion); + } + + String errorNoChequeFolio = null; + for (EstacionImpresora ei : estacion.getLsEstacionImpresora()) { + boolean isImpressoraFiscal = validacionImpressoraFiscal(ei); + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.GENERAR_ROTINA_FOLIOS.getDescricao())) { + errorNoChequeFolio = autorizaFolioService.noChequeFolioPreimpresos(ei, false); + } else if ((isImpressoraFiscal && isNuevaFiscal) || + (estacion.getIndStockCentral() != null && estacion.getIndStockCentral() && isImpressoraFiscal)) { + errorNoChequeFolio = autorizaFolioService.noChequeFolioPreimpresos(ei, true); + } + } + + if (StringUtils.isNotBlank(errorNoChequeFolio)) { + throw new BusinessException(errorNoChequeFolio); + } + + return estacion; + } + + private void validarDuplicidade(Estacion estacionValidacao) throws BusinessException { + Boolean esMacDuplicado = Boolean.FALSE; + + String nomeEstacao = ""; + Long numeroCaixa = 0l; + + if (estacionValidacao != null) { + nomeEstacao = estacionValidacao.getDescestacion(); + numeroCaixa = estacionValidacao.getNumcaja(); + esMacDuplicado = Boolean.TRUE; + } + + if (esMacDuplicado) { + StringBuilder msg = new StringBuilder(); + msg.append( Labels.getLabel("estacionServiceImpl.msg.macDuplicado") ); + msg.append( "\n" ); + msg.append( Labels.getLabel("estacionServiceImpl.msg.macDuplicado.descricaoEstacao") ); + msg.append( nomeEstacao ); + msg.append( "\n" ); + msg.append( Labels.getLabel("estacionServiceImpl.msg.macDuplicado.numeroCaixa") ); + msg.append( numeroCaixa.toString() ); + + throw new BusinessException( msg.toString()); + } + } + + private boolean validacionNuevaImpressoraFiscal(final Estacion e) { + for (EstacionImpresora ei : e.getLsEstacionImpresora()) { + if(TipoImpressora.getTipoImpressoraFiscal(ei.getTipoImpressora())!=null && ei.getEstacionImpresoraId() == null){ + return true; + } + } + return false; + } + + private boolean validacionImpressoraFiscal(final EstacionImpresora ei) { + if(TipoImpressora.getTipoImpressoraFiscal(ei.getTipoImpressora())!=null){ + return true; + }else{ + return false; + } + } + + @Override + public void devolverFoliosAutomaticosImpressoraFiscal(final EstacionImpresora ei) { + + if(TipoImpressora.getTipoImpressoraFiscal(ei.getTipoImpressora())!=null){ + autorizaFolioService.devolverFoliosAutomaticosImpressoraFiscal(ei); + } + } + + private void validarEstoqueUpdate(Estacion estacion) throws BusinessException { + + if (estacion.getEstacionId() == null) { + return; + } + + if (!ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.GENERAR_ROTINA_FOLIOS.getDescricao())) { + Estacion estacionPuntoVentaAnterior = estacionDAO.obtenerID(estacion.getEstacionId()); + if (estacionPuntoVentaAnterior.getPuntoVenta() != null) + if (!estacionPuntoVentaAnterior.getPuntoVenta().equals(estacion.getPuntoVenta())) { + if (estacionDAO.temEstoque(estacionPuntoVentaAnterior.getPuntoVenta(), estacion)) { + throw new BusinessException("estacionServiceImpl.msg.hayStock"); + } + } + } + } + + private void validarEstoqueBorrar(Estacion estacion) throws BusinessException { + if (!ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.GENERAR_ROTINA_FOLIOS.getDescricao())) { + if (estacionDAO.temEstoque(estacion.getPuntoVenta(), estacion)) { + throw new BusinessException("estacionServiceImpl.msg.hayStock.borrar"); + } + } + } + + @Transactional + public void borrar(Estacion entidad) throws BusinessException { + + validarEstoqueBorrar(entidad); + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + if (entidad.getEstacionSitefList() != null) { + for (EstacionSitef es : entidad.getEstacionSitefList()) { + es.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + es.setFecmodif(Calendar.getInstance().getTime()); + es.setActivo(Boolean.FALSE); + } + } + + estacionDAO.actualizacion(entidad); + } + + public List buscar(String descEstacion, String descMac, Long nunCaja, PuntoVenta pv) { + return estacionDAO.buscar(descEstacion, descMac, nunCaja, pv); + } + + public List buscar(String descMac) { + return estacionDAO.buscar(descMac); + } + + public Estacion buscarPorIMEI(String imei) { + return estacionDAO.buscarPorIMEI(imei); + } + + @Override + public Long getDecimalMAC(String mac) { + mac = mac.trim(); + mac = mac.replace("-", ""); + return Long.parseLong(mac, 16); + } + + @Override + public List buscarEstaciones(PuntoVenta puntoVenta) { + List estaciones = estacionDAO.buscarEstaciones(puntoVenta); + return estaciones; + } + + @Override + public List buscarEstaciones(List lsPuntoVenta) { + return estacionDAO.buscarEstaciones(lsPuntoVenta); + } + + @Override + public List buscarEstacionesStockCentral(PuntoVenta puntoVenta) { + List estaciones = estacionDAO.buscarEstacionesStockCentral(puntoVenta); + return estaciones; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EstacionSitefServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EstacionSitefServiceImpl.java new file mode 100644 index 000000000..c38df582b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EstacionSitefServiceImpl.java @@ -0,0 +1,66 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.EstacionSitefDAO; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EstacionSitef; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enums.TipoIntegracaoTEF; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.service.EstacionSitefService; + +/** + * + * @author Lucas + * + */ +@Service("estacionSitefService") +public class EstacionSitefServiceImpl implements EstacionSitefService { + + private static String VALIDA_DUPLICIDADE_SO_MESMA_AGENCIA= "VALIDA_DUPLICIDADE_SO_MESMA_AGENCIA"; + + @Autowired + private EstacionSitefDAO estacionSitefDAO; + + @Autowired + private ConstanteService constanteService; + + + + @Override + public EstacionSitef buscar(Empresa empresa, Integer numempresa, Integer numfilial, String numpdv) { + return estacionSitefDAO.buscar(empresa, numempresa, numfilial, numpdv); + } + + @Override + public EstacionSitef buscar(Empresa empresa, TipoIntegracaoTEF tipoIntegracaoTEF, String numpdv, Integer numfilial) { + return estacionSitefDAO.buscar(empresa, tipoIntegracaoTEF, numpdv, numfilial); + } + + @Override + public EstacionSitef parametrizacaoJahExiste(Empresa empresa, TipoIntegracaoTEF tipoIntegracaoTEF, String numpdv, Integer numfilial,PuntoVenta puntoVenta) { + + EstacionSitef estacionSitef = estacionSitefDAO.buscar(empresa, tipoIntegracaoTEF, numpdv, numfilial); + + if (estacionSitef == null){ + return null; + } + + Constante constante = constanteService.buscarPorNomeConstante(VALIDA_DUPLICIDADE_SO_MESMA_AGENCIA); + + if (constante!= null && StringUtils.isNotBlank(constante.getValorconstante()) && constante.getValorconstante().equalsIgnoreCase("true")){ + if (!estacionSitef.getEstacion().getPuntoVenta().equals(puntoVenta)){ + return null; + } + + } + + return estacionSitef; + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EstadoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EstadoServiceImpl.java new file mode 100644 index 000000000..7951c88df --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EstadoServiceImpl.java @@ -0,0 +1,115 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CiudadDAO; +import com.rjconsultores.ventaboletos.dao.EmpresaDAO; +import com.rjconsultores.ventaboletos.dao.EstadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Pais; +import com.rjconsultores.ventaboletos.service.EstadoService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author MCosso + */ +@Service("estadoService") +public class EstadoServiceImpl implements EstadoService { + + @Autowired + private EstadoDAO estadoDAO; + @Autowired + private CiudadDAO ciudadDAO; + @Autowired + private EmpresaDAO empresaDAO; + + public List obtenerTodos() { + return estadoDAO.obtenerTodos(); + } + + public Estado obtenerID(Integer id) { + return estadoDAO.obtenerID(id); + } + + @Transactional + public Estado suscribir(Estado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + entidad = estadoDAO.suscribir(entidad); + + gerarSeqNumFolioSistema(entidad); + + return entidad; + } + + @Transactional + public Estado actualizacion(Estado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return estadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Estado entidad) throws RegistroConDependenciaException { + + if (ciudadDAO.count("estado", entidad) > 0l) { + throw new RegistroConDependenciaException(); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + estadoDAO.actualizacion(entidad); + } + + public List buscar(String nombestado, Pais pais) { + return estadoDAO.buscar(nombestado, pais); + } + + public List buscarNotInEmpresaImposto(Empresa empresa) { + return estadoDAO.buscarNotInEmpresaImposto(empresa); + + } + + @Override + public List buscarCveEstado(String cveEstado) { + return estadoDAO.buscarCveEstado(cveEstado); + } + + private void gerarSeqNumFolioSistema(Estado estado) { + List lsEmpresas = empresaDAO.obtenerTodos(); + for (Empresa empresa : lsEmpresas) { + empresaDAO.gerarSeqNumFolioSistema(empresa.getEmpresaId(), estado.getCveestado()); + } + } + + @Override + public Map getConfiguracoesFusoVeraoParada(Integer paradaId, Date data) { + return estadoDAO.getConfiguracoesFusoVeraoParada(paradaId, data); + } + + @Override + public Map getConfiguracoesFusoVeraoPuntoventa(Integer puntoventaId, Date data) { + return estadoDAO.getConfiguracoesFusoVeraoPuntoventa(puntoventaId, data); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EventoExtraServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EventoExtraServiceImpl.java new file mode 100644 index 000000000..f0748af67 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EventoExtraServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.EventoExtraDAO; +import com.rjconsultores.ventaboletos.entidad.EventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.service.EventoExtraService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("eventoExtraService") +public class EventoExtraServiceImpl implements EventoExtraService { + + @Autowired + private EventoExtraDAO eventoExtraDAO; + + public List obtenerTodos() { + return eventoExtraDAO.obtenerTodos(); + } + + public EventoExtra obtenerID(Integer id) { + return eventoExtraDAO.obtenerID(id); + } + + @Transactional + public EventoExtra suscribir(EventoExtra entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return eventoExtraDAO.suscribir(entidad); + } + + @Transactional + public EventoExtra actualizacion(EventoExtra entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return eventoExtraDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(EventoExtra entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + eventoExtraDAO.actualizacion(entidad); + } + + @Transactional + public List obtenerPorTipo(TipoEventoExtra tipoEventoExtra){ + return eventoExtraDAO.obtenerPorTipo(tipoEventoExtra); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionPeajeServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionPeajeServiceImpl.java new file mode 100644 index 000000000..1923463a2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionPeajeServiceImpl.java @@ -0,0 +1,91 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ExcepcionPeajeDAO; +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje; +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeajeVigencia; +import com.rjconsultores.ventaboletos.service.ExcepcionPeajeService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("excepcionPeajeService") +public class ExcepcionPeajeServiceImpl implements ExcepcionPeajeService { + + @Autowired + private ExcepcionPeajeDAO excepcionPeajeDAO; + + public ExcepcionPeaje obtenerID(Integer id) { + return excepcionPeajeDAO.obtenerID(id); + } + + public List obtenerTodos() { + return excepcionPeajeDAO.obtenerTodos(); + } + + public List buscar(String descconvenio, String cveconvenio){ + return new ArrayList(); + } + + @Transactional + public ExcepcionPeaje suscribir(ExcepcionPeaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return excepcionPeajeDAO.suscribir(entidad); + } + + @Transactional + public ExcepcionPeaje actualizacion(ExcepcionPeaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return excepcionPeajeDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ExcepcionPeaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + +// for (ConvenioDet cd : entidad.getConvenioDetList()) { +// cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); +// cd.setFecmodif(Calendar.getInstance().getTime()); +// cd.setActivo(Boolean.FALSE); +// } +// +// for (ConvenioPuntoVenta cpv: entidad.getConvenioPuntoVentaList()) { +// cpv.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); +// cpv.setFecmodif(Calendar.getInstance().getTime()); +// cpv.setActivo(Boolean.FALSE); +// } +// +// for (ConvenioUsuario cu : entidad.getConvenioUsuarioList()) { +// cu.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); +// cu.setFecmodif(Calendar.getInstance().getTime()); +// cu.setActivo(Boolean.FALSE); +// } +// +// for (ConvenioTramo ct : entidad.getConvenioTramoList()) { +// ct.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); +// ct.setFecmodif(Calendar.getInstance().getTime()); +// ct.setActivo(Boolean.FALSE); +// } + + excepcionPeajeDAO.actualizacion(entidad); + } + + @Override + public void deletarVigencias(List epv) { + excepcionPeajeDAO.deletarVigencias(epv); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionRedondoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionRedondoServiceImpl.java new file mode 100644 index 000000000..293f9091d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionRedondoServiceImpl.java @@ -0,0 +1,88 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ExcepcionRedondoDAO; +import com.rjconsultores.ventaboletos.entidad.ExcepcionRedondo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.ExcepcionRedondoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("excepcionRedondoService") +public class ExcepcionRedondoServiceImpl implements ExcepcionRedondoService { + + @Autowired + private ExcepcionRedondoDAO excepcionRedondoDAO; + + public List obtenerTodos() { + return excepcionRedondoDAO.obtenerTodos(); + } + + public ExcepcionRedondo obtenerID(Integer id) { + return excepcionRedondoDAO.obtenerID(id); + } + + @Transactional(rollbackFor=BusinessException.class) + public ExcepcionRedondo suscribirActualizar(ExcepcionRedondo entidad) throws BusinessException { + + if (entidad.getOrigem().getParadaId().equals(entidad.getDestino().getParadaId())) { + throw new BusinessException("MSG.Origem.Igual.Destino"); + } + + + List lsExcepciones = excepcionRedondoDAO.buscar(entidad.getOrigem(), entidad.getDestino()); + boolean podeSavar = false; + if (lsExcepciones.isEmpty()) { + podeSavar = true; + } else { + if (entidad.getExcepcionredondoId() != null) { + for (ExcepcionRedondo er : lsExcepciones) { + if (entidad.getExcepcionredondoId().equals(er.getExcepcionredondoId())) { + podeSavar = true; + } + } + } + } + + if (!podeSavar) { + throw new BusinessException("MSG.Registro.Existe"); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getExcepcionredondoId() == null) { + return excepcionRedondoDAO.suscribir(entidad); + } else { + return excepcionRedondoDAO.actualizacion(entidad); + } + + } + + + @Transactional + public void borrar(ExcepcionRedondo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + excepcionRedondoDAO.actualizacion(entidad); + } + + public List buscar(String indTipo, Parada origem, Parada destino) { + return excepcionRedondoDAO.buscar(indTipo, origem, destino); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamgeralServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamgeralServiceImpl.java new file mode 100644 index 000000000..2c50da18f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamgeralServiceImpl.java @@ -0,0 +1,72 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FechamentoParamgeralDAO; +import com.rjconsultores.ventaboletos.entidad.FechamentoParamgeral; +import com.rjconsultores.ventaboletos.service.FechamentoParamgeralService; + +@Service("fechamentoParamgeralService") +public class FechamentoParamgeralServiceImpl implements FechamentoParamgeralService { + + @Autowired + private FechamentoParamgeralDAO fechamentoParamgeralDAO; + + @Override + public List obtenerTodos() { + return fechamentoParamgeralDAO.obtenerTodos(); + } + + @Override + public FechamentoParamgeral obtenerID(Long id) { + return fechamentoParamgeralDAO.obtenerID(id); + } + + @Override + @Transactional + public FechamentoParamgeral suscribir(FechamentoParamgeral entidad) { + return fechamentoParamgeralDAO.suscribir(entidad); + } + + @Override + @Transactional + public FechamentoParamgeral actualizacion(FechamentoParamgeral entidad) { + return fechamentoParamgeralDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(FechamentoParamgeral entidad) { + fechamentoParamgeralDAO.borrar(entidad); + } + + + public Long count(String campo, Object o) { + return fechamentoParamgeralDAO.count(campo, o); + } + + @Override + public List buscaParametrosPorEmpresas(List empresasId) { + return fechamentoParamgeralDAO.buscaParametrosPorEmpresas(empresasId); + } + + @Override + public List buscaParametrosPorEmpresa(Integer empresasId) { + return fechamentoParamgeralDAO.buscaParametrosPorEmpresa(empresasId); + } + + @Override + @Transactional + public FechamentoParamgeral suscribirOrActualizacion(FechamentoParamgeral fechamentoParamgeral) { + if(fechamentoParamgeral != null && fechamentoParamgeral.getFechamentoparamgeralId() == null) { + return suscribir(fechamentoParamgeral); + } else if(fechamentoParamgeral != null && fechamentoParamgeral.getFechamentoparamgeralId() != null) { + return actualizacion(fechamentoParamgeral); + } + return null; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java new file mode 100644 index 000000000..8d1163706 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java @@ -0,0 +1,87 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FechamentoParamptovtaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.FechamentoParamptovtaService; + +@Service("fechamentoParamptovtaService") +public class FechamentoParamptovtaServiceImpl implements FechamentoParamptovtaService { + + @Autowired + private FechamentoParamptovtaDAO fechamentoParamptovtaDAO; + + @Override + public List obtenerTodos() { + return fechamentoParamptovtaDAO.obtenerTodos(); + } + + @Override + public FechamentoParamptovta obtenerID(Long id) { + return fechamentoParamptovtaDAO.obtenerID(id); + } + + @Override + @Transactional + public FechamentoParamptovta suscribir(FechamentoParamptovta entidad) { + return fechamentoParamptovtaDAO.suscribir(entidad); + } + + @Override + @Transactional + public FechamentoParamptovta actualizacion(FechamentoParamptovta entidad) { + entidad.setFecmodif(new Date()); + return fechamentoParamptovtaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(FechamentoParamptovta entidad) { + fechamentoParamptovtaDAO.borrar(entidad); + } + + + public Long count(String campo, Object o) { + return fechamentoParamptovtaDAO.count(campo, o); + } + + @Override + public List buscaParametrosPorEmpresas(List empresasId) { + return fechamentoParamptovtaDAO.buscaParametrosPorEmpresas(empresasId); + } + + @Override + public List buscaParametrosPorEmpresa(Integer empresasId) { + return fechamentoParamptovtaDAO.buscaParametrosPorEmpresa(empresasId); + } + + @Override + @Transactional + public FechamentoParamptovta suscribirOrActualizacion(FechamentoParamptovta FechamentoParamptovta) { + if(FechamentoParamptovta != null && FechamentoParamptovta.getFechamentoparamptovtaId() == null) { + return suscribir(FechamentoParamptovta); + } else if(FechamentoParamptovta != null && FechamentoParamptovta.getFechamentoparamptovtaId() != null) { + return actualizacion(FechamentoParamptovta); + } + return null; + } + + @Override + public List buscaParametrosPorPuntoventa(PuntoVenta puntoventa) { + List params = fechamentoParamptovtaDAO.buscaParametrosPorPuntoventa(puntoventa); + return params; + } + + @Override + public FechamentoParamptovta buscaParametrosPorPuntoventaEmpresa(PuntoVenta puntoventa, Empresa empresa) { + return fechamentoParamptovtaDAO.buscaParametrosPorPuntoventa(puntoventa, empresa); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FeriadoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FeriadoServiceImpl.java new file mode 100644 index 000000000..095e0264d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/FeriadoServiceImpl.java @@ -0,0 +1,77 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.sql.Date; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FeriadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.Feriado; +import com.rjconsultores.ventaboletos.service.FeriadoService; +import com.rjconsultores.ventaboletos.utilerias.FeriadoCache; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("feriadoService") +public class FeriadoServiceImpl implements FeriadoService { + + @Autowired + private FeriadoDAO feriadoDAO; + + @Autowired + private FeriadoCache feriadoCache; + + public List obtenerTodos() { + return feriadoDAO.obtenerTodos(); + } + + public Feriado obtenerID(Integer id) { + return feriadoDAO.obtenerID(id); + } + + @Transactional + public Feriado suscribir(Feriado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + feriadoCache.limparData(entidad.getFecferiado(), entidad.getEmpresa() == null ? null : entidad.getEmpresa().getEmpresaId(), entidad.getEstado() == null ? null : entidad.getEstado().getEstadoId()); + + return feriadoDAO.suscribir(entidad); + } + + @Transactional + public Feriado actualizacion(Feriado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + feriadoCache.limparData(entidad.getFecferiado(), entidad.getEmpresa() == null ? null : entidad.getEmpresa().getEmpresaId(), entidad.getEstado() == null ? null : entidad.getEstado().getEstadoId()); + + return feriadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Feriado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + feriadoCache.limparData(entidad.getFecferiado(), entidad.getEmpresa() == null ? null : entidad.getEmpresa().getEmpresaId(), entidad.getEstado() == null ? null : entidad.getEstado().getEstadoId()); + + feriadoDAO.actualizacion(entidad); + } + + public List buscar(Date fecferiado) { + return feriadoDAO.buscar(fecferiado); + } + + @Override + public List buscarDataEmpresaEstado(Date data, Empresa empresa, Estado estado) { + return feriadoDAO.buscarDataEmpresaEstado(data, empresa, estado); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FiscalAliquotaEmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FiscalAliquotaEmpresaServiceImpl.java new file mode 100644 index 000000000..a54c5ef00 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/FiscalAliquotaEmpresaServiceImpl.java @@ -0,0 +1,49 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FiscalAliquotaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.FiscalAliquotaEmpresa; +import com.rjconsultores.ventaboletos.service.FiscalAliquotaEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("fiscalAliquotaEmpresa") +public class FiscalAliquotaEmpresaServiceImpl implements FiscalAliquotaEmpresaService { + + @Autowired + private FiscalAliquotaEmpresaDAO fiscalAliquotaEmpresaDAO; + + public List obtenerTodos() { + return fiscalAliquotaEmpresaDAO.obtenerTodos(); + } + + public FiscalAliquotaEmpresa obtenerID(Integer id) { + return fiscalAliquotaEmpresaDAO.obtenerID(id); + } + + @Transactional + public FiscalAliquotaEmpresa suscribirActualizar(FiscalAliquotaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getFiscalAliquotaEmpresaId() == null) { + return fiscalAliquotaEmpresaDAO.suscribir(entidad); + } + return fiscalAliquotaEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(FiscalAliquotaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + fiscalAliquotaEmpresaDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FiscalImpressoraEstadoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FiscalImpressoraEstadoServiceImpl.java new file mode 100644 index 000000000..45b2c4057 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/FiscalImpressoraEstadoServiceImpl.java @@ -0,0 +1,54 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FiscalImpressoraEstadoDAO; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressoraEstado; +import com.rjconsultores.ventaboletos.service.FiscalImpressoraEstadoService; + +@Service("fiscalImpressoraEstadoService") +public class FiscalImpressoraEstadoServiceImpl implements FiscalImpressoraEstadoService { + + @Autowired + FiscalImpressoraEstadoDAO fiscalImpressoraEstadoDAO; + + @Override + public List obtenerTodos() { + return fiscalImpressoraEstadoDAO.obtenerTodos(); + } + + @Override + public FiscalImpressoraEstado obtenerID(Integer id) { + return fiscalImpressoraEstadoDAO.obtenerID(id); + } + + @Override + @Transactional + public FiscalImpressoraEstado suscribir(FiscalImpressoraEstado entidad) { + return fiscalImpressoraEstadoDAO.suscribir(entidad); + } + + @Override + @Transactional + public FiscalImpressoraEstado actualizacion(FiscalImpressoraEstado entidad) { + return fiscalImpressoraEstadoDAO.actualizacion(entidad); + } + + @Override + public List retornaEstadosFiscalImpressora(FiscalImpressora fiscalImpressora) { + return fiscalImpressoraEstadoDAO.retornaEstadosFiscalImpressora(fiscalImpressora); + } + + @Override + @Transactional + public void borrar(FiscalImpressoraEstado entidad) { + fiscalImpressoraEstadoDAO.borrar(entidad); + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FiscalImpressoraServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FiscalImpressoraServiceImpl.java new file mode 100644 index 000000000..887bbd95f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/FiscalImpressoraServiceImpl.java @@ -0,0 +1,261 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FiscalImpressoraDAO; +import com.rjconsultores.ventaboletos.entidad.FiscalFormapagoEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalImpressora; +import com.rjconsultores.ventaboletos.entidad.FiscalRelgerencialEmpresa; +import com.rjconsultores.ventaboletos.entidad.FiscalTotnaofiscalEmpresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.FiscalImpressoraService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("fiscalImpressoraService") +public class FiscalImpressoraServiceImpl implements FiscalImpressoraService { + + public enum TipoTotalizadorNaoFiscal { + + CancImpPost(false), + CartaoCredDeb(false), + CanPassagem(false), + VendaManual(false), + ImpressaoPost(false), + SeguroOpcional(true), + CancSeguroOpcional(true), + Multa(true), + DiferencaMaior(true), + DiferencaMenor(true), + CUSTOM(true); + + private final boolean temEE; + private TipoTotalizadorNaoFiscal(boolean pTemEE) { temEE = pTemEE; } + public boolean isTemEE() { + return temEE; + } + } + + public enum TipoFormaPagamento { + TotalCartao, + PtaAtendido, + TrocaPassagem, + Gratuidade, + CUSTOM; + } + public enum TipoRelatorioGerencial { + RelatorioGeral, + CupomEmbarque, + CupomEmbGratuidade, + IdentificacaoPafECF, + ManifestoFiscal, + ParametrosConfiguracao, + IdentificacaoIdaVolta, + RelatorioDavDiv + /*CUSTOM*/; + } + + @Autowired + FiscalImpressoraDAO fiscalImpressoraDAO; + + @Override + public List obtenerTodos() { + return fiscalImpressoraDAO.obtenerTodos(); + } + + @Override + public FiscalImpressora obtenerID(Integer id) { + return fiscalImpressoraDAO.obtenerID(id); + } + + @Override + @Transactional + public FiscalImpressora suscribir(FiscalImpressora entidad) { + return fiscalImpressoraDAO.suscribir(entidad); + } + + @Override + @Transactional + public FiscalImpressora actualizacion(FiscalImpressora entidad) { + return fiscalImpressoraDAO.actualizacion(entidad); + } + + @Override + public List buscarTotsNaoFiscaisEmpresa(Integer empresaEcfId) { + return fiscalImpressoraDAO.buscarTotsNaoFiscaisEmpresa(empresaEcfId); + } + + @Override + public List buscarFormaPagoEmpresa(Integer empresaEcfId) { + return fiscalImpressoraDAO.buscarFormaPagoEmpresa(empresaEcfId); + } + + @Override + public List buscarItensRelgerencialEmpresa(Integer empresaEcfId) { + return fiscalImpressoraDAO.buscarItensRelgerencialEmpresa(empresaEcfId); + } + + @Override + public List obtenerTodosTotnaofiscalEmpresa() { + return fiscalImpressoraDAO.obtenerTodosTotnaofiscalEmpresa(); + } + + @Override + public FiscalTotnaofiscalEmpresa obtenerIDTotnaofiscalEmpresa(Long id) { + return fiscalImpressoraDAO.obtenerIDTotnaofiscalEmpresa(id); + } + + @Override + @Transactional + public void borrarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa totnaofiscalEmpresa) { + totnaofiscalEmpresa.setActivo(false); + totnaofiscalEmpresa.setFecmodif(Calendar.getInstance().getTime()); + totnaofiscalEmpresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + fiscalImpressoraDAO.borrarTotnaofiscalEmpresa(totnaofiscalEmpresa); + } + + @Override + @Transactional(rollbackFor=BusinessException.class) + public FiscalTotnaofiscalEmpresa suscribirActualizarTotnaofiscalEmpresa(FiscalTotnaofiscalEmpresa entidad) throws BusinessException { + entidad.setActivo(true); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + + FiscalTotnaofiscalEmpresa item = null; + + if (!TipoTotalizadorNaoFiscal.CUSTOM.toString().equals(entidad.getTipototalizador())){ + item = fiscalImpressoraDAO.buscarTotNaoFiscal(entidad.getEmpresa(), entidad.getTipototalizador()); + }else{ + if (entidad.getTipoeventoextra() == null){ + item = fiscalImpressoraDAO.buscarTotNaoFiscal(entidad.getEmpresa(), entidad.getTipototalizador(),entidad.getDescricao()); + }else{ + item = fiscalImpressoraDAO.buscarTotNaoFiscal(entidad.getEmpresa(), entidad.getTipototalizador(),entidad.getDescricao(),entidad.getTipoeventoextra()); + } + } + + if ( (entidad.getFiscaltotnaofiscalId() == null) && (item != null) ){ + throw new BusinessException("editarTotnaofiscalEmpresaController.MSG.erroTipoTotalizador"); + } + + if ( (entidad.getFiscaltotnaofiscalId() != null) && (item != null) && (!item.getFiscaltotnaofiscalId().equals(entidad.getFiscaltotnaofiscalId())) ){ + throw new BusinessException("editarTotnaofiscalEmpresaController.MSG.erroTipoTotalizador"); + } + if (entidad.getFiscaltotnaofiscalId() == null){ + return fiscalImpressoraDAO.suscribirTotnaofiscalEmpresa(entidad); + }else{ + return fiscalImpressoraDAO.actualizarTotnaofiscalEmpresa(entidad); + } + } + + @Override + public List obtenerTodosFormapagoEmpresa() { + return fiscalImpressoraDAO.obtenerTodosFormapagoEmpresa(); + } + + @Override + public FiscalFormapagoEmpresa obtenerIDFormapagoEmpresa(Long id) { + return fiscalImpressoraDAO.obtenerIDFormapagoEmpresa(id); + } + + @Override + @Transactional(rollbackFor=BusinessException.class) + public FiscalFormapagoEmpresa suscribirActualizarFormapagoEmpresa(FiscalFormapagoEmpresa entidad) throws BusinessException { + + FiscalFormapagoEmpresa item = null; + + if (!TipoFormaPagamento.CUSTOM.toString().equals(entidad.getTipoformapago())){ + item = fiscalImpressoraDAO.buscarFormaPago(entidad.getEmpresa(), entidad.getTipoformapago()); + }else{ + + //para o tipo CUSTOM, é necessário informar a forma de pagammetno. Senão dá problema no sco de vendas + if (entidad.getFormaPago() == null){ + throw new BusinessException("editarFormapagoEmpresaController.MSG.formaPagoObligatoria"); + } + + item = fiscalImpressoraDAO.buscarFormaPago(entidad.getEmpresa(), entidad.getTipoformapago(),entidad.getDescricao()); + } + + if ( (entidad.getFiscalformapagoempresaId() == null) && (item != null) ){ + throw new BusinessException("editarFormapagoEmpresaController.MSG.erroTipoFormaPago"); + } + + if ( (entidad.getFiscalformapagoempresaId() != null) && (item != null) && (!item.getFiscalformapagoempresaId().equals(entidad.getFiscalformapagoempresaId())) ){ + throw new BusinessException("editarFormapagoEmpresaController.MSG.erroTipoFormaPago"); + } + + entidad.setActivo(true); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + if (entidad.getFiscalformapagoempresaId() == null){ + return fiscalImpressoraDAO.suscribirFormapagoEmpresa(entidad); + }else{ + return fiscalImpressoraDAO.actualizacionFormapagoEmpresa(entidad); + } + } + + @Override + @Transactional(rollbackFor=BusinessException.class) + public FiscalFormapagoEmpresa borrarFormapagoEmpresa(FiscalFormapagoEmpresa entidad) { + entidad.setActivo(false); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + return fiscalImpressoraDAO.actualizacionFormapagoEmpresa(entidad); + } + + @Override + public List obtenerTodosRelgerencialEmpresa() { + return fiscalImpressoraDAO.obtenerTodosRelgerencialEmpresa(); + } + + @Override + public FiscalRelgerencialEmpresa obtenerIDRelgerencialEmpresa(Long id) { + return fiscalImpressoraDAO.obtenerIDRelgerencialEmpresa(id); + } + + @Override + @Transactional + public FiscalRelgerencialEmpresa suscribirRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad) { + return fiscalImpressoraDAO.suscribirRelgerencialEmpresa(entidad); + } + + + @Override + @Transactional(rollbackFor=BusinessException.class) + public FiscalRelgerencialEmpresa suscribirActualizarRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad) throws BusinessException { + + FiscalRelgerencialEmpresa item = null; + + item = fiscalImpressoraDAO.buscarRelGerencial(entidad.getEmpresa(), entidad.getTiporelgerencial()); + + if ( (entidad.getFiscalrelgerencialId() == null) && (item != null) ){ + throw new BusinessException("editarRelgerencialEmpresaController.MSG.erroTipoRelgerencial"); + } + + if ( (entidad.getFiscalrelgerencialId() != null) && (item != null) && (!item.getFiscalrelgerencialId().equals(entidad.getFiscalrelgerencialId())) ){ + throw new BusinessException("editarRelgerencialEmpresaController.MSG.erroTipoRelgerencial"); + } + + entidad.setActivo(true); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + if (entidad.getFiscalrelgerencialId() == null){ + return fiscalImpressoraDAO.suscribirRelgerencialEmpresa(entidad); + }else{ + return fiscalImpressoraDAO.actualizacionRelgerencialEmpresa(entidad); + } + } + + + @Override + @Transactional + public FiscalRelgerencialEmpresa actualizacionRelgerencialEmpresa(FiscalRelgerencialEmpresa entidad) { + return fiscalImpressoraDAO.actualizacionRelgerencialEmpresa(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FiscalServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FiscalServiceImpl.java new file mode 100644 index 000000000..c10b04b9b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/FiscalServiceImpl.java @@ -0,0 +1,1075 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.math.BigDecimal; +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import javax.sql.DataSource; + +import org.apache.log4j.Logger; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.datasource.DataSourceUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FiscalDAO; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Estado; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.service.FiscalService; +import com.rjconsultores.ventaboletos.service.TipoEventoExtraService; +import com.rjconsultores.ventaboletos.utilerias.BigDecimalUtil; +import com.rjconsultores.ventaboletos.utilerias.LocaleUtil; +import com.rjconsultores.ventaboletos.utilerias.archivointegracion.ArchivoIntegracionECF; +import com.rjconsultores.ventaboletos.utilerias.archivointegracion.ArchivoIntegracionECFManual; +import com.rjconsultores.ventaboletos.utilerias.archivointegracion.ArchivoIntegracionECFReducaoZ; +import com.rjconsultores.ventaboletos.utilerias.archivointegracion.ArchivoIntegracionNaoFiscal; +import com.rjconsultores.ventaboletos.utilerias.archivointegracion.ArchivoIntegracionReducaoZ; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.ExportacaoFiscal; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECF; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoCCF; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoCFC; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoICF; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoPRC; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoBPR; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoBPS; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoDBP; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoPAR; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoRMD; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoSeqBPS; +import com.rjconsultores.ventaboletos.utilerias.fiscal.vo.FiscalRdi; +import com.rjconsultores.ventaboletos.utilerias.impressaormd.vo.ImpressaoRMD; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionNaoFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.LeitorFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.LeitorFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.LeitorManualFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.LeitorNaoFiscalVO; + +@Service("fiscalService") +public class FiscalServiceImpl implements FiscalService { + private static Logger log = Logger.getLogger(FiscalServiceImpl.class); + + public static final String DATE_FORMAT_FISCAL = "yyyyMMdd"; + public static final BigDecimal CEM = BigDecimal.valueOf(100); + public static final String QUEBRA_LINHA = "\r\n"; + + private List lsTipoEventoExtra; + + @Autowired + private TipoEventoExtraService tipoEventoExtraService; + + @Autowired + private FiscalDAO fiscalDAO; + + @Autowired + private DataSource dataSourceRead; + + @Autowired + private DataSource dataSource; + + @Autowired + private ExportacaoFiscal exportacaoFiscal; + + private Connection getConnection() { + return DataSourceUtils.getConnection(dataSource); + } + + private Connection getConnectionRead() { + return DataSourceUtils.getConnection(dataSourceRead); + } + + @Override + @Transactional + public int gerarRegistroP2_F2(List lsEsquemaCorrida, Date dataDe, Date dataAte) throws SQLException { + return fiscalDAO.gerarRegistroP2_F2(lsEsquemaCorrida, dataDe, dataAte); + } + + @Override + public void gravarRMDBoleto(List rmds, Aidf aidf, String folio, Empresa empresa, Estado estado, boolean isECF, boolean isBPR) { + Connection connection = null; + try { + connection = getConnection(); + fiscalDAO.gravarRMDBoleto(connection, rmds, aidf, folio, empresa.getEmpresaId(), estado.getEstadoId(), isECF, isBPR); + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + } + + @Override + public void cancelarRMDBoleto(Date inicio, Date fim, Empresa empresa, Estado estado, Aidf aidf, String folioInicial, String folioFinal, boolean isCancela, boolean isInativa, boolean isECF, boolean isBPR) { + Connection connection = null; + try { + connection = getConnection(); + fiscalDAO.cancelarRMDBoleto(connection, inicio, fim, empresa.getEmpresaId(), estado, aidf, folioInicial, folioFinal, isCancela, + isInativa, isECF, isBPR); + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + } + + @Override + public List getRegistroImpressaoRMDTipoBPR(Date inicio, Date fim, Empresa empresa, Estado estado, String rmd, String folio) { + Connection connection = null; + try { + connection = getConnectionRead(); + return fiscalDAO.getRegistroImpressaoRMDTipoBPR(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado(), rmd, folio); + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public List buscarRelatorioRDI(Date inicio, Date fim, Empresa empresa, List estados, boolean isReceitaTerceiros) { + Connection connection = null; + try { + connection = getConnectionRead(); + return fiscalDAO.buscarRelatorioRDI(connection, inicio, fim, empresa.getEmpresaId(), estados, isReceitaTerceiros); + } catch (Exception e) { + log.error("", e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public List getRegistroImpressaoRMDTipoECF(Date inicio, Date fim, Empresa empresa, Estado estado, String rmd, String folio) { + Connection connection = null; + try { + connection = getConnectionRead(); + return fiscalDAO.getRegistroImpressaoRMDTipoECF(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado(), rmd, folio); + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public File importacionFiscalECFManual(Date inicio, Date fim, Empresa empresa, Estado estado, boolean isBoletoHist) { + + Connection connection = null; + try { + connection = getConnectionRead(); + + List list = fiscalDAO.buscaDatosFiscaisECFManual(inicio, fim, empresa.getEmpresaId(), estado.getEstadoId(), connection, isBoletoHist); + return new ArchivoIntegracionECFManual().importacionFiscalECFManual(inicio, fim, empresa, list); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public File importacionFiscalReducaoZPendencia(Date inicio, Date fim, Empresa empresa, Estado estado) { + + Connection connection = null; + try { + connection = getConnectionRead(); + + List list = fiscalDAO.buscaDatosFiscaisReducaoZ(inicio, fim, empresa.getEmpresaId(), estado.getEstadoId(), true, connection); + return new ArchivoIntegracionReducaoZ().importacionReducaoZ(inicio, fim, empresa, true, list); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public File importacionFiscalReducaoZ(Date inicio, Date fim, Empresa empresa, Estado estado) { + + Connection connection = null; + try { + connection = getConnectionRead(); + + List list = fiscalDAO.buscaDatosFiscaisReducaoZ(inicio, fim, empresa.getEmpresaId(), estado.getEstadoId(), false, connection); + return new ArchivoIntegracionReducaoZ().importacionReducaoZ(inicio, fim, empresa, false, list); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public File importacionFiscalECFPendencias(Date inicio, Date fim, Empresa empresa, Estado estado) { + Connection connection = null; + try { + connection = getConnectionRead(); + + List list = fiscalDAO.buscaDatosFiscaisECF(inicio, fim, empresa.getEmpresaId(), estado.getEstadoId(), false, false, true, connection, false); + return new ArchivoIntegracionECF().importacionFiscalECFGenerico(inicio, fim, empresa, false, false, true, list); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public File importacionFiscalECFCancelados(Date inicio, Date fim, Empresa empresa, Estado estado, boolean isBoletoHist) { + Connection connection = null; + try { + connection = getConnectionRead(); + + List list = fiscalDAO.buscaDatosFiscaisECF(inicio, fim, empresa.getEmpresaId(), estado.getEstadoId(), false, true, false, connection, isBoletoHist); + return new ArchivoIntegracionECF().importacionFiscalECFGenerico(inicio, fim, empresa, false, true, false, list); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public HashMap importacionFiscalECFValidaReducaoZ(Date inicio, Date fim, Empresa empresa, Estado estado, boolean isBoletoHist) { + + Connection connection = null; + try { + connection = getConnectionRead(); + + List listEcf = fiscalDAO.buscaDatosFiscaisECF(inicio, fim, empresa.getEmpresaId(), estado.getEstadoId(), true, false, false, connection, isBoletoHist); + + List listRedZ = fiscalDAO.buscaDatosFiscaisReducaoZ(inicio, fim, empresa.getEmpresaId(), estado.getEstadoId(), false, connection); + + ArchivoIntegracionECFReducaoZ ecfRedZ = new ArchivoIntegracionECFReducaoZ(); + ecfRedZ.importacionFiscalECFValidaReducaoZ(listEcf, listRedZ); + + List files = new ArrayList(); + files.add(new ArchivoIntegracionECF().importacionFiscalECFGenerico(inicio, fim, empresa, true, false, false, ecfRedZ.getListEcfValidos())); + files.add(new ArchivoIntegracionReducaoZ().importacionReducaoZ(inicio, fim, empresa, false, ecfRedZ.getListRedZValidos())); + + files.add(new ArchivoIntegracionECF().importacionFiscalECFGenerico(inicio, fim, empresa, false, false, true, ecfRedZ.getListEcfInvalidos())); + files.add(new ArchivoIntegracionReducaoZ().importacionReducaoZ(inicio, fim, empresa, true, ecfRedZ.getListRedZInvalidos())); + + HashMap result = new HashMap(); + result.put("arquivos", files); + result.put("ecfInvalidos", ecfRedZ.getListEcfInvalidos()); + result.put("redZInvalido", ecfRedZ.getListRedZInvalidos()); + + return result; + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + + return null; + } + + @Override + public File importacionFiscalECF(Date inicio, Date fim, Empresa empresa, Estado estado, boolean isBoletoHist) { + Connection connection = null; + try { + connection = getConnectionRead(); + + List list = fiscalDAO.buscaDatosFiscaisECF(inicio, fim, empresa.getEmpresaId(), estado.getEstadoId(), true, false, false, connection, isBoletoHist); + return new ArchivoIntegracionECF().importacionFiscalECFGenerico(inicio, fim, empresa, true, false, false, list); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public File importacionNaoFiscal(Date inicio, Date fim, Empresa empresa, Estado estado) { + Connection connection = null; + try { + connection = getConnectionRead(); + + List importacionNaoFiscalVOs = fiscalDAO.buscaDatosNaoFiscais(inicio, fim, empresa.getEmpresaId(), estado.getEstadoId(), connection); + + return new ArchivoIntegracionNaoFiscal().gerarArquivo(empresa.getCnpj(), importacionNaoFiscalVOs); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + return null; + } + + @Override + public File importacionFiscalECFXls(Empresa empresa, File arquivoTxt) { + return gerarArquivoEcfXlsGenerico(empresa, arquivoTxt); + } + + @Override + public File importacionFiscalReducaoZXls(Empresa empresa, File arquivoTxt) { + try { + List registros = carregarRegistrosReducaoZ(empresa, arquivoTxt); + return gerarArquivoReducaoZXls(registros, arquivoTxt.getName()); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return null; + } + + private List carregarRegistrosReducaoZ(Empresa empresa, File arquivoTxt) throws Exception { + List registros = new ArrayList(); + BufferedReader br = new BufferedReader(new FileReader(arquivoTxt)); + String linha = br.readLine(); + while (linha != null) { + LeitorFiscalReducaoZVO leitorFiscalReducaoZ = null; + int indice = -1; + if (linha.startsWith("1")) { + leitorFiscalReducaoZ = new LeitorFiscalReducaoZVO(); + leitorFiscalReducaoZ.setEmpresaId(empresa.getEmpresaId()); + leitorFiscalReducaoZ.setNombempresa(empresa.getNombempresa()); + leitorFiscalReducaoZ.setDatamov(linha.substring(1, 9).trim()); + leitorFiscalReducaoZ.setCnpj(linha.substring(9, 23).trim()); + leitorFiscalReducaoZ.setAliquota(BigDecimalUtil.getStringToBigDecimal(linha.substring(196, 210).trim(), 2, LocaleUtil.getLocale())); + + if (registros.contains(leitorFiscalReducaoZ)) { + indice = registros.indexOf(leitorFiscalReducaoZ); + leitorFiscalReducaoZ = registros.get(indice); + } + + leitorFiscalReducaoZ.setImposto(leitorFiscalReducaoZ.getImposto().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(272, 285).trim(), 2, LocaleUtil.getLocale()))); + leitorFiscalReducaoZ.setValorNaoTributado(leitorFiscalReducaoZ.getValorNaoTributado().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(182, 196).trim(), 2, LocaleUtil.getLocale()))); + leitorFiscalReducaoZ.setVendabrutadiaria(leitorFiscalReducaoZ.getVendabrutadiaria().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(126, 140).trim(), 2, LocaleUtil.getLocale()))); + + linha = br.readLine(); + } else { + linha = br.readLine(); + } + + if (leitorFiscalReducaoZ != null && indice > -1) { + registros.set(indice, leitorFiscalReducaoZ); + } else if (leitorFiscalReducaoZ != null) { + registros.add(leitorFiscalReducaoZ); + } + } + + br.close(); + + Collections.sort(registros); + + return registros; + } + + private File gerarArquivoReducaoZXls(List registros, String nomeArquivo) throws IOException { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet firstSheet = workbook.createSheet(); + + int linha = 0; + + // Cabecalho + HSSFRow row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue("DATA_MOVIMENTO"); + row.createCell(1).setCellValue("EMPRESA"); + row.createCell(2).setCellValue("CNPJ"); + row.createCell(3).setCellValue("VENDA_BRUTA_DIARIA"); + row.createCell(4).setCellValue("VALOR_NAO_TRIBUTADO"); + row.createCell(5).setCellValue("ALIQUOTA"); + row.createCell(6).setCellValue("VALOR_ICMS"); + + for (LeitorFiscalReducaoZVO leitorFiscal : registros) { + row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue(leitorFiscal.getDatamov()); + row.createCell(1).setCellValue(leitorFiscal.getNombempresa()); + row.createCell(2).setCellValue(leitorFiscal.getCnpj()); + row.createCell(3).setCellValue(leitorFiscal.getVendabrutadiaria().doubleValue()); + row.createCell(4).setCellValue(leitorFiscal.getValorNaoTributado().doubleValue()); + row.createCell(5).setCellValue(leitorFiscal.getAliquota().doubleValue()); + row.createCell(6).setCellValue(leitorFiscal.getImposto().doubleValue()); + } + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + workbook.write(bos); + + nomeArquivo = "consolidado_" + nomeArquivo.split("\\.")[0]; + File arquivo = File.createTempFile(nomeArquivo, ".xls"); + + FileOutputStream fos = new FileOutputStream(arquivo); + fos.write(bos.toByteArray()); + fos.close(); + + return arquivo; + } + + @Override + public File importacionFiscalECFManualXls(Empresa empresa, File arquivoTxt) { + try { + List registros = carregarRegistrosManualFiscal(empresa, arquivoTxt); + return gerarArquivoEcfManualXls(registros, arquivoTxt.getName()); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return null; + } + + private File gerarArquivoEcfManualXls(List registros, String nomeArquivo) throws Exception { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet firstSheet = workbook.createSheet(); + + int linha = 0; + + // Cabecalho + HSSFRow row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue("DATA_EMISSAO"); + row.createCell(1).setCellValue("EMPRESA"); + row.createCell(2).setCellValue("UF_ORIGEM"); + row.createCell(3).setCellValue("UF_DESTINO"); + row.createCell(4).setCellValue("CLASSE"); + row.createCell(5).setCellValue("STATUS"); + row.createCell(6).setCellValue("TARIFA"); + row.createCell(7).setCellValue("TX_EMBARQUE"); + row.createCell(8).setCellValue("PEDAGIO"); + row.createCell(9).setCellValue("SEGURO"); + row.createCell(10).setCellValue("TOTAL"); + row.createCell(11).setCellValue("ALIQUOTA"); + row.createCell(12).setCellValue("VALOR_ICMS"); + row.createCell(13).setCellValue("QTDE"); + + for (LeitorManualFiscalVO leitorFiscal : registros) { + row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue(leitorFiscal.getDataEmissao()); + row.createCell(1).setCellValue(leitorFiscal.getNombempresa()); + row.createCell(2).setCellValue(leitorFiscal.getOrigenUf()); + row.createCell(3).setCellValue(leitorFiscal.getDestinoUf()); + row.createCell(4).setCellValue(leitorFiscal.getClaseServicio()); + row.createCell(5).setCellValue(leitorFiscal.getStatus()); + row.createCell(6).setCellValue(leitorFiscal.getValorItem().doubleValue()); + row.createCell(7).setCellValue(leitorFiscal.getImportetaxaembarque().doubleValue()); + row.createCell(8).setCellValue(leitorFiscal.getImportepedagio().doubleValue()); + row.createCell(9).setCellValue(leitorFiscal.getImporteseguro().doubleValue()); + row.createCell(10).setCellValue(leitorFiscal.getValorTotal().doubleValue()); + row.createCell(11).setCellValue(leitorFiscal.getIcms().doubleValue()); + row.createCell(12).setCellValue(leitorFiscal.getValorIcms().doubleValue()); + row.createCell(13).setCellValue(leitorFiscal.getQtdeItens()); + } + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + workbook.write(bos); + + nomeArquivo = "consolidado_" + nomeArquivo.split("\\.")[0]; + File arquivo = File.createTempFile(nomeArquivo, ".xls"); + + FileOutputStream fos = new FileOutputStream(arquivo); + fos.write(bos.toByteArray()); + fos.close(); + + return arquivo; + } + + @Override + public File importacionNaoFiscalXls(Empresa empresa, File arquivoTxt) { + return gerarArquivoNaoFiscalXls(empresa, arquivoTxt); + } + + @Override + public File importacionFiscalECFCanceladosXls(Empresa empresa, File arquivoTxt) { + return gerarArquivoEcfXlsGenerico(empresa, arquivoTxt); + } + + private File gerarArquivoNaoFiscalXls(Empresa empresa, File arquivoTxt) { + try { + List registros = carregarRegistrosNaoFiscais(empresa, arquivoTxt); + return gerarArquivoNaoFiscaisXls(registros, arquivoTxt.getName()); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return null; + } + + private File gerarArquivoEcfXlsGenerico(Empresa empresa, File arquivoTxt) { + try { + List registros = carregarRegistrosEcf(empresa, arquivoTxt); + return gerarArquivoEcfXls(registros, arquivoTxt.getName()); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return null; + } + + private File gerarArquivoEcfXls(List registros, String nomeArquivo) throws IOException { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet firstSheet = workbook.createSheet(); + + int linha = 0; + + // Cabecalho + HSSFRow row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue("DATA_EMISSAO"); + row.createCell(1).setCellValue("EMPRESA"); + row.createCell(2).setCellValue("UF_ORIGEM"); + row.createCell(3).setCellValue("UF_DESTINO"); + row.createCell(4).setCellValue("CLASSE"); + row.createCell(5).setCellValue("MOTIVO_CANCELAMENTO"); + row.createCell(6).setCellValue("TARIFA"); + row.createCell(7).setCellValue("TX_EMBARQUE"); + row.createCell(8).setCellValue("PEDAGIO"); + row.createCell(9).setCellValue("SEGURO"); + row.createCell(10).setCellValue("MULTA"); + row.createCell(11).setCellValue("TOTAL"); + row.createCell(12).setCellValue("ALIQUOTA_ICMS"); + row.createCell(13).setCellValue("VALOR_ICMS"); + row.createCell(14).setCellValue("QTDE"); + + for (LeitorFiscalVO leitorFiscal : registros) { + row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue(leitorFiscal.getDataEmissao()); + row.createCell(1).setCellValue(leitorFiscal.getNombempresa()); + row.createCell(2).setCellValue(leitorFiscal.getOrigenUf()); + row.createCell(3).setCellValue(leitorFiscal.getDestinoUf()); + row.createCell(4).setCellValue(leitorFiscal.getClaseServicio()); + row.createCell(5).setCellValue(leitorFiscal.getDescmotivocancelamento()); + row.createCell(6).setCellValue(leitorFiscal.getValorTarifa().doubleValue()); + row.createCell(7).setCellValue(leitorFiscal.getValorEmbarque().doubleValue()); + row.createCell(8).setCellValue(leitorFiscal.getValorPedagio().doubleValue()); + row.createCell(9).setCellValue(leitorFiscal.getValorSeguro().doubleValue()); + row.createCell(10).setCellValue(leitorFiscal.getValorMulta().doubleValue()); + row.createCell(11).setCellValue(leitorFiscal.getTotal().doubleValue()); + row.createCell(12).setCellValue(leitorFiscal.getAliquota().doubleValue()); + row.createCell(13).setCellValue(leitorFiscal.getValorIcms().doubleValue()); + row.createCell(14).setCellValue(leitorFiscal.getQtdeItens()); + } + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + workbook.write(bos); + + nomeArquivo = "consolidado_" + nomeArquivo.split("\\.")[0]; + File arquivo = File.createTempFile(nomeArquivo, ".xls"); + + FileOutputStream fos = new FileOutputStream(arquivo); + fos.write(bos.toByteArray()); + fos.close(); + + return arquivo; + + } + + private List carregarRegistrosEcf(Empresa empresa, File arquivoTxt) throws Exception { + List registros = new ArrayList(); + BufferedReader br = new BufferedReader(new FileReader(arquivoTxt)); + String linha = br.readLine(); + while (linha != null) { + LeitorFiscalVO leitorFiscal = null; + int indice = -1; + if (linha.startsWith("1")) { + leitorFiscal = new LeitorFiscalVO(); + leitorFiscal.setEmpresaId(empresa.getEmpresaId()); + leitorFiscal.setNombempresa(empresa.getNombempresa()); + leitorFiscal.setDataEmissao(linha.substring(1, 9).trim()); + leitorFiscal.setOrigenUf(linha.substring(177, 179).trim()); + leitorFiscal.setDestinoUf(linha.substring(184, 186).trim()); + leitorFiscal.setClaseServicio(linha.substring(226, 256).trim()); + leitorFiscal.setDescmotivocancelamento(linha.substring(192, 212).trim()); + leitorFiscal.setAliquota(BigDecimalUtil.getStringToBigDecimal(linha.substring(79, 93).trim(), 2, LocaleUtil.getLocale())); + + if (registros.contains(leitorFiscal)) { + indice = registros.indexOf(leitorFiscal); + leitorFiscal = registros.get(indice); + } + + leitorFiscal.setQtdeItens(leitorFiscal.getQtdeItens() + 1); + linha = br.readLine(); + while (linha != null && linha.startsWith("2")) { + if (linha.indexOf("TA") >= 0) { + leitorFiscal.setValorTarifa(leitorFiscal.getValorTarifa().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + if (linha.indexOf("TX") >= 0) { + leitorFiscal.setValorEmbarque(leitorFiscal.getValorEmbarque().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + if (linha.indexOf("PE") >= 0) { + leitorFiscal.setValorPedagio(leitorFiscal.getValorPedagio().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + if (linha.indexOf("SE") >= 0) { + leitorFiscal.setValorSeguro(leitorFiscal.getValorSeguro().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + linha = br.readLine(); + } + } else { + linha = br.readLine(); + } + + if (leitorFiscal != null && indice > -1) { + registros.set(indice, leitorFiscal); + } else if (leitorFiscal != null) { + registros.add(leitorFiscal); + } + } + + br.close(); + + Collections.sort(registros); + + return registros; + } + + private List carregarRegistrosManualFiscal(Empresa empresa, File arquivoTxt) throws Exception { + List registros = new ArrayList(); + BufferedReader br = new BufferedReader(new FileReader(arquivoTxt)); + String linha = br.readLine(); + while (linha != null) { + LeitorManualFiscalVO leitorManualFiscal = null; + int indice = -1; + if (linha.startsWith("1")) { + leitorManualFiscal = new LeitorManualFiscalVO(); + leitorManualFiscal.setEmpresaId(empresa.getEmpresaId()); + leitorManualFiscal.setNombempresa(empresa.getNombempresa()); + leitorManualFiscal.setDataEmissao(linha.substring(1, 9).trim()); + leitorManualFiscal.setOrigenUf(linha.substring(177, 179).trim()); + leitorManualFiscal.setDestinoUf(linha.substring(184, 186).trim()); + leitorManualFiscal.setClaseServicio(linha.substring(226, 256).trim()); + leitorManualFiscal.setStatus(linha.substring(223, 224).trim()); + leitorManualFiscal.setIcms(BigDecimalUtil.getStringToBigDecimal(linha.substring(79, 93).trim(), 2, LocaleUtil.getLocale())); + + if (registros.contains(leitorManualFiscal)) { + indice = registros.indexOf(leitorManualFiscal); + leitorManualFiscal = registros.get(indice); + } + + leitorManualFiscal.setValorIcms(leitorManualFiscal.getValorIcms().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(93, 107).trim(), 2, LocaleUtil.getLocale()))); + leitorManualFiscal.setValorTotal(leitorManualFiscal.getValorTotal().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(51, 65).trim(), 2, LocaleUtil.getLocale()))); + + leitorManualFiscal.setQtdeItens(leitorManualFiscal.getQtdeItens() + 1); + linha = br.readLine(); + while (linha != null && linha.startsWith("2")) { + if (linha.indexOf("TA") >= 0) { + leitorManualFiscal.setValorItem(leitorManualFiscal.getValorItem().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + if (linha.indexOf("TX") >= 0) { + leitorManualFiscal.setImportetaxaembarque(leitorManualFiscal.getImportetaxaembarque().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + if (linha.indexOf("PE") >= 0) { + leitorManualFiscal.setImportepedagio(leitorManualFiscal.getImportepedagio().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + if (linha.indexOf("SE") >= 0) { + leitorManualFiscal.setImporteseguro(leitorManualFiscal.getImporteseguro().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(47, 62).trim(), 2, LocaleUtil.getLocale()))); + } + + linha = br.readLine(); + } + } else { + linha = br.readLine(); + } + + if (leitorManualFiscal != null && indice > -1) { + registros.set(indice, leitorManualFiscal); + } else if (leitorManualFiscal != null) { + registros.add(leitorManualFiscal); + } + } + + br.close(); + + Collections.sort(registros); + + return registros; + } + + private List carregarRegistrosNaoFiscais(Empresa empresa, File arquivoTxt) throws Exception { + List registros = new ArrayList(); + BufferedReader br = new BufferedReader(new FileReader(arquivoTxt)); + String linha = br.readLine(); + while (linha != null) { + LeitorNaoFiscalVO naoFiscais = null; + int indice = -1; + if (linha.startsWith("1")) { + naoFiscais = new LeitorNaoFiscalVO(); + naoFiscais.setEmpresaId(empresa.getEmpresaId()); + naoFiscais.setNombempresa(empresa.getNombempresa()); + naoFiscais.setDatamov(linha.substring(1, 9).trim()); + + Integer tipoEventoExtraId = Integer.valueOf(linha.substring(69, 78).trim()); + TipoEventoExtra tipoEvento = getTipoEventoExtra(tipoEventoExtraId); + + naoFiscais.setTipoeventoextraId(tipoEvento.getTipoeventoextraId()); + naoFiscais.setDesctipoevento(tipoEvento.getDescTipoEvento()); + + if (registros.contains(naoFiscais)) { + indice = registros.indexOf(naoFiscais); + naoFiscais = registros.get(indice); + } + + naoFiscais.setValorTotal(naoFiscais.getValorTotal().add(BigDecimalUtil.getStringToBigDecimal(linha.substring(52, 65).trim(), 2, LocaleUtil.getLocale()))); + + linha = br.readLine(); + } else { + linha = br.readLine(); + } + + if (naoFiscais != null && indice > -1) { + registros.set(indice, naoFiscais); + } else if (naoFiscais != null) { + registros.add(naoFiscais); + } + } + + br.close(); + + Collections.sort(registros); + + return registros; + } + + private File gerarArquivoNaoFiscaisXls(List registros, String nomeArquivo) throws IOException { + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet firstSheet = workbook.createSheet(); + + int linha = 0; + + // Cabecalho + HSSFRow row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue("DATA_EMISSAO"); + row.createCell(1).setCellValue("EMPRESA"); + row.createCell(2).setCellValue("CODIGO_NATUREZA"); + row.createCell(3).setCellValue("DESCRICAO_NATUREZA"); + row.createCell(4).setCellValue("VALOR_TOTAL"); + + for (LeitorNaoFiscalVO leitorNaoFiscal : registros) { + row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue(leitorNaoFiscal.getDatamov()); + row.createCell(1).setCellValue(leitorNaoFiscal.getNombempresa()); + row.createCell(2).setCellValue(leitorNaoFiscal.getTipoeventoextraId()); + row.createCell(3).setCellValue(leitorNaoFiscal.getDesctipoevento()); + row.createCell(4).setCellValue(leitorNaoFiscal.getValorTotal().doubleValue()); + } + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + workbook.write(bos); + + nomeArquivo = "consolidado_" + nomeArquivo.split("\\.")[0]; + File arquivo = File.createTempFile(nomeArquivo, ".xls"); + + FileOutputStream fos = new FileOutputStream(arquivo); + fos.write(bos.toByteArray()); + fos.close(); + + return arquivo; + + } + + private TipoEventoExtra getTipoEventoExtra(Integer tipoEventoExtraId) { + for (TipoEventoExtra tipoEvento : getListTipoEventoExtra()) { + if (tipoEventoExtraId.equals(tipoEvento.getTipoeventoextraId())) + return tipoEvento; + } + return null; + } + + private List getListTipoEventoExtra() { + if (lsTipoEventoExtra == null) { + lsTipoEventoExtra = tipoEventoExtraService.obtenerTodos(); + } + return lsTipoEventoExtra; + } + + @Override + public File buscarArquivoExportacaoECF(Date inicio, Date fim, Empresa empresa, Estado estado, String nomeArquivo) { + Connection connection = null; + + try { + connection = getConnectionRead(); + + List tempos = new ArrayList(0); + Long begin = 0L; + String tempo = null; + + begin = Calendar.getInstance().getTimeInMillis(); + log.info("Buscando os registros ECF"); + ExportacaoECF exportacaoECF = fiscalDAO.buscarRegistroECF(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado()); + log.info("Total de registros: " + exportacaoECF.getListaRegistroECF().size()); + tempo = infoTempo("ECF", begin); + log.info("Tempo na busca dos registros " + tempo); + tempos.add(tempo); + + // CFC + begin = Calendar.getInstance().getTimeInMillis(); + List listaRegistroECFTipoCFC = new ArrayList(0); + log.info("Buscando os registros CFC (ECF)"); +// listaRegistroECFTipoCFC.addAll(fiscalDAO.buscarRegistroECFTipoCFC(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado())); + listaRegistroECFTipoCFC.addAll(exportacaoECF.getListaRegistroECFTipoCFC()); + log.info("Total de registros: " + listaRegistroECFTipoCFC.size()); + tempo = infoTempo("CFC", begin); + log.info("Tempo na busca dos registros " + tempo); + tempos.add(tempo); + + // CCF + begin = Calendar.getInstance().getTimeInMillis(); + List listaRegistroECFTipoCCF = new ArrayList(0); + log.info("Buscando os registros CCF (ECF)"); +// listaRegistroECFTipoCCF.addAll(fiscalDAO.buscarRegistroECFTipoCCF(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado())); + listaRegistroECFTipoCCF.addAll(exportacaoECF.getListaRegistroECFTipoCCF()); + log.info("Total de registros: " + listaRegistroECFTipoCCF.size()); + tempo = infoTempo("CCF", begin); + log.info("Tempo na busca dos registros " + tempo); + tempos.add(tempo); + + // ICF + begin = Calendar.getInstance().getTimeInMillis(); + List listaRegistroECFTipoICF = new ArrayList(0); + log.info("Buscando os registros ICF (ECF)"); +// listaRegistroECFTipoICF.addAll(fiscalDAO.buscarRegistroECFTipoICF(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado())); + listaRegistroECFTipoICF.addAll(exportacaoECF.getListaRegistroECFTipoICF()); + log.info("Total de registros: " + listaRegistroECFTipoICF.size()); + tempo = infoTempo("ICF", begin); + log.info("Tempo na busca dos registros " + tempo); + tempos.add(tempo); + + // PRC + begin = Calendar.getInstance().getTimeInMillis(); + List listaRegistroECFTipoPRC = new ArrayList(0); + log.info("Buscando os registros PRC (ECF)"); +// listaRegistroECFTipoPRC.addAll(fiscalDAO.buscarRegistroECFTipoPRC(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado())); + listaRegistroECFTipoPRC.addAll(exportacaoECF.getListaRegistroECFTipoPRC()); + log.info("Total de registros: " + listaRegistroECFTipoPRC.size()); + tempo = infoTempo("PRC", begin); + log.info("Tempo na busca dos registros " + tempo); + tempos.add(tempo); + + fiscalDAO.limparCache(connection); + + return exportacaoFiscal.gerarArquivoECF(tempos, nomeArquivo, inicio, fim, estado.getCveestado(), empresa.getNombempresa(), listaRegistroECFTipoCFC, listaRegistroECFTipoCCF, listaRegistroECFTipoICF, + listaRegistroECFTipoPRC); + + } catch (Exception e) { + log.error(e.getMessage(), e); + + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + + throw new RuntimeException(e); + } + } + + return null; + } + + private String infoTempo(final String descricao, final Long inicio) { + final Long termino = Calendar.getInstance().getTimeInMillis(); + final Long tempo = termino - inicio; + + return descricao + ": " + String.format("%dm %ds", TimeUnit.MILLISECONDS.toMinutes(tempo), TimeUnit.MILLISECONDS.toSeconds(tempo) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(tempo))); + } + + @Override + public File buscarArquivoExportacaoRMD(Date inicio, Date fim, Empresa empresa, Estado estado, String nomeArquivo) { + Connection connection = null; + + try { + connection = getConnectionRead(); + + String tempo = null; + Long begin = 0L; + + begin = Calendar.getInstance().getTimeInMillis(); + log.info("Buscando os registros BPR"); + ExportacaoBPR exportacaoBPR = fiscalDAO.buscarRegistroBPR(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado()); + log.info("Total de registros: " + exportacaoBPR.getListaRegistroBPR().size()); + tempo = infoTempo("BPR", begin); + log.info("Tempo na busca dos registros " + tempo); + + begin = Calendar.getInstance().getTimeInMillis(); + log.info("Buscando os registros PAR"); +// List listaRegistroRMDTipoPAR = fiscalDAO.buscarRegistroRMDTipoPAR(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado()); + List listaRegistroRMDTipoPAR = exportacaoBPR.getListaRegistroBPRTipoPAR(); + log.info("Total de registros: " + listaRegistroRMDTipoPAR.size()); + tempo = infoTempo("PAR", begin); + log.info("Tempo na busca dos registros " + tempo); + + begin = Calendar.getInstance().getTimeInMillis(); + log.info("Buscando os registros RMD"); +// List listaRegistroRMDTipoRMD = fiscalDAO.buscarRegistroRMDTipoRMD(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado()); + List listaRegistroRMDTipoRMD = exportacaoBPR.getListaRegistroBPRTipoRMD(); + log.info("Total de registros: " + listaRegistroRMDTipoPAR.size()); + tempo = infoTempo("RMD", begin); + log.info("Tempo na busca dos registros " + tempo); + +// begin = Calendar.getInstance().getTimeInMillis(); +// log.info("Buscando os registros BPS"); +// List listaRegistroRMDTipoBPS = fiscalDAO.buscarRegistroRMDTipoBPS(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado()); + List listaRegistroRMDTipoBPS = null; +// log.info("Total de registros: " + listaRegistroRMDTipoPAR.size()); +// tempo = infoTempo("BPS", begin); +// log.info("Tempo na busca dos registros " + tempo); + +// begin = Calendar.getInstance().getTimeInMillis(); +// log.info("Buscando os registros DBP"); +// List listaRegistroRMDTipoDBP = fiscalDAO.buscarRegistroRMDTipoDBP(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado()); + List listaRegistroRMDTipoDBP = null; +// log.info("Total de registros: " + listaRegistroRMDTipoPAR.size()); +// tempo = infoTempo("DBP", begin); +// log.info("Tempo na busca dos registros " + tempo); + + begin = Calendar.getInstance().getTimeInMillis(); + log.info("Buscando os registros BPS"); +// List listaRegistroRMDTipoSeqBPS = fiscalDAO.buscarRegistroRMDSeqTipoBPS(connection, inicio, fim, empresa.getEmpresaId(), estado.getCveestado()); + List listaRegistroRMDTipoSeqBPS = exportacaoBPR.getListaRegistroBPRTipoSeqBPS(); + log.info("Total de registros: " + listaRegistroRMDTipoPAR.size()); + tempo = infoTempo("BPS", begin); + log.info("Tempo na busca dos registros " + tempo); + + fiscalDAO.limparCache(connection); + + return exportacaoFiscal.gerarArquivoRMD(inicio, fim, nomeArquivo, empresa.getNombempresa(), listaRegistroRMDTipoPAR, listaRegistroRMDTipoRMD, listaRegistroRMDTipoBPS, + listaRegistroRMDTipoDBP, listaRegistroRMDTipoSeqBPS); + + } catch (Exception e) { + log.error(e.getMessage(), e); + + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + + throw new RuntimeException(e); + } + } + + return null; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FlywayUtilServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FlywayUtilServiceImpl.java new file mode 100644 index 000000000..e584c9ffe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/FlywayUtilServiceImpl.java @@ -0,0 +1,31 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.FlywayUtilDAO; +import com.rjconsultores.ventaboletos.service.FlywayUtilService; + +@Service("flywayUtilService") +public class FlywayUtilServiceImpl implements FlywayUtilService { + + private static Logger log = LoggerFactory.getLogger(FlywayUtilServiceImpl.class); + + @Autowired + private FlywayUtilDAO flywayUtilDAO; + + @Override + public boolean existeErroExecucaoScript() { + boolean existeErro = true; + try{ + existeErro = flywayUtilDAO.existeErroExecucaoScript(); + }catch(Throwable t){ + log.error("",t); + } + + return existeErro; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FolioPreimpresoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FolioPreimpresoServiceImpl.java new file mode 100644 index 000000000..9edb9b8a3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/FolioPreimpresoServiceImpl.java @@ -0,0 +1,65 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.FolioPreimpresoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.FolioPreimpreso; +import com.rjconsultores.ventaboletos.service.FolioPreimpresoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("folioPreimpresoService") +public class FolioPreimpresoServiceImpl implements FolioPreimpresoService { + + @Autowired + private FolioPreimpresoDAO folioPreimpresoDAO; + + @Override + public List obtenerTodos() { + return folioPreimpresoDAO.obtenerTodos(); + } + + @Override + public FolioPreimpreso obtenerID(Integer id) { + return folioPreimpresoDAO.obtenerID(id); + } + + @Transactional + public FolioPreimpreso suscribir(FolioPreimpreso entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return folioPreimpresoDAO.suscribir(entidad); + } + + @Transactional + public FolioPreimpreso actualizacion(FolioPreimpreso entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return folioPreimpresoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(FolioPreimpreso entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + folioPreimpresoDAO.actualizacion(entidad); + } + + @Override + public FolioPreimpreso buscaFolioPreImpressoEstacionImpresora(Estacion estacion, Empresa empresa) { + return folioPreimpresoDAO.buscaFolioPreImpressoEstacionImpresora(estacion, empresa); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FormaPagamentoAgenciaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FormaPagamentoAgenciaServiceImpl.java new file mode 100644 index 000000000..18d902bf8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/FormaPagamentoAgenciaServiceImpl.java @@ -0,0 +1,85 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.zkoss.util.media.AMedia; + +import com.rjconsultores.ventaboletos.dao.FormaPagamentoAgenciaDAO; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.FormaPagamentoAgenciaService; + +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRResultSetDataSource; +import net.sf.jasperreports.engine.JasperRunManager; + +/** + * + * @author Administrador + */ +@Service("formaPagamentoAgenciaService") +public class FormaPagamentoAgenciaServiceImpl implements FormaPagamentoAgenciaService { + + @Autowired + private FormaPagamentoAgenciaDAO financeiroDAO; + @Autowired + private DataSource dataSource; + private static final Logger log = Logger.getLogger(FormaPagamentoAgenciaServiceImpl.class); + + public AMedia gerarInforme(InputStream informe, Map parameters) throws BusinessException { + Connection conn = null; + AMedia amedia = null; + + try { + conn = dataSource.getConnection(); + + ResultSet rs = financeiroDAO.executarSQL(conn, parameters); + JRDataSource jrDataSource = new JRResultSetDataSource(rs); + + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + Map args = new HashMap(); + args.put("dataInicio", dataInicio); + args.put("dataFinal", dataFinal); + final byte[] buf = JasperRunManager.runReportToPdf(informe, args, jrDataSource); + + final InputStream mediais = new ByteArrayInputStream(buf); + + amedia = new AMedia("financeiro.pdf", "pdf", null, mediais); + } catch (JRException e) { + log.error("Erro al generar reporte", e); + throw new BusinessException("MSG.Error"); + } catch (SQLException e) { + log.error("Error al obtener una conexcion en el datasource", e); + throw new BusinessException("MSG.Error"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException e) { + log.error("Error al cerrar la conexion", e); + } + } + } + + return amedia; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoDetServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoDetServiceImpl.java new file mode 100644 index 000000000..581aebe20 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoDetServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.FormaPagoDetDAO; +import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; +import com.rjconsultores.ventaboletos.service.FormaPagoDetService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("formaPagoDetService") +public class FormaPagoDetServiceImpl implements FormaPagoDetService { + + @Autowired + private FormaPagoDetDAO formaPagoDetDAO; + + public List obtenerTodos() { + return formaPagoDetDAO.obtenerTodos(); + } + + public FormaPagoDet obtenerID(Integer id) { + return formaPagoDetDAO.obtenerID(id); + } + + @Transactional + public FormaPagoDet suscribir(FormaPagoDet entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return formaPagoDetDAO.suscribir(entidad); + } + + @Transactional + public FormaPagoDet actualizacion(FormaPagoDet entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return formaPagoDetDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(FormaPagoDet entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + formaPagoDetDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java new file mode 100644 index 000000000..1dcce15a8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.FormaPagoDAO; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.service.FormaPagoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("formaPagoService") +public class FormaPagoServiceImpl implements FormaPagoService { + + private Integer[] formasPagoEspeciales = {4, 5, 6, 9, 10, 11, 96, 97, 98, 99}; + + @Autowired + private FormaPagoDAO formaPagoDAO; + + public List obtenerTodos() { + return formaPagoDAO.obtenerTodos(); + } + + public FormaPago obtenerID(Short id) { + return formaPagoDAO.obtenerID(id); + } + + @Transactional + public FormaPago suscribir(FormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return formaPagoDAO.suscribir(entidad); + } + + @Transactional + public FormaPago actualizacion(FormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return formaPagoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(FormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + formaPagoDAO.actualizacion(entidad); + } + + public List buscarPorDescricao(String descpago) { + return formaPagoDAO.buscarPorDescricao(descpago); + } + + public List buscarFormasPagoExceptoEspeciales() { + return formaPagoDAO.buscarTodosExceto(formasPagoEspeciales); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FuncionSistemaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FuncionSistemaServiceImpl.java new file mode 100644 index 000000000..29b6e152d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/FuncionSistemaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.FuncionSistemaDAO; +import com.rjconsultores.ventaboletos.entidad.FuncionSistema; +import com.rjconsultores.ventaboletos.service.FuncionSistemaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("funcionSistemaService") +public class FuncionSistemaServiceImpl implements FuncionSistemaService { + + @Autowired + private FuncionSistemaDAO funcionSistemaDAO; + + public List obtenerTodos() { + return funcionSistemaDAO.obtenerTodos(); + } + + public FuncionSistema obtenerID(Integer id) { + return funcionSistemaDAO.obtenerID(id); + } + + @Transactional + public FuncionSistema suscribir(FuncionSistema entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return funcionSistemaDAO.suscribir(entidad); + } + + @Transactional + public FuncionSistema actualizacion(FuncionSistema entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return funcionSistemaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(FuncionSistema entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + funcionSistemaDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/GrupoCategoriaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/GrupoCategoriaServiceImpl.java new file mode 100644 index 000000000..392655675 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/GrupoCategoriaServiceImpl.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.GrupoCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.GrupoCategoria; +import com.rjconsultores.ventaboletos.service.GrupoCategoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("grupoCategoriaService") +public class GrupoCategoriaServiceImpl implements GrupoCategoriaService { + + @Autowired + private GrupoCategoriaDAO grupoCategoriaDAO; + + public List obtenerTodos() { + return grupoCategoriaDAO.obtenerTodos(); + } + + public GrupoCategoria obtenerID(Integer id) { + return grupoCategoriaDAO.obtenerID(id); + } + + @Transactional + public GrupoCategoria suscribir(GrupoCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return grupoCategoriaDAO.suscribir(entidad); + } + + @Transactional + public GrupoCategoria actualizacion(GrupoCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return grupoCategoriaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(GrupoCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + grupoCategoriaDAO.actualizacion(entidad); + } + + @Override + public List buscar(String descricao) { + return grupoCategoriaDAO.buscar(descricao); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/GrupoCortesiasServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/GrupoCortesiasServiceImpl.java new file mode 100644 index 000000000..40bee2664 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/GrupoCortesiasServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.GrupoCortesiasDAO; +import com.rjconsultores.ventaboletos.entidad.GrupoCortesia; +import com.rjconsultores.ventaboletos.service.GrupoCortesiasService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("grupoCortesiaService") +public class GrupoCortesiasServiceImpl implements GrupoCortesiasService { + + @Autowired + private GrupoCortesiasDAO grupoCortesiasDAO; + + public List obtenerTodos() { + return grupoCortesiasDAO.obtenerTodos(); + } + + public GrupoCortesia obtenerID(Integer id) { + return grupoCortesiasDAO.obtenerID(id); + } + + @Transactional + public GrupoCortesia suscribir(GrupoCortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return grupoCortesiasDAO.suscribir(entidad); + } + + @Transactional + public GrupoCortesia actualizacion(GrupoCortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return grupoCortesiasDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(GrupoCortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + grupoCortesiasDAO.actualizacion(entidad); + } + + public List buscar(String descgrupo) { + return grupoCortesiasDAO.buscar(descgrupo); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/GrupoRutaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/GrupoRutaServiceImpl.java new file mode 100644 index 000000000..0851ec0d6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/GrupoRutaServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.GrupoRutaDAO; +import com.rjconsultores.ventaboletos.entidad.GrupoRuta; +import com.rjconsultores.ventaboletos.service.GrupoRutaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Bruno H. G. Gouvêa + * + */ +@Service("grupoRutaService") +public class GrupoRutaServiceImpl implements GrupoRutaService { + + @Autowired + private GrupoRutaDAO grupoRutaDAO; + + public List obtenerTodos() { + return grupoRutaDAO.obtenerTodos(); + } + + public GrupoRuta obtenerID(Integer id) { + return grupoRutaDAO.obtenerID(id); + } + + @Transactional + public GrupoRuta suscribir(GrupoRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return grupoRutaDAO.suscribir(entidad); + } + + @Transactional + public GrupoRuta actualizacion(GrupoRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return grupoRutaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(GrupoRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + grupoRutaDAO.actualizacion(entidad); + } + + public List buscarPorNome(String descgrupo) { + return grupoRutaDAO.buscarPorNome(descgrupo); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/HotelServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/HotelServiceImpl.java new file mode 100644 index 000000000..2f3baca89 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/HotelServiceImpl.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.HotelDAO; +import com.rjconsultores.ventaboletos.entidad.Hotel; +import com.rjconsultores.ventaboletos.service.HotelService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("hotelService") +public class HotelServiceImpl implements HotelService { + + @Autowired + private HotelDAO hotelDAO; + + public List obtenerTodos() { + return hotelDAO.obtenerTodos(); + } + + public Hotel obtenerID(Integer id) { + return hotelDAO.obtenerID(id); + } + + @Transactional + public Hotel suscribir(Hotel entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return hotelDAO.suscribir(entidad); + } + + @Transactional + public Hotel actualizacion(Hotel entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return hotelDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Hotel entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + hotelDAO.actualizacion(entidad); + } + + public List buscar(String deschotel) { + return hotelDAO.buscar(deschotel); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ImagemServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ImagemServiceImpl.java new file mode 100644 index 000000000..fa1944b8b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ImagemServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ImagemDAO; +import com.rjconsultores.ventaboletos.entidad.Imagem; +import com.rjconsultores.ventaboletos.service.ImagemService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("imagemService") +public class ImagemServiceImpl implements ImagemService { + + @Autowired + private ImagemDAO imagemDAO; + + public List obtenerTodos() { + return imagemDAO.obtenerTodos(); + } + + public Imagem obtenerID(Integer id) { + return imagemDAO.obtenerID(id); + } + + @Transactional(propagation = Propagation.SUPPORTS) + public Imagem suscribir(Imagem entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado() != null ? UsuarioLogado.getUsuarioLogado().getUsuarioId() : null); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return imagemDAO.suscribir(entidad); + } + + @Transactional + public Imagem actualizacion(Imagem entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return imagemDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Imagem entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + imagemDAO.actualizacion(entidad); + } + + @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) + public Imagem buscarPorNomeImagem(String nomeImagem) { + return imagemDAO.buscarPorNomeImagem(nomeImagem); + } + + public List buscar(String nombimagem) { + return imagemDAO.buscar(nombimagem); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesServiceImpl.java new file mode 100644 index 000000000..d8d8c1832 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesServiceImpl.java @@ -0,0 +1,658 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.brazilutils.br.cpfcnpj.Cpf; +import org.brazilutils.validation.ValidationException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.zkoss.util.media.Media; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteDireccion; +import com.rjconsultores.ventaboletos.entidad.ClienteFidelidad; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad; +import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion; +import com.rjconsultores.ventaboletos.passageirofrequente.vo.ClienteExcelVo; +import com.rjconsultores.ventaboletos.service.ClienteService; +import com.rjconsultores.ventaboletos.service.ImportacaoClientesService; +import com.rjconsultores.ventaboletos.service.TipoIdentificacionService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("importacaoClientesService") +public class ImportacaoClientesServiceImpl implements ImportacaoClientesService { + + @Autowired + TipoIdentificacionService tipoIdentificacionService; + @Autowired + private ClienteService clienteService; + private static Logger log = Logger.getLogger(ImportacaoClientesServiceImpl.class); + + @Override + public String[] lerArquivo(Reader reader, List empresas) { + String linha = null; + Integer index = 0; + StringBuilder qtdeGravados = new StringBuilder(); + StringBuilder erros = new StringBuilder(); + + Integer inseridos = 0; + Integer atualizados = 0; + + try { + BufferedReader leitor = new BufferedReader(reader); + + while ((linha = leitor.readLine()) != null) { + String[] dados = linha.replace("\"", "").split(","); + Integer[] gravados = salvarClientes(dados, empresas); + inseridos = gravados[0] + inseridos; + atualizados = gravados[1] + atualizados; + index++; + } + + leitor.close(); + + qtdeGravados.append("Gravados ").append(inseridos + atualizados).append(" clientes de ").append(index).append(" importados.\n"); + qtdeGravados.append("Atualizados ").append(atualizados).append(" clientes.\n"); + qtdeGravados.append("Inseridos ").append(inseridos).append(" novos clientes."); + + String[] resultado = { qtdeGravados.toString(), erros.toString() }; + return resultado; + + } catch (ArrayIndexOutOfBoundsException e) { + log.error(e); + String msg = "Erro ao gravar cliente na linha " + (index + 1) + " do arquivo."; + erros.append(msg); + String[] resultado = { "Houve erro ao gravar os clientes, consulte o arquivo de erros.", erros.toString() }; + return resultado; + } catch (Exception e) { + erros.append("Linha ").append(index).append(" do arquivo de clientes, erro: ").append(e.getCause().getCause()).append("\n"); + log.error(e); + String[] resultado = { e.toString() }; + return resultado; + } + } + + @Override + public Integer[] salvarClientes(String[] cliente, List empresas) throws Exception { + String nomeCliente = cliente[1].replace("\"", "").toUpperCase(); + Integer inseridos = new Integer(0); + Integer atualizados = new Integer(0); + Integer[] gravados = { 0, 0 }; + + for (Empresa e : empresas) { + + Cliente clienteGravar = clienteService.buscarPorNumeroFidelidade(cliente[0], e); + if (clienteGravar == null) { + clienteGravar = new Cliente(); + clienteGravar.setNombcliente(nomeCliente); + clienteGravar.setNumIdentificaUno(cliente[3]); + TarjetaFidelidad tarjetaFidelidad = new TarjetaFidelidad(); + tarjetaFidelidad.setActivo(Boolean.TRUE); + tarjetaFidelidad.setFecmodif(Calendar.getInstance().getTime()); + tarjetaFidelidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + // cast para Integer para remover 0 a esquerda: + tarjetaFidelidad.setNumTarjeta(cliente[0]); + + List ls = new ArrayList(); + + ClienteFidelidad clienteFidelidad = new ClienteFidelidad(); + clienteFidelidad.setTarjetaFidelidad(tarjetaFidelidad); + clienteFidelidad.setActivo(Boolean.TRUE); + clienteFidelidad.setFecmodif(Calendar.getInstance().getTime()); + clienteFidelidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clienteFidelidad.setCliente(clienteGravar); + clienteFidelidad.setEmpresa(e); + ls.add(clienteFidelidad); + + clienteGravar.setListClienteFidelidad(ls); + + clienteService.suscribir(clienteGravar); + inseridos = inseridos + 1; + gravados[0] = gravados[0] + inseridos; + } else { + clienteGravar.setNombcliente(nomeCliente); + clienteGravar.setNumIdentificaUno(cliente[3]); + clienteService.actualizacion(clienteGravar); + + atualizados = atualizados + 1; + gravados[1] = gravados[1] + atualizados; + } + } + return gravados; + } + + @Override + public String[] lerArquivoExcel(Media media, List empresas) { + + List lsTipoIdentificacion = tipoIdentificacionService.obtenerTodos(); + TipoIdentificacion tipoIdentificacionUno = null; + TipoIdentificacion tipoIdentificacionDoos = null; + + for (TipoIdentificacion t : lsTipoIdentificacion) { + if (t.getDesctipo().equalsIgnoreCase("cpf")) { + tipoIdentificacionUno = t; + } else if (t.getDesctipo().equalsIgnoreCase("rg")) { + tipoIdentificacionDoos = t; + } + if (tipoIdentificacionUno != null && tipoIdentificacionDoos != null) + break; + } + + Boolean usaCPFComoFidelidade = false; + Integer index = 1; + StringBuilder qtdeGravados = new StringBuilder(); + StringBuilder erros = new StringBuilder(); + Integer inseridos = 0; + Integer atualizados = 0; + Integer desconsiderados =0; + InputStream isMExcel = media.getStreamData(); + Sheet sheet = null; + + if (media.getFormat().equals("xls")) { + HSSFWorkbook wb; + try { + wb = new HSSFWorkbook(isMExcel); + sheet = wb.getSheetAt(0); + } catch (IOException e) { + e.printStackTrace(); + } + + } else if (media.getFormat().equals("xlsx")) { + XSSFWorkbook wb; + try { + wb = new XSSFWorkbook(isMExcel); + sheet = wb.getSheetAt(0); + } catch (IOException e) { + log.error("",e); + } + } + + int rows = sheet.getPhysicalNumberOfRows(); + + log.info(String.format("Quantidade cliente:%s",rows)); + + if (validaSheet(sheet)) { + usaCPFComoFidelidade = ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.USA_CPF_COMO_FIDELIDADE.getDescricao()); + log.info(String.format("usaCPFComoFidelidade:%s",usaCPFComoFidelidade)); + try { + for (index = 1; index < rows; index++) { + log.info(String.format("index cliente:%s",index)); + + Row row = sheet.getRow(index); + if (row == null){ + log.info("index/row empty"); + continue; + } + + Iterator cellIterator = row.cellIterator(); + ClienteExcelVo cliente = new ClienteExcelVo(); + + while (cellIterator.hasNext()) { + Cell cell = cellIterator.next(); + switch (cell.getColumnIndex()) { + case 0: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setCpf(cell.getStringCellValue()); + System.out.println(cliente.getCpf()); + break; + case 1: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setRg(cell.getStringCellValue()); + break; + case 2: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setNome(cell.getStringCellValue()); + break; + case 3: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setEmail(cell.getStringCellValue()); + break; + case 4: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setTelefone(cell.getStringCellValue()); + break; + case 5: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setCelular(cell.getStringCellValue()); + break; + case 6: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setFax(cell.getStringCellValue()); + break; + case 7: + + String dt = null; + + if (cell.getCellType() == Cell.CELL_TYPE_STRING) { + dt = cell.getStringCellValue(); + } else if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { + dt = cell.getDateCellValue() != null ? new SimpleDateFormat("dd/MM/yyyy").format(cell.getDateCellValue()) : null; + } + cliente.setNascimento(dt); + + break; + case 8: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setSexo(cell.getStringCellValue()); + break; + case 9: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setEndereco(cell.getStringCellValue()); + break; + case 10: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setBairro(cell.getStringCellValue()); + break; + case 11: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setCidade(cell.getStringCellValue()); + break; + case 12: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setEstado(cell.getStringCellValue()); + break; + + } + } + log.info(String.format("cliente:%s cpf:%s",cliente.getNome(),cliente.getCpf())); + + if (validaDadosPlanilha(cliente, erros)) { + log.info("enviado para gravação..."); + try{ + Integer[] gravados = salvarClienteExcel(empresas, usaCPFComoFidelidade, cliente, tipoIdentificacionUno, tipoIdentificacionDoos); + inseridos = gravados[0] + inseridos; + atualizados = gravados[1] + atualizados; + desconsiderados = gravados[2] + desconsiderados; + }catch(Throwable e){ + log.error("Erro na gravação do registro. Favor revisar",e); + log.info("continuando importação"); + } + + } else { + log.info("cliente não validado"); + erros.append("\n erro ao gravar o cliente na linha "); + erros.append(index + 1).append(" do arquivo."); + } + } + qtdeGravados.append("Gravados ").append(inseridos + atualizados).append(" clientes de ").append(index-1).append(" importados.\n"); + qtdeGravados.append("Desconsiderados ").append(desconsiderados).append(" clientes.\n"); + qtdeGravados.append("Atualizados ").append(atualizados).append(" clientes.\n"); + qtdeGravados.append("Inseridos ").append(inseridos).append(" novos clientes."); + String[] resultado = { qtdeGravados.toString(), erros.toString() }; + + log.info("importação finalizada"); + + return resultado; + + } catch (ArrayIndexOutOfBoundsException e) { + e.printStackTrace(); + String msg = "Erro ao gravar cliente na linha " + (index + 1) + " do arquivo."; + erros.append(msg); + String[] resultado = { "Houve erro ao gravar os clientes, consulte o arquivo de erros.", erros.toString() }; + return resultado; + } catch (Exception e) { + e.printStackTrace(); + erros.append("Linha ").append(index).append(" do arquivo de clientes, erro: ").append(e.getCause().getCause()).append("\n"); + String[] resultado = { "Houve erro ao gravar os clientes, consulte o arquivo de erros.", erros.toString() }; + return resultado; + } + + } else { + erros.append("A estrutura do arquivo esta com erro ").append("\n"); + String[] resultado = { "Houve erro ao gravar os clientes, consulte o arquivo de erros.", erros.toString() }; + return resultado; + } + + } + + private Integer[] salvarClienteExcel(List empresas, Boolean usaCPFComoFidelidade, ClienteExcelVo cliente, TipoIdentificacion tipoIdentificacionUno, TipoIdentificacion tipoIdentificacionDoos) throws ParseException { + Integer inseridos = new Integer(0); + Integer atualizados = new Integer(0); + Integer desconsiderados = new Integer(0); + Integer[] gravados = { 0, 0, 0 }; + Cliente clienteGravar = new Cliente(); + List lsCliente = clienteService.buscarPorDocumento(cliente.getCpf()); + + if (lsCliente != null && !lsCliente.isEmpty()) { + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.IS_DESCONSIDERA_CLIENTE_NA_BASE.getDescricao())) { + desconsiderados = desconsiderados + 1; + gravados[2] = gravados[2] + desconsiderados; + return gravados; + } else { + clienteGravar = lsCliente.get(0); + } + } + + // if (true) { + criarFidelidadesTodasEmpresas(clienteGravar, empresas, cliente); + // } + clienteGravar.setFecnacimiento(StringUtils.isEmpty(cliente.getNascimento()) ? null : retornaDate(cliente.getNascimento())); + clienteGravar.setDesccorreo(cliente.getEmail()); + clienteGravar.setNombcliente(cliente.getNome()); + clienteGravar.setNumfax(cliente.getFax()); + clienteGravar.setNumtelefono(cliente.getTelefone()); + clienteGravar.setNumtelefonodos(cliente.getCelular()); + clienteGravar.setIndsexo(cliente.getSexo()); + clienteGravar.setNumIdentificaUno(cliente.getCpf()); + clienteGravar.setTipoIdentificacionUno(tipoIdentificacionUno); + if (!StringUtils.isEmpty(cliente.getRg())) { + clienteGravar.setNumIdentificaDos(cliente.getRg()); + clienteGravar.setTipoIdentificacionDos(tipoIdentificacionDoos); + } + setDirecion(clienteGravar, cliente); + if (clienteGravar.getClienteId() == null) { + clienteGravar.setFecCadastro(new Date()); + clienteService.suscribir(clienteGravar); + inseridos = inseridos + 1; + gravados[0] = gravados[0] + inseridos; + + } else { + clienteService.actualizacion(clienteGravar); + atualizados = atualizados + 1; + gravados[1] = gravados[1] + atualizados; + } + + return gravados; + } + + private void setDirecion(Cliente cliente, ClienteExcelVo cExcel) { + List lsDirecion = new ArrayList(); + ClienteDireccion direccion = new ClienteDireccion(); + if ((cliente.getLsClienteDireccion() != null) + && (!cliente.getLsClienteDireccion().isEmpty())) { + if (cliente.getLsClienteDireccion().get(0) != null) { + direccion = cliente.getLsClienteDireccion().get(0); + cliente.getLsClienteDireccion().remove(0); + } + } + direccion.setDesestado(cExcel.getEstado()); + direccion.setDesciudad(cExcel.getCidade()); + direccion.setDesccolonia(cExcel.getBairro()); + direccion.setDesccalle(cExcel.getEndereco()); + direccion.setActivo(true); + direccion.setClienteId(cliente); + lsDirecion.add(direccion); + cliente.setLsClienteDireccion(lsDirecion); + + } + + private void criarFidelidadesTodasEmpresas(Cliente cliente, List empresas, ClienteExcelVo cExce) { + + Boolean achou = false; + List fidelidades = null; + + if (cliente.getClienteId() == null) { + fidelidades = new ArrayList(); + for (Empresa e : empresas) { + fidelidades.add(criarFidelidade(e, cExce)); + } + cliente.setListClienteFidelidad(fidelidades); + + } else { + fidelidades = cliente.getListClienteFidelidad(); + if (fidelidades == null || fidelidades.isEmpty()) { + for (Empresa e : empresas) { + fidelidades.add(criarFidelidade(e, cExce)); + } + } else { + for (Empresa e : empresas) { + for (ClienteFidelidad f : fidelidades) { + if (f.getEmpresa().equals(e)) { + f.setActivo(true); + f.setFecmodif(new Date()); + TarjetaFidelidad tarjetaFidelidad = f.getTarjetaFidelidad(); + if (tarjetaFidelidad != null) { + tarjetaFidelidad.setActivo(true); + tarjetaFidelidad.setFecmodif(new Date()); + } + + achou = true; + break; + } + } + if (!achou) { + fidelidades.add(criarFidelidade(e, cExce)); + } + achou = false; + } + } + } + + } + + // private List criarFidelidadesTodasEmpresas(List fidelidades, List empresas, ClienteExcelVo cExce) { + // + // List result = new ArrayList(); + // Boolean achou = false; + // if (fidelidades==null || fidelidades.isEmpty()) { + // for (Empresa e : empresas) { + // result.add(criarFidelidade(e, cExce)); + // } + // } else { + // for (Empresa e : empresas) { + // for (ClienteFidelidad f : fidelidades) { + // if (f.getEmpresa().equals(e)) { + // f.setActivo(true); + // f.setFecmodif(new Date()); + // TarjetaFidelidad tarjetaFidelidad = f.getTarjetaFidelidad(); + // if(tarjetaFidelidad!=null){ + // tarjetaFidelidad.setActivo(true); + // tarjetaFidelidad.setFecmodif(new Date()); + // } + // result.add(f); + // achou = true; + // break; + // } + // } + // if (!achou) { + // result.add(criarFidelidade(e, cExce)); + // } + // achou = false; + // } + // } + // return result; + // } + + private ClienteFidelidad criarFidelidade(Empresa e, ClienteExcelVo cExcel) { + ClienteFidelidad clienteFidelidad = new ClienteFidelidad(); + TarjetaFidelidad tarjetaFidelidad = new TarjetaFidelidad(); + tarjetaFidelidad.setNumTarjeta(cExcel.getCpf()); + tarjetaFidelidad.setActivo(true); + tarjetaFidelidad.setFecmodif(Calendar.getInstance().getTime()); + tarjetaFidelidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + clienteFidelidad.setEmpresa(e); + clienteFidelidad.setActivo(true); + clienteFidelidad.setFecmodif(Calendar.getInstance().getTime()); + clienteFidelidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clienteFidelidad.setTarjetaFidelidad(tarjetaFidelidad); + + return clienteFidelidad; + } + + public Boolean validaDadosPlanilha(ClienteExcelVo cliente, StringBuilder erros) { + + if (!StringUtils.isEmpty(cliente.getCpf())) { + try { + Long.parseLong(cliente.getCpf()); + if (!validarCPF(cliente.getCpf())) { + erros.append("CPF inválido."); + return false; + } + } catch (NumberFormatException e) { + erros.append("O CPF deve possuir apenas números."); + return false; + + } catch (Exception e) { + e.getMessage(); + erros.append("Erro ao obter o CPF."); + return false; + } + + } else { + erros.append("O CPF e obrigatório."); + return false; + } + + if (StringUtils.isEmpty(cliente.getNome())) { + erros.append("O NOME e obrigatório."); + return false; + } + + if (!StringUtils.isEmpty(cliente.getSexo())) { + if (!(cliente.getSexo().equalsIgnoreCase("f") || cliente.getSexo().equalsIgnoreCase("m") || cliente.getSexo().equalsIgnoreCase("masculino") || cliente.getSexo().equalsIgnoreCase("feminino"))) { + erros.append("Campo sexo foi informado incorretamente."); + return false; + } + } + + if (!StringUtils.isEmpty(cliente.getNascimento()) && cliente.getNascimento().matches("(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/((19|20)\\d\\d)")) { + SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); + try { + dateFormat.parse(cliente.getNascimento()); + } catch (Exception e) { + erros.append("Campo Nascimento foi informado incorretamente."); + return false; + } + } + return true; + } + + private Boolean validaSheet(Sheet sheet) { + + Row row = sheet.getRow(0); + Iterator cellIterator = row.cellIterator(); + + while (cellIterator.hasNext()) { + Cell cell = cellIterator.next(); + switch (cell.getColumnIndex()) { + case 0: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesController.HEADERCOLUMN.cpf"))) { + break; + } + return false; + case 1: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesController.HEADERCOLUMN.rg"))) { + break; + } + return false; + case 2: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesController.HEADERCOLUMN.nome"))) { + break; + } + return false; + case 3: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesController.HEADERCOLUMN.email"))) { + break; + } + return false; + + case 4: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesController.HEADERCOLUMN.telefone"))) { + break; + } + return false; + + case 5: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesController.HEADERCOLUMN.celular"))) { + break; + } + return false; + + case 6: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesController.HEADERCOLUMN.fax"))) { + break; + } + return false; + + case 7: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesController.HEADERCOLUMN.nascimento"))) { + break; + } + return false; + + case 8: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesController.HEADERCOLUMN.sexo"))) { + break; + } + return false; + case 9: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesController.HEADERCOLUMN.endereco"))) { + break; + } + return false; + case 10: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesController.HEADERCOLUMN.bairro"))) { + break; + } + return false; + case 11: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesController.HEADERCOLUMN.cidade"))) { + break; + } + return false; + case 12: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesController.HEADERCOLUMN.estado"))) { + break; + } + return false; + + } + + } + return true; + } + + private Date retornaDate(String date) throws ParseException { + + SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); + Date data = null; + data = (Date) dateFormat.parse(date); + return data; + + } + + private Boolean validarCPF(String numDoc) { + try { + // https://dicasdeprogramacao.com.br/algoritmo-para-validar-cpf + // O VAlidador não pegava os CPFs com todos os numeros iguais + if (numDoc.length() != 11 || numDoc.equals("00000000000") || numDoc.equals("11111111111") || numDoc.equals("22222222222") || + numDoc.equals("33333333333") || numDoc.equals("44444444444") || numDoc.equals("55555555555") || + numDoc.equals("66666666666") || numDoc.equals("77777777777") || numDoc.equals("88888888888") || + numDoc.equals("99999999999")) { + return false; + } + + Cpf cpf = new Cpf(numDoc); + if (!cpf.isValid()) { + return false; + } + } catch (ValidationException e) { + return false; + } + + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java new file mode 100644 index 000000000..82838b3b2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java @@ -0,0 +1,719 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.brazilutils.br.cpfcnpj.Cpf; +import org.brazilutils.validation.ValidationException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.zkoss.util.media.Media; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.entidad.Cliente; +import com.rjconsultores.ventaboletos.entidad.ClienteDireccion; +import com.rjconsultores.ventaboletos.entidad.ClienteFidelidad; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad; +import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion; +import com.rjconsultores.ventaboletos.passageirofrequente.vo.ClienteExcelVo; +import com.rjconsultores.ventaboletos.service.ClienteService; +import com.rjconsultores.ventaboletos.service.ImportacaoClientesSrvpService; +import com.rjconsultores.ventaboletos.service.TipoIdentificacionService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("importacaoClientesSrvpService") +public class ImportacaoClientesSrvpServiceImpl implements ImportacaoClientesSrvpService { + + private static final String ESPACO_CARACTERE_ASCII = "[^\\x00-\\x7F]"; + @Autowired + TipoIdentificacionService tipoIdentificacionService; + @Autowired + private ClienteService clienteService; + private static Logger log = Logger.getLogger(ImportacaoClientesSrvpServiceImpl.class); + + @Override + public String[] lerArquivo(Reader reader, List empresas) { + String linha = null; + Integer index = 0; + StringBuilder qtdeGravados = new StringBuilder(); + StringBuilder erros = new StringBuilder(); + + Integer inseridos = 0; + Integer atualizados = 0; + + try { + BufferedReader leitor = new BufferedReader(reader); + + while ((linha = leitor.readLine()) != null) { + String[] dados = linha.replace("\"", "").split(","); + Integer[] gravados = salvarClientes(dados, empresas); + inseridos = gravados[0] + inseridos; + atualizados = gravados[1] + atualizados; + index++; + } + + leitor.close(); + + qtdeGravados.append("Gravados ").append(inseridos + atualizados).append(" clientes de ").append(index).append(" importados.\n"); + qtdeGravados.append("Atualizados ").append(atualizados).append(" clientes.\n"); + qtdeGravados.append("Inseridos ").append(inseridos).append(" novos clientes."); + + String[] resultado = { qtdeGravados.toString(), erros.toString() }; + return resultado; + + } catch (ArrayIndexOutOfBoundsException e) { + log.error(e); + String msg = "Erro ao gravar cliente na linha " + (index + 1) + " do arquivo."; + erros.append(msg); + String[] resultado = { "Houve erro ao gravar os clientes, consulte o arquivo de erros.", erros.toString() }; + return resultado; + } catch (Exception e) { + erros.append("Linha ").append(index).append(" do arquivo de clientes, erro: ").append(e.getCause().getCause()).append("\n"); + log.error(e); + String[] resultado = { e.toString() }; + return resultado; + } + } + + @Override + public Integer[] salvarClientes(String[] cliente, List empresas) throws Exception { + String nomeCliente = cliente[1].replace("\"", "").toUpperCase(); + Integer inseridos = new Integer(0); + Integer atualizados = new Integer(0); + Integer[] gravados = { 0, 0 }; + + for (Empresa e : empresas) { + + Cliente clienteGravar = clienteService.buscarPorNumeroFidelidade(cliente[0], e); + if (clienteGravar == null) { + clienteGravar = new Cliente(); + clienteGravar.setNombcliente(nomeCliente); + clienteGravar.setNumIdentificaUno(cliente[3]); + TarjetaFidelidad tarjetaFidelidad = new TarjetaFidelidad(); + tarjetaFidelidad.setActivo(Boolean.TRUE); + tarjetaFidelidad.setFecmodif(Calendar.getInstance().getTime()); + tarjetaFidelidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + // cast para Integer para remover 0 a esquerda: + tarjetaFidelidad.setNumTarjeta(cliente[0]); + + List ls = new ArrayList(); + + ClienteFidelidad clienteFidelidad = new ClienteFidelidad(); + clienteFidelidad.setTarjetaFidelidad(tarjetaFidelidad); + clienteFidelidad.setActivo(Boolean.TRUE); + clienteFidelidad.setFecmodif(Calendar.getInstance().getTime()); + clienteFidelidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clienteFidelidad.setCliente(clienteGravar); + clienteFidelidad.setEmpresa(e); + ls.add(clienteFidelidad); + + clienteGravar.setListClienteFidelidad(ls); + + clienteService.suscribir(clienteGravar); + inseridos = inseridos + 1; + gravados[0] = gravados[0] + inseridos; + } else { + clienteGravar.setNombcliente(nomeCliente); + clienteGravar.setNumIdentificaUno(cliente[3]); + clienteService.actualizacion(clienteGravar); + + atualizados = atualizados + 1; + gravados[1] = gravados[1] + atualizados; + } + } + return gravados; + } + + @Override + public String[] lerArquivoExcel(Media media, List empresas) { + + List lsTipoIdentificacion = tipoIdentificacionService.obtenerTodos(); + TipoIdentificacion tipoIdentificacionUno = null; + TipoIdentificacion tipoIdentificacionDoos = null; + + for (TipoIdentificacion t : lsTipoIdentificacion) { + if (t.getDesctipo().equalsIgnoreCase("cpf")) { + tipoIdentificacionUno = t; + } else if (t.getDesctipo().equalsIgnoreCase("rg")) { + tipoIdentificacionDoos = t; + } + if (tipoIdentificacionUno != null && tipoIdentificacionDoos != null) + break; + } + + Boolean usaCPFComoFidelidade = false; + Integer index = 1; + StringBuilder qtdeGravados = new StringBuilder(); + StringBuilder erros = new StringBuilder(); + Integer inseridos = 0; + Integer atualizados = 0; + Integer desconsiderados =0; + InputStream isMExcel = media.getStreamData(); + Sheet sheet = null; + + if (media.getFormat().equals("xls")) { + HSSFWorkbook wb; + try { + wb = new HSSFWorkbook(isMExcel); + sheet = wb.getSheetAt(0); + } catch (IOException e) { + e.printStackTrace(); + } + + } else if (media.getFormat().equals("xlsx")) { + XSSFWorkbook wb; + try { + wb = new XSSFWorkbook(isMExcel); + sheet = wb.getSheetAt(0); + } catch (IOException e) { + log.error("",e); + } + } + + int rows = sheet.getPhysicalNumberOfRows(); + + log.info(String.format("Quantidade cliente:%s",rows)); + + if (validaSheet(sheet)) { + usaCPFComoFidelidade = ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.USA_CPF_COMO_FIDELIDADE.getDescricao()); + log.info(String.format("usaCPFComoFidelidade:%s",usaCPFComoFidelidade)); + try { + for (index = 1; index < rows; index++) { + log.info(String.format("index cliente:%s",index)); + + Row row = sheet.getRow(index); + if (row == null){ + log.info("index/row empty"); + continue; + } + + Iterator cellIterator = row.cellIterator(); + ClienteExcelVo cliente = new ClienteExcelVo(); + + while (cellIterator.hasNext()) { + Cell cell = cellIterator.next(); + switch (cell.getColumnIndex()) { + case 0: + cell.setCellType(Cell.CELL_TYPE_NUMERIC); + try { + cliente.setNumfidelidade(new Long(Math.round(cell.getNumericCellValue())).toString()); + }catch(Exception e) { + log.error("Erro na gravação do registro. Favor revisar",e); + } + break; + case 1: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setNome(cell.getStringCellValue()); + break; + case 2: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setTipodoc(cell.getStringCellValue()); + break; + case 3: + cell.setCellType(Cell.CELL_TYPE_NUMERIC); + String numDocString = null; + try { + numDocString = new Long(Math.round(cell.getNumericCellValue())).toString(); + }catch(Exception e) { + log.error("Erro na gravação do registro. Favor revisar",e); + erros.append(cliente.getNumfidelidade() + " - Numero doc nao numerico: " + new Long(Math.round(cell.getNumericCellValue())).toString()); + erros.append("\n"); + + } + cliente.setNumerodoc(numDocString); + cliente.setCpf(numDocString); + cliente.setRg(numDocString); + break; + case 4: + String dt = null; + try { + if (cell.getCellType() == Cell.CELL_TYPE_STRING && cell.getStringCellValue().length() ==6 ) { + dt = cell.getStringCellValue(); + } else if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC ) { + String dataString = new Long(Math.round(cell.getNumericCellValue())).toString(); + if(dataString!=null && dataString.length() ==6) { + Date data = DateUtil.getDateFromString(dataString, DateUtil.ddMMaa_sembarra); + dt = DateUtil.getStringDate(data, DateUtil.ddMMaa_anodoisdigitos); + cliente.setNascimento(dt); + }else { + cliente.setNascimento(null); + erros.append(cliente.getNumfidelidade() + " - Data Nascimento formato incorreto: " + new Long(Math.round(cell.getNumericCellValue())).toString()); + erros.append("\n"); + + } + }else { + cliente.setNascimento(null); + erros.append(cliente.getNumfidelidade() + " - Data Nascimento formato incorreto: " + cell.getStringCellValue().trim().replaceAll(" ","").toString()); + erros.append("\n"); + + } + }catch (Exception e) { + cliente.setNascimento(null); + erros.append(cliente.getNumfidelidade() + " - Data Nascimento formato incorreto: " + cell.getStringCellValue().trim().replaceAll(" ","").toString()); + erros.append("\n"); + } + break; + case 5: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setNacionalidade(cell.getStringCellValue()); + break; + case 6: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setPaisresidencia(cell.getStringCellValue()); + break; + case 7: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setOcupacao(cell.getStringCellValue()); + break; + case 8: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setSexo(cell.getStringCellValue()); + break; + case 9: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setEstadocivil(cell.getStringCellValue()); + break; + case 10: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setEmail(cell.getStringCellValue()); + break; + case 11: + try { + if(cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { + cliente.setTelefone(new Long(Math.round(cell.getNumericCellValue())).toString().trim().replaceAll(" ","")); + }else { + if(StringUtils.isNotBlank(cell.getStringCellValue())) { + try { + cliente.setTelefone(new Long(cell.getStringCellValue().trim().replaceAll(" ","")).toString()); + }catch (NumberFormatException e) { + cliente.setTelefone(""); + erros.append(cliente.getNumfidelidade() + " - Numero de Telefone incorreto: " + cell.getStringCellValue().trim().replaceAll(" ","").toString()); + erros.append("\n"); + } + } + } + }catch(Exception e) { + log.error("Erro na gravação do registro. Favor revisar",e); + } + break; + case 12: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setEndereco(cell.getStringCellValue()); + break; + case 13: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setCidade(cell.getStringCellValue()); + break; + case 14: + try { + cliente.setCep(new Long(Math.round(cell.getNumericCellValue())).toString()); + }catch(Exception e) { + log.error("Erro na gravação do registro. Favor revisar",e); + } + break; + case 15: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setObservacao(cell.getStringCellValue()); + break; + case 16: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setDesconto(cell.getStringCellValue()); + break; + } + } + + if (validaDadosPlanilha(cliente, erros)) { + log.info(String.format("cliente:%s cpf:%s RG:%s",cliente.getNome(),cliente.getCpf(), cliente.getRg())); + log.info("enviado para gravação..."); + try{ + Integer[] gravados = salvarClienteExcel(empresas, usaCPFComoFidelidade, cliente, tipoIdentificacionUno, tipoIdentificacionDoos); + inseridos = gravados[0] + inseridos; + atualizados = gravados[1] + atualizados; + desconsiderados = gravados[2] + desconsiderados; + }catch(Throwable e){ + log.error("Erro na gravação do registro. Favor revisar",e); + log.info("continuando importação"); + } + + } else { + log.info(String.format("cliente:%s cpf:%s",cliente.getNome(),cliente.getCpf())); + log.info("cliente não validado"); + erros.append("\n erro ao gravar o cliente na linha "); + erros.append(index + 1).append(" do arquivo."); + } + } + qtdeGravados.append("Gravados ").append(inseridos + atualizados).append(" clientes de ").append(index-1).append(" importados.\n"); + qtdeGravados.append("Desconsiderados ").append(desconsiderados).append(" clientes.\n"); + qtdeGravados.append("Atualizados ").append(atualizados).append(" clientes.\n"); + qtdeGravados.append("Inseridos ").append(inseridos).append(" novos clientes."); + String[] resultado = { qtdeGravados.toString(), erros.toString() }; + + log.info("importação finalizada"); + + return resultado; + + } catch (ArrayIndexOutOfBoundsException e) { + e.printStackTrace(); + String msg = "Erro ao gravar cliente na linha " + (index + 1) + " do arquivo."; + erros.append(msg); + String[] resultado = { "Houve erro ao gravar os clientes, consulte o arquivo de erros.", erros.toString() }; + return resultado; + } catch (Exception e) { + e.printStackTrace(); + erros.append("Linha ").append(index).append(" do arquivo de clientes, erro: ").append(e.getCause().getCause()).append("\n"); + String[] resultado = { "Houve erro ao gravar os clientes, consulte o arquivo de erros.", erros.toString() }; + return resultado; + } + + } else { + erros.append("A estrutura do arquivo esta com erro ").append("\n"); + String[] resultado = { "Houve erro ao gravar os clientes, consulte o arquivo de erros.", erros.toString() }; + return resultado; + } + + } + + private Integer[] salvarClienteExcel(List empresas, Boolean usaCPFComoFidelidade, ClienteExcelVo cliente, TipoIdentificacion tipoIdentificacionUno, TipoIdentificacion tipoIdentificacionDoos) throws ParseException { + Integer inseridos = new Integer(0); + Integer atualizados = new Integer(0); + Integer desconsiderados = new Integer(0); + Integer[] gravados = { 0, 0, 0 }; + Cliente clienteGravar = new Cliente(); + + List lsCliente = null; + if(StringUtils.isNotEmpty(cliente.getCpf())) { + lsCliente = clienteService.buscarPorDocumento(cliente.getCpf()); + } + + if (lsCliente != null && !lsCliente.isEmpty()) { + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.IS_DESCONSIDERA_CLIENTE_NA_BASE.getDescricao())) { + desconsiderados = desconsiderados + 1; + gravados[2] = gravados[2] + desconsiderados; + return gravados; + } else { + clienteGravar = lsCliente.get(0); + } + }else { + Cliente clienteGravarAux = clienteService.buscarPorNumeroFidelidade(cliente.getNumfidelidade()); + if(clienteGravarAux != null) { + clienteGravar = clienteGravarAux; + } + } + + criarFidelidadesTodasEmpresas(clienteGravar, empresas, cliente); + + clienteGravar.setFecnacimiento(StringUtils.isEmpty(cliente.getNascimento()) ? null : retornaDate(cliente.getNascimento())); + clienteGravar.setDesccorreo(cliente.getEmail()); + clienteGravar.setNombcliente(cliente.getNome()); + clienteGravar.setNumfax(cliente.getFax()); + clienteGravar.setNumtelefono(cliente.getTelefone()); + clienteGravar.setNumtelefonodos(cliente.getCelular()); + clienteGravar.setIndsexo(cliente.getSexo()); + clienteGravar.setNumIdentificaUno(cliente.getCpf()); + clienteGravar.setTipoIdentificacionUno(tipoIdentificacionUno); + if (!StringUtils.isEmpty(cliente.getRg())) { + clienteGravar.setNumIdentificaDos(cliente.getRg()); + clienteGravar.setTipoIdentificacionDos(tipoIdentificacionDoos); + } + setDirecion(clienteGravar, cliente); + if (clienteGravar.getClienteId() == null) { + clienteGravar.setFecCadastro(new Date()); + clienteService.suscribir(clienteGravar); + inseridos = inseridos + 1; + gravados[0] = gravados[0] + inseridos; + + } else { + clienteService.actualizacion(clienteGravar); + atualizados = atualizados + 1; + gravados[1] = gravados[1] + atualizados; + } + + return gravados; + } + + private void setDirecion(Cliente cliente, ClienteExcelVo cExcel) { + List lsDirecion = new ArrayList(); + ClienteDireccion direccion = new ClienteDireccion(); + if ((cliente.getLsClienteDireccion() != null) + && (!cliente.getLsClienteDireccion().isEmpty())) { + if (cliente.getLsClienteDireccion().get(0) != null) { + direccion = cliente.getLsClienteDireccion().get(0); + cliente.getLsClienteDireccion().remove(0); + } + } + direccion.setDesestado(cExcel.getEstado()); + direccion.setDesciudad(cExcel.getCidade()); + direccion.setDesccolonia(cExcel.getBairro()); + direccion.setDesccalle(cExcel.getEndereco()); + direccion.setActivo(true); + direccion.setClienteId(cliente); + lsDirecion.add(direccion); + cliente.setLsClienteDireccion(lsDirecion); + + } + + private void criarFidelidadesTodasEmpresas(Cliente cliente, List empresas, ClienteExcelVo cExce) { + + Boolean achou = false; + List fidelidades = null; + + if (cliente.getClienteId() == null) { + fidelidades = new ArrayList(); + for (Empresa e : empresas) { + fidelidades.add(criarFidelidade(e, cExce)); + } + cliente.setListClienteFidelidad(fidelidades); + + } else { + fidelidades = cliente.getListClienteFidelidad(); + if (fidelidades == null || fidelidades.isEmpty()) { + for (Empresa e : empresas) { + fidelidades.add(criarFidelidade(e, cExce)); + } + } else { + for (Empresa e : empresas) { + for (ClienteFidelidad f : fidelidades) { + if (f.getEmpresa().equals(e)) { + f.setActivo(true); + f.setFecmodif(new Date()); + TarjetaFidelidad tarjetaFidelidad = f.getTarjetaFidelidad(); + if (tarjetaFidelidad != null) { + tarjetaFidelidad.setActivo(true); + tarjetaFidelidad.setFecmodif(new Date()); + } + + achou = true; + break; + } + } + if (!achou) { + fidelidades.add(criarFidelidade(e, cExce)); + } + achou = false; + } + } + } + + } + + + private ClienteFidelidad criarFidelidade(Empresa e, ClienteExcelVo cExcel) { + ClienteFidelidad clienteFidelidad = new ClienteFidelidad(); + TarjetaFidelidad tarjetaFidelidad = new TarjetaFidelidad(); + tarjetaFidelidad.setNumTarjeta(cExcel.getNumfidelidade()); + tarjetaFidelidad.setActivo(true); + tarjetaFidelidad.setFecmodif(Calendar.getInstance().getTime()); + tarjetaFidelidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + clienteFidelidad.setEmpresa(e); + clienteFidelidad.setActivo(true); + clienteFidelidad.setFecmodif(Calendar.getInstance().getTime()); + clienteFidelidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clienteFidelidad.setTarjetaFidelidad(tarjetaFidelidad); + + return clienteFidelidad; + } + + public Boolean validaDadosPlanilha(ClienteExcelVo cliente, StringBuilder erros) { + + if (!StringUtils.isEmpty(cliente.getCpf())) { + try { + Long.parseLong(cliente.getCpf().trim().replace(" ", "")); + if (!validarCPF(cliente.getCpf())) { + cliente.setCpf(null); + } + } catch (NumberFormatException e) { + cliente.setCpf(null); + } catch (Exception e) { + e.getMessage(); + + } + + } else { + erros.append(cliente.getNumfidelidade() + " - Documento e obrigatório."); + erros.append("\n"); + return false; + } + + if (StringUtils.isEmpty(cliente.getNome())) { + erros.append(cliente.getNumfidelidade() + " - O NOME e obrigatório."); + erros.append("\n"); + return false; + } + + if (!StringUtils.isEmpty(cliente.getSexo())) { + if (!(cliente.getSexo().equalsIgnoreCase("f") || cliente.getSexo().equalsIgnoreCase("m") || cliente.getSexo().equalsIgnoreCase("masculino") || cliente.getSexo().equalsIgnoreCase("feminino"))) { + //erros.append("Campo sexo foi informado incorretamente."); + //return false; + } + } + + if (!StringUtils.isEmpty(cliente.getNascimento()) && cliente.getNascimento().matches("(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/((19|20)\\d\\d)")) { + SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); + try { + dateFormat.parse(cliente.getNascimento()); + } catch (Exception e) { + //erros.append("Campo Nascimento foi informado incorretamente."); + //return false; + } + } + return true; + } + + private Boolean validaSheet(Sheet sheet) { + + Row row = sheet.getRow(0); + Iterator cellIterator = row.cellIterator(); + + while (cellIterator.hasNext()) { + Cell cell = cellIterator.next(); + switch (cell.getColumnIndex()) { + case 0: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.numfidelidade"))) { + break; + } + return false; + + case 1: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.nome"))) { + break; + } + return false; + case 2: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.tipodoc"))) { + break; + } + return false; + case 3: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.numerodoc"))) { + break; + } + return false; + + case 4: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.datanascimento"))) { + break; + } + return false; + + case 5: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.nacionalidade"))) { + break; + } + return false; + + case 6: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.paisresidencia"))) { + break; + } + return false; + + case 7: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.ocupacao"))) { + break; + } + return false; + + case 8: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.sexo"))) { + break; + } + return false; + case 9: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.estadocivil"))) { + break; + } + return false; + case 10: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.email"))) { + break; + } + return false; + case 11: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.telefone"))) { + break; + } + return false; + case 12: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.endereco"))) { + break; + } + return false; + case 13: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.cidade"))) { + break; + } + return false; + case 14: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.cep"))) { + break; + } + return false; + case 15: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.observacao"))) { + break; + } + return false; + case 16: + if (cell.getStringCellValue().replaceAll(ESPACO_CARACTERE_ASCII, "").equalsIgnoreCase(Labels.getLabel("importarClientesControllerSrvp.HEADERCOLUMN.desconto"))) { + break; + } + return false; + } + + } + return true; + } + + private Date retornaDate(String date) throws ParseException { + + SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); + Date data = null; + data = (Date) dateFormat.parse(date); + return data; + + } + + private Boolean validarCPF(String numDoc) { + try { + // https://dicasdeprogramacao.com.br/algoritmo-para-validar-cpf + // O VAlidador não pegava os CPFs com todos os numeros iguais + if (numDoc.length() != 11 || numDoc.equals("00000000000") || numDoc.equals("11111111111") || numDoc.equals("22222222222") || + numDoc.equals("33333333333") || numDoc.equals("44444444444") || numDoc.equals("55555555555") || + numDoc.equals("66666666666") || numDoc.equals("77777777777") || numDoc.equals("88888888888") || + numDoc.equals("99999999999")) { + return false; + } + + Cpf cpf = new Cpf(numDoc); + if (!cpf.isValid()) { + return false; + } + } catch (ValidationException e) { + return false; + } + + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/InformeCategoriaVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/InformeCategoriaVentaServiceImpl.java new file mode 100644 index 000000000..8348725d2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/InformeCategoriaVentaServiceImpl.java @@ -0,0 +1,91 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.zkoss.util.media.AMedia; + +import com.rjconsultores.ventaboletos.dao.InformeCategoriaVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.InformeCategoriaVentaService; + +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRResultSetDataSource; +import net.sf.jasperreports.engine.JasperRunManager; + +/** + * + * @author Administrador + */ +@Service("informeCategoriaVentaService") +public class InformeCategoriaVentaServiceImpl implements InformeCategoriaVentaService { + + @Autowired + private InformeCategoriaVentaDAO informeCategoriaVentaDAO; + @Autowired + private DataSource dataSource; + private static final Logger log = Logger.getLogger(InformeCategoriaVentaServiceImpl.class); + + public AMedia gerarInforme(InputStream informe, Map parameters) throws BusinessException{ + Connection conn = null; + AMedia amedia = null; + + try { + conn = dataSource.getConnection(); + + ResultSet rs = informeCategoriaVentaDAO.executarSQL(conn, parameters); + JRDataSource jrDataSource = new JRResultSetDataSource(rs); + + String nomeEmpresa = "TODAS"; + Empresa empresa = (Empresa) parameters.get("empresa"); + if (empresa != null) { + nomeEmpresa = empresa.getNombempresa().toUpperCase(); + } + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + Map args = new HashMap(); + args.put("nomeEmpresa", nomeEmpresa); + args.put("dataInicio", dataInicio); + args.put("dataFinal", dataFinal); + final byte[] buf = + JasperRunManager.runReportToPdf(informe, args, jrDataSource); + + final InputStream mediais = new ByteArrayInputStream(buf); + + amedia = new AMedia("categoriaVenta.pdf", "pdf", null, mediais); + } catch (JRException e) { + log.error("Erro al generar reporte", e); + throw new BusinessException("MSG.Error"); + } catch (SQLException e) { + log.error("Error al obtener una conexcion en el datasource", e); + throw new BusinessException("MSG.Error"); + } finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException e) { + log.error("Error al cerrar la conexion", e); + } + } + } + + return amedia; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/InformePasajeroServicioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/InformePasajeroServicioServiceImpl.java new file mode 100644 index 000000000..c0139a8e4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/InformePasajeroServicioServiceImpl.java @@ -0,0 +1,90 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.zkoss.util.media.AMedia; + +import com.rjconsultores.ventaboletos.dao.InformePasajeroServicioDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.InformePasajeroServicioService; + +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRResultSetDataSource; +import net.sf.jasperreports.engine.JasperRunManager; + +/** + * + * @author Administrador + */ +@Service("informePasajeroServicioService") +public class InformePasajeroServicioServiceImpl implements InformePasajeroServicioService { + + @Autowired + private InformePasajeroServicioDAO informePasajeroServicioDAO; + @Autowired + private DataSource dataSource; + private static final Logger log = Logger.getLogger(InformePasajeroServicioServiceImpl.class); + + public AMedia gerarInforme(InputStream informe, Map parameters) throws BusinessException { + Connection conn = null; + AMedia amedia = null; + + try { + conn = dataSource.getConnection(); + + ResultSet rs = informePasajeroServicioDAO.executarSQL(conn, parameters); + JRDataSource jrDataSource = new JRResultSetDataSource(rs); + + String nomeEmpresa = "TODAS"; + Empresa empresa = (Empresa) parameters.get("empresa"); + if (empresa != null) { + nomeEmpresa = empresa.getNombempresa().toUpperCase(); + } + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + Map args = new HashMap(); + args.put("empresa", nomeEmpresa); + args.put("dataInicio", dataInicio); + args.put("dataFinal", dataFinal); + final byte[] buf = JasperRunManager.runReportToPdf(informe, args, jrDataSource); + + final InputStream mediais = new ByteArrayInputStream(buf); + + amedia = new AMedia("pasajeroServicio.pdf", "pdf", null, mediais); + } catch (JRException e) { + log.error("Erro al generar reporte", e); + throw new BusinessException("MSG.Error"); + } catch (SQLException e) { + log.error("Error al obtener una conexcion en el datasource", e); + throw new BusinessException("MSG.Error"); + } finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException e) { + log.error("Error al cerrar la conexion", e); + } + } + } + + return amedia; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/InformeServicioDiarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/InformeServicioDiarioServiceImpl.java new file mode 100644 index 000000000..7f5be17b5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/InformeServicioDiarioServiceImpl.java @@ -0,0 +1,89 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRResultSetDataSource; +import net.sf.jasperreports.engine.JasperRunManager; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.zkoss.util.media.AMedia; + +import com.rjconsultores.ventaboletos.dao.InformeServicioDiarioDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.InformeServicioDiarioService; + +/** + * + * @author Administrador + */ +@Service("informeServicioDiarioService") +public class InformeServicioDiarioServiceImpl implements InformeServicioDiarioService { + + @Autowired + private InformeServicioDiarioDAO informeServicioDiarioDAO; + @Autowired + private DataSource dataSource; + private static final Logger log = Logger.getLogger(InformeServicioDiarioServiceImpl.class); + + public AMedia gerarInforme(InputStream informe, Map parameters) throws BusinessException { + AMedia amedia = null; + Connection conn = null; + try { + conn = dataSource.getConnection(); + ResultSet rs = informeServicioDiarioDAO.executarSQL(conn, parameters); + JRDataSource jrDataSource = new JRResultSetDataSource(rs); + + String nomeEmpresa = "TODAS"; + Empresa empresa = (Empresa) parameters.get("empresa"); + if (empresa != null) { + nomeEmpresa = empresa.getNombempresa().toUpperCase(); + } + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + Map args = new HashMap(); + args.put("nomeEmpresa", nomeEmpresa); + args.put("dataInicio", dataInicio); + args.put("dataFinal", dataFinal); + final byte[] buf = + JasperRunManager.runReportToPdf(informe, args, jrDataSource); + + final InputStream mediais = new ByteArrayInputStream(buf); + + amedia = new AMedia("servicioDiario.pdf", "pdf", null, mediais); + } catch (JRException e) { + log.error("Erro al generar reporte", e); + throw new BusinessException("MSG.Error"); + } catch (SQLException e) { + log.error("Error al obtener una conexcion en el datasource", e); + throw new BusinessException("MSG.Error"); + } finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException e) { + log.error("Error al cerrar la conexion", e); + } + } + } + + return amedia; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/InformeVentasPuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/InformeVentasPuntoVentaServiceImpl.java new file mode 100644 index 000000000..ef77be93d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/InformeVentasPuntoVentaServiceImpl.java @@ -0,0 +1,84 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import javax.sql.DataSource; + +import net.sf.jasperreports.engine.JRDataSource; +import net.sf.jasperreports.engine.JRException; +import net.sf.jasperreports.engine.JRResultSetDataSource; +import net.sf.jasperreports.engine.JasperRunManager; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.zkoss.util.media.AMedia; + +import com.rjconsultores.ventaboletos.dao.InformeVentasPuntoVentaDAO; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.InformeVentasPuntoVentaService; + +/** + * + * @author Administrador + */ +@Service("informeVentasPuntoVentaService") +public class InformeVentasPuntoVentaServiceImpl implements InformeVentasPuntoVentaService { + + @Autowired + private InformeVentasPuntoVentaDAO informeVentasPuntoVentaDAO; + @Autowired + private DataSource dataSource; + private static final Logger log = Logger.getLogger(InformeVentasPuntoVentaServiceImpl.class); + + public AMedia gerarInforme(InputStream informe, Map parameters) throws BusinessException { + Connection conn = null; + AMedia amedia = null; + + try { + conn = dataSource.getConnection(); + + ResultSet rs = informeVentasPuntoVentaDAO.executarSQL(conn, parameters); + JRDataSource jrDataSource = new JRResultSetDataSource(rs); + + Date dataInicio = (Date) parameters.get("dataInicio"); + Date dataFinal = (Date) parameters.get("dataFinal"); + Map args = new HashMap(); + args.put("dataInicio", dataInicio); + args.put("dataFinal", dataFinal); + final byte[] buf = + JasperRunManager.runReportToPdf(informe, args, jrDataSource); + + final InputStream mediais = new ByteArrayInputStream(buf); + + amedia = new AMedia("ventasPuntoVenta.pdf", "pdf", null, mediais); + } catch (JRException e) { + log.error("Erro al generar reporte", e); + throw new BusinessException("MSG.Error"); + } catch (SQLException e) { + log.error("Error al obtener una conexcion en el datasource", e); + throw new BusinessException("MSG.Error"); + } finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException e) { + log.error("Error al cerrar la conexion", e); + } + } + } + + return amedia; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/InstiFinanceiraServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/InstiFinanceiraServiceImpl.java new file mode 100644 index 000000000..9057c83ec --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/InstiFinanceiraServiceImpl.java @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.InstiFinanceiraDAO; +import com.rjconsultores.ventaboletos.entidad.EmpresaContaBancaria; +import com.rjconsultores.ventaboletos.entidad.InstiFinanceira; +import com.rjconsultores.ventaboletos.service.InstiFinanceiraService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaBancoService") +public class InstiFinanceiraServiceImpl implements InstiFinanceiraService { + + @Autowired + private InstiFinanceiraDAO ptovtaBancoDAO; + + public List obtenerTodos() { + return ptovtaBancoDAO.obtenerTodos(); + } + + public InstiFinanceira obtenerID(Integer id) { + return ptovtaBancoDAO.obtenerID(id); + } + + @Transactional + public InstiFinanceira suscribir(InstiFinanceira entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaBancoDAO.suscribir(entidad); + } + + @Transactional + public InstiFinanceira actualizacion(InstiFinanceira entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaBancoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(InstiFinanceira entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaBancoDAO.actualizacion(entidad); + } + + public List buscar(String nome) { + return ptovtaBancoDAO.buscar(nome); + } + + @Override + public List buscarContasBancariasPorIdEmpresa(Integer empresaId) { + return ptovtaBancoDAO.buscarContasBancariasPorIdEmpresa(empresaId); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/IntegracaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/IntegracaoServiceImpl.java new file mode 100644 index 000000000..68be21f34 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/IntegracaoServiceImpl.java @@ -0,0 +1,70 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.dao.IntegracaoDerPrDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.service.IntegracaoService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.vo.exportacao.QdmpDerLinhaVo; + +@Service("integracaoService") +public class IntegracaoServiceImpl implements IntegracaoService { + private static Logger log = Logger.getLogger(IntegracaoServiceImpl.class); + + public static final String DATE_FORMAT_FISCAL = "yyyyMMdd"; + public static final String QUEBRA_LINHA = "\r\n"; + + @Autowired + private IntegracaoDerPrDAO integracaoDerPrDAO; + + @Override + public File importacaoQdmpDer(Date inicio, Date fim, Empresa empresa, List lslinhas) { + try { + String nomeArquivo = "QDMP_DER" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + + File arquivoQdmp = File.createTempFile(nomeArquivo + "-", ".txt"); + + PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivoQdmp), Constantes.UTF_8)); + + for (Ruta ruta : lslinhas) { + String cabeca = integracaoDerPrDAO.buscarDadosImportacaoCabeca(inicio, fim, empresa, ruta.getRutaId()); + List listaQdmpLinha = integracaoDerPrDAO.buscarDadosImportacaoLinha(inicio, fim, empresa, ruta.getRutaId()); + String rodape = integracaoDerPrDAO.buscarDadosImportacaoRodape(inicio, fim, empresa, ruta.getRutaId()); + + writer.print(cabeca); + writer.print(QUEBRA_LINHA); + + for (QdmpDerLinhaVo qdmpDerLinhaVo : listaQdmpLinha) { + writer.print(qdmpDerLinhaVo.toString()); + writer.print(QUEBRA_LINHA); + } + + writer.print(rodape); + writer.print(QUEBRA_LINHA); + } + + writer.close(); + return arquivoQdmp; + + } catch (IOException e) { + log.error( e.getMessage(), e); + } + + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/IntegracaoTotvsServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/IntegracaoTotvsServiceImpl.java new file mode 100644 index 000000000..b628fac71 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/IntegracaoTotvsServiceImpl.java @@ -0,0 +1,99 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CajaDAO; +import com.rjconsultores.ventaboletos.dao.CorridaDAO; +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.dao.IntegracaoTotvsDAO; +import com.rjconsultores.ventaboletos.dao.MarcaDAO; +import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.IntegracaoTotvs; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.IntegracaoTotvsService; + +@Service("integracaoTotvsService") +public class IntegracaoTotvsServiceImpl implements IntegracaoTotvsService { + + private static final String BILHETE = "BILHETE"; + + @Autowired + CajaDAO cajaDao; + + @Autowired + PuntoVentaDAO puntoVentaDao; + + @Autowired + MarcaDAO marcaDao; + + @Autowired + CorridaDAO corridaDao; + + @Autowired + EsquemaCorridaDAO esquemaCorridaDao; + + @Autowired + IntegracaoTotvsDAO integracaoTotvsDAO; + + @Override + public Integer atualizaStstausBilhetesIntegrar(Empresa empresa, Date dataInicial, Date dataFinal, PuntoVenta puntoVenta) throws BusinessException { + Marca marca = null; + if (empresa != null) { + marca = marcaDao.buscarMarcaPorEmpresa(empresa); + } + return cajaDao.atualizaCajasIntegracaoTotvs(marca, dataInicial, dataFinal, puntoVenta); + } + + @Override + public List buscaPuntoVentaEmpresa(Empresa empresa) { + return puntoVentaDao.buscaPuntoVentaEmpresa(empresa); + + } + + @Override + @Transactional + public Integer solicitaReIntegracaoBilhete(Empresa empresa, Date dataInicial, Date dataFinal, PuntoVenta puntoVenta, Usuario usuario) throws BusinessException { + Integer retorno = atualizaStstausBilhetesIntegrar(empresa, dataInicial, dataFinal, puntoVenta); + if (retorno.intValue() > 0) { + IntegracaoTotvs integracaoTotvs = new IntegracaoTotvs(); + integracaoTotvs.setDescIntegracao(BILHETE); + integracaoTotvs.setFecInicio(dataInicial); + integracaoTotvs.setFecFin(dataFinal); + integracaoTotvs.setFecmodif(new Date()); + integracaoTotvs.setPuntoVentaId(puntoVenta.getPuntoventaId()); + integracaoTotvs.setEmpresaId(empresa.getEmpresaId()); + integracaoTotvs.setUsuarioId(usuario.getUsuarioId()); + integracaoTotvs.setActivo(Boolean.TRUE); + integracaoTotvs.setQtdadeResgistrosAtualizados(retorno); + integracaoTotvsDAO.suscribir(integracaoTotvs); + } + return retorno; + } + + @Override + public Integer atualizaStstausServicosIntegrar(Empresa empresa, Integer numServico) throws BusinessException { + Marca marca = null; + if (empresa != null) { + marca = marcaDao.buscarMarcaPorEmpresa(empresa); + } + return esquemaCorridaDao.atualizaServicoIntegracaoTotvs(marca, numServico); + } + + @Override + public Integer atualizaStstausCorridasIntegrar(Empresa empresa, Integer numCorrida, Date dataInicial, Date dataFinal) throws BusinessException { + Marca marca = null; + if (empresa != null) { + marca = marcaDao.buscarMarcaPorEmpresa(empresa); + } + return corridaDao.atualizaCorridasIntegracaoTotvs(marca, dataInicial, dataFinal, numCorrida); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ItemAdicionalServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ItemAdicionalServiceImpl.java new file mode 100644 index 000000000..c5fab0f1e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ItemAdicionalServiceImpl.java @@ -0,0 +1,66 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ItemAdicionalDAO; +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.service.ItemAdicionalService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("itemAdicionalService") +public class ItemAdicionalServiceImpl implements ItemAdicionalService { + + @Autowired + private ItemAdicionalDAO itemAdicionalDAO; + + @Override + public List obtenerTodos() { + return itemAdicionalDAO.obtenerTodos(); + } + + @Override + public ItemAdicional obtenerID(Integer id) { + return itemAdicionalDAO.obtenerID(id); + } + + @Transactional + @Override + public ItemAdicional suscribir(ItemAdicional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return itemAdicionalDAO.suscribir(entidad); + } + + @Transactional + @Override + public ItemAdicional actualizacion(ItemAdicional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return itemAdicionalDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(ItemAdicional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + itemAdicionalDAO.actualizacion(entidad); + } + + @Override + public List buscaItemAdicionalPacote(Pacote pacote) { + return itemAdicionalDAO.buscaItemAdicionalPacote(pacote); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ItemDescontoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ItemDescontoServiceImpl.java new file mode 100644 index 000000000..fd78165ed --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ItemDescontoServiceImpl.java @@ -0,0 +1,66 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ItemDescontoDAO; +import com.rjconsultores.ventaboletos.entidad.ItemDesconto; +import com.rjconsultores.ventaboletos.service.ItemDescontoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ItemDescontoService") +public class ItemDescontoServiceImpl implements ItemDescontoService { + + @Autowired + private ItemDescontoDAO itemDescontoDAO; + + @Override + public List obtenerTodos() { + return itemDescontoDAO.obtenerTodos(); + } + + @Override + public ItemDesconto obtenerID(Long id) { + return itemDescontoDAO.obtenerID(id); + } + + @Transactional + @Override + public ItemDesconto suscribir(ItemDesconto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return itemDescontoDAO.suscribir(entidad); + } + + @Transactional + @Override + public ItemDesconto actualizacion(ItemDesconto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return itemDescontoDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(ItemDesconto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + itemDescontoDAO.actualizacion(entidad); + } + + @Override + public List buscarPorNome(String nomitemdesconto) { + return itemDescontoDAO.buscarPorNome(nomitemdesconto); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/LogAuditoriaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/LogAuditoriaServiceImpl.java new file mode 100644 index 000000000..fb59fae02 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/LogAuditoriaServiceImpl.java @@ -0,0 +1,134 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.LogAuditoriaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.LogAuditoria; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import br.com.rjconsultores.auditador.auditadores.Auditador; +import br.com.rjconsultores.auditador.enums.AuditadorTipoAlteracao; +import br.com.rjconsultores.auditador.model.AuditadorObjects; + +@Service("LogAuditoriaService") +public class LogAuditoriaServiceImpl implements LogAuditoriaService { + + private static Logger log = Logger.getLogger(LogAuditoriaServiceImpl.class); + + @Autowired + private LogAuditoriaDAO logAuditoriaDAO; + + @Override + public List obtenerTodos() { + return logAuditoriaDAO.obtenerTodos(); + } + + @Override + public LogAuditoria obtenerID(Long id) { + return logAuditoriaDAO.obtenerID(id); + } + + @Override + @Transactional + public LogAuditoria suscribir(LogAuditoria entidad) { + entidad.setUsuario(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return logAuditoriaDAO.suscribir(entidad); + } + + @Override + @Transactional + public LogAuditoria actualizacion(LogAuditoria entidad) { + entidad.setUsuario(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return logAuditoriaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(LogAuditoria entidad) { + entidad.setUsuario(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + logAuditoriaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void auditar(Object original, Object novo, Integer empresaId) { + try { + log.info(String.format(":: Iniciando gravação registros de auditoria classe: %s", novo.getClass().getSimpleName())); + Integer totalRegistrosAuditados = 0; + List lista = Auditador.getInstance().auditar(original, novo); + if(lista != null && !lista.isEmpty()) { + suscribir(lista, empresaId); + totalRegistrosAuditados = lista.size(); + } + log.info(String.format(":: Fim gravação registros de auditoria classe: %s - Total Registros auditados: %d", novo.getClass().getSimpleName(), totalRegistrosAuditados)); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + + private LogAuditoria convertToLogAuditoria(AuditadorObjects log, Integer empresaId) { + LogAuditoria logAuditoria = new LogAuditoria(); + logAuditoria.setUsuario(UsuarioLogado.getUsuarioLogado()); + logAuditoria.setFecmodif(Calendar.getInstance().getTime()); + logAuditoria.setActivo(Boolean.TRUE); + logAuditoria.setCampoAlterado(log.getCampoAlterado() != null ? log.getCampoAlterado().toUpperCase() : null); + logAuditoria.setClasseAlterada(log.getClasseAlterada()); + logAuditoria.setClassePrincipal(log.getClassePrincipal()); + logAuditoria.setTela(log.getTela()); + logAuditoria.setTipoAlteracao(log.getTipoAlteracao() != null ? log.getTipoAlteracao().toString() : AuditadorTipoAlteracao.ALTERACAO.toString()); + logAuditoria.setValorAnterior(log.getValorAnterior() != null ? log.getValorAnterior().toUpperCase() : null); + logAuditoria.setValorNovo(log.getValorNovo() != null ? log.getValorNovo().toUpperCase() : null); + logAuditoria.setIdAuditado(log.getIdAuditado()); + + if(empresaId != null) { + logAuditoria.setEmpresa(new Empresa(empresaId)); + } + return logAuditoria; + } + + @Override + @Transactional + public void auditarExclusao(Object objeto, Integer empresaId) { + try { + log.info(String.format(":: Iniciando gravação registros de auditoria de exclusao classe: %s", objeto.getClass().getSimpleName())); + Integer totalRegistrosAuditados = 0; + List lista = Auditador.getInstance().auditarExclusao(objeto); + if(lista != null && !lista.isEmpty()) { + suscribir(lista, empresaId); + totalRegistrosAuditados = lista.size(); + } + log.info(String.format(":: Fim gravação registros de auditoria de exclusao classe: %s - Total Registros auditados: %d", objeto.getClass().getSimpleName(), totalRegistrosAuditados)); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + + @Override + public List listarTodasAsTelas() { + return logAuditoriaDAO.listarTodasAsTelas(); + } + + @Override + @Transactional + public void suscribir(List lsObjects, Integer empresaId) { + for (AuditadorObjects auditado : lsObjects) { + LogAuditoria logAuditoria = convertToLogAuditoria(auditado, empresaId); + suscribir(logAuditoria); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/LogDespesasReceitasDivServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/LogDespesasReceitasDivServiceImpl.java new file mode 100644 index 000000000..32ff3f6b2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/LogDespesasReceitasDivServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.LogDespesaReceitaDivDAO; +import com.rjconsultores.ventaboletos.entidad.LogDespesaReceitaDiversa; +import com.rjconsultores.ventaboletos.service.LogDespesasReceitasDivService; + +@Service("logDespesasReceitasDivService") +public class LogDespesasReceitasDivServiceImpl implements LogDespesasReceitasDivService{ + + @Autowired + private LogDespesaReceitaDivDAO logDespesaReceitaDivDAO; + + @Override + public List obtenerTodos() { + return logDespesaReceitaDivDAO.obtenerTodos(); + } + + public List obterPorPeriodo(Date inicio, Date fim){ + return logDespesaReceitaDivDAO.obterPorPeriodo(inicio, fim); + } + + @Override + public LogDespesaReceitaDiversa obtenerID(Long id) { + return logDespesaReceitaDivDAO.obtenerID(id); + } + + @Override + @Transactional + public LogDespesaReceitaDiversa suscribir(LogDespesaReceitaDiversa entidad) { + return logDespesaReceitaDivDAO.suscribir(entidad); + } + + @Override + @Transactional + public LogDespesaReceitaDiversa actualizacion(LogDespesaReceitaDiversa entidad) { + return logDespesaReceitaDivDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(LogDespesaReceitaDiversa entidad) { + logDespesaReceitaDivDAO.borrar(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MarcaAutobusServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MarcaAutobusServiceImpl.java new file mode 100644 index 000000000..6bfbe2ae8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MarcaAutobusServiceImpl.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.MarcaAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.MarcaAutobus; +import com.rjconsultores.ventaboletos.service.MarcaAutobusService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("marcaAutobusService") +public class MarcaAutobusServiceImpl implements MarcaAutobusService { + + @Autowired + private MarcaAutobusDAO marcaAutobusDAO; + + public List obtenerTodos() { + return marcaAutobusDAO.obtenerTodos(); + } + + public MarcaAutobus obtenerID(Integer id) { + return marcaAutobusDAO.obtenerID(id); + } + + @Transactional + public MarcaAutobus suscribir(MarcaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaAutobusDAO.suscribir(entidad); + } + + @Transactional + public MarcaAutobus actualizacion(MarcaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaAutobusDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MarcaAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + marcaAutobusDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MarcaClaseServicioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MarcaClaseServicioServiceImpl.java new file mode 100644 index 000000000..b63dd6f68 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MarcaClaseServicioServiceImpl.java @@ -0,0 +1,87 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MarcaClaseServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MarcaClaseServicioPK; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.service.MarcaClaseServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("marcaClaseServicioService") +public class MarcaClaseServicioServiceImpl implements MarcaClaseServicioService { + + @Autowired + private MarcaClaseServicioDAO marcaClaseServicioDAO; + + public List obtenerTodos() { + return marcaClaseServicioDAO.obtenerTodos(); + } + + public MarcaClaseServicio obtenerID(MarcaClaseServicioPK id) { + return marcaClaseServicioDAO.obtenerID(id); + } + + @Transactional + public MarcaClaseServicio suscribir(MarcaClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaClaseServicioDAO.suscribir(entidad); + } + + @Transactional + public MarcaClaseServicio actualizacion(MarcaClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaClaseServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MarcaClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + marcaClaseServicioDAO.actualizacion(entidad); + } + + public List buscar(ClaseServicio clase) { + return marcaClaseServicioDAO.buscar(clase); + } + + @Override + public List buscarPorEmpresasPermitidas(ClaseServicio clase, Usuario usuarioLoggado) { + List idsEmpresa = getIdsEmpresaUsuario(usuarioLoggado); + return marcaClaseServicioDAO.buscarPorEmpresasPermitidas(clase, idsEmpresa); + } + + private List getIdsEmpresaUsuario(Usuario usuario){ + List toReturn = new ArrayList(); + for(Empresa empresa : usuario.getEmpresa()){ + toReturn.add(empresa.getEmpresaId()); + } + return toReturn; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MarcaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MarcaServiceImpl.java new file mode 100644 index 000000000..85fceb1e7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MarcaServiceImpl.java @@ -0,0 +1,82 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MarcaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.service.MarcaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("marcaService") +public class MarcaServiceImpl implements MarcaService { + + @Autowired + private MarcaDAO marcaDAO; + + public List obtenerTodos() { + return marcaDAO.obtenerTodos(); + } + + public Marca obtenerID(Short id) { + return marcaDAO.obtenerID(id); + } + + @Transactional + public Marca suscribir(Marca entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaDAO.suscribir(entidad); + } + + @Transactional + public Marca actualizacion(Marca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return marcaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Marca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + marcaDAO.actualizacion(entidad); + } + + public List buscarPorNome(String nomeMarca) { + return marcaDAO.buscarPorNome(nomeMarca); + } + + public List buscarTodosExceto(Usuario usuario,Integer... idMarca) { + return marcaDAO.buscarTodosExceto(usuario,idMarca); + } + + @Override + public List buscarDescricaoIdMarca() { + return marcaDAO.buscarDescricaoIdMarca(); + } + + + public List buscarMarcaPorEmpresa(List empresa){ + return marcaDAO.buscarMarcaPorEmpresa(empresa); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MensagemRecusaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MensagemRecusaServiceImpl.java new file mode 100644 index 000000000..9907a9ac5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MensagemRecusaServiceImpl.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.MensagemRecusaDAO; +import com.rjconsultores.ventaboletos.entidad.MensagemRecusa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.MensagemRecusaService; + +@Service("mensagemRecusaService") +public class MensagemRecusaServiceImpl implements MensagemRecusaService { + + @Autowired + private MensagemRecusaDAO mensagemRecusaDAO; + + @Override + public List obtenerTodos() { + return mensagemRecusaDAO.obtenerTodos(); + } + + @Override + public MensagemRecusa obtenerID(Integer id) { + return mensagemRecusaDAO.obtenerID(id); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void borrar(MensagemRecusa entidad) { + entidad.setActivo(Boolean.FALSE); + mensagemRecusaDAO.actualizacion(entidad); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public MensagemRecusa suscribirActualizar(MensagemRecusa entidad) throws BusinessException { + if (entidad.getMensagemRecusaId() == null) { + return mensagemRecusaDAO.suscribir(entidad); + } else { + return mensagemRecusaDAO.actualizacion(entidad); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MensajeEmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MensajeEmpresaServiceImpl.java new file mode 100644 index 000000000..332ca438e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MensajeEmpresaServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.MensajeEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeEmpresa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.MensajeEmpresaService; + +@Service("mensajeEmpresaService") +public class MensajeEmpresaServiceImpl implements MensajeEmpresaService { + + @Autowired + private MensajeEmpresaDAO mensajeEmpresaDAO; + + @Override + public List obtenerTodos() { + return mensajeEmpresaDAO.obtenerTodos(); + } + + @Override + public MensajeEmpresa obtenerID(Integer id) { + return mensajeEmpresaDAO.obtenerID(id); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void borrar(MensajeEmpresa entidad) { + mensajeEmpresaDAO.borrar(entidad); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public MensajeEmpresa suscribirActualizar(MensajeEmpresa entidad) throws BusinessException { + if (entidad.getMensajeEmpresaId() == null) { + return mensajeEmpresaDAO.suscribir(entidad); + } else { + return mensajeEmpresaDAO.actualizacion(entidad); + } + } + + @Override + public List obtenerPorMensaje(Mensaje mensaje) { + return mensajeEmpresaDAO.obtenerPorMensaje(mensaje); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MensajePuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MensajePuntoVentaServiceImpl.java new file mode 100644 index 000000000..f2626d94f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MensajePuntoVentaServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.MensajePuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajePuntoVenta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.MensajePuntaVentaService; + +@Service("mensajePuntoVentaService") +public class MensajePuntoVentaServiceImpl implements MensajePuntaVentaService { + + @Autowired + private MensajePuntoVentaDAO mensajePuntoVentaDAO; + + @Override + public List obtenerTodos() { + return mensajePuntoVentaDAO.obtenerTodos(); + } + + @Override + public MensajePuntoVenta obtenerID(Integer id) { + return mensajePuntoVentaDAO.obtenerID(id); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void borrar(MensajePuntoVenta entidad) { + mensajePuntoVentaDAO.borrar(entidad); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public MensajePuntoVenta suscribirActualizar(MensajePuntoVenta entidad) throws BusinessException { + if (entidad.getMensajePuntoVendaId() == null) { + return mensajePuntoVentaDAO.suscribir(entidad); + } else { + return mensajePuntoVentaDAO.actualizacion(entidad); + } + } + + @Override + public List obtenerPorMensaje(Mensaje mensaje) { + return mensajePuntoVentaDAO.obtenerPorMensaje(mensaje); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MensajeServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MensajeServiceImpl.java new file mode 100644 index 000000000..04a2f202c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MensajeServiceImpl.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.MensajeDAO; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.MensajeService; + +@Service("mensajeService") +public class MensajeServiceImpl implements MensajeService { + + @Autowired + private MensajeDAO mensajeDAO; + + @Override + public List obtenerTodos() { + return mensajeDAO.obtenerTodos(); + } + + @Override + public Mensaje obtenerID(Integer id) { + return mensajeDAO.obtenerID(id); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void borrar(Mensaje entidad) { + entidad.setActivo(Boolean.FALSE); + mensajeDAO.actualizacion(entidad); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public Mensaje suscribirActualizar(Mensaje entidad) throws BusinessException { + if (entidad.getMensajeId() == null) { + return mensajeDAO.suscribir(entidad); + } else { + return mensajeDAO.actualizacion(entidad); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MensajeUsuarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MensajeUsuarioServiceImpl.java new file mode 100644 index 000000000..6d50425f8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MensajeUsuarioServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.MensajeUsuarioDAO; +import com.rjconsultores.ventaboletos.entidad.Mensaje; +import com.rjconsultores.ventaboletos.entidad.MensajeUsuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.MensajeUsuarioService; + +@Service("mensajeUsuarioService") +public class MensajeUsuarioServiceImpl implements MensajeUsuarioService { + + @Autowired + private MensajeUsuarioDAO mensajeUsuarioDAO; + + @Override + public List obtenerTodos() { + return mensajeUsuarioDAO.obtenerTodos(); + } + + @Override + public MensajeUsuario obtenerID(Integer id) { + return mensajeUsuarioDAO.obtenerID(id); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void borrar(MensajeUsuario entidad) { + mensajeUsuarioDAO.borrar(entidad); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public MensajeUsuario suscribirActualizar(MensajeUsuario entidad) throws BusinessException { + if (entidad.getMensajeUsuarioId() == null) { + return mensajeUsuarioDAO.suscribir(entidad); + } else { + return mensajeUsuarioDAO.actualizacion(entidad); + } + } + + @Override + public List obtenerPorMensaje(Mensaje mensaje) { + return mensajeUsuarioDAO.obtenerPorMensaje(mensaje); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MercadoCompetidoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MercadoCompetidoServiceImpl.java new file mode 100644 index 000000000..c1baabe2e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MercadoCompetidoServiceImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MercadoCompetidoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.MercadoCompetido; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.service.MercadoCompetidoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("mercadoCompetidoService") +public class MercadoCompetidoServiceImpl implements MercadoCompetidoService { + + @Autowired + private MercadoCompetidoDAO mercadoCompetidoDAO; + + public List obtenerTodos() { + return mercadoCompetidoDAO.obtenerTodos(); + } + + public MercadoCompetido obtenerID(Integer id) { + return mercadoCompetidoDAO.obtenerID(id); + } + + @Transactional + public MercadoCompetido suscribir(MercadoCompetido entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return mercadoCompetidoDAO.suscribir(entidad); + } + + @Transactional + public MercadoCompetido actualizacion(MercadoCompetido entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return mercadoCompetidoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MercadoCompetido entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + mercadoCompetidoDAO.actualizacion(entidad); + } + + public boolean existe(ClaseServicio claseServicio, Parada origem, + Parada destino) { + return mercadoCompetidoDAO.existe(claseServicio, origem, destino); + } + + public List buscar(Parada origem, Parada destino) { + return mercadoCompetidoDAO.buscar(origem, destino); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MerchantBancarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MerchantBancarioServiceImpl.java new file mode 100644 index 000000000..130d96ff1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MerchantBancarioServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MerchantBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.MerchantBancario; +import com.rjconsultores.ventaboletos.service.MerchantBancarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("merchantBancarioService") +public class MerchantBancarioServiceImpl implements MerchantBancarioService { + + @Autowired + private MerchantBancarioDAO merchantBancarioDAO; + + public List obtenerTodos() { + return merchantBancarioDAO.obtenerTodos(); + } + + public MerchantBancario obtenerID(Integer id) { + return merchantBancarioDAO.obtenerID(id); + } + + @Transactional + public MerchantBancario suscribir(MerchantBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return merchantBancarioDAO.suscribir(entidad); + } + + @Transactional + public MerchantBancario actualizacion(MerchantBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return merchantBancarioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MerchantBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + merchantBancarioDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MigracaoControleEstoqueServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MigracaoControleEstoqueServiceImpl.java new file mode 100644 index 000000000..89d9d1a6f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MigracaoControleEstoqueServiceImpl.java @@ -0,0 +1,152 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AbastoBoletoDAO; +import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO; +import com.rjconsultores.ventaboletos.dao.AbastoHistoDAO; +import com.rjconsultores.ventaboletos.dao.AidfDAO; +import com.rjconsultores.ventaboletos.dao.DetAbastoBoletoDAO; +import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.dao.TipoMovimentacionDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.DetAbastoBoleto; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; +import com.rjconsultores.ventaboletos.service.MigracaoControleEstoqueService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("migracaoControleEstoqueService") +public class MigracaoControleEstoqueServiceImpl implements MigracaoControleEstoqueService { + + + @Autowired + private AbastoBoletoDAO abastoBoletoDAO; + + @Autowired + private DetAbastoBoletoDAO detAbastoBoletoDAO; + + @Autowired + private AidfDAO aidfDAO; + + @Autowired + private AbastoCentralDAO abastoCentralDAO; + + @Autowired + private AbastoHistoDAO abastoHistoDAO; + + @Autowired + private TipoMovimentacionDAO tipoMovimentacionDAO; + + @Autowired + private PuntoVentaDAO puntoVentaDAO; + + public MigracaoControleEstoqueServiceImpl() { + } + + @Transactional + public void migraDadosBoletosPuntoVenta(PuntoVenta puntoVenta){ + puntoVentaDAO.actualizacion(puntoVenta); + } + + @Transactional + public void migraDadosBoletosPuntoVentaAutomatico(PuntoVenta puntoVenta){ + + List abastoBoletos = abastoBoletoDAO.buscaAbastoBoletoPorPuntoVenta(puntoVenta); + + List empresas = new ArrayList(); + empresas.add(puntoVenta.getEmpresa()); + + List aidfs = aidfDAO.buscaAidfsPorEmpresas(empresas); + + Map> abastoBoletosPorAidf = new HashMap>(); + + for(AbastoBoleto abastoBoleto: abastoBoletos){ + + List detAbastoBoletos = detAbastoBoletoDAO.buscaDetAbastoBoletos(abastoBoleto); + + for(Aidf aidf : aidfs){ + + if(!abastoBoletosPorAidf.containsKey(aidf)) + abastoBoletosPorAidf.put(aidf, new ArrayList()); + + for(DetAbastoBoleto detAbastoBoleto : detAbastoBoletos){ + + String serieDetAbastoBoleto = detAbastoBoleto.getNumseriepreimpresa(); + Long numFolioInicialDetAbastoBoleto = Long.valueOf(detAbastoBoleto.getNumfolioinicial()); + Long numFolioFinalDetAbastoBoleto = Long.valueOf(detAbastoBoleto.getNumfoliofinal()); + + Long numFolioInicialAidf = Long.valueOf(aidf.getForminicial()); + Long numFolioFinalAidf = Long.valueOf(aidf.getFormfinal()); + + if(serieDetAbastoBoleto.equals(aidf.getSerie()) + && numFolioInicialDetAbastoBoleto >= numFolioInicialAidf + && numFolioFinalDetAbastoBoleto <= numFolioFinalAidf){ + + abastoBoletosPorAidf.get(aidf).add(detAbastoBoleto); + } + } + } + } + + Iterator>> boletosIt = abastoBoletosPorAidf.entrySet().iterator(); + + List boletosAMigrar = new ArrayList(); + + Integer usuarioId = UsuarioLogado.getUsuarioLogado().getUsuarioId(); + Date fecmodif = new Date(); + + while(boletosIt.hasNext()){ + + Entry> boletosPorAidf = boletosIt.next(); + + Aidf aidf = boletosPorAidf.getKey(); + List detAbastoBoletos = boletosPorAidf.getValue(); + + for(DetAbastoBoleto detAbastoBoleto : detAbastoBoletos){ + + String serieDetAbastoBoleto = detAbastoBoleto.getNumseriepreimpresa(); + Long numFolioInicialDetAbastoBoleto = Long.valueOf(detAbastoBoleto.getNumfolioinicial()); + Long numFolioFinalDetAbastoBoleto = Long.valueOf(detAbastoBoleto.getNumfoliofinal()); + + int numBoletos = (int)(numFolioFinalDetAbastoBoleto - numFolioInicialDetAbastoBoleto); + + Boolean activo = detAbastoBoleto.getActivo(); + String numsubseriepreimpreso = ""; + + for(int contBoletos = 0 ; contBoletos < numBoletos; contBoletos++ ){ + + String numfoliopreimpreso = (numFolioInicialDetAbastoBoleto + contBoletos)+""; + + AbastoCentral boletoAMigrar = new AbastoCentral( + aidf, serieDetAbastoBoleto, numfoliopreimpreso, numsubseriepreimpreso, + puntoVenta, activo, fecmodif, usuarioId); + + boletosAMigrar.add(boletoAMigrar); + } + } + } + + abastoCentralDAO.suscribirBilhetes(boletosAMigrar); + + TipoMovimentacion tipoMovMigracao = tipoMovimentacionDAO.buscarTipoMovimentacio(TipoMovimentacion.TIPO_MIGRACAO); + abastoHistoDAO.grabaHistoricoBilhetes(boletosAMigrar, tipoMovMigracao); + + + abastoCentralDAO.gravaControleEstoqueMigracao(puntoVenta, fecmodif, usuarioId); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MonedaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MonedaServiceImpl.java new file mode 100644 index 000000000..f1ef7ed7c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MonedaServiceImpl.java @@ -0,0 +1,109 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MonedaDAO; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.service.MonedaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("monedaService") +public class MonedaServiceImpl implements MonedaService { + + private static Logger log = Logger.getLogger(MonedaServiceImpl.class); + + @Autowired + private MonedaDAO monedaDAO; + + public List obtenerTodos() { + return monedaDAO.obtenerTodos(); + } + + public Moneda obtenerID(Integer id) { + return monedaDAO.obtenerID(id); + } + + @Transactional + public Moneda suscribir(Moneda entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return monedaDAO.suscribir(entidad); + } + + @Transactional + public Moneda actualizacion(Moneda entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return monedaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Moneda entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + monedaDAO.actualizacion(entidad); + } + + public List buscar(String descmoneda) { + return monedaDAO.buscar(descmoneda); + } + + @Override + public List obterTodosExcetoReais() { + try { + List monedas = monedaDAO.obtenerTodos(); + + Moneda real = new Moneda(); + real.setMonedaId(1); + + monedas.remove(real); + + return monedas; + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + return new ArrayList(); + } + } + + @Override + public List obtenerTodosSortedByID() { + try { + List monedas = monedaDAO.obtenerTodos(); + Collections.sort(monedas, new Comparator() { + @Override + public int compare(Moneda o1, Moneda o2) { + return o1.getMonedaId().compareTo(o2.getMonedaId()); + } + }); + return monedas; + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return new ArrayList(); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCCFServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCCFServiceImpl.java new file mode 100644 index 000000000..b98c8974a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCCFServiceImpl.java @@ -0,0 +1,113 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.sql.Connection; +import java.sql.SQLException; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.sql.DataSource; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.MonitoramentoCCFDAO; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCCF; +import com.rjconsultores.ventaboletos.service.MonitoramentoCCFService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("monitoramentoCCFService") +public class MonitoramentoCCFServiceImpl implements MonitoramentoCCFService{ + private static Logger log = Logger.getLogger(MonitoramentoCCFServiceImpl.class); + + @Autowired + private MonitoramentoCCFDAO monitoramentoCCFDAO; + @Autowired + private DataSource dataSource; + private Connection con; + + public List obtenerTodos() { + return monitoramentoCCFDAO.obtenerTodos(); + } + + public MonitoramentoCCF obtenerID(Integer id) { + return monitoramentoCCFDAO.obtenerID(id); + } + + @Override + public void openConnection(){ + try { + con = dataSource.getConnection(); + monitoramentoCCFDAO.setConnection(con); + log.debug("Abrindo conexão..."); + } catch (SQLException e) { + log.error("", e); + } + } + + @Override + public void closeConnection(){ + try { + this.con.close(); + log.debug("Conexão fechada!"); + } catch (SQLException e) { + log.error("", e); + } finally { + if (con != null){ + try { con.close(); } catch (SQLException e) { log.error("", e); } + } + } + } + + @Transactional + public MonitoramentoCCF suscribir(MonitoramentoCCF entidad) { + entidad.setUsuarioModif(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return monitoramentoCCFDAO.suscribir(entidad); + } + + @Transactional + public MonitoramentoCCF actualizacion(MonitoramentoCCF entidad) { + entidad.setUsuarioModif(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return monitoramentoCCFDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MonitoramentoCCF entidad) { + entidad.setUsuarioModif(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + monitoramentoCCFDAO.actualizacion(entidad); + } + + @Override + public List buscaQuebraCCF(final String numserie20, final Date data, final Integer ccfInicial) { + return monitoramentoCCFDAO.buscaQuebraCCF(numserie20, data, ccfInicial); + } + + public void gravarListaCCFQuebrados(Map impressoras, Date data){ + try { + for (Entry imp : impressoras.entrySet()){ + for (MonitoramentoCCF m : buscaQuebraCCF(imp.getKey(), data, imp.getValue())){ + monitoramentoCCFDAO.suscribir(m); + } + } + } catch (Exception e) { + log.error("", e); + } + } + + public Map obterImpressorasComCCFInicial(Date data){ + return monitoramentoCCFDAO.obterImpressorasComCCFInicial(data); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCRZServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCRZServiceImpl.java new file mode 100644 index 000000000..5c368851d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MonitoramentoCRZServiceImpl.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.MonitoramentoCRZDAO; +import com.rjconsultores.ventaboletos.entidad.MonitoramentoCRZ; +import com.rjconsultores.ventaboletos.service.MonitoramentoCRZService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("monitoramentoCRZService") +public class MonitoramentoCRZServiceImpl implements MonitoramentoCRZService{ + private static Logger log = Logger.getLogger(MonitoramentoCRZServiceImpl.class); + + @Autowired + private MonitoramentoCRZDAO monitoramentoCRZDAO; + + public List obtenerTodos() { + return monitoramentoCRZDAO.obtenerTodos(); + } + + public MonitoramentoCRZ obtenerID(Integer id) { + return monitoramentoCRZDAO.obtenerID(id); + } + + @Transactional + public MonitoramentoCRZ suscribir(MonitoramentoCRZ entidad) { + entidad.setUsuarioModif(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + try{ + return monitoramentoCRZDAO.suscribir(entidad); + } catch (Exception e){ + log.error("", e); + return entidad; + } + } + + @Transactional + public MonitoramentoCRZ actualizacion(MonitoramentoCRZ entidad) { + entidad.setUsuarioModif(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return monitoramentoCRZDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MonitoramentoCRZ entidad) { + entidad.setUsuarioModif(UsuarioLogado.getUsuarioLogado()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + monitoramentoCRZDAO.actualizacion(entidad); + } + + @Override + public List buscaQuebraCRZ(Date data){ + return monitoramentoCRZDAO.buscaQuebraCRZ(data); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MotivoCancelVendaPacoteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MotivoCancelVendaPacoteServiceImpl.java new file mode 100644 index 000000000..78942eee6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MotivoCancelVendaPacoteServiceImpl.java @@ -0,0 +1,84 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.MotivoCancelVendaPacoteDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelVendaPacote; +import com.rjconsultores.ventaboletos.service.MotivoCancelVendaPacoteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Bruno + */ +@Service("motivoCancelVendaPacoteService") +public class MotivoCancelVendaPacoteServiceImpl implements MotivoCancelVendaPacoteService { + + @Autowired + private MotivoCancelVendaPacoteDAO motivoCancelVendaPacoteDAO; + public static final Integer MAX_CONS_MOV_CANCEL = Integer.valueOf(35); + + public List obtenerTodos() { + return motivoCancelVendaPacoteDAO.obtenerTodos(); + } + + public MotivoCancelVendaPacote obtenerID(Integer id) { + return motivoCancelVendaPacoteDAO.obtenerID(id); + } + + @Transactional + public MotivoCancelVendaPacote suscribir(MotivoCancelVendaPacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoCancelVendaPacoteDAO.suscribir(entidad); + } + + @Transactional + public MotivoCancelVendaPacote actualizacion(MotivoCancelVendaPacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoCancelVendaPacoteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MotivoCancelVendaPacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + motivoCancelVendaPacoteDAO.actualizacion(entidad); + } + + public List buscar(String descmotivocancel, String tipomotivocancel) { + return motivoCancelVendaPacoteDAO.buscar(descmotivocancel, tipomotivocancel); + } + + public List obtenerTodosTipoMotivoCancel() { + return motivoCancelVendaPacoteDAO.obtenerTodosTipoMotivoCancel(); + } + + public List obtenerTodosEspecificos(Integer[] motivos) { + return motivoCancelVendaPacoteDAO.obtenerTodosEspecificos(motivos); + } + + public boolean validaMotivoCancelVendaPacoteConstante(MotivoCancelVendaPacote motivoCancelVendaPacote) { + if (motivoCancelVendaPacote.getMotivocancelvendapacoteId() <= MAX_CONS_MOV_CANCEL) + return false; + else + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MotivoCancelacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MotivoCancelacionServiceImpl.java new file mode 100644 index 000000000..e8f37c9eb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MotivoCancelacionServiceImpl.java @@ -0,0 +1,86 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MotivoCancelacionDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import com.rjconsultores.ventaboletos.service.MotivoCancelacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("motivoCancelacionService") +public class MotivoCancelacionServiceImpl implements MotivoCancelacionService { + + @Autowired + private MotivoCancelacionDAO motivoCancelacionDAO; + public static final Integer MAX_CONS_MOV_CANCEL = Integer.valueOf(35); + + public List obtenerTodos() { + return motivoCancelacionDAO.obtenerTodos(); + } + + public MotivoCancelacion obtenerID(Integer id) { + return motivoCancelacionDAO.obtenerID(id); + } + + @Transactional + public MotivoCancelacion suscribir(MotivoCancelacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoCancelacionDAO.suscribir(entidad); + } + + @Transactional + public MotivoCancelacion actualizacion(MotivoCancelacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoCancelacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MotivoCancelacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + motivoCancelacionDAO.actualizacion(entidad); + } + + public List buscar(String descmotivo, String tipomotivo) { + return motivoCancelacionDAO.buscar(descmotivo, tipomotivo); + } + + public List obtenerTodosTipoMotivoB() { + return motivoCancelacionDAO.obtenerTodosTipoMotivoB(); + } + + public List obtenerTodosEspecificos(Integer[] motivos) { + return motivoCancelacionDAO.obtenerTodosEspecificos(motivos); + } + + public boolean validaMotivoCancelacionConstante(MotivoCancelacion motivoCancelacion) { + if (motivoCancelacion.getMotivocancelacionId() <= MAX_CONS_MOV_CANCEL) + return false; + else + return true; + } + + public MotivoCancelacion findByCveSistema(String cveSistema) { + return motivoCancelacionDAO.findByCveSistema(cveSistema); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MotivoDevolucaoBilheteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MotivoDevolucaoBilheteServiceImpl.java new file mode 100644 index 000000000..eef254585 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MotivoDevolucaoBilheteServiceImpl.java @@ -0,0 +1,82 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MotivoDevolucaoBilheteDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoDevolucaoBilhete; +import com.rjconsultores.ventaboletos.service.MotivoDevolucaoBilheteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Bruno Neves + */ +@Service("motivoDevolucaoBilheteService") +public class MotivoDevolucaoBilheteServiceImpl implements MotivoDevolucaoBilheteService { + + @Autowired + private MotivoDevolucaoBilheteDAO motivoDevolucaoBilheteDAO; + public static final Integer MAX_CONS_MOV_CANCEL = Integer.valueOf(35); + + public List obtenerTodos() { + return motivoDevolucaoBilheteDAO.obtenerTodos(); + } + + public MotivoDevolucaoBilhete obtenerID(Integer id) { + return motivoDevolucaoBilheteDAO.obtenerID(id); + } + + @Transactional + public MotivoDevolucaoBilhete suscribir(MotivoDevolucaoBilhete entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoDevolucaoBilheteDAO.suscribir(entidad); + } + + @Transactional + public MotivoDevolucaoBilhete actualizacion(MotivoDevolucaoBilhete entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoDevolucaoBilheteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MotivoDevolucaoBilhete entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + motivoDevolucaoBilheteDAO.actualizacion(entidad); + } + + public List buscar(String descmotivo, String tipomotivo) { + return motivoDevolucaoBilheteDAO.buscar(descmotivo, tipomotivo); + } + + public List obtenerTodosTipoMotivoB() { + return motivoDevolucaoBilheteDAO.obtenerTodosTipoMotivoB(); + } + + public List obtenerTodosEspecificos(Integer[] motivos) { + return motivoDevolucaoBilheteDAO.obtenerTodosEspecificos(motivos); + } + + public boolean validaMotivoDevolucaoBilheteConstante(MotivoDevolucaoBilhete motivoDevolucaoBilhete) { + if (motivoDevolucaoBilhete.getMotivodevolucaobilheteId() <= MAX_CONS_MOV_CANCEL) + return false; + else + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MotivoReimpresionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MotivoReimpresionServiceImpl.java new file mode 100644 index 000000000..d163421f8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MotivoReimpresionServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MotivoReimpresionDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoReimpresion; +import com.rjconsultores.ventaboletos.service.MotivoReimpresionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("motivoReimpresionService") +public class MotivoReimpresionServiceImpl implements MotivoReimpresionService { + + @Autowired + private MotivoReimpresionDAO motivoReimpresionDAO; + + public List obtenerTodos() { + return motivoReimpresionDAO.obtenerTodos(); + } + + public MotivoReimpresion obtenerID(Integer id) { + return motivoReimpresionDAO.obtenerID(id); + } + + @Transactional + public MotivoReimpresion suscribir(MotivoReimpresion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoReimpresionDAO.suscribir(entidad); + } + + @Transactional + public MotivoReimpresion actualizacion(MotivoReimpresion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoReimpresionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MotivoReimpresion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + motivoReimpresionDAO.actualizacion(entidad); + } + + public List buscar(String descmotivo) { + return motivoReimpresionDAO.buscar(descmotivo); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MotivoViajeServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MotivoViajeServiceImpl.java new file mode 100644 index 000000000..d64c6a0ca --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MotivoViajeServiceImpl.java @@ -0,0 +1,62 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MotivoViajeDAO; +import com.rjconsultores.ventaboletos.entidad.MotivoViaje; +import com.rjconsultores.ventaboletos.service.MotivoViajeService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("motivoViajeService") +public class MotivoViajeServiceImpl implements MotivoViajeService { + + @Autowired + private MotivoViajeDAO motivoViajeDAO; + + public List obtenerTodos() { + return motivoViajeDAO.obtenerTodos(); + } + + public MotivoViaje obtenerID(Integer id) { + return motivoViajeDAO.obtenerID(id); + } + + @Transactional + public MotivoViaje suscribir(MotivoViaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoViajeDAO.suscribir(entidad); + } + + @Transactional + public MotivoViaje actualizacion(MotivoViaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivoViajeDAO.actualizacion(entidad); + + } + + @Transactional + public void borrar(MotivoViaje entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + motivoViajeDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MotivocancelacionEquivalenciaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MotivocancelacionEquivalenciaServiceImpl.java new file mode 100644 index 000000000..e37acc8bd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MotivocancelacionEquivalenciaServiceImpl.java @@ -0,0 +1,73 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.MotivocancelacionEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.MotivoCancelacion; +import com.rjconsultores.ventaboletos.entidad.MotivocancelacionEquivalencia; +import com.rjconsultores.ventaboletos.service.MotivocancelacionEquivalenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("motivocancelacionEquivalenciaService") +public class MotivocancelacionEquivalenciaServiceImpl + implements MotivocancelacionEquivalenciaService { + + @Autowired + private MotivocancelacionEquivalenciaDAO motivocancelacionEquivalenciaDAO; + + public List obtenerTodos() { + return motivocancelacionEquivalenciaDAO.obtenerTodos(); + } + + public MotivocancelacionEquivalencia obtenerID(Integer id) { + return motivocancelacionEquivalenciaDAO.obtenerID(id); + } + + @Transactional + public MotivocancelacionEquivalencia suscribir(MotivocancelacionEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivocancelacionEquivalenciaDAO.suscribir(entidad); + } + + @Transactional + public MotivocancelacionEquivalencia actualizacion(MotivocancelacionEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return motivocancelacionEquivalenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(MotivocancelacionEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + motivocancelacionEquivalenciaDAO.actualizacion(entidad); + } + + public List buscar(ComisionistaExterno comisionistaExterno, + MotivoCancelacion motivoCancelacion) { + return motivocancelacionEquivalenciaDAO.buscar(comisionistaExterno, motivoCancelacion); + } + + public List buscarEquivalencia(MotivocancelacionEquivalencia motivoCancelacionEquivalencia) { + return motivocancelacionEquivalenciaDAO.buscarEquivalencia(motivoCancelacionEquivalencia); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MovimentacionBilhetesServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MovimentacionBilhetesServiceImpl.java new file mode 100644 index 000000000..e51aec2a3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MovimentacionBilhetesServiceImpl.java @@ -0,0 +1,199 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO; +import com.rjconsultores.ventaboletos.dao.AbastoHistoDAO; +import com.rjconsultores.ventaboletos.dao.PtovtaTipoEstoqueDAO; +import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.dao.TipoMovimentacionDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; +import com.rjconsultores.ventaboletos.service.AutorizaFolioService; +import com.rjconsultores.ventaboletos.service.MovimentacionBilhetesService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("movimentacioBilhetesService") +public class MovimentacionBilhetesServiceImpl implements MovimentacionBilhetesService { + + @Autowired + private AbastoCentralDAO abastoCentralDAO; + + @Autowired + private AbastoHistoDAO abastoHistoDAO; + + @Autowired + private TipoMovimentacionDAO tipoMovimentacionDAO; + + @Autowired + private PuntoVentaDAO puntoVentaDAO; + + @Autowired + private PtovtaTipoEstoqueDAO ptovtaTipoEstoqueDAO; + + @Autowired + private AutorizaFolioService autorizaFolioService; + + + @Override + public List obtenerHistoricoMovimetacion(String numBilhete) { + + return null; + } + + @Override + public List obtenerHistoricoMovimetacion(Aidf aidf) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List obtenerHistoricoMovimetacion(Aidf aidf, Date fecInicial, Date fecFinal) { + // TODO Auto-generated method stub + return null; + } + + @Transactional + public void realizaAdquisicionBilhetes(Aidf aidf){ + + PuntoVenta suprimento = buscarAgSuprimento(); + + long formInicial = Long.valueOf(aidf.getForminicial()); + long formFinal = Long.valueOf(aidf.getFormfinal()); + + List bilhetes = new ArrayList(); + + for(long formCorrente = formInicial; formCorrente <= formFinal; formCorrente++){ + AbastoCentral nuevoBilhete = new AbastoCentral(); + nuevoBilhete.setAidf(aidf); + nuevoBilhete.setNumfoliopreimpreso(formCorrente+""); + nuevoBilhete.setNumseriepreimpresa(aidf.getSerie()); + nuevoBilhete.setNumsubseriepreimpreso(aidf.getSubserie()); + nuevoBilhete.setPuntoventa(suprimento); + nuevoBilhete.setFecmodif(Calendar.getInstance().getTime()); + nuevoBilhete.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + nuevoBilhete.setActivo(true); + + bilhetes.add(nuevoBilhete); + } + + abastoCentralDAO.suscribirBilhetes(bilhetes); + + TipoMovimentacion adquisicion = tipoMovimentacionDAO.buscarTipoMovimentacio(TipoMovimentacion.TIPO_ADQUISICION); + abastoHistoDAO.grabaHistoricoBilhetes(bilhetes, adquisicion); + + } + + @Transactional + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, TipoMovimentacion tipoMovimentacion) { + + if(validaTipoMovimentacao(tipoMovimentacion)){ + List bilhetes = abastoCentralDAO.obtenerBilhetes(aidf, origem); + atualizaBilhetesEGrabaHistorico(bilhetes, destino, tipoMovimentacion); + } + } + + @Transactional + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, Long cantidad, TipoMovimentacion tipoMovimentacion) { + + if(validaTipoMovimentacao(tipoMovimentacion)){ + Long formInicial = Long.valueOf(aidf.getForminicial()); + Long formFinal = formInicial + cantidad.longValue(); + + realizaMovimentacionBilhetes(aidf, origem, destino, formInicial.toString(), formFinal.toString(), tipoMovimentacion); + + } + } + + @Transactional + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion) { + + if(validaTipoMovimentacao(tipoMovimentacion)){ + List bilhetes = abastoCentralDAO.obtenerBilhetes(aidf, formInicial, formFinal, origem); + atualizaBilhetesEGrabaHistorico(bilhetes, destino, tipoMovimentacion); + } + } + + private boolean validaTipoMovimentacao(TipoMovimentacion tipoMovimentacion){ + TipoMovimentacion adquisicion = tipoMovimentacionDAO.buscarTipoMovimentacio(TipoMovimentacion.TIPO_ADQUISICION); + return !tipoMovimentacion.equals(adquisicion); + } + + public List obtenerTiposMovimetacion() { + List tiposMovimentacion = tipoMovimentacionDAO.obtenerTodos(); + return tiposMovimentacion; + } + + public PuntoVenta buscarAgSuprimento() { + PtovtaTipoEstoque tipoSuprimento = ptovtaTipoEstoqueDAO.buscarTipoSuprimento(); + PuntoVenta suprimento = puntoVentaDAO.buscarPuntoVentaPorTipoEstoque(tipoSuprimento).get(0); + + return suprimento; + } + + + public PuntoVenta buscarAgContabilidade() { + PtovtaTipoEstoque tipoContabilidade = ptovtaTipoEstoqueDAO.buscarTipoContabilidade(); + PuntoVenta contabilidade = puntoVentaDAO.buscarPuntoVentaPorTipoEstoque(tipoContabilidade).get(0); + + return contabilidade; + } + + public List obtenerTiposMovimetacionPuntoVenta() { + List tipos = tipoMovimentacionDAO.obtenerTiposMovimetacionPuntoVenta(); + return tipos; + } + + @Transactional + public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String numSerie, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion) { + + List bilhetes = abastoCentralDAO.obtenerBilhetesPorPuntoVenta(numSerie, formInicial, formFinal, puntoVentaBilhetes, origem); + atualizaBilhetesEGrabaHistorico(bilhetes, destino, tipoMovimentacion); + trataRequisicionBilhetesEstacion(bilhetes, origem, destino, formInicial, formFinal, tipoMovimentacion); + } + + private void trataRequisicionBilhetesEstacion(List bilhetes, Estacion origem, Estacion destino, String numfolioinicial, String numfoliofinal, TipoMovimentacion tipoMovimentacion){ + + Aidf aidfCorrente = null; + + for(AbastoCentral bilhete : bilhetes){ + + if(aidfCorrente == null || (aidfCorrente != null && !aidfCorrente.equals(bilhete.getAidf()))){ + aidfCorrente = bilhete.getAidf(); + String numseriepreimpresa = aidfCorrente.getSerie(); + autorizaFolioService.noChequeFolioPreimpresos(aidfCorrente, origem, destino, numfolioinicial, numfoliofinal, numseriepreimpresa, aidfCorrente.getEmpresa(), tipoMovimentacion); + } + } + } + + private void atualizaBilhetesEGrabaHistorico(List bilhetes, Estacion destino, TipoMovimentacion tipoMovimentacion){ + + abastoCentralDAO.actualizaBilhetes(bilhetes, destino); + abastoHistoDAO.grabaHistoricoBilhetes(bilhetes, tipoMovimentacion); + } + + private void atualizaBilhetesEGrabaHistorico(List bilhetes, PuntoVenta destino, TipoMovimentacion tipoMovimentacion){ + + abastoCentralDAO.actualizaBilhetes(bilhetes, destino); + abastoHistoDAO.grabaHistoricoBilhetes(bilhetes, tipoMovimentacion); + } + + @Override + public List buscarSeriesBilhetesPorEstacion(Estacion estacion) { + List seriesEstacion = abastoCentralDAO.buscarSeriesBilhetesPorEstacion(estacion); + return seriesEstacion; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/NodoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/NodoServiceImpl.java new file mode 100644 index 000000000..3e038164c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/NodoServiceImpl.java @@ -0,0 +1,40 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.NodoDAO; +import com.rjconsultores.ventaboletos.entidad.Nodo; +import com.rjconsultores.ventaboletos.service.NodoService; + +/** + * + * @author Administrador + */ +@Service("nodoService") +public class NodoServiceImpl implements NodoService { + + @Autowired + private NodoDAO nodoDAO; + + public List obtenerTodos() { + //No momento só será usado o nodo central + List ls = new ArrayList(); + ls.add(nodoDAO.obtenerID(Nodo.NODO_ID_CENTRAL)); + + return ls; + } + + @Override + public Nodo obtenerId(Integer id) { + return nodoDAO.obtenerID(id); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/NotaCreditoVendaPacoteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/NotaCreditoVendaPacoteServiceImpl.java new file mode 100644 index 000000000..2b6f22ae9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/NotaCreditoVendaPacoteServiceImpl.java @@ -0,0 +1,25 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.NotaCreditoVendaPacoteDAO; +import com.rjconsultores.ventaboletos.service.NotaCreditoVendaPacoteService; +import com.rjconsultores.ventaboletos.vo.reembolsoocdnotacredito.ReembolsoOcdNotaCreditoVO; + +@Service("notaCreditoVendaPacoteService") +public class NotaCreditoVendaPacoteServiceImpl implements NotaCreditoVendaPacoteService { + + @Autowired + private NotaCreditoVendaPacoteDAO notaCreditoVendaPacoteDAO; + + @Override + public List busquedaDatosReembolsoOcdNotaCreditoRS(Date fecInicial, Date fecFinal, Date fecPagamentoInicial, Date fecPagamentoFinal, Boolean indPago) { + return notaCreditoVendaPacoteDAO.busquedaDatosReembolsoOcdNotaCreditoRS(fecInicial, fecFinal, fecPagamentoInicial, fecPagamentoFinal, indPago); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/OCDParamServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/OCDParamServiceImpl.java new file mode 100644 index 000000000..f6b3e5922 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/OCDParamServiceImpl.java @@ -0,0 +1,81 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.OCDParamDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OCDParam; +import com.rjconsultores.ventaboletos.service.OCDParamService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ocdParamService") +public class OCDParamServiceImpl implements OCDParamService { + + @Autowired + private OCDParamDAO ocdParamDAO; + + private void setUsuarioFecmodifActivoOCD(OCDParam entidad){ + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + } + + @Override + public List obtenerTodos() { + List params = ocdParamDAO.obtenerTodos(); + return params; + } + + @Override + public OCDParam obtenerID(Integer id) { + OCDParam param = ocdParamDAO.obtenerID(id); + return param; + } + + @Transactional + public OCDParam suscribirActualizar(OCDParam entidad){ + if (entidad.getOcdparamId() == null && ocdParamDAO.buscaOCDParamPorEmpresa(entidad.getEmpresa()) != null){ + return null; + } else{ + return ocdParamDAO.suscribirActualizar(entidad); + } + } + + @Transactional + public OCDParam suscribir(OCDParam entidad) { + setUsuarioFecmodifActivoOCD(entidad); + OCDParam param = ocdParamDAO.suscribir(entidad); + return param; + } + + @Transactional + public OCDParam actualizacion(OCDParam entidad) { + setUsuarioFecmodifActivoOCD(entidad); + OCDParam param = ocdParamDAO.actualizacion(entidad); + return param; + } + + @Transactional + public void borrar(OCDParam entidad) { + setUsuarioFecmodifActivoOCD(entidad); + entidad.setActivo(Boolean.FALSE); + ocdParamDAO.borrar(entidad); + } + + @Override + public OCDParam buscaOCDParamPorEmpresa(Empresa empresa) { + OCDParam param = ocdParamDAO.buscaOCDParamPorEmpresa(empresa); + return param; + } + + @Override + public List buscaOCDParams(Empresa empresa) { + List params = ocdParamDAO.buscaOCDParams(empresa); + return params; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/OCDPtoVtaParamServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/OCDPtoVtaParamServiceImpl.java new file mode 100644 index 000000000..053d35d67 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/OCDPtoVtaParamServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.OCDPtoVtaParamDAO; +import com.rjconsultores.ventaboletos.entidad.OCDPtoVtaParam; +import com.rjconsultores.ventaboletos.service.OCDPtoVtaParamService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ocdPtoVtaParamService") +public class OCDPtoVtaParamServiceImpl implements OCDPtoVtaParamService { + + @Autowired + private OCDPtoVtaParamDAO ocdPtoVtaParamDAO; + + @Override + public List obtenerTodos() { + return ocdPtoVtaParamDAO.obtenerTodos(); + } + + @Override + public OCDPtoVtaParam obtenerID(Long id) { + return ocdPtoVtaParamDAO.obtenerID(id); + } + + @Override + @Transactional(readOnly = false) + public OCDPtoVtaParam suscribir(OCDPtoVtaParam entidad) { + return ocdPtoVtaParamDAO.suscribir(entidad); + } + + @Override + @Transactional(readOnly = false) + public OCDPtoVtaParam actualizacion(OCDPtoVtaParam entidad) { + return ocdPtoVtaParamDAO.actualizacion(entidad); + } + + @Override + @Transactional(readOnly = false) + public void borrar(OCDPtoVtaParam entidad) { + entidad.setActivo(Boolean.FALSE); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + ocdPtoVtaParamDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/OCDServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/OCDServiceImpl.java new file mode 100644 index 000000000..218dcb887 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/OCDServiceImpl.java @@ -0,0 +1,53 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.OCDDAO; +import com.rjconsultores.ventaboletos.entidad.OCD; +import com.rjconsultores.ventaboletos.service.OCDService; +import com.rjconsultores.ventaboletos.vo.reembolsoocdnotacredito.ReembolsoOcdNotaCreditoVO; + +@Service("ocdService") +public class OCDServiceImpl implements OCDService { + + @Autowired + private OCDDAO ocdDAO; + + @Override + public List obtenerTodos() { + return null; + } + + @Override + public OCD obtenerID(Integer id) { + return null; + } + + @Override + public OCD suscribir(OCD entidad) { + return null; + } + + @Override + public OCD actualizacion(OCD entidad) { + return null; + } + + @Override + public void borrar(OCD entidad) { + } + + @Transactional(propagation = Propagation.REQUIRED) + @Override + public List busquedaDatosReembolsoOcdNotaCreditoRS(Date fecInicial, Date fecFinal, Date fecPagamentoInicial, Date fecPagamentoFinal, Boolean indPago) { + return ocdDAO.busquedaDatosReembolsoOcdNotaCreditoRS(fecInicial, fecFinal, fecPagamentoInicial, fecPagamentoFinal, indPago); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/OperadorEmbarcadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/OperadorEmbarcadaServiceImpl.java new file mode 100644 index 000000000..b505b2b4f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/OperadorEmbarcadaServiceImpl.java @@ -0,0 +1,87 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaDAO; +import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaLinhaDAO; +import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaServicoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcada; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcadaLinha; +import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcadaServico; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.OperadorEmbarcadaService; +import com.rjconsultores.ventaboletos.vo.corrida.CorridaVO; + +@Service("operadorEmbarcadaService") +public class OperadorEmbarcadaServiceImpl implements OperadorEmbarcadaService { + + @Autowired + private OperadorEmbarcadaDAO operadorDAO; + @Autowired + private OperadorEmbarcadaServicoDAO opServicoDAO; + @Autowired + private OperadorEmbarcadaLinhaDAO opLinhaDAO; + + @Transactional(rollbackFor = BusinessException.class) + @Override + public OperadorEmbarcada suscribirActualizar(OperadorEmbarcada operador, List linhas, List listaServicos) throws BusinessException { + + if (operador.getOperadorEmbarcadaId() != null) { + List listaOpServico = opServicoDAO.buscarPorOperador(operador); + + List listaOpLinha = opLinhaDAO.buscarPorOperador(operador); + + for (OperadorEmbarcadaServico serv : listaOpServico) { + operador.getServicos().remove(serv); + serv.setOperadorEmbarcada(null); + opServicoDAO.borrar(serv); + } + + for (OperadorEmbarcadaLinha linha : listaOpLinha) { + operador.getLinhas().remove(linha); + linha.setOperadorEmbarcada(null); + opLinhaDAO.borrar(linha); + } + } + + operador.setLinhas(linhas); + operador.setServicos(listaServicos); + + if (operador.getOperadorEmbarcadaId() == null) { + operador = operadorDAO.suscribir(operador); + } else { + operador = operadorDAO.actualizacion(operador); + } + return operador; + } + + @Transactional + @Override + public void apagar(OperadorEmbarcada operador) throws BusinessException { + operadorDAO.borrar(operador); + } + + @Override + public OperadorEmbarcada buscarOperadorEmbarcadaPorUsuario(Integer idUsuario) { + return operadorDAO.buscarOperadorEmbarcadaPorUsuario(idUsuario); + } + + @Override + public PuntoVentaVO getPuntoVentaVO(Integer operador) { + return operadorDAO.getPuntoVentaVO(operador); + } + + @Override + public List getListaCorridaVO(Integer operador, Empresa empresa, Date dtIni, Date dtFim, PuntoVenta puntoVenta) { + return opServicoDAO.getListaCorridaVO(operador, empresa, dtIni, dtFim, puntoVenta); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/OrgaoCancelacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoCancelacionServiceImpl.java new file mode 100644 index 000000000..6b66fb499 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoCancelacionServiceImpl.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.OrgaoCancelacionDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoCancelacion; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.service.OrgaoCancelacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("orgaoCancelacionService") +public class OrgaoCancelacionServiceImpl implements OrgaoCancelacionService{ + + @Autowired + private OrgaoCancelacionDAO orgaoCancelacionDAO; + + public List obtenerTodos() { + return orgaoCancelacionDAO.obtenerTodos(); + } + + public OrgaoCancelacion obtenerID(Integer id) { + return orgaoCancelacionDAO.obtenerID(id); + } + + @Transactional + public OrgaoCancelacion suscribirActualizacion(OrgaoCancelacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getOrgaoCancelacionId() != null){ + return orgaoCancelacionDAO.actualizacion(entidad); + } else { + return orgaoCancelacionDAO.suscribir(entidad); + } + } + + @Transactional + public void borrar(OrgaoCancelacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + orgaoCancelacionDAO.actualizacion(entidad); + } + + public List buscarPorOrgao(OrgaoConcedente orgaoConcedente) { + return orgaoCancelacionDAO.buscarPorOrgao(orgaoConcedente); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java new file mode 100644 index 000000000..893df71c6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java @@ -0,0 +1,64 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.OrgaoConcedenteDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("orgaoConcedenteService") +public class OrgaoConcedenteServiceImpl implements OrgaoConcedenteService { + + @Autowired + private OrgaoConcedenteDAO orgaoConcedenteDAO; + + public List obtenerTodos() { + return orgaoConcedenteDAO.obtenerTodos(); + } + + public OrgaoConcedente obtenerID(Integer id) { + return orgaoConcedenteDAO.obtenerID(id); + } + + @Transactional + public OrgaoConcedente suscribir(OrgaoConcedente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return orgaoConcedenteDAO.suscribir(entidad); + } + + @Transactional + public OrgaoConcedente actualizacion(OrgaoConcedente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return orgaoConcedenteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(OrgaoConcedente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + orgaoConcedenteDAO.actualizacion(entidad); + } + + public List buscar(String desc) { + return orgaoConcedenteDAO.buscar(desc); + } + + @Override + public List obtenerTodosExceto(Integer... id) { + return orgaoConcedenteDAO.obtenerTodosExceto(id); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/OrgaoEmpParamServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoEmpParamServiceImpl.java new file mode 100644 index 000000000..e60faaab9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoEmpParamServiceImpl.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.OrgaoEmpParamDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoEmpParam; +import com.rjconsultores.ventaboletos.service.OrgaoEmpParamService; + +@Service("orgaoEmpParamService") +public class OrgaoEmpParamServiceImpl implements OrgaoEmpParamService { + + @Autowired + private OrgaoEmpParamDAO dao; + + @Override + public List obterPorOrgao(Integer orgaoConcedenteId) { + return dao.obterPorOrgao(orgaoConcedenteId); + } + + @Override + public List obterPorEmpresa(Integer empresaId) { + return dao.obterPorEmpresa(empresaId); + } + + @Override + public OrgaoEmpParam obterPorOrgaoEmpresa(Integer orgaoConcedenteId, Integer empresaId) { + return dao.obterPorOrgaoEmpresa(orgaoConcedenteId, empresaId); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/OrgaoTramoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoTramoServiceImpl.java new file mode 100644 index 000000000..840dfa904 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoTramoServiceImpl.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.service.OrgaoTramoService; + +@Service("orgaoTramoService") +public class OrgaoTramoServiceImpl implements OrgaoTramoService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PacoteConvenioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PacoteConvenioServiceImpl.java new file mode 100644 index 000000000..6a13b6ccd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PacoteConvenioServiceImpl.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PacoteConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.PacoteConvenio; +import com.rjconsultores.ventaboletos.service.PacoteConvenioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pacoteConvenioService") +public class PacoteConvenioServiceImpl implements PacoteConvenioService { + + @Autowired + private PacoteConvenioDAO pacoteConvenioDAO; + + public List obtenerTodos() { + return pacoteConvenioDAO.obtenerTodos(); + } + + public PacoteConvenio obtenerID(Long id) { + return pacoteConvenioDAO.obtenerID(id); + } + + @Transactional + public PacoteConvenio suscribir(PacoteConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pacoteConvenioDAO.suscribir(entidad); + } + + @Transactional + public PacoteConvenio actualizacion(PacoteConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pacoteConvenioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PacoteConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pacoteConvenioDAO.actualizacion(entidad); + } + + public List buscar(String deschotel) { + return pacoteConvenioDAO.buscar(deschotel); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PacoteDescontoBilheteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PacoteDescontoBilheteServiceImpl.java new file mode 100644 index 000000000..413692e0a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PacoteDescontoBilheteServiceImpl.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PacoteDescontoBilheteDAO; +import com.rjconsultores.ventaboletos.entidad.PacoteDescontoBilhete; +import com.rjconsultores.ventaboletos.service.PacoteDescontoBilheteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pacoteDescontoBilheteService") +public class PacoteDescontoBilheteServiceImpl implements PacoteDescontoBilheteService { + + @Autowired + PacoteDescontoBilheteDAO pacoteDescontoBilheteDAO; + + @Override + public List obtenerTodos() { + return pacoteDescontoBilheteDAO.obtenerTodos(); + } + + @Override + public PacoteDescontoBilhete obtenerID(Long id) { + return pacoteDescontoBilheteDAO.obtenerID(id); + } + + @Override + @Transactional + public PacoteDescontoBilhete suscribir(PacoteDescontoBilhete entidad) { + entidad.setActivo(true); + entidad.setFecmodif(new Date()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return pacoteDescontoBilheteDAO.suscribir(entidad); + } + + @Override + @Transactional + public PacoteDescontoBilhete actualizacion(PacoteDescontoBilhete entidad) { + entidad.setFecmodif(new Date()); + return pacoteDescontoBilheteDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(PacoteDescontoBilhete entidad) { + entidad.setActivo(false); + entidad.setFecmodif(new Date()); + actualizacion(entidad); + } + + @Override + public List obtenerTodos(Integer pacoteId) { + return pacoteDescontoBilheteDAO.obtenerTodos(pacoteId); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PacoteItemServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PacoteItemServiceImpl.java new file mode 100644 index 000000000..662a6a813 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PacoteItemServiceImpl.java @@ -0,0 +1,91 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PacoteItemDAO; +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteItem; +import com.rjconsultores.ventaboletos.service.PacoteItemService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pacoteItemService") +public class PacoteItemServiceImpl implements PacoteItemService { + + @Autowired + private PacoteItemDAO pacoteItemDAO; + + @Override + public List obtenerTodos() { + return pacoteItemDAO.obtenerTodos(); + } + + @Override + public PacoteItem obtenerID(Integer id) { + return pacoteItemDAO.obtenerID(id); + } + + @Transactional + @Override + public PacoteItem suscribir(PacoteItem entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pacoteItemDAO.suscribir(entidad); + } + + @Transactional + @Override + public PacoteItem actualizacion(PacoteItem entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pacoteItemDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(PacoteItem entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pacoteItemDAO.actualizacion(entidad); + } + + @Transactional(readOnly = false) + @Override + public PacoteItem vincularItemPacote(PacoteItem pacoteItem, Pacote pacote, ItemAdicional item) { + + if (pacoteItem == null) { + pacoteItem = new PacoteItem(); + } + + pacoteItem.setItemAdicional(item); + pacoteItem.setPacote(pacote); + + if (pacoteItem.getPacoteItemId() == null) { + return suscribir(pacoteItem); + } else { + return actualizacion(pacoteItem); + } + } + + @Override + public PacoteItem buscaPacoteItem(Pacote pacote, ItemAdicional item) { + return pacoteItemDAO.buscaPacoteItem(pacote, item); + } + + @Override + public List buscaItensPacote(Pacote pacote) { + return pacoteItemDAO.buscaItensPacote(pacote); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PacoteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PacoteServiceImpl.java new file mode 100644 index 000000000..fc9a7d929 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PacoteServiceImpl.java @@ -0,0 +1,95 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PacoteDAO; +import com.rjconsultores.ventaboletos.entidad.ItemAdicional; +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.PacoteTarifaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pacoteService") +public class PacoteServiceImpl implements PacoteService { + + @Autowired + private PacoteDAO pacoteDAO; + + @Autowired + private PacoteTarifaService pacoteTarifaService; + + @Autowired + private PacoteItemService pacoteItemService; + + @Override + public List obtenerTodos() { + return pacoteDAO.obtenerTodos(); + } + + @Override + public Pacote obtenerID(Integer id) { + return pacoteDAO.obtenerID(id); + } + + @Transactional + @Override + public Pacote suscribir(Pacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + + return pacoteDAO.suscribir(entidad); + } + + @Transactional + @Override + public Pacote actualizacion(Pacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + + return pacoteDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(Pacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pacoteDAO.actualizacion(entidad); + } + + @Override + public Boolean verificaCadastroTarifa(Pacote pacote, TipoTarifaPacote tarifa) { + + List 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 pacoteItemLs = pacoteItemService.buscaItensPacote(pacote); + + for (PacoteItem pacoteItem : pacoteItemLs) { + if (pacoteItem.getItemAdicional().equals(item)) + return Boolean.FALSE; + } + + return Boolean.TRUE; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PacoteTarifaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PacoteTarifaServiceImpl.java new file mode 100644 index 000000000..5ee52f1ad --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PacoteTarifaServiceImpl.java @@ -0,0 +1,95 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PacoteTarifaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.PacoteTarifa; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; +import com.rjconsultores.ventaboletos.service.PacoteTarifaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pacoteTarifaService") +public class PacoteTarifaServiceImpl implements PacoteTarifaService { + + @Autowired + private PacoteTarifaDAO pacoteTarifaDAO; + + @Override + public List obtenerTodos() { + return pacoteTarifaDAO.obtenerTodos(); + } + + @Override + public PacoteTarifa obtenerID(Integer id) { + return pacoteTarifaDAO.obtenerID(id); + } + + @Transactional + @Override + public PacoteTarifa suscribir(PacoteTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pacoteTarifaDAO.suscribir(entidad); + } + + @Transactional + @Override + public PacoteTarifa actualizacion(PacoteTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pacoteTarifaDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(PacoteTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pacoteTarifaDAO.actualizacion(entidad); + } + + @Transactional(readOnly = false) + @Override + public PacoteTarifa vincularPacoteTarifa(PacoteTarifa pacoteTarifa, Pacote pacote, TipoTarifaPacote tipoTarifaPacote, BigDecimal tarifa, Boolean indvendaweb, Categoria categoria) { + + if (pacoteTarifa == null) { + pacoteTarifa = new PacoteTarifa(); + } + + pacoteTarifa.setIndvendaweb(indvendaweb); + pacoteTarifa.setTarifa(tarifa); + pacoteTarifa.setTipoTarifaPacote(tipoTarifaPacote); + pacoteTarifa.setPacote(pacote); + pacoteTarifa.setCategoria(categoria); + + if (pacoteTarifa.getPacotetarifaId() == null) { + return suscribir(pacoteTarifa); + } else { + return actualizacion(pacoteTarifa); + } + } + + @Override + public PacoteTarifa buscaPacoteTarifa(Pacote pacote, TipoTarifaPacote tipoTarifaPacote) { + return pacoteTarifaDAO.buscaPacoteTarifa(pacote, tipoTarifaPacote); + } + + @Override + public List buscaTarifasPacote(Pacote pacote) { + return pacoteTarifaDAO.buscaTarifasPacote(pacote); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PaisServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PaisServiceImpl.java new file mode 100644 index 000000000..d13f543f0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PaisServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PaisDAO; +import com.rjconsultores.ventaboletos.entidad.Pais; +import com.rjconsultores.ventaboletos.service.PaisService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("paisService") +public class PaisServiceImpl implements PaisService { + + @Autowired + private PaisDAO paisDAO; + + public List obtenerTodos() { + return paisDAO.obtenerTodos(); + } + + public Pais obtenerID(Integer id) { + return paisDAO.obtenerID(id); + } + + @Transactional + public Pais suscribir(Pais entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paisDAO.suscribir(entidad); + } + + @Transactional + public Pais actualizacion(Pais entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paisDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Pais entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paisDAO.actualizacion(entidad); + } + + public List buscar(String nombpais) { + return paisDAO.buscar(nombpais); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParadaCodOrgaoConcedenteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParadaCodOrgaoConcedenteServiceImpl.java new file mode 100644 index 000000000..538aaa160 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParadaCodOrgaoConcedenteServiceImpl.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ParadaCodOrgaoConcedenteDAO; +import com.rjconsultores.ventaboletos.entidad.Pais; +import com.rjconsultores.ventaboletos.entidad.ParadaCodOrgaoConcedente; +import com.rjconsultores.ventaboletos.service.ParadaCodOrgaoConcedenteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("paradaCodOrgaoConcedenteService") +public class ParadaCodOrgaoConcedenteServiceImpl implements ParadaCodOrgaoConcedenteService { + + @Autowired + private ParadaCodOrgaoConcedenteDAO paradaCodOrgaoConcedenteDAO; + + @Override + public List obtenerTodos() { + return paradaCodOrgaoConcedenteDAO.obtenerTodos(); + } + + @Override + public ParadaCodOrgaoConcedente obtenerID(Integer id) { + return paradaCodOrgaoConcedenteDAO.obtenerID(id); + } + + @Transactional + public ParadaCodOrgaoConcedente suscribir(ParadaCodOrgaoConcedente entidad) { + return paradaCodOrgaoConcedenteDAO.suscribir(entidad); + } + + @Transactional + public ParadaCodOrgaoConcedente actualizacion(ParadaCodOrgaoConcedente entidad) { + return paradaCodOrgaoConcedenteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParadaCodOrgaoConcedente entidad) { + paradaCodOrgaoConcedenteDAO.borrar(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParadaEquivalenciaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParadaEquivalenciaServiceImpl.java new file mode 100644 index 000000000..afdb132cd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParadaEquivalenciaServiceImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParadaEquivalenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ComisionistaExterno; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaEquivalencia; +import com.rjconsultores.ventaboletos.service.ParadaEquivalenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("paradaEquivalenciaService") +public class ParadaEquivalenciaServiceImpl implements ParadaEquivalenciaService { + + @Autowired + private ParadaEquivalenciaDAO paradaEquivalenciaDAO; + + public List obtenerTodos() { + return paradaEquivalenciaDAO.obtenerTodos(); + } + + public ParadaEquivalencia obtenerID(Integer id) { + return paradaEquivalenciaDAO.obtenerID(id); + } + + @Transactional + public ParadaEquivalencia suscribir(ParadaEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paradaEquivalenciaDAO.suscribir(entidad); + } + + @Transactional + public ParadaEquivalencia actualizacion(ParadaEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paradaEquivalenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParadaEquivalencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paradaEquivalenciaDAO.actualizacion(entidad); + } + + public List buscar(Parada parada, + ComisionistaExterno comisionistaExterno, String equivalencia) { + return paradaEquivalenciaDAO.buscar(parada, comisionistaExterno, equivalencia); + } + + public List buscarEquivalencia(String equivalencia) { + return paradaEquivalenciaDAO.buscarEquivalencia(equivalencia); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java new file mode 100644 index 000000000..cbf190d03 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java @@ -0,0 +1,177 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +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 com.rjconsultores.ventaboletos.dao.ParadaDAO; +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.entidad.Ciudad; +import com.rjconsultores.ventaboletos.entidad.Nodo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.RegionMetropolitana; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TipoParada; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.ParadaService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("paradaService") +public class ParadaServiceImpl implements ParadaService { + + private static final int MAX_ANTT = 99999; + + @Autowired + private ParadaDAO paradaDAO; + @Autowired + private TramoDAO tramoDAO; + + public Parada obtenerID(Integer id) { + return paradaDAO.obtenerID(id); + } + + @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 lsParadas = paradaDAO.buscar(entidad.getCodantt()); + + if (!lsParadas.isEmpty()) { + if (entidad.getParadaId() == null) { + throw new BusinessException("busquedaCatalogoDeParadaController.msg.codAnttJaExiste"); + } else { + if (!lsParadas.contains(entidad)) { + throw new BusinessException("busquedaCatalogoDeParadaController.msg.codAnttJaExiste"); + } + } + } + + lsParadas = paradaDAO.buscar(entidad.getDescparada(), entidad.getCveparada(), entidad.getCiudad(), entidad.getTipoParada(), entidad.getNodo()); + + if (!lsParadas.isEmpty()) { + if (entidad.getParadaId() == null) { + throw new BusinessException("MSG.Registro.Existe"); + } 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)) { + throw new BusinessException("editarCatalogoDeParadaController.registroIATAExiste"); + } + } + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getParadaId() == null) { + return paradaDAO.suscribir(entidad); + } + + return paradaDAO.actualizacion(entidad); + + } + + @Transactional + public Parada suscribir(Parada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paradaDAO.suscribir(entidad); + } + + @Transactional + public Parada actualizacion(Parada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paradaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Parada entidad) throws RegistroConDependenciaException { + if ((tramoDAO.count("origem", entidad) > 0l) + || (tramoDAO.count("destino", entidad) > 0l)) { + throw new RegistroConDependenciaException(); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paradaDAO.actualizacion(entidad); + } + + public List buscar(String descparada, String cveparada, Ciudad ciudad, + TipoParada tipoParada, Nodo nodo) { + return paradaDAO.buscar(descparada, cveparada, ciudad, tipoParada, nodo); + } + + public List buscar(String descparada) { + return paradaDAO.buscar(descparada); + } + + public List buscarCVE(String cveparada) { + return paradaDAO.buscarCVE(StringUtils.trim(cveparada)); + } + + public List buscaLike(String descparada) { + return paradaDAO.buscaLike(descparada); + } + + public List obtenerOrigenPorRuta(Ruta ruta) { + return paradaDAO.obtenerOrigenPorRuta(ruta); + } + + @Override + public List obtenerTodos() { + return paradaDAO.obtenerTodos(); + } + + @Override + public List obterPossiveisDestinos(Parada origem) { + List paradas; + paradas = paradaDAO.obterPossiveisDestinos(origem); + + if (paradas != null) { + return paradas; + } + return new ArrayList(); + } + + @Override + public List buscaParadaRegionMetropolitana(RegionMetropolitana regionMetropolitana){ + return paradaDAO.buscaParadaRegionMetropolitana(regionMetropolitana); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaMasivoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaMasivoServiceImpl.java new file mode 100644 index 000000000..83fa27645 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaMasivoServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParamAcumulaMasivoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaMasivo; +import com.rjconsultores.ventaboletos.service.ParamAcumulaMasivoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("paramAcumulaMasivoService") +public class ParamAcumulaMasivoServiceImpl implements ParamAcumulaMasivoService { + + @Autowired + private ParamAcumulaMasivoDAO paramAcumulaMasivoDAO; + + public List obtenerTodos() { + return paramAcumulaMasivoDAO.obtenerTodos(); + } + + public ParamAcumulaMasivo obtenerID(Integer id) { + return paramAcumulaMasivoDAO.obtenerID(id); + } + + @Transactional + public ParamAcumulaMasivo suscribir(ParamAcumulaMasivo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramAcumulaMasivoDAO.suscribir(entidad); + } + + @Transactional + public ParamAcumulaMasivo actualizacion(ParamAcumulaMasivo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramAcumulaMasivoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamAcumulaMasivo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paramAcumulaMasivoDAO.actualizacion(entidad); + } + + public List buscar(ParamAcumulaMasivo paramAcumulaMasivo) { + return paramAcumulaMasivoDAO.buscar(paramAcumulaMasivo); + } + + public List buscar(Empresa emp, Integer min, Integer max, Date fecIni, Date fecFim) { + return paramAcumulaMasivoDAO.buscar(emp, min, max, fecIni, fecFim); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaPuntoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaPuntoServiceImpl.java new file mode 100644 index 000000000..22ec106c1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParamAcumulaPuntoServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParamAcumulaPuntoDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamAcumulaPunto; +import com.rjconsultores.ventaboletos.service.ParamAcumulaPuntoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("paramAcumulaPuntoService") +public class ParamAcumulaPuntoServiceImpl implements ParamAcumulaPuntoService { + + @Autowired + private ParamAcumulaPuntoDAO paramAcumulaPuntoDAO; + + public List obtenerTodos() { + return paramAcumulaPuntoDAO.obtenerTodos(); + } + + public ParamAcumulaPunto obtenerID(Integer id) { + return paramAcumulaPuntoDAO.obtenerID(id); + } + + @Transactional + public ParamAcumulaPunto suscribir(ParamAcumulaPunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramAcumulaPuntoDAO.suscribir(entidad); + } + + @Transactional + public ParamAcumulaPunto actualizacion(ParamAcumulaPunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramAcumulaPuntoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamAcumulaPunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paramAcumulaPuntoDAO.actualizacion(entidad); + } + + public List buscar(Parada origem, Parada destino, Date ini, Date fim) { + return paramAcumulaPuntoDAO.buscar(origem, destino, ini, fim); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParamArticuloServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParamArticuloServiceImpl.java new file mode 100644 index 000000000..df14bedc3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParamArticuloServiceImpl.java @@ -0,0 +1,53 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ParamArticuloDAO; +import com.rjconsultores.ventaboletos.entidad.ParamArticulo; +import com.rjconsultores.ventaboletos.service.ParamArticuloService; + +/** + * + * @author Administrador + */ +@Service("paramArticuloService") +public class ParamArticuloServiceImpl implements ParamArticuloService { + + @Autowired + private ParamArticuloDAO paramArticuloDAO; + + public List obtenerTodos() { + return paramArticuloDAO.obtenerTodos(); + } + + public ParamArticulo obtenerID(Integer id) { + return paramArticuloDAO.obtenerID(id); + } + + @Transactional + public ParamArticulo suscribir(ParamArticulo entidad) { + + return paramArticuloDAO.suscribir(entidad); + } + + @Transactional + public ParamArticulo actualizacion(ParamArticulo entidad) { + + return paramArticuloDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamArticulo entidad) { + + paramArticuloDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParamCanjePuntoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParamCanjePuntoServiceImpl.java new file mode 100644 index 000000000..7be46374e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParamCanjePuntoServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParamCanjePuntoDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParamCanjePunto; +import com.rjconsultores.ventaboletos.service.ParamCanjePuntoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("paramCanjePuntoService") +public class ParamCanjePuntoServiceImpl implements ParamCanjePuntoService { + + @Autowired + private ParamCanjePuntoDAO paramCanjePuntoDAO; + + public List obtenerTodos() { + return paramCanjePuntoDAO.obtenerTodos(); + } + + public ParamCanjePunto obtenerID(Integer id) { + return paramCanjePuntoDAO.obtenerID(id); + } + + @Transactional + public ParamCanjePunto suscribir(ParamCanjePunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramCanjePuntoDAO.suscribir(entidad); + } + + @Transactional + public ParamCanjePunto actualizacion(ParamCanjePunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramCanjePuntoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamCanjePunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paramCanjePuntoDAO.actualizacion(entidad); + } + + public List buscar(Parada origem, Parada destino, Date ini, Date fim) { + return paramCanjePuntoDAO.buscar(origem, destino, ini, fim); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParamCompraPuntoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParamCompraPuntoServiceImpl.java new file mode 100644 index 000000000..744110144 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParamCompraPuntoServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParamCompraPuntoDAO; +import com.rjconsultores.ventaboletos.entidad.ParamCompraPunto; +import com.rjconsultores.ventaboletos.service.ParamCompraPuntoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("paramCompraPuntoService") +public class ParamCompraPuntoServiceImpl implements ParamCompraPuntoService { + + @Autowired + private ParamCompraPuntoDAO paramCompraPuntoDAO; + + public List obtenerTodos() { + return paramCompraPuntoDAO.obtenerTodos(); + } + + public ParamCompraPunto obtenerID(Integer id) { + return paramCompraPuntoDAO.obtenerID(id); + } + + @Transactional + public ParamCompraPunto suscribir(ParamCompraPunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramCompraPuntoDAO.suscribir(entidad); + } + + @Transactional + public ParamCompraPunto actualizacion(ParamCompraPunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramCompraPuntoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamCompraPunto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paramCompraPuntoDAO.actualizacion(entidad); + } + + public List buscar(Date ini, Date fim) { + return paramCompraPuntoDAO.buscar(ini, fim); + } + + public List buscar(Date ini, Date fim, Integer cantPuntos, BigDecimal costoPunto) { + return paramCompraPuntoDAO.buscar(ini, fim, cantPuntos, costoPunto); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParamConexionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParamConexionServiceImpl.java new file mode 100644 index 000000000..37ec1809c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParamConexionServiceImpl.java @@ -0,0 +1,26 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ParamConexionDAO; +import com.rjconsultores.ventaboletos.entidad.ParamConexion; +import com.rjconsultores.ventaboletos.service.ParamConexionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("paramConexionService") +public class ParamConexionServiceImpl implements ParamConexionService { + + @Autowired + private ParamConexionDAO paramConexionDAO; + @Override + @Transactional + public ParamConexion actualizacion(ParamConexion paramConexion) { + paramConexion.setFecmodif(new java.util.Date()); + paramConexion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + return paramConexionDAO.actualizacion(paramConexion); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParamCostoTarjetaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParamCostoTarjetaServiceImpl.java new file mode 100644 index 000000000..405c93c02 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParamCostoTarjetaServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ParamCostoTarjetaDAO; +import com.rjconsultores.ventaboletos.entidad.ParamCostoTarjeta; +import com.rjconsultores.ventaboletos.service.ParamCostoTarjetaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("paramCostoTarjetaService") +public class ParamCostoTarjetaServiceImpl implements ParamCostoTarjetaService { + + @Autowired + private ParamCostoTarjetaDAO paramCostoTarjetaDAO; + + public List obtenerTodos() { + return paramCostoTarjetaDAO.obtenerTodos(); + } + + public ParamCostoTarjeta obtenerID(Integer id) { + return paramCostoTarjetaDAO.obtenerID(id); + } + + @Transactional + public ParamCostoTarjeta suscribir(ParamCostoTarjeta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramCostoTarjetaDAO.suscribir(entidad); + } + + @Transactional + public ParamCostoTarjeta actualizacion(ParamCostoTarjeta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramCostoTarjetaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamCostoTarjeta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paramCostoTarjetaDAO.actualizacion(entidad); + } + + public List buscar(ParamCostoTarjeta paramCostoTarjeta) { + return paramCostoTarjetaDAO.buscar(paramCostoTarjeta); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParamRecoleccionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParamRecoleccionServiceImpl.java new file mode 100644 index 000000000..48d39d24b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParamRecoleccionServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParamRecoleccionDAO; +import com.rjconsultores.ventaboletos.entidad.ParamRecoleccion; +import com.rjconsultores.ventaboletos.service.ParamRecoleccionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("paramRecoleccionService") +public class ParamRecoleccionServiceImpl implements ParamRecoleccionService { + + @Autowired + private ParamRecoleccionDAO paramRecoleccionDAO; + + public List obtenerTodos() { + return paramRecoleccionDAO.obtenerTodos(); + } + + public ParamRecoleccion obtenerID(Integer id) { + return paramRecoleccionDAO.obtenerID(id); + } + + @Transactional + public ParamRecoleccion suscribir(ParamRecoleccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramRecoleccionDAO.suscribir(entidad); + } + + @Transactional + public ParamRecoleccion actualizacion(ParamRecoleccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return paramRecoleccionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ParamRecoleccion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + paramRecoleccionDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PerfilFuncionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PerfilFuncionServiceImpl.java new file mode 100644 index 000000000..d26883787 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PerfilFuncionServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PerfilFuncionDAO; +import com.rjconsultores.ventaboletos.entidad.PerfilFuncion; +import com.rjconsultores.ventaboletos.service.PerfilFuncionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("perfilFuncionService") +public class PerfilFuncionServiceImpl implements PerfilFuncionService { + + @Autowired + private PerfilFuncionDAO perfilFuncionDAO; + + public List obtenerTodos() { + return perfilFuncionDAO.obtenerTodos(); + } + + public PerfilFuncion obtenerID(Integer id) { + return perfilFuncionDAO.obtenerID(id); + } + + @Transactional + public PerfilFuncion suscribir(PerfilFuncion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return perfilFuncionDAO.suscribir(entidad); + } + + @Transactional + public PerfilFuncion actualizacion(PerfilFuncion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return perfilFuncionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PerfilFuncion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + perfilFuncionDAO.actualizacion(entidad); + } + + @Override + public boolean usuarioPossuiPermissaoFuncionalidade(Integer usuarioId, String descRuta) { + return perfilFuncionDAO.usuarioPossuiPermissaoFuncionalidade(usuarioId, descRuta); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PerfilServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PerfilServiceImpl.java new file mode 100644 index 000000000..44ae4b18a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PerfilServiceImpl.java @@ -0,0 +1,135 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PerfilDAO; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import com.rjconsultores.ventaboletos.entidad.PerfilFuncion; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; +import com.rjconsultores.ventaboletos.service.PerfilService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author rodrigo + */ +@Service("perfilService") +public class PerfilServiceImpl implements PerfilService { + + @Autowired + private PerfilDAO perfilDAO; + + public List obtenerTodos() { + return perfilDAO.obtenerTodos(); + } + + public Perfil obtenerID(Integer id) { + return perfilDAO.obtenerID(id); + } + + @Transactional + public Perfil suscribir(Perfil entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return perfilDAO.suscribir(entidad); + } + + @Transactional + public Perfil actualizacion(Perfil entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return perfilDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Perfil entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + perfilDAO.actualizacion(entidad); + } + + public List buscar(String dscPerfil) { + return perfilDAO.buscar(dscPerfil); + } + + public List buscaPerfilJerarquia(Perfil perfilUsuario) { + return perfilDAO.buscaPerfilJerarquia(perfilUsuario); + } + + @Transactional + public Boolean clonarPerfil(Integer perfilId, String nomePerfil) { + + Perfil perfil = this.obtenerID(perfilId); + Perfil clonePerfil = new Perfil(); + + clonePerfil.setDescperfil(nomePerfil); + +// clonePerfil.setActivo(perfil.getActivo()); o método actualizacion ja seta os campos activo usuario e fecmodif + clonePerfil.setIndJerarquia(perfil.getIndJerarquia()); + clonePerfil.setPerfilFuncionList(new ArrayList()); + clonePerfil.setUsuarioPerfilList(new ArrayList()); + + + clonePerfil = suscribir(clonePerfil); + + clonePerfil = percorrerPerfilAtivoParaClonar(perfil, clonePerfil); + + + actualizacion(clonePerfil); + +// inativar(clonePricing); + + if (clonePerfil.getPerfilId() != null) { + return true; + } else { + return false; + } + } + + private Perfil percorrerPerfilAtivoParaClonar(Perfil perfil, Perfil clonePerfil) { + + List usuarioPerfilList = new ArrayList(); + for(UsuarioPerfil usuarioPerfil : perfil.getUsuarioPerfilList()){ + UsuarioPerfil cloneUsuarioPerfil = new UsuarioPerfil(); + cloneUsuarioPerfil.setActivo(usuarioPerfil.getActivo()); + cloneUsuarioPerfil.setFecmodif(Calendar.getInstance().getTime()); + cloneUsuarioPerfil.setPerfil(clonePerfil); + cloneUsuarioPerfil.setUsuario(usuarioPerfil.getUsuario()); + cloneUsuarioPerfil.setUsuariomodifId(usuarioPerfil.getUsuariomodifId()); + cloneUsuarioPerfil.setUsuarioperfilId(usuarioPerfil.getUsuarioperfilId()); + usuarioPerfilList.add(cloneUsuarioPerfil); + } + clonePerfil.setUsuarioPerfilList(usuarioPerfilList); + + List perfilFuncionList = new ArrayList(); + for(PerfilFuncion perfilFuncion : perfil.getPerfilFuncionList()){ + PerfilFuncion clonePerfilFuncion = new PerfilFuncion(); + clonePerfilFuncion.setActivo(perfilFuncion.getActivo()); + clonePerfilFuncion.setFecmodif(Calendar.getInstance().getTime()); + clonePerfilFuncion.setFuncionSistema(perfilFuncion.getFuncionSistema()); + clonePerfilFuncion.setIndLectura(perfilFuncion.getIndLectura()); + clonePerfilFuncion.setPerfil(clonePerfil); + clonePerfilFuncion.setUsuarioId(perfilFuncion.getUsuarioId()); + perfilFuncionList.add(clonePerfilFuncion); + } + clonePerfil.setPerfilFuncionList(perfilFuncionList); + + return clonePerfil; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PeriodoVacacionalServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PeriodoVacacionalServiceImpl.java new file mode 100644 index 000000000..dde4476d9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PeriodoVacacionalServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PeriodoVacacionalDAO; +import com.rjconsultores.ventaboletos.entidad.PeriodoVacacional; +import com.rjconsultores.ventaboletos.service.PeriodoVacacionalService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("periodoVacacionalService") +public class PeriodoVacacionalServiceImpl implements PeriodoVacacionalService { + + @Autowired + private PeriodoVacacionalDAO periodoVacacionalDAO; + + public List obtenerTodos() { + return periodoVacacionalDAO.obtenerTodos(); + } + + public PeriodoVacacional obtenerID(Integer id) { + return periodoVacacionalDAO.obtenerID(id); + } + + @Transactional + public PeriodoVacacional suscribir(PeriodoVacacional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return periodoVacacionalDAO.suscribir(entidad); + } + + @Transactional + public PeriodoVacacional actualizacion(PeriodoVacacional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return periodoVacacionalDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PeriodoVacacional entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + periodoVacacionalDAO.actualizacion(entidad); + } + + public List buscar(Date dataInicio, Date dataFim) { + return periodoVacacionalDAO.buscar(dataInicio, dataFim); + } + + public List buscarFechaTraslapa(PeriodoVacacional periodoVacacional) { + return periodoVacacionalDAO.buscarFechaTraslapa(periodoVacacional); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PlazaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PlazaServiceImpl.java new file mode 100644 index 000000000..11650129e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PlazaServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PlazaDAO; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.service.PlazaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("plazaService") +public class PlazaServiceImpl implements PlazaService { + + @Autowired + private PlazaDAO plazaDAO; + + public List obtenerTodos() { + return plazaDAO.obtenerTodos(); + } + + public Plaza obtenerID(Integer id) { + return plazaDAO.obtenerID(id); + } + + @Transactional + public Plaza suscribir(Plaza entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return plazaDAO.suscribir(entidad); + } + + @Transactional + public Plaza actualizacion(Plaza entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return plazaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Plaza entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + plazaDAO.actualizacion(entidad); + } + + public List buscar(String nombplaza) { + return plazaDAO.buscar(nombplaza); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PrecioFixoPedagioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PrecioFixoPedagioServiceImpl.java new file mode 100644 index 000000000..06e111f04 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PrecioFixoPedagioServiceImpl.java @@ -0,0 +1,115 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PrecioFixoPedagioDAO; +import com.rjconsultores.ventaboletos.dao.hibernate.PrecioFixoPedagioHibernateDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.PrecioFixoPedagio; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.service.PrecioFixoPedagioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("precioFixoPedagioService") +public class PrecioFixoPedagioServiceImpl implements PrecioFixoPedagioService { + + @Autowired + private PrecioFixoPedagioDAO precioFixoPedagioDAO; + @Autowired + private PrecioFixoPedagioHibernateDAO precioFixoPedagioHibernateDAO; + + public List obtenerTodos() { + return precioFixoPedagioDAO.obtenerTodos(); + } + + public PrecioFixoPedagio obtenerID(Integer id) { + return precioFixoPedagioDAO.obtenerID(id); + } + + + public List buscarPorNome(String nomeClaseServicio) { + return precioFixoPedagioDAO.buscarPorNome(nomeClaseServicio); + } + + public List buscarTodosExceto(Integer ... idClase){ + return precioFixoPedagioDAO.buscarTodosExceto(idClase); + } + + public List buscarPorEmpresasDoUsuario (List empresasUsuario) { + + if(empresasUsuario == null || empresasUsuario.isEmpty()) { + return null; + } + + StringBuilder idEmpresasBuilder = new StringBuilder(); + String idEmpresas = ""; + + for (Empresa empresa : empresasUsuario) { + idEmpresasBuilder.append(empresa.getEmpresaId().toString()).append(","); + } + + idEmpresasBuilder = idEmpresasBuilder.deleteCharAt(idEmpresasBuilder.length() -1); + idEmpresas = idEmpresasBuilder.toString(); + + List result = (List) precioFixoPedagioDAO.buscarPorEmpresasDoUsuario(idEmpresas); + return result; + } + + @Transactional + public PrecioFixoPedagio suscribir(PrecioFixoPedagio entidad) { + + return precioFixoPedagioDAO.suscribir(entidad); + } + + @Transactional + public PrecioFixoPedagio actualizacion(PrecioFixoPedagio entidad) { + return precioFixoPedagioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PrecioFixoPedagio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(new java.util.Date()); + entidad.setActivo(false); + precioFixoPedagioDAO.actualizacion(entidad); + + } + @Override + public Boolean validarInclusaoPrecoFixo(PrecioFixoPedagio precoFixoPedagio) { + List precos = buscar(precoFixoPedagio); + + + if(precos.isEmpty()){ + return Boolean.TRUE; + } + + return Boolean.FALSE; + + + } + + private List buscar(PrecioFixoPedagio precoFixoPedagio) { + + return precioFixoPedagioHibernateDAO.buscarPrecioFixoPedagio(precoFixoPedagio); + } + + @Override + public List buscarPrecioFixoPedagio(PrecioFixoPedagio obj) { + + return precioFixoPedagioDAO.buscarPrecioFixoPedagio(obj); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PrecioVentajaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PrecioVentajaServiceImpl.java new file mode 100644 index 000000000..f86ac27c6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PrecioVentajaServiceImpl.java @@ -0,0 +1,170 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PrecioVentajaDAO; +import com.rjconsultores.ventaboletos.entidad.PrecioVentaja; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.PrecioVentajaService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Igor + */ +@Service("precioVentajaService") +public class PrecioVentajaServiceImpl implements PrecioVentajaService { + + @Autowired + private PrecioVentajaDAO precioVentajaDAO; + + @Autowired + private RutaService rutaService; + + public List obtenerTodos() { + return null; + } + + public PrecioVentaja obtenerID(Integer id) { + return null; + } + + @Transactional + public PrecioVentaja suscribirActualizacion(PrecioVentaja entidad) throws BusinessException { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + + if(!verificarPreenhimentoLinhaOriginal(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.linha.original"); + } + + if(!verificarPreenchimentoOrigemDestinoOriginais(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.origem.destino.originais"); + } + + if(!verificarPreenhimentoLinhaASerCopiada(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.linhaASerCopiada"); + } + + if(!verificarPreenchimentoOrigemDestinoASeremCopiados(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.origem.destinoASeremCopiados"); + } + + if(!verificarPreenchimentoDataInicioFim(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.data.InicioFim"); + } + + if(!verificarRutaOrigemDestinoOriginal(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.destinoOuOrigemNaoExistemOriginal"); + } + + if(!verificarRutaOrigemDestinoASerCopiado(entidad)){ + throw new BusinessException("editarPrecioVentajaController.MSG.destinoOuOrigemNaoExistemDestino"); + } + + Boolean precioVentajaDuplicado = validarDuplicidade(entidad); + + if (precioVentajaDuplicado) { + throw new BusinessException("editarPrecioVentajaController.MSG.data.existeIgual", new Object[] { entidad.getOrigenOriginalId().getDescparada(), + entidad.getDestinoOriginalId().getDescparada(), entidad.getRutaOriginalId().getDescruta() }); + } + + + + if (entidad.getPrecioVentajaId() == null) { + return precioVentajaDAO.suscribir(entidad); + } else { + return precioVentajaDAO.actualizacion(entidad); + } + } + + private Boolean validarDuplicidade(PrecioVentaja entidad) { + List lsPrecioVentaja = precioVentajaDAO.buscarPrecioVentaja(entidad.getOrigenOriginalId().getParadaId(), entidad.getDestinoOriginalId().getParadaId(), entidad.getRutaOriginalId().getRutaId(), entidad.getCorridaId() ); + Boolean precioVentajaDuplicado = false; + + if (!lsPrecioVentaja.isEmpty()) { + + if (entidad.getPrecioVentajaId() == null){ + precioVentajaDuplicado = Boolean.TRUE; + }else{ + for (PrecioVentaja est : lsPrecioVentaja) { + if (!est.getPrecioVentajaId().equals(entidad.getPrecioVentajaId())) { + precioVentajaDuplicado = Boolean.TRUE; + break; + } + } + } + } + + return precioVentajaDuplicado; + } + + private Boolean verificarPreenchimentoDataInicioFim(PrecioVentaja entidad){ + if(entidad.getFechaInicio() == null || entidad.getFechaFinal() == null){ + return false; + } + return true; + } + + private Boolean verificarPreenchimentoOrigemDestinoASeremCopiados(PrecioVentaja entidad){ + if(entidad.getOrigenPrecioId() == null || entidad.getDestinoPrecioId() == null){ + return false; + } + return true; + } + + private Boolean verificarPreenhimentoLinhaASerCopiada(PrecioVentaja entidad) { + if(entidad.getRutaPrecioId() == null){ + return false; + } + return true; + } + + private Boolean verificarPreenchimentoOrigemDestinoOriginais(PrecioVentaja entidad){ + if(entidad.getOrigenOriginalId() == null || entidad.getDestinoOriginalId() == null){ + return false; + } + return true; + } + + private Boolean verificarPreenhimentoLinhaOriginal(PrecioVentaja entidad) { + if(entidad.getRutaOriginalId() == null){ + return false; + } + return true; + } + + private Boolean verificarRutaOrigemDestinoOriginal(PrecioVentaja entidad) { + Boolean existeOrigemOriginal = rutaService.paradaExisteEnLaRuta(entidad.getOrigenOriginalId(), entidad.getRutaOriginalId()); + Boolean exiteDestinoOriginal = rutaService.paradaExisteEnLaRuta(entidad.getDestinoOriginalId(), entidad.getRutaOriginalId()); + return existeOrigemOriginal && exiteDestinoOriginal; + } + + private Boolean verificarRutaOrigemDestinoASerCopiado(PrecioVentaja entidad) { + Boolean exiteOrigemASerCopiado = rutaService.paradaExisteEnLaRuta(entidad.getOrigenPrecioId(), entidad.getRutaPrecioId()); + Boolean exiteDestinoASerCopiado = rutaService.paradaExisteEnLaRuta(entidad.getDestinoPrecioId(), entidad.getRutaPrecioId()); + return exiteOrigemASerCopiado && exiteDestinoASerCopiado; + } + + + @Transactional + public void borrar(PrecioVentaja entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + precioVentajaDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PrecoApanheServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PrecoApanheServiceImpl.java new file mode 100644 index 000000000..47470d92f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PrecoApanheServiceImpl.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PrecoApanheDAO; +import com.rjconsultores.ventaboletos.entidad.PrecoApanhe; +import com.rjconsultores.ventaboletos.service.PrecoApanheService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("precoApanheService") +public class PrecoApanheServiceImpl implements PrecoApanheService { + + @Autowired + private PrecoApanheDAO precoApanheDAO; + + public List obtenerTodos() { + return precoApanheDAO.obtenerTodos(); + } + + public PrecoApanhe obtenerID(Integer id) { + return precoApanheDAO.obtenerID(id); + } + + @Transactional + public PrecoApanhe suscribir(PrecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return precoApanheDAO.suscribir(entidad); + } + + @Transactional + public PrecoApanhe actualizacion(PrecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return precoApanheDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PrecoApanhe entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + precoApanheDAO.actualizacion(entidad); + } + + public List buscar(String deschotel, String desccolonia, String nombciudad) { + return precoApanheDAO.buscar(deschotel, desccolonia, nombciudad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingAsientoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingAsientoServiceImpl.java new file mode 100644 index 000000000..a55567a4d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingAsientoServiceImpl.java @@ -0,0 +1,76 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingAsientoDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingAsiento; +import com.rjconsultores.ventaboletos.service.PricingAsientoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingAsientoService") +public class PricingAsientoServiceImpl implements PricingAsientoService { + + @Autowired + private PricingAsientoDAO pricingAsientoDAO; + + public List obtenerTodos() { + return pricingAsientoDAO.obtenerTodos(); + } + + public PricingAsiento obtenerID(Integer id) { + return pricingAsientoDAO.obtenerID(id); + } + + @Transactional + public PricingAsiento suscribir(PricingAsiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingAsientoDAO.suscribir(entidad); + } + + @Transactional + public PricingAsiento actualizacion(PricingAsiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingAsientoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingAsiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingAsientoDAO.actualizacion(entidad); + } + + public List obtenerPricingCategoria(Pricing pricing, Integer asiento) { + return pricingAsientoDAO.obtenerPricingCategoria(pricing, asiento); + } + + @Override + @Transactional + public void borrar(List pricingAsientos) { + if(pricingAsientos != null && !pricingAsientos.isEmpty()) { + for (PricingAsiento pricingAsiento : pricingAsientos) { + borrar(pricingAsiento); + } + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingCategoriaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingCategoriaServiceImpl.java new file mode 100644 index 000000000..ff8fd5100 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingCategoriaServiceImpl.java @@ -0,0 +1,77 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCategoria; +import com.rjconsultores.ventaboletos.service.PricingCategoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingCategoriaService") +public class PricingCategoriaServiceImpl implements PricingCategoriaService { + + @Autowired + private PricingCategoriaDAO pricingCategoriaDAO; + + public List obtenerTodos() { + return pricingCategoriaDAO.obtenerTodos(); + } + + public PricingCategoria obtenerID(Integer id) { + return pricingCategoriaDAO.obtenerID(id); + } + + @Transactional + public PricingCategoria suscribir(PricingCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingCategoriaDAO.suscribir(entidad); + } + + @Transactional + public PricingCategoria actualizacion(PricingCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingCategoriaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingCategoriaDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingCategoria(Pricing pricing, Categoria categoria) { + return pricingCategoriaDAO.obtenerPricingCategoria(pricing, categoria); + } + + @Override + @Transactional + public void borrar(List pricingCategorias) { + if(pricingCategorias != null && !pricingCategorias.isEmpty()) { + for (PricingCategoria pricingCategoria : pricingCategorias) { + borrar(pricingCategoria); + } + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingClaseServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingClaseServiceImpl.java new file mode 100644 index 000000000..ecf984245 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingClaseServiceImpl.java @@ -0,0 +1,77 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingClaseDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingClase; +import com.rjconsultores.ventaboletos.service.PricingClaseService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingClaseService") +public class PricingClaseServiceImpl implements PricingClaseService { + + @Autowired + private PricingClaseDAO pricingClaseDAO; + + public List obtenerTodos() { + return pricingClaseDAO.obtenerTodos(); + } + + public PricingClase obtenerID(Integer id) { + return pricingClaseDAO.obtenerID(id); + } + + @Transactional + public PricingClase suscribir(PricingClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingClaseDAO.suscribir(entidad); + } + + @Transactional + public PricingClase actualizacion(PricingClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingClaseDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingClaseDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingClase(Pricing pricing, ClaseServicio claseServicio) { + return pricingClaseDAO.obtenerPricingClase(pricing, claseServicio); + } + + @Override + @Transactional + public void borrar(List pricingClases) { + if(pricingClases != null && !pricingClases.isEmpty()) { + for (PricingClase pricingClase : pricingClases) { + borrar(pricingClase); + } + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingClasseTarifariaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingClasseTarifariaServiceImpl.java new file mode 100644 index 000000000..ea451f85c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingClasseTarifariaServiceImpl.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingClasseTarifariaDAO; +import com.rjconsultores.ventaboletos.entidad.PricingClasseTarifaria; +import com.rjconsultores.ventaboletos.service.PricingClasseTarifariaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pricingClasseTarifariaService") +public class PricingClasseTarifariaServiceImpl implements PricingClasseTarifariaService { + + @Autowired + private PricingClasseTarifariaDAO pricingClasseTarifariaDAO; + + @Override + public List obtenerTodos() { + return pricingClasseTarifariaDAO.obtenerTodos(); + } + + @Override + public PricingClasseTarifaria obtenerID(Integer id) { + return pricingClasseTarifariaDAO.obtenerID(id); + } + + @Override + @Transactional + public PricingClasseTarifaria suscribir(PricingClasseTarifaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return pricingClasseTarifariaDAO.suscribir(entidad); + } + + @Override + @Transactional + public PricingClasseTarifaria actualizacion(PricingClasseTarifaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return pricingClasseTarifariaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(PricingClasseTarifaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + pricingClasseTarifariaDAO.actualizacion(entidad); + } + + public Boolean validacionSigla(String sigla) { + return pricingClasseTarifariaDAO.validacionSigla(sigla); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingCorridaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingCorridaServiceImpl.java new file mode 100644 index 000000000..33c8619a3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingCorridaServiceImpl.java @@ -0,0 +1,77 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingCorridaDAO; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingCorrida; +import com.rjconsultores.ventaboletos.service.PricingCorridaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingCorridaService") +public class PricingCorridaServiceImpl implements PricingCorridaService { + + @Autowired + private PricingCorridaDAO pricingCorridaDAO; + + public List obtenerTodos() { + return pricingCorridaDAO.obtenerTodos(); + } + + public PricingCorrida obtenerID(Integer id) { + return pricingCorridaDAO.obtenerID(id); + } + + @Transactional + public PricingCorrida suscribir(PricingCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingCorridaDAO.suscribir(entidad); + } + + @Transactional + public PricingCorrida actualizacion(PricingCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingCorridaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingCorrida entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingCorridaDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingCorrida(Pricing pricing, CorridaCtrl corrida) { + return pricingCorridaDAO.obtenerPricingCorrida(pricing, corrida); + } + + @Override + @Transactional + public void borrar(List pricingCorridas) { + if(pricingCorridas != null && !pricingCorridas.isEmpty()) { + for (PricingCorrida pricingCorrida : pricingCorridas) { + borrar(pricingCorrida); + } + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingCtrlServiceImpl.java new file mode 100644 index 000000000..a05e29fa5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingCtrlServiceImpl.java @@ -0,0 +1,73 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.PricingCtrl; +import com.rjconsultores.ventaboletos.service.PricingCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pricingCtrlService") +public class PricingCtrlServiceImpl implements PricingCtrlService { + + @Autowired + private PricingCtrlDAO pricingCtrlDAO; + + @Override + public List obtenerTodos() { + return pricingCtrlDAO.obtenerTodos(); + } + + @Override + public PricingCtrl obtenerID(Integer id) { + return pricingCtrlDAO.obtenerID(id); + } + + @Override + @Transactional + public PricingCtrl suscribir(PricingCtrl entidad) { + entidad.setActivo(true); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(new Date()); + return pricingCtrlDAO.suscribir(entidad); + } + + @Override + @Transactional + public PricingCtrl actualizacion(PricingCtrl entidad) { + entidad.setActivo(true); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(new Date()); + return pricingCtrlDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(PricingCtrl entidad) { + entidad.setActivo(false); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(new Date()); + pricingCtrlDAO.actualizacion(entidad); + } + + @Override + public PricingCtrl obtenerPricingCtrl() { + return pricingCtrlDAO.obtenerPricingCtrl(); + } + + @Override + @Transactional + public PricingCtrl suscribirOrActualizacion(PricingCtrl entidad) { + if(entidad.getPricingctrlId() == null) { + return suscribir(entidad); + } else { + return actualizacion(entidad); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingDiaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingDiaServiceImpl.java new file mode 100644 index 000000000..17f972e55 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingDiaServiceImpl.java @@ -0,0 +1,76 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingDiaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingDia; +import com.rjconsultores.ventaboletos.service.PricingDiaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingDiaService") +public class PricingDiaServiceImpl implements PricingDiaService { + + @Autowired + private PricingDiaDAO pricingDiaDAO; + + public List obtenerTodos() { + return pricingDiaDAO.obtenerTodos(); + } + + public PricingDia obtenerID(Integer id) { + return pricingDiaDAO.obtenerID(id); + } + + @Transactional + public PricingDia suscribir(PricingDia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingDiaDAO.suscribir(entidad); + } + + @Transactional + public PricingDia actualizacion(PricingDia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingDiaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingDia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingDiaDAO.actualizacion(entidad); + } + + public List buscarTraslapa(PricingDia pricingDia) { + return pricingDiaDAO.buscarTraslapa(pricingDia); + } + + @Override + @Transactional + public void borrar(List pricingDias) { + if(pricingDias != null && !pricingDias.isEmpty()) { + for (PricingDia pricingDia : pricingDias) { + borrar(pricingDia); + } + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoAgenciaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoAgenciaServiceImpl.java new file mode 100644 index 000000000..e766367bd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoAgenciaServiceImpl.java @@ -0,0 +1,63 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoAgenciaDAO; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoAgencia; +import com.rjconsultores.ventaboletos.service.PricingEspecificoAgenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pricingEspecificoAgenciaService") +public class PricingEspecificoAgenciaServiceImpl implements PricingEspecificoAgenciaService { + @Autowired + private PricingEspecificoAgenciaDAO pricingEspecificoAgenciaDAO; + + @Override + public List obtenerTodos() { + return pricingEspecificoAgenciaDAO.obtenerTodos(); + } + + @Override + public PricingEspecificoAgencia obtenerID(Long id) { + return pricingEspecificoAgenciaDAO.obtenerID(id); + } + + @Override + @Transactional + public PricingEspecificoAgencia suscribir(PricingEspecificoAgencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); +// entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pricingEspecificoAgenciaDAO.suscribir(entidad); + } + + @Override + @Transactional + public PricingEspecificoAgencia actualizacion(PricingEspecificoAgencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + + return pricingEspecificoAgenciaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(PricingEspecificoAgencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pricingEspecificoAgenciaDAO.actualizacion(entidad); + } + @Override + public Boolean existeAgenciaPricing (PricingEspecificoAgencia entidad){ + return pricingEspecificoAgenciaDAO.isDuplicado(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoCanalVendasServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoCanalVendasServiceImpl.java new file mode 100644 index 000000000..12e48ad3d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoCanalVendasServiceImpl.java @@ -0,0 +1,63 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoCanalVendasDAO; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCanalVendas; +import com.rjconsultores.ventaboletos.service.PricingEspecificoCanalVendasService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pricingEspecificoCanalVendasService") +public class PricingEspecificoCanalVendasServiceImpl implements PricingEspecificoCanalVendasService { + @Autowired + private PricingEspecificoCanalVendasDAO pricingEspecificoCanalVendasDAO; + + @Override + public List obtenerTodos() { + return pricingEspecificoCanalVendasDAO.obtenerTodos(); + } + + @Override + public PricingEspecificoCanalVendas obtenerID(Long id) { + return pricingEspecificoCanalVendasDAO.obtenerID(id); + } + + @Override + @Transactional + public PricingEspecificoCanalVendas suscribir(PricingEspecificoCanalVendas entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); +// entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pricingEspecificoCanalVendasDAO.suscribir(entidad); + } + + @Override + @Transactional + public PricingEspecificoCanalVendas actualizacion(PricingEspecificoCanalVendas entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + + return pricingEspecificoCanalVendasDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(PricingEspecificoCanalVendas entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pricingEspecificoCanalVendasDAO.actualizacion(entidad); + } + @Override + public Boolean existeCanalVendasPricing (PricingEspecificoCanalVendas entidad){ + return pricingEspecificoCanalVendasDAO.isDuplicado(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoCategoriaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoCategoriaServiceImpl.java new file mode 100644 index 000000000..1ce746ba7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoCategoriaServiceImpl.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCategoria; +import com.rjconsultores.ventaboletos.service.PricingEspecificoCategoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pricingEspecificoCategoriaService") +public class PricingEspecificoCategoriaServiceImpl implements PricingEspecificoCategoriaService { + @Autowired + private PricingEspecificoCategoriaDAO pricingEspecificoCategoriaDAO; + + @Override + public List obtenerTodos() { + return pricingEspecificoCategoriaDAO.obtenerTodos(); + } + + @Override + public PricingEspecificoCategoria obtenerID(Long id) { + return pricingEspecificoCategoriaDAO.obtenerID(id); + } + + @Override + @Transactional + public PricingEspecificoCategoria suscribir(PricingEspecificoCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setActivo(Boolean.TRUE); + + return pricingEspecificoCategoriaDAO.suscribir(entidad); + } + + @Override + @Transactional + public PricingEspecificoCategoria actualizacion(PricingEspecificoCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + + return pricingEspecificoCategoriaDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(PricingEspecificoCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pricingEspecificoCategoriaDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoOcupacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoOcupacionServiceImpl.java new file mode 100644 index 000000000..e2f26b22b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoOcupacionServiceImpl.java @@ -0,0 +1,57 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoOcupacionDAO; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoOcupacion; +import com.rjconsultores.ventaboletos.service.PricingEspecificoOcupacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pricingEspecificoOcupacionService") +public class PricingEspecificoOcupacionServiceImpl implements PricingEspecificoOcupacionService { + @Autowired + private PricingEspecificoOcupacionDAO pricingEspecificoOcupacionDAO; + + @Override + public List obtenerTodos() { + return pricingEspecificoOcupacionDAO.obtenerTodos(); + } + + @Override + public PricingEspecificoOcupacion obtenerID(Long id) { + return pricingEspecificoOcupacionDAO.obtenerID(id); + } + + @Override + public PricingEspecificoOcupacion suscribir(PricingEspecificoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pricingEspecificoOcupacionDAO.suscribir(entidad); + } + + @Override + @Transactional + public PricingEspecificoOcupacion actualizacion(PricingEspecificoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + + return pricingEspecificoOcupacionDAO.actualizacion(entidad); + } + + @Override + public void borrar(PricingEspecificoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pricingEspecificoOcupacionDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoServiceImpl.java new file mode 100644 index 000000000..bdc838551 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingEspecificoServiceImpl.java @@ -0,0 +1,199 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingEspecificoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PricingEspecifico; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoAgencia; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCanalVendas; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoCategoria; +import com.rjconsultores.ventaboletos.entidad.PricingEspecificoOcupacion; +import com.rjconsultores.ventaboletos.service.PricingEspecificoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("pricingEspecificoService") +public class PricingEspecificoServiceImpl implements PricingEspecificoService { + + @Autowired + private PricingEspecificoDAO pricingEspecificoDAO; + + public List obtenerTodos() { + return pricingEspecificoDAO.obtenerTodos(); + } + + public PricingEspecifico obtenerID(Long id) { + return pricingEspecificoDAO.obtenerID(id); + } + + @Transactional + public PricingEspecifico suscribir(PricingEspecifico entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pricingEspecificoDAO.suscribir(entidad); + } + + @Transactional + public PricingEspecifico actualizacion(PricingEspecifico entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return pricingEspecificoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingEspecifico entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + pricingEspecificoDAO.actualizacion(entidad); + } + + public List buscarPorNome(PricingEspecifico pricingEspecifico) { + return pricingEspecificoDAO.buscarPorNome(pricingEspecifico); + } + + @Override + public List buscarPorNome(String nome) { + // TODO Auto-generated method stub + return null; + } + + @Override + @Transactional + public PricingEspecifico clonarPricing(Long id, String nome, List pricingCategoriaList) { + + PricingEspecifico pricingToClone = obtenerID(id); + PricingEspecifico clonePricing = new PricingEspecifico(); + + clonePricing.setNombPricing(nome); + clonePricing.setClaseServicio(pricingToClone.getClaseServicio()); + clonePricing.setCorridaId(pricingToClone.getCorridaId()); + clonePricing.setFechorfin(pricingToClone.getFechorfin()); + clonePricing.setFechorinicio(pricingToClone.getFechorinicio()); + clonePricing.setMarca(pricingToClone.getMarca()); + clonePricing.setMoneda(pricingToClone.getMoneda()); + clonePricing.setParada(pricingToClone.getParada()); + clonePricing.setParada1(pricingToClone.getParada1()); + clonePricing.setPricingEspecificoOcupacionsList(getPricingEspecificoOcupacion(pricingToClone, clonePricing)); + clonePricing.setTarifa(pricingToClone.getTarifa()); + clonePricing.setTarifaredabierto(pricingToClone.getTarifaredabierto()); + clonePricing.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + clonePricing.setPricingEspecificoAgenciasList(getPricingEspecificoAgenciasList(pricingToClone, clonePricing)); + clonePricing.setPricingEspecificoCanalVendasList(getPricingEspecificoCanalVendasList(pricingToClone, clonePricing)); + clonePricing.setPricingEspecificoCategoriaList(getPricingEspecificoCategoriaList(pricingToClone, clonePricing, pricingCategoriaList)); + + return suscribir(clonePricing); + } + + private List getPricingEspecificoAgenciasList(PricingEspecifico pricingToClone, PricingEspecifico clonePricing) { + + List toReturn = new ArrayList(); + + for (PricingEspecificoAgencia a : pricingToClone.getPricingEspecificoAgenciasList()) { + if (a.getActivo()) { + PricingEspecificoAgencia newPricingAgencia = new PricingEspecificoAgencia(); + + newPricingAgencia.setActivo(true); + newPricingAgencia.setFecmodif(new Date()); + newPricingAgencia.setPricingEspecifico(clonePricing); + newPricingAgencia.setPuntoVenta(a.getPuntoVenta()); + newPricingAgencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + toReturn.add(newPricingAgencia); + } + } + + return toReturn; + } + + private List getPricingEspecificoCanalVendasList(PricingEspecifico pricingToClone, PricingEspecifico clonePricing) { + + List toReturn = new ArrayList(); + + for (PricingEspecificoCanalVendas c : pricingToClone.getPricingEspecificoCanalVendasList()) { + if (c.getActivo()) { + PricingEspecificoCanalVendas newCanalVendas = new PricingEspecificoCanalVendas(); + + newCanalVendas.setActivo(true); + newCanalVendas.setFecmodif(new Date()); + newCanalVendas.setPricingEspecifico(clonePricing); + newCanalVendas.setTipoPtovta(c.getTipoPtovta()); + newCanalVendas.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + toReturn.add(newCanalVendas); + } + } + + return toReturn; + } + + private List getPricingEspecificoCategoriaList(PricingEspecifico pricingToClone, PricingEspecifico clonePricing, List pricingCategoriaList) { + + List toReturn = new ArrayList(); + + for (PricingEspecificoCategoria c : pricingCategoriaList) { + if (c.getActivo()) { + PricingEspecificoCategoria newCategoria = new PricingEspecificoCategoria(); + + newCategoria.setActivo(true); + newCategoria.setFecmodif(new Date()); + newCategoria.setPricingEspecifico(clonePricing); + newCategoria.setCategoria(c.getCategoria()); + newCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + toReturn.add(newCategoria); + } + } + + return toReturn; + } + + private List getPricingEspecificoOcupacion(PricingEspecifico pricingToClone, PricingEspecifico clonePricing){ + + List list = new ArrayList(); + + for(PricingEspecificoOcupacion peo : pricingToClone.getPricingEspecificoOcupacionsList()){ + PricingEspecificoOcupacion newPeo = new PricingEspecificoOcupacion( + peo.getOcupacioninicial(), + peo.getOcupacionfinal(), + peo.getTarifa(), + peo.getActivo(), + new Date(), + UsuarioLogado.getUsuarioLogado().getUsuarioId(), + peo.getDescuento(), + clonePricing); + + list.add(newPeo); + } + + return list; + } + + @Override + public List buscar(List empresas, List tipoClasses, List origens, List destinos, Date vigenciaInicial, Date vigenciaFinal) { + return pricingEspecificoDAO.buscar(empresas, tipoClasses, origens, destinos, vigenciaInicial, vigenciaFinal); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingFormapagoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingFormapagoServiceImpl.java new file mode 100644 index 000000000..83b7a5e0f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingFormapagoServiceImpl.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingFormapagoDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingFormapago; +import com.rjconsultores.ventaboletos.service.PricingFormapagoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pricingFormapagoService") +public class PricingFormapagoServiceImpl implements PricingFormapagoService { + + @Autowired + private PricingFormapagoDAO pricingFormapagoDAO; + + @Override + public List obtenerTodos() { + return pricingFormapagoDAO.obtenerTodos(); + } + + @Override + public PricingFormapago obtenerID(Integer id) { + return pricingFormapagoDAO.obtenerID(id); + } + + @Transactional + public PricingFormapago suscribir(PricingFormapago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingFormapagoDAO.suscribir(entidad); + + } + + @Transactional + public PricingFormapago actualizacion(PricingFormapago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingFormapagoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingFormapago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingFormapagoDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingImporteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingImporteServiceImpl.java new file mode 100644 index 000000000..87761106d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingImporteServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingImporteDAO; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingImporte; +import com.rjconsultores.ventaboletos.service.PricingImporteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingImporteService") +public class PricingImporteServiceImpl implements PricingImporteService { + + @Autowired + private PricingImporteDAO pricingImporteDAO; + + public List obtenerTodos() { + return pricingImporteDAO.obtenerTodos(); + } + + public PricingImporte obtenerID(Integer id) { + return pricingImporteDAO.obtenerID(id); + } + + @Transactional + public PricingImporte suscribir(PricingImporte entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingImporteDAO.suscribir(entidad); + } + + @Transactional + public PricingImporte actualizacion(PricingImporte entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingImporteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingImporte entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingImporteDAO.actualizacion(entidad); + } + + public List buscarMoneda(PricingImporte pricingImporte, Moneda moneda) { + return pricingImporteDAO.buscarMoneda(pricingImporte, moneda); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingMarcaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingMarcaServiceImpl.java new file mode 100644 index 000000000..80a9dc31c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingMarcaServiceImpl.java @@ -0,0 +1,77 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMarca; +import com.rjconsultores.ventaboletos.service.PricingMarcaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingMarcaService") +public class PricingMarcaServiceImpl implements PricingMarcaService { + + @Autowired + private PricingMarcaDAO pricingMarcaDAO; + + public List obtenerTodos() { + return pricingMarcaDAO.obtenerTodos(); + } + + public PricingMarca obtenerID(Integer id) { + return pricingMarcaDAO.obtenerID(id); + } + + @Transactional + public PricingMarca suscribir(PricingMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingMarcaDAO.suscribir(entidad); + } + + @Transactional + public PricingMarca actualizacion(PricingMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingMarcaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingMarcaDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingMarca(Pricing pricing, Marca marca) { + return pricingMarcaDAO.obtenerPricingMarca(pricing, marca); + } + + @Override + @Transactional + public void borrar(List pricingMarcaList) { + if(pricingMarcaList != null && !pricingMarcaList.isEmpty()) { + for (PricingMarca pricingMarca : pricingMarcaList) { + borrar(pricingMarca); + } + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingMercadoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingMercadoServiceImpl.java new file mode 100644 index 000000000..004ae379d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingMercadoServiceImpl.java @@ -0,0 +1,80 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingMercado; +import com.rjconsultores.ventaboletos.service.PricingMercadoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("pricingMercadoService") +public class PricingMercadoServiceImpl implements PricingMercadoService { + + @Autowired + private PricingMercadoDAO pricingMercadoDAO; + + public List obtenerTodos() { + return pricingMercadoDAO.obtenerTodos(); + } + + public PricingMercado obtenerID(Integer id) { + return pricingMercadoDAO.obtenerID(id); + } + + @Transactional + public PricingMercado suscribir(PricingMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingMercadoDAO.suscribir(entidad); + } + + @Transactional + public PricingMercado actualizacion(PricingMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingMercadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingMercadoDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingMercado(Pricing pricing, Parada origen, Parada destino) { + return pricingMercadoDAO.obtenerPricingMercado(pricing, origen, destino); + } + + @Override + @Transactional + public void borrar(List pricingMercados) { + if(pricingMercados != null && !pricingMercados.isEmpty()) { + for (PricingMercado pricingMercado : pricingMercados) { + borrar(pricingMercado); + } + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingOcupaAntecipaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingOcupaAntecipaServiceImpl.java new file mode 100644 index 000000000..df0263a16 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingOcupaAntecipaServiceImpl.java @@ -0,0 +1,134 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingOcupaAntecipaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.PricingOcupaAntecipaService; +import com.rjconsultores.ventaboletos.utilerias.TraslaparUtil; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("pricingOcupacionService") +public class PricingOcupaAntecipaServiceImpl implements PricingOcupaAntecipaService { + + private static final Logger log = LoggerFactory.getLogger(PricingOcupaAntecipaServiceImpl.class); + + @Autowired + private PricingOcupaAntecipaDAO pricingOcupacionDAO; + + @Transactional + public PricingOcupaAntecipa suscribir(PricingOcupaAntecipa entidad) throws BusinessException { + if (traslapa(entidad)) { + throw new BusinessException("PricingOcupaAntecipaServiceImpl.msg.traslapa"); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingOcupacionDAO.suscribir(entidad); + } + + @Transactional(rollbackFor = BusinessException.class) + public PricingOcupaAntecipa actualizacion(PricingOcupaAntecipa entidad) throws BusinessException { + if (traslapa(entidad)) { + throw new BusinessException("PricingOcupaAntecipaServiceImpl.msg.traslapa"); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingOcupacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingOcupaAntecipa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingOcupacionDAO.actualizacion(entidad); + } + + public List updateList(PricingOcupaAntecipa pricingOcupaAntecipa) { + List lsSalvos = pricingOcupacionDAO.buscarOcupaAntecipaPricing(pricingOcupaAntecipa.getPricing().getPricingId()); + return lsSalvos; + } + + private boolean traslapa(PricingOcupaAntecipa pricingOcupaAntecipa) { + + boolean traslapa = false; + List lsSalvos = pricingOcupacionDAO.buscarOcupaAntecipaPricing(pricingOcupaAntecipa.getPricing().getPricingId()); + + // removo o pricing que eu estou validando + lsSalvos.remove(pricingOcupaAntecipa); + + BigDecimal cantocupaini = pricingOcupaAntecipa.getOcupacioninicial(); + BigDecimal cantocupafin = pricingOcupaAntecipa.getOcupacionfinal(); + + boolean validaCantPorcentaje = ((cantocupaini != null) && (cantocupafin != null)); + + Integer cantasientosmin = pricingOcupaAntecipa.getCantasientosmin(); + Integer cantasientosmax = pricingOcupaAntecipa.getCantasientosmax(); + + boolean validaCantAsientos = ((cantasientosmin != null) && (cantasientosmax != null)); + + Integer cantdiasmin = pricingOcupaAntecipa.getCantdiasmin(); + Integer cantdiasmax = pricingOcupaAntecipa.getCantdiasmax(); + + boolean validaCantDias = ((cantdiasmin != null) && (cantdiasmax != null)); + + for (PricingOcupaAntecipa poa : lsSalvos) { + boolean traslapaCantPorcentaje = false; + if (validaCantPorcentaje) { + if ((poa.getOcupacioninicial() != null) && (poa.getOcupacionfinal() != null)) { + traslapaCantPorcentaje = TraslaparUtil.intersectNum(poa.getOcupacioninicial(), poa.getOcupacionfinal(), cantocupaini, cantocupafin); + } + } + + boolean traslapaCantAsiento = false; + if (validaCantAsientos) { + if ((poa.getCantasientosmin() != null) && (poa.getCantasientosmax() != null)) { + traslapaCantAsiento = TraslaparUtil.intersectNum(poa.getCantasientosmin(), poa.getCantasientosmax(), cantasientosmin, cantasientosmax); + } + } + + boolean traslapaCantDias = false; + if (validaCantDias) { + if ((poa.getCantdiasmin() != null) && (poa.getCantdiasmax() != null)) { + traslapaCantDias = TraslaparUtil.intersectNum(poa.getCantdiasmin(), poa.getCantdiasmax(), cantdiasmin, cantdiasmax); + } + } + + if ((traslapaCantPorcentaje || traslapaCantAsiento ) && traslapaCantDias ){ + log.info("registro que traslapa PricingOcupaAntecipa id =" + poa.getPricingocupaantecipaId()); + + traslapa = true; + + break; + } + + } + + return traslapa; + } + + @Override + @Transactional + public void borrar(List pricingOcupaAntecipas) { + if(pricingOcupaAntecipas != null && !pricingOcupaAntecipas.isEmpty()) { + for (PricingOcupaAntecipa pricingOcupaAntecipa : pricingOcupaAntecipas) { + borrar(pricingOcupaAntecipa); + } + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingPuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingPuntoVentaServiceImpl.java new file mode 100644 index 000000000..3c484fe61 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingPuntoVentaServiceImpl.java @@ -0,0 +1,77 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.PricingPuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingPuntoVentaService") +public class PricingPuntoVentaServiceImpl implements PricingPuntoVentaService { + + @Autowired + private PricingPuntoVentaDAO pricingPuntoVentaDAO; + + public List obtenerTodos() { + return pricingPuntoVentaDAO.obtenerTodos(); + } + + public PricingPuntoVenta obtenerID(Integer id) { + return pricingPuntoVentaDAO.obtenerID(id); + } + + @Transactional + public PricingPuntoVenta suscribir(PricingPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingPuntoVentaDAO.suscribir(entidad); + } + + @Transactional + public PricingPuntoVenta actualizacion(PricingPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingPuntoVentaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingPuntoVentaDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingPuntoVenta(Pricing pricing, PuntoVenta puntoVenta) { + return pricingPuntoVentaDAO.obtenerPricingPuntoVenta(pricing, puntoVenta); + } + + @Override + @Transactional + public void borrar(List pricingPuntoVentas) { + if(pricingPuntoVentas != null && !pricingPuntoVentas.isEmpty()) { + for (PricingPuntoVenta pricingPuntoVenta : pricingPuntoVentas) { + borrar(pricingPuntoVenta); + } + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingRutaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingRutaServiceImpl.java new file mode 100644 index 000000000..849cbeeee --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingRutaServiceImpl.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingRutaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingRuta; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.service.PricingRutaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingRutaService") +public class PricingRutaServiceImpl implements PricingRutaService { + + @Autowired + private PricingRutaDAO pricingRutaDAO; + + public List obtenerTodos() { + return pricingRutaDAO.obtenerTodos(); + } + + public PricingRuta obtenerID(Integer id) { + return pricingRutaDAO.obtenerID(id); + } + + @Transactional + public PricingRuta suscribir(PricingRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingRutaDAO.suscribir(entidad); + } + + @Transactional + public PricingRuta actualizacion(PricingRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingRutaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingRutaDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingRuta(Pricing pricing, Ruta ruta) { + return pricingRutaDAO.obtenerPricingRuta(pricing, ruta); + } + + @Override + @Transactional + public void borrar(List pricingRutas) { + if(pricingRutas != null && !pricingRutas.isEmpty()) { + for (PricingRuta pricingRuta : pricingRutas) { + borrar(pricingRuta); + } + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingServiceImpl.java new file mode 100644 index 000000000..ec751feb9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingServiceImpl.java @@ -0,0 +1,584 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PricingDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingAsiento; +import com.rjconsultores.ventaboletos.entidad.PricingCategoria; +import com.rjconsultores.ventaboletos.entidad.PricingClase; +import com.rjconsultores.ventaboletos.entidad.PricingCorrida; +import com.rjconsultores.ventaboletos.entidad.PricingDia; +import com.rjconsultores.ventaboletos.entidad.PricingFormapago; +import com.rjconsultores.ventaboletos.entidad.PricingImporte; +import com.rjconsultores.ventaboletos.entidad.PricingMarca; +import com.rjconsultores.ventaboletos.entidad.PricingMercado; +import com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa; +import com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PricingRuta; +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; +import com.rjconsultores.ventaboletos.entidad.PricingVigencia; +import com.rjconsultores.ventaboletos.service.CategoriaService; +import com.rjconsultores.ventaboletos.service.PricingService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("pricingService") +public class PricingServiceImpl implements PricingService { + + private static Logger log = Logger.getLogger(PricingServiceImpl.class); + + @Autowired + private PricingDAO pricingDAO; + + @Autowired + private CategoriaService categoriaService; + + public List obtenerTodos() { + return pricingDAO.obtenerTodos(); + } + + public Pricing obtenerID(Integer id) { + return pricingDAO.obtenerID(id); + } + + @Transactional + public Pricing suscribir(Pricing entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingDAO.suscribir(entidad); + } + + @Transactional + public Pricing actualizacion(Pricing entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingDAO.actualizacion(entidad); + } + + private void ativarInativarExcluirPricing(Pricing entidad, Integer ativarInativarExcluir) { + entidad = obtenerID(entidad.getPricingId()); + + for (PricingAsiento pricingAsiento : entidad.getPricingAsientoList()) { + pricingAsiento.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingAsiento.setFecmodif(Calendar.getInstance().getTime()); + pricingAsiento.setActivo(ativarInativarExcluir); + } + + for (PricingCategoria pricingCategoria : entidad.getPricingCategoriaList()) { + pricingCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingCategoria.setFecmodif(Calendar.getInstance().getTime()); + pricingCategoria.setActivo(ativarInativarExcluir); + } + + for (PricingClase pricingClase : entidad.getPricingClaseList()) { + pricingClase.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingClase.setFecmodif(Calendar.getInstance().getTime()); + pricingClase.setActivo(ativarInativarExcluir); + } + + for (PricingCorrida pricingCorrida : entidad.getPricingCorridaList()) { + pricingCorrida.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingCorrida.setFecmodif(Calendar.getInstance().getTime()); + pricingCorrida.setActivo(ativarInativarExcluir); + } + + for (PricingDia pricingDia : entidad.getPricingDiaList()) { + pricingDia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingDia.setFecmodif(Calendar.getInstance().getTime()); + pricingDia.setActivo(ativarInativarExcluir); + } + + for (PricingImporte pricingImporte : entidad.getPricingImporteList()) { + pricingImporte.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingImporte.setFecmodif(Calendar.getInstance().getTime()); + pricingImporte.setActivo(ativarInativarExcluir); + } + + for (PricingMarca pricingMarca : entidad.getPricingMarcaList()) { + pricingMarca.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingMarca.setFecmodif(Calendar.getInstance().getTime()); + pricingMarca.setActivo(ativarInativarExcluir); + } + + for (PricingMercado pricingMercado : entidad.getPricingMercadoList()) { + pricingMercado.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingMercado.setFecmodif(Calendar.getInstance().getTime()); + pricingMercado.setActivo(ativarInativarExcluir); + } + + for (PricingOcupaAntecipa pricingOcupaAntecipa : entidad.getPricingOcupaAntecipaList()) { + pricingOcupaAntecipa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingOcupaAntecipa.setFecmodif(Calendar.getInstance().getTime()); + pricingOcupaAntecipa.setActivo(ativarInativarExcluir); + } + + for (PricingPuntoVenta pricingPuntoVenta : entidad.getPricingPuntoventaList()) { + pricingPuntoVenta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingPuntoVenta.setFecmodif(Calendar.getInstance().getTime()); + pricingPuntoVenta.setActivo(ativarInativarExcluir); + } + + for (PricingRuta pricingRuta : entidad.getPricingRutaList()) { + pricingRuta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingRuta.setFecmodif(Calendar.getInstance().getTime()); + pricingRuta.setActivo(ativarInativarExcluir); + } + + for (PricingTipoPtoVta pricingTipoPtoVta : entidad.getPricingTipoptovtaList()) { + pricingTipoPtoVta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingTipoPtoVta.setFecmodif(Calendar.getInstance().getTime()); + pricingTipoPtoVta.setActivo(ativarInativarExcluir); + } + + for (PricingVigencia pricingVigencia : entidad.getPricingVigenciaList()) { + pricingVigencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingVigencia.setFecmodif(Calendar.getInstance().getTime()); + pricingVigencia.setActivo(ativarInativarExcluir); + } + + for (PricingTipoServicio pricingTipoServicio : entidad.getPricingTipoServicioList()) { + pricingTipoServicio.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingTipoServicio.setFecmodif(Calendar.getInstance().getTime()); + pricingTipoServicio.setActivo(ativarInativarExcluir); + } + + for (PricingFormapago pricingFormapago : entidad.getPricingFormapagoList()) { + pricingFormapago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricingFormapago.setFecmodif(Calendar.getInstance().getTime()); + pricingFormapago.setActivo(ativarInativarExcluir); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(ativarInativarExcluir); + + pricingDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Pricing entidad) { + ativarInativarExcluirPricing(entidad, Pricing.EXCLUIDO); + } + + @Transactional + public void inativar(Pricing entidad) { + ativarInativarExcluirPricing(entidad, Pricing.INATIVO); + } + + @Transactional + public void ativar(Pricing entidad) { + ativarInativarExcluirPricing(entidad, Pricing.ATIVO); + } + + @Transactional + public void borrarFisico(Pricing entidad) { + borrar(entidad); + } + + public List buscar(String nombPricing, Empresa empresa, Short cantboleto, + Integer cantdiasanticipacion, BigDecimal descuentoporcentaje, BigDecimal descuentoporcredondo) { + return pricingDAO.buscar(nombPricing, empresa, cantboleto, cantdiasanticipacion, descuentoporcentaje, descuentoporcredondo); + } + + public List buscarPorNombre(String nombPricing) { + return pricingDAO.buscarPorNombre(nombPricing); + } + + @Transactional + public Boolean clonarPricing(Integer pricingId, String nomePricing, boolean incluirPadraoPricingTipoPassagemPET) { + + Pricing pricing = this.obtenerID(pricingId); + Pricing clonePricing = new Pricing(); + + clonePricing.setNombPricing(nomePricing); + + clonePricing.setCantboleto(pricing.getCantboleto()); + clonePricing.setCantdiasanticipacion(pricing.getCantdiasanticipacion()); + clonePricing.setDescuentoporcentaje(pricing.getDescuentoporcentaje()); + clonePricing.setDescuentoporcredondo(pricing.getDescuentoporcredondo()); + clonePricing.setEmpresa(pricing.getEmpresa()); + clonePricing.setIndcancelable(pricing.getIndcancelable()); + clonePricing.setIndGeneraFeriadoVenta(pricing.getIndGeneraFeriadoVenta()); + clonePricing.setIndGeneraFeriadoViaje(pricing.getIndGeneraFeriadoViaje()); + clonePricing.setIndtransferible(pricing.getIndtransferible()); + clonePricing.setIndreservable(pricing.getIndreservable()); + + clonePricing = suscribir(clonePricing); + + percorrerPricingAtivoParaClonar(pricing, clonePricing, incluirPadraoPricingTipoPassagemPET); + actualizacion(clonePricing); + + inativar(clonePricing); + + return clonePricing.getPricingId() != null; + } + + private void percorrerPricingAtivoParaClonar(Pricing pricing, Pricing clonePricing, boolean incluirPadraoPricingTipoPassagemPET) { + Integer ativar = Pricing.ATIVO; + clonePricing.setPricingAsientoList(obtemPricingAsientoList(pricing, clonePricing, ativar)); + clonePricing.setPricingCategoriaList(obtemPricingCategoriaList(pricing, clonePricing, ativar, incluirPadraoPricingTipoPassagemPET)); + clonePricing.setPricingClaseList(obtemPricingClaseList(pricing, clonePricing, ativar)); + clonePricing.setPricingCorridaList(obtemPricingCorridaList(pricing, clonePricing, ativar)); + clonePricing.setPricingDiaList(obtemPricingDiaList(pricing, clonePricing, ativar)); + clonePricing.setPricingImporteList(obtemPricingImporteList(pricing, clonePricing, ativar)); + clonePricing.setPricingMarcaList(obtemPricingMarcaList(pricing, clonePricing, ativar)); + clonePricing.setPricingMercadoList(obtemPricingMercadoList(pricing, clonePricing, ativar)); + clonePricing.setPricingOcupaAntecipaList(obtemPricingOcupaAntecipaList(pricing, clonePricing, ativar)); + clonePricing.setPricingPuntoventaList(obtemPricingPuntoVentaList(pricing, clonePricing, ativar)); + clonePricing.setPricingRutaList(obtemPricingRutaList(pricing, clonePricing, ativar)); + clonePricing.setPricingTipoptovtaList(obtemPricingTipoPtoVtaList(pricing, clonePricing, ativar)); + clonePricing.setPricingVigenciaList(obtemPricingVigenciaList(pricing, clonePricing, ativar)); + clonePricing.setPricingTipoServicioList(obtemPricingTipoServicioList(pricing, clonePricing, ativar)); + clonePricing.setPricingFormapagoList(obtemPricingFormapagoList(pricing, clonePricing, ativar)); + } + + private List obtemPricingFormapagoList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingFormapagoList = new ArrayList(); + for (PricingFormapago pricingFormapago : pricing.getPricingFormapagoList()) { + + PricingFormapago clonePricingFormapago = new PricingFormapago(); + clonePricingFormapago.setIndexcepcion(pricingFormapago.getIndexcepcion()); + clonePricingFormapago.setFormaPago(pricingFormapago.getFormaPago()); + + clonePricingFormapago.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingFormapago.setFecmodif(Calendar.getInstance().getTime()); + clonePricingFormapago.setActivo(ativar); + clonePricingFormapago.setPricing(clonePricing); + pricingFormapagoList.add(clonePricingFormapago); + } + return pricingFormapagoList; + } + + private List obtemPricingTipoServicioList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingTipoServicioList = new ArrayList(); + for (PricingTipoServicio pricingTipoServicio : pricing.getPricingTipoServicioList()) { + + PricingTipoServicio clonePricingTipoServicio = new PricingTipoServicio(); + clonePricingTipoServicio.setTipoServicio(pricingTipoServicio.getTipoServicio()); + + clonePricingTipoServicio.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingTipoServicio.setFecmodif(Calendar.getInstance().getTime()); + clonePricingTipoServicio.setActivo(ativar); + clonePricingTipoServicio.setPricing(clonePricing); + pricingTipoServicioList.add(clonePricingTipoServicio); + } + return pricingTipoServicioList; + } + + private List obtemPricingVigenciaList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingVigenciaList = new ArrayList(); + for (PricingVigencia pricingVigencia : pricing.getPricingVigenciaList()) { + + PricingVigencia clonePricingVigencia = new PricingVigencia(); + + clonePricingVigencia.setFecfinventa(pricingVigencia.getFecfinventa()); + clonePricingVigencia.setFecinicioventa(pricingVigencia.getFecinicioventa()); + clonePricingVigencia.setFecinicioviaje(pricingVigencia.getFecinicioviaje()); + clonePricingVigencia.setFecfinviaje(pricingVigencia.getFecfinviaje()); + + clonePricingVigencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingVigencia.setFecmodif(Calendar.getInstance().getTime()); + clonePricingVigencia.setActivo(ativar); + clonePricingVigencia.setPricing(clonePricing); + pricingVigenciaList.add(clonePricingVigencia); + } + return pricingVigenciaList; + } + + private List obtemPricingTipoPtoVtaList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingTipoPtoVtaList = new ArrayList(); + for (PricingTipoPtoVta pricingTipoPtoVta : pricing.getPricingTipoptovtaList()) { + + PricingTipoPtoVta clonePricingTipoPtoVta = new PricingTipoPtoVta(); + + clonePricingTipoPtoVta.setTipoPtovta(pricingTipoPtoVta.getTipoPtovta()); + + clonePricingTipoPtoVta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingTipoPtoVta.setFecmodif(Calendar.getInstance().getTime()); + clonePricingTipoPtoVta.setActivo(ativar); + clonePricingTipoPtoVta.setPricing(clonePricing); + pricingTipoPtoVtaList.add(clonePricingTipoPtoVta); + } + return pricingTipoPtoVtaList; + } + + private List obtemPricingRutaList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingRutaList = new ArrayList(); + for (PricingRuta pricingRuta : pricing.getPricingRutaList()) { + + PricingRuta clonePricingRuta = new PricingRuta(); + + clonePricingRuta.setRuta(pricingRuta.getRuta()); + + clonePricingRuta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingRuta.setFecmodif(Calendar.getInstance().getTime()); + clonePricingRuta.setActivo(ativar); + clonePricingRuta.setPricing(clonePricing); + pricingRutaList.add(clonePricingRuta); + } + return pricingRutaList; + } + + private List obtemPricingPuntoVentaList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingPuntoVentaList = new ArrayList(); + for (PricingPuntoVenta pricingPuntoVenta : pricing.getPricingPuntoventaList()) { + + PricingPuntoVenta clonePricingPuntoVenta = new PricingPuntoVenta(); + + clonePricingPuntoVenta.setPuntoVenta(pricingPuntoVenta.getPuntoVenta()); + + clonePricingPuntoVenta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingPuntoVenta.setFecmodif(Calendar.getInstance().getTime()); + clonePricingPuntoVenta.setActivo(ativar); + clonePricingPuntoVenta.setPricing(clonePricing); + pricingPuntoVentaList.add(clonePricingPuntoVenta); + } + return pricingPuntoVentaList; + } + + private List obtemPricingOcupaAntecipaList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingOcupaAntecipaList = new ArrayList(); + for (PricingOcupaAntecipa pricingOcupaAntecipa : pricing.getPricingOcupaAntecipaList()) { + + PricingOcupaAntecipa clonePricingOcupaAntecipa = new PricingOcupaAntecipa(); + + clonePricingOcupaAntecipa.setCantasientosmin(pricingOcupaAntecipa.getCantasientosmin()); + clonePricingOcupaAntecipa.setCantasientosmax(pricingOcupaAntecipa.getCantasientosmax()); + clonePricingOcupaAntecipa.setCantdiasmin(pricingOcupaAntecipa.getCantdiasmin()); + clonePricingOcupaAntecipa.setCantdiasmax(pricingOcupaAntecipa.getCantdiasmax()); + clonePricingOcupaAntecipa.setImporte(pricingOcupaAntecipa.getImporte()); + clonePricingOcupaAntecipa.setPorcentaje(pricingOcupaAntecipa.getPorcentaje()); + clonePricingOcupaAntecipa.setOcupacioninicial(pricingOcupaAntecipa.getOcupacioninicial()); + clonePricingOcupaAntecipa.setOcupacionfinal(pricingOcupaAntecipa.getOcupacionfinal()); + + clonePricingOcupaAntecipa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingOcupaAntecipa.setFecmodif(Calendar.getInstance().getTime()); + clonePricingOcupaAntecipa.setActivo(ativar); + clonePricingOcupaAntecipa.setPricing(clonePricing); + pricingOcupaAntecipaList.add(clonePricingOcupaAntecipa); + } + return pricingOcupaAntecipaList; + } + + private List obtemPricingMercadoList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingMercadoList = new ArrayList(); + for (PricingMercado pricingMercado : pricing.getPricingMercadoList()) { + + PricingMercado clonePricingMercado = new PricingMercado(); + + clonePricingMercado.setDestino(pricingMercado.getDestino()); + clonePricingMercado.setOrigen(pricingMercado.getOrigen()); + + clonePricingMercado.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingMercado.setFecmodif(Calendar.getInstance().getTime()); + clonePricingMercado.setActivo(ativar); + clonePricingMercado.setPricing(clonePricing); + pricingMercadoList.add(clonePricingMercado); + } + return pricingMercadoList; + } + + private List obtemPricingMarcaList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingMarcaList = new ArrayList(); + for (PricingMarca pricingMarca : pricing.getPricingMarcaList()) { + + PricingMarca clonePricingMarca = new PricingMarca(); + + clonePricingMarca.setMarca(pricingMarca.getMarca()); + + clonePricingMarca.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingMarca.setFecmodif(Calendar.getInstance().getTime()); + clonePricingMarca.setActivo(ativar); + clonePricingMarca.setPricing(clonePricing); + pricingMarcaList.add(clonePricingMarca); + } + return pricingMarcaList; + } + + private List obtemPricingImporteList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingImporteList = new ArrayList(); + for (PricingImporte pricingImporte : pricing.getPricingImporteList()) { + + PricingImporte clonePricingImporte = new PricingImporte(); + + clonePricingImporte.setImporte(pricingImporte.getImporte()); + clonePricingImporte.setMoneda(pricingImporte.getMoneda()); + + clonePricingImporte.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingImporte.setFecmodif(Calendar.getInstance().getTime()); + clonePricingImporte.setActivo(ativar); + clonePricingImporte.setPricing(clonePricing); + pricingImporteList.add(clonePricingImporte); + } + return pricingImporteList; + } + + private List obtemPricingDiaList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingDiaList = new ArrayList(); + for (PricingDia pricingDia : pricing.getPricingDiaList()) { + + PricingDia clonePricingDia = new PricingDia(); + + clonePricingDia.setHorariofin(pricingDia.getHorariofin()); + clonePricingDia.setHorarioinicio(pricingDia.getHorarioinicio()); + clonePricingDia.setInddomingo(pricingDia.getInddomingo()); + clonePricingDia.setIndjueves(pricingDia.getIndjueves()); + clonePricingDia.setIndlunes(pricingDia.getIndlunes()); + clonePricingDia.setIndmartes(pricingDia.getIndmartes()); + clonePricingDia.setIndmiercoles(pricingDia.getIndmiercoles()); + clonePricingDia.setIndsabado(pricingDia.getIndsabado()); + clonePricingDia.setIndviernes(pricingDia.getIndviernes()); + clonePricingDia.setIndfecventa(pricingDia.getIndfecventa()); + clonePricingDia.setIndfecviaje(pricingDia.getIndfecviaje()); + + clonePricingDia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingDia.setFecmodif(Calendar.getInstance().getTime()); + clonePricingDia.setActivo(ativar); + clonePricingDia.setPricing(clonePricing); + pricingDiaList.add(clonePricingDia); + } + return pricingDiaList; + } + + private List obtemPricingCorridaList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingCorridaList = new ArrayList(); + for (PricingCorrida pricingCorrida : pricing.getPricingCorridaList()) { + + PricingCorrida clonePricingCorrida = new PricingCorrida(); + + clonePricingCorrida.setCorridaCtrl(pricingCorrida.getCorridaCtrl()); + + clonePricingCorrida.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingCorrida.setFecmodif(Calendar.getInstance().getTime()); + clonePricingCorrida.setActivo(ativar); + clonePricingCorrida.setPricing(clonePricing); + pricingCorridaList.add(clonePricingCorrida); + } + return pricingCorridaList; + } + + private List obtemPricingAsientoList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingAsientoList = new ArrayList(); + for (PricingAsiento pricingAsiento : pricing.getPricingAsientoList()) { + + PricingAsiento clonePricingAsiento = new PricingAsiento(); + + clonePricingAsiento.setNombImagen(pricingAsiento.getNombImagen()); + clonePricingAsiento.setNumeasiento(pricingAsiento.getNumeasiento()); + clonePricingAsiento.setPorcentaje(pricingAsiento.getPorcentaje()); + + clonePricingAsiento.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingAsiento.setFecmodif(Calendar.getInstance().getTime()); + clonePricingAsiento.setActivo(ativar); + clonePricingAsiento.setPricing(clonePricing); + pricingAsientoList.add(clonePricingAsiento); + } + return pricingAsientoList; + } + + private List obtemPricingClaseList(Pricing pricing, Pricing clonePricing, Integer ativar) { + List pricingClaseList = new ArrayList(); + for (PricingClase pricingClase : pricing.getPricingClaseList()) { + + PricingClase clonePricingClase = new PricingClase(); + + clonePricingClase.setClaseServicio(pricingClase.getClaseServicio()); + + clonePricingClase.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingClase.setFecmodif(Calendar.getInstance().getTime()); + clonePricingClase.setActivo(ativar); + clonePricingClase.setPricing(clonePricing); + pricingClaseList.add(clonePricingClase); + } + return pricingClaseList; + } + + private List obtemPricingCategoriaList(Pricing pricing, Pricing clonePricing, Integer ativar, boolean incluirPadraoPricingTipoPassagemPET) { + List pricingCategoriaList = new ArrayList(); + for (PricingCategoria pricingCategoria : pricing.getPricingCategoriaList()) { + setCategoria(clonePricing, ativar, pricingCategoriaList, pricingCategoria.getCategoria()); + } + + if (incluirPadraoPricingTipoPassagemPET) { + configuraInclusaoPadraoTipoPassagemPET(pricing, clonePricing, ativar, pricingCategoriaList); + } + + return pricingCategoriaList; + } + + protected void setCategoria(Pricing clonePricing, Integer ativar, List pricingCategoriaList, Categoria categoria) { + PricingCategoria clonePricingCategoria = new PricingCategoria(); + clonePricingCategoria.setCategoria(categoria); + clonePricingCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + clonePricingCategoria.setFecmodif(Calendar.getInstance().getTime()); + clonePricingCategoria.setActivo(ativar); + clonePricingCategoria.setPricing(clonePricing); + pricingCategoriaList.add(clonePricingCategoria); + } + + private void configuraInclusaoPadraoTipoPassagemPET(Pricing pricing, Pricing clonePricing, Integer ativar, List pricingCategoriaList) { + Categoria categoriaNormal = categoriaService.buscarUmaCategoria("NORMAL"); + if (!possuiCategoriaNaLista(pricing.getPricingCategoriaList(), categoriaNormal)) { + setCategoria(clonePricing, ativar, pricingCategoriaList, categoriaNormal); + } + Categoria categoriaPET = categoriaService.buscarUmaCategoria("PET"); + if (!possuiCategoriaNaLista(pricing.getPricingCategoriaList(), categoriaPET)) { + setCategoria(clonePricing, ativar, pricingCategoriaList, categoriaPET); + } + + } + + private boolean possuiCategoriaNaLista(List categoriaList, Categoria categoria) { + for (PricingCategoria pricingCategoria : categoriaList) { + if (pricingCategoria.getCategoria().equals(categoria)) { + return true; + } + } + return false; + } + + @Override + public List buscar(Integer pricingId, String nomepricing, Integer empresaId, Date dataViagemInicio, Date dataViagemFim, Integer origemId, Integer destinoId) { + return pricingDAO.buscar(pricingId, nomepricing, empresaId, dataViagemInicio, dataViagemFim, origemId, destinoId); + } + + @Override + @Transactional + public void excluirPricing(Integer diasFimViagem) { + try { + List pricings = pricingDAO.buscar(diasFimViagem); + for (Integer pricingId : pricings) { + Pricing pricing = pricingDAO.obtenerID(pricingId); + borrar(pricing); + log.info(String.format("Pricing [%d] excluido via WS", pricingId)); + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingTipoPtoVtaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingTipoPtoVtaServiceImpl.java new file mode 100644 index 000000000..97af181ed --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingTipoPtoVtaServiceImpl.java @@ -0,0 +1,77 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingTipoPtoVtaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.service.PricingTipoPtoVtaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingTipoPtoVtaService") +public class PricingTipoPtoVtaServiceImpl implements PricingTipoPtoVtaService { + + @Autowired + private PricingTipoPtoVtaDAO pricingTipoPtoVtaDAO; + + public List obtenerTodos() { + return pricingTipoPtoVtaDAO.obtenerTodos(); + } + + public PricingTipoPtoVta obtenerID(Integer id) { + return pricingTipoPtoVtaDAO.obtenerID(id); + } + + @Transactional + public PricingTipoPtoVta suscribir(PricingTipoPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingTipoPtoVtaDAO.suscribir(entidad); + } + + @Transactional + public PricingTipoPtoVta actualizacion(PricingTipoPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingTipoPtoVtaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingTipoPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingTipoPtoVtaDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingTipoPuntoVenta(Pricing pricing, TipoPuntoVenta tipoPuntoVenta) { + return pricingTipoPtoVtaDAO.obtenerPricingTipoPuntoVenta(pricing, tipoPuntoVenta); + } + + @Override + @Transactional + public void borrar(List pricingTipoPtoVtas) { + if(pricingTipoPtoVtas != null && !pricingTipoPtoVtas.isEmpty()) { + for (PricingTipoPtoVta pricingTipoPtoVta : pricingTipoPtoVtas) { + borrar(pricingTipoPtoVta); + } + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingTipoServicioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingTipoServicioServiceImpl.java new file mode 100644 index 000000000..a193845e3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingTipoServicioServiceImpl.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingTipoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; +import com.rjconsultores.ventaboletos.entidad.TipoServicio; +import com.rjconsultores.ventaboletos.service.PricingTipoServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("pricingTipoServicioService") +public class PricingTipoServicioServiceImpl implements PricingTipoServicioService { + + @Autowired + private PricingTipoServicioDAO pricingTipoServicioDAO; + + public List obtenerTodos() { + return pricingTipoServicioDAO.obtenerTodos(); + } + + public PricingTipoServicio obtenerID(Integer id) { + return pricingTipoServicioDAO.obtenerID(id); + } + + @Transactional + public PricingTipoServicio suscribir(PricingTipoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingTipoServicioDAO.suscribir(entidad); + } + + @Transactional + public PricingTipoServicio actualizacion(PricingTipoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingTipoServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingTipoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingTipoServicioDAO.actualizacion(entidad); + } + + public Boolean obtenerPricingTipoServicio(Pricing pricing, TipoServicio tipoServicio) { + return pricingTipoServicioDAO.obtenerPricingTipoServicio(pricing, tipoServicio); + } + + @Override + @Transactional + public void borrar(List pricingTipoServicios) { + if(pricingTipoServicios != null && !pricingTipoServicios.isEmpty()) { + for (PricingTipoServicio pricingTipoServicio : pricingTipoServicios) { + borrar(pricingTipoServicio); + } + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PricingVigenciaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PricingVigenciaServiceImpl.java new file mode 100644 index 000000000..d89ed498c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PricingVigenciaServiceImpl.java @@ -0,0 +1,81 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PricingVigenciaDAO; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingVigencia; +import com.rjconsultores.ventaboletos.service.PricingVigenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("pricingVigenciaService") +public class PricingVigenciaServiceImpl implements PricingVigenciaService { + + @Autowired + private PricingVigenciaDAO pricingVigenciaDAO; + + public List obtenerTodos() { + return pricingVigenciaDAO.obtenerTodos(); + } + + public PricingVigencia obtenerID(Integer id) { + return pricingVigenciaDAO.obtenerID(id); + } + + @Transactional + public PricingVigencia suscribir(PricingVigencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingVigenciaDAO.suscribir(entidad); + } + + @Transactional + public PricingVigencia actualizacion(PricingVigencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.ATIVO); + + return pricingVigenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PricingVigencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Pricing.EXCLUIDO); + + pricingVigenciaDAO.actualizacion(entidad); + } + + public List buscarPorVigencias(PricingVigencia pv) { + return pricingVigenciaDAO.buscarPorVigencias(pv); + } + + public Boolean podeSalvar(Pricing pricing, PricingVigencia pricingVigencia, Date inicio, Date fim) { + return pricingVigenciaDAO.podeSalvar(pricing, pricingVigencia, inicio, fim); + } + + @Override + @Transactional + public void borrar(List pricingVigenciaList) { + if(pricingVigenciaList != null && !pricingVigenciaList.isEmpty()) { + for (PricingVigencia pricingVigencia : pricingVigenciaList) { + borrar(pricingVigencia); + } + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ProdClaseServicioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ProdClaseServicioServiceImpl.java new file mode 100644 index 000000000..eaab1a96b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ProdClaseServicioServiceImpl.java @@ -0,0 +1,62 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdClaseServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ProdClaseServicio; +import com.rjconsultores.ventaboletos.service.ProdClaseServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodClaseServicioService") +public class ProdClaseServicioServiceImpl implements ProdClaseServicioService { + + @Autowired + private ProdClaseServicioDAO prodClaseServicioDAO; + + public List obtenerTodos() { + return prodClaseServicioDAO.obtenerTodos(); + } + + public ProdClaseServicio obtenerID(Integer id) { + return prodClaseServicioDAO.obtenerID(id); + } + + @Transactional + public ProdClaseServicio suscribir(ProdClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodClaseServicioDAO.suscribir(entidad); + } + + @Transactional + public ProdClaseServicio actualizacion(ProdClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodClaseServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdClaseServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodClaseServicioDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ProdFormaPagoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ProdFormaPagoServiceImpl.java new file mode 100644 index 000000000..384fb064d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ProdFormaPagoServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdFormaPagoDAO; +import com.rjconsultores.ventaboletos.entidad.ProdFormaPago; +import com.rjconsultores.ventaboletos.service.ProdFormaPagoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodFormaPagoService") +public class ProdFormaPagoServiceImpl implements ProdFormaPagoService { + + @Autowired + private ProdFormaPagoDAO prodFormaPagoDAO; + + public List obtenerTodos() { + return prodFormaPagoDAO.obtenerTodos(); + } + + public ProdFormaPago obtenerID(Integer id) { + return prodFormaPagoDAO.obtenerID(id); + } + + @Transactional + public ProdFormaPago suscribir(ProdFormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodFormaPagoDAO.suscribir(entidad); + } + + @Transactional + public ProdFormaPago actualizacion(ProdFormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodFormaPagoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdFormaPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodFormaPagoDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ProdMarcaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ProdMarcaServiceImpl.java new file mode 100644 index 000000000..0720f8d09 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ProdMarcaServiceImpl.java @@ -0,0 +1,84 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdMarca; +import com.rjconsultores.ventaboletos.entidad.ProdPrecio; +import com.rjconsultores.ventaboletos.service.ProdMarcaService; +import com.rjconsultores.ventaboletos.service.ProdPrecioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodMarcaService") +public class ProdMarcaServiceImpl implements ProdMarcaService { + + @Autowired + private ProdMarcaDAO prodMarcaDAO; + @Autowired + private ProdPrecioService prodPrecioService; + + + public List obtenerTodos() { + return prodMarcaDAO.obtenerTodos(); + } + + public ProdMarca obtenerID(Integer id) { + return prodMarcaDAO.obtenerID(id); + } + + @Transactional + public ProdMarca suscribir(ProdMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodMarcaDAO.suscribir(entidad); + } + + @Transactional + public ProdMarca actualizacion(ProdMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodMarcaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodMarcaDAO.actualizacion(entidad); + } + + @Transactional + public ProdMarca actualizacion(ProdMarca entidad, List listPrecios) { + entidad = this.actualizacion(entidad); + for(ProdPrecio pp : listPrecios){ + prodPrecioService.actualizacion(pp); + } + return entidad; + } + + @Transactional + public ProdMarca suscribir(ProdMarca entidad, List listPrecios) { + entidad = this.suscribir(entidad); + for(ProdPrecio pp : listPrecios){ + prodPrecioService.suscribir(pp); + } + return entidad; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ProdMercadoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ProdMercadoServiceImpl.java new file mode 100644 index 000000000..195ec4458 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ProdMercadoServiceImpl.java @@ -0,0 +1,62 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.ProdMercado; +import com.rjconsultores.ventaboletos.service.ProdMercadoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodMercadoService") +public class ProdMercadoServiceImpl implements ProdMercadoService { + + @Autowired + private ProdMercadoDAO prodMercadoDAO; + + public List obtenerTodos() { + return prodMercadoDAO.obtenerTodos(); + } + + public ProdMercado obtenerID(Integer id) { + return prodMercadoDAO.obtenerID(id); + } + + @Transactional + public ProdMercado suscribir(ProdMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodMercadoDAO.suscribir(entidad); + } + + @Transactional + public ProdMercado actualizacion(ProdMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodMercadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodMercadoDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ProdPrecioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ProdPrecioServiceImpl.java new file mode 100644 index 000000000..b34b2a356 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ProdPrecioServiceImpl.java @@ -0,0 +1,85 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdPrecioDAO; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.ProdPrecio; +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import com.rjconsultores.ventaboletos.service.ProdPrecioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("prodPrecioService") +public class ProdPrecioServiceImpl implements ProdPrecioService { + + @Autowired + private ProdPrecioDAO prodPrecioDAO; + + public List obtenerTodos() { + return prodPrecioDAO.obtenerTodos(); + } + + public ProdPrecio obtenerID(Integer id) { + return prodPrecioDAO.obtenerID(id); + } + + @Transactional + public ProdPrecio suscribir(ProdPrecio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodPrecioDAO.suscribir(entidad); + } + + @Transactional + public ProdPrecio actualizacion(ProdPrecio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodPrecioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdPrecio entidad) { + if (entidad.getProdprecio() == null) { + return; + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodPrecioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Marca marca) { + if (marca == null){ + return; + } + List lsPrecios = prodPrecioDAO.buscar(marca); + for (ProdPrecio pp : lsPrecios) { + pp.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pp.setFecmodif(Calendar.getInstance().getTime()); + pp.setActivo(Boolean.FALSE); + + prodPrecioDAO.actualizacion(pp); + } + } + + public List buscar(Marca marca, ProductoServicio productoservicio) { + return prodPrecioDAO.buscar(marca, productoservicio); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ProdPuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ProdPuntoVentaServiceImpl.java new file mode 100644 index 000000000..113f32c2b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ProdPuntoVentaServiceImpl.java @@ -0,0 +1,62 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdPuntoVenta; +import com.rjconsultores.ventaboletos.service.ProdPuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodPuntoVentaService") +public class ProdPuntoVentaServiceImpl implements ProdPuntoVentaService { + + @Autowired + private ProdPuntoVentaDAO prodPuntoVentaDAO; + + public List obtenerTodos() { + return prodPuntoVentaDAO.obtenerTodos(); + } + + public ProdPuntoVenta obtenerID(Integer id) { + return prodPuntoVentaDAO.obtenerID(id); + } + + @Transactional + public ProdPuntoVenta suscribir(ProdPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodPuntoVentaDAO.suscribir(entidad); + } + + @Transactional + public ProdPuntoVenta actualizacion(ProdPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodPuntoVentaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodPuntoVentaDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ProdRutaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ProdRutaServiceImpl.java new file mode 100644 index 000000000..7415810f6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ProdRutaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdRutaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdRuta; +import com.rjconsultores.ventaboletos.service.ProdRutaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodRutaService") +public class ProdRutaServiceImpl implements ProdRutaService { + + @Autowired + private ProdRutaDAO prodRutaDAO; + + public List obtenerTodos() { + return prodRutaDAO.obtenerTodos(); + } + + public ProdRuta obtenerID(Integer id) { + return prodRutaDAO.obtenerID(id); + } + + @Transactional + public ProdRuta suscribir(ProdRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodRutaDAO.suscribir(entidad); + } + + @Transactional + public ProdRuta actualizacion(ProdRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodRutaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdRuta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodRutaDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ProdTipoptovtaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ProdTipoptovtaServiceImpl.java new file mode 100644 index 000000000..308ed122f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ProdTipoptovtaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdTipoptovtaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdTipoptovta; +import com.rjconsultores.ventaboletos.service.ProdTipoptovtaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodTipoptovtaService") +public class ProdTipoptovtaServiceImpl implements ProdTipoptovtaService { + + @Autowired + private ProdTipoptovtaDAO prodTipoptovtaDAO; + + public List obtenerTodos() { + return prodTipoptovtaDAO.obtenerTodos(); + } + + public ProdTipoptovta obtenerID(Integer id) { + return prodTipoptovtaDAO.obtenerID(id); + } + + @Transactional + public ProdTipoptovta suscribir(ProdTipoptovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodTipoptovtaDAO.suscribir(entidad); + } + + @Transactional + public ProdTipoptovta actualizacion(ProdTipoptovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodTipoptovtaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdTipoptovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodTipoptovtaDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ProdVigenciaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ProdVigenciaServiceImpl.java new file mode 100644 index 000000000..d75ffcdd7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ProdVigenciaServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProdVigenciaDAO; +import com.rjconsultores.ventaboletos.entidad.ProdVigencia; +import com.rjconsultores.ventaboletos.service.ProdVigenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("prodVigenciaService") +public class ProdVigenciaServiceImpl implements ProdVigenciaService { + + @Autowired + private ProdVigenciaDAO prodVigenciaDAO; + + public List obtenerTodos() { + return prodVigenciaDAO.obtenerTodos(); + } + + public ProdVigencia obtenerID(Integer id) { + return prodVigenciaDAO.obtenerID(id); + } + + @Transactional + public ProdVigencia suscribir(ProdVigencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodVigenciaDAO.suscribir(entidad); + } + + @Transactional + public ProdVigencia actualizacion(ProdVigencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return prodVigenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProdVigencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + prodVigenciaDAO.actualizacion(entidad); + } + + public List buscarTraslapa(ProdVigencia prodVigencia) { + return prodVigenciaDAO.buscarTraslapa(prodVigencia); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ProductoServicioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ProductoServicioServiceImpl.java new file mode 100644 index 000000000..4afc90601 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ProductoServicioServiceImpl.java @@ -0,0 +1,124 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ProductoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ProdClaseServicio; +import com.rjconsultores.ventaboletos.entidad.ProdFormaPago; +import com.rjconsultores.ventaboletos.entidad.ProdMarca; +import com.rjconsultores.ventaboletos.entidad.ProdMercado; +import com.rjconsultores.ventaboletos.entidad.ProdPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.ProdRuta; +import com.rjconsultores.ventaboletos.entidad.ProdTipoptovta; +import com.rjconsultores.ventaboletos.entidad.ProdVigencia; +import com.rjconsultores.ventaboletos.entidad.ProductoServicio; +import com.rjconsultores.ventaboletos.service.ProductoServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("productoServicioService") +public class ProductoServicioServiceImpl implements ProductoServicioService { + + @Autowired + private ProductoServicioDAO productoServicioDAO; + + public List obtenerTodos() { + return productoServicioDAO.obtenerTodos(); + } + + public ProductoServicio obtenerID(Integer id) { + return productoServicioDAO.obtenerID(id); + } + + @Transactional + public ProductoServicio suscribir(ProductoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return productoServicioDAO.suscribir(entidad); + } + + @Transactional + public ProductoServicio actualizacion(ProductoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return productoServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ProductoServicio entidad) { + + entidad = this.obtenerID(entidad.getProductoservicioId()); + for (ProdClaseServicio p : entidad.getProdClaseServicioList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdFormaPago p : entidad.getProdFormaPagoList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdMarca p : entidad.getProdMarcaList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdMercado p : entidad.getProdMercadoList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdPuntoVenta p : entidad.getProdPuntoVentaList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdRuta p : entidad.getProdRutaList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdTipoptovta p : entidad.getProdTipoptovtaList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + for (ProdVigencia p : entidad.getProdVigenciaList()) { + p.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + p.setFecmodif(Calendar.getInstance().getTime()); + p.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + productoServicioDAO.actualizacion(entidad); + } + @Transactional + public void borrarFisico(ProductoServicio entidad) { + productoServicioDAO.borrar(entidad); + } + + public List buscar(String descproductoservicio) { + throw new UnsupportedOperationException("Not supported yet."); + } + + public List obtener(ProductoServicio ps) { + return productoServicioDAO.obtener(ps); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaCheckinServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaCheckinServiceImpl.java new file mode 100644 index 000000000..e28325a6b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaCheckinServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PtoVtaCheckinDAO; +import com.rjconsultores.ventaboletos.entidad.PtoVtaCheckin; +import com.rjconsultores.ventaboletos.service.PtoVtaCheckinService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ptoVtaCheckinService") +public class PtoVtaCheckinServiceImpl implements PtoVtaCheckinService { + + @Autowired + private PtoVtaCheckinDAO ptovtaEmpresaBloqueadaServiceDAO; + + @Override + public List obtenerTodos() { + return ptovtaEmpresaBloqueadaServiceDAO.obtenerTodos(); + } + + @Override + public PtoVtaCheckin obtenerID(Integer id) { + return ptovtaEmpresaBloqueadaServiceDAO.obtenerID(id); + } + + @Override + @Transactional(readOnly = false) + public PtoVtaCheckin suscribir(PtoVtaCheckin entidad) { + return ptovtaEmpresaBloqueadaServiceDAO.suscribir(entidad); + } + + @Override + @Transactional(readOnly = false) + public PtoVtaCheckin actualizacion(PtoVtaCheckin entidad) { + return ptovtaEmpresaBloqueadaServiceDAO.actualizacion(entidad); + } + + @Override + @Transactional(readOnly = false) + public void borrar(PtoVtaCheckin entidad) { + entidad.setActivo(Boolean.FALSE); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + ptovtaEmpresaBloqueadaServiceDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaSeguroServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaSeguroServiceImpl.java new file mode 100644 index 000000000..c228d5ee7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaSeguroServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PtoVtaSeguroDAO; +import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro; +import com.rjconsultores.ventaboletos.service.PtoVtaSeguroService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ptoVtaSeguroService") +public class PtoVtaSeguroServiceImpl implements PtoVtaSeguroService { + + @Autowired + private PtoVtaSeguroDAO ptoVtaSeguroServiceDAO; + + @Override + public List obtenerTodos() { + return ptoVtaSeguroServiceDAO.obtenerTodos(); + } + + @Override + public PtoVtaSeguro obtenerID(Integer id) { + return ptoVtaSeguroServiceDAO.obtenerID(id); + } + + @Override + @Transactional(readOnly = false) + public PtoVtaSeguro suscribir(PtoVtaSeguro entidad) { + return ptoVtaSeguroServiceDAO.suscribir(entidad); + } + + @Override + @Transactional(readOnly = false) + public PtoVtaSeguro actualizacion(PtoVtaSeguro entidad) { + return ptoVtaSeguroServiceDAO.actualizacion(entidad); + } + + @Override + @Transactional(readOnly = false) + public void borrar(PtoVtaSeguro entidad) { + entidad.setActivo(Boolean.FALSE); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + ptoVtaSeguroServiceDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaUsuarioBancarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaUsuarioBancarioServiceImpl.java new file mode 100644 index 000000000..de9d34c3c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtoVtaUsuarioBancarioServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PtoVtaUsuarioBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.PtoVtaUsuarioBancario; +import com.rjconsultores.ventaboletos.service.PtoVtaUsuarioBancarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptoVtaUsuarioBancarioService") +public class PtoVtaUsuarioBancarioServiceImpl implements PtoVtaUsuarioBancarioService { + + @Autowired + private PtoVtaUsuarioBancarioDAO ptoVtaUsuarioBancarioDAO; + + public List obtenerTodos() { + return ptoVtaUsuarioBancarioDAO.obtenerTodos(); + } + + public PtoVtaUsuarioBancario obtenerID(Integer id) { + return ptoVtaUsuarioBancarioDAO.obtenerID(id); + } + + @Transactional + public PtoVtaUsuarioBancario suscribir(PtoVtaUsuarioBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptoVtaUsuarioBancarioDAO.suscribir(entidad); + } + + @Transactional + public PtoVtaUsuarioBancario actualizacion(PtoVtaUsuarioBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptoVtaUsuarioBancarioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtoVtaUsuarioBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptoVtaUsuarioBancarioDAO.actualizacion(entidad); + } + + public void borrarFisico(PtoVtaUsuarioBancario pto2) { + ptoVtaUsuarioBancarioDAO.borrarFisico(pto2); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAgenciaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAgenciaServiceImpl.java new file mode 100644 index 000000000..fef2d0b3e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAgenciaServiceImpl.java @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.hibernate.Query; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PtovtaAgenciaDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaAgencia; +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa; +import com.rjconsultores.ventaboletos.service.PtovtaAgenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaAgenciaBancariaService") +public class PtovtaAgenciaServiceImpl implements PtovtaAgenciaService { + + @Autowired + private PtovtaAgenciaDAO ptovtaBancoDAO; + + public List obtenerTodos() { + return ptovtaBancoDAO.obtenerTodos(); + } + + public PtovtaAgencia obtenerID(Integer id) { + return ptovtaBancoDAO.obtenerID(id); + } + + @Transactional + public PtovtaAgencia suscribir(PtovtaAgencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaBancoDAO.suscribir(entidad); + } + + @Transactional + public PtovtaAgencia actualizacion(PtovtaAgencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaBancoDAO.actualizacion(entidad); + } + + + @Transactional + public void borrar(PtovtaAgencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaBancoDAO.actualizacion(entidad); + } + + + public List buscar(String numagencia) { + return ptovtaBancoDAO.buscar(numagencia); + } + + public void borrarFisico(PtovtaAgencia pto) { + ptovtaBancoDAO.borrarFisico(pto); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAntecipacomissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAntecipacomissaoServiceImpl.java new file mode 100644 index 000000000..84aafe079 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAntecipacomissaoServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PtovtaAntecipacomissaoDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaAntecipacomissao; +import com.rjconsultores.ventaboletos.service.PtovtaAntecipacomissaoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaAntecipacomissaoService") +public class PtovtaAntecipacomissaoServiceImpl implements PtovtaAntecipacomissaoService { + + @Autowired + private PtovtaAntecipacomissaoDAO ptovtaAntecipacomissaoDAO; + + public List obtenerTodos() { + return ptovtaAntecipacomissaoDAO.obtenerTodos(); + } + + public PtovtaAntecipacomissao obtenerID(Integer id) { + return ptovtaAntecipacomissaoDAO.obtenerID(id); + } + + @Transactional + public PtovtaAntecipacomissao suscribir(PtovtaAntecipacomissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaAntecipacomissaoDAO.suscribir(entidad); + } + + @Transactional + public PtovtaAntecipacomissao actualizacion(PtovtaAntecipacomissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaAntecipacomissaoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaAntecipacomissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaAntecipacomissaoDAO.actualizacion(entidad); + } + + public List buscar(int id) { + return ptovtaAntecipacomissaoDAO.buscar(id); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAntifraudeServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAntifraudeServiceImpl.java new file mode 100644 index 000000000..f3cd533f6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaAntifraudeServiceImpl.java @@ -0,0 +1,57 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PtovtaAntifraudeDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaAntifraude; +import com.rjconsultores.ventaboletos.service.PtovtaAntifraudeService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ptovtaAntifraudeService") +public class PtovtaAntifraudeServiceImpl implements PtovtaAntifraudeService { + + @Autowired + PtovtaAntifraudeDAO ptovtaAntifraudeServiceDAO; + + @Override + public List obtenerTodos() { + return ptovtaAntifraudeServiceDAO.obtenerTodos(); + } + + @Override + public PtovtaAntifraude obtenerID(Integer id) { + return ptovtaAntifraudeServiceDAO.obtenerID(id); + } + + @Override + @Transactional + public PtovtaAntifraude suscribir(PtovtaAntifraude entidad) { + entidad.setActivo(true); + entidad.setFecmodif(new Date()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return ptovtaAntifraudeServiceDAO.suscribir(entidad); + } + + @Override + @Transactional + public PtovtaAntifraude actualizacion(PtovtaAntifraude entidad) { + entidad.setFecmodif(new Date()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return ptovtaAntifraudeServiceDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(PtovtaAntifraude entidad) { + entidad.setActivo(false); + entidad.setFecmodif(new Date()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + ptovtaAntifraudeServiceDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaCatIndServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaCatIndServiceImpl.java new file mode 100644 index 000000000..148e51012 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaCatIndServiceImpl.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PtovtaCatIndDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd; +import com.rjconsultores.ventaboletos.service.PtovtaCatIndService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ptovtaCatIndService") +public class PtovtaCatIndServiceImpl implements PtovtaCatIndService { + + @Autowired + private PtovtaCatIndDAO ptovtaCatIndDAO; + + @Override + public List obtenerTodos() { + return ptovtaCatIndDAO.obtenerTodos(); + } + + @Override + public PtovtaCatInd obtenerID(Integer id) { + return ptovtaCatIndDAO.obtenerID(id); + } + + @Override + @Transactional + public PtovtaCatInd suscribir(PtovtaCatInd entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return ptovtaCatIndDAO.suscribir(entidad); + } + + @Override + @Transactional + public PtovtaCatInd actualizacion(PtovtaCatInd entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return ptovtaCatIndDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(PtovtaCatInd entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + ptovtaCatIndDAO.actualizacion(entidad); + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java new file mode 100644 index 000000000..7330b753c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PtovtaComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaComissao; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.PtovtaComissaoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaComissaoService") +public class PtovtaComissaoServiceImpl implements PtovtaComissaoService { + + @Autowired + private PtovtaComissaoDAO ptovtaComissaoDAO; + + public List obtenerTodos() { + return ptovtaComissaoDAO.obtenerTodos(); + } + + public PtovtaComissao obtenerID(Integer id) { + return ptovtaComissaoDAO.obtenerID(id); + } + + @Transactional + public PtovtaComissao suscribir(PtovtaComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaComissaoDAO.suscribir(entidad); + } + + @Transactional + public PtovtaComissao actualizacion(PtovtaComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaComissaoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaComissaoDAO.actualizacion(entidad); + } + + public List buscar(int id) { + return ptovtaComissaoDAO.buscar(id); + } + + public List buscarByPuntaVenta(PuntoVenta puntaVenta) { + return ptovtaComissaoDAO.buscarByPuntaVenta(puntaVenta); + } + + @Override + public PtovtaComissao buscarPuntaVentaEmpresa(Integer puntaVentaId, Integer empresaId) { + return ptovtaComissaoDAO.buscarPuntaVentaEmpresa(puntaVentaId, empresaId); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaContaMDServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaContaMDServiceImpl.java new file mode 100644 index 000000000..37f8cc5b2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaContaMDServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PtovtaContaMDDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaContaMD; +import com.rjconsultores.ventaboletos.service.PtovtaContaMDService; + +@Service("PtovtaContaMDService") +public class PtovtaContaMDServiceImpl implements PtovtaContaMDService { + + @Autowired + private PtovtaContaMDDAO ptovtaContaMDDAO; + + @Override + public List obtenerTodos() { + return ptovtaContaMDDAO.obtenerTodos(); + } + + @Override + public PtovtaContaMD obtenerID(Long id) { + return ptovtaContaMDDAO.obtenerID(id); + } + + @Transactional + @Override + public PtovtaContaMD suscribir(PtovtaContaMD entidad) { + return ptovtaContaMDDAO.suscribir(entidad); + } + + @Transactional + @Override + public PtovtaContaMD actualizacion(PtovtaContaMD entidad) { + return ptovtaContaMDDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(PtovtaContaMD entidad) { + ptovtaContaMDDAO.borrar(entidad); + } + + @Override + public boolean contemItem(PtovtaContaMD ptovtaContaMD) { + return ptovtaContaMDDAO.contemItem(ptovtaContaMD); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaDiversosServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaDiversosServiceImpl.java new file mode 100644 index 000000000..55c0ac068 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaDiversosServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PtovtaDiversosDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaDiversos; +import com.rjconsultores.ventaboletos.service.PtovtaDiversosService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaDiversosService") +public class PtovtaDiversosServiceImpl implements PtovtaDiversosService { + + @Autowired + private PtovtaDiversosDAO ptovtaDiversosDAO; + + public List obtenerTodos() { + return ptovtaDiversosDAO.obtenerTodos(); + } + + public PtovtaDiversos obtenerID(Integer id) { + return ptovtaDiversosDAO.obtenerID(id); + } + + @Transactional + public PtovtaDiversos suscribir(PtovtaDiversos entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaDiversosDAO.suscribir(entidad); + } + + @Transactional + public PtovtaDiversos actualizacion(PtovtaDiversos entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaDiversosDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaDiversos entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaDiversosDAO.actualizacion(entidad); + } + + public List buscar(int id) { + return ptovtaDiversosDAO.buscar(id); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaBloqueadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaBloqueadaServiceImpl.java new file mode 100644 index 000000000..28f588069 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaBloqueadaServiceImpl.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PtovtaEmpresaBloqueadaDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaBloqueada; +import com.rjconsultores.ventaboletos.service.PtovtaEmpresaBloqueadaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ptovtaEmpresaBloqueadaService") +public class PtovtaEmpresaBloqueadaServiceImpl implements PtovtaEmpresaBloqueadaService { + + @Autowired + private PtovtaEmpresaBloqueadaDAO ptovtaEmpresaBloqueadaServiceDAO; + + @Override + public List obtenerTodos() { + return ptovtaEmpresaBloqueadaServiceDAO.obtenerTodos(); + } + + @Override + public PtovtaEmpresaBloqueada obtenerID(Integer id) { + return ptovtaEmpresaBloqueadaServiceDAO.obtenerID(id); + } + + @Override + @Transactional(readOnly=false) + public PtovtaEmpresaBloqueada suscribir(PtovtaEmpresaBloqueada entidad) { + return ptovtaEmpresaBloqueadaServiceDAO.suscribir(entidad); + } + + @Override + @Transactional(readOnly=false) + public PtovtaEmpresaBloqueada actualizacion(PtovtaEmpresaBloqueada entidad) { + return ptovtaEmpresaBloqueadaServiceDAO.actualizacion(entidad); + } + + @Override + @Transactional(readOnly=false) + public void borrar(PtovtaEmpresaBloqueada entidad) { + entidad.setActivo(Boolean.FALSE); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + ptovtaEmpresaBloqueadaServiceDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaContaBancariaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaContaBancariaServiceImpl.java new file mode 100644 index 000000000..5c3f928e5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaContaBancariaServiceImpl.java @@ -0,0 +1,67 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PtovtaEmpresaContaBancariaDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresaContaBancaria; +import com.rjconsultores.ventaboletos.service.PtovtaEmpresaContaBancariaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaEmpresaContaBancariaService") +public class PtovtaEmpresaContaBancariaServiceImpl implements PtovtaEmpresaContaBancariaService { + + @Autowired + private PtovtaEmpresaContaBancariaDAO ptovtaEmpresaContaBancariaDAO; + + public List obtenerTodos() { + return ptovtaEmpresaContaBancariaDAO.obtenerTodos(); + } + + public PtovtaEmpresaContaBancaria obtenerID(Integer id) { + return ptovtaEmpresaContaBancariaDAO.obtenerID(id); + } + + @Transactional + public PtovtaEmpresaContaBancaria suscribir(PtovtaEmpresaContaBancaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaEmpresaContaBancariaDAO.suscribir(entidad); + } + + @Transactional + public PtovtaEmpresaContaBancaria actualizacion(PtovtaEmpresaContaBancaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaEmpresaContaBancariaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaEmpresaContaBancaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaEmpresaContaBancariaDAO.actualizacion(entidad); + } + + public void borrarFisico(PtovtaEmpresaContaBancaria pto) { + ptovtaEmpresaContaBancariaDAO.borrarFisico(pto); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaServiceImpl.java new file mode 100644 index 000000000..fb11d64b1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEmpresaServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PtovtaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa; +import com.rjconsultores.ventaboletos.service.PtovtaEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaEmpresaService") +public class PtovtaEmpresaServiceImpl implements PtovtaEmpresaService { + + @Autowired + private PtovtaEmpresaDAO ptovtaEmpresaDAO; + + public List obtenerTodos() { + return ptovtaEmpresaDAO.obtenerTodos(); + } + + public PtovtaEmpresa obtenerID(Integer id) { + return ptovtaEmpresaDAO.obtenerID(id); + } + + @Transactional + public PtovtaEmpresa suscribir(PtovtaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaEmpresaDAO.suscribir(entidad); + } + + @Transactional + public PtovtaEmpresa actualizacion(PtovtaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaEmpresaDAO.actualizacion(entidad); + } + + public List buscar(PtovtaEmpresa ptovtaEmpresa) { + return ptovtaEmpresaDAO.buscar(ptovtaEmpresa); + } + + public void borrarFisico(PtovtaEmpresa pto) { + ptovtaEmpresaDAO.borrarFisico(pto); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEstoqueServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEstoqueServiceImpl.java new file mode 100644 index 000000000..17826789e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaEstoqueServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.PtovtaEstoqueDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaEstoque; +import com.rjconsultores.ventaboletos.service.PtovtaEstoqueService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaEstoqueService") +public class PtovtaEstoqueServiceImpl implements PtovtaEstoqueService { + + @Autowired + private PtovtaEstoqueDAO ptovtaEstoqueDAO; + + public List obtenerTodos() { + return ptovtaEstoqueDAO.obtenerTodos(); + } + + public PtovtaEstoque obtenerID(Integer id) { + return ptovtaEstoqueDAO.obtenerID(id); + } + + @Transactional + public PtovtaEstoque suscribir(PtovtaEstoque entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaEstoqueDAO.suscribir(entidad); + } + + @Transactional + public PtovtaEstoque actualizacion(PtovtaEstoque entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaEstoqueDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaEstoque entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaEstoqueDAO.actualizacion(entidad); + } + + public List buscar(int id) { + return ptovtaEstoqueDAO.buscar(id); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaHorarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaHorarioServiceImpl.java new file mode 100644 index 000000000..1d6cf77f6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaHorarioServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + + +import com.rjconsultores.ventaboletos.dao.PtovtaHorarioDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaHorario; +import com.rjconsultores.ventaboletos.service.PtovtaHorarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaHorarioService") +public class PtovtaHorarioServiceImpl implements PtovtaHorarioService { + + @Autowired + private PtovtaHorarioDAO ptovtaHorarioDAO; + + public List obtenerTodos() { + return ptovtaHorarioDAO.obtenerTodos(); + } + + public PtovtaHorario obtenerID(Integer id) { + return ptovtaHorarioDAO.obtenerID(id); + } + + @Transactional + public PtovtaHorario suscribir(PtovtaHorario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaHorarioDAO.suscribir(entidad); + } + + @Transactional + public PtovtaHorario actualizacion(PtovtaHorario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaHorarioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaHorario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaHorarioDAO.actualizacion(entidad); + } + + public List buscar(int id) { + return ptovtaHorarioDAO.buscar(id); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java new file mode 100644 index 000000000..2691c7140 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + + +import com.rjconsultores.ventaboletos.dao.PtovtaTitularDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaTitular; +import com.rjconsultores.ventaboletos.service.PtovtaTitularService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("ptovtaTitularService") +public class PtovtaTitularServiceImpl implements PtovtaTitularService { + + @Autowired + private PtovtaTitularDAO ptovtaTitularDAO; + + public List obtenerTodos() { + return ptovtaTitularDAO.obtenerTodos(); + } + + public PtovtaTitular obtenerID(Integer id) { + return ptovtaTitularDAO.obtenerID(id); + } + + @Transactional + public PtovtaTitular suscribir(PtovtaTitular entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaTitularDAO.suscribir(entidad); + } + + @Transactional + public PtovtaTitular actualizacion(PtovtaTitular entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return ptovtaTitularDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(PtovtaTitular entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + ptovtaTitularDAO.actualizacion(entidad); + } + + public List buscar(int id) { + return ptovtaTitularDAO.buscar(id); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java new file mode 100644 index 000000000..b693105f9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -0,0 +1,840 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.net.URL; +import java.rmi.RemoteException; +import java.sql.Connection; +import java.sql.SQLException; +import java.text.Normalizer; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import javax.sql.DataSource; + +import org.apache.commons.lang.StringUtils; +import org.brazilutils.br.cpfcnpj.CpfCnpj; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.datasource.DataSourceUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.tempuri.IAG; +import org.tempuri.IAGservice; +import org.tempuri.IAGserviceLocator; + +import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.dao.UsuarioUbicacionDAO; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.IntegracionException; +import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.service.EstacionService; +import com.rjconsultores.ventaboletos.service.PuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ws.totvs.service.TotvsService; +import com.rjconsultores.ws.utileria.Atributos; +import com.rjconsultores.ws.utileria.Atributos.CodPaisBanco; +import com.rjconsultores.ws.utileria.Atributos.ContribuinteICMS; +import com.rjconsultores.ws.utileria.Atributos.ContribuinteSimplesNacional; +import com.rjconsultores.ws.utileria.Atributos.InscricaoMunicipal; +import com.rjconsultores.ws.utileria.Atributos.TipoCliente; +import com.rjconsultores.ws.utileria.Atributos.TipoEntidade; +import com.rjconsultores.ws.utileria.Atributos.TipoFornecedor; +import com.rjconsultores.ws.utileria.Atributos.TipoPessoa; +import com.rjconsultores.ws.utileria.RetornoTotvs; +import com.rjconsultores.ws.utileria.RetornoTotvs.TipoRetorno; +import com.rjconsultores.wsag.Constantes; +import com.rjconsultores.wsag.dao.DaoAG; + +import AGIntf.TCliente; +import AGIntf.TComissaoServicosCliente; +import AGIntf.TFornecedor; +import AGIntf.TServicosCliente; + +/** + * + * @author Administrador + */ +@Service("puntoVentaService") +public class PuntoVentaServiceImpl implements PuntoVentaService { + + private static Logger log = LoggerFactory.getLogger(PuntoVentaServiceImpl.class); + private static org.jboss.logging.Logger wslog = org.jboss.logging.Logger.getLogger("com.rjconsultores.ws"); + + @Autowired + private PuntoVentaDAO puntoVentaDAO; + @Autowired + private ConstanteService constanteService; + @Autowired + private EstacionService estacionService; + @Autowired + private UsuarioUbicacionDAO usuarioUbicacionDAO; + @Autowired + private DataSource dataSource; + + // FIXME : Remover esse método de quem está usando. Esse método carrega muitos dados + @Deprecated + public List obtenerTodos() { + return puntoVentaDAO.obtenerTodos(); + } + + public PuntoVenta obtenerID(Integer id) { + return puntoVentaDAO.obtenerID(id); + } + + @Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class}) + public PuntoVenta suscribir(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + Exception respEx = null; + Constante constDesativaTotvs = constanteService.buscarPorNomeConstante("WS_TOTVS_DESATIVA_INTEGRACAO"); + Boolean desativaTotvs = constDesativaTotvs != null && constDesativaTotvs.getValorconstante().equals("1"); + + // Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso. + // Integração AG + /* + * Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if (entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { log.debug("iniciando integração com AG"); integraAG(entidad); log.debug("fim da integração com AG"); } + */ + + // Integração Totvs + if (!desativaTotvs){ + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) { + try { + + if (entidad.getIndIntegracion() == null || (entidad.getIndIntegracion().equals(TipoRetorno.PENDENTE.getValor()) + || entidad.getIndIntegracion().equals(TipoRetorno.ERRO.getValor()))) { + String resp = integracionTotvs(entidad); + + TipoRetorno retornoTotvs = RetornoTotvs.validaRetornoTotvs(resp); + + switch (retornoTotvs) { + case CONCLUIDA: + entidad.setIndIntegracion(TipoRetorno.CONCLUIDA.getValor()); + break; + + case JA_CADASTRADA: + entidad.setIndIntegracion(TipoRetorno.JA_CADASTRADA.getValor()); + respEx = new IntegracionException(Atributos.MSG_ERRO_JA_CADASTRADO); + break; + + case ERRO: + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + resp); + break; + + default: + break; + } + } else { + respEx = new IntegracionException(Atributos.MSG_ERRO_NAO_ENVIO); + } + } catch (ValidacionCampoException ev) { + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = ev; + + } catch (Exception e) { + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + log.error(Atributos.MSG_ERRO_GENERICA, e); + respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + e.getMessage()); + } + + } + } + if (respEx != null) { + if (respEx instanceof ValidacionCampoException) { + throw (ValidacionCampoException) respEx; + } else if (respEx instanceof IntegracionException) { + entidad = puntoVentaDAO.suscribir(entidad); + throw (IntegracionException) respEx; + } + } + entidad = puntoVentaDAO.suscribir(entidad); + + // Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso. + // Integração AG + Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); + if (entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { + log.debug("iniciando integração com AG"); + integraAG(entidad); + log.debug("fim da integração com AG"); + } + + return entidad; + } + + private void integraAG(PuntoVenta entidad) throws IntegracionException{ + Connection connection = null; + try { + String motivoNaoIntegrado = ""; + + connection = getConnection(); + DaoAG.getInstance().setDBConnection(connection); + + integrarClienteAG(entidad); + if (!entidad.getIndIntegradoAG()){ + motivoNaoIntegrado += "Cliente: " + entidad.getMotivoNaoIntegradoAG(); + } + integrarFornecedorAG(entidad); + if (!entidad.getIndIntegradoAG()){ + motivoNaoIntegrado += "\nFornecedor: " + entidad.getMotivoNaoIntegradoAG(); + + } + if (!motivoNaoIntegrado.isEmpty()){ + throw new IntegracionException(motivoNaoIntegrado); + } + } finally { + try { + if (connection != null && !connection.isClosed()) { + connection.close(); + } + } catch (SQLException e) { + log.error("error fechar conexão", e); + throw new RuntimeException(e); + } + } + } + + private void integrarFornecedorAG(PuntoVenta entidad) { + try { + IAGservice service = new IAGserviceLocator(); + IAG iag = DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG) == null ? null : service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG))); + TFornecedor fornecedor = null; + String strFornecedor = ""; + try{ + strFornecedor = iag.getCodigoFornecedorWithIDWS(entidad.getNumPuntoVenta().toString()); + wslog.debug("Retorno consulta fornecedor ws: " + strFornecedor); + } catch (RemoteException e) { + wslog.error(e.toString()); + entidad.setIndIntegradoAG(false); + entidad.setMotivoNaoIntegradoAG("Erro ao conectar com o WS: " + e.toString()); + return; + } + if (!strFornecedor.contains("ERRO")){ + // retornar msg a informação de registro já cadastrado + entidad.setIndIntegradoAG(false); + entidad.setMotivoNaoIntegradoAG("Fornecedor já cadastrado"); + } else { + fornecedor = new TFornecedor(); + fornecedor.setNome(entidad.getRazonSocial()); + fornecedor.setNomeFantasia(entidad.getNombpuntoventa()); + fornecedor.setCNPJCPF(entidad.getNumDoCPuntoVenta()); + fornecedor.setGrupo(""); + fornecedor.setReceita(""); + fornecedor.setCodigo(""); + fornecedor.setCEP(entidad.getCep()); + fornecedor.setLogradouro(""+entidad.getLogradouro()); + fornecedor.setBairro(entidad.getBairro()); + fornecedor.setNumero(""+entidad.getNumero()); + fornecedor.setComplemento(""+entidad.getComplemento()); + fornecedor.setUF(entidad.getUF()); + fornecedor.setCidade(entidad.getCidade()); + fornecedor.setDDD(""); + fornecedor.setFone(""); + fornecedor.setFax(""); + fornecedor.setEmail(""); + fornecedor.setContato(""); + fornecedor.setSite(""); + fornecedor.setRG(""); + fornecedor.setIE(""); + fornecedor.setIM(""); + fornecedor.setReferencia(""); + fornecedor.setFinalidadeTED(""); + fornecedor.setFinalidadeDOC(""); + fornecedor.setCelular(""); + fornecedor.setLeiaute(""); + fornecedor.setBanco(""); + fornecedor.setBancoNumero(""); + fornecedor.setAgencia(""); + fornecedor.setCC(""); + fornecedor.setDVAg(""); + fornecedor.setDVCC(""); + fornecedor.setIDWS(entidad.getNumPuntoVenta()); + try{ + String retornoAG = iag.incluiFornecedor(fornecedor); + entidad.setIndIntegradoAG(true); + wslog.debug(retornoAG); + } catch (RemoteException e) { + entidad.setIndIntegradoAG(false); + entidad.setMotivoNaoIntegradoAG(e.getMessage()); + } + } + } catch (Exception e) { + wslog.error(e.getMessage(), e); + } + } + + private void integrarClienteAG(PuntoVenta entidad) { + + try { + + IAGservice service = new IAGserviceLocator(); + IAG iag = DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG) == null ? null : service.getIAGPort(new URL(DaoAG.getInstance().obterConstante(Constantes.URL_WS_AG))); + TCliente cli = null; + String cliStr = ""; + try { + cliStr = iag.getClienteWithIDWS(entidad.getNumPuntoVenta().toString()); + wslog.debug("Retorno consulta cliente ws: " + cliStr); + } catch (RemoteException e) { + wslog.error(e.toString()); + entidad.setIndIntegradoAG(false); + entidad.setMotivoNaoIntegradoAG("Erro ao conectar com o WS: " + e.toString()); + return; + } + if (!cliStr.contains("ERRO")) { + // retornar msg a informação de registro já cadastrado + entidad.setIndIntegradoAG(false); + entidad.setMotivoNaoIntegradoAG("Cliente já cadastrado"); + } else { + cli = new TCliente(); + cli.setCodigo(""); + cli.setNome(entidad.getRazonSocial()); + cli.setNomeFantasia(entidad.getNombpuntoventa()); + cli.setCnpjcpf(entidad.getNumDoCPuntoVenta()); + cli.setGrupo(""); + cli.setAgenteCobrador(""); + cli.setVencimento(0); + cli.setContaContabil(""); + cli.setCep(entidad.getCep()); + cli.setLogradouro("" + entidad.getLogradouro()); + cli.setBairro(entidad.getBairro()); + cli.setNumero("" + entidad.getNumero()); + cli.setComplemento("" + entidad.getComplemento()); + cli.setUf(entidad.getUF()); + cli.setCidade(entidad.getCidade()); + cli.setDdd(""); + cli.setFone(""); + cli.setDddFax(""); + cli.setFax(""); + cli.setIdentificador(""); + cli.setDddCelular(""); + cli.setCelular(""); + cli.setEmail(""); + cli.setContato(""); + cli.setSite(""); + cli.setRg(""); + cli.setIe(""); + cli.setReceita(""); + cli.setRepresentante(""); + cli.setIM(""); + cli.setCampoExtra1(""); + cli.setCampoExtra10(""); + cli.setCampoExtra2(""); + cli.setCampoExtra3(""); + cli.setCampoExtra4(""); + cli.setCampoExtra5(""); + cli.setCampoExtra6(""); + cli.setCampoExtra7(""); + cli.setCampoExtra8(""); + cli.setCampoExtra9(""); + cli.setCliPagador(""); + cli.setIDWS(entidad.getNumPuntoVenta()); + cli.setServicosCliente(new TServicosCliente()); + cli.getServicosCliente().setServico(""); + cli.getServicosCliente().setEstabelecimento(""); + cli.getServicosCliente().setModalidade(""); + cli.getServicosCliente().setIndexador(""); + cli.getServicosCliente().setAnoMesPrimeiraCobranca(""); + cli.getServicosCliente().setAquisicao(Calendar.getInstance()); + cli.getServicosCliente().setAnoMesReajuste(""); + cli.getServicosCliente().setObservacao(""); + cli.getServicosCliente().setDescricaoNota(""); + cli.getServicosCliente().setComplementoDescricaoNota(""); + cli.getServicosCliente().setContrato(""); + cli.getServicosCliente().setDtCancelamento(Calendar.getInstance()); + cli.getServicosCliente().setObsCancelamento(""); + cli.getServicosCliente().setCRS_Codigo(""); + cli.getServicosCliente().setIDWS(entidad.getNumPuntoVenta()); + + cli.getServicosCliente().setAcessoSimultaneo(0); + cli.getServicosCliente().setAgrupaFat(0); + cli.getServicosCliente().setAnoMesPrimeiraCobranca(""); + cli.getServicosCliente().setAnoMesReajuste(""); + cli.getServicosCliente().setAquisicao(Calendar.getInstance()); + cli.getServicosCliente().setCliente(""); + cli.getServicosCliente().setComissaoServicosCliente(new TComissaoServicosCliente()); + cli.getServicosCliente().setComplementoDescricaoNota(""); + cli.getServicosCliente().setContrato(""); + cli.getServicosCliente().setCRD_Codigo(""); + cli.getServicosCliente().setCRS_Codigo(""); + cli.getServicosCliente().setDescPrevisto(0); + cli.getServicosCliente().setDescricaoNota(""); + cli.getServicosCliente().setDtCancelamento(Calendar.getInstance()); + cli.getServicosCliente().setEstabelecimento(""); + cli.getServicosCliente().setGrupoDeHoras(0); + cli.getServicosCliente().setIDWS(""); + cli.getServicosCliente().setIndexador(""); + cli.getServicosCliente().setMCS_Codigo(""); + cli.getServicosCliente().setModalidade(""); + cli.getServicosCliente().setNrLicencas(0); + cli.getServicosCliente().setObsCancelamento(""); + cli.getServicosCliente().setObservacao(""); + cli.getServicosCliente().setQtdIndexador(0); + cli.getServicosCliente().setSequencial(0); + cli.getServicosCliente().setServico(""); + cli.getServicosCliente().setStISS(""); + cli.getServicosCliente().setTamanhoEmpresa(0); + cli.getServicosCliente().setValorMaximoFortesDoc(0); + cli.getServicosCliente().setVencimento(0); + cli.getServicosCliente().setVRP_Codigo(""); + try { + +// StringWriter sw = new StringWriter(); +// JAXBContext jaxbContext = JAXBContext.newInstance(TCliente.class); +// Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); +// jaxbMarshaller.marshal(cli, sw); +// String xmlString = sw.toString(); +// System.out.println(xmlString); + + String retornoAG = iag.incluiCliente(cli); + entidad.setIndIntegradoAG(true); + wslog.debug(retornoAG); + } catch (RemoteException e) { + entidad.setIndIntegradoAG(false); + entidad.setMotivoNaoIntegradoAG(e.getMessage()); + } + } + + } catch (Exception e) { + wslog.error(e.getMessage(), e); + } + } + + private Connection getConnection() { + return DataSourceUtils.getConnection(dataSource); + } + + @Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class}) + public PuntoVenta actualizacion(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + Exception respEx = null; + Constante constDesativaTotvs = constanteService.buscarPorNomeConstante("WS_TOTVS_DESATIVA_INTEGRACAO"); + Boolean desativaTotvs = constDesativaTotvs != null && constDesativaTotvs.getValorconstante().equals("1"); + + // Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso. + // Integração AG + /* + * Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if ( entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { log.debug("iniciando integração com AG"); integraAG(entidad); log.debug("fim da integração com AG"); } + */ + + // Integração Totvs + if (!desativaTotvs){ + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) { + + try { + if (entidad.getIndIntegracion() == null || (entidad.getIndIntegracion().equals(TipoRetorno.PENDENTE.getValor()) + || entidad.getIndIntegracion().equals(TipoRetorno.ERRO.getValor()))) { + String resp = integracionTotvs(entidad); + + TipoRetorno retornoTotvs = RetornoTotvs.validaRetornoTotvs(resp); + + switch (retornoTotvs) { + case CONCLUIDA: + entidad.setIndIntegracion(TipoRetorno.CONCLUIDA.getValor()); + break; + + case JA_CADASTRADA: + entidad.setIndIntegracion(TipoRetorno.JA_CADASTRADA.getValor()); + respEx = new IntegracionException(Atributos.MSG_ERRO_JA_CADASTRADO); + break; + + case ERRO: + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + resp); + break; + + default: + break; + } + } else { + respEx = new IntegracionException(Atributos.MSG_ERRO_NAO_ENVIO); + } + } catch (ValidacionCampoException e) { + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + respEx = e; + + } catch (Exception e) { + entidad.setIndIntegracion(TipoRetorno.ERRO.getValor()); + log.error(Atributos.MSG_ERRO_GENERICA, e); + respEx = new IntegracionException(Atributos.MSG_ERRO_GENERICA + e.getMessage()); + } + } + } + entidad = puntoVentaDAO.actualizacion(entidad); + + if (respEx != null) { + if (respEx instanceof IntegracionException) { + throw (IntegracionException) respEx; + } else if (respEx instanceof ValidacionCampoException) { + throw (ValidacionCampoException) respEx; + } + } + + // Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso. + // Integração AG + Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); + if (entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { + log.debug("iniciando integração com AG"); + integraAG(entidad); + log.debug("fim da integração com AG"); + } + + return entidad; + } + + private boolean tienesEstacionEnPuntoVta(PuntoVenta entidad) { + List lsEstaciones = estacionService.buscarEstaciones(entidad); + if (lsEstaciones != null && lsEstaciones.size() > 0) { + return true; + } + return false; + } + + @Transactional + public void borrar(PuntoVenta entidad) throws BusinessException { + + if (tienesEstacionEnPuntoVta(entidad)) { + throw new BusinessException("editarPuntoVentaController.MSG.estacionVinculadaAgenciaOnDelete"); + } + + for (FormaPagoDet forma : entidad.getLsFormaPagoDet()) { + forma.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + forma.setFecmodif(Calendar.getInstance().getTime()); + forma.setActivo(Boolean.FALSE); + } + + if (entidad.getAgenciaId() != null) { + + entidad.getAgenciaId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.getAgenciaId().setFecmodif(Calendar.getInstance().getTime()); + entidad.getAgenciaId().setActivo(Boolean.FALSE); + + } + + if (entidad.getComissaoId() != null) { + entidad.getComissaoId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.getComissaoId().setFecmodif(Calendar.getInstance().getTime()); + entidad.getComissaoId().setActivo(Boolean.FALSE); + } + + if (entidad.getDiversosId() != null) { + entidad.getDiversosId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.getDiversosId().setFecmodif(Calendar.getInstance().getTime()); + entidad.getDiversosId().setActivo(Boolean.FALSE); + } + + if (entidad.getTitularId() != null) { + entidad.getTitularId().setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.getTitularId().setFecmodif(Calendar.getInstance().getTime()); + entidad.getTitularId().setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + puntoVentaDAO.actualizacion(entidad); + } + + public List buscaLike(String strEstacion, boolean sinTodos) { + return puntoVentaDAO.buscaLike(strEstacion, sinTodos); + } + + public List buscar(String nomPuntoVenta, String numPuntoVenta) { + return puntoVentaDAO.busca(nomPuntoVenta, numPuntoVenta); + } + + public List buscaPuntoVenta(String numPuntoVenta) { + return puntoVentaDAO.buscaPuntoVenta(numPuntoVenta); + } + + public List buscaPuntoVentaParada(Parada paradaId) { + return puntoVentaDAO.buscaPuntoVentaParada(paradaId); + } + + public List buscarPuntoVentaSubordinados(PuntoVenta puntoVenta) { + List lsPuntoVentaSubordinados = puntoVentaDAO.buscarPuntoVentaSubordinados(puntoVenta); + + return lsPuntoVentaSubordinados; + } + + public List buscarPuntosVentaMovimentacionBilhetes(List empresas) { + List puntosVenta = puntoVentaDAO.buscarPuntosVentaMovimentacionBilhetes(empresas); + return puntosVenta; + } + + public List buscarPuntosVentaPorUsuario(Usuario usuario) { + List puntosVenta = usuarioUbicacionDAO.buscarPuntoVentaPorUsuario(usuario); + return puntosVenta; + } + + private void validaCampos(PuntoVenta puntoVenta) throws ValidacionCampoException { + + if (puntoVenta.getNumDoCPuntoVenta() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.numDoCPuntoVenta"); + } + + String cpfOrCnpj = puntoVenta.getNumDoCPuntoVenta().replaceAll("[^0-9.]", ""); + + if (!CpfCnpj.isValid(cpfOrCnpj)) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.cpfCnpj"); + } + + if (puntoVenta.getNumIEPuntoVenta() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.numIEPuntoVenta"); + } + + if (puntoVenta.getColonia() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.colonia"); + } + + if (puntoVenta.getCodpostal() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.cep"); + } + + if (puntoVenta.getDireccioncalle() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.calle"); + } + + if (puntoVenta.getAgenciaId() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.agenciaId"); + } else { + + if (puntoVenta.getAgenciaId().getNumagencia() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.numagencia"); + } + if (puntoVenta.getAgenciaId().getNumconta() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.numconta"); + } + if (puntoVenta.getAgenciaId().getDigito() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.digito"); + } + + if (puntoVenta.getAgenciaId().getInstiFinanceiraId() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.instiFinanceiraId"); + } else { + if (puntoVenta.getAgenciaId().getInstiFinanceiraId().getCodigo() == null) { + throw new ValidacionCampoException("editarPuntoVentaController.erro.instiFinanceiraId.codigo"); + } + } + } + } + + private String integracionTotvs(PuntoVenta puntoVenta) throws Exception { + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) { + + validaCampos(puntoVenta); + + String endpointFornecedor = getEndpointFornecedor(); + String endpointCliente = getEndpointCliente(); + + String xidsvp = puntoVenta.getNumPuntoVenta(); + + String cnpjEmpresaProtheus = Atributos.CNPJ_EMPRESA_PROTHEUS; + + String nome = puntoVenta.getNombpuntoventa(); + nome = removerAcentosCaracteresEspeciaisTotvs(nome); + + String cgc = puntoVenta.getNumDoCPuntoVenta(); + + String endereco = puntoVenta.getDireccioncalle() + "," + ((puntoVenta.getDireccionnumero() == null) ? "" : puntoVenta.getDireccionnumero()); + endereco = removerAcentosCaracteresEspeciaisTotvs(endereco); + + String complemen = puntoVenta.getCompl() == null ? "" : puntoVenta.getCompl(); + complemen = removerAcentosCaracteresEspeciaisTotvs(complemen); + + String bairro = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getDesccolonia(); + bairro = removerAcentosCaracteresEspeciaisTotvs(bairro); + + String codmun = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getCodmunicipio().toString(); + codmun = (codmun == null) ? "" : StringUtils.leftPad(codmun, 5, '0'); + + String est = puntoVenta.getColonia() == null ? null : puntoVenta.getColonia().getCiudad().getEstado().getCveestado(); + String codpais = CodPaisBanco.BRASIL.getValor(); + + String cep = puntoVenta.getCodpostal() != null ? puntoVenta.getCodpostal().toString() : null; + + String tel = puntoVenta.getNumtelefonouno(); + String ddd = null; + try { + String[] telefone = tel == null ? null : tel.split("\\)"); + ddd = tel == null ? null : telefone[0].replaceAll("\\(", ""); + tel = tel == null ? null : telefone[1].replaceAll("\\(", ""); + } catch (Exception e) { + tel = puntoVenta.getNumtelefonouno(); + } + + String email = puntoVenta.getDescCorreo() == null ? "" : puntoVenta.getDescCorreo(); + email = removerCaracteresInvalidosXml(email); + + String fax = puntoVenta.getNumfax() == null ? "" : puntoVenta.getNumfax(); + String inscr = puntoVenta.getNumIEPuntoVenta(); + String inscrm = InscricaoMunicipal.ISENTO.name(); + + String nreduz = puntoVenta.getRazonSocial() != null ? puntoVenta.getRazonSocial() : puntoVenta.getNombpuntoventa(); + nreduz = removerAcentosCaracteresEspeciaisTotvs(nreduz); + + String simpnac = ContribuinteSimplesNacional.NAO.getValor(); + + String tppessoa = TipoFornecedor.OS.name(); + String tppessoaCliente = TipoCliente.F.name(); + + String tipoPessoa = TipoPessoa.F.name(); + + if (isCNPJ(cgc)) { + tipoPessoa = TipoPessoa.J.name(); + } + + String obs = StringUtils.isBlank(puntoVenta.getComentarios()) ? "sem obs." : puntoVenta.getComentarios(); + + String contaFornecedor = Atributos.CONTA_FORNECEDOR_PROTHEUS; + String contaCliente = Atributos.CONTA_CLIENTE_PROTHEUS; + + String naturez = ""; + String cnae = ""; + String fator = ""; + + String agencia = puntoVenta.getAgenciaId() == null ? "" : puntoVenta.getAgenciaId().getNumagencia(); + String dgverag = ""; + try { + String[] agenciaComp = agencia == null ? null : agencia.split("-"); + agencia = agencia == null ? null : agenciaComp[0]; + dgverag = agencia == null ? null : agenciaComp[1]; + } catch (Exception e) { + agencia = puntoVenta.getAgenciaId() == null ? "" : puntoVenta.getAgenciaId().getNumagencia(); + } + + String banco = puntoVenta.getAgenciaId().getInstiFinanceiraId() == null ? "" : puntoVenta.getAgenciaId().getInstiFinanceiraId().getCodigo(); + String ctacorr = puntoVenta.getAgenciaId() == null ? "" : puntoVenta.getAgenciaId().getNumconta(); + String dgverct = puntoVenta.getAgenciaId() == null ? "" : puntoVenta.getAgenciaId().getDigito(); + + String resp = null; + Exception respEx = null; + + try { + resp = TotvsService.cadastrarFornecedor(endpointFornecedor, bairro, cep, cgc, cnae, codmun, codpais, complemen, contaFornecedor, ddd, email, endereco, + est, inscr, inscrm, naturez, nreduz, nome, simpnac, tel, tipoPessoa, tppessoa, cnpjEmpresaProtheus, xidsvp, agencia, banco, + dgverag, ctacorr, dgverct); + } catch (Exception e) { + log.error("", e); + respEx = e; + } + + String contrib = ContribuinteICMS.NAO.getValor(); + String entid = TipoEntidade.TRANSPORTE_PASSAGEIRO.getValor(); + String pais = "";// segundo orientação da TOTVS, passar em branco + + try { + resp = TotvsService.cadastrarCliente(endpointCliente, bairro, cep, cgc, codmun, codpais, complemen, contaCliente, contrib, ddd, email, cnpjEmpresaProtheus, + endereco, entid, fator, fax, inscr, inscrm, naturez, nreduz, nome, obs, pais, tppessoaCliente, tel, tipoPessoa, est, xidsvp); + } catch (Exception e) { + log.error("", e); + respEx = e; + } + + if (respEx != null) { + throw respEx; + } + + return resp; + } + return null; + } + + private String getEndpointFornecedor() { + Constante constante = constanteService.buscarPorNomeConstante("WS_TOTVS_FORNECEDOR_ENDPOINT"); + if (constante == null) { + return ""; + } + return constante.getValorconstante(); + } + + private String getEndpointCliente() { + Constante constante = constanteService.buscarPorNomeConstante("WS_TOTVS_CLIENTE_ENDPOINT"); + if (constante == null) { + return ""; + } + return constante.getValorconstante(); + } + + private String somenteNumeros(String s) { + if (s == null || StringUtils.isBlank(s)) { + return ""; + } + + s = StringUtils.trim(s); + + return s.replaceAll("[^0-9]", ""); + } + + private boolean isCNPJ(String vlr) { + vlr = somenteNumeros(vlr); + return vlr.length() > 11; + } + + /** + * From xml spec valid chars:
+ * #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
+ * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
+ * + * link artigo:http://stackoverflow.com/questions/9710185/how-to-deal-with-invalid-characters-in-a-ws-output-when-using-cxf + * + * @param text + * The String to clean + * @param replacement + * The string to be substituted for each match + * @return The resulting String + */ + private String removerCaracteresInvalidosXml(String s) { + if (s == null) { + return s; + } + + String re = "[^\\x09\\x0A\\x0D\\x20-\\xD7FF\\xE000-\\xFFFD\\x10000-x10FFFF]"; + return s.replaceAll(re, ""); + } + + private String removerAcentosCaracteresEspeciaisTotvs(String s) { + if (StringUtils.isBlank(s)) { + return s; + } + s = StringUtils.trim(s); + s = removerCaracteresInvalidosXml(s); + return Normalizer.normalize(s, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "").replaceAll("\\W", " "); + } + + @Override + public List buscaPuntoVentaEmpresaSemECF(Empresa empresa) { + return puntoVentaDAO.buscaPuntoVentaEmpresaSemECF(empresa); + } + + @Override + public List buscarPuntoVentaPtoVtaComissao(List empresas) { + List empresasId = new ArrayList(); + if(empresas != null) { + for (Empresa empresa : empresas) { + empresasId.add(empresa.getEmpresaId()); + } + } + if(!empresasId.isEmpty()) { + return puntoVentaDAO.buscarPuntoVentaPtoVtaComissao(empresasId); + } + + return null; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ReceitaDespesaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ReceitaDespesaServiceImpl.java new file mode 100644 index 000000000..6320cbe1b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ReceitaDespesaServiceImpl.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ReceitaDespesaDAO; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.relatorios.receitaDespesa.RelatorioFinanceiroReceitasDespesasBean; +import com.rjconsultores.ventaboletos.service.ReceitaDespesaService; + +@Repository("receitaDespesaService") +public class ReceitaDespesaServiceImpl implements ReceitaDespesaService { + + @Autowired + ReceitaDespesaDAO receitaDespesaoDAO; + + @Override + public List getRelatorioDetalhado(Map parametros) throws BusinessException { + return receitaDespesaoDAO.getRelatorioDetalhado(parametros); + } + + @Override + public List getRelatorioSintetico(Map parametros) throws BusinessException { + return receitaDespesaoDAO.getRelatorioSintetico(parametros); + } + + @Override + public List getRelatorioAgencia(Map parametros) throws BusinessException { + return receitaDespesaoDAO.getRelatorioAgencia(parametros); + } + + @Override + public List getRelatorioEvento(Map parametros) throws BusinessException { + return receitaDespesaoDAO.getRelatorioEvento(parametros); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RedondeoCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RedondeoCtrlServiceImpl.java new file mode 100644 index 000000000..c1cc92727 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RedondeoCtrlServiceImpl.java @@ -0,0 +1,87 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RedondeoCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.Redondeo; +import com.rjconsultores.ventaboletos.entidad.RedondeoCtrl; +import com.rjconsultores.ventaboletos.entidad.RedondeoMarca; +import com.rjconsultores.ventaboletos.service.RedondeoCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("redondeoCtrlService") +public class RedondeoCtrlServiceImpl implements RedondeoCtrlService { + + @Autowired + private RedondeoCtrlDAO redondeoCtrlDAO; + + public List obtenerTodos() { + return redondeoCtrlDAO.obtenerTodos(); + } + + public RedondeoCtrl obtenerID(Integer id) { + return redondeoCtrlDAO.obtenerID(id); + } + + @Transactional + public RedondeoCtrl suscribir(RedondeoCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return redondeoCtrlDAO.suscribir(entidad); + } + + @Transactional + public RedondeoCtrl actualizacion(RedondeoCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return redondeoCtrlDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RedondeoCtrl entidad) { + + entidad = obtenerID(entidad.getRedondeoctrlId()); + + for (Redondeo r : entidad.getRedondeoList()) { + r.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + r.setFecmodif(Calendar.getInstance().getTime()); + r.setActivo(Boolean.FALSE); + } + for (RedondeoMarca rm : entidad.getRedondeoMarcaList()) { + rm.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rm.setFecmodif(Calendar.getInstance().getTime()); + rm.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + redondeoCtrlDAO.actualizacion(entidad); + } + + public List buscar(RedondeoCtrl redondeoCtrl) { + return redondeoCtrlDAO.buscar(redondeoCtrl); + } + + public List buscarTraslapa(Short[] iDMarcas, BigDecimal valorinicial, BigDecimal valorfinal, Boolean indaplicadescuento, + Boolean indaplicapricing, Boolean indaplicaAtersp) { + return redondeoCtrlDAO.buscarTraslapa(iDMarcas, valorinicial, valorfinal, indaplicadescuento, indaplicapricing, indaplicaAtersp); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RedondeoMarcaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RedondeoMarcaServiceImpl.java new file mode 100644 index 000000000..dfcbcd661 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RedondeoMarcaServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RedondeoMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.RedondeoMarca; +import com.rjconsultores.ventaboletos.service.RedondeoMarcaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("redondeoMarcaService") +public class RedondeoMarcaServiceImpl implements RedondeoMarcaService { + + @Autowired + private RedondeoMarcaDAO redondeoMarcaDAO; + + public List obtenerTodos() { + return redondeoMarcaDAO.obtenerTodos(); + } + + public RedondeoMarca obtenerID(Integer id) { + return redondeoMarcaDAO.obtenerID(id); + } + + @Transactional + public RedondeoMarca suscribir(RedondeoMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return redondeoMarcaDAO.suscribir(entidad); + } + + @Transactional + public RedondeoMarca actualizacion(RedondeoMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return redondeoMarcaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RedondeoMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + redondeoMarcaDAO.actualizacion(entidad); + } + + public List buscar(Marca marca) { + return redondeoMarcaDAO.buscar(marca); + } + + public List obtenerTodasMarcas(Short[] iDMarcas) { + return redondeoMarcaDAO.obtenerTodasMarcas(iDMarcas); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RedondeoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RedondeoServiceImpl.java new file mode 100644 index 000000000..f3e4e7ce5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RedondeoServiceImpl.java @@ -0,0 +1,71 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RedondeoDAO; +import com.rjconsultores.ventaboletos.entidad.Redondeo; +import com.rjconsultores.ventaboletos.service.RedondeoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("redondeoService") +public class RedondeoServiceImpl implements RedondeoService { + + @Autowired + private RedondeoDAO redondeoDAO; + + public List obtenerTodos() { + return redondeoDAO.obtenerTodos(); + } + + public Redondeo obtenerID(Integer id) { + return redondeoDAO.obtenerID(id); + } + + @Transactional + public Redondeo suscribir(Redondeo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return redondeoDAO.suscribir(entidad); + } + + @Transactional + public Redondeo actualizacion(Redondeo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return redondeoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Redondeo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + redondeoDAO.actualizacion(entidad); + } + + public List buscar(BigDecimal valorInicial, BigDecimal valorFinal, + BigDecimal valorRedondeo) { + return redondeoDAO.buscar(valorInicial, valorFinal, valorRedondeo); + } + + public List buscarVlrIniVlrFin(BigDecimal valorInicial, BigDecimal valorFinal) { + return redondeoDAO.buscar(valorInicial, valorFinal); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RegionMetropolitanaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RegionMetropolitanaServiceImpl.java new file mode 100644 index 000000000..3b37e70c3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RegionMetropolitanaServiceImpl.java @@ -0,0 +1,57 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.RegionMetropolitanaDAO; +import com.rjconsultores.ventaboletos.entidad.RegionMetropolitana; +import com.rjconsultores.ventaboletos.service.RegionMetropolitanaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("regionMetropolitanaService") +public class RegionMetropolitanaServiceImpl implements RegionMetropolitanaService { + + @Autowired + private RegionMetropolitanaDAO regionMetropolitanaDAO; + + @Override + public List obtenerTodos() { + return regionMetropolitanaDAO.obtenerTodos(); + } + + @Override + public RegionMetropolitana obtenerID(Long id) { + return regionMetropolitanaDAO.obtenerID(id); + } + + @Transactional + public RegionMetropolitana suscribir(RegionMetropolitana entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return regionMetropolitanaDAO.suscribir(entidad); + } + + @Transactional + public RegionMetropolitana actualizacion(RegionMetropolitana entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return regionMetropolitanaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RegionMetropolitana entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + regionMetropolitanaDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RelatorioAgepanServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RelatorioAgepanServiceImpl.java new file mode 100644 index 000000000..770fa6524 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RelatorioAgepanServiceImpl.java @@ -0,0 +1,243 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.apache.poi.hssf.usermodel.HSSFCell; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.EstadoDAO; +import com.rjconsultores.ventaboletos.dao.RelatorioAgepanDAO; +import com.rjconsultores.ventaboletos.enums.TipoDescontoBPe; +import com.rjconsultores.ventaboletos.enums.TipoIdentificacionDoc; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.RelatorioAgepanService; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; +import com.rjconsultores.ventaboletos.utilerias.TimeZoneUtil; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.OrgaoConcedente.RelatorioGratuidadeAgepanVO; + +@Service("relatorioAgepanService") +public class RelatorioAgepanServiceImpl implements RelatorioAgepanService { + + @Autowired + RelatorioAgepanDAO relatorioAgepanDAO; + + @Autowired + EstadoDAO estadoDAO; + + @Override + public List listar(Map parametros) throws BusinessException { + return relatorioAgepanDAO.listar(parametros); + } + + @Override + public InputStream gerarArquivoGratuidadeAgepan(Map parametros) throws IOException, BusinessException { + InputStream arquivo = null; + + List retorno = listar(parametros); + + arquivo = gerarArquivo(retorno); + + return arquivo; + } + + private InputStream gerarArquivo(List retorno) throws IOException { + HSSFWorkbook wb = new HSSFWorkbook(); + + criarArquivoExcel(wb, retorno); + + String nomeArquivo = UsuarioLogado.getUsuarioLogado().getNombusuario() + + "_" + Calendar.getInstance().getTime().getTime() + + "_" + "arquivoAgepan"; + + File fNomeArquivo = File.createTempFile(nomeArquivo, ".tmp"); + + FileOutputStream stream = new FileOutputStream(fNomeArquivo); + stream.flush(); + wb.write(stream); + stream.close(); + + InputStream is = new FileInputStream(fNomeArquivo); + + return is; + } + + private void criarArquivoExcel(HSSFWorkbook wb, List dados) { + HSSFSheet sheet = wb.createSheet("dados"); + int contRow = 0; + String[] cabecalho1 = new String[] {"nBP","dhEmi","xLocOrig","xLocDest","dhEmb","xNome","CPF","tpDoc","nDoc","xDoc","tpViagem","tpServico","dhViagem","prefixo","poltrona","vBP","vDesconto","tpDesconto","xDesconto","qrCodBPe"}; + String[] cabecalho2 = new String[] {"[9]","[13]","[85]","[87]","[88]","[91]","[92]","[93]","[94]","[95]","[102]","[103]","[106]","[108]","[109]","[115]","[116]","[119]","[120]","[189]"}; + criarRow(contRow++, sheet, cabecalho1); + criarRow(contRow++, sheet, cabecalho2); + + for (RelatorioGratuidadeAgepanVO vo : dados) { + String[] vetVO = transformarVOToVetor(vo); + criarRow(contRow++, sheet, vetVO); + } + + for (int i = 0; i < cabecalho1.length; i++) { + sheet.autoSizeColumn(i); + } + } + + private String[] transformarVOToVetor(RelatorioGratuidadeAgepanVO vo) { + Map dadosTimezoneParada = estadoDAO.getConfiguracoesFusoVeraoParada(vo.getOrigenId(), vo.getFechorventa()); + Map dadosTimezonePuntoventa = estadoDAO.getConfiguracoesFusoVeraoPuntoventa(vo.getPuntoventaId(), vo.getFechorventa()); + + List retorno = new ArrayList(); + + //"nBP", + retorno.add(vo.getNumBpe()); + + //"dhEmi", + String dataEmissao = TimeZoneUtil.ajustarPuntoVentaEmissaoOrigemViagemTimeZone(dadosTimezoneParada, dadosTimezonePuntoventa, vo.getFechorventa()); + retorno.add(dataEmissao); + + //"xLocOrig", + retorno.add(vo.getOrigem()); + + //"xLocDest", + retorno.add(vo.getDestino()); + + //"dhEmb", + String dhEmbarque = TimeZoneUtil.ajustarTimeZone(dadosTimezoneParada, vo.getFechorviaje()); + retorno.add(dhEmbarque); + + //"xNome", + retorno.add(StringUtils.isNotBlank(vo.getNombpasajero()) ? vo.getNombpasajero() : ""); + + //"CPF", + String cpf = carregarCpfBpe(vo.getDesctipodoc(), vo.getDesctipodoc2(), vo.getDescnumdoc(), vo.getDescnumdoc2()); + retorno.add(cpf); + + //"tpDoc", + String descTipoDoc = carregarDescTipoDoc(vo.getDesctipodoc(), vo.getDesctipodoc2()); + TipoIdentificacionDoc identificacionDoc = TipoIdentificacionDoc.getTipo(descTipoDoc); + String tpDoc = "5"; + if(identificacionDoc != null) { + if (identificacionDoc.equals(TipoIdentificacionDoc.RG)) { + tpDoc = "1"; + } else if (identificacionDoc.equals(TipoIdentificacionDoc.PASPT)) { + tpDoc = "3"; + } else if (identificacionDoc.equals(TipoIdentificacionDoc.CN)) { + tpDoc = "4"; + } + } + retorno.add(tpDoc); + + //"nDoc", + String nDoc = carregarNumDoc(vo.getDescnumdoc(), vo.getDescnumdoc2()); + retorno.add(nDoc); + + //"xDoc", + retorno.add(""); + + //"tpViagem", + retorno.add(vo.getCorridaextra()); + + //"tpServico", + retorno.add(vo.getTiposervicobpe()); + + //"dhViagem", + String dhViagem = TimeZoneUtil.ajustarTimeZone(dadosTimezoneParada, vo.getFechorviaje()); + retorno.add(dhViagem); + + //"prefixo", + retorno.add(vo.getPrefixo()); + + //"poltrona", + retorno.add(vo.getNumasiento()); + + //"vBP", + retorno.add(MoneyHelper.arredondar(vo.getTotalbase()).toString()); + + if(MoneyHelper.isMaior(vo.getDesconto(), BigDecimal.ZERO)) { + //"vDesconto", + retorno.add(MoneyHelper.arredondar(vo.getDesconto()).toString()); + + //"tpDesconto", + TipoDescontoBPe tipoDescontoBPe = null; + if(StringUtils.isNotBlank(vo.getDescontobpe())) { + tipoDescontoBPe = TipoDescontoBPe.valueOf(vo.getDescontobpe()); + } + if(tipoDescontoBPe == null) { + tipoDescontoBPe = TipoDescontoBPe.TARIFA_PROMOCIONAL; + } + retorno.add(tipoDescontoBPe.getValor()); + + //"xDesconto", + retorno.add(tipoDescontoBPe.getDescricao()); + + } else { + retorno.add(""); + retorno.add(""); + retorno.add(""); + } + + //"qrCodBPe" + retorno.add(vo.getChbpe()); + + return retorno.toArray(new String[retorno.size()]); + } + + private void criarRow(int numRow, HSSFSheet sheet, String[] dados) { + int numColumn = 0; + HSSFRow row = sheet.createRow(numRow); + for (String dado : dados) { + HSSFCell cell = row.createCell(numColumn++); + cell.setCellValue(dado); + } + } + + private String carregarCpfBpe(String desctipodoc, String desctipodoc2, String descnumdoc, String descnumdoc2) { + String cpfBpe = null; + TipoIdentificacionDoc identificacionDoc = TipoIdentificacionDoc.getTipo(desctipodoc); + if(identificacionDoc != null && (TipoIdentificacionDoc.CPF.equals(identificacionDoc) || TipoIdentificacionDoc.CNPJ.equals(identificacionDoc))) { + cpfBpe = descnumdoc; + } + identificacionDoc = TipoIdentificacionDoc.getTipo(desctipodoc2); + if(identificacionDoc != null && (TipoIdentificacionDoc.CPF.equals(identificacionDoc) || TipoIdentificacionDoc.CNPJ.equals(identificacionDoc))) { + cpfBpe = descnumdoc2; + } + cpfBpe = cpfBpe == null ? "" : cpfBpe.trim().replaceAll("\\D", ""); + + return cpfBpe; + } + + private String carregarNumDoc(String descnumdoc, String descnumdoc2) { + String lDescDoc = null; + if(StringUtils.isNotBlank(descnumdoc)){ + lDescDoc = descnumdoc; + } + if(StringUtils.isBlank(lDescDoc)){ + lDescDoc = descnumdoc2; + } + return lDescDoc == null ? "" : lDescDoc.trim().replaceAll("\\D", ""); + } + + private String carregarDescTipoDoc(String desctipodoc, String desctipodoc2) { + String lDescTipoDoc = null; + if(StringUtils.isNotBlank(desctipodoc)){ + lDescTipoDoc = desctipodoc; + } + if(StringUtils.isBlank(lDescTipoDoc)) { + lDescTipoDoc = desctipodoc2; + } + return lDescTipoDoc != null ? lDescTipoDoc.trim() : ""; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RequisicionBoletoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RequisicionBoletoServiceImpl.java new file mode 100644 index 000000000..0c2026e01 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RequisicionBoletoServiceImpl.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.RequisicionBoletoDAO; +import com.rjconsultores.ventaboletos.entidad.RequisicionBoleto; +import com.rjconsultores.ventaboletos.service.RequisicionBoletoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("requisicionBoletoService") +public class RequisicionBoletoServiceImpl implements RequisicionBoletoService { + + @Autowired + private RequisicionBoletoDAO requisicionBoletoDAO; + + @Override + public List obtenerTodos() { + return requisicionBoletoDAO.obtenerTodos(); + } + + @Override + public RequisicionBoleto obtenerID(Integer id) { + return requisicionBoletoDAO.obtenerID(id); + } + + @Transactional + public RequisicionBoleto suscribir(RequisicionBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return requisicionBoletoDAO.suscribir(entidad); + } + + @Transactional + public RequisicionBoleto actualizacion(RequisicionBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return requisicionBoletoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RequisicionBoleto entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + requisicionBoletoDAO.actualizacion(entidad); + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ReservaEspecialClienteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ReservaEspecialClienteServiceImpl.java new file mode 100644 index 000000000..f824d30f8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ReservaEspecialClienteServiceImpl.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ReservaEspecialClienteDAO; +import com.rjconsultores.ventaboletos.entidad.ReservaEspecialCliente; +import com.rjconsultores.ventaboletos.service.ReservaEspecialClienteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + + +/** + * @author valde + * + */ +@Service("reservaEspecialClienteService") +public class ReservaEspecialClienteServiceImpl implements ReservaEspecialClienteService { + + @Autowired + private ReservaEspecialClienteDAO reservaEspecialClienteDAO; + + public List obtenerTodos() { + return reservaEspecialClienteDAO.obtenerTodos(); + } + + public ReservaEspecialCliente obtenerID(Integer id) { + return reservaEspecialClienteDAO.obtenerID(id); + } + + @Transactional + public ReservaEspecialCliente suscribir(ReservaEspecialCliente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservaEspecialClienteDAO.suscribir(entidad); + } + + @Transactional + public ReservaEspecialCliente actualizacion(ReservaEspecialCliente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservaEspecialClienteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ReservaEspecialCliente entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + reservaEspecialClienteDAO.actualizacion(entidad); + } + + @Override + public List bucarReservaEspecialByClienteId(Long clienteId) { + return reservaEspecialClienteDAO.bucarReservaEspecialByClienteId(clienteId); + } + + @Override + public List bucarReservaEspecialByCorridaId(Long corridaId) { + return reservaEspecialClienteDAO.bucarReservaEspecialByCorridaId(corridaId); + } + + + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ReservacionCategoriaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ReservacionCategoriaServiceImpl.java new file mode 100644 index 000000000..5296f4538 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ReservacionCategoriaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ReservacionCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionCategoria; +import com.rjconsultores.ventaboletos.service.ReservacionCategoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("reservacionCategoriaService") +public class ReservacionCategoriaServiceImpl implements ReservacionCategoriaService { + + @Autowired + private ReservacionCategoriaDAO reservacionCategoriaDAO; + + public List obtenerTodos() { + return reservacionCategoriaDAO.obtenerTodos(); + } + + public ReservacionCategoria obtenerID(Integer id) { + return reservacionCategoriaDAO.obtenerID(id); + } + + @Transactional + public ReservacionCategoria suscribir(ReservacionCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionCategoriaDAO.suscribir(entidad); + } + + @Transactional + public ReservacionCategoria actualizacion(ReservacionCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionCategoriaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ReservacionCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + reservacionCategoriaDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ReservacionClaseServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ReservacionClaseServiceImpl.java new file mode 100644 index 000000000..c85adc937 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ReservacionClaseServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ReservacionClaseDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionClase; +import com.rjconsultores.ventaboletos.service.ReservacionClaseService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("reservacionClaseService") +public class ReservacionClaseServiceImpl implements ReservacionClaseService { + + @Autowired + private ReservacionClaseDAO reservacionClaseDAO; + + public List obtenerTodos() { + return reservacionClaseDAO.obtenerTodos(); + } + + public ReservacionClase obtenerID(Integer id) { + return reservacionClaseDAO.obtenerID(id); + } + + @Transactional + public ReservacionClase suscribir(ReservacionClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionClaseDAO.suscribir(entidad); + } + + @Transactional + public ReservacionClase actualizacion(ReservacionClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionClaseDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ReservacionClase entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + reservacionClaseDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ReservacionCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ReservacionCtrlServiceImpl.java new file mode 100644 index 000000000..3f032906d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ReservacionCtrlServiceImpl.java @@ -0,0 +1,101 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ReservacionCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionCategoria; +import com.rjconsultores.ventaboletos.entidad.ReservacionClase; +import com.rjconsultores.ventaboletos.entidad.ReservacionCtrl; +import com.rjconsultores.ventaboletos.entidad.ReservacionMarca; +import com.rjconsultores.ventaboletos.entidad.ReservacionMercado; +import com.rjconsultores.ventaboletos.entidad.ReservacionPuntoVenta; +import com.rjconsultores.ventaboletos.service.ReservacionCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("reservacionCtrlService") +public class ReservacionCtrlServiceImpl implements ReservacionCtrlService { + + @Autowired + private ReservacionCtrlDAO reservacionCtrlDAO; + + public List obtenerTodos() { + return reservacionCtrlDAO.obtenerTodos(); + } + + public ReservacionCtrl obtenerID(Integer id) { + return reservacionCtrlDAO.obtenerID(id); + } + + @Transactional + public ReservacionCtrl suscribir(ReservacionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionCtrlDAO.suscribir(entidad); + } + + @Transactional + public ReservacionCtrl actualizacion(ReservacionCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionCtrlDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ReservacionCtrl entidad) { + for (ReservacionCategoria reservacion : entidad.getReservacionCategoriaList()) { + reservacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + reservacion.setFecmodif(Calendar.getInstance().getTime()); + reservacion.setActivo(Boolean.FALSE); + } + for (ReservacionClase reservacion : entidad.getReservacionClaseList()) { + reservacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + reservacion.setFecmodif(Calendar.getInstance().getTime()); + reservacion.setActivo(Boolean.FALSE); + } + for (ReservacionMarca reservacion : entidad.getReservacionMarcaList()) { + reservacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + reservacion.setFecmodif(Calendar.getInstance().getTime()); + reservacion.setActivo(Boolean.FALSE); + } + for (ReservacionMercado reservacion : entidad.getReservacionMercadoList()) { + reservacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + reservacion.setFecmodif(Calendar.getInstance().getTime()); + reservacion.setActivo(Boolean.FALSE); + } + for (ReservacionPuntoVenta reservacion : entidad.getReservacionPuntoVentaList()) { + reservacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + reservacion.setFecmodif(Calendar.getInstance().getTime()); + reservacion.setActivo(Boolean.FALSE); + } + + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + reservacionCtrlDAO.actualizacion(entidad); + } + + public List buscar(ReservacionCtrl reservacionCtrl) { + return reservacionCtrlDAO.buscar(reservacionCtrl); + } + + public List buscarFechaTraslapa(ReservacionCtrl reservacionCtrl) { + return reservacionCtrlDAO.buscarFechaTraslapa(reservacionCtrl); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ReservacionMarcaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ReservacionMarcaServiceImpl.java new file mode 100644 index 000000000..a6fc1c718 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ReservacionMarcaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ReservacionMarcaDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionMarca; +import com.rjconsultores.ventaboletos.service.ReservacionMarcaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("reservacionMarcaService") +public class ReservacionMarcaServiceImpl implements ReservacionMarcaService { + + @Autowired + private ReservacionMarcaDAO reservacionMarcaDAO; + + public List obtenerTodos() { + return reservacionMarcaDAO.obtenerTodos(); + } + + public ReservacionMarca obtenerID(Integer id) { + return reservacionMarcaDAO.obtenerID(id); + } + + @Transactional + public ReservacionMarca suscribir(ReservacionMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionMarcaDAO.suscribir(entidad); + } + + @Transactional + public ReservacionMarca actualizacion(ReservacionMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionMarcaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ReservacionMarca entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + reservacionMarcaDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ReservacionMercadoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ReservacionMercadoServiceImpl.java new file mode 100644 index 000000000..fe51ac0fb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ReservacionMercadoServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ReservacionMercadoDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionMercado; +import com.rjconsultores.ventaboletos.service.ReservacionMercadoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("reservacionMercadoService") +public class ReservacionMercadoServiceImpl implements ReservacionMercadoService { + + @Autowired + private ReservacionMercadoDAO reservacionMercadoDAO; + + public List obtenerTodos() { + return reservacionMercadoDAO.obtenerTodos(); + } + + public ReservacionMercado obtenerID(Integer id) { + return reservacionMercadoDAO.obtenerID(id); + } + + @Transactional + public ReservacionMercado suscribir(ReservacionMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionMercadoDAO.suscribir(entidad); + } + + @Transactional + public ReservacionMercado actualizacion(ReservacionMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionMercadoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ReservacionMercado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + reservacionMercadoDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ReservacionPuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ReservacionPuntoVentaServiceImpl.java new file mode 100644 index 000000000..5ac669987 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ReservacionPuntoVentaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ReservacionPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.ReservacionPuntoVenta; +import com.rjconsultores.ventaboletos.service.ReservacionPuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("reservacionPuntoVentaService") +public class ReservacionPuntoVentaServiceImpl implements ReservacionPuntoVentaService { + + @Autowired + private ReservacionPuntoVentaDAO reservacionPuntoVentaDAO; + + public List obtenerTodos() { + return reservacionPuntoVentaDAO.obtenerTodos(); + } + + public ReservacionPuntoVenta obtenerID(Integer id) { + return reservacionPuntoVentaDAO.obtenerID(id); + } + + @Transactional + public ReservacionPuntoVenta suscribir(ReservacionPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionPuntoVentaDAO.suscribir(entidad); + } + + @Transactional + public ReservacionPuntoVenta actualizacion(ReservacionPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return reservacionPuntoVentaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ReservacionPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + reservacionPuntoVentaDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RestriccionPagoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RestriccionPagoServiceImpl.java new file mode 100644 index 000000000..a01d12877 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RestriccionPagoServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RestriccionPagoDAO; +import com.rjconsultores.ventaboletos.entidad.ConfigRestriccionPago; +import com.rjconsultores.ventaboletos.entidad.RestriccionPago; +import com.rjconsultores.ventaboletos.service.RestriccionPagoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("restriccionService") +public class RestriccionPagoServiceImpl implements RestriccionPagoService { + + @Autowired + private RestriccionPagoDAO restriccionDAO; + + public List obtenerTodos() { + return restriccionDAO.obtenerTodos(); + } + + public RestriccionPago obtenerID(Short id) { + return restriccionDAO.obtenerID(id); + } + + @Transactional + public RestriccionPago suscribir(RestriccionPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return restriccionDAO.suscribir(entidad); + } + + @Transactional + public RestriccionPago actualizacion(RestriccionPago entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return restriccionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RestriccionPago entidad) { + for (ConfigRestriccionPago crp : entidad.getConfigRestriccionPagoList()) { + crp.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + crp.setFecmodif(Calendar.getInstance().getTime()); + crp.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + restriccionDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RhPagoConductorServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RhPagoConductorServiceImpl.java new file mode 100644 index 000000000..cbb6eb51b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RhPagoConductorServiceImpl.java @@ -0,0 +1,51 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RhPagoConductorDAO; +import com.rjconsultores.ventaboletos.entidad.RhPagoConductor; +import com.rjconsultores.ventaboletos.service.RhPagoConductorService; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("rhPagoConductorService") +public class RhPagoConductorServiceImpl implements RhPagoConductorService { + + @Autowired + private RhPagoConductorDAO restriccionDAO; + + public List obtenerTodos() { + return restriccionDAO.obtenerTodos(); + } + + public RhPagoConductor obtenerID(Integer id) { + return restriccionDAO.obtenerID(id); + } + + @Transactional + public RhPagoConductor suscribir(RhPagoConductor entidad) { + + + return restriccionDAO.suscribir(entidad); + } + + @Transactional + public RhPagoConductor actualizacion(RhPagoConductor entidad) { + + + return restriccionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RhPagoConductor entidad) { + restriccionDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RolOperativoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RolOperativoServiceImpl.java new file mode 100644 index 000000000..d055d2f74 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RolOperativoServiceImpl.java @@ -0,0 +1,81 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.dao.RolOperativoDAO; +import com.rjconsultores.ventaboletos.entidad.DiagramaAutobus; +import com.rjconsultores.ventaboletos.entidad.RolOperativo; +import com.rjconsultores.ventaboletos.service.RolOperativoService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("rolOperativoService") +public class RolOperativoServiceImpl implements RolOperativoService { + + @Autowired + private RolOperativoDAO rolOperativoDAO; + @Autowired + private EsquemaCorridaDAO esquemaCorridaDAO; + + public List obtenerTodos() { + return rolOperativoDAO.obtenerTodos(); + } + + public RolOperativo obtenerID(Integer id) { + return rolOperativoDAO.obtenerID(id); + } + + @Transactional + public RolOperativo suscribir(RolOperativo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rolOperativoDAO.suscribir(entidad); + } + + @Transactional + public RolOperativo actualizacion(RolOperativo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rolOperativoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RolOperativo entidad) throws RegistroConDependenciaException { + if (esquemaCorridaDAO.count("rolOperativo", entidad) > 0l) { + throw new RegistroConDependenciaException(); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + rolOperativoDAO.actualizacion(entidad); + } + + public List pesquisar(DiagramaAutobus diagrama, String rol) { + + return rolOperativoDAO.pesquisar(diagrama, rol); + } + + public List buscar(String descroloperativo) { + return rolOperativoDAO.buscar(descroloperativo); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RutaCasetaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RutaCasetaServiceImpl.java new file mode 100644 index 000000000..dbe2037f2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RutaCasetaServiceImpl.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.RutaCasetaDAO; +import com.rjconsultores.ventaboletos.entidad.RutaCaseta; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.RutaCasetaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("rutaCasetaService") +public class RutaCasetaServiceImpl implements RutaCasetaService{ + + @Autowired + private RutaCasetaDAO rutaCasetaDAO; + + @Transactional(rollbackFor = BusinessException.class) + public RutaCaseta suscribir(RutaCaseta entidad) throws BusinessException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + entidad = rutaCasetaDAO.suscribir(entidad); + + return entidad; + } + + @Transactional(rollbackFor = BusinessException.class) + public void deletarRutaCasetasFromRutaSecuenciaId(Integer id) throws BusinessException { + rutaCasetaDAO.deletarRutaCasetasFromRutaSecuenciaId(id); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RutaCombinacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RutaCombinacionServiceImpl.java new file mode 100644 index 000000000..dcec2d8f9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RutaCombinacionServiceImpl.java @@ -0,0 +1,462 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RutaCombinacionDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.service.RutaCombinacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaGroupVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaEscalaVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaOficialEscalaGroupVO; +import com.rjconsultores.ventaboletos.vo.tarifa.TarifaOficialEscalaVO; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import java.util.Set; + +import org.apache.log4j.Logger; +import org.apache.poi.hssf.usermodel.HSSFCellStyle; +import org.apache.poi.hssf.usermodel.HSSFFont; +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.zkoss.util.resource.Labels; + +/** + * + * @author Rafius + */ +@Service("rutaCombinacionaService") +public class RutaCombinacionServiceImpl implements RutaCombinacionService { + + @Autowired + private RutaCombinacionDAO rutaCombinacionDAO; + private static Logger log = Logger.getLogger(RutaCombinacionServiceImpl.class); + private int NUM_LINHA_INICIO = 8; + + public List obtenerTodos() { + return rutaCombinacionDAO.obtenerTodos(); + } + + public RutaCombinacion obtenerID(Integer id) { + return rutaCombinacionDAO.obtenerID(id); + } + + @Transactional + public RutaCombinacion suscribir(RutaCombinacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rutaCombinacionDAO.suscribir(entidad); + } + + @Transactional + public RutaCombinacion actualizacion(RutaCombinacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rutaCombinacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RutaCombinacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + rutaCombinacionDAO.actualizacion(entidad); + } + + public boolean busquedaRutaTramo(Ruta ruta, Tramo tramo, Boolean ativo) { + return rutaCombinacionDAO.busquedaRutaTramo(ruta, tramo, ativo); + } + + public RutaCombinacion busquedaTramoRutaTramo(Ruta ruta, Tramo trBuscaOrigemDestino) { + return rutaCombinacionDAO.busquedaTramoRutaTramo(ruta, trBuscaOrigemDestino); + } + + public void ativar(RutaCombinacion rcExiste) { + rcExiste.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rcExiste.setFecmodif(Calendar.getInstance().getTime()); + rcExiste.setActivo(Boolean.TRUE); + + rutaCombinacionDAO.actualizacion(rcExiste); + } + + public Tramo busqueda(Ruta ruta, Parada origen, Parada destino) { + return rutaCombinacionDAO.busqueda(ruta, origen, destino); + } + + public RutaCombinacion busquedaTramoRutaOrigemDestino(Ruta ruta, Parada origem, Parada destino) { + return rutaCombinacionDAO.busquedaTramoRutaOrigemDestino(ruta, origem, destino); + } + + public RutaCombinacion busquedaTramoRutaOrigemDestino(Integer ruta, Integer origemId, Integer destinoId) { + return rutaCombinacionDAO.busquedaTramoRutaOrigemDestino(ruta, origemId, destinoId); + } + + public List obtenerPorRuta(Ruta ruta) { + return rutaCombinacionDAO.obtenerPorRuta(ruta); + } + + public boolean buscarRutaCombinacionExisteTramo(Tramo tramo) { + return rutaCombinacionDAO.buscarRutaCombinacionExisteTramo(tramo); + } + + public int borrarCombinaciones(Ruta ruta) { + return rutaCombinacionDAO.borrarCombinaciones(ruta); + } + + @Transactional + public void activar(Ruta ruta, Tramo trBuscaOrigemDestino) { + rutaCombinacionDAO.activar(ruta, trBuscaOrigemDestino); + } + + public HSSFWorkbook gerarTarifaEscala(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, List lsAddRmvCategoria, List lsAddRmvEmpresas, List lsAddRmvRutas, List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa) { + + HSSFWorkbook wb = new HSSFWorkbook(); + // fonte em negrito: + HSSFFont fonte = wb.createFont(); + fonte.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + HSSFCellStyle estilo = wb.createCellStyle(); + estilo.setFont(fonte); + + //Bucando todas as Linhas com Clase Marca e Moeda Separadamente + List lsLinhasAgrupadas = rutaCombinacionDAO.pesquisaTarifaGroupObj(lsAddRmvMonedas, lsAddRmvMarcas, lsAddRmvClaseServico, + lsAddRmvCategoria, lsAddRmvEmpresas, lsAddRmvRutas, lsAddRmvTipoPuntoVenta, lsAddRmvVigenciaTarifa); + + + HSSFSheet sheet1 = null; + + int linha = NUM_LINHA_INICIO; + int linhaAnterior = NUM_LINHA_INICIO; + int coluna = 0; + int numAba = 1; + + Object[] rows = new Object[10000]; + + TarifaEscalaVO tarAnterior = null; + for (TarifaEscalaGroupVO teg : lsLinhasAgrupadas) { + try { + + String descRuta = teg.getDESCRUTA(); + Integer rutaId = teg.getRUTA_ID().intValue(); + + //Buscando preços especificos de uma Linha + List lsTarifaEscala = rutaCombinacionDAO.pesquisaTarifaEscalaObj(rutaId.toString(), teg.getMONEDA_ID().toString(), + teg.getVIGENCIATARIFA_ID().toString(), teg.getMARCA_ID().toString()); + //Nome da Aba + String sheetName = ""; + //Se o nome da ruta for muito grande, tem que cortar para caber no noma da aba com seu ID + if (descRuta.toString().length() > 22) { + sheetName = numAba + " ".concat(descRuta.substring(0, 22).concat(" (").concat(rutaId.toString()).concat(")")); + } else { + sheetName = numAba + " ".concat(descRuta.concat(" (").concat(rutaId.toString()).concat(")")); + } + + numAba = numAba + 1; + sheet1 = wb.createSheet(sheetName); + SimpleDateFormat sf = new SimpleDateFormat("dd/MM/yyyy HH:mm"); + + //Montando o Cabeçalho + HSSFRow r0 = sheet1.createRow(0); + r0.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhFeciniciovigencia.label")); + r0.createCell(1).setCellValue(sf.format(teg.getFECINICIOVIGENCIA()) + " - " + sf.format(teg.getFECFINVIGENCIA())); + + HSSFRow r1 = sheet1.createRow(1); + r1.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhMoneda.label")); + r1.createCell(1).setCellValue(teg.getDESCMONEDA().toUpperCase()); + + HSSFRow r2 = sheet1.createRow(2); + r2.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhMarca.label")); + r2.createCell(1).setCellValue(teg.getDESCMARCA().toUpperCase()); + + HSSFRow r3 = sheet1.createRow(3); + r3.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhClaseServicio.label")); + r3.createCell(1).setCellValue(teg.getDESCCLASE().toUpperCase()); + + HSSFRow r4 = sheet1.createRow(4); + r4.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhRuta.label")); + r4.createCell(1).setCellValue(descRuta.toUpperCase()); + + for (TarifaEscalaVO tar : lsTarifaEscala) { + //Primeira Execucao + //Crias as Linhas + //Coloca o preço do primeiro registro + if (linha == NUM_LINHA_INICIO) { + for (int i = NUM_LINHA_INICIO; i <= lsTarifaEscala.size() + NUM_LINHA_INICIO; i++) { + HSSFRow row = sheet1.createRow(i); + rows[i] = row; + } + + HSSFRow rowOrigem = (HSSFRow) rows[linha]; + //Nome e Descrição + rowOrigem.createCell(coluna).setCellValue(tar.getCVEORIGEM()); + rowOrigem.createCell(coluna + 1).setCellValue(tar.getDESCORIGEM()); + rows[linha] = rowOrigem; + + HSSFRow rowPrimeiroPrecio = (HSSFRow) rows[linha + 1]; + rowPrimeiroPrecio.createCell(coluna).setCellValue(tar.getPRECIO().setScale(2).doubleValue()); + rows[linha + 1] = rowPrimeiroPrecio; + + linha = linha + 1; + tarAnterior = tar; + continue; + } + + //Si mesma origen, se coloca somente o precio + if (tar.getCVEORIGEM().equals(tarAnterior.getCVEORIGEM())) { + HSSFRow rowTarifa = (HSSFRow) rows[linha + 1]; + if (tar.getPRECIO() != null) { + rowTarifa.createCell(coluna).setCellValue(tar.getPRECIO().setScale(2).doubleValue()); + } + rows[linha + 1] = rowTarifa; + + linha = linha + 1; + } else { + + //Se nao mostra proxima Localidade + Preço na linha + linhaAnterior = linhaAnterior + 1; + linha = linhaAnterior; + coluna = coluna + 1; + + HSSFRow rowOrigem = (HSSFRow) rows[linha]; + rowOrigem.createCell(coluna).setCellValue(tar.getCVEORIGEM()); + rowOrigem.createCell(coluna + 1).setCellValue(tar.getDESCORIGEM()); + rows[linha] = rowOrigem; + + HSSFRow rowOrigemPrecio = (HSSFRow) rows[linha + 1]; + rowOrigemPrecio.createCell(coluna).setCellValue(tar.getPRECIO().setScale(2).doubleValue()); + rows[linha + 1] = rowOrigemPrecio; + + linha = linha + 1; + } + tarAnterior = tar; + } + //Ultima Execucao Coloca o Destino Final + HSSFRow rowOrigem = (HSSFRow) rows[linha]; + rowOrigem.createCell(coluna + 1).setCellValue(tarAnterior.getCVEDESTINO()); + rowOrigem.createCell(coluna + 2).setCellValue(tarAnterior.getDESCDESTINO()); + rows[linha] = rowOrigem; + linha = NUM_LINHA_INICIO; + linhaAnterior = NUM_LINHA_INICIO; + coluna = 0; + } catch (Exception ex) { + log.error("Exportação Excel Escala: ", ex); + } + } + + return wb; + } + + public HSSFWorkbook gerarTarifaOficialEscala(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, ArrayList arrayList, List lsAddRmvEmpresas, List lsAddRmvRutas, ArrayList arrayList0, List lsAddRmvVigenciaTarifa) { + + HSSFWorkbook wb = new HSSFWorkbook(); + // fonte em negrito: + HSSFFont fonte = wb.createFont(); + fonte.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); + HSSFCellStyle estilo = wb.createCellStyle(); + estilo.setFont(fonte); + + //Bucando todas as Linhas com Clase Marca e Moeda Separadamente + List lsLinhasAgrupadas = rutaCombinacionDAO.pesquisaTarifaOficialGroupObj(lsAddRmvMonedas, lsAddRmvMarcas, lsAddRmvClaseServico, + lsAddRmvEmpresas, lsAddRmvRutas, lsAddRmvVigenciaTarifa); + + if(lsLinhasAgrupadas == null || lsLinhasAgrupadas.isEmpty()){ + return null; + } + + HSSFSheet sheet1 = null; + + int linha = NUM_LINHA_INICIO; + int linhaAnterior = NUM_LINHA_INICIO; + int coluna = 0; + int numAba = 1; + + Object[] rows = new Object[10000]; + + TarifaOficialEscalaVO tarAnterior = null; + for (TarifaOficialEscalaGroupVO teg : lsLinhasAgrupadas) { + try { + + String descRuta = teg.getDESCRUTA(); + Integer rutaId = teg.getRUTA_ID().intValue(); + + //Buscando preços especificos de uma Linha + List lsTarifaEscala = rutaCombinacionDAO.pesquisaTarifaOficialEscalaObj(rutaId.toString(), teg.getMONEDA_ID().toString(), + null, teg.getMARCA_ID().toString()); + //Nome da Aba + String sheetName = ""; + //Se o nome da ruta for muito grande, tem que cortar para caber no noma da aba com seu ID + if (descRuta.toString().length() > 22) { + sheetName = numAba + " ".concat(descRuta.substring(0, 22).concat(" (").concat(rutaId.toString()).concat(")")); + } else { + sheetName = numAba + " ".concat(descRuta.concat(" (").concat(rutaId.toString()).concat(")")); + } + + numAba = numAba + 1; + sheet1 = wb.createSheet(sheetName); + HSSFRow r1 = sheet1.createRow(1); + r1.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhMoneda.label")); + r1.createCell(1).setCellValue(teg.getDESCMONEDA().toUpperCase()); + + HSSFRow r2 = sheet1.createRow(2); + r2.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhMarca.label")); + r2.createCell(1).setCellValue(teg.getDESCMARCA().toUpperCase()); + + HSSFRow r3 = sheet1.createRow(3); + r3.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhClaseServicio.label")); + r3.createCell(1).setCellValue(teg.getDESCCLASE().toUpperCase()); + + HSSFRow r4 = sheet1.createRow(4); + r4.createCell(0).setCellValue(Labels.getLabel("tarifaEscalaContorller.lhRuta.label")); + r4.createCell(1).setCellValue(descRuta.toUpperCase()); + + HSSFRow r6 = sheet1.createRow(6); + r6.createCell(0).setCellValue("Preço - Taxa - Seguro - Pedagio - Outros"); + + + for (TarifaOficialEscalaVO tar : lsTarifaEscala) { + //Primeira Execucao + //Crias as Linhas + //Coloca o preço do primeiro registro + if (linha == NUM_LINHA_INICIO) { + for (int i = NUM_LINHA_INICIO; i <= lsTarifaEscala.size() + NUM_LINHA_INICIO; i++) { + HSSFRow row = sheet1.createRow(i); + rows[i] = row; + } + + HSSFRow rowOrigem = (HSSFRow) rows[linha]; + //Nome e Descrição + rowOrigem.createCell(coluna).setCellValue(tar.getCVEORIGEM()); + rowOrigem.createCell(coluna + 1).setCellValue(tar.getDESCORIGEM()); + rows[linha] = rowOrigem; + + HSSFRow rowPrimeiroPrecio = (HSSFRow) rows[linha + 1]; + BigDecimal taxa = tar.getTAXAEMBARQUE(); + BigDecimal segu = tar.getSEGURO(); + BigDecimal outros = tar.getOUTROS(); + BigDecimal pedagio = tar.getPEDAGIO(); + rowPrimeiroPrecio.createCell(coluna).setCellValue(tar.getPRECIO().setScale(2).doubleValue() + " \n" + + (taxa == null ? " 0 " : taxa.setScale(2).doubleValue()) + " \n" + + (segu == null ? " 0 " : segu.setScale(2).doubleValue()) + " \n" + + (pedagio == null ? " 0 " : pedagio.setScale(2).doubleValue()) + " \n" + + (outros == null ? " 0 " : outros.setScale(2).doubleValue())); + rows[linha + 1] = rowPrimeiroPrecio; + + linha = linha + 1; + tarAnterior = tar; + continue; + } + + //Si mesma origen, se coloca somente o precio + if (tar.getCVEORIGEM().equals(tarAnterior.getCVEORIGEM())) { + HSSFRow rowTarifa = (HSSFRow) rows[linha + 1]; + if (tar.getPRECIO() != null) { + rowTarifa.createCell(coluna).setCellValue(tar.getPRECIO().setScale(2).doubleValue()); + } + rows[linha + 1] = rowTarifa; + + linha = linha + 1; + } else { + + //Se nao mostra proxima Localidade + Preço na linha + linhaAnterior = linhaAnterior + 1; + linha = linhaAnterior; + coluna = coluna + 1; + + HSSFRow rowOrigem = (HSSFRow) rows[linha]; + rowOrigem.createCell(coluna).setCellValue(tar.getCVEORIGEM()); + rowOrigem.createCell(coluna + 1).setCellValue(tar.getDESCORIGEM()); + rows[linha] = rowOrigem; + + HSSFRow rowOrigemPrecio = (HSSFRow) rows[linha + 1]; + BigDecimal taxa = tar.getTAXAEMBARQUE(); + BigDecimal segu = tar.getSEGURO(); + BigDecimal pedagio = tar.getPEDAGIO(); + BigDecimal outros = tar.getOUTROS(); + rowOrigemPrecio.createCell(coluna).setCellValue(tar.getPRECIO().setScale(2).doubleValue() + " \n" + + (taxa == null ? " 0 " : taxa.setScale(2).doubleValue()) + " \n" + + (segu == null ? " 0 " : segu.setScale(2).doubleValue()) + " \n" + + (pedagio == null ? " 0 " : pedagio.setScale(2).doubleValue()) + " \n" + + (outros == null ? " 0 " : outros.setScale(2).doubleValue())); + rows[linha + 1] = rowOrigemPrecio; + + linha = linha + 1; + } + tarAnterior = tar; + } + //Ultima Execucao Coloca o Destino Final + HSSFRow rowOrigem = (HSSFRow) rows[linha]; + rowOrigem.createCell(coluna + 1).setCellValue(tarAnterior.getCVEDESTINO()); + rowOrigem.createCell(coluna + 2).setCellValue(tarAnterior.getDESCDESTINO()); + rows[linha] = rowOrigem; + linha = NUM_LINHA_INICIO; + linhaAnterior = NUM_LINHA_INICIO; + coluna = 0; + } catch (Exception ex) { + log.error("Exportação Excel Escala: ", ex); + } + } + + return wb; + } + + public List pesquisaTarifaObj(List lsAddRmvMonedas, List lsAddRmvMarcas, + List lsAddRmvClaseServico, List lsAddRmvCategoria, + List lsAddRmvEmpresas, List lsAddRmvRutas, + List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa, List lsAddRmvOrgaoConcedente) { + return rutaCombinacionDAO.pesquisaTarifaObj(lsAddRmvMonedas, lsAddRmvMarcas, lsAddRmvClaseServico, + lsAddRmvCategoria, lsAddRmvEmpresas, lsAddRmvRutas, lsAddRmvTipoPuntoVenta, lsAddRmvVigenciaTarifa, lsAddRmvOrgaoConcedente); + } + + public List pesquisaTarifaEmbObj(List lsAddRmvMonedas, List lsAddRmvMarcas, + List lsAddRmvClaseServico, List lsAddRmvCategoria, + List lsAddRmvEmpresas, List lsAddRmvRutas, + List lsAddRmvTipoPuntoVenta, List lsAddRmvVigenciaTarifa, List lsAddRmvOrgaoConcedente) { + return rutaCombinacionDAO.pesquisaTarifaEmbObj(lsAddRmvMonedas, lsAddRmvMarcas, lsAddRmvClaseServico, + lsAddRmvCategoria, lsAddRmvEmpresas, lsAddRmvRutas, lsAddRmvTipoPuntoVenta, lsAddRmvVigenciaTarifa, lsAddRmvOrgaoConcedente); + } + + public List pesquisaTarifaOficialObj(List lsAddRmvMonedas, List lsAddRmvMarcas, List lsAddRmvClaseServico, ArrayList arrayList, List lsAddRmvEmpresas, List lsAddRmvRutas, ArrayList arrayList0, List lsAddRmvVigenciaTarifa) { + return rutaCombinacionDAO.pesquisaTarifaOficialObj(lsAddRmvMonedas, lsAddRmvMarcas, lsAddRmvClaseServico, + lsAddRmvEmpresas, lsAddRmvRutas, lsAddRmvVigenciaTarifa); + } + + @Override + public boolean existeTramo(Tramo tramo) { + return rutaCombinacionDAO.existeTramo(tramo); + } + + @Override + public boolean isRutaCombinacionVenda(Integer rutaId, Integer origenId, Integer destinoId) { + return rutaCombinacionDAO.isRutaCombinacionVenda(rutaId, origenId, destinoId); + } + + @Override + public Set rutasCombinacionVenda(List rutas) { + return rutaCombinacionDAO.rutasCombinacionVenda(rutas); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RutaEmbarqueDesembarqueServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RutaEmbarqueDesembarqueServiceImpl.java new file mode 100644 index 000000000..6f53d1ce7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RutaEmbarqueDesembarqueServiceImpl.java @@ -0,0 +1,54 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.RutaEmbarqueDesembarqueDAO; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaEmbarqueDesembarque; +import com.rjconsultores.ventaboletos.service.RutaEmbarqueDesembarqueService; + +@Service("rutaEmbarqueDesembarqueService") +public class RutaEmbarqueDesembarqueServiceImpl implements RutaEmbarqueDesembarqueService { + + @Autowired + private RutaEmbarqueDesembarqueDAO rutaEmbarqueDesembarqueDAO; + + @Override + public List obtenerTodos() { + return rutaEmbarqueDesembarqueDAO.obtenerTodos(); + } + + @Override + public RutaEmbarqueDesembarque obtenerID(Integer id) { + return rutaEmbarqueDesembarqueDAO.obtenerID(id); + } + + @Transactional + @Override + public RutaEmbarqueDesembarque suscribir(RutaEmbarqueDesembarque entidad) { + return rutaEmbarqueDesembarqueDAO.suscribir(entidad); + } + + @Transactional + @Override + public RutaEmbarqueDesembarque actualizacion(RutaEmbarqueDesembarque entidad) { + return rutaEmbarqueDesembarqueDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(RutaEmbarqueDesembarque entidad) { + rutaEmbarqueDesembarqueDAO.borrar(entidad); + } + + @Override + public List obtenerPorRuta(Ruta ruta) { + return rutaEmbarqueDesembarqueDAO.obtenerPorRuta(ruta); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RutaEmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RutaEmpresaServiceImpl.java new file mode 100644 index 000000000..b14008a61 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RutaEmpresaServiceImpl.java @@ -0,0 +1,76 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RutaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; +import com.rjconsultores.ventaboletos.service.RutaEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("rutaEmpresaService") +public class RutaEmpresaServiceImpl implements RutaEmpresaService { + + @Autowired + private RutaEmpresaDAO rutaEmpresaDAO; + + public List obtenerTodos() { + return rutaEmpresaDAO.obtenerTodos(); + } + + public RutaEmpresa obtenerID(Integer id) { + return rutaEmpresaDAO.obtenerID(id); + } + + @Transactional + public RutaEmpresa suscribir(RutaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rutaEmpresaDAO.suscribir(entidad); + } + + @Transactional + public RutaEmpresa actualizacion(RutaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rutaEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RutaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + rutaEmpresaDAO.actualizacion(entidad); + } + + @Override + public List obtenerPorEmpresa(Empresa empresa) { + return rutaEmpresaDAO.obtenerPorEmpresa(empresa); + } + + @Override + public List obtenerPorRuta(Ruta ruta) { + return rutaEmpresaDAO.obtenerPorRuta(ruta); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RutaIcmsExcepcionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RutaIcmsExcepcionServiceImpl.java new file mode 100644 index 000000000..07b7ae032 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RutaIcmsExcepcionServiceImpl.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.RutaIcmsExcepcionDAO; +import com.rjconsultores.ventaboletos.entidad.RutaIcmsExcepcion; +import com.rjconsultores.ventaboletos.service.RutaIcmsExcepcionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("rutaIcmsExcepcionService") +public class RutaIcmsExcepcionServiceImpl implements RutaIcmsExcepcionService { + + @Autowired + private RutaIcmsExcepcionDAO rutaIcmsExcepcionDAO; + + @Override + public List obtenerTodos() { + return rutaIcmsExcepcionDAO.obtenerTodos(); + } + + @Override + public RutaIcmsExcepcion obtenerID(Integer id) { + return rutaIcmsExcepcionDAO.obtenerID(id); + } + + @Override + @Transactional + public RutaIcmsExcepcion suscribir(RutaIcmsExcepcion entidad) { + entidad.setActivo(Boolean.TRUE); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return rutaIcmsExcepcionDAO.suscribir(entidad); + } + + @Override + @Transactional + public RutaIcmsExcepcion actualizacion(RutaIcmsExcepcion entidad) { + entidad.setActivo(Boolean.TRUE); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return rutaIcmsExcepcionDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(RutaIcmsExcepcion entidad) { + entidad.setActivo(Boolean.FALSE); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rutaIcmsExcepcionDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RutaSecuenciaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RutaSecuenciaServiceImpl.java new file mode 100644 index 000000000..eefc6aaba --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RutaSecuenciaServiceImpl.java @@ -0,0 +1,86 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.RutaSecuenciaDAO; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import com.rjconsultores.ventaboletos.service.RutaSecuenciaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("rutaSecuenciaService") +public class RutaSecuenciaServiceImpl implements RutaSecuenciaService { + + @Autowired + private RutaSecuenciaDAO rutaSecuenciaDAO; + + public List obtenerTodos() { + return rutaSecuenciaDAO.obtenerTodos(); + } + + public RutaSecuencia obtenerID(Integer id) { + return rutaSecuenciaDAO.obtenerID(id); + } + + @Transactional + public RutaSecuencia suscribir(RutaSecuencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rutaSecuenciaDAO.suscribir(entidad); + } + + @Transactional + public RutaSecuencia actualizacion(RutaSecuencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return rutaSecuenciaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(RutaSecuencia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + rutaSecuenciaDAO.actualizacion(entidad); + } + + public List buscarSecuenciaOrdenado(Ruta ruta) { + return rutaSecuenciaDAO.buscarSecuenciaOrdenado(ruta); + } + public int borrarSecuencias(Ruta ruta) { + return rutaSecuenciaDAO.borrarSecuencias(ruta); + } + + @Override + public List obtenerNumRutaSecuenciaPorCorridaOrigemDestino(EsquemaCorrida esquemaCorrida, Parada origem, Parada destino) { + return rutaSecuenciaDAO.obtenerNumRutaSecuenciaPorCorridaOrigemDestino(esquemaCorrida, origem, destino); + } + + @Override + public List obtenerNumRutaSecuenciaOcupadaPorCorridaAsiento(EsquemaCorrida esquemaCorrida, String asiento) { + return rutaSecuenciaDAO.obtenerNumRutaSecuenciaOcupadaPorCorridaAsiento(esquemaCorrida, asiento); + } + + @Override + public List obtenerNumRutaSecuenciaPorCorridaOrigemDestinoId(EsquemaCorrida esquemaCorrida, Integer origem, Integer destino){ + return rutaSecuenciaDAO.obtenerNumRutaSecuenciaPorCorridaOrigemDestinoId(esquemaCorrida, origem, destino); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java new file mode 100644 index 000000000..57bd3e17a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java @@ -0,0 +1,634 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.CorridaDAO; +import com.rjconsultores.ventaboletos.dao.EsquemaCorridaDAO; +import com.rjconsultores.ventaboletos.dao.RutaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia; +import com.rjconsultores.ventaboletos.entidad.ParadaSecuenciaCombinacaoLinha; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCaseta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.ParadaService; +import com.rjconsultores.ventaboletos.service.RutaCombinacionService; +import com.rjconsultores.ventaboletos.service.RutaSecuenciaService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.service.TramoRutaService; +import com.rjconsultores.ventaboletos.service.TramoService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.ruta.RutaVO; + +/** + * + * @author Rafius + */ +@Service("rutaService") +public class RutaServiceImpl implements RutaService { + + @Autowired + private RutaDAO rutaDAO; + @Autowired + private TramoService tramoService; + @Autowired + private RutaCombinacionService rutaCombinacionService; + @Autowired + private RutaSecuenciaService rutaSecuenciaService; + @Autowired + private CorridaDAO corridaDAO; + @Autowired + private EsquemaCorridaDAO esquemaCorridaDAO; + @Autowired + private ParadaService paradaService; + @Autowired + private TramoRutaService tramoRutaService; + + private static Logger log = Logger.getLogger(RutaServiceImpl.class); + + public List obtenerTodos() { + return rutaDAO.obtenerTodos(); + } + + public Ruta obtenerID(Integer id) { + return rutaDAO.obtenerID(id); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public Parada validaParada(String descripcionParada, Parada paradaAntiga) throws Exception { + + String cve = extrairCodigoOuLocalidade(descripcionParada, true, false); + String descparada = extrairCodigoOuLocalidade(descripcionParada, false, true); + + if (cve == null || descparada == null) + throw new BusinessException("editarCatalogoDeRutaController.actionCanbiarParada.businessException"); + try { + List paradas = paradaService.buscarCVE(cve); + paradas.addAll(paradaService.buscar(descparada)); + if (!paradas.isEmpty()) { + return paradas.iterator().next(); + } else { + return null; + } + } catch (Exception e) { + throw e; + } + } + + private String extrairCodigoOuLocalidade(String descripcionParada, boolean isCodigo, boolean isLocalidade) throws Exception { + try { + String arraySplit[] = new String[2]; + arraySplit = descripcionParada.split(" - "); + if (isCodigo) + return arraySplit[0]; + if (isLocalidade) + return arraySplit[1]; + } catch (Exception e) { + throw new BusinessException("editarCatalogoDeRutaController.actionCanbiarParada.businessException"); + } + return null; + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public boolean cambiarParadaRuta(Ruta ruta, Parada paradaAntiga, Parada nuevaParada, String descripcionParada) throws Exception { + + try { + String cve = extrairCodigoOuLocalidade(descripcionParada, true, false); + String descparada = extrairCodigoOuLocalidade(descripcionParada, false, true); + + if (nuevaParada == null) { + nuevaParada = crearNuevaParada(paradaAntiga, cve, descparada); + paradaService.suscribirActualizar(nuevaParada); + } + + List tramos = validaTramosRuta(ruta); + List cambios = new ArrayList(); + for (Tramo tramo : tramos) { + Tramo nTramo = crearNuevoTramo(tramo, paradaAntiga, nuevaParada); + if (nTramo != null) { + cambios.add(new CambioRutaTramo(tramo, nTramo, paradaAntiga, nuevaParada)); + tramoService.suscribirActualizar(nTramo); + } + } + + for (CambioRutaTramo crt : cambios) { + rutaDAO.updateAsientosVendibles(ruta, crt.getViejoTramo(), crt.getNuevoTramo()); + } + + return true; + + } catch (Exception e) { + throw e; + } + } + + private List validaTramosRuta(Ruta ruta) { + + List tramosRuta = new ArrayList(); + + for (RutaCombinacion rc : ruta.getRutaCombinacionList()) { + if (!tramosRuta.contains(rc.getTramo())) + tramosRuta.add(rc.getTramo()); + } + + for (RutaSecuencia rs : ruta.getRutaSecuenciaList()) { + if (!tramosRuta.contains(rs.getTramo())) + tramosRuta.add(rs.getTramo()); + } + + return tramosRuta; + } + + private Tramo crearNuevoTramo(Tramo tramo, Parada viejaParada, Parada nuevaParada) { + + Tramo viejoTramo = tramoService.obtenerID(tramo.getTramoId()); + if (viejoTramo.getOrigem().equals(viejaParada) || viejoTramo.getDestino().equals(viejaParada)) { + + Tramo ptramo = null; + if (viejoTramo.getOrigem().equals(viejaParada)) { + ptramo = tramoService.obtenerTramotPorOrigemDestinoVia(nuevaParada, viejoTramo.getDestino(), viejoTramo.getVia()); + } + + if (viejoTramo.getDestino().equals(viejaParada)) { + ptramo = tramoService.obtenerTramotPorOrigemDestinoVia(viejoTramo.getOrigem(), nuevaParada, viejoTramo.getVia()); + } + + if (ptramo == null) { + + Tramo nuevoTramo = new Tramo(); + nuevoTramo.setDesctramo(viejoTramo.getDesctramo() + " II"); + nuevoTramo.setVia(viejoTramo.getVia()); + nuevoTramo.setKmPagoConductor(viejoTramo.getKmPagoConductor()); + nuevoTramo.setKmReal(viejoTramo.getKmReal()); + + nuevoTramo.setLsTramoTiempo(viejoTramo.getLsTramoTiempo()); + nuevoTramo.setLsOrgaoTramo(viejoTramo.getLsOrgaoTramo()); + + nuevoTramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + nuevoTramo.setFecmodif(Calendar.getInstance().getTime()); + nuevoTramo.setActivo(Boolean.TRUE); + + if (viejoTramo.getOrigem().equals(viejaParada)) { + nuevoTramo.setOrigem(nuevaParada); + nuevoTramo.setDestino(viejoTramo.getDestino()); + } + if (viejoTramo.getDestino().equals(viejaParada)) { + nuevoTramo.setDestino(nuevaParada); + nuevoTramo.setOrigem(viejoTramo.getOrigem()); + } + + return nuevoTramo; + } else { + return ptramo; + } + } else { + return null; + } + } + + private Parada crearNuevaParada(Parada parada, String cve, String descparada) { + Parada nuevaParada = new Parada(); + nuevaParada.setCveparada(cve); + nuevaParada.setDescparada(descparada); + nuevaParada.setCiudad(parada.getCiudad()); + nuevaParada.setRegionMetropolitana(parada.getRegionMetropolitana()); + nuevaParada.setNodo(parada.getNodo()); + nuevaParada.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + nuevaParada.setFecmodif(Calendar.getInstance().getTime()); + nuevaParada.setActivo(Boolean.TRUE); + + return nuevaParada; + } + + @Transactional(rollbackFor = BusinessException.class) + public Ruta suscribir(Ruta entidad, List lsParadasSequencia) throws BusinessException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getVentaOffLine() == null) { + entidad.setVentaOffLine(false); + } + + Boolean isClone = entidad.getIsClone() != null ? entidad.getIsClone() : Boolean.FALSE; + + if (entidad.getRutaId() == null) { + entidad = rutaDAO.suscribir(entidad); + } else { + entidad = rutaDAO.actualizacion(entidad); + } + if (lsParadasSequencia != null) { + if (!isClone) { + generarSecuencias(entidad, lsParadasSequencia); + } + generarCombinacion(entidad); + } + + return entidad; + } + + private void generarSecuencias(Ruta ruta, List lsParadasSequencia) throws BusinessException { + + tramoRutaService.limparInconsistenciasTramo(); + if (lsParadasSequencia != null) { + List lsRutaSecuencia = new ArrayList(); + HashMap> rutaSecuenciaBackup = new HashMap>(); + for (RutaSecuencia rutaSecuencia : ruta.getRutaSecuenciaList()) { + rutaSecuenciaBackup.put(rutaSecuencia.getTramo().getTramoId(), rutaSecuencia.getLsRutaCase() ); + } + + // Desativo todas as secuencias e gero novamente. + rutaSecuenciaService.borrarSecuencias(ruta); + ruta.setRutaSecuenciaList(null); + + log.info("Geração de Secuencia!"); + log.info("Ruta: " + ruta.getRutaId() + " - " + ruta.getDescruta()); + + lsRutaSecuencia.clear(); + StringBuilder sb = new StringBuilder("Tramo(s) inexistente(s):"); + sb.append("\n"); + for (int i = 0; i < lsParadasSequencia.size() - 1; i++) { + Parada ori = lsParadasSequencia.get(i).getParada(); + Via via = lsParadasSequencia.get(i).getVia(); + Integer sec1 = lsParadasSequencia.get(i).getSecuencia().intValue(); + log.info("Secuencia: " + sec1 + " origen " + ori.getDescparada() + " - " + ori.getCveparada() + " Via: " + via.getNombvia()); + + Parada des = lsParadasSequencia.get(i + 1).getParada(); + Integer sec2 = lsParadasSequencia.get(i + 1).getSecuencia().intValue(); + log.info("Secuencia: " + sec2 + " destino " + des.getDescparada() + " - " + des.getCveparada() + " Via: " + via.getNombvia()); + + ClaseServicio claseServicio = ruta.getClaseServicio(); + + Tramo tramo = tramoService.obtenerTramoUnicoRuta(ori, des, via, claseServicio); + + if (tramo != null) { + + RutaSecuencia rutaSecuencia = new RutaSecuencia(); + rutaSecuencia.setRuta(ruta); + rutaSecuencia.setTramo(tramo); + rutaSecuencia.setNumsecuencia(sec1.shortValue()); + rutaSecuencia.setActivo(Boolean.TRUE); + rutaSecuencia.setFecmodif(Calendar.getInstance().getTime()); + rutaSecuencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rutaSecuencia.setKmOriginal(tramo.getKmReal()); + rutaSecuencia = rutaSecuenciaService.suscribir(rutaSecuencia); + + List lsRutaCaseta = rutaSecuenciaBackup.get(tramo.getTramoId()); + if( lsRutaCaseta != null && !lsRutaCaseta.isEmpty() ) { + rutaSecuencia.setLsRutaCase(lsRutaCaseta); + } + + + lsRutaSecuencia.add(rutaSecuencia); + + } else { + throw new BusinessException("rutaServiceImpl.msg.validacionTRamo", new Object[] { ori.getCveparada(), des.getCveparada(), via.getNombvia(), claseServicio.getDescclase() }); + } + } + ruta.setRutaSecuenciaList(lsRutaSecuencia); + } + } + + @Transactional(rollbackFor = BusinessException.class) + public Ruta actualizacion(Ruta ruta, List lsParadasSequencia) throws BusinessException { + if (lsParadasSequencia != null) { + generarSecuencias(ruta, lsParadasSequencia); + generarCombinacion(ruta); + } + + ruta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + ruta.setFecmodif(Calendar.getInstance().getTime()); + ruta.setActivo(Boolean.TRUE); + + return rutaDAO.actualizacion(ruta); + } + + @Transactional(rollbackFor = RegistroConDependenciaException.class) + public void borrar(Ruta entidad) throws RegistroConDependenciaException { + if ((corridaDAO.count(entidad) > 0l) || (esquemaCorridaDAO.count("ruta", entidad) > 0l)) { + throw new RegistroConDependenciaException(); + } + + entidad = this.obtenerID(entidad.getRutaId()); + for (RutaCombinacion rutaCombinacion : entidad.getRutaCombinacionList()) { + rutaCombinacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rutaCombinacion.setFecmodif(Calendar.getInstance().getTime()); + rutaCombinacion.setActivo(Boolean.FALSE); + } + + for (RutaSecuencia rutaSecuencia : entidad.getRutaSecuenciaList()) { + rutaSecuencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rutaSecuencia.setFecmodif(Calendar.getInstance().getTime()); + rutaSecuencia.setActivo(Boolean.FALSE); + } + + for (RutaEmpresa rutaEmpresa : entidad.getLsRutaEmpresa()) { + rutaEmpresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rutaEmpresa.setFecmodif(Calendar.getInstance().getTime()); + rutaEmpresa.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + rutaDAO.actualizacion(entidad); + } + + @Transactional(rollbackFor = BusinessException.class) + public void generarCombinacion(Ruta ruta) throws BusinessException { + + + List listRutaCombinacion = new ArrayList(); + List lsRutaSecuencia = new ArrayList(); + if (ruta.getRutaId() != null) { + listRutaCombinacion = rutaCombinacionService.obtenerPorRuta(ruta); + } + + rutaCombinacionService.borrarCombinaciones(ruta); + + ruta.setRutaCombinacionList(listRutaCombinacion); + + lsRutaSecuencia = rutaSecuenciaService.buscarSecuenciaOrdenado(ruta); + + for (int i = 0; i < lsRutaSecuencia.size(); i++) { + Tramo tramoSecuencia1 = lsRutaSecuencia.get(i).getTramo(); + Parada origem = tramoSecuencia1.getOrigem(); + + for (int x = 0; x < lsRutaSecuencia.size(); x++) { + Tramo tramoSecuencia2 = lsRutaSecuencia.get(x).getTramo(); + Parada destinoOrigem = tramoSecuencia2.getDestino(); + + // Numero secuencia anterior > Numero secuencia atual não deve fazer. + // Essa condição não permiti gerar uma volta. + if (lsRutaSecuencia.get(i).getNumsecuencia().intValue() > lsRutaSecuencia.get(x).getNumsecuencia().intValue()) { + continue; + } + + // IDA - A x B - A x C + if (origem == destinoOrigem) { + continue; + } + + List listTramo = tramoService.obtenerPorOrigemDestinoFetchLazy(origem, destinoOrigem); + + if (listTramo.isEmpty()) { + throw new BusinessException("rutaServiceImpl.msg.validacionTRamoCombinacion", new Object[] { origem.getDescparada(), origem.getCveparada(), destinoOrigem.getDescparada(), destinoOrigem.getCveparada() }); + } + + Tramo trBuscaOrigemDestino = new Tramo(); + for (Tramo tm : listTramo) { + if (tm.getVia().equals(tramoSecuencia2.getVia())) { + trBuscaOrigemDestino = tm; + break; + } else if (tm.getVia().equals(tramoSecuencia1.getVia())) { + trBuscaOrigemDestino = tm; + break; + } else { + trBuscaOrigemDestino = tm; + } + } + + log.debug("Tramo:" + trBuscaOrigemDestino.getDesctramo()); + + RutaCombinacion rc = new RutaCombinacion(); + rc.setActivo(Boolean.TRUE); + rc.setFecmodif(Calendar.getInstance().getTime()); + rc.setIndventa(indVenta(ruta, trBuscaOrigemDestino)); + rc.setRuta(ruta); + rc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rc.setTramo(trBuscaOrigemDestino); + + // Verifica se já existe o registro INATIVO para Reativa-lo e manter a configuração se vende. + // if (!rutaCombinacionService.busquedaRutaTramo(ruta, trBuscaOrigemDestino, Boolean.FALSE)) { + rc = rutaCombinacionService.suscribir(rc); + // } else { + // rutaCombinacionService.activar(ruta, trBuscaOrigemDestino); + // } + + } + } + } + + private boolean indVenta(Ruta ruta, Tramo trBuscaOrigemDestino) { + for (RutaCombinacion rc : ruta.getRutaCombinacionList()) { + if (rc.getTramo().equals(trBuscaOrigemDestino)) { + return rc.getIndventa(); + } + } + return true; + } + + public Parada getDestino(Ruta ruta) { + return rutaDAO.buscarDestino(ruta); + } + + public Parada getOrigem(Ruta ruta) { + return rutaDAO.buscarOrigen(ruta); + } + + public List buscarPorClaseServicioEmpresa(ClaseServicio claseServicio, Empresa empresa) { + return rutaDAO.buscarPorClaseServicioEmpresa(claseServicio, empresa); + } + + public List buscarPorClaseServicio(ClaseServicio claseServicio) { + return rutaDAO.buscarPorClaseServicio(claseServicio); + } + + public List buscar(String nomeRuta, ClaseServicio claseServicio, Boolean nomeObrigatorio) { + return rutaDAO.buscar(nomeRuta, claseServicio, nomeObrigatorio); + } + + public List obtenerPorEmpresa(Empresa empresa) { + return rutaDAO.obtenerPorEmpresa(empresa); + } + + public List buscarTodosExceto(Integer... idRuta) { + return rutaDAO.buscarTodosExceto(idRuta); + } + + public List buscarTodosEstos(Integer[] idRutas) { + return rutaDAO.buscarTodosEstos(idRutas); + } + + public List buscarNumRuta(String numRuta) { + return rutaDAO.buscarNumRuta(numRuta); + } + + @Override + public boolean paradaExisteEnLaRuta(Parada parada, Ruta ruta) { + ruta = obtenerID(ruta.getRutaId()); + boolean existe = false; + for (int i = 0; (i < ruta.getRutaSecuenciaList().size()) && !existe; i++) { + RutaSecuencia rutaSecuencia = ruta.getRutaSecuenciaList().get(i); + Tramo tramo = rutaSecuencia.getTramo(); + if (tramo != null) { + if (tramo.getOrigem().equals(parada) || tramo.getDestino().equals(parada)) { + existe = true; + } + } + } + return existe; + } + + @Override + public List buscaRutaPorNumeroSemDadoRepetido(String palavraPesquisaRuta) { + return rutaDAO.buscaRutaPorNumeroSemDadoRepetido(palavraPesquisaRuta); + } + + public List buscaRuta(String palavraPesquisaRuta) { + return rutaDAO.buscaRuta(palavraPesquisaRuta); + } + + @Override + public List buscaRuta(String palavraPesquisaRuta, OrgaoConcedente orgao) { + return rutaDAO.buscaRuta(palavraPesquisaRuta, orgao); + } + + public List buscaRutasFromOrgao(OrgaoConcedente orgao) { + return rutaDAO.buscaRutasFromOrgao(orgao); + } + + public List buscaSomenteRutasFromOrgao(OrgaoConcedente orgao) { + return rutaDAO.buscaSomenteRutasFromOrgao(orgao); + } + + @Override + public List buscarRutasPorEmpresas(List lsEmp) { + return rutaDAO.buscarPorRutaPorEmpresas(lsEmp); + } + +// private class RutaComparator implements Comparator { +// @Override +// public int compare(Ruta r1, Ruta r2) { +// String name1 = r1.getDescruta(); +// String name2 = r2.getDescruta(); +// return name1.compareTo(name2); +// } +// } + + @Override + public Integer getNumSecuenciaOrigen(Integer rutaId, Integer origenId) { + return obtenerID(rutaId).numSecuenciaOrigen(origenId); + } + + @Override + public Integer getNumSecuenciaDestino(Integer rutaId, Integer destinoId) { + return obtenerID(rutaId).numSecuenciaDestino(destinoId); + } + + @Override + public List verificarSeqRutaNaoGerada(Ruta ruta, List lsParadasSecuencia) { + + List sequencias = null; + + if (lsParadasSecuencia != null) { + sequencias = new ArrayList(); + + for (ParadaSecuencia sequenciaInformada : lsParadasSecuencia) { + + Via via = sequenciaInformada.getVia(); + + ParadaSecuenciaCombinacaoLinha paradaSecuenciaCombinacaoLinha = new ParadaSecuenciaCombinacaoLinha(); + paradaSecuenciaCombinacaoLinha.setOrigem(sequenciaInformada); + paradaSecuenciaCombinacaoLinha.setVia(via); + paradaSecuenciaCombinacaoLinha.setDestinos(new ArrayList()); + paradaSecuenciaCombinacaoLinha.setKmReal(sequenciaInformada.getKmReal()); + paradaSecuenciaCombinacaoLinha.setKmEntradaSaida(sequenciaInformada.getKmEntradaSaida()); + paradaSecuenciaCombinacaoLinha.setTempoReal(sequenciaInformada.getTempoReal()); + + for (ParadaSecuencia sequenciaExistente : lsParadasSecuencia) { + if (sequenciaInformada.getParada().getParadaId() == sequenciaExistente.getParada().getParadaId()) { + continue; + } + + paradaSecuenciaCombinacaoLinha.getDestinos().add(sequenciaExistente); + } + + sequencias.add(paradaSecuenciaCombinacaoLinha); + } + } + + return sequencias; + } + + @Override + public List buscarRutasPorEmpresaOrgaoConcedente(Empresa empresa, OrgaoConcedente orgao) { + return rutaDAO.buscarRutasPorEmpresaOrgaoConcedente(empresa, orgao); + } + + class CambioRutaTramo { + private Tramo viejoTramo; + private Tramo nuevoTramo; + private Parada viejaParada; + private Parada nuevaParada; + + public CambioRutaTramo(Tramo viejoTramo, Tramo nuevoTramo, Parada viejaParada, Parada nuevaParada) { + super(); + this.viejoTramo = viejoTramo; + this.nuevoTramo = nuevoTramo; + this.viejaParada = viejaParada; + this.nuevaParada = nuevaParada; + } + + public Tramo getViejoTramo() { + return viejoTramo; + } + + public void setViejoTramo(Tramo viejoTramo) { + this.viejoTramo = viejoTramo; + } + + public Tramo getNuevoTramo() { + return nuevoTramo; + } + + public void setNuevoTramo(Tramo nuevoTramo) { + this.nuevoTramo = nuevoTramo; + } + + public Parada getViejaParada() { + return viejaParada; + } + + public void setViejaParada(Parada viejaParada) { + this.viejaParada = viejaParada; + } + + public Parada getNuevaParada() { + return nuevaParada; + } + + public void setNuevaParada(Parada nuevaParada) { + this.nuevaParada = nuevaParada; + } + } + + @Override + public List buscaLikeComboBox(String stringConsulta) { + return rutaDAO.buscaLikeComboBox(stringConsulta); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java new file mode 100644 index 000000000..1e4a76a6f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java @@ -0,0 +1,120 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.codehaus.jettison.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConstanteDAO; +import com.rjconsultores.ventaboletos.dao.SapDAO; +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente; +import com.rjconsultores.ventaboletos.rest.IntegracaoSapRest; +import com.rjconsultores.ventaboletos.service.SapService; +import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO; + +@Service("sapService") +public class SapServiceImpl implements SapService{ + + private static final String INTEGRACAO_SAP_URL = "INTEGRACAO_SAP_URL"; + private static final String INTEGRACAO_SAP_CREDENCIAL = "INTEGRACAO_SAP_CREDENCIAL"; + + @Autowired + private SapDAO sapDAO; + + @Autowired + private ConstanteDAO constanteDAO; + + @Override + public List obtenerTodos() { + return sapDAO.obtenerTodos(); + } + + @Override + public FechamentoCntcorrente obtenerID(Long id) { + return sapDAO.obtenerID(id); + } + + @Override + @Transactional + public FechamentoCntcorrente suscribir(FechamentoCntcorrente entidad) { + return sapDAO.suscribir(entidad); + } + + @Override + @Transactional + public FechamentoCntcorrente actualizacion(FechamentoCntcorrente entidad) { + return sapDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(FechamentoCntcorrente entidad) { + sapDAO.borrar(entidad); + + } + + @Override + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) { + return sapDAO.obtenerTodosParaRemessa(empresa, dataDe, dataAte, reenviar); + } + + @Override + public int remessa(List fechamentos) throws Exception { + try { + int contador = 0; + IntegracaoSapRest integracaoSapRest = IntegracaoSapRest.getInstance(); + String credenciais = buscaConstante(INTEGRACAO_SAP_CREDENCIAL); + String url = buscaConstante(INTEGRACAO_SAP_URL); + + for (FechamentoCntCorrenteVO fechamentoCntcorrente : fechamentos) { + if( fechamentoCntcorrente.isEnviar()) { + JSONObject integrado = integracaoSapRest.enviarIntegracaoSap(fechamentoCntcorrente, url, credenciais); + + if(integrado == null) { + throw new RuntimeException("Erro no envio/retorno da requisicao para integração SAP"); + }else if(integrado.getString("Integration").equals("S")) { + atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId()); + contador++; + }else if(integrado.getString("Integration").equals("E")) { + throw new RuntimeException("Retorno enviado pelo SAP: \r\n"+integrado.getString("Message")); + } + } + } + + return contador; + }catch(RuntimeException re){ + throw re; + }catch(Exception e){ + throw e; + } + } + + private boolean atualizaFechamento(Long fechamentocntcorrenteId) throws Exception { + return sapDAO.atualizaFechamento( fechamentocntcorrenteId); + } + + private String buscaConstante(String constanteString) { + Constante constante = constanteDAO.buscarPorNomeConstante(constanteString); + + if( constante == null || constante.getValorconstante() == null || constante.getValorconstante().isEmpty() ) { + throw new RuntimeException("Constante "+constanteString+" não cadastrada"); + } + + return constante.getValorconstante(); + } + + @Override + public void integracaoSapAutomatica() throws Exception { + List listaPendente = obtenerTodosParaRemessa(null, new Date(), new Date(), false); + + if(!listaPendente.isEmpty()) { + remessa(listaPendente); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SecretariaEmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SecretariaEmpresaServiceImpl.java new file mode 100644 index 000000000..2bac75c29 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/SecretariaEmpresaServiceImpl.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.SecretariaEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import com.rjconsultores.ventaboletos.entidad.SecretariaEmpresa; +import com.rjconsultores.ventaboletos.service.SecretariaEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("secretariaEmpresaService") +public class SecretariaEmpresaServiceImpl implements SecretariaEmpresaService { + + @Autowired + private SecretariaEmpresaDAO secretariaEmpresaDAO; + + public List obtenerTodos() { + return secretariaEmpresaDAO.obtenerTodos(); + } + + public SecretariaEmpresa obtenerID(Integer id) { + return secretariaEmpresaDAO.obtenerID(id); + } + + @Transactional + public SecretariaEmpresa suscribir(SecretariaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return secretariaEmpresaDAO.suscribir(entidad); + } + + @Transactional + public SecretariaEmpresa actualizacion(SecretariaEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return secretariaEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(SecretariaEmpresa entidad) { + secretariaEmpresaDAO.borrar(entidad); + } + + + @Override + public List buscarPorSecretaria(Secretaria secretaria){ + return secretariaEmpresaDAO.buscarPorSecretaria(secretaria); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SecretariaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SecretariaServiceImpl.java new file mode 100644 index 000000000..5b9e77ea1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/SecretariaServiceImpl.java @@ -0,0 +1,86 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.SecretariaDAO; +import com.rjconsultores.ventaboletos.entidad.CuponSecretaria; +import com.rjconsultores.ventaboletos.entidad.Secretaria; +import com.rjconsultores.ventaboletos.service.SecretariaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("secretariaService") +public class SecretariaServiceImpl implements SecretariaService { + + @Autowired + private SecretariaDAO secretariaDAO; + + public List obtenerTodos() { + return secretariaDAO.obtenerTodos(); + } + + public Secretaria obtenerID(Integer id) { + return secretariaDAO.obtenerID(id); + } + + @Transactional + public Secretaria suscribir(Secretaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return secretariaDAO.suscribir(entidad); + } + + @Transactional + public Secretaria actualizacion(Secretaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return secretariaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Secretaria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + for (CuponSecretaria cd : entidad.getLsCuponSecretaria()) { + cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + cd.setFecmodif(Calendar.getInstance().getTime()); + cd.setActivo(Boolean.FALSE); + } + + secretariaDAO.actualizacion(entidad); + } + + public List buscar(String descsecretaria, String cvesecretaria) { + return secretariaDAO.buscar(descsecretaria, cvesecretaria); + } + + public List buscar(String descsecretaria) { + return secretariaDAO.buscar(descsecretaria); + } + + @Override + public Secretaria buscarSecretariaVoucherRod(Short formaPagoId) { + return secretariaDAO.buscarSecretariaVoucherRod(formaPagoId); + } + + public List buscaLike(String descsecretaria) { + return secretariaDAO.buscaLike(descsecretaria); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SegVKMServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SegVKMServiceImpl.java new file mode 100644 index 000000000..69c94a985 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/SegVKMServiceImpl.java @@ -0,0 +1,79 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.SegVKMDAO; +import com.rjconsultores.ventaboletos.entidad.SegVKM; +import com.rjconsultores.ventaboletos.service.SegVKMService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author RJ + */ +@Service("segVKMService") +public class SegVKMServiceImpl implements SegVKMService { + + @Autowired + private SegVKMDAO segVKMDAO; + + public List obtenerTodos() { + return segVKMDAO.obtenerTodos(); + } + + public SegVKM obtenerID(Integer id) { + return segVKMDAO.obtenerID(id); + } + + @Transactional + public SegVKM suscribir(SegVKM entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return segVKMDAO.suscribir(entidad); + } + + @Transactional + public SegVKM actualizacion(SegVKM entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return segVKMDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(SegVKM entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + segVKMDAO.actualizacion(entidad); + } + + public List buscar(String serie) { + return segVKMDAO.buscar(serie); + + } + + @Override + public String seriePorEmpresa(Integer empresaId) { + return segVKMDAO.seriePorEmpresa(empresaId); + } + + @Override + public BigDecimal buscarSeguroPorKm(Long km, String serie, Integer orgaoConcedenteId) { + return segVKMDAO.buscarSeguroPorKm(km, serie, orgaoConcedenteId); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SeguradoraEmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SeguradoraEmpresaServiceImpl.java new file mode 100644 index 000000000..521d0e327 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/SeguradoraEmpresaServiceImpl.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.SeguradoraEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.SeguradoraEmpresa; +import com.rjconsultores.ventaboletos.service.SeguradoraEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("seguradoraEmpresaService") +public class SeguradoraEmpresaServiceImpl implements SeguradoraEmpresaService { + + @Autowired + private SeguradoraEmpresaDAO seguradoraEmpresaDAO; + + public List obtenerTodos() { + return seguradoraEmpresaDAO.obtenerTodos(); + } + + public SeguradoraEmpresa obtenerID(Integer id) { + return seguradoraEmpresaDAO.obtenerID(id); + } + + public boolean existe(Empresa empresa, String serie){ + return seguradoraEmpresaDAO.existe(empresa, serie); + } + + @Transactional + public SeguradoraEmpresa suscribir(SeguradoraEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return seguradoraEmpresaDAO.suscribir(entidad); + } + + @Transactional + public SeguradoraEmpresa actualizacion(SeguradoraEmpresa entidad) { + return seguradoraEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(SeguradoraEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + seguradoraEmpresaDAO.borrar(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SeguroKmServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SeguroKmServiceImpl.java new file mode 100644 index 000000000..2b87a073d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/SeguroKmServiceImpl.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroKm; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.SeguroKmDAO; +import com.rjconsultores.ventaboletos.service.SeguroKmService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import org.springframework.transaction.annotation.Transactional; + +@Service("seguroKmService") +public class SeguroKmServiceImpl implements SeguroKmService { + + @Autowired + private SeguroKmDAO seguroKmDAO; + + public List buscarPorOrgao(OrgaoConcedente orgao) { + return seguroKmDAO.buscarPorOrgao(orgao); + } + + public List obtenerTodos() { + return seguroKmDAO.obtenerTodos(); + } + + public SeguroKm obtenerID(Integer id) { + return seguroKmDAO.obtenerID(id); + } + + @Transactional + public SeguroKm suscribir(SeguroKm entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return seguroKmDAO.suscribir(entidad); + } + + @Transactional + public SeguroKm actualizacion(SeguroKm entidad) { + return seguroKmDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(SeguroKm entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + seguroKmDAO.borrar(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SeguroTarifaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SeguroTarifaServiceImpl.java new file mode 100644 index 000000000..8ec64362c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/SeguroTarifaServiceImpl.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.SeguroTarifa; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO; +import com.rjconsultores.ventaboletos.service.SeguroTarifaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import org.springframework.transaction.annotation.Transactional; + +@Service("seguroTarifaService") +public class SeguroTarifaServiceImpl implements SeguroTarifaService { + + @Autowired + private SeguroTarifaDAO seguroTarifaDAO; + + public List obtenerTodos() { + return seguroTarifaDAO.obtenerTodos(); + } + + public SeguroTarifa obtenerID(Integer id) { + return seguroTarifaDAO.obtenerID(id); + } + + @Transactional + public SeguroTarifa suscribir(SeguroTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return seguroTarifaDAO.suscribir(entidad); + } + + @Transactional + public SeguroTarifa actualizacion(SeguroTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + return seguroTarifaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(SeguroTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + seguroTarifaDAO.actualizacion(entidad); + } + + public List buscarPorOrgao(OrgaoConcedente orgao) { + return seguroTarifaDAO.buscarPorOrgao(orgao); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SisdapServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SisdapServiceImpl.java new file mode 100644 index 000000000..223352d45 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/SisdapServiceImpl.java @@ -0,0 +1,28 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.SisdapDAO; +import com.rjconsultores.ventaboletos.service.SisdapService; + +@Service("sisdapService") +public class SisdapServiceImpl implements SisdapService{ + + @Autowired + private SisdapDAO sisdapDAO; + + @Override + public List getMovimentoLinhas(Date fecInicio, Date fecFinal, Integer empresaId) { + return sisdapDAO.getMovimentoLinhas(fecInicio, fecFinal, empresaId); + } + + @Override + public List getMovimentoSecoes(Date fecInicio, Date fecFinal, Integer empresaId, List pesquisaGratuidade, List pesquisaDescontoIdoso, List pesquisaGratuidadeIdoso, List pesquisaDescontoJovem, List pesquisaGratuidadeJovem) { + return sisdapDAO.getMovimentoSecoes(fecInicio, fecFinal, empresaId, pesquisaGratuidade, pesquisaGratuidadeIdoso, pesquisaDescontoIdoso, pesquisaDescontoJovem, pesquisaGratuidadeJovem); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SistemaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SistemaServiceImpl.java new file mode 100644 index 000000000..13a8f5b26 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/SistemaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.SistemaDAO; +import com.rjconsultores.ventaboletos.entidad.Sistema; +import com.rjconsultores.ventaboletos.service.SistemaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("sistemaService") +public class SistemaServiceImpl implements SistemaService { + + @Autowired + private SistemaDAO sistemaDAO; + + public List obtenerTodos() { + return sistemaDAO.obtenerTodos(); + } + + public Sistema obtenerID(Integer id) { + return sistemaDAO.obtenerID(id); + } + + @Transactional + public Sistema suscribir(Sistema entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return sistemaDAO.suscribir(entidad); + } + + @Transactional + public Sistema actualizacion(Sistema entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return sistemaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Sistema entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + sistemaDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaCategoriaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaCategoriaServiceImpl.java new file mode 100644 index 000000000..bc5abe308 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaCategoriaServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TarifaCategoriaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.TarifaCategoria; +import com.rjconsultores.ventaboletos.service.TarifaCategoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("tarifaCategoriaService") +public class TarifaCategoriaServiceImpl implements TarifaCategoriaService { + + @Autowired + private TarifaCategoriaDAO tarifaCategoriaDAO; + + public List obtenerTodos() { + return tarifaCategoriaDAO.obtenerTodos(); + } + + public TarifaCategoria obtenerID(Integer id) { + return tarifaCategoriaDAO.obtenerID(id); + } + + @Transactional + public TarifaCategoria suscribir(TarifaCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaCategoriaDAO.suscribir(entidad); + } + + @Transactional + public TarifaCategoria actualizacion(TarifaCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaCategoriaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarifaCategoria entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tarifaCategoriaDAO.actualizacion(entidad); + } + + public List buscar(Categoria categoria) { + return tarifaCategoriaDAO.buscarPorCategoria(categoria); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaEmbarcadaHistServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaEmbarcadaHistServiceImpl.java new file mode 100644 index 000000000..db218aa54 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaEmbarcadaHistServiceImpl.java @@ -0,0 +1,59 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TarifaEmbarcadaHistDAO; +import com.rjconsultores.ventaboletos.entidad.TarifaEmbarcadaHist; +import com.rjconsultores.ventaboletos.service.TarifaEmbarcadaHistService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tarifaEmbarcadaHistService") +public class TarifaEmbarcadaHistServiceImpl implements TarifaEmbarcadaHistService { + + @Autowired + private TarifaEmbarcadaHistDAO tarifaEmbarcadaHistDAO; + + public List obtenerTodos() { + return tarifaEmbarcadaHistDAO.obtenerTodos(); + } + + public TarifaEmbarcadaHist obtenerID(Integer id) { + return tarifaEmbarcadaHistDAO.obtenerID(id); + } + + @Transactional + public TarifaEmbarcadaHist suscribir(TarifaEmbarcadaHist entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaEmbarcadaHistDAO.suscribir(entidad); + } + + @Transactional + public TarifaEmbarcadaHist actualizacion(TarifaEmbarcadaHist entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaEmbarcadaHistDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarifaEmbarcadaHist entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tarifaEmbarcadaHistDAO.borrar(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaEmbarcadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaEmbarcadaServiceImpl.java new file mode 100644 index 000000000..2d0832802 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaEmbarcadaServiceImpl.java @@ -0,0 +1,175 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.RoundingMode; +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TarifaEmbarcadaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TarifaEmbarcada; +import com.rjconsultores.ventaboletos.entidad.TarifaEmbarcadaHist; +import com.rjconsultores.ventaboletos.entidad.TarifaMinima; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.TarifaEmbarcadaHistService; +import com.rjconsultores.ventaboletos.service.TarifaEmbarcadaService; +import com.rjconsultores.ventaboletos.service.TarifaMinimaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tarifaEmbarcadaService") +public class TarifaEmbarcadaServiceImpl implements TarifaEmbarcadaService { + + private static Logger log = Logger.getLogger(TarifaEmbarcadaService.class); + + @Autowired + private TarifaEmbarcadaDAO tarifaEmbarcadaDAO; + + @Autowired + private TarifaEmbarcadaHistService tarifaEmbarcadaHistService; + + @Autowired + private TarifaMinimaService tarifaMinimaService; + + public List obtenerTodos() { + return tarifaEmbarcadaDAO.obtenerTodos(); + } + + @Transactional(readOnly = true) + public TarifaEmbarcada obtenerID(Integer id) { + return tarifaEmbarcadaDAO.obtenerID(id); + } + + @Transactional + public TarifaEmbarcada suscribir(TarifaEmbarcada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + if (entidad.getPrecio() != null) { + entidad.setPrecio(entidad.getPrecio().setScale(2, RoundingMode.HALF_UP)); + } + if (entidad.getPreciooriginal() != null) { + entidad.setPreciooriginal(entidad.getPreciooriginal().setScale(2, RoundingMode.HALF_UP)); + } + if (entidad.getPrecioredabierto() != null) { + entidad.setPrecioredabierto(entidad.getPrecioredabierto().setScale(2, RoundingMode.HALF_UP)); + } + cadastrarTarifaEmbarcadaHistorico(entidad); + + return tarifaEmbarcadaDAO.suscribir(entidad); + } + + @Transactional + public TarifaEmbarcada actualizacion(TarifaEmbarcada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + if (entidad.getPrecio() != null) { + entidad.setPrecio(entidad.getPrecio().setScale(2, RoundingMode.HALF_UP)); + } + if (entidad.getPreciooriginal() != null) { + entidad.setPreciooriginal(entidad.getPreciooriginal().setScale(2, RoundingMode.HALF_UP)); + } + if (entidad.getPrecioredabierto() != null) { + entidad.setPrecioredabierto(entidad.getPrecioredabierto().setScale(2, RoundingMode.HALF_UP)); + } + + + cadastrarTarifaEmbarcadaHistorico(entidad); + + tarifaEmbarcadaDAO.updateTarifa(entidad); + + return entidad; + } + + @Transactional + public void borrar(TarifaEmbarcada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cadastrarTarifaEmbarcadaHistorico(entidad); + + tarifaEmbarcadaDAO.actualizacion(entidad); + } + + private void cadastrarTarifaEmbarcadaHistorico(TarifaEmbarcada entidad) { + TarifaEmbarcadaHist th = new TarifaEmbarcadaHist(); + th.setActivo(entidad.getActivo()); + th.setClaseServicio(entidad.getClaseServicio()); + th.setFecmodif(entidad.getFecmodif()); + th.setMarca(entidad.getMarca()); + th.setMoneda(entidad.getMoneda()); + th.setPrecio(entidad.getPrecio()); + th.setPreciooriginal(entidad.getPreciooriginal()); + th.setStatustarifa(entidad.getStatustarifa()); + th.setUsuarioId(entidad.getUsuarioId()); + th.setVigenciaTarifa(entidad.getVigenciaTarifa()); + + th = tarifaEmbarcadaHistService.suscribir(th); + } + + @Override + public void excluirTodasTarifas(Moneda moneda, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Parada origem, Parada destino, Ruta ruta, Via via, Boolean vende) { + tarifaEmbarcadaDAO.excluirTodasTarifas(moneda, marca, claseServicio, vigenciaTarifa, origem, destino, ruta, via, vende); + } + + @Override + public Boolean podeAlterarTarifaMinima(TarifaEmbarcada tarifa, Marca marca, Parada origem, + Parada destino, ClaseServicio claseServicio, Plaza plaza, Moneda moneda) { + + Boolean podeAlterarTarifaMinima = Boolean.TRUE; + + List lsTarifaMinima = tarifaMinimaService.pesquisarEspecifico(marca, origem, destino, claseServicio, moneda); + + if (lsTarifaMinima.isEmpty()) { + lsTarifaMinima = tarifaMinimaService.pesquisarOrigemDestinoTodos(marca, origem, destino, claseServicio, moneda); + } + + log.debug("Moneda : " + moneda.getDescmoneda()); + log.debug("Preço : " + tarifa.getPrecio()); + + for (TarifaMinima tm : lsTarifaMinima) { + if (tarifa.getPrecio().compareTo(tm.getImportetarifa()) == -1) { + podeAlterarTarifaMinima = Boolean.FALSE; + log.debug("Tarifa Minima ID: " + tm.getTarifaminimaId()); + log.debug("Tarifa Minima Origen : " + tm.getOrigem().getDescparada()); + log.debug("Tarifa Minima Destino: " + tm.getDestino().getDescparada()); + log.debug("Tarifa Minima Marca : " + tm.getMarca().getDescmarca()); + log.debug("Tarifa Minima Clase : " + tm.getClaseServicio().getDescclase()); + log.debug("Tarifa Minima Moneda : " + tm.getMoneda().getDescmoneda()); + log.debug("Tarifa Minima : " + tm.getImportetarifa() + " Valor Alterado: " + tarifa.getPrecio()); + } + } + + return podeAlterarTarifaMinima; + } + + @Override + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException { + tarifaEmbarcadaDAO.copiarTarifas(vigenciaTarifaOrigem, vigenciaTarifaDestino, empresa, excluirTarifasDestino); + } + + public TarifaEmbarcada buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio, + VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta) { + return tarifaEmbarcadaDAO.buscar(tramo, marca, claseServicio, vigenciaTarifa, moneda, ruta); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaHistServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaHistServiceImpl.java new file mode 100644 index 000000000..1cff76433 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaHistServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TarifaHistDAO; +import com.rjconsultores.ventaboletos.entidad.TarifaHist; +import com.rjconsultores.ventaboletos.service.TarifaHistService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("tarifaHistService") +public class TarifaHistServiceImpl implements TarifaHistService { + + @Autowired + private TarifaHistDAO tarifaHistDAO; + + public List obtenerTodos() { + return tarifaHistDAO.obtenerTodos(); + } + + public TarifaHist obtenerID(Integer id) { + return tarifaHistDAO.obtenerID(id); + } + + @Transactional + public TarifaHist suscribir(TarifaHist entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaHistDAO.suscribir(entidad); + } + + @Transactional + public TarifaHist actualizacion(TarifaHist entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaHistDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarifaHist entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tarifaHistDAO.borrar(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaKmServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaKmServiceImpl.java new file mode 100644 index 000000000..8dc9974a6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaKmServiceImpl.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TarifaKmDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TarifaKm; +import com.rjconsultores.ventaboletos.service.TarifaKmService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tarifaKmService") +public class TarifaKmServiceImpl implements TarifaKmService { + + @Autowired + private TarifaKmDAO tarifaKmDAO; + + public List buscarPorOrgaoAndClasse(OrgaoConcedente orgaoconcedenteId, ClaseServicio claseId) { + return tarifaKmDAO.buscarPorOrgaoAndClasse( orgaoconcedenteId, claseId); + + } + + public List obtenerTodos() { + return tarifaKmDAO.obtenerTodos(); + } + + public TarifaKm obtenerID(Integer id) { + return tarifaKmDAO.obtenerID(id); + } + + @Transactional + public TarifaKm actualizacion(TarifaKm entidad) { + return tarifaKmDAO.actualizacion(entidad); + } + + @Transactional + public TarifaKm suscribir(TarifaKm entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaKmDAO.suscribir(entidad); + } + + @Transactional + public void borrar(TarifaKm entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tarifaKmDAO.borrar(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaMinimaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaMinimaServiceImpl.java new file mode 100644 index 000000000..3d1ab1a19 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaMinimaServiceImpl.java @@ -0,0 +1,130 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TarifaMinimaDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.TarifaMinima; +import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria; +import com.rjconsultores.ventaboletos.service.TarifaMinimaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("tarifaMinimaService") +public class TarifaMinimaServiceImpl implements TarifaMinimaService { + + @Autowired + private TarifaMinimaDAO tarifaMinimaDAO; + + public List obtenerTodos() { + return tarifaMinimaDAO.obtenerTodos(); + } + + public TarifaMinima obtenerID(Integer id) { + return tarifaMinimaDAO.obtenerID(id); + } + + @Transactional + public TarifaMinima suscribir(TarifaMinima entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaMinimaDAO.suscribir(entidad); + } + + @Transactional + public TarifaMinima actualizacion(TarifaMinima entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaMinimaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarifaMinima entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tarifaMinimaDAO.actualizacion(entidad); + } + + public List buscarPorPlaza(Plaza plaza) { + return tarifaMinimaDAO.buscarPorPlaza(plaza); + } + + public List pesquisar(Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio, Moneda moneda) { + return tarifaMinimaDAO.pesquisar(marca, origem, destino, claseServicio, moneda); + } + + public List pesquisar(BigDecimal valor, Moneda moneda, + Plaza plaza, Marca marca, Parada origem, Parada destino, + ClaseServicio claseServicio) { + return tarifaMinimaDAO.pesquisar(valor, moneda, plaza, marca, origem, + destino, claseServicio); + } + + public List pesquisar( TarifaMinima tarifaMinima) { + return tarifaMinimaDAO.pesquisar( tarifaMinima); + } + + public List pesquisarEspecifico(Marca marca, Parada origem, + Parada destino, ClaseServicio claseServicio, Moneda moneda) { + return tarifaMinimaDAO.pesquisar(marca, origem, destino, claseServicio, moneda); + } + + public List pesquisarOrigemDestinoTodos(Marca marca, Parada origem,Parada destino,ClaseServicio claseServicio, Moneda moneda) { + return tarifaMinimaDAO.pesquisarOrigemDestinoTodos(marca, origem, destino, claseServicio, moneda); + } + + public List buscarPorMarca(Marca marca, Moneda moneda) { + return tarifaMinimaDAO.buscarPorMarcaMoneda(marca, moneda); + } + + public List buscarPorClaseServico(ClaseServicio claseServicio, + Moneda moneda) { + return tarifaMinimaDAO.buscarPorClaseServicioMoneda(claseServicio, moneda); + } + + public List buscarPorPlazaMoneda(Plaza plaza, Moneda moneda) { + return tarifaMinimaDAO.buscarPorPlazaMoneda(plaza, moneda); + } + + @Override + public TarifaMinimaCategoria adicionarTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria) { + tarifaMinimaCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tarifaMinimaCategoria.setFecmodif(new Date()); + tarifaMinimaCategoria.setActivo(Boolean.TRUE); + return tarifaMinimaDAO.adicionarTarifaMinimaCategoria(tarifaMinimaCategoria); + } + + @Override + public void removerTarifaMinimaCategoria(TarifaMinimaCategoria tarifaMinimaCategoria) { + tarifaMinimaCategoria.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tarifaMinimaCategoria.setFecmodif(new Date()); + tarifaMinimaCategoria.setActivo(Boolean.FALSE); + tarifaMinimaDAO.removerTarifaMinimaCategoria(tarifaMinimaCategoria); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java new file mode 100644 index 000000000..5d0b890a9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java @@ -0,0 +1,344 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.constantes.TipoSeguro; +import com.rjconsultores.ventaboletos.dao.OrgaoConcedenteDAO; +import com.rjconsultores.ventaboletos.dao.SeguroKmDAO; +import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO; +import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TarifaOficial; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; +import com.rjconsultores.ventaboletos.service.TarifaOficialService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.comissao.TarifaOficialVO; + +@Service("tarifaOficialService") +public class TarifaOficialServiceImpl implements TarifaOficialService { + + private static Logger log = LoggerFactory.getLogger(TarifaOficialServiceImpl.class); + + @Autowired + private TarifaOficialDAO tarifaOficialDAO; + @Autowired + private SeguroKmDAO seguroKmDAO; + @Autowired + private SeguroTarifaDAO seguroTarifaDAO; + @Autowired + private OrgaoConcedenteDAO orgaoConcedenteDAO; + + @Autowired + private LogAuditoriaService logAuditoriaService; + + @Override + @Transactional + public Integer gerarTarifaPorCoeficiente(Integer rutaId, OrgaoConcedente orgaoConcedente, List idsEmpresas) { + return tarifaOficialDAO.gerarTarifaPorCoeficiente(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedente, idsEmpresas); + } + + @Override + @Transactional + public Integer atualizarTarifaPorCoeficiente(Integer rutaId, OrgaoConcedente orgaoConcedente) { + return tarifaOficialDAO.atualizarTarifaCoeficiente(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedente); + } + + @Override + @Transactional + public void copiarParaTarifa(VigenciaTarifa vigenciaTarifa, Boolean calculaPegagio, Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP, Boolean calculaEmbarcada, Empresa empresa, OrgaoConcedente orgaoConcedente) { + tarifaOficialDAO.copiarParaTarifa(vigenciaTarifa, UsuarioLogado.getUsuarioLogado().getUsuarioId(), + calculaPegagio, calculaTarifa, calculaTaxaEmbarque, calculaSeguro, calculaTPP, calculaEmbarcada, empresa, orgaoConcedente); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void gerarAtualizarTarifa(List lsRuta, OrgaoConcedente orgaoConcedente, List lsEmpresaSelected) throws BusinessException { + + // Limpando a tabela de TARIFA_OFICIAL + tarifaOficialDAO.limparTarifasOficiais(lsEmpresaSelected); + + int x = 0; + if(lsRuta != null && !lsRuta.isEmpty()){ + x = lsRuta.size(); + } + + List idsEmpresas = new ArrayList(); + for(Empresa e : lsEmpresaSelected){ + idsEmpresas.add(e.getEmpresaId()); + } + + do{ + Integer rutaId = null; + if(lsRuta != null && !lsRuta.isEmpty()){ + Ruta r = lsRuta.get(x-1); + rutaId = r.getRutaId(); + } + + log.info("gerarAtualizarTarifa= rudaId:" + rutaId + ";orgaoConcedenteId:" + (orgaoConcedente != null ? orgaoConcedente.getOrgaoConcedenteId() : "null") + ";empresaId:" + idsEmpresas); + + // Gerando as tarifas pelo coeficiente + if (orgaoConcedente == null || + (orgaoConcedente.getOrgaoConcedenteId() == null || orgaoConcedente.getOrgaoConcedenteId() != OrgaoConcedente.CODIGO_ARTESP)) { + Integer qtdTarifaCoeficiente = gerarTarifaPorCoeficiente(rutaId, orgaoConcedente, idsEmpresas); + log.info("qtdTarifaCoeficiente=" + qtdTarifaCoeficiente); + } + + // Gerando as tarifas para ARTESP + if (orgaoConcedente == null || + (orgaoConcedente.getOrgaoConcedenteId() == null || orgaoConcedente.getOrgaoConcedenteId() == OrgaoConcedente.CODIGO_ARTESP)) { + Integer qtdTarifaArtesp = tarifaOficialDAO.gerarTarifaArtesp(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), + orgaoConcedente != null ? orgaoConcedente.getOrgaoConcedenteId() : null, idsEmpresas); + log.info("qtdTarifaArtesp=" + qtdTarifaArtesp); + } + x--; + }while(x > 0); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void gerarAtualizarTabelaZerada(List lsRuta, Integer orgaoConcedenteId, List lsEmpresaSelected) throws BusinessException { + // Limpando a tabela de TARIFA_OFICIAL + tarifaOficialDAO.limparTarifasOficiais(lsEmpresaSelected); + + int x =0; + if(lsRuta != null && !lsRuta.isEmpty()){ + x = lsRuta.size(); + } + + List idsEmpresas = new ArrayList(); + for(Empresa e : lsEmpresaSelected){ + idsEmpresas.add(e.getEmpresaId()); + } + + do{ + Integer rutaId =null; + if(lsRuta != null && !lsRuta.isEmpty()){ + rutaId = lsRuta.get(x-1).getRutaId(); + } + + //Gerando as tarifas + tarifaOficialDAO.gerarTabelaZerada(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, idsEmpresas); + + x--; + }while(x > 0); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void atualizarTaxaEmbarque(List lsRuta, Integer orgaoConcedenteId,boolean gerarTabelaZerada, List lsEmpresaSelected) throws BusinessException{ + + if (gerarTabelaZerada){ + gerarAtualizarTabelaZerada(lsRuta, orgaoConcedenteId, lsEmpresaSelected); + } + + List idsEmpresas = new ArrayList(); + for(Empresa e : lsEmpresaSelected){ + idsEmpresas.add(e.getEmpresaId()); + } + + tarifaOficialDAO.atualizarTaxaEmbarque(lsRuta, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, idsEmpresas); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void atualizarSeguroPorKm(Integer rutaId, Integer orgaoId, TipoSeguro tipoSeguro) throws BusinessException { + tarifaOficialDAO.atualizarSeguroPorKm(rutaId, orgaoId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), tipoSeguro); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void atualizarSeguroPorKmTPP(Integer rutaId, Integer orgaoId, TipoSeguro tipoSeguro) throws BusinessException { + tarifaOficialDAO.atualizarPrecioPorTPP(rutaId, orgaoId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), tipoSeguro); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void atualizarSeguroPorTarifa(Integer rutaId, Integer orgaoId) throws BusinessException { + tarifaOficialDAO.atualizarSeguroPorTarifa(rutaId, orgaoId, UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void atualizarSeguro(List lsRuta, Integer orgaoId, TipoSeguro tipoSeguro) throws BusinessException { + + List lsOrgaoId = new ArrayList(); + + if (orgaoId == null) { + lsOrgaoId.addAll(orgaoConcedenteDAO.obtenerTodosIds()); + } else { + 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. + for (Integer orgaoConcedenteId : lsOrgaoId) { + if (seguroKmDAO.existe(orgaoConcedenteId)) { + atualizarSeguroPorKm(rutaId, orgaoConcedenteId, tipoSeguro); + } else if (seguroTarifaDAO.existe(orgaoConcedenteId)) { + atualizarSeguroPorTarifa(rutaId, orgaoConcedenteId); + } + } + x--; + }while(x > 0); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public void atualizarSeguroTPP(List lsRuta, Integer orgaoId, TipoSeguro tipoSeguro) throws BusinessException { + + List lsOrgaoId = new ArrayList(); + + if (orgaoId == null) { + lsOrgaoId.addAll(orgaoConcedenteDAO.obtenerTodosIds()); + } else { + 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. + for (Integer orgaoConcedenteId : lsOrgaoId) { + if (seguroKmDAO.existe(orgaoConcedenteId)) { + atualizarSeguroPorKmTPP(rutaId, orgaoConcedenteId, tipoSeguro); + } + } + x--; + } while (x > 0); + } + + @Override + @Transactional + public void aplicarArredondamentoTarifa(Integer orgaoConcedenteId, Boolean taxaEmbarque) { + tarifaOficialDAO.aplicarArredondamentoTarifa(orgaoConcedenteId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), taxaEmbarque); + } + + @Override + @Transactional + public void actualizacion(TarifaOficial tarifaOficial) { + try { + TarifaOficial originalClone = tarifaOficial.getCloneObject(); + tarifaOficialDAO.actualizacion(tarifaOficial); + logAuditoriaService.auditar(originalClone, tarifaOficial, tarifaOficial.getMarca() != null && tarifaOficial.getMarca().getEmpresa() != null ? tarifaOficial.getMarca().getEmpresa().getEmpresaId() : null); + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new RuntimeException(e.getMessage(), e); + } + } + + @Override + public TarifaOficial obtenerID(Integer tarifaOficialId) { + TarifaOficial tarifaOficial = tarifaOficialDAO.obtenerID(tarifaOficialId); + try { + tarifaOficial.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return tarifaOficial; + } + + @Override + @Transactional + public void borrar(TarifaOficial tarifaOficial) { + tarifaOficialDAO.borrar(tarifaOficial); + logAuditoriaService.auditarExclusao(tarifaOficial, tarifaOficial.getMarca() != null && tarifaOficial.getMarca().getEmpresa() != null ? tarifaOficial.getMarca().getEmpresa().getEmpresaId() : null); + } + + @Override + public long obtenerCount(List lstEmpresas){ + return tarifaOficialDAO.obtenerCount(lstEmpresas); + } + + @Override + @Transactional + public void atualizarPedagio() { + tarifaOficialDAO.atualizarPedagio(); + } + + @Override + public List obterTarifaOficialPorFiltro(Moneda moneda, Marca marca,List lsMarcas,Parada origem, Parada destino, ClaseServicio claseServicio, Ruta ruta, String numRuta, Boolean vende){ + return converterVo(tarifaOficialDAO.obterTarifaOficialPorFiltroVO(moneda, marca, lsMarcas, origem, destino, claseServicio, ruta, numRuta, vende)); + } + public List converterVo(List lsTarifaOficialVo){ + List lsTarifa= new ArrayList(); + TarifaOficial ta; + Parada origem; + Parada destino; + Tramo tramo; + Marca marca; + Via via; + + for(TarifaOficialVO t:lsTarifaOficialVo){ + ta= new TarifaOficial(); + ta.setTarifaOficialId(t.getTarifaoficialid()); + ta.setPrecio(t.getPrecio()); + ta.setPreciooriginal(t.getPreciooriginal()); + ta.setImportepedagio(t.getImportepedagio()); + ta.setImporteseguro(t.getImporteseguro()); + ta.setImportetaxaembarque(t.getImportetaxaembarque()); + ta.setImporteoutros(t.getImporteoutros()); + ta.setImportetpp(t.getImportetpp()); + origem = new Parada(); + origem.setDescparada(t.getDescparadaorigem()); + destino = new Parada(); + destino.setDescparada(t.getDescparadadestino()); + via =new Via(); + via.setNombvia(t.getNomevia()); + tramo = new Tramo(); + tramo.setOrigem(origem); + tramo.setDestino(destino); + tramo.setVia(via); + ta.setTramo(tramo); + marca= new Marca(); + marca.setDescmarca(t.getDescmarca()); + ta.setMarca(marca); + OrgaoConcedente or = new OrgaoConcedente(); + or.setDescOrgao(t.getDescorgao()); + ta.setOrgaoConcedente(or); + ClaseServicio cl = new ClaseServicio(); + cl.setDescclase(t.getDescclasse()); + ta.setClaseServicio(cl); + Ruta r = new Ruta(); + r.setPrefixo(t.getRutaprefixo()); + r.setNumRuta(t.getNumruta()); + ta.setRuta(r); + lsTarifa.add(ta); + + } + return lsTarifa; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java new file mode 100644 index 000000000..942463bf5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java @@ -0,0 +1,380 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TarifaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Moneda; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Plaza; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.entidad.TarifaCategoria; +import com.rjconsultores.ventaboletos.entidad.TarifaHist; +import com.rjconsultores.ventaboletos.entidad.TarifaMinima; +import com.rjconsultores.ventaboletos.entidad.TarifaTipoptovta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; +import com.rjconsultores.ventaboletos.service.MonedaService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.service.TarifaHistService; +import com.rjconsultores.ventaboletos.service.TarifaMinimaService; +import com.rjconsultores.ventaboletos.service.TarifaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.comissao.TarifaVO; + +/** + * + * @author rodrigo + */ +@Service("tarifaService") +public class TarifaServiceImpl implements TarifaService { + + @Autowired + private TarifaDAO tarifaDAO; + @Autowired + private TarifaHistService tarifaHistService; + @Autowired + private MonedaService monedaService; + @Autowired + private TarifaMinimaService tarifaMinimaService; + @Autowired + private RutaService rutaService; + + @Autowired + private LogAuditoriaService logAuditoriaService; + + private static Logger log = Logger.getLogger(TarifaServiceImpl.class); + + public List obtenerTodos() { + return tarifaDAO.obtenerTodos(); + } + + @Transactional(readOnly = true) + public Tarifa obtenerID(Integer id) { + Tarifa tarifa = tarifaDAO.obtenerID(id); + try { + tarifa.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return tarifa; + } + + private void cadastrarTarifaHistorico(Tarifa entidad) { + TarifaHist th = new TarifaHist(); + th.setActivo(entidad.getActivo()); + th.setClaseServicio(entidad.getClaseServicio()); + th.setFecmodif(entidad.getFecmodif()); + th.setMarca(entidad.getMarca()); + th.setMoneda(entidad.getMoneda()); + th.setPrecio(entidad.getPrecio()); + th.setPreciooriginal(entidad.getPreciooriginal()); + th.setStatustarifa(entidad.getStatustarifa()); + th.setUsuarioId(entidad.getUsuarioId()); + th.setVigenciaTarifa(entidad.getVigenciaTarifa()); + + th = tarifaHistService.suscribir(th); + } + + @Transactional + public Tarifa suscribir(Tarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + if (entidad.getPrecio() != null) { + entidad.setPrecio(entidad.getPrecio().setScale(2, RoundingMode.HALF_UP)); + } + if (entidad.getPreciooriginal() != null) { + entidad.setPreciooriginal(entidad.getPreciooriginal().setScale(2, RoundingMode.HALF_UP)); + } + if (entidad.getPrecioredabierto() != null) { + entidad.setPrecioredabierto(entidad.getPrecioredabierto().setScale(2, RoundingMode.HALF_UP)); + } + cadastrarTarifaHistorico(entidad); + + logAuditoriaService.auditar(null, entidad, entidad.getMarca() != null && entidad.getMarca().getEmpresa() != null ? entidad.getMarca().getEmpresa().getEmpresaId() : null); + + return tarifaDAO.suscribir(entidad); + + } + + @Transactional + public Tarifa actualizacion(Tarifa entidad) { + try { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + if (entidad.getPrecio() != null) { + entidad.setPrecio(entidad.getPrecio().setScale(2, RoundingMode.HALF_UP)); + } + if (entidad.getPreciooriginal() != null) { + entidad.setPreciooriginal(entidad.getPreciooriginal().setScale(2, RoundingMode.HALF_UP)); + } + if (entidad.getPrecioredabierto() != null) { + entidad.setPrecioredabierto(entidad.getPrecioredabierto().setScale(2, RoundingMode.HALF_UP)); + } + + // Rafael: Segundo a Letícia, não pode atualizar o DOLAR caso haja uma + // atualização de preço, os dolores somente são gerados na inclusão de preço. + + // Tarifa tarifa = this.obtenerID(entidad.getTarifaId()); + // entidad.setLsTarifaCategoria(tarifa.getLsTarifaCategoria()); + // entidad.setLsTarifaTipoptovta(tarifa.getLsTarifaTipoptovta()); + + cadastrarTarifaHistorico(entidad); + // cadastrarTarifaMonedaEstrangeira(entidad); + + + Tarifa originalClone = entidad.getCloneObject(); + + tarifaDAO.updateTarifa(entidad); + + logAuditoriaService.auditar(originalClone, entidad, entidad.getMarca() != null && entidad.getMarca().getEmpresa() != null ? entidad.getMarca().getEmpresa().getEmpresaId() : null); + + return entidad; + + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new RuntimeException(e.getMessage(), e); + } + } + + @Transactional + public void borrar(Tarifa entidad) { + for (TarifaCategoria pricing : entidad.getLsTarifaCategoria()) { + pricing.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricing.setFecmodif(Calendar.getInstance().getTime()); + pricing.setActivo(Boolean.FALSE); + } + + for (TarifaTipoptovta pricing : entidad.getLsTarifaTipoptovta()) { + pricing.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + pricing.setFecmodif(Calendar.getInstance().getTime()); + pricing.setActivo(Boolean.FALSE); + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + cadastrarTarifaHistorico(entidad); + + logAuditoriaService.auditarExclusao(entidad, entidad.getMarca() != null && entidad.getMarca().getEmpresa() != null ? entidad.getMarca().getEmpresa().getEmpresaId() : null); + + tarifaDAO.actualizacion(entidad); + } + + public boolean existe(Marca marca, Tramo tramo, Moneda moneda, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Ruta ruta, OrgaoConcedente orgaoConcedente) { + return tarifaDAO.existe(marca, tramo, moneda, claseServicio, vigenciaTarifa, ruta, orgaoConcedente); + } + + public List pesquisar(Marca marca, Parada origem, Parada destino, Moneda moneda, + ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, + Categoria categoria, TipoPuntoVenta tipoPuntoVenta) { + return tarifaDAO.pesquisar(marca, origem, destino, moneda, claseServicio, vigenciaTarifa, + categoria, tipoPuntoVenta); + } + + public Tarifa buscar(Tramo tramo, Marca marca, ClaseServicio claseServicio, + VigenciaTarifa vigenciaTarifa, Moneda moneda, Ruta ruta) { + return tarifaDAO.buscar(tramo, marca, claseServicio, vigenciaTarifa, moneda, ruta); + } + + public List buscarPorVigencia(VigenciaTarifa vigencia, Empresa empresa) { + return tarifaDAO.buscarTarifasAtivasInativasPorVigencia(vigencia, empresa); + } + + public Boolean podeAlterarTarifaMinima(Tarifa tarifa, Marca marca, Parada origem, + Parada destino, ClaseServicio claseServicio, Plaza plaza, Moneda moneda) { + + Boolean podeAlterarTarifaMinima = Boolean.TRUE; + + List lsTarifaMinima = tarifaMinimaService.pesquisarEspecifico(marca, origem, destino, claseServicio, moneda); + + if (lsTarifaMinima.isEmpty()) { + lsTarifaMinima = tarifaMinimaService.pesquisarOrigemDestinoTodos(marca, origem, destino, claseServicio, moneda); + } + + log.debug("Moneda : " + moneda.getDescmoneda()); + log.debug("Preço : " + tarifa.getPrecio()); + + for (TarifaMinima tm : lsTarifaMinima) { + if (tarifa.getPrecio().compareTo(tm.getImportetarifa()) == -1) { + podeAlterarTarifaMinima = Boolean.FALSE; + log.debug("Tarifa Minima ID: " + tm.getTarifaminimaId()); + log.debug("Tarifa Minima Origen : " + tm.getOrigem().getDescparada()); + log.debug("Tarifa Minima Destino: " + tm.getDestino().getDescparada()); + log.debug("Tarifa Minima Marca : " + tm.getMarca().getDescmarca()); + log.debug("Tarifa Minima Clase : " + tm.getClaseServicio().getDescclase()); + log.debug("Tarifa Minima Moneda : " + tm.getMoneda().getDescmoneda()); + log.debug("Tarifa Minima : " + tm.getImportetarifa() + " Valor Alterado: " + tarifa.getPrecio()); + } + } + + return podeAlterarTarifaMinima; + } + + public List buscarExisteVigencia(VigenciaTarifa vigenciaTarifa) { + return tarifaDAO.buscarTarifasAtivasPorVigencia(vigenciaTarifa); + } + + // Metodo para gerar todas as tarifas possiveis + @Transactional + public Boolean generarTarifas(VigenciaTarifa vigencia, Marca marca) { + + // Lista de Rutas + List lsRuta = rutaService.obtenerTodos(); + try { + for (Ruta r : lsRuta) { + Ruta ruta = rutaService.obtenerID(r.getRutaId()); + + // Lista de Combinações + List lsRutaCombinacion = ruta.getRutaCombinacionList(); + for (RutaCombinacion rc : lsRutaCombinacion) { + + Tarifa tarifa = new Tarifa(); + // Valor de 6 Pesos por Default + tarifa.setPrecio(BigDecimal.valueOf(6)); + tarifa.setPreciooriginal(BigDecimal.ZERO); + // Pesos Mexicano + tarifa.setMoneda(monedaService.obtenerID(1)); + // Marca... informado antes + // Vigencia... informado antes + tarifa.setVigenciaTarifa(vigencia); + tarifa.setMarca(marca); + + tarifa.setClaseServicio(r.getClaseServicio()); + tarifa.setTramo(rc.getTramo()); + + // Tramo-Marca-Classe-Vigencia-Moneda + boolean existe = tarifaDAO.existe(tarifa.getMarca(), tarifa.getTramo(), tarifa.getMoneda(), tarifa.getClaseServicio(), tarifa.getVigenciaTarifa(), tarifa.getRuta(), tarifa.getOrgaoConcedente()); + + if (!existe) { + tarifa.setFecmodif(Calendar.getInstance().getTime()); + tarifa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tarifa.setActivo(Boolean.TRUE); + tarifa.setStatustarifa("L"); + + log.debug("Tarifa: Ruta " + ruta.getDescruta() + " - " + ruta.getRutaId() + " Tramo: " + tarifa.getTramo().getTramoId() + + " Marca " + marca + " Vigencia: " + vigencia); + + tarifa = tarifaDAO.suscribir(tarifa); + + logAuditoriaService.auditar(null, tarifa, tarifa.getMarca() != null && tarifa.getMarca().getEmpresa() != null ? tarifa.getMarca().getEmpresa().getEmpresaId() : null); + } + } + } + } catch (Exception e) { + log.debug("ERRO al generar tarifas", e); + return false; + } + return true; + } + + @Override + public boolean buscarTarifaExisteTramo(Tramo tramo) { + return tarifaDAO.buscarTarifaExisteTramo(tramo); + } + + @Override + public void copiarTarifas(VigenciaTarifa vigenciaTarifaOrigem, VigenciaTarifa vigenciaTarifaDestino, Empresa empresa, boolean excluirTarifasDestino) throws BusinessException { + tarifaDAO.copiarTarifas(vigenciaTarifaOrigem, vigenciaTarifaDestino, empresa, excluirTarifasDestino); + } + + @Override + public boolean existeTarifas(VigenciaTarifa vigenciaTarifa) { + return tarifaDAO.existeTarifas(vigenciaTarifa); + } + + @Override + public void excluirTodasTarifas(Moneda moneda, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Parada origem, + Parada destino, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via, Boolean vende){ + tarifaDAO.excluirTodasTarifas(moneda, marca, claseServicio, vigenciaTarifa, origem, destino, categoria, tipoPuntoVenta, ruta, via, vende, UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + @Override + public List obterTarifaOficialPorFiltro(Moneda moneda, Marca marca, List lsMarcas, Parada origem, Parada destino, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via, Boolean vende) { + return converterVo(tarifaDAO.obterTarifaOficialPorFiltroVO(moneda, marca, lsMarcas, origem, destino, claseServicio, vigenciaTarifa, categoria, tipoPuntoVenta, ruta, via, vende)); + + } + + public List converterVo(List lsTarifaVo){ + List lsTarifa= new ArrayList(); + Tarifa ta; + Parada origem; + Parada destino; + Tramo tramo; + Marca marca; + Via via; + VigenciaTarifa vi; + + for(TarifaVO t:lsTarifaVo){ + ta= new Tarifa(); + ta.setTarifaId(t.getTarifaid()); + ta.setPrecio(t.getPrecio()); + ta.setPreciooriginal(t.getPreciooriginal()); + ta.setImportepedagio(t.getImportepedagio()); + ta.setImporteseguro(t.getImporteseguro()); + ta.setImportetaxaembarque(t.getImportetaxaembarque()); + ta.setImporteoutros(t.getImporteoutros()); + ta.setStatustarifa(t.getStatustarifa()); + ta.setImporteTPP(t.getImportetpp()); + origem = new Parada(); + origem.setDescparada(t.getDescparadaOrigem()); + destino = new Parada(); + destino.setDescparada(t.getDescparadaDestino()); + via =new Via(); + via.setNombvia(t.getNomeVia()); + tramo = new Tramo(); + tramo.setOrigem(origem); + tramo.setDestino(destino); + tramo.setVia(via); + ta.setTramo(tramo); + marca= new Marca(); + marca.setDescmarca(t.getDescMarca()); + ta.setMarca(marca); + vi= new VigenciaTarifa(); + vi.setFeciniciovigencia(t.getFeciniciovigencia()); + vi.setFecfinvigencia(t.getFecfimvigencia()); + ta.setVigenciaTarifa(vi); + OrgaoConcedente or = new OrgaoConcedente(); + or.setDescOrgao(t.getDescorgao()); + ta.setOrgaoConcedente(or); + ClaseServicio cl = new ClaseServicio(); + cl.setDescclase(t.getDescclasse()); + ta.setClaseServicio(cl); + Ruta r = new Ruta(); + r.setPrefixo(t.getRutaprefixo()); + r.setNumRuta(t.getNumruta()); + ta.setRuta(r); + lsTarifa.add(ta); + + + } + return lsTarifa; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaTipoptovtaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaTipoptovtaServiceImpl.java new file mode 100644 index 000000000..b9f1352b9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaTipoptovtaServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TarifaTipoptovtaDAO; +import com.rjconsultores.ventaboletos.entidad.TarifaTipoptovta; +import com.rjconsultores.ventaboletos.service.TarifaTipoptovtaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("tarifaTipoptovtaService") +public class TarifaTipoptovtaServiceImpl implements TarifaTipoptovtaService { + + @Autowired + private TarifaTipoptovtaDAO tarifaTipoptovtaDAO; + + public List obtenerTodos() { + return tarifaTipoptovtaDAO.obtenerTodos(); + } + + public TarifaTipoptovta obtenerID(Integer id) { + return tarifaTipoptovtaDAO.obtenerID(id); + } + + @Transactional + public TarifaTipoptovta suscribir(TarifaTipoptovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaTipoptovtaDAO.suscribir(entidad); + } + + @Transactional + public TarifaTipoptovta actualizacion(TarifaTipoptovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarifaTipoptovtaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarifaTipoptovta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tarifaTipoptovtaDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarjetaCreditoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarjetaCreditoServiceImpl.java new file mode 100644 index 000000000..9326b507a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarjetaCreditoServiceImpl.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TarjetaCreditoDAO; +import com.rjconsultores.ventaboletos.entidad.TarjetaCredito; +import com.rjconsultores.ventaboletos.service.TarjetaCreditoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tarjetaCreditoService") +public class TarjetaCreditoServiceImpl implements TarjetaCreditoService { + + @Autowired + private TarjetaCreditoDAO tarjetaCreditoDAO; + + public List obtenerTodos() { + return tarjetaCreditoDAO.obtenerTodos(); + } + + public TarjetaCredito obtenerID(Integer id) { + return tarjetaCreditoDAO.obtenerID(id); + } + + @Transactional + public TarjetaCredito suscribir(TarjetaCredito entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarjetaCreditoDAO.suscribir(entidad); + } + + @Transactional + public TarjetaCredito actualizacion(TarjetaCredito entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tarjetaCreditoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarjetaCredito entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tarjetaCreditoDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarjetaFidelidadServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarjetaFidelidadServiceImpl.java new file mode 100644 index 000000000..9e0c53fc1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarjetaFidelidadServiceImpl.java @@ -0,0 +1,74 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TarjetaFidelidadDAO; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad; +import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidadCuenta; +import com.rjconsultores.ventaboletos.service.TarjetaFidelidadService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("tarjetaFidelidadService") +public class TarjetaFidelidadServiceImpl implements TarjetaFidelidadService { + + @Autowired + private TarjetaFidelidadDAO fidelidadDAO; + + public List obtenerTodos() { + return fidelidadDAO.obtenerTodos(); + } + + public TarjetaFidelidad obtenerID(Integer id) { + return fidelidadDAO.obtenerID(id); + } + + public TarjetaFidelidad obtenerNumTarjeta(Integer numTarjeta){ + return fidelidadDAO.obtenerNumTarjeta(numTarjeta); + } + + @Transactional + public TarjetaFidelidad suscribir(TarjetaFidelidad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return fidelidadDAO.suscribir(entidad); + } + + @Transactional + public TarjetaFidelidad actualizacion(TarjetaFidelidad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return fidelidadDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarjetaFidelidad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + fidelidadDAO.actualizacion(entidad); + } + + public List obtenerCantDesc() { + return fidelidadDAO.obtenerCantDesc(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarjetaRecaudacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarjetaRecaudacionServiceImpl.java new file mode 100644 index 000000000..357b4c1b1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarjetaRecaudacionServiceImpl.java @@ -0,0 +1,48 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TarjetaRecaudacionDAO; +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacion; +import com.rjconsultores.ventaboletos.entidad.TarjetaRecaudacionPK; +import com.rjconsultores.ventaboletos.service.TarjetaRecaudacionService; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tarjetaRecaudacionService") +public class TarjetaRecaudacionServiceImpl implements TarjetaRecaudacionService { + + @Autowired + private TarjetaRecaudacionDAO tarjetaRecaudacionDAO; + + public List obtenerTodos() { + return tarjetaRecaudacionDAO.obtenerTodos(); + } + + public TarjetaRecaudacion obtenerID(TarjetaRecaudacionPK id) { + return tarjetaRecaudacionDAO.obtenerID(id); + } + + @Transactional + public TarjetaRecaudacion suscribir(TarjetaRecaudacion entidad) { + return tarjetaRecaudacionDAO.suscribir(entidad); + } + + @Transactional + public TarjetaRecaudacion actualizacion(TarjetaRecaudacion entidad) { + return tarjetaRecaudacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarjetaRecaudacion entidad) { + tarjetaRecaudacionDAO.borrar(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarjetaViajeServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarjetaViajeServiceImpl.java new file mode 100644 index 000000000..ddc9379f9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarjetaViajeServiceImpl.java @@ -0,0 +1,265 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.zkoss.zul.Comboitem; + +import com.rjconsultores.ventaboletos.dao.CorridaTramoDAO; +import com.rjconsultores.ventaboletos.dao.TarjetaViajeDAO; +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; +import com.rjconsultores.ventaboletos.entidad.RhPagoConductor; +import com.rjconsultores.ventaboletos.entidad.TarjetaViaje; +import com.rjconsultores.ventaboletos.service.CorridaService; +import com.rjconsultores.ventaboletos.service.RhPagoConductorService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.service.TarjetaViajeService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tarjetaViajeService") +public class TarjetaViajeServiceImpl implements TarjetaViajeService { + + @Autowired + private TarjetaViajeDAO tarjetaViajeDAO; + @Autowired + private CorridaTramoDAO corridaTramoDAO; + @Autowired + private CorridaService corridaService; + @Autowired + private RhPagoConductorService rhPagoConductorService; + @Autowired + private RutaService rutaService; + private static Logger log = Logger.getLogger(TarjetaViajeServiceImpl.class); + + @Override + public List obtenerTodos() { + return tarjetaViajeDAO.obtenerTodos(); + } + + @Override + public TarjetaViaje obtenerID(Integer id) { + return tarjetaViajeDAO.obtenerID(id); + } + + @Transactional + public TarjetaViaje suscribir(TarjetaViaje entidad) { + entidad.setActivo(true); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return tarjetaViajeDAO.suscribir(entidad); + } + + @Transactional + public TarjetaViaje actualizacion(TarjetaViaje entidad) { + entidad.setActivo(true); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return tarjetaViajeDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TarjetaViaje entidad) { + if (entidad.getIndstatustarjeta().equals("M")) { + tarjetaViajeDAO.borrar(entidad); + } else { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(false); + entidad.setIndstatustarjeta("B"); + tarjetaViajeDAO.actualizacion(entidad); + } + } + + @Transactional + public void grabarTarjetaViaje(List lsCorridaTramo) { + try { + TarjetaViaje tarjeta = null; + for (CorridaTramo ct : lsCorridaTramo) { + + if (ct.getCorrida() == null) { + log.debug("Corrida Tramo sem Corrida: " + ct.getCorridatramoId()); + continue; + } + + tarjeta = new TarjetaViaje(); + tarjeta.setActivo(true); + if (ct.getCorrida().getCorridaRebote() != null) { + tarjeta.setIndRebote(1); + } else { + tarjeta.setIndRebote(0); + } + tarjeta.setFecenvionomina(null); + tarjeta.setFecmodif(new Date()); + tarjeta.setFoliotarjetaviaje(ct.getFolioTarjeta() == null ? null : ct.getFolioTarjeta().toString());// checar + tarjeta.setIndstatustarjeta("N"); + tarjeta.setNumsecuencia(ct.getNumsecuencia() != null ? Integer.getInteger(ct.getNumsecuencia().toString()) : null); + tarjeta.setUsuarioId(ct.getUsuarioId()); + tarjeta.setAutobus(ct.getAutobus()); + tarjeta.setClaseServicio(ct.getCorrida().getClaseServicio()); + tarjeta.setConductor(ct.getConductor()); + tarjeta.setConductor1(ct.getConductor1()); + tarjeta.setEmpresa(ct.getCorrida().getEmpresa()); + tarjeta.setMarca(ct.getCorrida().getMarca()); + + tarjeta.setFecInicial(ct.getCorrida().getId().getFeccorrida()); + tarjeta.setFecHorSalida(ct.getCorrida().getFechorsalida()); + + tarjeta.setNumCorrida(ct.getCorrida().getId().getCorridaId()); + + BigDecimal kmPagoCondutor = new BigDecimal(BigInteger.ZERO); + BigDecimal kmReal = new BigDecimal(BigInteger.ZERO); +// BigDecimal teste = corridaTramoDAO.buscarSumTarjetaMesmaCorrida(ct); +// tarjeta.setKmPagoConductor(teste); +// tarjeta.setKmReal(teste); +// + List lsCorridasAdicionais = corridaTramoDAO.buscarTarjetaMesmaCorrida(ct); + if (!lsCorridasAdicionais.isEmpty()) { + for (CorridaTramo ct2 : lsCorridasAdicionais) { + if (ct2.getTramo() == null) { + log.debug("Corrida Tramo Sem Tramo: " + ct2.getCorridatramoId().toString()); + continue; + } + if (ct2.getTramo().getKmPagoConductor() != null) { + + log.debug("Corrida Tramo Id: " + ct2.getCorridatramoId().toString()); + kmPagoCondutor = kmPagoCondutor.add(ct2.getTramo().getKmPagoConductor()); + kmReal = kmReal.add(ct2.getTramo().getKmReal()); + } + } + } + + tarjeta.setKmPagoConductor(kmPagoCondutor); + tarjeta.setKmReal(kmReal); + + //Origem Destino Inicial e Final da Corrida + Corrida corrida = ct.getCorrida(); + tarjeta.setOrigen(corrida.getOrigem().getCveparada()); + tarjeta.setDestino(corrida.getDestino().getCveparada()); + + tarjetaViajeDAO.suscribir(tarjeta); + ct.setIndmanttarjeta(true); + corridaTramoDAO.actualizacion(ct); + + } + } catch (Exception e) { + log.error("Geracao de Tarjetas"); + log.error(e); + } + } + + @Override + public void verificaCorridaDuplicada(List lsTarjetaViaje, boolean todasTarjetas) { + + for (TarjetaViaje t : lsTarjetaViaje) { + List ls = tarjetaViajeDAO.buscarTarjetaPorFiltros(t); + if (ls.size() > 1) { + //Vermelho + t.seteCorridaDuplicada(true); + + //Esse teste checa se houve uma volta para o autobus/condutor, + //Se teve volta a TarjetaViaje tem que ser preta + boolean existeCorridaVolta = tarjetaViajeDAO.buscarTarjetaExisteVolta(t); + + //Se não existe corrida de volta Vermelho + t.seteCorridaDuplicada(!existeCorridaVolta); + } + } + + } + + @Override + public List buscarTarjetaPorFiltros(Integer autoIni, + Integer autoFin, Date dataIni, Date dataFin, Comboitem empresa) { + + return tarjetaViajeDAO.buscarTarjetaPorFiltros(autoIni, autoFin, + dataIni, dataFin, empresa); + } + + @Override + public List generarArchivoNomina(Date fecIni, Date fecFin) { + Calendar c = Calendar.getInstance(); + c.setTime(fecFin); + c.add(Calendar.HOUR, 23); + c.add(Calendar.MINUTE, 59); + c.add(Calendar.SECOND, 59); + fecFin = c.getTime(); + List lsTarjetas = tarjetaViajeDAO.buscarTarjetasParaEnvioNomina(fecIni, fecFin); + + try { + for (TarjetaViaje tv : lsTarjetas) { + RhPagoConductor rh = new RhPagoConductor(); + + Corrida.Id id = new Corrida.Id(); + id.setCorridaId(tv.getNumCorrida()); + id.setFeccorrida(tv.getFecInicial()); + Corrida corrida = corridaService.obtenerID(id); + + if (tv.getAutobus() != null) { + rh.setNumautobus(Integer.parseInt(tv.getAutobus().getNumautobus())); + } + rh.setNumcorrida(tv.getNumCorrida()); + rh.setFechorsalida(tv.getFecHorSalida()); + + rh.setCantkmsoperador1(tv.getKmPagoConductor()); + rh.setCantkmsoperador2(tv.getKmPagoConductor()); + + if (tv.getConductor() != null) { + if (tv.getConductor().getEmpleado() != null) { + rh.setCveoperador1(tv.getConductor().getEmpleado().getCveEmpleado()); + rh.setNombreoperador1(tv.getConductor().getEmpleado().getNombEmpleado()); + } + } + if (tv.getConductor1() != null) { + if (tv.getConductor1().getEmpleado() != null) { + rh.setCveoperador2(tv.getConductor1().getEmpleado().getCveEmpleado()); + rh.setNombreoperador2(tv.getConductor1().getEmpleado().getNombEmpleado()); + } + } + if (tv.getMarca() != null) { + rh.setMarca(tv.getMarca().getMarcaId()); + } + if (corrida != null) { + if (corrida.getRuta() != null) { + rh.setRuta(corrida.getRuta().getRutaId()); + String descRuta = corrida.getRuta().getDescruta(); + rh.setDescruta(descRuta.length() > 29 ? descRuta.substring(0, 30) : descRuta); + rh.setCveOrigen(rutaService.getOrigem(corrida.getRuta()).getCveparada()); + rh.setCveDestino(rutaService.getDestino(corrida.getRuta()).getCveparada()); + } + + boolean pisoExtra = (corrida.getNumPiso() == null) ? false + : corrida.getNumPiso() == 2 ? true : false; + rh.setIndextra(pisoExtra); + } + log.debug("RH_SALIDAS: NUMAUTOBUS: " + rh.getNumautobus() + " NUMCORRIDA: " + rh.getNumcorrida() + + " DESCRUTA: " + rh.getDescruta() + " FECHORSALIDA: " + rh.getFechorsalida() + + " CVEOPERADOR1: " + rh.getCveoperador1() + " NOMBREOPERADOR1: " + rh.getNombreoperador1() + " CANTKMSOPERADOR1: " + rh.getCantkmsoperador1() + + " CVEOPERADOR2: " + rh.getCveoperador2() + " NOMBREOPERADOR2: " + rh.getNombreoperador2() + " CANTKMSOPERADOR2: " + rh.getCantkmsoperador2() + + " INDEXTRA: " + rh.getIndextra() + " CVEORIGEN: " + rh.getCveOrigen() + " CVEDESTINO: " + rh.getCveDestino() + " RUTA_ID: " + rh.getRuta()); + rhPagoConductorService.suscribir(rh); + } + + } catch (Exception e) { + log.error(e); + return null; + } + + return lsTarjetas; + } + + @Transactional + public void actulizarTarjetasEnviadas(List lsTarjetas) { + for (TarjetaViaje tarjeta : lsTarjetas) { + tarjeta.setFecenvionomina(new Date()); + tarjetaViajeDAO.actualizacion(tarjeta); + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbLevanteCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbLevanteCtrlServiceImpl.java new file mode 100644 index 000000000..7319bbc96 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbLevanteCtrlServiceImpl.java @@ -0,0 +1,61 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TaxaEmbLevanteCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbLevanteCtrl; +import com.rjconsultores.ventaboletos.service.TaxaEmbLevanteCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("taxaEmbLevanteCtrlService") +public class TaxaEmbLevanteCtrlServiceImpl implements TaxaEmbLevanteCtrlService { + + @Autowired + private TaxaEmbLevanteCtrlDAO taxaEmbLevanteCtrlDAO; + + @Override + public List obtenerTodos() { + return taxaEmbLevanteCtrlDAO.obtenerTodos(); + } + + @Override + public TaxaEmbLevanteCtrl obtenerID(Integer id) { + return taxaEmbLevanteCtrlDAO.obtenerID(id); + } + + @Transactional + public TaxaEmbLevanteCtrl suscribir(TaxaEmbLevanteCtrl entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return taxaEmbLevanteCtrlDAO.suscribir(entidad); + } + + @Transactional + public TaxaEmbLevanteCtrl actualizacion(TaxaEmbLevanteCtrl entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return taxaEmbLevanteCtrlDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TaxaEmbLevanteCtrl entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + taxaEmbLevanteCtrlDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueKmServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueKmServiceImpl.java new file mode 100644 index 000000000..0584ff027 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueKmServiceImpl.java @@ -0,0 +1,62 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TaxaEmbarqueKmDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueKm; +import com.rjconsultores.ventaboletos.service.TaxaEmbarqueKmService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("taxaEmbarqueKmService") +public class TaxaEmbarqueKmServiceImpl implements TaxaEmbarqueKmService { + + @Autowired + private TaxaEmbarqueKmDAO taxaEmbarqueKmDAO; + + public List obtenerTodos() { + return taxaEmbarqueKmDAO.obtenerTodos(); + } + + public TaxaEmbarqueKm obtenerID(Integer id) { + return taxaEmbarqueKmDAO.obtenerID(id); + } + + @Transactional + public TaxaEmbarqueKm suscribir(TaxaEmbarqueKm entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return taxaEmbarqueKmDAO.suscribir(entidad); + } + + @Transactional + public TaxaEmbarqueKm actualizacion(TaxaEmbarqueKm entidad) { + return taxaEmbarqueKmDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TaxaEmbarqueKm entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + taxaEmbarqueKmDAO.borrar(entidad); + } + + public List buscarPorOrgao(OrgaoConcedente orgaoconcedenteId) { + return taxaEmbarqueKmDAO.buscarPorOrgao(orgaoconcedenteId); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueParadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueParadaServiceImpl.java new file mode 100644 index 000000000..573e7b8ac --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TaxaEmbarqueParadaServiceImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TaxaEmbarqueParadaDAO; +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada; +import com.rjconsultores.ventaboletos.service.TaxaEmbarqueParadaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.TaxaEmbarqueW2i; + +import java.sql.SQLException; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Desenvolvimento + */ +@Service("taxaEmbarqueParadaService") +public class TaxaEmbarqueParadaServiceImpl implements TaxaEmbarqueParadaService { + + @Autowired + private TaxaEmbarqueParadaDAO taxaEmbarqueParadaDAO; + + public List obtenerTodos() { + return taxaEmbarqueParadaDAO.obtenerTodos(); + } + + public TaxaEmbarqueParada obtenerID(Integer id) { + return taxaEmbarqueParadaDAO.obtenerID(id); + } + + @Transactional + public TaxaEmbarqueParada suscribir(TaxaEmbarqueParada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return taxaEmbarqueParadaDAO.suscribir(entidad); + } + + @Transactional + public TaxaEmbarqueParada actualizacion(TaxaEmbarqueParada entidad) { + return taxaEmbarqueParadaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TaxaEmbarqueParada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + taxaEmbarqueParadaDAO.borrar(entidad); + } + + public List buscarPorLocalidade(Parada parada) { + return taxaEmbarqueParadaDAO.buscarPorLocalidade(parada); + } + + public List buscarEstoqueTaxaEmbarque(Parada origem, Empresa empresa, String txtKm, OrgaoConcedente orgao, Categoria categoria) throws SQLException { + return taxaEmbarqueParadaDAO.buscarEstoqueTaxaEmbarque(origem, empresa, txtKm, orgao, categoria); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCiudadServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCiudadServiceImpl.java new file mode 100644 index 000000000..95a68d6f8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCiudadServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoCambioCiudadDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCambioCiudad; +import com.rjconsultores.ventaboletos.service.TipoCambioCiudadService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoCambioCiudadService") +public class TipoCambioCiudadServiceImpl implements TipoCambioCiudadService { + + @Autowired + private TipoCambioCiudadDAO tipoCambioCiudadDAO; + + public List obtenerTodos() { + return tipoCambioCiudadDAO.obtenerTodos(); + } + + public TipoCambioCiudad obtenerID(Integer id) { + return tipoCambioCiudadDAO.obtenerID(id); + } + + @Transactional + public TipoCambioCiudad suscribir(TipoCambioCiudad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCambioCiudadDAO.suscribir(entidad); + } + + @Transactional + public TipoCambioCiudad actualizacion(TipoCambioCiudad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCambioCiudadDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoCambioCiudad entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoCambioCiudadDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCtrlServiceImpl.java new file mode 100644 index 000000000..0f4ffa092 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoCambioCtrlServiceImpl.java @@ -0,0 +1,68 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoCambioCtrlDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCambioCiudad; +import com.rjconsultores.ventaboletos.entidad.TipoCambioCtrl; +import com.rjconsultores.ventaboletos.service.TipoCambioCtrlService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoCambioCtrlService") +public class TipoCambioCtrlServiceImpl implements TipoCambioCtrlService { + + @Autowired + private TipoCambioCtrlDAO tipoCambioCtrlDAO; + + public List obtenerTodos() { + return tipoCambioCtrlDAO.obtenerTodos(); + } + + public TipoCambioCtrl obtenerID(Integer id) { + return tipoCambioCtrlDAO.obtenerID(id); + } + + @Transactional + public TipoCambioCtrl suscribir(TipoCambioCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCambioCtrlDAO.suscribir(entidad); + } + + @Transactional + public TipoCambioCtrl actualizacion(TipoCambioCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCambioCtrlDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoCambioCtrl entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + for (TipoCambioCiudad tcc : entidad.getTipoCambioCiudadList()) { + tcc.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tcc.setFecmodif(Calendar.getInstance().getTime()); + tcc.setActivo(Boolean.FALSE); + } + + tipoCambioCtrlDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoConvenioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoConvenioServiceImpl.java new file mode 100644 index 000000000..be9301e07 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoConvenioServiceImpl.java @@ -0,0 +1,63 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoConvenioDAO; +import com.rjconsultores.ventaboletos.entidad.TipoConvenio; +import com.rjconsultores.ventaboletos.service.TipoConvenioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("tipoConvenioService") +public class TipoConvenioServiceImpl implements TipoConvenioService{ + + @Autowired + private TipoConvenioDAO tcdao; + + public List obtenerTodos() { + return tcdao.obtenerTodos(); + } + + public TipoConvenio obtenerID(Integer id) { + return tcdao.obtenerID(id); + } + + @Transactional + public TipoConvenio suscribir(TipoConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tcdao.suscribir(entidad); + } + + @Transactional + public TipoConvenio actualizacion(TipoConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tcdao.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoConvenio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tcdao.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoCorteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoCorteServiceImpl.java new file mode 100644 index 000000000..64f8fbdd8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoCorteServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoCorteDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCorte; +import com.rjconsultores.ventaboletos.service.TipoCorteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoCorteService") +public class TipoCorteServiceImpl implements TipoCorteService { + + @Autowired + private TipoCorteDAO tipoCorteDAO; + + public List obtenerTodos() { + return tipoCorteDAO.obtenerTodos(); + } + + public TipoCorte obtenerID(Integer id) { + return tipoCorteDAO.obtenerID(id); + } + + @Transactional + public TipoCorte suscribir(TipoCorte entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCorteDAO.suscribir(entidad); + } + + @Transactional + public TipoCorte actualizacion(TipoCorte entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCorteDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoCorte entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoCorteDAO.actualizacion(entidad); + } + + public List buscar(String desctipo) { + return tipoCorteDAO.buscar(desctipo); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaDescuentoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaDescuentoServiceImpl.java new file mode 100644 index 000000000..56c6dc915 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaDescuentoServiceImpl.java @@ -0,0 +1,94 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoCortesiaDescuentoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import com.rjconsultores.ventaboletos.entidad.TipoCortesiaDescuento; +import com.rjconsultores.ventaboletos.service.TipoCortesiaDescuentoService; +import com.rjconsultores.ventaboletos.service.TipoCortesiaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("tipoCortesiaDService") +public class TipoCortesiaDescuentoServiceImpl implements TipoCortesiaDescuentoService { + + @Autowired + private TipoCortesiaDescuentoDAO tipoCortesiaDescuentoDAO; + @Autowired + private TipoCortesiaService tcDAO; + + public List obtenerTodos() { + return tipoCortesiaDescuentoDAO.obtenerTodos(); + } + + public TipoCortesiaDescuento obtenerID(Integer id) { + return tipoCortesiaDescuentoDAO.obtenerID(id); + } + + @Transactional + public TipoCortesiaDescuento suscribir(TipoCortesiaDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCortesiaDescuentoDAO.suscribir(entidad); + } + + @Transactional + public TipoCortesiaDescuento actualizacion(TipoCortesiaDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCortesiaDescuentoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoCortesiaDescuento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoCortesiaDescuentoDAO.actualizacion(entidad); + } + + public List pesquisar(TipoCortesia tipoCortesia) { + + return tipoCortesiaDescuentoDAO.pesquisar(tipoCortesia); + + } + + public List Onchangue(TipoCortesia tp) { + List tc = tcDAO.obtenerTodos(); + TipoCortesia Tcselec = null; + for (TipoCortesia tpc : tc) { + + if (tpc.getTipocortesiaId().equals(tp.getTipocortesiaId())) { + Tcselec = tpc; + } + } + + return tipoCortesiaDescuentoDAO.Onchangue(Tcselec); + } + + public List buscar(BigDecimal porcentaje, + TipoCortesia tipoCortesia) { + return tipoCortesiaDescuentoDAO.buscar(porcentaje, tipoCortesia); + } + + public List obtenerTipoCortesia(int i) { + return tipoCortesiaDescuentoDAO.obtenerTipoCortesia(i); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaServiceImpl.java new file mode 100644 index 000000000..ce104fbb6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoCortesiaServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoCortesiaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoCortesia; +import com.rjconsultores.ventaboletos.service.TipoCortesiaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Shiro + */ +@Service("tipoCortesiaService") +public class TipoCortesiaServiceImpl implements TipoCortesiaService { + + @Autowired + private TipoCortesiaDAO tipoCortesiaDAO; + + public List obtenerTodos() { + return tipoCortesiaDAO.obtenerTodos(); + } + + public TipoCortesia obtenerID(Integer id) { + return tipoCortesiaDAO.obtenerID(id); + } + + @Transactional + public TipoCortesia suscribir(TipoCortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCortesiaDAO.suscribir(entidad); + } + + @Transactional + public TipoCortesia actualizacion(TipoCortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoCortesiaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoCortesia entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoCortesiaDAO.actualizacion(entidad); + } + + public List buscar(String descTipo) { + return tipoCortesiaDAO.buscar(descTipo); + } + + public List obtenerGrupoCortesia(int i) { + return tipoCortesiaDAO.obtenerGrupoCortesia(i); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoDocAutobusServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoDocAutobusServiceImpl.java new file mode 100644 index 000000000..9e6248c3a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoDocAutobusServiceImpl.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TipoDocAutobusDAO; +import com.rjconsultores.ventaboletos.entidad.TipoDocAutobus; +import com.rjconsultores.ventaboletos.service.TipoDocAutobusService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tipoDocAutobusService") +public class TipoDocAutobusServiceImpl implements TipoDocAutobusService { + + @Autowired + private TipoDocAutobusDAO tipoDocAutobusDAO; + + @Override + public List obtenerTodos() { + return tipoDocAutobusDAO.obtenerTodos(); + } + + @Override + public TipoDocAutobus obtenerID(Integer id) { + return tipoDocAutobusDAO.obtenerID(id); + } + + @Transactional + public TipoDocAutobus suscribir(TipoDocAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoDocAutobusDAO.suscribir(entidad); + } + + @Transactional + public TipoDocAutobus actualizacion(TipoDocAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoDocAutobusDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoDocAutobus entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoDocAutobusDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoDomicilioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoDomicilioServiceImpl.java new file mode 100644 index 000000000..3df08d768 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoDomicilioServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoDomicilioDAO; +import com.rjconsultores.ventaboletos.entidad.TipoDomicilio; +import com.rjconsultores.ventaboletos.service.TipoDomicilioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoDomicilioService") +public class TipoDomicilioServiceImpl implements TipoDomicilioService { + + @Autowired + private TipoDomicilioDAO tipoDomicilioDAO; + + public List obtenerTodos() { + return tipoDomicilioDAO.obtenerTodos(); + } + + public TipoDomicilio obtenerID(Integer id) { + return tipoDomicilioDAO.obtenerID(id); + } + + @Transactional + public TipoDomicilio suscribir(TipoDomicilio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoDomicilioDAO.suscribir(entidad); + } + + @Transactional + public TipoDomicilio actualizacion(TipoDomicilio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoDomicilioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoDomicilio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoDomicilioDAO.actualizacion(entidad); + } + + public List buscar(String desctipo, String cvetipodomicilio) { + return tipoDomicilioDAO.buscar(desctipo, cvetipodomicilio); + } + + public List buscarClave(String cvetipodomicilio) { + return tipoDomicilioDAO.buscarClave(cvetipodomicilio); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoEmpleadoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoEmpleadoServiceImpl.java new file mode 100644 index 000000000..8f38e27d7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoEmpleadoServiceImpl.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.TipoEmpleadoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEmpleado; +import com.rjconsultores.ventaboletos.service.TipoEmpleadoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tipoEmpleadoService") +public class TipoEmpleadoServiceImpl implements TipoEmpleadoService { + + @Autowired + private TipoEmpleadoDAO tipoEmpleadoDAO; + + @Override + public List obtenerTodos() { + return tipoEmpleadoDAO.obtenerTodos(); + } + + @Override + public TipoEmpleado obtenerID(Integer id) { + return tipoEmpleadoDAO.obtenerID(id); + } + + @Override + public TipoEmpleado suscribir(TipoEmpleado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoEmpleadoDAO.suscribir(entidad); + } + + @Override + public TipoEmpleado actualizacion(TipoEmpleado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoEmpleadoDAO.actualizacion(entidad); + } + + @Override + public void borrar(TipoEmpleado entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoEmpleadoDAO.actualizacion(entidad); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraEmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraEmpresaServiceImpl.java new file mode 100644 index 000000000..ff2c4f443 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraEmpresaServiceImpl.java @@ -0,0 +1,58 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TipoEventoExtraEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraEmpresa; +import com.rjconsultores.ventaboletos.service.TipoEventoExtraEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tipoEventoExtraEmpresaService") +public class TipoEventoExtraEmpresaServiceImpl implements TipoEventoExtraEmpresaService { + @Autowired + private TipoEventoExtraEmpresaDAO tipoEventoExtraEmpresaDAO; + + @Override + public List buscarPorTipoEventoExtra(TipoEventoExtra tipoeventoextra) { + return tipoEventoExtraEmpresaDAO.buscarPorTipoEventoExtra(tipoeventoextra); + } + + @Transactional + public TipoEventoExtraEmpresa suscribir(TipoEventoExtraEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoEventoExtraEmpresaDAO.suscribir(entidad); + } + + @Override + public List obtenerTodos() { + return tipoEventoExtraEmpresaDAO.obtenerTodos(); + } + + @Override + public TipoEventoExtraEmpresa obtenerID(Integer id) { + return tipoEventoExtraEmpresaDAO.obtenerID(id); + } + + @Transactional + public TipoEventoExtraEmpresa actualizacion(TipoEventoExtraEmpresa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoEventoExtraEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoEventoExtraEmpresa entidad) { + tipoEventoExtraEmpresaDAO.borrar(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraPtovtaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraPtovtaServiceImpl.java new file mode 100644 index 000000000..98ce84799 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraPtovtaServiceImpl.java @@ -0,0 +1,53 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TipoEventoExtraPtovtaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtraPtoVta; +import com.rjconsultores.ventaboletos.service.TipoEventoExtraPtovtaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tipoEventoExtraPtovtaService") +public class TipoEventoExtraPtovtaServiceImpl implements TipoEventoExtraPtovtaService { + @Autowired + private TipoEventoExtraPtovtaDAO TipoEventoExtraPtovtaDAO; + + + @Transactional + public TipoEventoExtraPtoVta suscribir(TipoEventoExtraPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return TipoEventoExtraPtovtaDAO.suscribir(entidad); + } + + @Override + public List obtenerTodos() { + return TipoEventoExtraPtovtaDAO.obtenerTodos(); + } + + @Override + public TipoEventoExtraPtoVta obtenerID(Integer id) { + return TipoEventoExtraPtovtaDAO.obtenerID(id); + } + + @Transactional + public TipoEventoExtraPtoVta actualizacion(TipoEventoExtraPtoVta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return TipoEventoExtraPtovtaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoEventoExtraPtoVta entidad) { + TipoEventoExtraPtovtaDAO.borrar(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraServiceImpl.java new file mode 100644 index 000000000..5cc86c287 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoEventoExtraServiceImpl.java @@ -0,0 +1,100 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TipoEventoExtraDAO; +import com.rjconsultores.ventaboletos.entidad.TipoEventoExtra; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; +import com.rjconsultores.ventaboletos.service.EventoExtraService; +import com.rjconsultores.ventaboletos.service.TipoEventoExtraService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("tipoEventoExtraService") +public class TipoEventoExtraServiceImpl implements TipoEventoExtraService { + + @Autowired + private TipoEventoExtraDAO tipoEventoExtraDAO; + @Autowired + private EventoExtraService eventoExtraService; + + public List obtenerTodos() { + return tipoEventoExtraDAO.obtenerTodos(); + } + + public TipoEventoExtra obtenerID(Integer id) { + return tipoEventoExtraDAO.obtenerID(id); + } + + @Transactional + public TipoEventoExtra suscribir(TipoEventoExtra entidad) throws ValidacionCampoException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) { + validaCampos(entidad); + } + + return tipoEventoExtraDAO.suscribir(entidad); + } + + @Transactional + public TipoEventoExtra actualizacion(TipoEventoExtra entidad) throws ValidacionCampoException { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) { + validaCampos(entidad); + } + + return tipoEventoExtraDAO.actualizacion(entidad); + } + + @Transactional(rollbackFor = BusinessException.class) + public void borrar(TipoEventoExtra entidad) throws BusinessException { + + if (!eventoExtraService.obtenerPorTipo(entidad).isEmpty()) { + throw new BusinessException("editarTipoEventoExtraController.MSG.evento"); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoEventoExtraDAO.actualizacion(entidad); + } + + @Override + public List buscar(String descingreso) { + return tipoEventoExtraDAO.buscar(descingreso); + } + + private void validaCampos(TipoEventoExtra entidad) throws ValidacionCampoException { + + if (entidad.getNatureza() == null) { + throw new ValidacionCampoException("editarTipoEventoExtraController.MSG.natureza"); + } + + // o campo contacontabil não é obrigatório +// if (entidad.getContaContabil() == null) { +// throw new ValidacionCampoException("editarTipoEventoExtraController.MSG.contaContabil"); +// } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoIdentificacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoIdentificacionServiceImpl.java new file mode 100644 index 000000000..ef215d7dc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoIdentificacionServiceImpl.java @@ -0,0 +1,23 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.TipoIdentificacionDAO; +import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion; +import com.rjconsultores.ventaboletos.service.TipoIdentificacionService; + +@Service("tipoIdentificacionService") +public class TipoIdentificacionServiceImpl implements TipoIdentificacionService { + + @Autowired + private TipoIdentificacionDAO tipoIdentificacionDAO; + + @Override + public List obtenerTodos() { + return tipoIdentificacionDAO.obtenerTodos(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoInformativoComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoInformativoComissaoServiceImpl.java new file mode 100644 index 000000000..6a16e1a49 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoInformativoComissaoServiceImpl.java @@ -0,0 +1,61 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TipoInformativoComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoInformativoComissao; +import com.rjconsultores.ventaboletos.service.TipoInformativoComissaoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tipoInformativoComissaoService") +public class TipoInformativoComissaoServiceImpl implements TipoInformativoComissaoService { + + @Autowired + private TipoInformativoComissaoDAO tipoInformativoComissaoDAO; + + public List obtenerTodos() { + return tipoInformativoComissaoDAO.obtenerTodos(); + } + + public TipoInformativoComissao obtenerID(Integer id) { + return tipoInformativoComissaoDAO.obtenerID(id); + } + + @Transactional + public TipoInformativoComissao suscribir(TipoInformativoComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoInformativoComissaoDAO.suscribir(entidad); + } + + @Transactional + public TipoInformativoComissao actualizacion(TipoInformativoComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoInformativoComissaoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoInformativoComissao entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoInformativoComissaoDAO.actualizacion(entidad); + } + + @Override + public Boolean existeTipoInformativo(TipoInformativoComissao tipo) { + return tipoInformativoComissaoDAO.existeTipoInformativo(tipo); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoMovimientoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoMovimientoServiceImpl.java new file mode 100644 index 000000000..8cae6820d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoMovimientoServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoMovimientoDAO; +import com.rjconsultores.ventaboletos.entidad.TipoMovimiento; +import com.rjconsultores.ventaboletos.service.TipoMovimientoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoMovimientoService") +public class TipoMovimientoServiceImpl implements TipoMovimientoService { + + @Autowired + private TipoMovimientoDAO tipoMovimientoDAO; + + public List obtenerTodos() { + return tipoMovimientoDAO.obtenerTodos(); + } + + public TipoMovimiento obtenerID(Integer id) { + return tipoMovimientoDAO.obtenerID(id); + } + + @Transactional + public TipoMovimiento suscribir(TipoMovimiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoMovimientoDAO.suscribir(entidad); + } + + @Transactional + public TipoMovimiento actualizacion(TipoMovimiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoMovimientoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoMovimiento entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoMovimientoDAO.actualizacion(entidad); + } + + public List buscar(String descmovimiento) { + return tipoMovimientoDAO.buscar(descmovimiento); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoOcupacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoOcupacionServiceImpl.java new file mode 100644 index 000000000..4ce1ccad7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoOcupacionServiceImpl.java @@ -0,0 +1,69 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoOcupacionDAO; +import com.rjconsultores.ventaboletos.entidad.TipoOcupacion; +import com.rjconsultores.ventaboletos.service.TipoOcupacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoOcupacionService") +public class TipoOcupacionServiceImpl implements TipoOcupacionService { + + @Autowired + private TipoOcupacionDAO tipoOcupacionDAO; + + public List obtenerTodos() { + return tipoOcupacionDAO.obtenerTodos(); + } + + public TipoOcupacion obtenerID(Integer id) { + return tipoOcupacionDAO.obtenerID(id); + } + + @Transactional + public TipoOcupacion suscribir(TipoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoOcupacionDAO.suscribir(entidad); + } + + @Transactional + public TipoOcupacion actualizacion(TipoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoOcupacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoOcupacionDAO.actualizacion(entidad); + } + + public List buscar(String desctipo, String cvetipoocupacion) { + return tipoOcupacionDAO.buscar(desctipo, cvetipoocupacion); + } + + public List buscarClave(String cvetipoocupacion) { + return tipoOcupacionDAO.buscarClave(cvetipoocupacion); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoParadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoParadaServiceImpl.java new file mode 100644 index 000000000..713696520 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoParadaServiceImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.ParadaDAO; +import com.rjconsultores.ventaboletos.dao.TipoParadaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoParada; +import com.rjconsultores.ventaboletos.service.TipoParadaService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoParadaService") +public class TipoParadaServiceImpl implements TipoParadaService { + + @Autowired + private TipoParadaDAO tipoParadaDAO; + @Autowired + private ParadaDAO paradaDAO; + + public List obtenerTodos() { + return tipoParadaDAO.obtenerTodos(); + } + + public TipoParada obtenerID(Integer id) { + return tipoParadaDAO.obtenerID(id); + } + + @Transactional + public TipoParada suscribir(TipoParada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoParadaDAO.suscribir(entidad); + } + + @Transactional + public TipoParada actualizacion(TipoParada entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoParadaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoParada entidad) throws RegistroConDependenciaException{ + if (paradaDAO.count(entidad) > 0l) { + throw new RegistroConDependenciaException(); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoParadaDAO.actualizacion(entidad); + } + + public List buscar(String desctipo) { + return tipoParadaDAO.buscar(desctipo); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoPuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoPuntoVentaServiceImpl.java new file mode 100644 index 000000000..624ea1098 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoPuntoVentaServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.service.TipoPuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("tipoPuntoVentaService") +public class TipoPuntoVentaServiceImpl implements TipoPuntoVentaService { + + @Autowired + private TipoPuntoVentaDAO tipoPuntoVentaDAO; + + public List obtenerTodos() { + return tipoPuntoVentaDAO.obtenerTodos(); + } + + public TipoPuntoVenta obtenerID(Short id) { + return tipoPuntoVentaDAO.obtenerID(id); + } + + @Transactional + public TipoPuntoVenta suscribir(TipoPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoPuntoVentaDAO.suscribir(entidad); + } + + @Transactional + public TipoPuntoVenta actualizacion(TipoPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoPuntoVentaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoPuntoVentaDAO.actualizacion(entidad); + } + + public List buscar(String desctipo) { + return tipoPuntoVentaDAO.buscar(desctipo); + } + + @Override + public List obtenerTodosExceto(Short... id) { + return tipoPuntoVentaDAO.obtenerTodosExceto(id); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoServicioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoServicioServiceImpl.java new file mode 100644 index 000000000..445efeb88 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoServicioServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.TipoServicio; +import com.rjconsultores.ventaboletos.service.TipoServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("tipoServicioService") +public class TipoServicioServiceImpl implements TipoServicioService { + + @Autowired + private TipoServicioDAO tipoServicioDAO; + + public List obtenerTodos() { + return tipoServicioDAO.obtenerTodos(); + } + + public TipoServicio obtenerID(Integer id) { + return tipoServicioDAO.obtenerID(id); + } + + @Transactional + public TipoServicio suscribir(TipoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoServicioDAO.suscribir(entidad); + } + + @Transactional + public TipoServicio actualizacion(TipoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoServicioDAO.actualizacion(entidad); + } + + public List buscar(String descservicio) { + return tipoServicioDAO.buscar(descservicio); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoTarifaPacoteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoTarifaPacoteServiceImpl.java new file mode 100644 index 000000000..f816e5987 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoTarifaPacoteServiceImpl.java @@ -0,0 +1,66 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TipoTarifaPacoteDAO; +import com.rjconsultores.ventaboletos.entidad.Pacote; +import com.rjconsultores.ventaboletos.entidad.TipoTarifaPacote; +import com.rjconsultores.ventaboletos.service.TipoTarifaPacoteService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("tipoTarifaPacoteService") +public class TipoTarifaPacoteServiceImpl implements TipoTarifaPacoteService { + + @Autowired + private TipoTarifaPacoteDAO tipoTarifaPacoteDAO; + + @Override + public List obtenerTodos() { + return tipoTarifaPacoteDAO.obtenerTodos(); + } + + @Override + public TipoTarifaPacote obtenerID(Integer id) { + return tipoTarifaPacoteDAO.obtenerID(id); + } + + @Transactional + @Override + public TipoTarifaPacote suscribir(TipoTarifaPacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoTarifaPacoteDAO.suscribir(entidad); + } + + @Transactional + @Override + public TipoTarifaPacote actualizacion(TipoTarifaPacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoTarifaPacoteDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(TipoTarifaPacote entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoTarifaPacoteDAO.actualizacion(entidad); + } + + @Override + public List buscaTipoTarifaPacote(Pacote pacote) { + return tipoTarifaPacoteDAO.buscaTipoTarifaPacote(pacote); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoVentaServiceImpl.java new file mode 100644 index 000000000..032b0c1f5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoVentaServiceImpl.java @@ -0,0 +1,73 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TipoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.TipoVenta; +import com.rjconsultores.ventaboletos.service.TipoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("tipoVentaService") +public class TipoVentaServiceImpl implements TipoVentaService { + + @Autowired + private TipoVentaDAO tipoVentaDAO; + + public List obtenerTodos() { + return tipoVentaDAO.obtenerTodos(); + } + + public TipoVenta obtenerID(Integer id) { + return tipoVentaDAO.obtenerID(id); + } + + @Transactional + public TipoVenta suscribir(TipoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoVentaDAO.suscribir(entidad); + } + + @Transactional + public TipoVenta actualizacion(TipoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tipoVentaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TipoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tipoVentaDAO.actualizacion(entidad); + } + + public List buscar(String desctipoventa) { + return tipoVentaDAO.buscar(desctipoventa); + } + + public TipoVenta obtenerID(Short tipoventaId) { + return tipoVentaDAO.obtenerID(tipoventaId); + } + + public List obterTiposVentaIntegracao() { + return tipoVentaDAO.obterTiposVentaIntegracao(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TramoKmServicioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TramoKmServicioServiceImpl.java new file mode 100644 index 000000000..bc46a00c0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TramoKmServicioServiceImpl.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TramoKmServicioDAO; +import com.rjconsultores.ventaboletos.entidad.TramoKmServicio; +import com.rjconsultores.ventaboletos.service.TramoKmServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Desenvolvimento + */ +@Service("tramoKmServicioService") +public class TramoKmServicioServiceImpl implements TramoKmServicioService { + + @Autowired + private TramoKmServicioDAO tramoKmServicioDAO; + + public List obtenerTodos() { + return tramoKmServicioDAO.obtenerTodos(); + } + + public TramoKmServicio obtenerID(Integer id) { + return tramoKmServicioDAO.obtenerID(id); + } + + @Transactional + public TramoKmServicio suscribir(TramoKmServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tramoKmServicioDAO.suscribir(entidad); + } + + @Transactional + public TramoKmServicio actualizacion(TramoKmServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tramoKmServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TramoKmServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tramoKmServicioDAO.actualizacion(entidad); + } + + public List buscar(TramoKmServicio tramoKmServicio) { + return tramoKmServicioDAO.buscar(tramoKmServicio); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java new file mode 100644 index 000000000..57f24ce36 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java @@ -0,0 +1,664 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; + +import org.apache.log4j.Logger; +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 com.rjconsultores.ventaboletos.dao.OrgaoTramoDAO; +import com.rjconsultores.ventaboletos.dao.RutaDAO; +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.dao.TramoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.OrgaoTramo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaSecuencia; +import com.rjconsultores.ventaboletos.entidad.ParadaSecuenciaCombinacaoLinha; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; +import com.rjconsultores.ventaboletos.entidad.RutaEmpresa; +import com.rjconsultores.ventaboletos.entidad.RutaSecuencia; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.RutaCombinacionService; +import com.rjconsultores.ventaboletos.service.RutaEmpresaService; +import com.rjconsultores.ventaboletos.service.RutaSecuenciaService; +import com.rjconsultores.ventaboletos.service.RutaService; +import com.rjconsultores.ventaboletos.service.TramoRutaService; +import com.rjconsultores.ventaboletos.service.TramoService; +import com.rjconsultores.ventaboletos.service.TramoServicioService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.HoraSistema; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.RutaTramoVO; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.SecuenciaRutaTramoCoeficienteVO; +import com.rjconsultores.ventaboletos.vo.esquemaoperacional.SecuenciaRutaTramoVO; + +@Service("tramoRutaService") +public class TramoRutaServiceImpl implements TramoRutaService { + + private static Logger log = Logger.getLogger(TramoRutaServiceImpl.class); + @Autowired + private RutaCombinacionService rutaCombinacionService; + @Autowired + private RutaSecuenciaService rutaSecuenciaService; + @Autowired + private RutaEmpresaService rutaEmpresaService; + @Autowired + private RutaService rutaService; + @Autowired + private TramoService tramoService; + @Autowired + private TramoServicioService tramoServicioService; + @Autowired + private RutaDAO rutaDAO; + @Autowired + private OrgaoTramoDAO orgaoTramoDAO; + @Autowired + private TramoServicioDAO tramoServicioDAO; + @Autowired + private TramoDAO tramoDAO; + + /** + * Hace la validación de los datos del rutaTramoVO + * + * @param rutaTramoVO + * @throws BusinessException + */ + private void validarGenerarTramosRutas(RutaTramoVO rutaTramoVO) throws BusinessException { + if (rutaTramoVO.getLsSecuenciaRutaTramoVO().isEmpty()) { + throw new BusinessException("tramoRutaServiceImpl.msg.secuenciaObligatorio"); + } + if ((rutaTramoVO.getPrefixo() == null) || (rutaTramoVO.getPrefixo().isEmpty())) { + throw new BusinessException("tramoRutaServiceImpl.msg.prefixoObligatorio"); + } + if (rutaTramoVO.getLsEmpresa().isEmpty()) { + throw new BusinessException("tramoRutaServiceImpl.msg.empresaObligatoria"); + } + + if (rutaTramoVO.getLsCombinacionRutaTramoVO().isEmpty()) { + throw new BusinessException("tramoRutaServiceImpl.msg.combinacionObligatorio"); + } + for (SecuenciaRutaTramoCoeficienteVO s : rutaTramoVO.getLsCombinacionRutaTramoVO()) { + if (s.getTramoId() != null) { + continue; + } + if ((s.getOrigen() == null) || (s.getDestino() == null) || (s.getVia() == null) + || (s.getKmReal() == null) || (s.getSecuencia() == null) || (s.getTiempoRecorrido() == null) + || ((rutaTramoVO.getOrgaoConcedente() == null || !rutaTramoVO.getOrgaoConcedente().getOrgaoConcedenteId().equals(21) + && ((s.getCoeficienteTarifa1() == null) || (s.getKmCoeficiente1() == null) || (s.getKmCoeficiente1() == BigDecimal.ZERO))))) { + + throw new BusinessException("tramoRutaServiceImpl.msg.cambosObligatoriosCombinacion", new Object[] { s.getOrigen(), s.getDestino() }); + } + } + for (SecuenciaRutaTramoVO s : rutaTramoVO.getLsSecuenciaRutaTramoVO()) { + if (s.getTramoId() != null) { + continue; + } + if ((s.getOrigen() == null) || (s.getDestino() == null) || (s.getVia() == null) + || (s.getKmReal() == null) || (s.getSecuencia() == null) || (s.getTiempoRecorrido() == null)) { + throw new BusinessException("tramoRutaServiceImpl.msg.cambosObligatoriosSecuencia", new Object[] { s.getOrigen(), + s.getDestino() }); + } + } + } + + @Transactional(rollbackFor = BusinessException.class) + @Override + public Ruta generarTramosRutas(RutaTramoVO rutaTramoVO, Boolean isRegreso) throws BusinessException { + + this.validarGenerarTramosRutas(rutaTramoVO); + + // Genero los tramos y tramos servicios de la combinacion que no existen + // Aqui si genera tambien los tramos de la secuencia + for (SecuenciaRutaTramoCoeficienteVO s : rutaTramoVO.getLsCombinacionRutaTramoVO()) { + log.debug("Origen:" + s.getOrigen() + ";Destino:" + s.getDestino() + ";Via:" + s.getVia()); + boolean fueGenerado = generarDatos(s, rutaTramoVO.getClaseServicio(), rutaTramoVO.getOrgaoConcedente()); + log.debug("Fue Generado:" + fueGenerado); + } + + // Genero la ruta + Ruta ruta = new Ruta(); + ruta.setDescruta(rutaTramoVO.getDescRuta()); + ruta.setClaseServicio(rutaTramoVO.getClaseServicio()); + ruta.setOrgaoConcedente(rutaTramoVO.getOrgaoConcedente()); + ruta.setIndNombreObligatorio(rutaTramoVO.getSolicitaNombrePasajero()); + ruta.setIndSentidoIda(rutaTramoVO.getIndSentidoIda()); + ruta.setIndTelefoneObrigatorio(false); + if (rutaTramoVO.getVentaHandHeld() == null) { + ruta.setVentaOffLine(false); + } else { + ruta.setVentaOffLine(rutaTramoVO.getVentaHandHeld()); + } + + ruta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + ruta.setActivo(Boolean.TRUE); + ruta.setFecmodif(new java.util.Date()); + ruta.setPrefixo(rutaTramoVO.getPrefixo()); + ruta.setNumRuta(rutaTramoVO.getNumRuta()); + //valores de tributação para ecf + ruta.setIndTribPedagio(Boolean.FALSE); + ruta.setIndTribTarifa(Boolean.TRUE); + ruta.setIndTribTaxaEmbarque(Boolean.FALSE); + ruta.setIndRutaInternacional(Boolean.FALSE); + + ruta = rutaDAO.suscribir(ruta); + + // Genero la secuencia de la ruta + for (SecuenciaRutaTramoVO s : rutaTramoVO.getLsSecuenciaRutaTramoVO()) { + RutaSecuencia rutaSecuencia = new RutaSecuencia(); + rutaSecuencia.setNumsecuencia(s.getSecuencia().shortValue()); + rutaSecuencia.setTramo(tramoService.obtenerTramotPorOrigemDestinoVia(s.getOrigen(), s.getDestino(), s.getVia())); + rutaSecuencia.setCantKmEntradaSaida(s.getKmEntradaSaida()); + rutaSecuencia.setKmOriginal(s.getKmOriginal()); + + + if(rutaSecuencia.getTramo() == null ){ + Tramo tramo = new Tramo(); + tramo.setDesctramo(tramoService.gerarDescripcionTramo(s.getOrigen(), s.getDestino(), s.getVia())); + tramo.setOrigem(s.getOrigen()); + tramo.setDestino(s.getDestino()); + tramo.setKmReal(s.getKmReal()); + tramo.setKmEntradaSaida(s.getKmSaidaOrigen()); + tramo.setKmEntradaSaidaDestino(s.getKmEntradaDestino()); + tramo.setVia(s.getVia()); + tramo.setActivo(Boolean.TRUE); + tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramo.setFecmodif(new java.util.Date()); + + tramo = tramoDAO.suscribir(tramo); + rutaSecuencia.setTramo(tramo); + } else { + Tramo tramo = rutaSecuencia.getTramo(); + tramo.setKmEntradaSaida(s.getKmSaidaOrigen()); + tramo.setKmEntradaSaidaDestino(s.getKmEntradaDestino()); + tramo = tramoDAO.actualizacion(tramo); + } + rutaSecuencia.setRuta(ruta); + rutaSecuencia = rutaSecuenciaService.suscribir(rutaSecuencia); + } + + for (SecuenciaRutaTramoCoeficienteVO s : rutaTramoVO.getLsCombinacionRutaTramoVO()) { + RutaCombinacion rutaCombinacion = new RutaCombinacion(); + rutaCombinacion.setIndventa(s.getPermiteVenda() == null ? true : s.getPermiteVenda()); + rutaCombinacion.setRuta(ruta); + rutaCombinacion.setTramo(tramoService.obtenerTramotPorOrigemDestinoVia(s.getOrigen(), s.getDestino(), s.getVia())); + + rutaCombinacion = rutaCombinacionService.suscribir(rutaCombinacion); + } + + for (Empresa e : rutaTramoVO.getLsEmpresa()) { + RutaEmpresa rutaEmpresa = new RutaEmpresa(); + rutaEmpresa.setEmpresa(e); + rutaEmpresa.setActivo(Boolean.TRUE); + rutaEmpresa.setFecmodif(Calendar.getInstance().getTime()); + rutaEmpresa.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rutaEmpresa.setRuta(ruta); + + rutaEmpresa = rutaEmpresaService.suscribir(rutaEmpresa); + } + + return ruta; + } + + @Override + public RutaTramoVO generarRutaRegreso(RutaTramoVO rutaTramoVO) { + RutaTramoVO rutaTramoRegresoVO = new RutaTramoVO(); + rutaTramoRegresoVO.setClaseServicio(rutaTramoVO.getClaseServicio()); + rutaTramoRegresoVO.setOrgaoConcedente(rutaTramoVO.getOrgaoConcedente()); + rutaTramoRegresoVO.setSolicitaNombrePasajero(rutaTramoVO.getSolicitaNombrePasajero()); + rutaTramoRegresoVO.setVentaHandHeld(rutaTramoVO.getVentaHandHeld() == null ? true : rutaTramoVO.getVentaHandHeld()); + rutaTramoRegresoVO.setLsEmpresa(rutaTramoVO.getLsEmpresa()); + + if (rutaTramoVO.getIndSentidoIda()) { + rutaTramoRegresoVO.setIndSentidoIda(Boolean.FALSE); + } else { + rutaTramoRegresoVO.setIndSentidoIda(Boolean.TRUE); + } + rutaTramoRegresoVO.setNumRuta(rutaTramoVO.getNumRuta()); + rutaTramoRegresoVO.setPrefixo(rutaTramoVO.getPrefixo()); + if (rutaTramoVO.getDescRuta() != null) { + rutaTramoRegresoVO.setDescRuta(rutaTramoVO.getDescRuta()); + } else { + rutaTramoRegresoVO.setDescRuta("-"); + } + + List lsSecuenciaRutaTramoRegresoVO = new ArrayList(); + List lsSecuenciaRutaTramoIdaVO = new ArrayList(rutaTramoVO.getLsSecuenciaRutaTramoVO()); + // Reordena a lista + Collections.reverse(lsSecuenciaRutaTramoIdaVO); + + int secuencia = 0; + + Map kmEntradaSaida = rutaTramoVO.getParadasComKmEntradaSaida(); + + for (SecuenciaRutaTramoVO s : lsSecuenciaRutaTramoIdaVO) { + TramoServicio tramoServicio = tramoServicioService.buscar(s.getDestino(), s.getOrigen(), s.getVia(), rutaTramoVO.getClaseServicio()); + if (tramoServicio != null) { + s.setTramoId(tramoServicio.getTramo().getTramoId()); + s.setTramoServicioId(tramoServicio.getTramoservicioId()); + + lsSecuenciaRutaTramoRegresoVO.add(new SecuenciaRutaTramoVO(s.getDestino(), s.getOrigen(), s.getVia(), ++secuencia, s.getKmReal(), s.getTiempoRecorrido(), + s.getTramoId(), s.getTramoServicioId(), rutaTramoRegresoVO.getNumRuta(), rutaTramoRegresoVO.getIndSentidoIda(), kmEntradaSaida.containsKey(s.getDestino()) ? kmEntradaSaida.get(s.getDestino()) : BigDecimal.ZERO )); + } else { + lsSecuenciaRutaTramoRegresoVO.add(new SecuenciaRutaTramoVO(s.getDestino(), s.getOrigen(), s.getVia(), ++secuencia, s.getKmReal(), s.getTiempoRecorrido(), rutaTramoRegresoVO.getNumRuta(), rutaTramoRegresoVO.getIndSentidoIda(),kmEntradaSaida.containsKey(s.getDestino()) ? kmEntradaSaida.get(s.getDestino()) : BigDecimal.ZERO )); + } + } + rutaTramoRegresoVO.setLsSecuenciaRutaTramoVO(lsSecuenciaRutaTramoRegresoVO); + + List lsCombinacionRutaTramoRegresoVO = new ArrayList(); + List lsCombinacionTramoIdaVO = new ArrayList(rutaTramoVO.getLsCombinacionRutaTramoVO()); + Collections.sort(lsCombinacionTramoIdaVO, new Comparator() { + + @Override + public int compare(SecuenciaRutaTramoCoeficienteVO o1, SecuenciaRutaTramoCoeficienteVO o2) { + return o2.getSecuencia().compareTo(o1.getSecuencia()); + } + }); + + secuencia = 0; + for (SecuenciaRutaTramoCoeficienteVO s : lsCombinacionTramoIdaVO) { + TramoServicio tramoServicio = tramoServicioService.buscar(s.getDestino(), s.getOrigen(), s.getVia(), rutaTramoVO.getClaseServicio()); + if (tramoServicio != null) { + s.setTramoId(tramoServicio.getTramo().getTramoId()); + s.setTramoServicioId(tramoServicio.getTramoservicioId()); + + SecuenciaRutaTramoCoeficienteVO secuenciaRutaTramoCoeficienteVO = new SecuenciaRutaTramoCoeficienteVO(s.getDestino(), s.getOrigen(), s.getVia(), ++secuencia, s.getKmReal(), s.getTiempoRecorrido(), + s.getTramoId(), s.getTramoServicioId(), rutaTramoRegresoVO.getNumRuta(), s.getKmSaidaOrigen()); + + OrgaoTramo orgaoTramo = orgaoTramoDAO.buscar(s.getDestino().getParadaId(), s.getOrigen().getParadaId(), s.getVia().getViaId(), rutaTramoVO.getOrgaoConcedente().getOrgaoConcedenteId(), rutaTramoVO.getClaseServicio().getClaseservicioId()); + + if (orgaoTramo != null) { + secuenciaRutaTramoCoeficienteVO.setOrgaoTramoId(orgaoTramo.getOrgaoTramoId()); + + secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa1(s.getCoeficienteTarifa1()); + secuenciaRutaTramoCoeficienteVO.setKmCoeficiente1(s.getKmCoeficiente1()); + + if (s.getCoeficienteTarifa2() != null) { + secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa2(s.getCoeficienteTarifa2()); + secuenciaRutaTramoCoeficienteVO.setKmCoeficiente2(s.getKmCoeficiente2()); + } + + if (s.getCoeficienteTarifa3() != null) { + secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa3(s.getCoeficienteTarifa3()); + secuenciaRutaTramoCoeficienteVO.setKmCoeficiente3(s.getKmCoeficiente3()); + } + } + + secuenciaRutaTramoCoeficienteVO.setPermiteVenda(s.getPermiteVenda()); + lsCombinacionRutaTramoRegresoVO.add(secuenciaRutaTramoCoeficienteVO); + } else { + SecuenciaRutaTramoCoeficienteVO secuenciaRutaTramoCoeficienteVO = new SecuenciaRutaTramoCoeficienteVO(s.getDestino(), s.getOrigen(), s.getVia(), ++secuencia, s.getKmReal(), s.getTiempoRecorrido(), rutaTramoRegresoVO.getNumRuta(), s.getKmSaidaOrigen()); + + secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa1(s.getCoeficienteTarifa1()); + secuenciaRutaTramoCoeficienteVO.setKmCoeficiente1(s.getKmCoeficiente1()); + + secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa2(s.getCoeficienteTarifa2()); + secuenciaRutaTramoCoeficienteVO.setKmCoeficiente2(s.getKmCoeficiente2()); + + secuenciaRutaTramoCoeficienteVO.setCoeficienteTarifa3(s.getCoeficienteTarifa3()); + secuenciaRutaTramoCoeficienteVO.setKmCoeficiente3(s.getKmCoeficiente3()); + secuenciaRutaTramoCoeficienteVO.setPermiteVenda(s.getPermiteVenda()); + + lsCombinacionRutaTramoRegresoVO.add(secuenciaRutaTramoCoeficienteVO); + } + + } + rutaTramoRegresoVO.setLsCombinacionRutaTramoVO(lsCombinacionRutaTramoRegresoVO); + + return rutaTramoRegresoVO; + } + + @Override + public List generarCombinacion(RutaTramoVO rutaTramoVO) { + List lsSecuenciaRutaTramoVO = new ArrayList(rutaTramoVO.getLsSecuenciaRutaTramoVO()); + List lsSecuenciaCombinacionRutaTramoVO = new ArrayList(); + + Collections.sort(lsSecuenciaRutaTramoVO); + + int secuencia = 0; + List listSecuenciaCalculada = new ArrayList(lsSecuenciaRutaTramoVO); + + for (SecuenciaRutaTramoVO secuenciaInicial : lsSecuenciaRutaTramoVO) { + Parada origen = secuenciaInicial.getOrigen(); + Parada destino = secuenciaInicial.getDestino(); + + listSecuenciaCalculada.remove(secuenciaInicial); + + BigDecimal totalKmsReal = secuenciaInicial.getKmReal(); + totalKmsReal = totalKmsReal.add(secuenciaInicial.getKmSaidaOrigen().add(secuenciaInicial.getKmEntradaDestino())); + + HoraSistema totalTiempoRecorrido = secuenciaInicial.getTiempoRecorrido(); + + Via via = secuenciaInicial.getVia(); + + secuencia = criaSecuenciaRutaTramoCoeficienteVO(rutaTramoVO, lsSecuenciaCombinacionRutaTramoVO, secuencia, totalKmsReal, origen, destino, secuenciaInicial.getKmSaidaOrigen(), secuenciaInicial.getKmEntradaDestino(), totalTiempoRecorrido, via); + totalKmsReal = totalKmsReal.subtract(secuenciaInicial.getKmEntradaDestino()); + + for (SecuenciaRutaTramoVO secuenciaInterna : listSecuenciaCalculada) { + destino = secuenciaInterna.getDestino(); + totalKmsReal = totalKmsReal.add(secuenciaInterna.getKmReal()); + totalKmsReal = totalKmsReal.add(secuenciaInterna.getKmEntradaDestino()); + totalTiempoRecorrido = totalTiempoRecorrido.sumar(secuenciaInterna.getTiempoRecorrido()); + + secuencia = criaSecuenciaRutaTramoCoeficienteVO(rutaTramoVO, lsSecuenciaCombinacionRutaTramoVO, secuencia, totalKmsReal, origen, destino, secuenciaInicial.getKmSaidaOrigen(), secuenciaInterna.getKmEntradaDestino(), totalTiempoRecorrido, via); + totalKmsReal = totalKmsReal.subtract(secuenciaInterna.getKmEntradaDestino()); + + } + + } + + return lsSecuenciaCombinacionRutaTramoVO; + } + + private int criaSecuenciaRutaTramoCoeficienteVO(RutaTramoVO rutaTramoVO, List lsSecuenciaCombinacionRutaTramoVO, int secuencia, BigDecimal totalKmsReal, Parada origen, Parada destino, BigDecimal kmSaidaOrigen, BigDecimal kmEntradaDestino, HoraSistema totalTiempoRecorrido, Via via) { + SecuenciaRutaTramoCoeficienteVO nuevaSecuencia = new SecuenciaRutaTramoCoeficienteVO(origen, destino, via, ++secuencia, + totalKmsReal, totalTiempoRecorrido, rutaTramoVO.getNumRuta()); + + atualizandoSecuenciaPorViaExistente(rutaTramoVO, origen, destino, via, nuevaSecuencia); + + nuevaSecuencia.setKmSaidaOrigen(kmSaidaOrigen); + nuevaSecuencia.setKmEntradaDestino(kmEntradaDestino); + nuevaSecuencia.setNumRuta(rutaTramoVO.getNumRuta()); + lsSecuenciaCombinacionRutaTramoVO.add(nuevaSecuencia); + + log.debug("Origen:" + nuevaSecuencia.getOrigen() + ";Destino:" + nuevaSecuencia.getDestino() + ";Via:" + + nuevaSecuencia.getVia() + ";KmsReal:" + nuevaSecuencia.getKmReal() + ";hora:" + nuevaSecuencia.getTiempoRecorrido()); + return secuencia; + } + + private void atualizandoSecuenciaPorViaExistente(RutaTramoVO rutaTramoVO, Parada origen, Parada destino, Via via, SecuenciaRutaTramoCoeficienteVO nuevaSecuencia) { + if (via != null) { + atualizandoSecuenciaPorTramosExistente(rutaTramoVO, origen, destino, via, nuevaSecuencia); + atualizandoSecuenciaPorOrgaoTramosExistentes(rutaTramoVO, origen, destino, via, nuevaSecuencia); + } + } + + private void atualizandoSecuenciaPorOrgaoTramosExistentes(RutaTramoVO rutaTramoVO, Parada origen, Parada destino, Via via, SecuenciaRutaTramoCoeficienteVO nuevaSecuencia) { + OrgaoTramo orgaoTramo = orgaoTramoDAO.buscar(origen.getParadaId(), destino.getParadaId(), via.getViaId(), rutaTramoVO.getOrgaoConcedente().getOrgaoConcedenteId(), rutaTramoVO.getClaseServicio().getClaseservicioId()); + if (orgaoTramo != null) { + nuevaSecuencia.setCoeficienteTarifa1(orgaoTramo.getCoeficienteTarifa1()); + nuevaSecuencia.setKmCoeficiente1(orgaoTramo.getKmCoeficiente1()); + nuevaSecuencia.setCoeficienteTarifa2(orgaoTramo.getCoeficienteTarifa2()); + nuevaSecuencia.setKmCoeficiente2(orgaoTramo.getKmCoeficiente2()); + nuevaSecuencia.setCoeficienteTarifa3(orgaoTramo.getCoeficienteTarifa3()); + nuevaSecuencia.setKmCoeficiente3(orgaoTramo.getKmCoeficiente3()); + nuevaSecuencia.setOrgaoTramoId(orgaoTramo.getOrgaoTramoId()); + } + incluirCoeficiente(nuevaSecuencia, rutaTramoVO); + } + + private void atualizandoSecuenciaPorTramosExistente(RutaTramoVO rutaTramoVO, Parada origen, Parada destino, Via via, SecuenciaRutaTramoCoeficienteVO nuevaSecuencia) { + TramoServicio tramoServicio = tramoServicioService.buscar(origen, destino, via, rutaTramoVO.getClaseServicio()); + if (tramoServicio != null) { + nuevaSecuencia.setKmReal(tramoServicio.getTramo().getKmReal()); + nuevaSecuencia.setTiempoRecorrido(new HoraSistema(tramoServicio.getTiemporecorrido())); + nuevaSecuencia.setTramoId(tramoServicio.getTramo().getTramoId()); + nuevaSecuencia.setTramoServicioId(tramoServicio.getTramoservicioId()); + } + } + + private void incluirCoeficiente(SecuenciaRutaTramoCoeficienteVO nuevaSecuencia, RutaTramoVO rutaTramoVO) { + if (nuevaSecuencia.getKmCoeficiente1() == null && rutaTramoVO.getCoeficienteDefault1() != null) { + nuevaSecuencia.setKmCoeficiente1(nuevaSecuencia.getKmReal()); + } + if (nuevaSecuencia.getKmCoeficiente2() == null && rutaTramoVO.getCoeficienteDefault2() != null) { + nuevaSecuencia.setKmCoeficiente2(nuevaSecuencia.getKmReal()); + } + if (nuevaSecuencia.getKmCoeficiente3() == null && rutaTramoVO.getCoeficienteDefault3() != null) { + nuevaSecuencia.setKmCoeficiente3(nuevaSecuencia.getKmReal()); + } + } + + @Override + public List generarCombinacionTrechoRuta(RutaTramoVO rutaTramoVO, List secuenciasDestino) { + // una nueva lista que va a ser ordenada. Con eso, no afecta la lista original + + List lsSecuenciaCombinacionRutaTramoVO = new ArrayList(); + + List secuencias = rutaTramoVO.getLsParadaSecuenciaCombinacaoLinhas(); + + for (ParadaSecuenciaCombinacaoLinha secuencia: secuencias){ + Parada origem = secuencia.getOrigem().getParada(); + Via via = secuencia.getVia(); + + BigDecimal totalKmsReal = BigDecimal.ZERO; + + BigDecimal kmsRealOrigem = secuencia.getKmReal() == null || secuencia.getKmReal().isEmpty() ? BigDecimal.ZERO : + new BigDecimal(secuencia.getKmReal()); + + totalKmsReal = totalKmsReal.add(kmsRealOrigem); + HoraSistema tempoTotalOrigemDestino = secuencia.getTempoReal().isEmpty() ? new HoraSistema() : new HoraSistema(DateUtil.getDataTempoDecorrido(secuencia.getTempoReal()));; + + for (ParadaSecuencia secuenciaDestino : secuenciasDestino) { + + //O processo não é realizado na ordem inversa (em que a sequencia da origem é maior que a sequencia de seus destinos), considerando que esse é o processo inversa a ida ou a volta. + if (secuencia.getOrigem().getSecuencia() >= secuenciaDestino.getSecuencia()){ + continue; + } + + Parada destino = secuenciaDestino.getParada(); + + //A primeira seguencia sempre será a origem + //A segunda sequencia sempre recebe a km e o tempo da origem + if (secuenciaDestino.getSecuencia() > 2) { + tempoTotalOrigemDestino = calcularTempoTotalDestino(secuencia, secuenciaDestino.getSecuencia()); + totalKmsReal = calcularKmDestino(secuencia, secuenciaDestino.getSecuencia()); + } + + SecuenciaRutaTramoCoeficienteVO nuevaSecuencia = new SecuenciaRutaTramoCoeficienteVO(origem, destino, via, + secuencia.getOrigem().getSecuencia().intValue(), totalKmsReal, tempoTotalOrigemDestino, rutaTramoVO.getNumRuta()); + + atualizandoSecuenciaPorViaExistente(rutaTramoVO, origem, destino, via, nuevaSecuencia); + + + nuevaSecuencia.setNumRuta(rutaTramoVO.getNumRuta()); + + lsSecuenciaCombinacionRutaTramoVO.add(nuevaSecuencia); + } + } + + return lsSecuenciaCombinacionRutaTramoVO; + } + + /** + * Genera los datos de tramo, tramo tiempo e coeficiente tarifa sino existen los datos + * + * @param secuencia + * @param claseServicio + * @param orgaoConcedente + * @return + */ + private boolean generarDatos(SecuenciaRutaTramoCoeficienteVO secuencia, ClaseServicio claseServicio, OrgaoConcedente orgaoConcedente) { + TramoServicio tramoServicio = tramoServicioDAO.buscar(secuencia.getOrigen(), secuencia.getDestino(), secuencia.getVia(), claseServicio); + + Tramo tramo = null; + if (tramoServicio == null) { + tramo = tramoService.buscar(secuencia.getOrigen(), secuencia.getDestino(), secuencia.getVia()); + if (tramo == null) { + if(secuencia.getTramoId() != null){ + tramo = tramoService.obtenerID(secuencia.getTramoId()); + }else{ + tramo = new Tramo(); + tramo.setDesctramo(tramoService.gerarDescripcionTramo(secuencia.getOrigen(), secuencia.getDestino(), secuencia.getVia())); + tramo.setOrigem(secuencia.getOrigen()); + tramo.setDestino(secuencia.getDestino()); + tramo.setKmReal(secuencia.getKmReal()); + tramo.setKmEntradaSaida(secuencia.getKmSaidaOrigen() == null ? BigDecimal.ZERO : secuencia.getKmSaidaOrigen()); + tramo.setKmEntradaSaidaDestino(secuencia.getKmEntradaDestino() == null ? BigDecimal.ZERO : secuencia.getKmEntradaDestino()); + tramo.setVia(secuencia.getVia()); + tramo.setActivo(Boolean.TRUE); + tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramo.setFecmodif(new java.util.Date()); + + tramo = tramoDAO.suscribir(tramo); + } + } + tramoServicio = new TramoServicio(); + tramoServicio.setClaseServicio(claseServicio); + tramoServicio.setTramo(tramo); + tramoServicio.setTiemporecorrido(secuencia.getTiempoRecorrido().getFecha()); + + tramoServicio = tramoServicioService.suscribir(tramoServicio); + + susCribrirOrgaoTramo(secuencia, claseServicio, orgaoConcedente, tramo); + + return true; + } + + susCribrirOrgaoTramo(secuencia, claseServicio, orgaoConcedente, tramo); + + return false; + } + + private void susCribrirOrgaoTramo(SecuenciaRutaTramoCoeficienteVO secuencia, ClaseServicio claseServicio, OrgaoConcedente orgaoConcedente, Tramo tramo) { + + if(tramo == null) { + if(secuencia.getTramoId() != null){ + tramo = tramoService.obtenerID(secuencia.getTramoId()); + } + } + + if (secuencia.getOrgaoTramoId() == null + && secuencia.getCoeficienteTarifa1() != null) { + OrgaoTramo orgaoTramo = new OrgaoTramo(); + orgaoTramo.setClaseServicio(claseServicio); + orgaoTramo.setOrgaoConcedente(orgaoConcedente); + orgaoTramo.setTramo(tramo); + + orgaoTramo.setActivo(Boolean.TRUE); + orgaoTramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + orgaoTramo.setFecmodif(new java.util.Date()); + orgaoTramo.setCoeficienteTarifa1(secuencia.getCoeficienteTarifa1()); + orgaoTramo.setKmCoeficiente1(secuencia.getKmCoeficiente1()); + + if (secuencia.getCoeficienteTarifa2() != null) { + orgaoTramo.setCoeficienteTarifa2(secuencia.getCoeficienteTarifa2()); + orgaoTramo.setKmCoeficiente2(secuencia.getKmCoeficiente2()); + } + + if (secuencia.getCoeficienteTarifa3() != null) { + orgaoTramo.setCoeficienteTarifa3(secuencia.getCoeficienteTarifa3()); + orgaoTramo.setKmCoeficiente3(secuencia.getKmCoeficiente3()); + } + + orgaoTramoDAO.suscribir(orgaoTramo); + } + } + + @Transactional(rollbackFor = BusinessException.class) + @Override + public void generarTramosRutaExistente(RutaTramoVO rutaTramoVO, Ruta ruta) throws BusinessException { + + this.validarGenerarTramosRutas(rutaTramoVO); + + // Genero los tramos y tramos servicios de la combinacion que no existen + // Aqui si genera tambien los tramos de la secuencia + for (SecuenciaRutaTramoCoeficienteVO s : rutaTramoVO.getLsCombinacionRutaTramoVO()) { + log.debug("Origen:" + s.getOrigen() + ";Destino:" + s.getDestino() + ";Via:" + s.getVia()); + boolean fueGenerado = generarDatos(s, rutaTramoVO.getClaseServicio(), rutaTramoVO.getOrgaoConcedente()); + log.debug("Fue Generado:" + fueGenerado); + } + + // Genero la secuencia de la ruta + for (SecuenciaRutaTramoVO s : rutaTramoVO.getLsSecuenciaRutaTramoVO()) { + RutaSecuencia rutaSecuencia = new RutaSecuencia(); + rutaSecuencia.setNumsecuencia(s.getSecuencia().shortValue()); + rutaSecuencia.setTramo(tramoService.obtenerTramotPorOrigemDestinoVia(s.getOrigen(), s.getDestino(), s.getVia())); + rutaSecuencia.setRuta(ruta); + rutaSecuencia.setKmOriginal(rutaSecuencia.getTramo().getKmRealSemKmEntradaSaida()); + + if (rutaSecuencia.getRuta() == null && rutaSecuencia.getRuta().getRutaId() == null) { + rutaService.suscribir(rutaSecuencia.getRuta(), null); + } + rutaSecuencia = rutaSecuenciaService.suscribir(rutaSecuencia); + + if (rutaSecuencia.getRutasecuenciaId() == null){ + throw new BusinessException(Labels.getLabel("gerarCombinacionTramoRutaController.MSG.error.rutaSecuencia")); + } + } + + for (SecuenciaRutaTramoCoeficienteVO s : rutaTramoVO.getLsCombinacionRutaTramoVO()) { + RutaCombinacion rutaCombinacion = new RutaCombinacion(); + rutaCombinacion.setIndventa(s.getPermiteVenda() == null ? true : s.getPermiteVenda()); + rutaCombinacion.setRuta(ruta); + rutaCombinacion.setTramo(tramoService.obtenerTramotPorOrigemDestinoVia(s.getOrigen(), s.getDestino(), s.getVia())); + + rutaCombinacion = rutaCombinacionService.suscribir(rutaCombinacion); + + if (rutaCombinacion.getRutacombinacionId() == null){ + throw new BusinessException(Labels.getLabel("gerarCombinacionTramoRutaController.MSG.error.rutaCombinacion")); + } + } + } + + //calculo do tempo sempre considerando que o calculo deve ser feito desconsiderando o valor do tempo, + //inicializando com o tempo da origem e incrementando as sequencias anteriores + private HoraSistema calcularTempoTotalDestino(ParadaSecuenciaCombinacaoLinha sequenciaOrigem, int numSeqAtual) { + HoraSistema horaSistema = sequenciaOrigem.getTempoReal().isEmpty() ? new HoraSistema() : new HoraSistema(DateUtil.getDataTempoDecorrido(sequenciaOrigem.getTempoReal())); + + for (ParadaSecuencia destino: sequenciaOrigem.getDestinos()) { + HoraSistema horaSistemaDestino = destino.getTempoReal().isEmpty() ? new HoraSistema() : + new HoraSistema(DateUtil.getDataTempoDecorrido(destino.getTempoReal())); + + //desconsidera o tempo para os destinos com sequencia inferior a origem, já que estes já foram calculados + if (sequenciaOrigem.getOrigem().getSecuencia() > destino.getSecuencia()) { + continue; + } + + //faz o calculo para a sequencia do destino para qual o tempo está sendo calculado + if (destino.getSecuencia() == numSeqAtual){ + break; + } + + horaSistema = horaSistema.sumar(horaSistemaDestino); + } + + return horaSistema; + + } + + //calculo da km sempre considerando que o calculo deve ser feito desconsiderando o valor da km, + //inicializando com o valor da km da origem e incrementando as sequencias anteriores + private BigDecimal calcularKmDestino(ParadaSecuenciaCombinacaoLinha sequenciaOrigem, int numSeqAtual) { + BigDecimal kmTotal= sequenciaOrigem.getKmReal() == null || sequenciaOrigem.getKmReal().isEmpty() ? BigDecimal.ZERO : + new BigDecimal(sequenciaOrigem.getKmReal()); + + for (ParadaSecuencia destino: sequenciaOrigem.getDestinos()) { + //desconsidera a km para os destinos com sequencia inferior a origem, já que estes já foram calculados + if (sequenciaOrigem.getOrigem().getSecuencia() > destino.getSecuencia()) { + continue; + } + + //faz o calculo para a sequencia do destino para qual a km está sendo calculada + if (destino.getSecuencia() == numSeqAtual){ + break; + } + + BigDecimal kmDestino= destino.getKmReal() == null || destino.getKmReal().isEmpty() ? BigDecimal.ZERO : + new BigDecimal(destino.getKmReal()); + + kmTotal = kmTotal.add(kmDestino); + } + + return kmTotal; + } + + @Transactional + public void limparInconsistenciasTramo() { + tramoServicioDAO.limparInconsistenciasTramo(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TramoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TramoServiceImpl.java new file mode 100644 index 000000000..125df8eae --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TramoServiceImpl.java @@ -0,0 +1,297 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.Predicate; +import org.hibernate.LazyInitializationException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.RutaCombinacionDAO; +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.OrgaoTramo; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.TramoTiempo; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.EsquemaCorridaService; +import com.rjconsultores.ventaboletos.service.TarifaService; +import com.rjconsultores.ventaboletos.service.TramoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("tramoService") +public class TramoServiceImpl implements TramoService { + + @Autowired + private TramoDAO tramoDAO; + @Autowired + private RutaCombinacionDAO rutaCombinacionDAO; + @Autowired + private EsquemaCorridaService esquemaCorridaService; + @Autowired + private TarifaService tarifaService; + + public List obtenerTodos() { + return tramoDAO.obtenerTodos(); + } + + public Tramo obtenerID(Integer id) { + return tramoDAO.obtenerID(id); + } + + @Transactional(rollbackFor = BusinessException.class) + public void borrar(Tramo entidad) throws BusinessException { + + + boolean rutaOcupaTramo = rutaCombinacionDAO.existeTramo(entidad); + if (rutaOcupaTramo){ + throw new BusinessException("editarTramosController.MSG.borrarFalse"); + } + + boolean existeEsquemaCorrida = esquemaCorridaService.buscarEsquemaCorridaExisteTramo(entidad); + if (existeEsquemaCorrida){ + throw new BusinessException("editarTramosController.MSG.borrarFalse"); + } + + boolean existeTarifa = tarifaService.buscarTarifaExisteTramo(entidad); + if (existeTarifa){ + throw new BusinessException("editarTramosController.MSG.borrarFalse"); + } + + entidad = tramoDAO.obtenerID(entidad.getTramoId()); + if (entidad.getLsTramoTiempo() != null) { + for (TramoTiempo tramo : entidad.getLsTramoTiempo()) { + tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramo.setFecmodif(Calendar.getInstance().getTime()); + tramo.setActivo(Boolean.FALSE); + } + } + + if (entidad.getTramoServicioList() != null) { + for (TramoServicio tramo : entidad.getTramoServicioList()) { + tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramo.setFecmodif(Calendar.getInstance().getTime()); + tramo.setActivo(Boolean.FALSE); + } + } + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tramoDAO.actualizacion(entidad); + } + + public Tramo obtenerPorOrigemDestino(Parada origem, Parada destino) { + return tramoDAO.obtenerPorOrigemDestino(origem, destino); + } + + public List obtenerListPorOrigemDestino(Parada origem, Parada destino) { + return tramoDAO.obtenerListPorOrigemDestino(origem, destino); + } + + public Tramo obtenerTramotPorOrigemDestinoVia(Parada origem, Parada destino, Via via) { + return tramoDAO.obtenerTramotPorOrigemDestinoVia(origem, destino, via); + } + + public Tramo buscar(Parada origem, Parada destino, Via via) { + return tramoDAO.busca(origem, destino, via); + } + + @Override + public String gerarDescripcionTramo(Parada origen,Parada destino,Via via){ + String descTramo = origen.getCveparada() + "-" + destino.getCveparada() + "(" + via.getNombvia() + ")"; + if (descTramo.length() > 20) { + descTramo = descTramo.substring(0, 20); + } + return descTramo; + } + + public List buscarCveParada(String origen, String destino, String via) { + return tramoDAO.buscarCveParada(origen, destino, via); + } + + public Tramo obtenerTramoUnicoRuta(Parada origem, Parada destino, Via via, ClaseServicio claseServicio) { + return tramoDAO.obtenerTramoUnicoRuta(origem, destino, via, claseServicio); + } + + public List buscar(List lsParadas, Via via) { + List respuesta = new ArrayList(); + + Parada origen = lsParadas.get(0); + Parada destino = null; + + + for (int i = 1; i < lsParadas.size(); i++) { + destino = lsParadas.get(i); + Tramo busca = tramoDAO.busca(origen, destino, via); + + if (busca!= null) { + respuesta.add(busca); + } + } + + return respuesta; + } + + @Transactional + public void guardarTramosKm(List lsTramos, Via via) { + for (Tramo tramo : lsTramos) { + Tramo busca = tramoDAO.busca(tramo.getOrigem(), tramo.getDestino(), via); + if (busca==null) { + tramo.setVia(via); + tramo.setActivo(Boolean.TRUE); + tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramo.setFecmodif(Calendar.getInstance().getTime()); + tramo.setDesctramo(tramo.getOrigem().getCveparada().trim()+"-"+tramo.getDestino().getCveparada().trim()); + tramoDAO.suscribir(tramo); + + } else { + Tramo tramoExiste = busca; + tramoExiste.setKmPagoConductor(tramo.getKmPagoConductor()); + tramoExiste.setKmReal(tramo.getKmReal()); + tramoExiste.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramoExiste.setFecmodif(Calendar.getInstance().getTime()); + } + } + } + public List obtenerViasOrigemDestino(Parada origem, Parada destino) { + return tramoDAO.obtenerViasOrigemDestino(origem, destino); + } + public List obtenerPorOrigemDestinoFetchLazy(Parada origem, Parada destino) { + return tramoDAO.obtenerPorOrigemDestinoFetchLazy(origem, destino); + } + + private List getListTramoService(Tramo t){ + return tramoDAO.obtenerTramosServiciosPorTramo(t); + } + + public List getLsOrgaoTramoByTramo(Tramo tramo){ + return tramoDAO.getLsOrgaoTramo(tramo); + } + + @Override + @Transactional(rollbackFor = BusinessException.class) + public Tramo suscribirActualizar(Tramo tramo) throws BusinessException { + + + Tramo tramoBusqueda = buscar(tramo.getOrigem(), tramo.getDestino(), tramo.getVia()); + + if (tramo.getOrigem().equals(tramo.getDestino())) { + throw new BusinessException("editarTramosController.MSG.OrigemDestinoIguais"); + } + + if ((tramoBusqueda != null) && (tramo.getTramoId() == null)) { + throw new BusinessException("MSG.Registro.Existe.Origem.Destino.Via"); + } + + if ((tramoBusqueda != null) && (!tramo.equals(tramoBusqueda))) { + throw new BusinessException("MSG.Registro.Existe.Origem.Destino.Via"); + } + + + if (tramo.getTramoId() != null) { + boolean rutaOcupaTramo = rutaCombinacionDAO.existeTramo(tramo); + + if (rutaOcupaTramo) { + Tramo tramoOriginal = tramoDAO.obtenerID(tramo.getTramoId()); + + if (!tramo.getVia().equals(tramoOriginal.getVia())) { + throw new BusinessException("TramoServiceImpl.msg.validacionVia"); + } + + if (!tramo.getOrigem().equals(tramoOriginal.getOrigem())) { + throw new BusinessException("TramoServiceImpl.msg.validacionOrigen"); + } + + if (!tramo.getDestino().equals(tramoOriginal.getDestino())) { + throw new BusinessException("TramoServiceImpl.msg.validacionDestino"); + } + + // Validación: No es posible quitar ClaseServicio de un tramo que esta asociado a una ruta e esa ruta tenga la misma clase de servicio + // Esa validación tambien permite que el usuario quite una clase y la agregue de nuevo con otro tiempo de recorrido + List lsTramoServicioOriginal = tramoOriginal.getTramoServicioList(); + for (final TramoServicio ts : lsTramoServicioOriginal) { + + + boolean alterouClaseTramoServico = true; + + try{ + tramo.getTramoServicioList(); + } catch(LazyInitializationException le){ + tramo.setTramoServicioList(getListTramoService(tramo)); + } + + for( TramoServicio tsNovo : tramo.getTramoServicioList()){ + if (tsNovo.getClaseServicio().equals(ts.getClaseServicio())){ + alterouClaseTramoServico = false; + break; + } + } + + if (alterouClaseTramoServico) { + if (rutaCombinacionDAO.existeTramo(tramo, ts.getClaseServicio())) { + throw new BusinessException("TramoServiceImpl.msg.validacionTramoServicio"); + } + } + } + + List lsTramoTiempoOriginal = tramoOriginal.getLsTramoTiempo(); + for (final TramoTiempo tt : lsTramoTiempoOriginal) { + boolean existe = CollectionUtils.exists(tramo.getLsTramoTiempo(), new Predicate() { + + @Override + public boolean evaluate(Object o) { + TramoTiempo t = (TramoTiempo) o; + if (t.getActivo()) { + return t.getClaseServicio().equals(tt.getClaseServicio()); + } + return false; + } + }); + + if (!existe) { + if (rutaCombinacionDAO.existeTramo(tramo, tt.getClaseServicio())) { + throw new BusinessException("TramoServiceImpl.msg.validacionTramoTiempo"); + } + } + } + + } + } + + tramo.setDesctramo(gerarDescripcionTramo(tramo.getOrigem(), tramo.getDestino(), tramo.getVia())); + tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramo.setFecmodif(Calendar.getInstance().getTime()); + tramo.setActivo(Boolean.TRUE); + + if (tramo.getTramoId() == null) { + return tramoDAO.suscribir(tramo); + } else { + return tramoDAO.actualizacion(tramo); + } + } + + @Override + public Boolean existe(Parada origem, Parada destino) { + if(tramoDAO.obtenerPorOrigemDestino(origem, destino).getTramoId()!=null){ + return true; + } + return false; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TramoServicioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TramoServicioServiceImpl.java new file mode 100644 index 000000000..9c14c22a9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TramoServicioServiceImpl.java @@ -0,0 +1,128 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.dao.TramoServicioDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoServicio; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.service.TramoService; +import com.rjconsultores.ventaboletos.service.TramoServicioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Rafius + */ +@Service("tramoServicioService") +public class TramoServicioServiceImpl implements TramoServicioService { + + @Autowired + private TramoServicioDAO tramoServicioDAO; + @Autowired + private TramoService tramoService; + @Autowired + private TramoDAO tramoDAO; + + public List obtenerTodos() { + return tramoServicioDAO.obtenerTodos(); + } + + public TramoServicio obtenerID(Integer id) { + return tramoServicioDAO.obtenerID(id); + } + + @Transactional + public TramoServicio suscribir(TramoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tramoServicioDAO.suscribir(entidad); + } + + @Transactional + public TramoServicio actualizacion(TramoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tramoServicioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TramoServicio entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tramoServicioDAO.actualizacion(entidad); + } + + public List buscarPorTramo(Tramo tramo) { + return tramoServicioDAO.buscarPorTramo(tramo); + } + + public List buscarPorTramoServico(Tramo tramo, ClaseServicio clase) { + return tramoServicioDAO.buscarPorTramo(tramo, clase); + } + + @Override + public TramoServicio buscar(Parada origen, Parada destino, Via via, ClaseServicio clase) { + return tramoServicioDAO.buscar(origen, destino, via, clase); + } + + @Override + @Transactional + public boolean generarTramoTiempo(Parada origen, Parada destino, Via via, BigDecimal kmsReal,Date tiempoRecorrido, ClaseServicio claseServicio) { + + TramoServicio tramoServicio = tramoServicioDAO.buscar(origen, destino, via, claseServicio); + + Tramo tramo = null; + if (tramoServicio == null) { + tramo = tramoService.buscar(origen, destino, via); + if (tramo == null) { + tramo = new Tramo(); + tramo.setDesctramo(tramoService.gerarDescripcionTramo(origen, destino, via)); + tramo.setOrigem(origen); + tramo.setDestino(destino); + tramo.setKmReal(kmsReal); + tramo.setVia(via); + tramo.setActivo(Boolean.TRUE); + tramo.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + tramo.setFecmodif(new java.util.Date()); + + tramo = tramoDAO.suscribir(tramo); + } + tramoServicio = new TramoServicio(); + tramoServicio.setClaseServicio(claseServicio); + tramoServicio.setTramo(tramo); + tramoServicio.setTiemporecorrido(tiempoRecorrido); + + tramoServicio = this.suscribir(tramoServicio); + + return true; + } + + return false; + } + + @Override + public boolean existenTiemposTramosEsquema(Integer esquemaCorridaId) { + return tramoServicioDAO.existenTiemposTramosEsquema(esquemaCorridaId); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TramoTiempoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TramoTiempoServiceImpl.java new file mode 100644 index 000000000..f04f5ccab --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TramoTiempoServiceImpl.java @@ -0,0 +1,76 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TramoTiempoDAO; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.entidad.TramoTiempo; +import com.rjconsultores.ventaboletos.service.TramoTiempoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Administrador + */ +@Service("tramoTiempoService") +public class TramoTiempoServiceImpl implements TramoTiempoService { + + @Autowired + private TramoTiempoDAO tramoTiempoDAO; + + public List obtenerTodos() { + return tramoTiempoDAO.obtenerTodos(); + } + + public TramoTiempo obtenerID(Integer id) { + return tramoTiempoDAO.obtenerID(id); + } + + @Transactional + public TramoTiempo suscribir(TramoTiempo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tramoTiempoDAO.suscribir(entidad); + } + + @Transactional + public TramoTiempo actualizacion(TramoTiempo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return tramoTiempoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TramoTiempo entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + tramoTiempoDAO.actualizacion(entidad); + } + + public List buscarPorTramo(Tramo tramo) { + return tramoTiempoDAO.buscarPorTramo(tramo); + } + + public List buscarPorTramo(Tramo tramo,ClaseServicio clase) { + return tramoTiempoDAO.buscarPorTramo(tramo, clase); + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TurnoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TurnoServiceImpl.java new file mode 100644 index 000000000..c8509c966 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TurnoServiceImpl.java @@ -0,0 +1,65 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TurnoDAO; +import com.rjconsultores.ventaboletos.entidad.Turno; +import com.rjconsultores.ventaboletos.service.TurnoService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("turnoService") +public class TurnoServiceImpl implements TurnoService { + + @Autowired + private TurnoDAO turnoDAO; + + public List obtenerTodos() { + return turnoDAO.obtenerTodos(); + } + + public Turno obtenerID(Integer id) { + return turnoDAO.obtenerID(id); + } + + @Transactional + public Turno suscribir(Turno entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return turnoDAO.suscribir(entidad); + } + + @Transactional + public Turno actualizacion(Turno entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return turnoDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Turno entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + turnoDAO.actualizacion(entidad); + } + + public List buscar(String descturno) { + return turnoDAO.buscar(descturno); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioBancarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioBancarioServiceImpl.java new file mode 100644 index 000000000..436c2c27e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioBancarioServiceImpl.java @@ -0,0 +1,61 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.UsuarioBancarioDAO; +import com.rjconsultores.ventaboletos.entidad.UsuarioBancario; +import com.rjconsultores.ventaboletos.service.UsuarioBancarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("usuarioBancarioService") +public class UsuarioBancarioServiceImpl implements UsuarioBancarioService { + + @Autowired + private UsuarioBancarioDAO usuarioBancarioDAO; + + public List obtenerTodos() { + return usuarioBancarioDAO.obtenerTodos(); + } + + public UsuarioBancario obtenerID(Integer id) { + return usuarioBancarioDAO.obtenerID(id); + } + + @Transactional + public UsuarioBancario suscribir(UsuarioBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioBancarioDAO.suscribir(entidad); + } + + @Transactional + public UsuarioBancario actualizacion(UsuarioBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioBancarioDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(UsuarioBancario entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + usuarioBancarioDAO.actualizacion(entidad); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioEmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioEmpresaServiceImpl.java new file mode 100644 index 000000000..bf299c5d6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioEmpresaServiceImpl.java @@ -0,0 +1,71 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.UsuarioEmpresaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioEmpresa; +import com.rjconsultores.ventaboletos.service.UsuarioEmpresaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("usuarioEmpresaService") +public class UsuarioEmpresaServiceImpl implements UsuarioEmpresaService { + + @Autowired + private UsuarioEmpresaDAO usuarioEmpresaDAO; + + public List obtenerTodos() { + return usuarioEmpresaDAO.obtenerTodos(); + } + + public UsuarioEmpresa obtenerID(Integer id) { + return usuarioEmpresaDAO.obtenerID(id); + } + + @Transactional + public UsuarioEmpresa suscribir(UsuarioEmpresa entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioEmpresaDAO.suscribir(entidad); + } + + @Transactional + public UsuarioEmpresa actualizacion(UsuarioEmpresa entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioEmpresaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(UsuarioEmpresa entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + usuarioEmpresaDAO.actualizacion(entidad); + } + + public List obtenerPorUsuario(Usuario usuario) { + return usuarioEmpresaDAO.obtenerPorUsuario(usuario); + } + + public List obtenerEmpresa(Usuario usuario) { + return usuarioEmpresaDAO.obtenerEmpresa(usuario); + } + + public Boolean obtenerPorEmpresaUsuario(Empresa empresa, Usuario usuario) { + return usuarioEmpresaDAO.obtenerPorEmpresaUsuario( empresa, usuario); + } + +} + diff --git a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioPerfilServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioPerfilServiceImpl.java new file mode 100644 index 000000000..e99f44984 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioPerfilServiceImpl.java @@ -0,0 +1,90 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.UsuarioPerfilDAO; +import com.rjconsultores.ventaboletos.entidad.PerfilFuncion; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; +import com.rjconsultores.ventaboletos.service.UsuarioPerfilService; +import com.rjconsultores.ventaboletos.service.UsuarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Rafius + */ +@Service("usuarioPerfilService") +public class UsuarioPerfilServiceImpl implements UsuarioPerfilService { + + @Autowired + private UsuarioPerfilDAO usuarioPerfilDAO; + + @Autowired + private UsuarioService usuarioService; + + public List obtenerTodos() { + return usuarioPerfilDAO.obtenerTodos(); + } + + public UsuarioPerfil obtenerID(Integer id) { + return usuarioPerfilDAO.obtenerID(id); + } + + @Transactional + public UsuarioPerfil suscribir(UsuarioPerfil entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioPerfilDAO.suscribir(entidad); + } + + @Transactional + public UsuarioPerfil actualizacion(UsuarioPerfil entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioPerfilDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(UsuarioPerfil entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + usuarioPerfilDAO.actualizacion(entidad); + } + + public List obtenerPorUsuario(Usuario usuario) { + return usuarioPerfilDAO.obtenerPorUsuario(usuario); + } + + @Transactional + @Override + public boolean validaPermissaoPerfilEdicao(String funcionSistema) { + Usuario usuarioLogado = usuarioService.obtenerID(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + List listUsuarioPerfil = usuarioLogado.getUsuarioPerfilList(); + for (UsuarioPerfil up : listUsuarioPerfil) { + List listPerfilFuncion = up.getPerfil().getPerfilFuncionList(); + for (PerfilFuncion pf : listPerfilFuncion) { + if(pf.getFuncionSistema().getDescruta().equals(funcionSistema)) { + if(!pf.getIndLectura()) { + return true; + } + } + } + } + + return false; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java new file mode 100644 index 000000000..34f6fa709 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java @@ -0,0 +1,267 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.security.authentication.CredentialsExpiredException; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.core.userdetails.UserDetailsService; +import org.springframework.security.core.userdetails.UsernameNotFoundException; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.UsuarioDAO; +import com.rjconsultores.ventaboletos.dao.UsuarioPerfilDAO; +import com.rjconsultores.ventaboletos.entidad.Empleado; +import com.rjconsultores.ventaboletos.entidad.Perfil; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; +import com.rjconsultores.ventaboletos.service.UsuarioService; +import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; +import com.rjconsultores.ventaboletos.utilerias.CustomEnum; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.utilerias.seguridad.ContrasenaUtileria; +import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO; + +/** + * + * @author Administrador + */ +@Service("usuarioService") +public class UsuarioServiceImpl implements UsuarioService, UserDetailsService { + + @Autowired + private UsuarioDAO usuarioDAO; + @Autowired + private UsuarioPerfilDAO usuarioPerfilDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; + private static Logger log = Logger.getLogger(UsuarioServiceImpl.class); + + + public List buscarPeloNome(String nome) { + return usuarioDAO.buscarPeloNome(nome); + } + + public List obtenerTodos() { + return usuarioDAO.obtenerTodos(); + } + + public Usuario obtenerID(Integer id) { + + Usuario usuario = usuarioDAO.obtenerID(id); + try { + usuario.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return usuario; + + } + + @Transactional(rollbackFor = BusinessException.class) + @Override + public Usuario suscribirActualizar(Usuario entidad, String senha, Perfil perfil) throws BusinessException { + + try{ + + Usuario originalClone = entidad.getCloneObject(); + + // validación duplicado + List lsUsuario = this.buscarPelaCveUsuario(entidad.getClaveUsuario()); + boolean podeSalvar = false; + if (lsUsuario.isEmpty()) { + podeSalvar = true; + } else { + if (entidad.getUsuarioId() != null) { + for (Usuario u : lsUsuario) { + if (u.getUsuarioId().equals(entidad.getUsuarioId())) { + podeSalvar = true; + } + } + } + } + + if (!podeSalvar) { + throw new BusinessException("MSG.Registro.Existe"); + } + if (senha != null) { + // validación complejidad contrasena + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CONTRASENA_VALIDA_COMPLEJIDAD.getDescricao())) { + ContrasenaUtileria contrasenaUtileria = new ContrasenaUtileria(); + contrasenaUtileria.validarContrasenaCompleja(senha); + } + + // encriptación contrasena + entidad.setSenha(ContrasenaUtileria.encriptarContrasena(senha)); + } + + // Perfil + UsuarioPerfil up = new UsuarioPerfil(); + up.setUsuario(entidad); + up.setPerfil(perfil); + up.setActivo(Boolean.TRUE); + up.setFecmodif(Calendar.getInstance().getTime()); + up.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + if (entidad.getUsuarioId() != null) { + List lsUsuarioPerfil = usuarioPerfilDAO.obtenerPorUsuario(entidad); + for (UsuarioPerfil up2 : lsUsuarioPerfil) { + usuarioPerfilDAO.borrar(up2); + } + } + List lsUp = new ArrayList(); + lsUp.add(up); + entidad.setUsuarioPerfilList(lsUp); + + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getUsuarioId() == null) { + return usuarioDAO.suscribir(entidad); + } else { + entidad = usuarioDAO.actualizacion(entidad); + logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresa() != null && !entidad.getEmpresa().isEmpty()? entidad.getEmpresa().get(0).getEmpresaId(): null); + return entidad; + } + }catch (Exception e) { + log.error(e.getMessage(), e); + throw new RuntimeException(e.getMessage(), e); + } + } + + @Transactional(rollbackFor = BusinessException.class) + @Override + public Usuario cambiarContrasena(Usuario entidad, String senha) throws BusinessException { + + // validación duplicado + List lsUsuario = this.buscarPelaCveUsuario(entidad.getClaveUsuario()); + boolean podeSalvar = false; + if (lsUsuario.isEmpty()) { + podeSalvar = true; + } else { + if (entidad.getUsuarioId() != null) { + for (Usuario u : lsUsuario) { + if (u.getUsuarioId().equals(entidad.getUsuarioId())) { + podeSalvar = true; + } + } + } + } + + if (!podeSalvar) { + throw new BusinessException("MSG.Registro.Existe"); + } + if (senha != null) { + // validación complejidad contrasena + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CONTRASENA_VALIDA_COMPLEJIDAD.getDescricao())) { + ContrasenaUtileria contrasenaUtileria = new ContrasenaUtileria(); + contrasenaUtileria.validarContrasenaCompleja(senha); + } + + // encriptación contrasena + entidad.setSenha(ContrasenaUtileria.encriptarContrasena(senha)); + } + + entidad.setFecContrasena(Calendar.getInstance().getTime()); + entidad.setUsuariomodifId(entidad.getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + if (entidad.getUsuarioId() != null) { + return usuarioDAO.actualizacion(entidad); + } else { + throw new BusinessException("MSG.Registro.Existe"); + } + } + + @Transactional + public void borrar(Usuario entidad) { + + entidad = obtenerID(entidad.getUsuarioId()); + + for (UsuarioPerfil up : entidad.getUsuarioPerfilList()) { + up.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + up.setFecmodif(Calendar.getInstance().getTime()); + up.setActivo(Boolean.FALSE); + } + + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + usuarioDAO.actualizacion(entidad); + } + + public Usuario buscarPeloNomeSenha(String stUsuario, String senha) { + senha = ContrasenaUtileria.encriptarContrasena(senha); + return usuarioDAO.buscarPeloNomeSenha(stUsuario, senha); + } + + @Override + public UserDetails loadUserByUsername(String login) throws UsernameNotFoundException, DataAccessException, CredentialsExpiredException { + if (login == null) { + throw new UsernameNotFoundException("Usuario não encontrado"); + } + List list = usuarioDAO.buscarPelaCveUsuario(login.toUpperCase()); + + if (list.isEmpty()) { + throw new UsernameNotFoundException("Usuario não encontrado"); + } + + Usuario user = list.get(0); + + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CONTRASENA_VALIDA_COMPLEJIDAD.getDescricao())) { + if (!user.isCredentialsNonExpired()) { + throw new CredentialsExpiredException("Senha Expirada"); + } + } + + return user; + } + + public List buscarPorEmpleado(Empleado empleado) { + return usuarioDAO.buscarPorEmpleado(empleado); + } + + public List buscarPelaCveUsuario(String cveUsuario) { + return usuarioDAO.buscarPelaCveUsuario(cveUsuario); + } + + @Override + public List buscarPeloNomeLike(String nome) { + return usuarioDAO.buscarPeloNomeLike(nome); + } + + @Override + public List buscarUsuariosEmbarcadaPorPontoVenda(Long puntoVentaId) { + return usuarioDAO.buscarUsuarioPorPontoVenda(puntoVentaId); + } + + @Override + public List buscarUsuariosEmbarcadaPorDispositivo(Long dispositivoEmbarcadaId){ + return usuarioDAO.buscarUsuarioPorDispositivo(dispositivoEmbarcadaId); + } + + @Override + public List buscarUsuarioEmbarcadaPorUsuariosIds(List usuariosIdList) { + return usuarioDAO.buscarUsuarioEmbarcadaPorUsuariosIds(usuariosIdList); + } + + @Override + public List buscaUsuariosDoPuntoVenta(Long puntoVentaId) { + return usuarioDAO.buscaUsuariosDoPuntoVenta(puntoVentaId); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioSesionImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioSesionImpl.java new file mode 100644 index 000000000..4c99e8d65 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioSesionImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.UsuarioSesionDAO; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioSesion; +import com.rjconsultores.ventaboletos.service.UsuarioSesionService; + +/** + * + * @author RJ Consultores + */ +@Service("usuarioSesionService") +public class UsuarioSesionImpl implements UsuarioSesionService { + + @Autowired + private UsuarioSesionDAO usuarioSesionDAO; + + public List obtenerTodos() { + return usuarioSesionDAO.obtenerTodos(); + } + + public UsuarioSesion obtenerID(Integer id) { + return usuarioSesionDAO.obtenerID(id); + } + + @Transactional + public UsuarioSesion suscribir(UsuarioSesion entidad) { + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioSesionDAO.suscribir(entidad); + } + + @Transactional + public UsuarioSesion actualizacion(UsuarioSesion entidad) { + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioSesionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(UsuarioSesion entidad) { + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + usuarioSesionDAO.actualizacion(entidad); + } + + @Override + public List buscar(Usuario usuario) { + return usuarioSesionDAO.buscar(usuario); + } + + @Transactional + @Override + public void liberarUsuario(Usuario usuario) { + usuarioSesionDAO.liberarUsuario(usuario); + + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioUbicacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioUbicacionServiceImpl.java new file mode 100644 index 000000000..13ff272cd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioUbicacionServiceImpl.java @@ -0,0 +1,66 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.UsuarioUbicacionDAO; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion; +import com.rjconsultores.ventaboletos.service.UsuarioUbicacionService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import org.springframework.stereotype.Service; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author rodrigo + */ +@Service("usuarioUbicacionService") +public class UsuarioUbicacionServiceImpl implements UsuarioUbicacionService { + + @Autowired + private UsuarioUbicacionDAO usuarioUbicacionDAO; + + public List obtenerTodos() { + return usuarioUbicacionDAO.obtenerTodos(); + } + + public UsuarioUbicacion obtenerID(Integer id) { + return usuarioUbicacionDAO.obtenerID(id); + } + + @Transactional + public UsuarioUbicacion suscribir(UsuarioUbicacion entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioUbicacionDAO.suscribir(entidad); + } + + @Transactional + public UsuarioUbicacion actualizacion(UsuarioUbicacion entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return usuarioUbicacionDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(UsuarioUbicacion entidad) { + entidad.setUsuariomodifId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + usuarioUbicacionDAO.actualizacion(entidad); + } + + public List buscarPorUsuario(Usuario usuario) { + return usuarioUbicacionDAO.buscarPorUsuario(usuario); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/VendaEmbarcadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/VendaEmbarcadaServiceImpl.java new file mode 100644 index 000000000..00c689ce3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/VendaEmbarcadaServiceImpl.java @@ -0,0 +1,51 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import org.slf4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.constantes.ConstantesVendaEmbarcada; +import com.rjconsultores.ventaboletos.dao.CajaDAO; +import com.rjconsultores.ventaboletos.dao.hibernate.CajaHibernateDAO; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaBoletoFormapagoException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaException; +import com.rjconsultores.ventaboletos.exception.VendaEmbarcadaCajaFormapagoException; +import com.rjconsultores.ventaboletos.service.VendaEmbarcadaService; +import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO; + +@Service("VendaEmbarcadaService") +public class VendaEmbarcadaServiceImpl implements VendaEmbarcadaService { + + private static Logger log = org.slf4j.LoggerFactory.getLogger(CajaHibernateDAO.class); + + @Autowired + CajaDAO cajaDao; + + @Override + public int gerarVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) throws BusinessException { + try { + cajaDao.gerarVendaEmbarcada(vendaEmbarcada); + + return ConstantesVendaEmbarcada.VENDA_GERADA; + } catch (VendaEmbarcadaBoletoException e) { + log.error(e.getMessage(), e); + return ConstantesVendaEmbarcada.VENDA_BOLETO_ERROR; + } catch (VendaEmbarcadaBoletoFormapagoException e) { + log.error(e.getMessage(), e); + return ConstantesVendaEmbarcada.VENDA_BOLETO_FORMAPAGO_ERROR; + } catch (VendaEmbarcadaCajaException e) { + log.error(e.getMessage(), e); + return ConstantesVendaEmbarcada.VENDA_CAJA_ERROR; + } catch (VendaEmbarcadaCajaFormapagoException e) { + log.error(e.getMessage(), e); + return ConstantesVendaEmbarcada.VENDA_CAJA_FORMAPAGO_ERROR; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ViaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ViaServiceImpl.java new file mode 100644 index 000000000..64c6024e0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ViaServiceImpl.java @@ -0,0 +1,72 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.dao.ViaDAO; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.service.ViaService; +import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import java.util.Calendar; +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * + * @author Administrador + */ +@Service("viaService") +public class ViaServiceImpl implements ViaService { + + @Autowired + private ViaDAO viaDAO; + @Autowired + private TramoDAO tramoDAO; + + public List obtenerTodos() { + return viaDAO.obtenerTodos(); + } + + public Via obtenerID(Integer id) { + return viaDAO.obtenerID(id); + } + + @Transactional + public Via suscribir(Via entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return viaDAO.suscribir(entidad); + } + + @Transactional + public Via actualizacion(Via entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return viaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Via entidad) throws RegistroConDependenciaException { + if (tramoDAO.count("via", entidad) > 0l) { + throw new RegistroConDependenciaException(); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + viaDAO.actualizacion(entidad); + } + + public List buscar(String nombvia) { + return viaDAO.buscar(nombvia); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/VigenciaTarifaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/VigenciaTarifaServiceImpl.java new file mode 100644 index 000000000..afd21b673 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/VigenciaTarifaServiceImpl.java @@ -0,0 +1,84 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.VigenciaTarifaDAO; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; +import com.rjconsultores.ventaboletos.service.VigenciaTarifaService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author rodrigo + */ +@Service("vigenciaTarifaService") +public class VigenciaTarifaServiceImpl implements VigenciaTarifaService { + + @Autowired + private VigenciaTarifaDAO vigenciaTarifaDAO; + + public List obtenerTodos() { + return vigenciaTarifaDAO.obtenerTodos(); + } + + public VigenciaTarifa obtenerID(Integer id) { + return vigenciaTarifaDAO.obtenerID(id); + } + + @Transactional + public VigenciaTarifa suscribir(VigenciaTarifa entidad) { + entidad = forcePeriodLimits(entidad); + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return vigenciaTarifaDAO.suscribir(entidad); + } + + @Transactional + public VigenciaTarifa actualizacion(VigenciaTarifa entidad) { + entidad = forcePeriodLimits(entidad); + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return vigenciaTarifaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(VigenciaTarifa entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + vigenciaTarifaDAO.actualizacion(entidad); + } + + public List pesquisar(Date inicio, Date fim) { + return vigenciaTarifaDAO.pesquisar(inicio, fim); + } + + public List buscarVigenciasIntervalo(VigenciaTarifa vigenciaTarifa) { + return vigenciaTarifaDAO.buscarVigenciasIntervalo(vigenciaTarifa); + } + + private VigenciaTarifa forcePeriodLimits(VigenciaTarifa entidad) { + entidad.setFeciniciovigencia(DateUtil.inicioFecha(entidad.getFeciniciovigencia())); + entidad.setFecfinvigencia(DateUtil.fimFecha(entidad.getFecfinvigencia())); + + return entidad; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/ActivoUtil.java b/src/com/rjconsultores/ventaboletos/utilerias/ActivoUtil.java new file mode 100644 index 000000000..414f8e7c9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/ActivoUtil.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.utilerias; + +public class ActivoUtil { + + public static final Integer ATIVO = 1; + public static final Integer INATIVO = 2; + public static final Integer EXCLUIDO = 0; + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/Application.java b/src/com/rjconsultores/ventaboletos/utilerias/Application.java new file mode 100644 index 000000000..68f7125e2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/Application.java @@ -0,0 +1,17 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import com.rjconsultores.ventaboletos.entidad.Imagem; + +public class Application { + + private Imagem image; + + public Imagem getImage() { + return image; + } + + public void setImage(Imagem image) { + this.image = image; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/ApplicationProperties.java b/src/com/rjconsultores/ventaboletos/utilerias/ApplicationProperties.java new file mode 100644 index 000000000..240d2ceb4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/ApplicationProperties.java @@ -0,0 +1,220 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.utilerias; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.core.io.ClassPathResource; + +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.entidad.Custom; +import com.rjconsultores.ventaboletos.entidad.Imagem; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.service.CustomService; +import com.rjconsultores.ventaboletos.service.ImagemService; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +/** + * Clase con las propriedad especificas de los clientes + * + * @author Administrador + */ + +public class ApplicationProperties { + private static Logger log = Logger.getLogger(ApplicationProperties.class); + private static ApplicationProperties INSTANCE; + private static Properties p; + private static final String PATH_IMAGENES = "/com/rjconsultores/ventaboletos/web/cliente/imagenes/"; + + private Boolean readOnlyConnection = Boolean.TRUE; + + private ApplicationProperties() { + p = new Properties(); + this.readConfiguration(); + this.readConfigurationToDatabase(); + this.readReadOnlyConnection(); + } + + public static ApplicationProperties getInstance() { + if (INSTANCE == null) { + INSTANCE = new ApplicationProperties(); + } + + return INSTANCE; + } + + private void readConfiguration() { + try { + + InputStream is = new ClassPathResource("/com/rjconsultores/ventaboletos/web/cliente/conf/application.properties").getInputStream(); + p.load(is); + is.close(); + } catch (IOException e) { + log.error(e); + } + } + + /** + * Insere na tabela de custom os registros que existem no Enum, o valor inicial ao inserir de cada custom é baseado no arquivo de propriedades + * {@code database.properties}, caso não exista é inserido com valor {@code null}. A cada novo parâmetro no Enum será adicionado um registro na tabela de custom. Não deverá mais ser adicionado + * mais informações no arquivo de propriedades, somente no Enum {@code CustomEnum}. + * @see #CustomEnum + */ + public void readConfigurationToDatabase() { + + try { + CustomService customService = (CustomService) AppContext.getApplicationContext().getBean("customService"); + for (CustomEnum customEnum : CustomEnum.values()) { + log.info("Verificando custom=" + customEnum.toString()); + if (customService.buscar(customEnum.toString()) == null) { + + Custom custom = new Custom(); + custom.setChave(customEnum.toString()); + custom.setValor(p.getProperty(customEnum.toString())); + custom.setSistema(Custom.TIPO_SISTEMA_ADM); + customService.suscribir(custom); + + log.info("Adicionado custom=" + customEnum.toString()); + } + } + + } catch (Exception e) { + log.error("", e); + } + } + + private String getValuefromCustom(String key, String defaultValue) { + + try { + CustomService customService = (CustomService) AppContext.getApplicationContext().getBean("customService"); + Custom custom = customService.buscar(key); + if (custom != null) { + String val = custom.getValor(); + return (val == null) ? defaultValue : val; + } + + } catch (Exception e) { + log.error("", e); + } + + return defaultValue; + + } + + public Integer maxSizeNumCorrida() { + String property = getValuefromCustom(CustomEnum.MAX_SIZE_NUM_CORRIDA.toString(), "-1"); + return Integer.parseInt(property); + } + + /** + * Procura a chave no banco de dados, caso exista retorna o valor, caso não exista retorna 0. + * + * @param key o valor da chave. + * @return o valor do custom no banco. + */ + public boolean isCustomHabilitado(String key) { + String property = getValuefromCustom(key, "0"); + return property.equals("1"); + } + + /** + * Procura a chave no banco de dados, caso exista retorna o valor, caso não exista retorna o valor default. + * + * @param key o valor da chave. + * @return o valor do custom no banco. + */ + public boolean isCustomHabilitado(String key, String defaultValue) { + String property = getValuefromCustom(key, defaultValue); + return property.equals("1"); + } + + private InputStream readImagefromCustom(String imagene) throws FileNotFoundException, IOException { + + InputStream inputStream = null; + try { + inputStream = new ClassPathResource(PATH_IMAGENES + imagene).getInputStream(); + } catch (FileNotFoundException fnfe) { + throw fnfe; + } catch (IOException e) { + throw e; + } + return inputStream; + } + + public void loadImageToDatabase(String empresa, boolean isGenerica) { + + try { + + String empresaNome = isGenerica ? "EMPRESA_BACKGROUND_GENERICA" : "EMPRESA_BACKGROUND"; + ImagemService imagemService = (ImagemService) AppContext.getApplicationContext().getBean("imagemService"); + + if (CollectionUtils.isEmpty(imagemService.buscar(empresaNome))) { + InputStream in = readImagefromCustom(empresa); + if (in != null) { + byte[] targetArray = IOUtils.toByteArray(in); + + Imagem entidad = new Imagem(); + entidad.setImagem(targetArray); + entidad.setNombImagem(empresaNome); + + imagemService.suscribir(entidad); + } + + } + + + + } catch (IOException e) { + log.error("", e); + } + + } + + public void singletonImage(){ + + ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService"); + ImagemService imagemService = (ImagemService) AppContext.getApplicationContext().getBean("imagemService"); + Constante constante = constanteService.buscarPorNomeConstante("IMAGENE_EMPRESA_GENERICA"); + + if ((constante != null) && StringUtils.isNotBlank(constante.getValorconstante()) && Boolean.valueOf(constante.getValorconstante())) { + Imagem imagemGenerica = imagemService.buscarPorNomeImagem("EMPRESA_BACKGROUND_GENERICA"); + getApplication().setImage(imagemGenerica); + }else{ + Imagem imagem = imagemService.buscarPorNomeImagem("EMPRESA_BACKGROUND"); + getApplication().setImage(imagem); + } + } + + private Application getApplication() { + ApplicationContext appContext = AppContext.getApplicationContext(); + BeanFactory factory = (BeanFactory) appContext; + Application app = (Application) factory.getBean("app"); + return app; + } + + public void readReadOnlyConnection() { + ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService"); + Constante constante = constanteService.buscarPorNomeConstante("READ_ONLY_CONNECTION"); + + readOnlyConnection = Boolean.TRUE; + + if ((constante != null) && StringUtils.isNotBlank(constante.getValorconstante())) { + readOnlyConnection = Boolean.valueOf(constante.getValorconstante()); + } + } + + public Boolean getReadOnlyConnection() { + return readOnlyConnection; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/BigDecimalUtil.java b/src/com/rjconsultores/ventaboletos/utilerias/BigDecimalUtil.java new file mode 100644 index 000000000..9c51ea89c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/BigDecimalUtil.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.ParseException; +import java.util.Locale; + +import org.apache.commons.lang.StringUtils; + +/** + * + * @author Wilian + * + */ +public class BigDecimalUtil { + + public static BigDecimal getStringToBigDecimal(String value, Locale locale) throws ParseException { + if(value != null && StringUtils.isNotBlank(value)) { + NumberFormat nf = NumberFormat.getInstance(locale); + return new BigDecimal(nf.parse(value).toString()); + } + + return null; + } + + public static String getBigDecimalToStringDouble2CasasDecimaisFormatado(BigDecimal value, Locale locale) { + if(value != null) { + NumberFormat nf = NumberFormat.getInstance(locale); + nf.setMinimumFractionDigits(2); + nf.setMaximumFractionDigits(2); + nf.setRoundingMode(RoundingMode.HALF_UP); + return nf.format(value.doubleValue()); + } + + return null; + } + + public static BigDecimal getStringToBigDecimal(String value, int qtdeCasasDecimais, Locale locale) throws ParseException { + if(value != null && StringUtils.isNotBlank(value)) { + DecimalFormat df = (DecimalFormat) NumberFormat.getInstance(locale); + df.setMinimumFractionDigits(qtdeCasasDecimais); + df.setMaximumFractionDigits(qtdeCasasDecimais); + value = value.substring(0, value.length() - qtdeCasasDecimais).concat(df.getDecimalFormatSymbols().getDecimalSeparator()+"").concat(value.substring(value.length() - qtdeCasasDecimais, value.length())); + return new BigDecimal(df.parse(value).toString()); + } + + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/CustomEnum.java b/src/com/rjconsultores/ventaboletos/utilerias/CustomEnum.java new file mode 100644 index 000000000..73c152814 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/CustomEnum.java @@ -0,0 +1,173 @@ +package com.rjconsultores.ventaboletos.utilerias; + +public enum CustomEnum { + + /** + * Indica se la informacion de equivalencia es visible + * + * @return + */ + MOSTRAR_EQUIVALENCIA("equivalencia.mostrar"), + + /** + * Indica se o campo empresa é obrigatório + * @return + */ + EMPRESA_OBRIGATORIA("empresa.obrigatoria"), + + /** + * Indica se es gerado o campo equivalencia corrida na tabela de corrida + * + * @return + */ + GERAR_CAMPO_EQUIVALENCIA_CORRIDA("corrida.gerarCampoEquivalencia"), + + /** + * Indica exibe o combo de Division na Gera��o de Corridas do Esquema Operacional. + * + * @return + */ + EXIBIR_DIVISION_CONFIGURACION_CORRIDA("esquemaOperacional.configuracionCorrida.exibeDivision"), + + /** + * Indica se va a exhibir la cuenta contable en el catalogo de tipos de eventos + * + * @return + */ + EXHIBIR_CUENTA_CONTABLE_TIPOS_EVENTOS("eventosExtras.tiposEventos.exhibirCuentaContable"), + + /** + * Indica se va a exhibir la "aba" de excepciones de tramo_km en la pantalla de tramos + * + * @return + */ + EXHIBIR_EXCEPCIONES_TRAMO_KM("tramos.exhibirExcepcionesTramoKm"), + + /** + * Indica se vai exibir botão na modificação massiva de tarifa de geração automatica de tarifas + * + * @return + */ + GENERAR_TARIFAS_AUTOMATICA("tarifa.generarTarifasAutomatica"), + + GENERAR_ROTINA_FOLIOS("no.cheque.folio"), + + HABILITAR_PRICING_CATEGORIA("pricing.categoria.habilitar"), + + RUTA_CON_MAS_DE_UNA_CLASE("ruta.masdeunaclase"), + + DIAGRAMA_AUTOBUS_DOS_PESTANA("diagramaautobus.dospestana"), + + CONTRASENA_VALIDA_COMPLEJIDAD("contrasena.validaComplejidad"), + + HABILITAR_CUSTOM_SEQUENCE("custom.sequence"), + + INTEGRACION_TOTVS("integracion.totvs"), + + INTEGRACION_AG("integracion.AG"), + + INTEGRACION_AGWS("integracion.agws"), + + INTEGRACION_RIOCARD("integracion.riocard"), + + DIAGRAMA_AUTOBUS_TREM("layoutdiagramaautobus.trem"), + + VALIDA_ESTADO_NO_NOME_LOCALIDADE("validaEstadoNomeLocalidade"), + + PODE_EDITAR_CLIENTE_FIDELIDADE("podeEditarClienteFidelidade"), + + VALIDA_SOBREPOSICAO_VIGENCIA("validaSobreposicaoVigencia"), + + USA_CPF_COMO_FIDELIDADE("usaCPFComoFidelidade"), + + USA_PADRAO_PRICING_TIPO_PASSAGEM_PET("usaPadroPricingEspecificoTipoPassagemPET"), + + EXIBE_TPP("exibeTpp"), + + COD_ANTT_NAO_OBRIGATORIO("codAnttNaoObrigatorio"), + + ARTESP_PEDAGIO_IDA_VOLTA_DIV_POR2("artespPedagioIdaVoltaDivPor2"), + + CALCULO_PEAJE_REUNIDAS_ANTT("calculoPeajeReunidasANTT"), + + MAX_SIZE_NUM_CORRIDA("maxSizeNumCorrida"), + + CRIAR_TARIFA_APENAS_TRECHO_VENDIDO("criarTarifaApenasTrechoVendido"), + + EXIBIR_ESTACAO_CADASTRO_USUARIO("exibirEstacaoCadastroUsuario"), + + UTILLIZA_CARTAO_LIBERCARD("utilizaLibercard"), + + /** + * + * Indica se ao salvar um ponto de venda será validado se para todas as empresas informadas para venda também será necessário informar o fechamento. + * + * @return + */ + VALIDA_CONTA_CORRENTE_EMPESA_PTOVTA("puntoVenta.validaCtaCteEmpresa"), + + IS_DATASOURCE_COMISSAO_BANCO_PRODUCAO("datasource.conferencia.comissao"), + + IS_PERMITE_VARIAS_IMPRESSORAS_MESMA_EMPRESA("permiteVariasImpressorasMesmaEmpresa"), + + IS_FORMAPAGO_PRICING_INATIVO("formaPagoPricingInativo"), + + EXIBIR_PUNTO_VENTA_CADASTRO_AIDF("exibirPuntoVentaCadastroAIDF"), + + IS_PUNTOVENTA_CADASTRO_AIDF_OBRIGATORIO("isPuntoVentaCadastroAIDFObrigatorio"), + + ENDERECO_CLIENTE_OBRIGATORIO("cliente.enderecoObrigatorio"), + + IS_PERMITE_LAYOUT_INTERNACIONAL("permiteLayoutInternacional"), + + RELATORIO_TAXAS_LINHA_TXT_DOWNLOAD_VISIBLE("taxasLinhaTxtDownloadVisible"), + + IS_PERMITE_CALCULO_COMISSAO_PERIODO("permiteCalculoComissaoPeriodo"), + + IS_INCLUI_TIPO_PAGAMENTO_TURISMO_BGM("incluiTipoPagamentoTurismoBGM"), + + IS_GERAR_TRECHO_AUTOMATICO_DEFAULT_NAO("gerarTrechoAutomaticoDefaultNao"), + + IS_VALIDA_DOCUMENTACAO_MONITRIP("validaDocumentacaoMonitrip"), + + IS_RECEITA_DESPESAS_COMPORTE("isReceitasDespesasComporte"), + + IS_RECEITA_DESPESAS_OURO_PRATA("isReceitasDespesasOuroPrata"), + + IS_COD_RECEITA_FIXO_BGM("isCodReceitaFixoBgm"), + + HABILITAR_EXCLUIR_SEQUENCIA_LINHA("habilitarExcluirSequenciaLinha"), + + /** + * Indica se a taxa de embarque será impressa como QRCode ou Codigo de barras + * + * @return + */ + IS_TAXA_EMBARQUE_IMPRESSA_QRCODE("isTxEmbarqueImpressaEmQrcode"), + + IS_DESCONSIDERA_CLIENTE_NA_BASE("isDesconsideraClienteNaBase"), + + IS_HABILITA_IE_DESCENTRALIZADA("isHabilitaIEDescentralizada"), + + IS_VALIDAR_CONSTANTE_REMESSA("isValidarConstanteRemessa"), + + IS_DESABILITA_USUARIO_ADMINISTRADORES_PERFIL("dasabilitaUsuarioAdministradoresPerfil"), + + INTEGRACION_SAFER("integracion.safer"); + + private String descricao; + + private CustomEnum(String descricao) { + this.descricao = descricao; + } + + public String getDescricao() { + return descricao; + } + + @Override + public String toString() { + return this.descricao; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java b/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java new file mode 100644 index 000000000..55d0e4b8c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java @@ -0,0 +1,847 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.utilerias; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.Set; +import java.util.TreeSet; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.apache.commons.lang.StringUtils; + +public final class DateUtil { + + public static Integer DIA = Integer.valueOf(1000 * 60 * 60 * 24); + public static Integer UM_DIA = Integer.valueOf(1); + + /** + * Formato 24Hs + */ + public static String ddMMaaHH24mm = "dd/MM/yyyy HH:mm"; + public static String ddMMaaHH24mmss = "dd/MM/yyyy HH:mm:ss"; + + /** + * Formato 12hs + */ + public static String ddMMaaHHmm = "dd/MM/yyyy hh:mm"; + public static String ddMMaaaa = "dd/MM/yyyy"; + public static String ddMMaa_anodoisdigitos = "dd/MM/yy"; + public static String ddMMaa_sembarra = "ddMMyy"; + public static String HHmm = "HH:mm"; + public static String formatGMT = "yyyy-MM-dd'T'HH:mm:ss"; + public static String formatJson = "yyyy-MM-dd'T'HH:mm:ss.SSS"; + public static String formatExp = "yyyyMMdd"; + public static String YYYY_MM_DD_T_HH_MM_SS_Z = "yyyy-MM-dd'T'HH:mm:ssZ"; + + /** + * No need for an instance + */ + private DateUtil() { + } + + /** + * Elapsed days based on current time + * + * @param date + * Date + * + * @return int number of days + */ + public static int getElapsedDias(Date date) { + return elapsed(date, Calendar.DATE); + } + + /** + * Elapsed days based on two Date objects + * + * @param d1 + * Date + * @param d2 + * Date + * + * @return int number of days + */ + public static int getElapsedDias(Date d1, Date d2) { + return elapsed(d1, d2, Calendar.DATE); + } + + /** + * Elapsed months based on current time + * + * @param date + * Date + * + * @return int number of months + */ + public static int getElapsedMeses(Date date) { + return elapsed(date, Calendar.MONTH); + } + + /** + * Elapsed months based on two Date objects + * + * @param d1 + * Date + * @param d2 + * Date + * + * @return int number of months + */ + public static int getElapsedMeses(Date d1, Date d2) { + return elapsed(d1, d2, Calendar.MONTH); + } + + /** + * Elapsed years based on current time + * + * @param date + * Date + * + * @return int number of years + */ + public static int getElapsedAnos(Date date) { + return elapsed(date, Calendar.YEAR); + } + + /** + * Elapsed years based on two Date objects + * + * @param d1 + * Date + * @param d2 + * Date + * + * @return int number of years + */ + public static int getElapsedAnos(Date d1, Date d2) { + return elapsed(d1, d2, Calendar.YEAR); + } + + /** + * All elaspsed types + * + * @param g1 + * GregorianCalendar + * @param g2 + * GregorianCalendar + * @param type + * int (Calendar.FIELD_NAME) + * + * @return int number of elapsed "type" + */ + private static int elapsed(GregorianCalendar g1, GregorianCalendar g2, int type) { + GregorianCalendar gc1, gc2; + int elapsed = 0; + // Create copies since we will be clearing/adding + if (g2.after(g1)) { + gc2 = (GregorianCalendar) g2.clone(); + gc1 = (GregorianCalendar) g1.clone(); + } else { + gc2 = (GregorianCalendar) g1.clone(); + gc1 = (GregorianCalendar) g2.clone(); + } + if (type == Calendar.MONTH || type == Calendar.YEAR) { + gc1.clear(Calendar.DATE); + gc2.clear(Calendar.DATE); + } + if (type == Calendar.YEAR) { + gc1.clear(Calendar.MONTH); + gc2.clear(Calendar.MONTH); + } + while (gc1.before(gc2)) { + gc1.add(type, 1); + elapsed++; + } + return elapsed; + } + + /** + * All elaspsed types based on date and current Date + * + * @param date + * Date + * @param type + * int (Calendar.FIELD_NAME) + * + * @return int number of elapsed "type" + */ + private static int elapsed(Date date, int type) { + return elapsed(date, new Date(), type); + } + + /** + * All elaspsed types + * + * @param d1 + * Date + * @param d2 + * Date + * @param type + * int (Calendar.FIELD_NAME) + * + * @return int number of elapsed "type" + */ + private static int elapsed(Date d1, Date d2, int type) { + Calendar cal = Calendar.getInstance(); + cal.setTime(d1); + GregorianCalendar g1 = new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE)); + cal.setTime(d2); + GregorianCalendar g2 = new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE)); + return elapsed(g1, g2, type); + } + + public static Date getDateFromString(String data, String formato) throws java.text.ParseException { + Date d = new Date(); + DateFormat df = new SimpleDateFormat(formato); + + d = df.parse(data); + return d; + } + + public static int compareDate(java.util.Date d1) { + return compareDate(d1, new java.util.Date()); + } + + /** + * Compara a data atual com d1 de forma que a chama fica compareOnlyDate(d1, new java.util.Date()); + * + * {@link #compareOnlyDate(Date, Date)} + */ + public static int compareOnlyDate(java.util.Date d1) { + return compareOnlyDate(d1, new java.util.Date()); + } + + /** + * Não leva em consideração os segundos/minutos. Só é considerado o dia/mes/ano
+ * + * Retorno igual a {@link #compareDate(Date, Date)} + */ + public static int compareOnlyDate(java.util.Date d1, java.util.Date d2) { + java.util.Calendar cal = Calendar.getInstance(); + cal.setTime(d1); + GregorianCalendar g1 = new GregorianCalendar(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE)); + + java.util.Calendar cal2 = Calendar.getInstance(); + cal2.setTime(d2); + GregorianCalendar g2 = new GregorianCalendar(cal2.get(Calendar.YEAR), cal2.get(Calendar.MONTH), cal2.get(Calendar.DATE)); + return g1.compareTo(g2); + // return cal.compareTo(cal2); + } + + /** + * Retorna : - 0 se igual
+ * - < 0 se d1 < d2
+ * - > 0 se d1 > d2
+ */ + public static int compareDate(java.util.Date d1, java.util.Date d2) { + java.util.Calendar cal = Calendar.getInstance(); + cal.setTime(d1); + java.util.Calendar cal2 = Calendar.getInstance(); + cal2.setTime(d2); + + return cal.compareTo(cal2); + } + + public static Integer getIntegerDate(java.util.Date d, String formato) { + if (formato.contains("/")) { + throw new IllegalArgumentException("O formato não deve conter o simbolo \\ "); + } + + String s = getStringDate(d, formato); + return Integer.parseInt(s); + } + + public static String getStringDate(java.util.Date d, String formato) { + if (d != null) { + DateFormat df = new SimpleDateFormat(formato); + return df.format(d); + } + return null; + } + + /** + * Formato 12 horas + * @param d + * @return + */ + public static String getStringDateHour(java.util.Date d) { + if (d != null) { + DateFormat df = new SimpleDateFormat(ddMMaaHHmm); + return df.format(d); + } + return null; + } + + /** + * Formato 24 horas + * @param d + * @return + */ + public static String getStringDate24Hour(java.util.Date d) { + if (d != null) { + DateFormat df = new SimpleDateFormat(ddMMaaHH24mm); + return df.format(d); + } + return null; + } + public static String getStringDate(java.util.Date d) { + return getStringDate(d, "dd/MM/yyyy"); + } + + public static String getStringDate(java.sql.Date d) { + return getStringDate(new java.util.Date(d.getTime())); + } + + public static String getStringCurrentDate(String formato) { + return getStringDate(new java.util.Date(), formato); + } + + public static String changeFormatStringDate(String date, String currentFormat, String newFormat) { + + try { + return DateUtil.getStringDate(DateUtil.getDateFromString(date, currentFormat), newFormat); + } catch (ParseException ex) { + Logger.getLogger(DateUtil.class.getName()).log(Level.SEVERE, null, ex); + } + return null; + } + + public static Integer changeFormatIntDate(Integer date, String currentFormat, String newFormat) { + + try { + return DateUtil.getIntegerDate(DateUtil.getDateFromString(String.valueOf(date), currentFormat), newFormat); + } catch (ParseException ex) { + Logger.getLogger(DateUtil.class.getName()).log(Level.SEVERE, null, ex); + } + return null; + } + + /** + * Retorna uma array onde [0] é hora, [1] é minuto + * + * @param hora + * @return + */ + private static int[] getArrayHora(Integer hora) { + + String strHora = String.valueOf(hora); + + int[] array = new int[2]; + + if (strHora.length() <= 2) { + array[0] = 0; + array[1] = Integer.parseInt(strHora); + } else if (strHora.length() == 3) { + array[0] = Integer.parseInt(strHora.substring(0, 1)); + array[1] = Integer.parseInt(strHora.substring(1)); + } else if (strHora.length() == 4) { + array[0] = Integer.parseInt(strHora.substring(0, 2)); + array[1] = Integer.parseInt(strHora.substring(2)); + } + + return array; + } + + public static java.util.Date changeFormatIntDate(Integer date, String currentFormat, Integer hora) { + + try { + if (currentFormat.equals("yMMdd") || currentFormat.equals("yyMMdd")) { + + currentFormat = "yyyyMMdd"; + String strData = String.valueOf(date); + + if (strData.length() == 5) { + strData = "200" + strData; + } else if (strData.length() == 6) { + strData = "20" + strData; + } + + date = Integer.parseInt(strData); + } + Date data = DateUtil.getDateFromString(String.valueOf(date), currentFormat); + + if (hora == null) { + return data; + } + + int horaArray[] = DateUtil.getArrayHora(hora); + Calendar c = Calendar.getInstance(); + c.setTime(data); + c.set(Calendar.HOUR_OF_DAY, horaArray[0]); + c.set(Calendar.MINUTE, horaArray[1]); + + return c.getTime(); + + } catch (ParseException ex) { + Logger.getLogger(DateUtil.class.getName()).log(Level.SEVERE, null, ex); + } + return null; + } + + public static java.util.Date changeFormatStringDate(String date, String currentFormat, Integer hora) { + + try { + if (currentFormat.equals("yMMdd") || currentFormat.equals("yyMMdd")) { + + currentFormat = "yyyyMMdd"; + + if (date.length() == 5) { + date = "200" + date; + } else if (date.length() == 6) { + date = "20" + date; + } + } + Date data = DateUtil.getDateFromString(String.valueOf(date), currentFormat); + + if (hora == null) { + return data; + } + + int horaArray[] = DateUtil.getArrayHora(hora); + Calendar c = Calendar.getInstance(); + c.setTime(data); + c.set(Calendar.HOUR_OF_DAY, horaArray[0]); + c.set(Calendar.MINUTE, horaArray[1]); + + return c.getTime(); + + } catch (ParseException ex) { + Logger.getLogger(DateUtil.class.getName()).log(Level.SEVERE, null, ex); + } + return null; + } + + public static int getIntHoraSRVP(Date data) { + Calendar c = Calendar.getInstance(); + c.setTime(data); + + String hora = String.valueOf(c.get(Calendar.HOUR_OF_DAY)); + hora = (hora.length() < 2) ? "0" + hora : hora; + + String minuto = String.valueOf(c.get(Calendar.MINUTE)); + minuto = (minuto.length() < 2) ? "0" + minuto : minuto; + + return Integer.parseInt(hora + minuto); + } + + public static long getElapsedHoras(Date dtInic, Date dtFim) { + return (dtFim.getTime() - dtInic.getTime()) / (1000 * 60 * 60); + } + + public static long getElapsedMinutos(Date dtInic, Date dtFim) { + return (dtFim.getTime() - dtInic.getTime()) / (1000 * 60); + } + + /** + * Regresa los minutos pela hora inicial del sistema + * + * @param dtInic + * @param dtFim + * @return + */ + public static HoraSistema getHorasMinutosByInicio(Date dtFim) { + return new HoraSistema(dtFim); + } + + /** + * Verifica se o intervalo de datas dtStartCompare e dtEndCompare estão dentro do intervalo dtStart dtEnd + * + * @param dtStart + * @param dtEnd + * @param dtStartCompare + * @param dtEndCompare + * @return + */ + public static boolean intersectDate(Date dtStart, Date dtEnd, Date dtStartCompare, Date dtEndCompare) { + return TraslaparUtil.intersectDate(dtStart, dtEnd, dtStartCompare, dtEndCompare); + } + + public static void main(String ar[]) { + System.out.println(Arrays.asList(1,2,3,4,5).toString().replaceAll("[\\]\\[]", "")); + } + + public static void main2(String args[]) { + java.util.Date agora = new java.util.Date(); + + System.out.println(agora); + + Calendar c = Calendar.getInstance(); + c.setTime(agora); + + System.out.println(DateUtil.getIntHoraSRVP(agora)); + // c.add(Calendar.MINUTE, 60); + + System.out.println("final " + c.getTime()); + System.out.println("1 " + c.get(Calendar.HOUR_OF_DAY)); + + } + + /** + * Es la fecInicial del sistema para campos de horas + * + * @return + */ + public static Calendar getFecInicio() { + Calendar c = Calendar.getInstance(); + c.set(Calendar.YEAR, 1970); + c.set(Calendar.DAY_OF_MONTH, 1); + c.set(Calendar.MONTH, 0); + c.set(Calendar.HOUR_OF_DAY, 0); + c.set(Calendar.MINUTE, 0); + c.set(Calendar.MILLISECOND, 0); + c.set(Calendar.SECOND, 0); + + return c; + } + + /** + * Es la fecInicial del sistema con los campos de hora y minutos del parametro informado + * + * @return + */ + public static Calendar getFecInicio(Date horaMinuto) { + Calendar tmp = Calendar.getInstance(); + tmp.setTime(horaMinuto); + Calendar c = getFecInicio(); + c.set(Calendar.HOUR_OF_DAY, tmp.get(Calendar.HOUR_OF_DAY)); + c.set(Calendar.MINUTE, tmp.get(Calendar.MINUTE)); + + return c; + } + + /** + * Es la fecInicial del sistema con los campos de hora y minutos del parametro informado + * + * @return + */ + public static Calendar getFecInicio(Integer hora, Integer minuto) { + + Calendar c = getFecInicio(); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + return c; + } + + /** + * Quita los segundos y milesegundos de la fecha + * + * @param fecha + * @return + */ + public static Date normalizar(Date fecha) { + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(fecha); + gcalendar.set(Calendar.SECOND, 0); + gcalendar.set(Calendar.MILLISECOND, 0); + + return gcalendar.getTime(); + } + + /** + * Quita los segundos, milesegundos, hora y minuto de la fecha + * + * @param fecha + * @return + */ + public static Date normalizarToFecha(Date fecha) { + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(fecha); + gcalendar.set(Calendar.SECOND, 0); + gcalendar.set(Calendar.MILLISECOND, 0); + gcalendar.set(Calendar.HOUR_OF_DAY, 0); + gcalendar.set(Calendar.MINUTE, 0); + + return gcalendar.getTime(); + } + + public static Date inicioFechaPeriodoMeses(Date periodo) { + return inicioFecha(periodo, true); + } + + public static Date fimFechaPeriodoMeses(Date periodo) { + return fimFecha(periodo, true); + } + + private static Date inicioFecha(Date fecha, boolean diaInicial) { + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(fecha); + int date = gcalendar.get(Calendar.DATE); + if (diaInicial) { + date = gcalendar.getActualMinimum(Calendar.DAY_OF_MONTH); + } + int month = gcalendar.get(Calendar.MONTH); + int year = gcalendar.get(Calendar.YEAR); + int hourOfDay = 00; + int minute = 00; + int second = 00; + + gcalendar.set(year, month, date, hourOfDay, minute, second); + return gcalendar.getTime(); + } + + private static Date fimFecha(Date fecha, boolean diaFinal) { + GregorianCalendar gcalendar = new GregorianCalendar(); + gcalendar.setTime(fecha); + + int date = gcalendar.get(Calendar.DATE); + if (diaFinal) { + date = gcalendar.getActualMaximum(Calendar.DAY_OF_MONTH); + } + int month = gcalendar.get(Calendar.MONTH); + int year = gcalendar.get(Calendar.YEAR); + int hourOfDay = 23; + int minute = 59; + int second = 59; + + gcalendar.set(year, month, date, hourOfDay, minute, second); + return gcalendar.getTime(); + } + + public static Date inicioFecha(Date fecha) { + return inicioFecha(fecha, false); + } + + public static Date fimFecha(Date fecha) { + return fimFecha(fecha, false); + } + + public static Date somarDias(Date data, int quantidadeDias) { + Integer dias = UM_DIA * quantidadeDias; + Calendar c = Calendar.getInstance(); + c.setTime(data); + c.add(Calendar.DAY_OF_MONTH, dias); + return c.getTime(); + } + + public static Date somarMinutos(Date data, int quantidadeMinutos) { + Calendar c = Calendar.getInstance(); + c.setTime(data); + c.add(Calendar.MINUTE, quantidadeMinutos); + return c.getTime(); + } + + /** + * Formato competencia: MM/YYYY + * + * @param competencia + * @return + */ + public static Set carregarDiasCompetencia(String competencia, Date dataMovimento) { + Set diasCompetencia = new TreeSet(); + if (competencia == null && dataMovimento != null) { + Integer diaInteger = new Integer(getStringDate(dataMovimento).split("/")[0]); + diasCompetencia.add(diaInteger); + } else { + String[] vetCompetencia = competencia.split("/"); + Calendar cal = Calendar.getInstance(); + cal.set(Calendar.MONTH, Integer.valueOf(vetCompetencia[0]) - 1); + cal.set(Calendar.YEAR, Integer.valueOf(vetCompetencia[1])); + + for (int i = 1; i <= cal.getActualMaximum(Calendar.DAY_OF_MONTH); i++) { + diasCompetencia.add(i); + } + } + return diasCompetencia; + } + + public static Set carregarDiasCompetencia(Date dataInicial, Date dataFinal) { + Set diasCompetencia = new TreeSet(); + + Calendar cal = Calendar.getInstance(); + + cal.setTime(dataInicial); + Integer diaInicial = cal.get(Calendar.DAY_OF_MONTH); + + cal.setTime(dataFinal); + Integer diaFinal = cal.get(Calendar.DAY_OF_MONTH); + + for (int i = diaInicial; i <= diaFinal; i++) { + diasCompetencia.add(i); + } + + return diasCompetencia; + } + + public static boolean isCompetenciaValida(String competencia) { + if (StringUtils.isNotBlank(competencia)) { + String mesString = competencia.split("/")[0].replaceAll("_", ""); + if (StringUtils.isNotBlank(mesString)) { + Integer mes = Integer.valueOf(competencia.split("/")[0]); + Integer minMes = Calendar.JANUARY + 1; + Integer maxMes = Calendar.DECEMBER + 1; + return mes >= minMes && mes <= maxMes; + } + } + + return false; + } + + public static Date getDataFinalCompetencia(String competencia) throws ParseException { + if (isCompetenciaValida(competencia)) { + Date dataInicio = getDateFromString("01/" + competencia, "dd/MM/yyyy"); + Calendar cal = Calendar.getInstance(LocaleUtil.getLocale()); + cal.setTime(dataInicio); + return getDateFromString(cal.getActualMaximum(Calendar.DAY_OF_MONTH) + "/" + competencia, "dd/MM/yyyy"); + } + return null; + } + + public static Date getDataInicialCompetencia(String competencia) throws ParseException { + if (isCompetenciaValida(competencia)) { + return getDateFromString("01/" + competencia, "dd/MM/yyyy"); + } + return null; + } + + public static Date getYesterdayDate() { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE, -1); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + Date yesterday = calendar.getTime(); + return yesterday; + } + + public static String getYesterdayDateString() { + DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); + Calendar cal = Calendar.getInstance(); + cal.add(Calendar.DATE, -1); + return dateFormat.format(cal.getTime()); + } + + public static Date getDataTempoDecorrido(String tempo) { + String[] tempoDecorrido = tempo.split(":"); + + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.HOUR, Integer.parseInt(tempoDecorrido[0].isEmpty() ? "0" : tempoDecorrido[0])); + calendar.set(Calendar.MINUTE, Integer.parseInt(tempoDecorrido[1].isEmpty() ? "0" : tempoDecorrido[1])); + + return calendar.getTime(); + } + + public static int diferencaEntreDatasEmdias(Date inicio, Date fim) { + long quantidadeHoras = ((fim.getTime() - inicio.getTime())); + return (int) (quantidadeHoras / DIA); + } + + public static String dataFormatoBPe(Date data){ + SimpleDateFormat dateFormat = new SimpleDateFormat(YYYY_MM_DD_T_HH_MM_SS_Z) { + private static final long serialVersionUID = 1L; + public StringBuffer format(Date date, StringBuffer toAppendTo, java.text.FieldPosition pos) { + StringBuffer toFix = super.format(date, toAppendTo, pos); + return toFix.insert(toFix.length()-2, ':'); + }; + }; + + return dateFormat.format(data); + } + + public static Date dateFormatBPe(final String data) { + try { + SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD_T_HH_MM_SS_Z); + + String value = data; + + if (value.substring(value.length()-3,value.length()-2).equals(":")) { + StringBuilder dx = new StringBuilder(value); + dx = dx.delete(dx.length() - 3, dx.length() - 2); + value = dx.toString(); + } + + return sdf.parse(value); + } catch (ParseException e) { + return null; + } + } + + /** + * Verifica se a data1 é igual a data2 + * @param data1 + * @param data2 + * @return + */ + public static boolean isIgual(final Date data1, final Date data2) { + if(data1 == null || data2 == null) { + return false; + } + + Calendar c1 = Calendar.getInstance(); + c1.setTime(data1); + + Calendar c2 = Calendar.getInstance(); + c2.setTime(data2); + + return c1.equals(c2); + } + + /** + * Verifica se a data1 é igual ou menor que a data2 + * @param data1 + * @param data2 + * @return + */ + public static boolean isIgualORMenor(final Date data1, final Date data2) { + return isIgual(data1, data2) || isMenor(data1, data2); + } + + /** + * Verifica se a data1 é menor que a data2 + * @param data1 + * @param data2 + * @return + */ + public static boolean isMenor(final Date data1, final Date data2) { + if(data1 == null || data2 == null) { + return false; + } + + Calendar c1 = Calendar.getInstance(); + c1.setTime(data1); + + Calendar c2 = Calendar.getInstance(); + c2.setTime(data2); + + return c1.before(c2); + } + + /** + * Verifica se a data1 é igual ou maior que a data2 + * @param data1 + * @param data2 + * @return + */ + public static boolean isIgualORMaior(final Date data1, final Date data2) { + return isIgual(data1, data2) || isMaior(data1, data2); + } + + /** + * Verifica se a data1 é maior que a data2 + * @param data1 + * @param data2 + * @return + */ + public static boolean isMaior(final Date data1, final Date data2) { + if(data1 == null || data2 == null) { + return false; + } + + Calendar c1 = Calendar.getInstance(); + c1.setTime(data1); + + Calendar c2 = Calendar.getInstance(); + c2.setTime(data2); + + return c1.after(c2); + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/utilerias/DocumentosUtil.java b/src/com/rjconsultores/ventaboletos/utilerias/DocumentosUtil.java new file mode 100644 index 000000000..cab68c730 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/DocumentosUtil.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.text.ParseException; + +import javax.swing.text.MaskFormatter; + +import org.apache.commons.lang.StringUtils; + +public class DocumentosUtil { + + private static final String CPF_MASK = "###.###.###-##"; + private static final String CNPJ_MASK = "##.###.###/####-##"; + + public static String formataCpf(String cpf) { + try { + if(StringUtils.isNotBlank(cpf)) { + cpf = StringHelper.preencherZeroEsquerda(cpf.replace("[^0-9]", ""), 11); + MaskFormatter mask = new MaskFormatter(CPF_MASK); + mask.setValueContainsLiteralCharacters(false); + return mask.valueToString(cpf); + } + } catch (ParseException e) { + e.printStackTrace(); + } + return null; + } + + public static String formataCnpj(String cnpj) { + try { + if(StringUtils.isNotBlank(cnpj)) { + cnpj = StringHelper.preencherZeroEsquerda(cnpj.replace("[^0-9]", ""), 14); + MaskFormatter mask = new MaskFormatter(CNPJ_MASK); + mask.setValueContainsLiteralCharacters(false); + return mask.valueToString(cnpj); + } + } catch (ParseException e) { + e.printStackTrace(); + } + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/FeriadoCache.java b/src/com/rjconsultores/ventaboletos/utilerias/FeriadoCache.java new file mode 100644 index 000000000..ad1cce9b3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/FeriadoCache.java @@ -0,0 +1,129 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.FeriadoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Estado; + +@Service("feriadoCache") +@Scope(value = "prototype") +public class FeriadoCache { + + private static Logger log = LoggerFactory.getLogger(FeriadoCache.class); + + @Autowired + private FeriadoDAO feriadoDAO; + private Map mapFeriado; + + public FeriadoCache() { + mapFeriado = new LinkedHashMap(); + } + + public boolean ehFeriado(Date dataFeriado, Empresa empresa, Estado estadoOrigem) { + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + String strDataFeriado = sdf.format(dataFeriado); + KeyFeriadoMap key = new KeyFeriadoMap(strDataFeriado, empresa.getEmpresaId(), estadoOrigem.getEstadoId()); + + Boolean ehFeriado = mapFeriado.get(key); + + log.debug("ehFeriado="+ehFeriado); + + if (ehFeriado == null) { + ehFeriado = feriadoDAO.ehFeriado(new java.sql.Date(dataFeriado.getTime()), empresa, estadoOrigem); + + mapFeriado.put(key, ehFeriado); + } + + log.debug("data feriado = " + strDataFeriado + "; empresa = " + empresa.getNombempresa() + "; estado = " + estadoOrigem.getNombestado() + "; eh feriado = " + ehFeriado); + + return ehFeriado; + } + + public void limpar() { + log.debug("limpeza de cache de feriados"); + + mapFeriado.clear(); + } + + public void limparData(Date dataFeriado, Integer empresaId, Integer estadoId) { + try { + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + String strDataFeriado = sdf.format(dataFeriado); + + log.info(String.format("Removendo feriado, data: "+ strDataFeriado +", empresaId: "+ empresaId+", estadoId: " + estadoId)); + + KeyFeriadoMap key = new KeyFeriadoMap(strDataFeriado, empresaId, estadoId); + + mapFeriado.remove(key); + } catch (Exception e) { + log.error("Erro ao remover Deriado de cache: ", e); + } + } + + class KeyFeriadoMap { + private String dataFeriado; + private Integer empresaId; + private Integer estadoOrigemId; + + public KeyFeriadoMap(String dataFeriado, Integer empresaId, Integer estadoOrigemId) { + super(); + this.dataFeriado = dataFeriado; + this.empresaId = empresaId; + this.estadoOrigemId = estadoOrigemId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + getOuterType().hashCode(); + result = prime * result + ((dataFeriado == null) ? 0 : dataFeriado.hashCode()); + result = prime * result + ((empresaId == null) ? 0 : empresaId.hashCode()); + result = prime * result + ((estadoOrigemId == null) ? 0 : estadoOrigemId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + KeyFeriadoMap other = (KeyFeriadoMap) obj; + if (!getOuterType().equals(other.getOuterType())) + return false; + if (dataFeriado == null) { + if (other.dataFeriado != null) + return false; + } else if (!dataFeriado.equals(other.dataFeriado)) + return false; + if (empresaId == null) { + if (other.empresaId != null) + return false; + } else if (!empresaId.equals(other.empresaId)) + return false; + if (estadoOrigemId == null) { + if (other.estadoOrigemId != null) + return false; + } else if (!estadoOrigemId.equals(other.estadoOrigemId)) + return false; + return true; + } + + private FeriadoCache getOuterType() { + return FeriadoCache.this; + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/HoraSistema.java b/src/com/rjconsultores/ventaboletos/utilerias/HoraSistema.java new file mode 100644 index 000000000..14e1e8842 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/HoraSistema.java @@ -0,0 +1,101 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.util.Calendar; +import java.util.Date; + +/** + * Classe criada para realizar operações sobre a hora inicial do sistema.
+ * + * A hora inicial do sistema pode ser obtida pelo método DateUtil.getFecInicio() e retorna : YEAR, 1970; DAY_OF_MONTH, 1; MONTH, 0; HOUR_OF_DAY, 0;MINUTE, 0;
+ * MILLISECOND, 0; SECOND, 0.
+ * + * + * Assim é possível armazenar e somar tempos como 24:30 + 36:00 = 60 horas e 30 minutos + * + * @author gleimar + * + */ +public class HoraSistema { + private Integer hora; + private Integer minuto; + + public HoraSistema() { + this.hora = 0; + this.minuto = 0; + } + + public HoraSistema(Date fecha) { + conf(fecha); + } + + private void conf(Date fecha) { + Long tempo = DateUtil.getElapsedMinutos(DateUtil.getFecInicio().getTime(), fecha); + + long minutos = (tempo % 60); + int horas = (tempo.intValue() / 60); + + hora = horas; + minuto = (int) minutos; + + } + + @Override + public String toString() { + + return (hora + ":" + ((String.valueOf(minuto).length() < 2) ? "0" + minuto : minuto)); + } + + public Integer getHora() { + return hora; + } + + public Integer getMinuto() { + return minuto; + } + + public void setMinuto(Integer minuto) { + this.minuto = minuto; + } + + public void setHora(Integer hora) { + this.hora = hora; + } + + public Date getFecha() { + Calendar c = DateUtil.getFecInicio(); + c.add(Calendar.HOUR_OF_DAY, hora); + c.add(Calendar.MINUTE, minuto); + + return c.getTime(); + } + + /** + * Realiza a soma da hora/minuto atual com o informado no parametro + * + * @param horaAdicao + * @return + */ + public HoraSistema sumar(HoraSistema horaAdicao) { + Calendar horaAtual = Calendar.getInstance(); + horaAtual.setTime(getFecha()); + + Calendar horaSomar = Calendar.getInstance(); + horaSomar.setTime(horaAdicao.getFecha()); + + int horaTotal = horaAtual.get(Calendar.HOUR_OF_DAY) + horaSomar.get(Calendar.HOUR_OF_DAY); + int minutoTotal = horaAtual.get(Calendar.MINUTE) + horaSomar.get(Calendar.MINUTE); + + int cantDiasAtual = DateUtil.getElapsedDias(DateUtil.getFecInicio().getTime(), horaAtual.getTime()); + int cantDiasSumar = DateUtil.getElapsedDias(DateUtil.getFecInicio().getTime(), horaSomar.getTime()); + + Calendar fecInicio = DateUtil.getFecInicio(); + fecInicio.add(Calendar.HOUR_OF_DAY, horaTotal); + fecInicio.add(Calendar.MINUTE, minutoTotal); + + fecInicio.add(Calendar.DATE, cantDiasAtual); + fecInicio.add(Calendar.DATE, cantDiasSumar); + + return new HoraSistema(fecInicio.getTime()); + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/utilerias/LocaleUtil.java b/src/com/rjconsultores/ventaboletos/utilerias/LocaleUtil.java new file mode 100644 index 000000000..d46fc1478 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/LocaleUtil.java @@ -0,0 +1,36 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.util.Locale; + +import org.zkoss.util.Locales; + +/** + * Retorna o locale atual, caso o locale não seja suportado pelo sistema,
+ * será retornado o locale pt_br + * @author Wilian + */ +public class LocaleUtil { + + + private static Locale LOCALE_PT_BR = new Locale("pt", "br"); + private static Locale LOCALE_ES_MX = new Locale("es", "mx"); + + private static Locale [] LOCALES = new Locale[]{LOCALE_PT_BR, LOCALE_ES_MX}; + + /** + * Retorna o locale atual, caso o locale não seja suportado pelo sistema,
+ * será retornado o locale pt_br + * @return + */ + public static Locale getLocale() { + Locale localeCurrent = Locales.getCurrent(); + for (Locale locale : LOCALES) { + if(localeCurrent.getLanguage().equals(locale.getLanguage())) { + return localeCurrent; + } + } + + return LOCALE_PT_BR; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/LocalizadorHelper.java b/src/com/rjconsultores/ventaboletos/utilerias/LocalizadorHelper.java new file mode 100644 index 000000000..d4d036018 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/LocalizadorHelper.java @@ -0,0 +1,156 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.util.HashMap; +import java.util.Map; +import java.util.Random; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class LocalizadorHelper { + private static Logger log = LoggerFactory.getLogger(LocalizadorHelper.class); + + private Map mapa = new HashMap(0); + + public LocalizadorHelper() { + mapa.put("1", "GO"); + mapa.put("2", "JM"); + mapa.put("3", "LQ"); + mapa.put("4", "HU"); + mapa.put("5", "NS"); + mapa.put("6", "RV"); + mapa.put("7", "XP"); + mapa.put("8", "IY"); + mapa.put("9", "KZ"); + mapa.put("0", "WT"); + } + + public String getLocalizadorAlfa(final String localizador) { + String valor = localizador.substring(2, localizador.length()); + String alfa = Long.toHexString(Integer.valueOf(valor)).toUpperCase(); + + String novo = ""; + + Random gerador = new Random(); + + for (int idx = 0; idx < alfa.length(); idx++) { + String digito = alfa.substring(idx, idx + 1); + + if (mapa.containsKey(digito)) { + String mascara = mapa.get(digito); + + int r = gerador.nextInt(2); + + novo += mascara.substring(r, r + 1); + } else { + novo += digito; + } + } + + return novo; + } + + public String getLocalizadorReal(final String localizador) { + + if (StringUtils.isBlank(localizador)) { + return localizador; + } + + try { + String novo = ""; + + for (int idx = 0; idx < localizador.length(); idx++) { + String digito = localizador.substring(idx, idx + 1); + digito = digito.toUpperCase(); + + if (!"ABCDEF1234567890".contains(digito)) { + for (Map.Entry entry : mapa.entrySet()) { + String chave = entry.getKey(); + String valor = entry.getValue(); + + if (valor.contains(digito)) { + novo += chave; + break; + } + } + } else { + novo += digito; + } + } + + return "01" + String.format("%010d", Long.parseLong(novo, 16)); + + } catch (Exception e) { + log.error("Localizador invalido: " + localizador, e); + + return "010000000000"; + } + } + + public String getLocalizadorRealEmbarcada(final String localizador) { + + if (StringUtils.isBlank(localizador)) { + return localizador; + } + + try { + String novo = ""; + + for (int idx = 0; idx < localizador.length(); idx++) { + String digito = localizador.substring(idx, idx + 1); + digito = digito.toUpperCase(); + + if (!"ABCDEF1234567890".contains(digito)) { + for (Map.Entry entry : mapa.entrySet()) { + String chave = entry.getKey(); + String valor = entry.getValue(); + + if (valor.contains(digito)) { + novo += chave; + break; + } + } + } else { + novo += digito; + } + } + + return String.format("%010d", Long.parseLong(novo, 16)); + + } catch (Exception e) { + log.error("Localizador invalido: " + localizador, e); + + return "010000000000"; + } + } + + public String getLocalizadorAlfaEmbarcada(final String localizador) { + if (StringUtils.isBlank(localizador) || StringUtils.isAlpha(localizador)) { + return localizador; + } + + String valor = localizador.substring(0, localizador.length()); + String alfa = Long.toHexString(Integer.valueOf(valor)).toUpperCase(); + + String novo = ""; + + Random gerador = new Random(); + + for (int idx = 0; idx < alfa.length(); idx++) { + String digito = alfa.substring(idx, idx + 1); + + if (mapa.containsKey(digito)) { + String mascara = mapa.get(digito); + + int r = gerador.nextInt(2); + + novo += mascara.substring(r, r + 1); + } else { + novo += digito; + } + } + + return novo; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/MoneyHelper.java b/src/com/rjconsultores/ventaboletos/utilerias/MoneyHelper.java new file mode 100644 index 000000000..0040888f9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/MoneyHelper.java @@ -0,0 +1,226 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.math.BigDecimal; +import java.math.MathContext; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.text.ParseException; +import java.util.Locale; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Clase MoneyHelper + * + * Referência: http://www.javapractices.com/topic/TopicAction.do?Id=13 + * + * @author RJ Consultores + */ +public class MoneyHelper { + private static Logger log = LoggerFactory.getLogger(MoneyHelper.class); + + private static int DECIMALS = 2; + private static int ROUNDING_MODE = BigDecimal.ROUND_HALF_EVEN; + public static BigDecimal HUNDRED = new BigDecimal("100"); + private static int MATH_CONTEXT = 2; + + public MoneyHelper() { + + } + + public static BigDecimal instanciar(String aValor) { + return arredondar(BigDecimal.valueOf(Float.valueOf(aValor))); + } + + public static BigDecimal instanciar(BigDecimal aValor) { + return arredondar(aValor); + } + + public static BigDecimal somar(BigDecimal... aAmount) { + BigDecimal total = BigDecimal.ZERO; + for (BigDecimal value : aAmount) { + BigDecimal fAmountOne = value == null ? BigDecimal.ZERO : arredondar(value); + total = total.add(fAmountOne); + } + return total.setScale(DECIMALS, ROUNDING_MODE); + } + + public static BigDecimal somar(int customScale, BigDecimal... aAmount) { + BigDecimal total = BigDecimal.ZERO; + for (BigDecimal value : aAmount) { + BigDecimal fAmountOne = value == null ? BigDecimal.ZERO : arredondar(value, customScale); + total = total.add(fAmountOne); + } + return total.setScale(customScale, ROUNDING_MODE); + } + + public static BigDecimal somar(BigDecimal aAmountOne, BigDecimal aAmountTwo) { + BigDecimal fAmountOne = aAmountOne == null ? BigDecimal.ZERO : arredondar(aAmountOne); + BigDecimal fAmountTwo = aAmountTwo == null ? BigDecimal.ZERO : arredondar(aAmountTwo); + + return fAmountOne.add(fAmountTwo).setScale(DECIMALS, ROUNDING_MODE); + } + + public static BigDecimal somar(BigDecimal aAmountOne, BigDecimal aAmountTwo, int customScale) { + BigDecimal fAmountOne = aAmountOne == null ? BigDecimal.ZERO : arredondar(aAmountOne, customScale); + BigDecimal fAmountTwo = aAmountTwo == null ? BigDecimal.ZERO : arredondar(aAmountTwo, customScale); + + return fAmountOne.add(fAmountTwo).setScale(customScale, ROUNDING_MODE); + } + + public static BigDecimal subtrair(BigDecimal aAmountOne, BigDecimal aAmountTwo) { + BigDecimal fAmountOne = arredondar(aAmountOne); + BigDecimal fAmountTwo = arredondar(aAmountTwo); + + return fAmountOne.subtract(fAmountTwo).setScale(DECIMALS, ROUNDING_MODE); + } + + public static BigDecimal subtrair(BigDecimal aAmountOne, BigDecimal aAmountTwo, int customScale) { + BigDecimal fAmountOne = arredondar(aAmountOne, customScale); + BigDecimal fAmountTwo = arredondar(aAmountTwo, customScale); + + return fAmountOne.subtract(fAmountTwo).setScale(customScale, ROUNDING_MODE); + } + + public static BigDecimal dividir(BigDecimal aAmount, BigDecimal aDivisor) { + BigDecimal fAmount = arredondar(aAmount); + BigDecimal fDivisor = arredondar(aDivisor); + + return fAmount.divide(fDivisor, DECIMALS, ROUNDING_MODE); + } + + public static BigDecimal dividir(BigDecimal aAmount, BigDecimal aDivisor, int customScale) { + BigDecimal fAmount = arredondar(aAmount, customScale); + BigDecimal fDivisor = arredondar(aDivisor, customScale); + + return fAmount.divide(fDivisor, customScale, ROUNDING_MODE); + } + + public static BigDecimal multiplicar(BigDecimal aAmount, BigDecimal aMultiplicand) { + BigDecimal fAmount = arredondar(aAmount); + BigDecimal fMultiplicand = arredondar(aMultiplicand); + + return fAmount.multiply(fMultiplicand, new MathContext(ROUNDING_MODE)).setScale(DECIMALS, ROUNDING_MODE); + } + + public static BigDecimal multiplicar(BigDecimal aAmount, BigDecimal aMultiplicand, int customScale) { + BigDecimal fAmount = arredondar(aAmount, customScale); + BigDecimal fMultiplicand = arredondar(aMultiplicand, customScale); + + return fAmount.multiply(fMultiplicand, new MathContext(ROUNDING_MODE)).setScale(customScale, ROUNDING_MODE); + } + + public static BigDecimal arredondar(BigDecimal aNumber) { + if (aNumber != null) { + return aNumber.setScale(DECIMALS, ROUNDING_MODE); + } else { + return null; + } + } + + public static BigDecimal arredondar(BigDecimal aNumber, int decimals, int rounding_mode) { + if (aNumber != null) { + return aNumber.setScale(decimals, rounding_mode); + } else { + return null; + } + } + + public static BigDecimal arredondar(Float aNumber) { + return BigDecimal.valueOf(aNumber).setScale(DECIMALS, ROUNDING_MODE); + } + + public static boolean isMaior(BigDecimal aAmountOne, BigDecimal aAmountTwo) { + BigDecimal fAmountOne = arredondar(aAmountOne); + BigDecimal fAmountTwo = arredondar(aAmountTwo); + + return fAmountOne.compareTo(fAmountTwo) > 0; + } + + public static boolean isMaiorIgual(BigDecimal aAmountOne, BigDecimal aAmountTwo) { + BigDecimal fAmountOne = arredondar(aAmountOne); + BigDecimal fAmountTwo = arredondar(aAmountTwo); + + return fAmountOne.compareTo(fAmountTwo) >= 0; + } + + public static boolean isMenor(BigDecimal aAmountOne, BigDecimal aAmountTwo) { + BigDecimal fAmountOne = arredondar(aAmountOne); + BigDecimal fAmountTwo = arredondar(aAmountTwo); + + return fAmountOne.compareTo(fAmountTwo) < 0; + } + + public static boolean isMenorIgual(BigDecimal aAmountOne, BigDecimal aAmountTwo) { + BigDecimal fAmountOne = arredondar(aAmountOne); + BigDecimal fAmountTwo = arredondar(aAmountTwo); + + return fAmountOne.compareTo(fAmountTwo) <= 0; + } + + public static boolean isIgual(BigDecimal aAmountOne, BigDecimal aAmountTwo) { + BigDecimal fAmountOne = arredondar(aAmountOne); + BigDecimal fAmountTwo = arredondar(aAmountTwo); + + return fAmountOne.compareTo(fAmountTwo) == 0; + } + + public static BigDecimal getDiferenca(BigDecimal aAmountOne, BigDecimal aAmountTwo) { + return aAmountTwo.subtract(aAmountOne); + } + + public static BigDecimal getPercentual(BigDecimal aAmountOne, BigDecimal aAmountTwo) { + + BigDecimal diferenca = getDiferenca(aAmountOne, aAmountTwo); + BigDecimal fractionalChange = BigDecimal.ZERO; + + if (diferenca != null && (diferenca.compareTo(BigDecimal.ZERO) != 0) && (aAmountOne.compareTo(BigDecimal.ZERO) != 0)) { + fractionalChange = diferenca.divide(aAmountOne, new MathContext(MATH_CONTEXT)); + } + return arredondar(fractionalChange.multiply(HUNDRED)).abs(); + } + + public static BigDecimal getValorDescontadoPercentual(BigDecimal valor, BigDecimal percdesconto) { + BigDecimal valorDescontado = multiplicar(valor, percdesconto).divide(HUNDRED); + return arredondar(subtrair(valor, valorDescontado)); + } + + public static BigDecimal getPercentualValor(BigDecimal valorTotal, BigDecimal valorPercentual) { + if (valorTotal != null && valorPercentual != null) { + return dividir(dividir(multiplicar(valorTotal, valorPercentual), HUNDRED), HUNDRED); + } + return BigDecimal.ZERO; + } + + /** + * Converte uma string no formato de moeda em um {@link BigDecimal} + * + * @param valor + * @return + */ + public static BigDecimal getValor(String valor) { + try { + if (StringUtils.isNotBlank(valor)) { + NumberFormat nf = DecimalFormat.getCurrencyInstance(Locale.getDefault()); + nf.setMinimumFractionDigits(DECIMALS); + nf.setMaximumFractionDigits(DECIMALS); + return arredondar(nf.parse(valor).floatValue()); + } + } catch (ParseException e) { + log.error(e.getMessage(), e); + } + return null; + } + + public static String getValor(BigDecimal valor) { + NumberFormat nf = NumberFormat.getInstance(Locale.getDefault()); + return nf.format(valor); + } + + public static BigDecimal arredondar(BigDecimal aNumber, int customScale) { + return aNumber.setScale(customScale, ROUNDING_MODE); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/OcdUtil.java b/src/com/rjconsultores/ventaboletos/utilerias/OcdUtil.java new file mode 100644 index 000000000..b2c917de9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/OcdUtil.java @@ -0,0 +1,44 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.rjconsultores.ventaboletos.entidad.OCD; + +public class OcdUtil { + + private static final String REGEX = "([0-9]+)([A-Za-z]{3})([0-9]+)"; + + public static String generaLocalizadorOCD(OCD ocd) { + return generaLocalizadorOCD(ocd.getNumoperacion(), ocd.getOcdId()); + } + + public static String generaLocalizadorOCD(String numoperacion, Long ocdId) { + char letraPosicao1 = (char) (numoperacion.charAt(numoperacion.length() - 1) + 25); + char letraPosicao2 = (char) (numoperacion.charAt(numoperacion.length() - 2) + 25); + char letraPosicao3 = (char) (numoperacion.charAt(numoperacion.length() - 3) + 25); + String localizador = String.format("%s%s%s%s%d", numoperacion, letraPosicao1, letraPosicao2, letraPosicao3, ocdId).toLowerCase(); + return localizador; + } + + public static boolean validarLocalizadorOcd(String localizador) { + Pattern localizadorPattern = Pattern.compile(REGEX); + Matcher localizadorMatcher = localizadorPattern.matcher(localizador); + return localizadorMatcher.matches(); + } + + public static Long getOcdIdByLocalizadorOcd(String localizador) { + Pattern localizadorPattern = Pattern.compile(REGEX); + Matcher localizadorMatcher = localizadorPattern.matcher(localizador); + localizadorMatcher.matches(); + return Long.valueOf(localizadorMatcher.group(3)); + } + + public static String getNumOcdByLocalizadorOcd(String localizador) { + Pattern localizadorPattern = Pattern.compile(REGEX); + Matcher localizadorMatcher = localizadorPattern.matcher(localizador); + localizadorMatcher.matches(); + return localizadorMatcher.group(1); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/PasswordHelper.java b/src/com/rjconsultores/ventaboletos/utilerias/PasswordHelper.java new file mode 100644 index 000000000..30c5556ed --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/PasswordHelper.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.util.Date; +import java.util.Random; + +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + + + +public class PasswordHelper { + + private static Logger log = LoggerFactory.getLogger(PasswordHelper.class); + + private static PasswordHelper instance; + private final int MM_MAX = 10; + + private String password = ""; + private Date passwordCreated; + + public static PasswordHelper getInstance() { + if (instance == null) + instance = new PasswordHelper(); + return instance; + } + + public String generateRandomPassword() { + int size = 8; + String capLetter = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + String numbers = "01234567890123456789"; + String finalString = capLetter + numbers; + + Random random = new Random(); + char[] charPassword = new char[size]; + for (int i = 0; i < size; i++) { + charPassword[i] = finalString.charAt(random.nextInt(finalString.length())); + } + password = String.valueOf(charPassword); + passwordCreated = DateUtil.somarMinutos(new Date(), MM_MAX); + log.info("Gerada Senha de Instalação Valida até: " + passwordCreated.toString()); + return password; + } + + public boolean isValidPassword(String myPassword) { + return !StringUtils.isBlank(myPassword) && + !StringUtils.isBlank(password) && + password.equals(myPassword) && + DateUtil.compareDate(new Date(), passwordCreated) < 0; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/PricingConverterVOToEntidad.java b/src/com/rjconsultores/ventaboletos/utilerias/PricingConverterVOToEntidad.java new file mode 100644 index 000000000..35a25b615 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/PricingConverterVOToEntidad.java @@ -0,0 +1,428 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.entidad.Categoria; +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CorridaCtrl; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Marca; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Pricing; +import com.rjconsultores.ventaboletos.entidad.PricingClase; +import com.rjconsultores.ventaboletos.entidad.PricingClasseTarifaria; +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.entidad.TipoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoServicio; +import com.rjconsultores.ventaboletos.vo.pricing.PricingAsiento; +import com.rjconsultores.ventaboletos.vo.pricing.PricingCanalVenta; +import com.rjconsultores.ventaboletos.vo.pricing.PricingCategoria; +import com.rjconsultores.ventaboletos.vo.pricing.PricingClasse; +import com.rjconsultores.ventaboletos.vo.pricing.PricingCorrida; +import com.rjconsultores.ventaboletos.vo.pricing.PricingDia; +import com.rjconsultores.ventaboletos.vo.pricing.PricingMarca; +import com.rjconsultores.ventaboletos.vo.pricing.PricingMercado; +import com.rjconsultores.ventaboletos.vo.pricing.PricingOcupaAntecipa; +import com.rjconsultores.ventaboletos.vo.pricing.PricingPuntoVenta; +import com.rjconsultores.ventaboletos.vo.pricing.PricingRuta; +import com.rjconsultores.ventaboletos.vo.pricing.PricingTipoCorrida; +import com.rjconsultores.ventaboletos.vo.pricing.PricingVigencia; + +public class PricingConverterVOToEntidad { + + private static Logger log = Logger.getLogger(PricingConverterVOToEntidad.class); + + private static PricingConverterVOToEntidad INSTANCE; + + private PricingConverterVOToEntidad() { + super(); + } + + public synchronized static PricingConverterVOToEntidad getInstance() { + if(INSTANCE == null) { + INSTANCE = new PricingConverterVOToEntidad(); + } + return INSTANCE; + } + + public Pricing convertVOToEntidad(com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) { + try { + Pricing retorno = new Pricing(); + retorno.setPricingId(pricingVO.getPricingId()); + retorno.setNombPricing(pricingVO.getNomePricing()); + retorno.setCantboleto(pricingVO.getQtdePoltronas() != null ? pricingVO.getQtdePoltronas().shortValue() : null); + retorno.setDescuentoporcentaje(pricingVO.getPorcentagemIda()); + retorno.setDescuentoporcredondo(pricingVO.getPorcentagemIdaVolta()); + retorno.setIndtransferible(pricingVO.getPodeTransferir() != null ? pricingVO.getPodeTransferir().equals(1) : true); + retorno.setIndreservable(pricingVO.getPodeReservar() != null ? pricingVO.getPodeReservar().equals(1): true); + retorno.setExibeVenda(pricingVO.getExibirVenda() != null ? pricingVO.getExibirVenda().equals(1) : true); + retorno.setIndcancelable(pricingVO.getPodeCancelar() != null ? pricingVO.getPodeCancelar().equals(1) : true); + retorno.setActivo(Pricing.ATIVO); + retorno.setFecmodif(new Date()); + retorno.setCantdiasanticipacion(pricingVO.getDiasAtencipacao()); + retorno.setEmpresa(new Empresa(pricingVO.getEmpresaId())); + retorno.setIndGeneraFeriadoViaje(StringUtils.isNotBlank(pricingVO.getAplicaFeriadoDtViagem()) ? pricingVO.getAplicaFeriadoDtViagem() : "S"); + retorno.setIndGeneraFeriadoVenta(StringUtils.isNotBlank(pricingVO.getAplicaFeriadoDtVenda()) ? pricingVO.getAplicaFeriadoDtVenda() : "S"); + + convertVOToEntidadPoltronas(retorno, pricingVO); + convertVOToEntidadCanalVendas(retorno, pricingVO); + convertVOToEntidadCategorias(retorno, pricingVO); + convertVOToEntidadClasses(retorno, pricingVO); + convertVOToEntidadServicos(retorno, pricingVO); + convertVOToEntidadDias(retorno, pricingVO); + convertVOToEntidadOcupacoes(retorno, pricingVO); + convertVOToEntidadPuntoventas(retorno, pricingVO); + convertVOToEntidadLinhas(retorno, pricingVO); + convertVOToEntidadTiposervicos(retorno, pricingVO); + convertVOToEntidadMercados(retorno, pricingVO); + convertVOToEntidadVigencias(retorno, pricingVO); + convertVOToEntidadMarcas(retorno, pricingVO); + + return retorno; + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return null; + } + + public void convertVOToEntidadPoltronas(Pricing retorno, com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) { + if(pricingVO.getPoltronas() != null && !pricingVO.getPoltronas().isEmpty()) { + List asientos = new ArrayList(); + for (PricingAsiento pricingAsientoVO : pricingVO.getPoltronas()) { + com.rjconsultores.ventaboletos.entidad.PricingAsiento pricingAsiento = new com.rjconsultores.ventaboletos.entidad.PricingAsiento(); + pricingAsiento.setPricing(retorno); + pricingAsiento.setActivo(Pricing.ATIVO); + pricingAsiento.setFecmodif(new Date()); + pricingAsiento.setUsuarioId(retorno.getUsuarioId()); + pricingAsiento.setNombImagen(pricingAsientoVO.getNombImagen()); + pricingAsiento.setNumeasiento(pricingAsientoVO.getNumeasiento()); + pricingAsiento.setPorcentaje(pricingAsientoVO.getPorcentaje()); + + asientos.add(pricingAsiento); + } + retorno.setPricingAsientoList(asientos); + } + } + + public void convertVOToEntidadCanalVendas(Pricing retorno, com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) { + if(pricingVO.getCanalvendas() != null && !pricingVO.getCanalvendas().isEmpty()) { + List tipoPtoVtas = new ArrayList(); + for (PricingCanalVenta pricingCanalVentaVO : pricingVO.getCanalvendas()) { + com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta pricingTipoPtoVta = new com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta(); + pricingTipoPtoVta.setPricing(retorno); + pricingTipoPtoVta.setActivo(Pricing.ATIVO); + pricingTipoPtoVta.setFecmodif(new Date()); + pricingTipoPtoVta.setUsuarioId(retorno.getUsuarioId()); + pricingTipoPtoVta.setTipoPtovta(new TipoPuntoVenta(pricingCanalVentaVO.getCanalventaId().shortValue())); + + tipoPtoVtas.add(pricingTipoPtoVta); + } + + if(tipoPtoVtas.isEmpty()) { + com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta pricingTipoPtoVta = new com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta(); + pricingTipoPtoVta.setPricing(retorno); + pricingTipoPtoVta.setActivo(Pricing.ATIVO); + pricingTipoPtoVta.setFecmodif(new Date()); + pricingTipoPtoVta.setUsuarioId(retorno.getUsuarioId()); + pricingTipoPtoVta.setTipoPtovta(new TipoPuntoVenta(Short.valueOf("-1"))); + + tipoPtoVtas.add(pricingTipoPtoVta); + } + retorno.setPricingTipoptovtaList(tipoPtoVtas); + } + } + + public void convertVOToEntidadCategorias(Pricing retorno, com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) { + if(pricingVO.getCategorias() != null && !pricingVO.getCategorias().isEmpty()) { + List categorias = new ArrayList(); + for (PricingCategoria pricingCategoriaVO : pricingVO.getCategorias()) { + com.rjconsultores.ventaboletos.entidad.PricingCategoria pricingCategoria = new com.rjconsultores.ventaboletos.entidad.PricingCategoria(); + pricingCategoria.setPricing(retorno); + pricingCategoria.setActivo(Pricing.ATIVO); + pricingCategoria.setFecmodif(new Date()); + pricingCategoria.setUsuarioId(retorno.getUsuarioId()); + pricingCategoria.setCategoria(new Categoria(pricingCategoriaVO.getCategoriaId())); + + categorias.add(pricingCategoria); + } + + if(categorias.isEmpty()) { + com.rjconsultores.ventaboletos.entidad.PricingCategoria pricingCategoria = new com.rjconsultores.ventaboletos.entidad.PricingCategoria(); + pricingCategoria.setPricing(retorno); + pricingCategoria.setActivo(Pricing.ATIVO); + pricingCategoria.setFecmodif(new Date()); + pricingCategoria.setUsuarioId(retorno.getUsuarioId()); + pricingCategoria.setCategoria(new Categoria(1)); + + categorias.add(pricingCategoria); + + pricingCategoria = new com.rjconsultores.ventaboletos.entidad.PricingCategoria(); + pricingCategoria.setPricing(retorno); + pricingCategoria.setActivo(Pricing.ATIVO); + pricingCategoria.setFecmodif(new Date()); + pricingCategoria.setUsuarioId(retorno.getUsuarioId()); + pricingCategoria.setCategoria(new Categoria(48)); + + categorias.add(pricingCategoria); + } + + retorno.setPricingCategoriaList(categorias); + } + } + + public void convertVOToEntidadClasses(Pricing retorno, com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) { + if(pricingVO.getClasses() != null && !pricingVO.getClasses().isEmpty()) { + List clases = new ArrayList(); + for (PricingClasse pricingClasseVO : pricingVO.getClasses()) { + com.rjconsultores.ventaboletos.entidad.PricingClase pricingClase = new com.rjconsultores.ventaboletos.entidad.PricingClase(); + pricingClase.setPricing(retorno); + pricingClase.setActivo(Pricing.ATIVO); + pricingClase.setFecmodif(new Date()); + pricingClase.setUsuarioId(retorno.getUsuarioId()); + pricingClase.setClaseServicio(new ClaseServicio(pricingClasseVO.getClasseservicioId())); + + clases.add(pricingClase); + } + + if(clases.isEmpty()) { + com.rjconsultores.ventaboletos.entidad.PricingClase pricingClase = new com.rjconsultores.ventaboletos.entidad.PricingClase(); + pricingClase.setPricing(retorno); + pricingClase.setActivo(Pricing.ATIVO); + pricingClase.setFecmodif(new Date()); + pricingClase.setUsuarioId(retorno.getUsuarioId()); + pricingClase.setClaseServicio(new ClaseServicio(1)); + + clases.add(pricingClase); + } + retorno.setPricingClaseList(clases); + } + } + + public void convertVOToEntidadServicos(Pricing retorno, com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) { + if(pricingVO.getServicos() != null && !pricingVO.getServicos().isEmpty()) { + List corridas = new ArrayList(); + for (PricingCorrida pricingServicoVO : pricingVO.getServicos()) { + com.rjconsultores.ventaboletos.entidad.PricingCorrida pricingCorrida = new com.rjconsultores.ventaboletos.entidad.PricingCorrida(); + pricingCorrida.setPricing(retorno); + pricingCorrida.setActivo(Pricing.ATIVO); + pricingCorrida.setFecmodif(new Date()); + pricingCorrida.setUsuarioId(retorno.getUsuarioId()); + pricingCorrida.setCorridaCtrl(new CorridaCtrl(pricingServicoVO.getNumservico())); + + corridas.add(pricingCorrida); + } + retorno.setPricingCorridaList(corridas); + } + } + + public void convertVOToEntidadDias(Pricing retorno, com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) throws ParseException { + if(pricingVO.getDias() != null && !pricingVO.getDias().isEmpty()) { + List dias = new ArrayList(); + for (PricingDia pricingDiaVO : pricingVO.getDias()) { + com.rjconsultores.ventaboletos.entidad.PricingDia pricingDia = new com.rjconsultores.ventaboletos.entidad.PricingDia(); + pricingDia.setPricing(retorno); + pricingDia.setActivo(Pricing.ATIVO); + pricingDia.setFecmodif(new Date()); + pricingDia.setUsuarioId(retorno.getUsuarioId()); + + if(StringUtils.isNotBlank(pricingDiaVO.getHorariofim())) { + pricingDia.setHorariofin(DateUtil.getFecInicio(DateUtil.getDateFromString(pricingDiaVO.getHorariofim(), "HH:mm")).getTime()); + } + + if(StringUtils.isNotBlank(pricingDiaVO.getHorarioinicio())) { + pricingDia.setHorarioinicio(DateUtil.getFecInicio(DateUtil.getDateFromString(pricingDiaVO.getHorarioinicio(), "HH:mm")).getTime()); + } + + pricingDia.setIndlunes(pricingDiaVO.getSegunda() != null ? pricingDiaVO.getSegunda().equals(1) : false); + pricingDia.setIndmartes(pricingDiaVO.getTerca() != null ? pricingDiaVO.getTerca().equals(1) : false); + pricingDia.setIndmiercoles(pricingDiaVO.getQuarta() != null ? pricingDiaVO.getQuarta().equals(1) : false); + pricingDia.setIndjueves(pricingDiaVO.getQuinta() != null ? pricingDiaVO.getQuinta().equals(1) : false); + pricingDia.setIndviernes(pricingDiaVO.getSexta() != null ? pricingDiaVO.getSexta().equals(1) : false); + pricingDia.setIndsabado(pricingDiaVO.getSabado() != null ? pricingDiaVO.getSabado().equals(1) : false); + pricingDia.setIndfecventa(pricingDiaVO.getDataviagem() == null || !pricingDiaVO.getDataviagem().equals(1)); + pricingDia.setIndfecviaje(!pricingDia.getIndfecventa()); + + dias.add(pricingDia); + } + retorno.setPricingDiaList(dias); + } + } + + public void convertVOToEntidadOcupacoes(Pricing retorno, com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) { + if(pricingVO.getOcupacoes() != null && !pricingVO.getOcupacoes().isEmpty()) { + List ocupacoes = new ArrayList(); + for (PricingOcupaAntecipa pricingOcupaAntecipaVO : pricingVO.getOcupacoes()) { + com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa pricingOcupaAntecipa = new com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa(); + pricingOcupaAntecipa.setPricing(retorno); + pricingOcupaAntecipa.setActivo(Pricing.ATIVO); + pricingOcupaAntecipa.setFecmodif(new Date()); + pricingOcupaAntecipa.setUsuarioId(retorno.getUsuarioId()); + pricingOcupaAntecipa.setCantasientosmax(pricingOcupaAntecipaVO.getCantasientosmax()); + pricingOcupaAntecipa.setCantasientosmin(pricingOcupaAntecipaVO.getCantasientosmin()); + pricingOcupaAntecipa.setCantdiasmax(pricingOcupaAntecipaVO.getCantdiasmax()); + pricingOcupaAntecipa.setCantdiasmin(pricingOcupaAntecipaVO.getCantdiasmin()); + pricingOcupaAntecipa.setImporte(pricingOcupaAntecipaVO.getImporte()); + pricingOcupaAntecipa.setOcupacionfinal(pricingOcupaAntecipaVO.getOcupacionfinal()); + pricingOcupaAntecipa.setOcupacioninicial(pricingOcupaAntecipaVO.getOcupacioninicial()); + pricingOcupaAntecipa.setPorcentaje(pricingOcupaAntecipaVO.getPorcentaje()); + if(pricingOcupaAntecipaVO.getClasseId() != null) { + pricingOcupaAntecipa.setPricingClasseTarifaria(new PricingClasseTarifaria(pricingOcupaAntecipaVO.getClasseId())); + } + + ocupacoes.add(pricingOcupaAntecipa); + } + retorno.setPricingOcupaAntecipaList(ocupacoes); + } + } + + public void convertVOToEntidadPuntoventas(Pricing retorno, com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) { + if(pricingVO.getPuntoventas() != null && !pricingVO.getPuntoventas().isEmpty()) { + List puntoventas = new ArrayList(); + for (PricingPuntoVenta pricingPuntoVentaVO : pricingVO.getPuntoventas()) { + com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta pricingPuntoVenta = new com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta(); + pricingPuntoVenta.setPricing(retorno); + pricingPuntoVenta.setActivo(Pricing.ATIVO); + pricingPuntoVenta.setFecmodif(new Date()); + pricingPuntoVenta.setUsuarioId(retorno.getUsuarioId()); + pricingPuntoVenta.setPuntoVenta(new PuntoVenta(pricingPuntoVentaVO.getPuntoventaId())); + + puntoventas.add(pricingPuntoVenta); + } + + if(puntoventas.isEmpty()) { + com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta pricingPuntoVenta = new com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta(); + pricingPuntoVenta.setPricing(retorno); + pricingPuntoVenta.setActivo(Pricing.ATIVO); + pricingPuntoVenta.setFecmodif(new Date()); + pricingPuntoVenta.setUsuarioId(retorno.getUsuarioId()); + pricingPuntoVenta.setPuntoVenta(new PuntoVenta(-1)); + + puntoventas.add(pricingPuntoVenta); + } + + retorno.setPricingPuntoventaList(puntoventas); + } + } + + public void convertVOToEntidadLinhas(Pricing retorno, com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) { + if(pricingVO.getLinhas() != null && !pricingVO.getLinhas().isEmpty()) { + List rutas = new ArrayList(); + for (PricingRuta pricingLinhaVO : pricingVO.getLinhas()) { + com.rjconsultores.ventaboletos.entidad.PricingRuta pricingRuta = new com.rjconsultores.ventaboletos.entidad.PricingRuta(); + pricingRuta.setPricing(retorno); + pricingRuta.setActivo(Pricing.ATIVO); + pricingRuta.setFecmodif(new Date()); + pricingRuta.setUsuarioId(retorno.getUsuarioId()); + pricingRuta.setRuta(new Ruta(pricingLinhaVO.getRutaId())); + + rutas.add(pricingRuta); + } + + if(rutas.isEmpty()) { + com.rjconsultores.ventaboletos.entidad.PricingRuta pricingRuta = new com.rjconsultores.ventaboletos.entidad.PricingRuta(); + pricingRuta.setPricing(retorno); + pricingRuta.setActivo(Pricing.ATIVO); + pricingRuta.setFecmodif(new Date()); + pricingRuta.setUsuarioId(retorno.getUsuarioId()); + pricingRuta.setRuta(new Ruta(-1)); + + rutas.add(pricingRuta); + } + retorno.setPricingRutaList(rutas); + } + } + + public void convertVOToEntidadTiposervicos(Pricing retorno, com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) { + if(pricingVO.getTiposervicos() != null && !pricingVO.getTiposervicos().isEmpty()) { + List tipoServicios = new ArrayList(); + for (PricingTipoCorrida pricingTipoCorridaVO : pricingVO.getTiposervicos()) { + com.rjconsultores.ventaboletos.entidad.PricingTipoServicio pricingTipoServicio = new com.rjconsultores.ventaboletos.entidad.PricingTipoServicio(); + pricingTipoServicio.setPricing(retorno); + pricingTipoServicio.setActivo(Pricing.ATIVO); + pricingTipoServicio.setFecmodif(new Date()); + pricingTipoServicio.setUsuarioId(retorno.getUsuarioId()); + pricingTipoServicio.setTipoServicio(new TipoServicio(pricingTipoCorridaVO.getTipocorridaId())); + + tipoServicios.add(pricingTipoServicio); + } + retorno.setPricingTipoServicioList(tipoServicios); + } + } + + public void convertVOToEntidadMercados(Pricing retorno, com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) { + if(pricingVO.getMercados() != null && !pricingVO.getMercados().isEmpty()) { + List mercados = new ArrayList(); + for (PricingMercado pricingMercadoVO : pricingVO.getMercados()) { + com.rjconsultores.ventaboletos.entidad.PricingMercado pricingMercado = new com.rjconsultores.ventaboletos.entidad.PricingMercado(); + pricingMercado.setPricing(retorno); + pricingMercado.setActivo(Pricing.ATIVO); + pricingMercado.setFecmodif(new Date()); + pricingMercado.setUsuarioId(retorno.getUsuarioId()); + pricingMercado.setOrigen(new Parada(pricingMercadoVO.getOrigemId())); + pricingMercado.setDestino(new Parada(pricingMercadoVO.getDestinoId())); + + mercados.add(pricingMercado); + } + retorno.setPricingMercadoList(mercados); + } + } + + public void convertVOToEntidadVigencias(Pricing retorno, com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) throws ParseException { + if(pricingVO.getVigencias() != null && !pricingVO.getVigencias().isEmpty()) { + List vigencias = new ArrayList(); + for (PricingVigencia pricingVigenciaVO : pricingVO.getVigencias()) { + com.rjconsultores.ventaboletos.entidad.PricingVigencia pricingVigencia = new com.rjconsultores.ventaboletos.entidad.PricingVigencia(); + pricingVigencia.setPricing(retorno); + pricingVigencia.setActivo(Pricing.ATIVO); + pricingVigencia.setFecmodif(new Date()); + pricingVigencia.setUsuarioId(retorno.getUsuarioId()); + + if(StringUtils.isNotBlank(pricingVigenciaVO.getInicioDataVenda())) { + pricingVigencia.setFecinicioventa(DateUtil.getDateFromString(pricingVigenciaVO.getInicioDataVenda(), "dd/MM/yyyy HH:mm")); + } + + if(StringUtils.isNotBlank(pricingVigenciaVO.getFimDataVenda())) { + pricingVigencia.setFecfinventa(DateUtil.getDateFromString(pricingVigenciaVO.getFimDataVenda(), "dd/MM/yyyy HH:mm")); + } + + if(StringUtils.isNotBlank(pricingVigenciaVO.getInicioDataViagem())) { + pricingVigencia.setFecinicioviaje(DateUtil.getDateFromString(pricingVigenciaVO.getInicioDataViagem(), "dd/MM/yyyy HH:mm")); + } + + if(StringUtils.isNotBlank(pricingVigenciaVO.getFimDataViagem())) { + pricingVigencia.setFecfinviaje(DateUtil.getDateFromString(pricingVigenciaVO.getFimDataViagem(), "dd/MM/yyyy HH:mm")); + } + + vigencias.add(pricingVigencia); + } + retorno.setPricingVigenciaList(vigencias); + } + } + + public void convertVOToEntidadMarcas(Pricing retorno, com.rjconsultores.ventaboletos.vo.pricing.Pricing pricingVO) { + if(pricingVO.getMarcas() != null && !pricingVO.getMarcas().isEmpty()) { + List marcas = new ArrayList(); + for (PricingMarca pricingMarcaVO : pricingVO.getMarcas()) { + com.rjconsultores.ventaboletos.entidad.PricingMarca pricingMarca = new com.rjconsultores.ventaboletos.entidad.PricingMarca(); + pricingMarca.setPricing(retorno); + pricingMarca.setActivo(Pricing.ATIVO); + pricingMarca.setFecmodif(new Date()); + pricingMarca.setUsuarioId(retorno.getUsuarioId()); + pricingMarca.setMarca(new Marca(pricingMarcaVO.getMarcaId().shortValue())); + + marcas.add(pricingMarca); + } + retorno.setPricingMarcaList(marcas); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/RegistroConDependenciaException.java b/src/com/rjconsultores/ventaboletos/utilerias/RegistroConDependenciaException.java new file mode 100644 index 000000000..a05ef8e06 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/RegistroConDependenciaException.java @@ -0,0 +1,23 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.utilerias; + +import org.zkoss.util.resource.Labels; + +/** + * + * @author gleimar + */ +public class RegistroConDependenciaException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public RegistroConDependenciaException() { + super(Labels.getLabel("MSG.exception.RegistroConDependenciaException")); + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/SendMail.java b/src/com/rjconsultores/ventaboletos/utilerias/SendMail.java new file mode 100644 index 000000000..eb7bb4254 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/SendMail.java @@ -0,0 +1,426 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; + +import javax.activation.DataHandler; +import javax.activation.DataSource; +import javax.activation.FileDataSource; +import javax.mail.AuthenticationFailedException; +import javax.mail.BodyPart; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.Multipart; +import javax.mail.SendFailedException; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.AddressException; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeMultipart; +import javax.mail.util.ByteArrayDataSource; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.enums.MimeType; +import com.rjconsultores.ventaboletos.enums.TypeContentEmail; + + +public class SendMail implements java.io.Serializable { + private static final String ENCODE_UTF_8 = "UTF-8"; + + private static final long serialVersionUID = 2067442255080001075L; + + public enum AuthType {TLS,SSL,SMTPS,NONE} + + private String smtpHost; + private String smtpUser; + private String smtpPassword; + private String smtpPort; + private String emailFrom; + private String emailTo; + private String emailToCO; + private List emailCopy = new ArrayList(); + private String localhost; + private Boolean auth; + private String subject; + private String text; + private Map anexosBytes; + private Map anexosArquivos; + private Map mimeTypes; + private AuthType authType; + + public SendMail(){ + this.smtpHost = ""; + this.smtpUser = ""; + this.smtpPassword = ""; + this.smtpPort = ""; + this.emailFrom = ""; + this.localhost = ""; + this.auth = true; + this.authType = AuthType.TLS; + this.emailTo = ""; + this.emailToCO = ""; + } + + public SendMail(String smtpHost, String smtpUser, String smtpPassword, String smtpPort, + String emailFrom, String emailTo, List emailCopy, String localhost, + Boolean auth, String subject, String text) { + this.smtpHost = smtpHost; + this.smtpUser = smtpUser; + this.smtpPassword = smtpPassword; + this.smtpPort = smtpPort; + this.emailFrom = emailFrom; + this.emailTo = emailTo; + this.emailCopy = emailCopy; + this.localhost = localhost; + this.auth = auth; + this.subject = subject; + this.text = text; + } + + public String[] removeNull(String[] a) { + List removed = new ArrayList(); + for (String str : a) + if (!StringUtils.isBlank(str) && !str.equals("null")) + removed.add(str); + return removed.toArray(new String[0]); + } + + public void send() throws SendFailedException { + send(null); + } + + public void send(TypeContentEmail type) throws SendFailedException { + try { + if(emailTo==null) { + throw new SendFailedException("Email de envio não foi corretamente configurado"); + } + String[] to = removeNull(getArrayEnderecoEmail(emailTo)); + String[] bcc = removeNull(getArrayEnderecoEmail(emailToCO)); + + Session session = Session.getInstance(getProperties(), null); + + Message message = new MimeMessage(session); + message.setFrom(new InternetAddress(emailFrom)); + message.setRecipients(Message.RecipientType.TO, getInternetAddress(to)); + message.setRecipients(Message.RecipientType.BCC, getInternetAddress(bcc)); + InternetAddress[] copyAddress = getInternetAddress(new String[emailCopy.size()]); + if (copyAddress.length > 0) { + message.setRecipients(Message.RecipientType.CC, copyAddress); + } + + ((MimeMessage) message).setSubject(subject, ENCODE_UTF_8); + + Multipart multipart = new MimeMultipart(); + multipart.addBodyPart(type == null ? getMimeBodyPart() : getMimeBodyPart(type)); + message.setContent(multipart); + + adicionarAnexos(multipart); + + Transport t = session.getTransport(authType.equals(AuthType.SMTPS) ? "smtps" : "smtp"); + if (auth) { + t.connect(smtpUser, smtpPassword); + } else { + t.connect(); + + } + t.sendMessage(message, message.getAllRecipients()); + t.close(); + } catch (Exception e) { + throw new SendFailedException("Ocorreu um erro no envio do email.", e); + } + } + + public void sendEmail(TypeContentEmail type) throws AuthenticationFailedException, MessagingException, Exception { + String[] to = removeNull(getArrayEnderecoEmail(emailTo)); + String[] bcc = removeNull(getArrayEnderecoEmail(emailToCO)); + + Session session = Session.getInstance(getProperties(), null); + + Message message = new MimeMessage(session); + message.setFrom(new InternetAddress(emailFrom)); + message.setRecipients(Message.RecipientType.TO, getInternetAddress(to)); + message.setRecipients(Message.RecipientType.BCC, getInternetAddress(bcc)); + InternetAddress[] copyAddress = getInternetAddress(new String[emailCopy.size()]); + if (copyAddress.length > 0) { + message.setRecipients(Message.RecipientType.CC, copyAddress); + } + + ((MimeMessage) message).setSubject(subject, ENCODE_UTF_8); + + Multipart multipart = new MimeMultipart(); + multipart.addBodyPart(type == null ? getMimeBodyPart() : getMimeBodyPart(type)); + message.setContent(multipart); + + adicionarAnexos(multipart); + + Transport t = session.getTransport(authType.equals(AuthType.SMTPS) ? "smtps" : "smtp"); + if (auth) { + t.connect(smtpUser, smtpPassword); + } else { + t.connect(); + + } + t.sendMessage(message, message.getAllRecipients()); + t.close(); + } + + public boolean testConfiguration() throws AuthenticationFailedException, MessagingException, Exception { + boolean result = false; + + Session session = Session.getInstance(getProperties(), null); + + Message message = new MimeMessage(session); + + ((MimeMessage) message).setSubject(subject, ENCODE_UTF_8); + + Transport t = session.getTransport(authType.equals(AuthType.SMTPS) ? "smtps" : "smtp"); + if (auth) { + t.connect(smtpUser, smtpPassword); + } else { + t.connect(); + + } + t.close(); + result = true; + + return result; + } + + private String[] getArrayEnderecoEmail(String emailValue) { + String[] arrayEmail = {}; + if (emailValue.contains(";")){ + arrayEmail = emailValue.split(";"); + } else if (!StringUtils.isBlank(emailValue)){ + arrayEmail = new String[1]; + arrayEmail[0] = emailValue; + } + return arrayEmail; + } + + public void addAnexo(String nome, ByteArrayOutputStream anexo, MimeType mimeType) { + if(anexosBytes == null) { + anexosBytes = new HashMap(); + } + if(mimeTypes == null) { + mimeTypes = new HashMap(); + } + anexosBytes.put(nome, anexo); + mimeTypes.put(nome, mimeType); + } + + public void addAnexo(String nome, String anexo) { + if(anexosArquivos== null) { + anexosArquivos = new HashMap(); + } + anexosArquivos.put(nome, anexo); + } + + private BodyPart getMimeBodyPart() throws MessagingException { + BodyPart messageBodyPart = new MimeBodyPart(); + ((MimeBodyPart)messageBodyPart).setText(text, ENCODE_UTF_8); + return messageBodyPart; + } + + private BodyPart getMimeBodyPart(TypeContentEmail type) throws MessagingException { + BodyPart messageBodyPart = new MimeBodyPart(); + messageBodyPart.setContent(text, type.valor); + return messageBodyPart; + } + + private InternetAddress[] getInternetAddress(String[] address) throws AddressException { + InternetAddress[] toAddress = new InternetAddress[address.length]; + for (int i = 0; i < address.length; i++) { + toAddress[i] = new InternetAddress(address[i]); + } + return toAddress; + } + + private Properties getProperties() { + Properties props = System.getProperties(); + props.put("mail.smtp.host", smtpHost); + props.put("mail.smtp.ssl.trust", smtpHost); + + if (localhost != null) { + props.put("mail.smtp.localhost", localhost); + } + + if (auth) { + props.setProperty("mail.smtp.user", smtpUser); + } + + if (authType.equals(AuthType.TLS)) { + props.setProperty("mail.smtp.starttls.enable", "true"); + props.setProperty("mail.smtp.starttls.required", "true"); + } else if (authType.equals(AuthType.SSL)) { + props.put("mail.smtp.socketFactory.port", smtpPort); + props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); + } else if (authType.equals(AuthType.SMTPS)) { + props.setProperty("mail.smtps.ssl.checkserveridentity", "true"); + props.setProperty("mail.smtps.quitwait", "false"); + } else if (authType.equals(AuthType.NONE)) { + props.setProperty("mail.smtp.starttls.enable", "true"); + props.setProperty("mail.smtp.starttls.required", "false"); + props.setProperty("mail.smtp.ssl.trust", "*"); + props.setProperty("mail.smtp.ssl.checkserveridentity", "false"); + props.setProperty("mail.smtp.ssl.enable", "false"); + } + + props.setProperty("mail.smtp.auth", auth.toString()); + props.setProperty("mail.smtp.port", smtpPort); + return props; + } + + private void adicionarAnexos(Multipart multipart) throws MessagingException, IOException { + anexarArquivosBytes(multipart); + anexarArquivos(multipart); + } + + private void anexarArquivosBytes(Multipart multipart) throws MessagingException, IOException { + if(anexosBytes != null) { + for (Entry anexo : anexosBytes.entrySet()) { + BodyPart bodyPart = new MimeBodyPart(); + MimeType mimeType = mimeTypes.get(anexo.getKey()); + DataSource bds = new ByteArrayDataSource(new ByteArrayInputStream(anexo.getValue().toByteArray()), mimeType.toString()); + bodyPart.setDataHandler(new DataHandler(bds)); + bodyPart.setFileName(anexo.getKey()); + + multipart.addBodyPart(bodyPart); + } + } + } + + private void anexarArquivos(Multipart multipart) throws MessagingException { + if(anexosArquivos != null) { + for (Entry anexo : anexosArquivos.entrySet()) { + BodyPart bodyPart = new MimeBodyPart(); + DataSource bds = new FileDataSource(anexo.getValue()); + bodyPart.setDataHandler(new DataHandler(bds)); + bodyPart.setFileName(anexo.getKey()); + multipart.addBodyPart(bodyPart); + } + } + } + + public String getSmtpHost() { + return smtpHost; + } + + public void setSmtpHost(String smtpHost) { + this.smtpHost = smtpHost; + } + + public String getSmtpUser() { + return smtpUser; + } + + public void setSmtpUser(String smtpUser) { + this.smtpUser = smtpUser; + } + + public String getSmtpPassword() { + return smtpPassword; + } + + public void setSmtpPassword(String smtpPassword) { + this.smtpPassword = smtpPassword; + } + + public String getSmtpPort() { + return smtpPort; + } + + public void setSmtpPort(String smtpPort) { + this.smtpPort = smtpPort; + } + + public String getEmailFrom() { + return emailFrom; + } + + public void setEmailFrom(String emailFrom) { + this.emailFrom = emailFrom; + } + + public String getEmailTo() { + return emailTo; + } + + public void setEmailTo(String emailTo) { + this.emailTo = emailTo; + } + + public List getEmailCopy() { + return emailCopy; + } + + public void setEmailCopy(List emailCopy) { + this.emailCopy = emailCopy; + } + + public String getLocalhost() { + return localhost; + } + + public void setLocalhost(String localhost) { + this.localhost = localhost; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public String getEmailToCO() { + return emailToCO; + } + + public void setEmailToCO(String emailToCO) { + this.emailToCO = emailToCO; + } + + public Boolean getAuth() { + return auth; + } + + public void setAuth(Boolean auth) { + this.auth = auth; + } + + public Map getAnexosArquivos() { + return anexosArquivos; + } + + public void setAnexosArquivos(Map anexosArquivos) { + this.anexosArquivos = anexosArquivos; + } + + public AuthType getAuthType() { + return authType; + } + + public void setAuthType(AuthType authType) { + this.authType = authType; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/utilerias/StringHelper.java b/src/com/rjconsultores/ventaboletos/utilerias/StringHelper.java new file mode 100644 index 000000000..0ecf603a7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/StringHelper.java @@ -0,0 +1,154 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.commons.lang.StringUtils; + +public class StringHelper { + + public static final String QUEBRA_LINHA = "\r\n"; + + private static String[] REPLACES = { "a", "e", "i", "o", "u", "c", "A", "E", "I", "O", "U", "C" }; + private static Pattern[] PATTERNS = null; + + private StringHelper() { + } + + private static void compilePatterns() { + PATTERNS = new Pattern[REPLACES.length]; + PATTERNS[0] = Pattern.compile("[âãáàä]"); + PATTERNS[1] = Pattern.compile("[éèêë]"); + PATTERNS[2] = Pattern.compile("[íìîï]"); + PATTERNS[3] = Pattern.compile("[óòôõö]"); + PATTERNS[4] = Pattern.compile("[úùûü]"); + PATTERNS[5] = Pattern.compile("[ç]"); + PATTERNS[6] = Pattern.compile("[ÂÃÁÀÄ]"); + PATTERNS[7] = Pattern.compile("[ÉÈÊË]"); + PATTERNS[8] = Pattern.compile("[ÍÌÎÏ]"); + PATTERNS[9] = Pattern.compile("[ÓÒÔÕÖ]"); + PATTERNS[10] = Pattern.compile("[ÚÙÛÜ]"); + PATTERNS[11] = Pattern.compile("[Ç]"); + } + + public static String replaceAcento(String text) { + if (PATTERNS == null) { + compilePatterns(); + } + + String result = text; + for (int i = 0; i < PATTERNS.length; i++) { + Matcher matcher = PATTERNS[i].matcher(result); + result = matcher.replaceAll(REPLACES[i]); + } + return result; + } + + public static String retornaSomenteNumeros(String str) { + if (str != null) { + return str.replaceAll("[^0123456789]", ""); + } else { + return ""; + } + } + + public static String removeStringEsquerda(String str, String strRemover) { + if (str != null) { + str = StringUtils.stripStart(str, strRemover); + return str; + } else { + return ""; + } + } + + public static String preencherStringEspacoDireita(String str, int tamanho) { + return preencherStringDireita(str, tamanho, StringUtils.EMPTY); + } + + public static String preencherStringEspacoEsquerda(String str, int tamanho) { + return preencherStringEsquerda(str, tamanho, StringUtils.EMPTY); + } + + public static String preencherZeroDireita(String str, int tamanho) { + return preencherStringDireita(str, tamanho, "0"); + } + + public static String preencherZeroEsquerda(String str, int tamanho) { + return preencherStringEsquerda(str, tamanho, "0"); + } + + public static String preencherZeroEsquerda(Integer val, int tamanho) { + String value = val == null ? "" : val.toString(); + + return preencherStringEsquerda(value, tamanho, "0"); + } + + public static String preencherStringDireita(String str, int tamanho, String preenchimento) { + if (str != null) { + if (str.length() > tamanho) { + str = str.substring(0, tamanho); + } else { + str = StringUtils.rightPad(str, tamanho, preenchimento); + } + return str; + } else { + return StringUtils.rightPad(StringUtils.EMPTY, tamanho, preenchimento); + } + } + + public static String preencherStringEsquerda(String str, int tamanho, String preenchimento) { + if (str != null) { + if (str.length() > tamanho) { + str = str.substring(0, tamanho); + } else { + str = StringUtils.leftPad(str, tamanho, preenchimento); + } + return str; + } else { + return StringUtils.leftPad(StringUtils.EMPTY, tamanho, preenchimento); + } + } + + public static String preencherPipeDireita(String str, int tamanho) { + if (str != null && !StringUtils.isEmpty(str)) { + if (str.length() > tamanho) { + str = str.substring(0, tamanho); + } + str = StringUtils.rightPad(str, str.length() + 1, "|"); + return str; + } else { + return "|"; + } + } + + public static String preencherPipeDireita(String str) { + if (str != null && !StringUtils.isEmpty(str)) { + str = StringUtils.rightPad(str, str.length() + 1, "|"); + return str; + } else { + return "|"; + } + } + + public static String divideEFormata(String str) { + + DecimalFormatSymbols symbols = new DecimalFormatSymbols(); + symbols.setDecimalSeparator(','); + DecimalFormat formatador = new DecimalFormat("0.00", symbols); + + String valor = "0"; + if (str != null) { + valor = new BigDecimal(str).divide(new BigDecimal(100)).toString(); + } + return formatador.format(new BigDecimal(valor)); + + } + + public static Boolean isNumeric(String str) { + return StringUtils.isNumeric(str); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/TimeZoneUtil.java b/src/com/rjconsultores/ventaboletos/utilerias/TimeZoneUtil.java new file mode 100644 index 000000000..a97122801 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/TimeZoneUtil.java @@ -0,0 +1,130 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.math.BigDecimal; +import java.util.Calendar; +import java.util.Date; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TimeZoneUtil { + + private static Logger log = LoggerFactory.getLogger(TimeZoneUtil.class); + + /** + * Ajusta o timezone conforme a origem ou ponto de venda informado de acordo com o horario de verao e fuso horario, + * nao alterando a data informada, apenas o GMT + * + * Retorna a data formatada para envio do BPe + * + * @param puntoventaId + * @param paradaId + * @param data + * @return + */ + public static String ajustarTimeZone(Map mConfiguracoesFusoHorario, Date data) { + try { + Integer gmtBrasil = -3; + + if(mConfiguracoesFusoHorario != null) { + StringBuilder sDataBpeFormatada = new StringBuilder(DateUtil.getStringDate(data, "yyyy-MM-dd'T'HH:mm:ss")); + Integer tiempohorhuso = mConfiguracoesFusoHorario.get("tiempohorhuso"); + + if (tiempohorhuso != null) { + gmtBrasil += tiempohorhuso; + } + Integer tiempohorverano = mConfiguracoesFusoHorario.get("tiempohorverano"); + + if (tiempohorverano != null) { + gmtBrasil += tiempohorverano; + } + + StringBuilder sGmtBrasil = new StringBuilder(); + if(gmtBrasil >= 0) { + sGmtBrasil.append("+"); + } + sGmtBrasil.append(gmtBrasil.toString()); + + if(gmtBrasil.toString().length() <= 2) { + sGmtBrasil.insert(1, "0"); + } + sDataBpeFormatada.append(sGmtBrasil).append(":00"); + + return sDataBpeFormatada.toString(); + } + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return DateUtil.dataFormatoBPe(data); + } + + /** + * Ajusta o timezone da data de acordo com a diferença da agencia de venda com a origem da viagem. + * @param puntoventaId + * @param paradaId + * @param data + * @return + */ + public static String ajustarPuntoVentaEmissaoOrigemViagemTimeZone(Map mConfiguracoesFusoHorarioParada, Map mConfiguracoesFusoHorarioPuntoVenta, Date data) { + try { + Integer gmtParada = -3; + Integer gmtPuntoventa = -3; + + if(mConfiguracoesFusoHorarioParada != null) { + Integer tiempohorhuso = mConfiguracoesFusoHorarioParada.get("tiempohorhuso"); + + if (tiempohorhuso != null) { + gmtParada += tiempohorhuso; + } + Integer tiempohorverano = mConfiguracoesFusoHorarioParada.get("tiempohorverano"); + + if (tiempohorverano != null) { + gmtParada += tiempohorverano; + } + } + + if(mConfiguracoesFusoHorarioPuntoVenta != null) { + Integer tiempohorhuso = mConfiguracoesFusoHorarioPuntoVenta.get("tiempohorhuso"); + + if (tiempohorhuso != null) { + gmtPuntoventa += tiempohorhuso; + } + Integer tiempohorverano = mConfiguracoesFusoHorarioPuntoVenta.get("tiempohorverano"); + + if (tiempohorverano != null) { + gmtPuntoventa += tiempohorverano; + } + } + + Integer qtdHoraAjustaData = new BigDecimal(gmtPuntoventa).abs().intValue() - new BigDecimal(gmtParada).abs().intValue(); + Calendar cal = Calendar.getInstance(); + cal.setTime(data); + cal.add(Calendar.HOUR_OF_DAY, qtdHoraAjustaData); + + StringBuilder sDataBpeFormatada = new StringBuilder(DateUtil.getStringDate(cal.getTime(), "yyyy-MM-dd'T'HH:mm:ss")); + + StringBuilder sGmtData = new StringBuilder(); + if(gmtParada >= 0) { + sGmtData.append("+"); + } + sGmtData.append(gmtParada.toString()); + + if(gmtParada.toString().length() <= 2) { + sGmtData.insert(1, "0"); + } + + sDataBpeFormatada.append(sGmtData).append(":00"); + + return sDataBpeFormatada.toString(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return DateUtil.dataFormatoBPe(data); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/TraslaparUtil.java b/src/com/rjconsultores/ventaboletos/utilerias/TraslaparUtil.java new file mode 100644 index 000000000..19f1594e7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/TraslaparUtil.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.utilerias; + +import java.math.BigDecimal; +import java.util.Date; + + +/** + * Classe que ajuda na verificação se os dados se sobrepõe + * @author gleimar + */ +public class TraslaparUtil { + /** + * Verifica se o intervalo de datas dtStartCompare e dtEndCompare estão dentro do intervalo dtStart dtEnd + * + * @param dtStart + * @param dtEnd + * @param dtStartCompare + * @param dtEndCompare + * @return + */ + public static boolean intersectDate(Date dtStart, Date dtEnd, Date dtStartCompare, Date dtEndCompare) { + if (((DateUtil.compareDate(dtStart, dtStartCompare) >= 0) && (DateUtil.compareDate(dtEnd, dtEndCompare) <= 0)) + || ((DateUtil.compareDate(dtEnd, dtStartCompare) >= 0) && (DateUtil.compareDate(dtEnd, dtEndCompare) <= 0)) + || ((DateUtil.compareDate(dtStart, dtStartCompare) >= 0) && (DateUtil.compareDate(dtStart, dtEndCompare) <= 0)) + || ((DateUtil.compareDate(dtStart, dtStartCompare) <= 0) && (DateUtil.compareDate(dtEnd, dtEndCompare) >= 0))) { + + return true; + } + + return false; + } + + /** + * + * @param numStart + * @param numEnd + * @param numStartCompare + * @param numEndCompare + * @return + */ + public static boolean intersectNum(Long numStart, Long numEnd, Long numStartCompare, Long numEndCompare) { + if (((numStart.compareTo(numStartCompare) >= 0) && (numEnd.compareTo(numEndCompare) <= 0)) + || ((numEnd.compareTo(numStartCompare) >= 0) && (numEnd.compareTo(numEndCompare) <= 0)) + || ((numStart.compareTo(numStartCompare) >= 0) && (numStart.compareTo(numEndCompare) <= 0)) + || ((numStart.compareTo(numStartCompare) <= 0) && (numEnd.compareTo(numEndCompare) >= 0))) { + + return true; + } + + return false; + } + public static boolean intersectNum(BigDecimal numStart, BigDecimal numEnd, BigDecimal numStartCompare, BigDecimal numEndCompare) { + if (((numStart.compareTo(numStartCompare) >= 0) && (numEnd.compareTo(numEndCompare) <= 0)) + || ((numEnd.compareTo(numStartCompare) >= 0) && (numEnd.compareTo(numEndCompare) <= 0)) + || ((numStart.compareTo(numStartCompare) >= 0) && (numStart.compareTo(numEndCompare) <= 0)) + || ((numStart.compareTo(numStartCompare) <= 0) && (numEnd.compareTo(numEndCompare) >= 0))) { + + return true; + } + + return false; + } + public static boolean intersectNum(Integer numStart, Integer numEnd, Integer numStartCompare, Integer numEndCompare) { + return intersectNum(numStart.longValue(), numEnd.longValue(), numStartCompare.longValue(), numEndCompare.longValue()); + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/UsuarioLogado.java b/src/com/rjconsultores/ventaboletos/utilerias/UsuarioLogado.java new file mode 100644 index 000000000..bd10bd4ea --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/UsuarioLogado.java @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.utilerias; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.context.ApplicationContext; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContext; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.web.context.ContextLoaderListener; + +import com.rjconsultores.ventaboletos.dao.UsuarioPerfilDAO; +import com.rjconsultores.ventaboletos.entidad.PerfilFuncion; +import com.rjconsultores.ventaboletos.entidad.Usuario; +import com.rjconsultores.ventaboletos.entidad.UsuarioPerfil; + +/** + * + * @author rodrigo + */ +public class UsuarioLogado { + + private static Logger log = Logger.getLogger(UsuarioLogado.class); + + public static Usuario getUsuarioLogado() { + Usuario usuario = null; + SecurityContext sc = SecurityContextHolder.getContext(); + if (sc != null) { + Authentication authentication = (Authentication) sc.getAuthentication(); + + if ((authentication != null) && (authentication.getPrincipal() instanceof Usuario)) { + usuario = (Usuario) authentication.getPrincipal(); + + if(usuario.getListClavesPermisos() == null) { + cargaPermisoClave(usuario); + } + } else { + usuario = null; + } + } + + return usuario; + } + + private static void cargaPermisoClave(Usuario usuario) { + try { + if(usuario != null && usuario.getListClavesPermisos() == null || usuario.getListClavesPermisos().isEmpty()) { + ApplicationContext context = ContextLoaderListener.getCurrentWebApplicationContext(); + + if(context != null) { + + UsuarioPerfilDAO usuarioPerfilDAO = context.getBean(UsuarioPerfilDAO.class); + if(usuarioPerfilDAO != null) { + usuario.setListClavesPermisos(new ArrayList()); + List listUsuarioPerfil = usuarioPerfilDAO.obtenerPorUsuario(usuario); + for (UsuarioPerfil up : listUsuarioPerfil) { + List listPerfilFuncion = up.getPerfil().getPerfilFuncionList(); + for (PerfilFuncion pf : listPerfilFuncion) { + usuario.getListClavesPermisos().add(pf.getFuncionSistema().getDescruta()); + } + } + } + } + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/UtiliteriasFiscal.java b/src/com/rjconsultores/ventaboletos/utilerias/UtiliteriasFiscal.java new file mode 100644 index 000000000..accb5eb6c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/UtiliteriasFiscal.java @@ -0,0 +1,285 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.text.NumberFormat; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; + +public class UtiliteriasFiscal { + + private static int DECIMALS = 2; + private static int ROUNDING_MODE = BigDecimal.ROUND_HALF_EVEN; + + public static final String DATE_FORMAT_FISCAL = "yyyyMMdd"; + public static final BigDecimal CEM = BigDecimal.valueOf(100); + public static final String QUEBRA_LINHA = "\r\n"; + + public static BigDecimal divideEFormata(BigDecimal valor) { + String vlrFormatado = StringHelper.divideEFormata(valor.toString()); + return new BigDecimal(vlrFormatado); + } + + public static String defineCodigoProduto(Integer idOrigemCorrida, Integer idDestinoCorrida, Integer idLinha) { + int tamanhoMaximo = 12; + + String codOrigem = Integer.toHexString(idOrigemCorrida); + String codDestino = Integer.toHexString(idDestinoCorrida); + String codLinha = Integer.toHexString(idLinha); + + codOrigem = codOrigem.toUpperCase() + StringUtils.repeat("X", 4 - codOrigem.length()); + codDestino = codDestino.toUpperCase() + StringUtils.repeat("X", 4 - codDestino.length()); + codLinha = codLinha.toUpperCase() + StringUtils.repeat("X", 3 - codLinha.length()); + + String codProduto = codOrigem + codDestino + codLinha + "-"; + + if (codProduto.length() > tamanhoMaximo) { + codProduto = codProduto.substring(1, tamanhoMaximo + 1); + } + + return codProduto; + } + + public static void main(String args[]) { + System.out.println(formataZeroDecimal(new BigDecimal("3870.00"), 2, 14)); + } + + public static String formataNumerico(final String valor, final int tamanho) { + return formataNumerico(valor, false, tamanho); + } + + public static String formataNumerico(final String valor, final boolean removeMascara, final int tamanho) { + String retorno = StringUtils.trim(valor); + + if (retorno == null) { + retorno = ""; + } + + if (removeMascara) { + retorno = retorno.replace("-", "").replace(".", "").replace("/", ""); + } + + retorno = retorno.replace(".", "").replace(",", ""); + + if (tamanho > 0) { + if (retorno.length() > tamanho) { + retorno = retorno.substring(retorno.length() - tamanho, retorno.length()); + } + + return StringUtils.leftPad(retorno, tamanho, "0"); + } + + return retorno; + } + + public static String formataZeroDecimal(final BigDecimal valor, final int tamanho) { + String valorFommat = valor == null ? "" : valor.toString(); + valorFommat = valorFommat.toString().replace(".", "").replace(",", ""); + valorFommat = formataNumerico(valorFommat, valorFommat.length()); + valorFommat = StringUtils.leftPad(valorFommat, (tamanho), "0"); + return valorFommat; + } + + public static String formataEspacosDecimalEsquerda(final BigDecimal valor, final int tamanho) { + String valorFommat = valor == null ? "" : valor.toString(); + valorFommat = valorFommat.toString().replace(".", "").replace(",", ""); + valorFommat = UtiliteriasFiscal.formataNumerico(valorFommat, valorFommat.length()); + valorFommat = StringUtils.leftPad(valorFommat, (tamanho), " "); + return valorFommat; + } + + public static String formataEspacosDecimalDireita(final BigDecimal valor, final int tamanho) { + String valorFommat = valor == null ? "" : valor.toString(); + valorFommat = valorFommat.toString().replace(".", "").replace(",", ""); + valorFommat = UtiliteriasFiscal.formataNumerico(valorFommat, valorFommat.length()); + valorFommat = StringUtils.rightPad(valorFommat, (tamanho), " "); + return valorFommat; + } + + public static BigDecimal arredondar(BigDecimal aNumber) { + return aNumber.setScale(DECIMALS, ROUNDING_MODE); + } + + public static String formataZeroDecimal(final BigDecimal valor, final int casasDecimais, final int tamanho) { + NumberFormat df = DecimalFormat.getInstance(); + df.setMinimumFractionDigits(casasDecimais); + df.setMaximumFractionDigits(casasDecimais); + + String valorFommat = valor == null ? "" : df.format(valor).replaceAll("[^0-9]", ""); + valorFommat = formataNumerico(valorFommat, tamanho); + return valorFommat; + } + + public static BigDecimal valorTotalItensECF(ImportacionFiscalVO item) { + BigDecimal valorTotal = BigDecimal.ZERO; + + BigDecimal valorPedagio = item.getValorPedagio() == null ? BigDecimal.ZERO : item.getValorPedagio(); + BigDecimal valorEmbarque = item.getValorEmbarque() == null ? BigDecimal.ZERO : item.getValorEmbarque(); + BigDecimal valorTarifa = item.getValorTarifa() == null ? BigDecimal.ZERO : item.getValorTarifa(); + BigDecimal valorSeguro = item.getValorSeguro() == null ? BigDecimal.ZERO : item.getValorSeguro(); + if (valorTarifa.equals(BigDecimal.ZERO)) + valorTarifa = BigDecimal.ONE.divide(CEM); + + valorTotal = valorTotal.add(valorTarifa).add(valorPedagio).add(valorEmbarque).add(valorSeguro); + + return valorTotal; + } + + public static String aberturaDeArquivo(String identificador, String data, String cnpjFilial, String brancos372, + String sequencial) { + + StringBuilder abertura = new StringBuilder(); + abertura.append(identificador); + abertura.append(data); + abertura.append(cnpjFilial); + abertura.append(brancos372); + abertura.append(sequencial); + + return abertura.toString(); + } + + public static String headerDocumentoFiscal(String identificador, String data, String cnpjImpressora, String coo, + String serie, String especie, String codigoCliente, String filialCliente, String condicaoPagamento, + String valorTotalDocumanto, String valorItens, String aliquota, String imposto, String valorPIS, + String valorCofins, String valorCSLL, String totalICMSIsento, String totalICMSNaotributado, String origenUf, + String origen, String destinoUf, String destino, String subSerie, String aidf, String status, + String motivocancelacion, String valorMulta, String brancos, String claseServicio, String sequencial) { + + StringBuilder header = new StringBuilder(); + header.append(identificador); + header.append(data); + header.append(cnpjImpressora); + header.append(coo); + header.append(serie); + header.append(especie); + header.append(codigoCliente); + header.append(filialCliente); + header.append(condicaoPagamento); + header.append(valorTotalDocumanto); + header.append(valorItens); + header.append(aliquota); + header.append(imposto); + header.append(valorPIS); + header.append(valorCofins); + header.append(valorCSLL); + header.append(totalICMSIsento); + header.append(totalICMSNaotributado); + header.append(origenUf); + header.append(origen); + header.append(destinoUf); + header.append(destino); + header.append(subSerie == null ? "" : subSerie); + header.append(aidf == null ? "" : aidf); + header.append(status); + header.append(motivocancelacion == null ? "" : motivocancelacion); + header.append(valorMulta == null ? "" : valorMulta); + header.append(brancos); + header.replace(226, 256, claseServicio); + + header.append(sequencial); + + return header.toString(); + } + + public static String itensDocumentoFiscal(String identificador, String numItem, String cfop, String codigoTES, + String codProduto, String unidade, String quantidade, String valorUnitario, String valorTotal, + String aliquotaItem, String impostoItem, String valorPIS, String aliquotaPIS, String aliquotaCofins, + String valorCofins, String aliquotaCSLL, String valorCSLL, String aliquotaISS, String valorISS, + String totalICMSIsentoItem, String totalICMSNaotributadoItem, String numeroPDV, String numeroSeriePDV, + String modeloImpressora, String numCaixa, String status, String coo, String serie, + String brancos, String sequencial) { + + StringBuilder item = new StringBuilder(); + item.append(identificador); + item.append(numItem); + item.append(cfop); + item.append(codigoTES); + item.append(codProduto); + item.append(unidade); + item.append(quantidade); + item.append(valorUnitario); + item.append(valorTotal); + item.append(aliquotaItem); + item.append(impostoItem); + item.append(aliquotaPIS); + item.append(valorPIS); + item.append(aliquotaCofins); + item.append(valorCofins); + item.append(aliquotaCSLL); + item.append(valorCSLL); + item.append(aliquotaISS); + item.append(valorISS); + item.append(totalICMSIsentoItem); + item.append(totalICMSNaotributadoItem); + item.append(numeroPDV == null ? "" : numeroPDV); + item.append(numeroSeriePDV == null ? "" : numeroSeriePDV); + item.append(modeloImpressora); + item.append(numCaixa); + item.append(status); + item.append(coo == null ? "" : coo); + item.append(serie == null ? "" : serie); + item.append(brancos); + item.append(sequencial); + + return item.toString(); + } + + public static String fechamentoDeArquivo(String identificador, String qtdeDocGerados, String qtdeItensDocGerados, + String brancos, String sequencial) { + + StringBuilder fechamento = new StringBuilder(); + fechamento.append(identificador); + fechamento.append(qtdeDocGerados == null ? "" : qtdeDocGerados); + fechamento.append(qtdeItensDocGerados == null ? "" : qtdeItensDocGerados); + fechamento.append(brancos); + fechamento.append(sequencial); + + return fechamento.toString(); + } + + public static String reducaoZ(String identificador, String dataMovimento, String cnpj, String numRelatorio, String numPDV, + String numSeriePDV, String numReducaoZ, String gtInicial, String gtFinal, String docFiscalInic, + String docFiscalFinal, String valorCancel, String valorContabil, String subtributaria, String descontos, + String isento, String naoTributado, String aliquota, String aliquota2, String aliquota3, String aliquota4, + String coo, String outrosRecebimentos, String impostoDebitado, String dataReducaoZ, String horaReducaoZ, + String valorDocFiscal, String cro, String status, String brancos, String sequencial) { + + StringBuilder reducaoZ = new StringBuilder(); + reducaoZ.append(identificador); + reducaoZ.append(dataMovimento); + reducaoZ.append(cnpj); + reducaoZ.append(numRelatorio); + reducaoZ.append(numPDV); + reducaoZ.append(numSeriePDV); + reducaoZ.append(numReducaoZ); + reducaoZ.append(gtInicial); + reducaoZ.append(gtFinal); + reducaoZ.append(docFiscalInic); + reducaoZ.append(docFiscalFinal); + reducaoZ.append(valorCancel); + reducaoZ.append(valorContabil); + reducaoZ.append(subtributaria); + reducaoZ.append(descontos); + reducaoZ.append(isento); + reducaoZ.append(naoTributado); + reducaoZ.append(aliquota); + reducaoZ.append(aliquota2); + reducaoZ.append(aliquota3); + reducaoZ.append(aliquota4); + reducaoZ.append(coo); + reducaoZ.append(outrosRecebimentos); + reducaoZ.append(impostoDebitado); + reducaoZ.append(dataReducaoZ); + reducaoZ.append(horaReducaoZ); + reducaoZ.append(valorDocFiscal); + reducaoZ.append(cro); + reducaoZ.append(status); + reducaoZ.append(brancos); + reducaoZ.append(sequencial); + + return reducaoZ.toString(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/ValidadorImportacaoEcf.java b/src/com/rjconsultores/ventaboletos/utilerias/ValidadorImportacaoEcf.java new file mode 100644 index 000000000..ada0962ed --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/ValidadorImportacaoEcf.java @@ -0,0 +1,63 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.math.BigDecimal; + +public class ValidadorImportacaoEcf { + + public static void main(String[] args) { + BufferedReader br; + int linha = 1; + + BigDecimal soma = BigDecimal.ZERO; + try { + br = new BufferedReader(new FileReader("c:\\Users\\rjgw\\Downloads\\fiscal_cancel_201604060542.txt")); + try { + // int linha = 1; + String line = br.readLine(); + Integer l1 = null; + Integer l2 = null; + try { + while (line != null) { + if (line.startsWith("1")) { + l1 = Integer.valueOf(line.substring(51, 65).trim()); + System.out.println("Linha: " + linha + " -- " + "Valor: " + l1); + soma = soma.add(new BigDecimal(l1).divide(new BigDecimal(100))); + l2 = 0; + } + if (line.startsWith("2")) { + l2 += Integer.valueOf(line.substring(47, 62).trim()); + } + line = br.readLine(); + if (line.startsWith("1") && l1 != null && l2 != null) { + if (l1.compareTo(l2) != 0) { + System.out.println("Linha: " + linha); + } + } + linha++; + } + } catch (NullPointerException e) { + } + + System.out.println("Soma: " + soma); + + } catch (IOException e) { + e.printStackTrace(); + } catch (Exception e) { + System.out.println("Linha: " + linha); + e.printStackTrace(); + } finally { + try { + br.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } catch (FileNotFoundException e) { + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/ZipUtil.java b/src/com/rjconsultores/ventaboletos/utilerias/ZipUtil.java new file mode 100644 index 000000000..179891112 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/ZipUtil.java @@ -0,0 +1,53 @@ +package com.rjconsultores.ventaboletos.utilerias; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +public class ZipUtil { + + public static void compactarArquivos(File arquivoDeSaida, File... arquivosEOuPastas) throws IOException { + if (arquivosEOuPastas != null && arquivoDeSaida != null) { + byte[] buf = new byte[1024]; + ZipOutputStream out = new ZipOutputStream(new FileOutputStream(arquivoDeSaida)); + + for (File f : arquivosEOuPastas) { + FileInputStream in = new FileInputStream(f.getPath()); + out.putNextEntry(new ZipEntry(f.getName())); + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + out.closeEntry(); + in.close(); + f.delete(); + } + out.close(); + } + } + + public static void compactarArquivos(File arquivoDeSaida, List arquivosEOuPastas) throws IOException { + if (arquivosEOuPastas != null && arquivoDeSaida != null) { + byte[] buf = new byte[1024]; + ZipOutputStream out = new ZipOutputStream(new FileOutputStream(arquivoDeSaida)); + + for (File f : arquivosEOuPastas) { + FileInputStream in = new FileInputStream(f.getPath()); + out.putNextEntry(new ZipEntry(f.getName())); + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + out.closeEntry(); + in.close(); + f.delete(); + } + out.close(); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECF.java b/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECF.java new file mode 100644 index 000000000..0be318f8a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECF.java @@ -0,0 +1,472 @@ +package com.rjconsultores.ventaboletos.utilerias.archivointegracion; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.StringHelper; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ItemFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.SiglaMotivoCancelacion; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria; + +public class ArchivoIntegracionECF { + + private static Logger log = Logger.getLogger(ArchivoIntegracionECF.class); + + public File importacionFiscalECFGenerico(Date inicio, Date fim, Empresa empresa, boolean isNormal, boolean isCancelados, boolean isPendencias, List list) { + + try { + String nomeArquivo = "fiscal_ecf_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + if (isCancelados) { + nomeArquivo = "fiscal_ecf_cancel_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + } else if (isPendencias) { + nomeArquivo = "fiscal_ecf_pendencias_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + } + + File arquivo = File.createTempFile(nomeArquivo, ".txt"); + + PrintWriter gravarArq = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivo), Constantes.UTF_8)); + + Integer seq = 1; + + String cnpjFilial = empresa.getCnpj(); + String brancos371 = StringHelper.preencherStringEspacoEsquerda(null, 371); + String dataAgora = DateUtil.getStringDate(Calendar.getInstance().getTime(), UtiliteriasFiscal.DATE_FORMAT_FISCAL); + String seqAbertura = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String abertura = UtiliteriasFiscal.aberturaDeArquivo("0", dataAgora, cnpjFilial, brancos371, seqAbertura); + gravarArq.print(abertura + UtiliteriasFiscal.QUEBRA_LINHA); + + Integer qtdDoc = 0; + Integer qtdItens = 0; + + String header = null; + List itensDocs = new ArrayList(); + + for (ImportacionFiscalVO item : list) { + + qtdDoc++; + header = null; + itensDocs = new ArrayList(); + + String data = item.getDataEmissao(); + String brancos = StringHelper.preencherStringEspacoEsquerda(null, 202); + String cnpjEcf = item.getCnpjEcf() == null ? cnpjFilial : item.getCnpjEcf(); + + String serie = item.getNumImpressora(); + if (serie.length() >= 20) { + serie = serie.substring(17); + serie = StringHelper.preencherStringEspacoEsquerda(serie, 3); + } else { + serie = StringHelper.preencherStringEspacoEsquerda(null, 3); + } + + String especie = StringHelper.preencherStringEspacoDireita("CF", 5); + + String codigoCliente = StringHelper.preencherStringEsquerda(null, 6, "9"); + String filialCliente = StringHelper.preencherStringEsquerda(null, 2, "9"); + String condicaoPagamento = StringHelper.preencherStringEsquerda(null, 3, "9"); + + String valorPIS = StringHelper.preencherZeroEsquerda("", 14); + String valorCofins = StringHelper.preencherZeroEsquerda("", 14); + String valorCSLL = StringHelper.preencherZeroEsquerda("", 14); + + String coo = StringHelper.preencherStringEspacoDireita(item.getCoo(), 9); + + BigDecimal valorTotal = UtiliteriasFiscal.arredondar(UtiliteriasFiscal.valorTotalItensECF(item)); + String valorTotalDocumanto = UtiliteriasFiscal.formataEspacosDecimalDireita(valorTotal, 14); + String valorItens = valorTotalDocumanto; + + HashMap aliquotaBaseCalculo = getAliquotaBaseCalculo(item); + String aliquota = aliquotaBaseCalculo.get("aliquota"); + String imposto = aliquotaBaseCalculo.get("imposto"); + String totalICMSIsento = aliquotaBaseCalculo.get("totalICMSIsento"); + String totalICMSNaotributado = aliquotaBaseCalculo.get("totalICMSNaotributado"); + + String origenUf = StringHelper.preencherStringEspacoEsquerda(item.getOrigenUf(), 2); + String origen = item.getOrigenId() == null ? StringUtils.EMPTY : item.getOrigenId().toString(); + if (origen.length() > 2) { + origen = origen.substring(2); + origen = StringHelper.preencherStringEspacoEsquerda(origen, 5); + } else { + origen = StringHelper.preencherStringEspacoEsquerda(origen, 5); + } + + String destinoUf = StringHelper.preencherStringEspacoEsquerda(item.getDestinoUf(), 2); + String destino = item.getDestinoId() == null ? StringUtils.EMPTY : item.getDestinoId().toString(); + if (destino.length() > 2) { + destino = destino.substring(2); + destino = StringHelper.preencherStringEspacoEsquerda(destino, 5); + } else { + destino = StringHelper.preencherStringEspacoEsquerda(destino, 5); + } + + String motivocancelacion = null; + String valorMulta = null; + if (isCancelados) { + SiglaMotivoCancelacion sigla = SiglaMotivoCancelacion.valueOf(item.getMotivocancelacion()); + motivocancelacion = StringHelper.preencherStringEspacoEsquerda(sigla.toString(), 20); + valorMulta = UtiliteriasFiscal.formataZeroDecimal(item.getValorMulta(), 15); + brancos = StringHelper.preencherStringEspacoEsquerda(null, 167); + } + + seq++; + String status = StringHelper.preencherStringEspacoEsquerda(item.getStatus(), 1); + String claseServicio = StringHelper.preencherStringEspacoDireita(item.getClaseServicio(), 30); + String seqHeader = StringHelper.preencherZeroEsquerda(Integer.valueOf(seq).toString(), 6); + + header = UtiliteriasFiscal.headerDocumentoFiscal("1", data, cnpjEcf, coo, serie, especie, codigoCliente, + filialCliente, condicaoPagamento, valorTotalDocumanto, valorItens, aliquota, imposto, + valorPIS, valorCofins, valorCSLL, totalICMSIsento, totalICMSNaotributado, origenUf, origen, + destinoUf, destino, null, null, status, motivocancelacion, valorMulta, brancos, claseServicio, seqHeader); + + /* + * Item da importacion Fiscal ECF + */ + int seqItem = 1; + for (ItemFiscalVO subItens : item.getItensFiscais()) { + String itemDoc = montarItensFiscais(subItens, seq++, seqItem); + itensDocs.add(itemDoc); + qtdItens++; + seqItem++; + } + + grabarHeaderItens(gravarArq, header, itensDocs); + + } + + seq++; + String qtdeDocGerados = StringHelper.preencherZeroEsquerda(qtdDoc.toString(), 6); + String qtdeItensDocGerados = StringHelper.preencherZeroEsquerda(qtdItens.toString(), 6); + String brancos381 = StringHelper.preencherStringEspacoEsquerda(null, 381); + String seqFechamento = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String fechamento = UtiliteriasFiscal.fechamentoDeArquivo("3", qtdeDocGerados, qtdeItensDocGerados, brancos381, seqFechamento); + gravarArq.print(fechamento + UtiliteriasFiscal.QUEBRA_LINHA); + + gravarArq.close(); + return arquivo; + + } catch (IOException e) { + log.error("", e); + } + + return null; + } + + private HashMap getAliquotaBaseCalculo(ImportacionFiscalVO fiscal) { + + HashMap resp = new HashMap(); + + String aliquota = null; + String imposto = null; + String totalICMSIsento = null; + String totalICMSNaotributado = null; + + for (ItemFiscalVO item : fiscal.getItensFiscais()) { + + BigDecimal valorItem = BigDecimal.ZERO; + String codProduto = StringHelper.preencherStringEspacoEsquerda(item.getCodProduto(), 15); + // VALIDA TARIFA + if (codProduto.indexOf("TA") >= 0) { + valorItem = item.getValorTarifa() == null ? valorItem : item.getValorTarifa(); + if (valorItem.equals(BigDecimal.ZERO)) + valorItem = BigDecimal.ONE; + + // TAXA DE EMBARQUE + } else if (codProduto.indexOf("TX") >= 0) { + valorItem = item.getValorEmbarque() == null ? valorItem : item.getValorEmbarque(); + + // PEDAGIO + } else if (codProduto.indexOf("PE") >= 0) { + valorItem = item.getValorPedagio() == null ? valorItem : item.getValorPedagio(); + + // SEGURO + } else if (codProduto.indexOf("SE") >= 0) { + valorItem = item.getValorSeguro() == null ? valorItem : item.getValorSeguro(); + } + + try { + valorItem = UtiliteriasFiscal.arredondar(valorItem); + item.setValorItem(new BigDecimal(UtiliteriasFiscal.formataZeroDecimal(valorItem, 15))); + } catch (Exception e) { + log.error("ERROR: " + item.toString(), e); + item.setValorItem(new BigDecimal(UtiliteriasFiscal.formataZeroDecimal(BigDecimal.ZERO, 15))); + } + + HashMap aliquotaBaseCalculo = new HashMap(0); + + // Verificando se é um produto tributável. Formato: XXTYYYY (XX - Posicao / YYYY - Aliquota) + String repTributado = item.getRepTributado() == null ? SituacaoTributaria.NAO_TRIBUTADO.getValue() : item.getRepTributado(); + if (repTributado.length() == 7 && repTributado.substring(2, 3).equals(SituacaoTributaria.TRIBUTADO.getValue())) { + + String tipoPassagem = item.getTipoPassagem(); + + if (tipoPassagem == null) { + tipoPassagem = "E"; + } + + String key = tipoPassagem + item.getRepTributado().substring(3, 7); + + if (!aliquotaBaseCalculo.containsKey(key)) { + aliquotaBaseCalculo.put(key, BigDecimal.ZERO); + } + + BigDecimal soma = item.getValorItem().divide(BigDecimal.TEN.multiply(BigDecimal.TEN)); + aliquotaBaseCalculo.put(key, soma.add(aliquotaBaseCalculo.get(key))); + + } else if (repTributado.equals(SituacaoTributaria.NAO_TRIBUTADO.getValue())) { + + BigDecimal soma = item.getValorItem(); + totalICMSNaotributado = soma.toString(); + + if (totalICMSNaotributado.length() < 14) { + totalICMSNaotributado = StringHelper.preencherZeroEsquerda(totalICMSNaotributado, 14); + } + + } + + for (String key : aliquotaBaseCalculo.keySet()) { + aliquota = key.substring(1, 5); + + BigDecimal aliquotaCalc = BigDecimal.valueOf(Double.valueOf(aliquota) / UtiliteriasFiscal.CEM.doubleValue()); + aliquotaCalc = UtiliteriasFiscal.arredondar(aliquotaCalc); + + BigDecimal baseCalculo = aliquotaBaseCalculo.get(key); + baseCalculo = UtiliteriasFiscal.arredondar(baseCalculo); + + BigDecimal valorImposto = baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM)); + valorImposto = UtiliteriasFiscal.arredondar(valorImposto); + + imposto = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 14); + aliquota = UtiliteriasFiscal.formataZeroDecimal(aliquotaCalc, 14); + } + + boolean inconsistente = item.getInconsistencia() == null ? false : item.getInconsistencia(); + if (inconsistente) { + if (codProduto.indexOf("TA") >= 0) { + BigDecimal aliquotaCalc = item.getImpostoEstado() == null ? BigDecimal.ZERO : item.getImpostoEstado(); + aliquotaCalc = UtiliteriasFiscal.arredondar(aliquotaCalc); + + BigDecimal baseCalculo = valorItem; + baseCalculo = UtiliteriasFiscal.arredondar(baseCalculo); + + BigDecimal valorImposto = baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM)); + valorImposto = UtiliteriasFiscal.arredondar(valorImposto); + + imposto = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 14); + aliquota = UtiliteriasFiscal.formataZeroDecimal(aliquotaCalc, 14); + totalICMSIsento = null; + totalICMSNaotributado = null; + } + } + + } + if (StringUtils.isBlank(aliquota)) + aliquota = StringHelper.preencherZeroEsquerda("", 14); + + if (StringUtils.isBlank(imposto)) + imposto = StringHelper.preencherZeroEsquerda("", 14); + + if (StringUtils.isBlank(totalICMSIsento)) + totalICMSIsento = StringHelper.preencherZeroEsquerda("", 14); + + if (StringUtils.isBlank(totalICMSNaotributado)) + totalICMSNaotributado = StringHelper.preencherZeroEsquerda("", 14); + + resp.put("aliquota", aliquota); + resp.put("imposto", imposto); + resp.put("totalICMSIsento", totalICMSIsento); + resp.put("totalICMSNaotributado", totalICMSNaotributado); + + return resp; + } + + private String montarItensFiscais(ItemFiscalVO item, Integer seq, Integer seqItem) { + + String tipoPassagem = null; + + String repTributado = item.getRepTributado() == null ? SituacaoTributaria.NAO_TRIBUTADO.getValue() : item.getRepTributado(); + if (repTributado.length() == 7 && repTributado.substring(2, 3).equals(SituacaoTributaria.TRIBUTADO.getValue())) { + tipoPassagem = item.getTipoPassagem(); + + if (tipoPassagem == null) + tipoPassagem = "E"; + + } else { + tipoPassagem = "E"; + } + + String numItem = StringHelper.preencherZeroEsquerda(seqItem.toString(), 3); + + String cfop = null; + if (tipoPassagem.equals("E")) { + cfop = StringHelper.preencherStringEspacoDireita("6357", 5); + } else if (tipoPassagem.equals("M")) { + cfop = StringHelper.preencherStringEspacoDireita("5357", 5); + } + + String codigoTES = StringHelper.preencherStringEsquerda(null, 3, "9"); + String codProduto = StringHelper.preencherStringEspacoEsquerda(item.getCodProduto(), 15); + String unidade = "UN"; + String quantidade = "001"; + + // TODO: A forma de enviar o valor do item é baseada no codProduto, pelo fato da FISCAL_R5 estar gravando os registros de tarifa errado + BigDecimal valorItem = BigDecimal.ZERO; + // VALIDA TARIFA + if (codProduto.indexOf("TA") >= 0) { + valorItem = item.getValorTarifa() == null ? valorItem : item.getValorTarifa(); + if (valorItem.equals(BigDecimal.ZERO)) + valorItem = BigDecimal.ONE.divide(UtiliteriasFiscal.CEM); + + // TAXA DE EMBARQUE + } else if (codProduto.indexOf("TX") >= 0) { + valorItem = item.getValorEmbarque() == null ? valorItem : item.getValorEmbarque(); + + // PEDAGIO + } else if (codProduto.indexOf("PE") >= 0) { + valorItem = item.getValorPedagio() == null ? valorItem : item.getValorPedagio(); + + // SEGURO + } else if (codProduto.indexOf("SE") >= 0) { + valorItem = item.getValorSeguro() == null ? valorItem : item.getValorSeguro(); + } + + String valorUnitario = null; + try { + valorItem = UtiliteriasFiscal.arredondar(valorItem); + valorUnitario = UtiliteriasFiscal.formataZeroDecimal(valorItem, 15); + item.setValorItem(new BigDecimal(valorUnitario)); + } catch (Exception e) { + log.error("ERROR: " + item.toString(), e); + valorUnitario = UtiliteriasFiscal.formataZeroDecimal(BigDecimal.ZERO, 15); + item.setValorItem(new BigDecimal(valorUnitario)); + } + + String valorTotal = valorUnitario; + String aliquotaItem = StringHelper.preencherZeroEsquerda("", 7); + String impostoItem = StringHelper.preencherZeroEsquerda("", 15); + String totalICMSIsentoItem = StringHelper.preencherZeroEsquerda("", 15); + String totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda("", 15); + + HashMap aliquotaItens = new HashMap(0); + + // Verificando se é um produto tributável. Formato: XXTYYYY (XX - Posicao / YYYY - Aliquota) + if (repTributado.length() == 7 && repTributado.substring(2, 3).equals(SituacaoTributaria.TRIBUTADO.getValue())) { + + String key = tipoPassagem + item.getRepTributado().substring(3, 7); + + if (!aliquotaItens.containsKey(key)) { + aliquotaItens.put(key, BigDecimal.ZERO); + } + + BigDecimal soma = item.getValorItem().divide(BigDecimal.TEN.multiply(BigDecimal.TEN)); + aliquotaItens.put(key, soma.add(aliquotaItens.get(key))); + + } else if (repTributado.equals(SituacaoTributaria.NAO_TRIBUTADO.getValue())) { + + BigDecimal soma = item.getValorItem(); + totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda(soma.toString(), 15); + } + + for (String key : aliquotaItens.keySet()) { + aliquotaItem = key.substring(1, 5); + + BigDecimal aliquotaCalc = BigDecimal.valueOf(Double.valueOf(aliquotaItem) / UtiliteriasFiscal.CEM.doubleValue()); + aliquotaCalc = UtiliteriasFiscal.arredondar(aliquotaCalc); + + BigDecimal baseCalculo = aliquotaItens.get(key); + baseCalculo = UtiliteriasFiscal.arredondar(baseCalculo); + + BigDecimal valorImposto = baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM)); + valorImposto = UtiliteriasFiscal.arredondar(valorImposto); + + impostoItem = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 15); + aliquotaItem = UtiliteriasFiscal.formataZeroDecimal(null, 7); + } + + boolean inconsistente = item.getInconsistencia() == null ? false : item.getInconsistencia(); + if (inconsistente) { + if (codProduto.indexOf("TA") >= 0) { + BigDecimal aliquotaCalc = item.getImpostoEstado() == null ? BigDecimal.ZERO : item.getImpostoEstado(); + aliquotaCalc = UtiliteriasFiscal.arredondar(aliquotaCalc); + + BigDecimal baseCalculo = valorItem; + baseCalculo = UtiliteriasFiscal.arredondar(baseCalculo); + + BigDecimal valorImposto = baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM)); + valorImposto = UtiliteriasFiscal.arredondar(valorImposto); + + impostoItem = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 15); + aliquotaItem = UtiliteriasFiscal.formataZeroDecimal(null, 7); + totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda("", 15); + } + } + + String aliquotaPIS = StringHelper.preencherZeroEsquerda("", 7); + String valorPIS = StringHelper.preencherZeroEsquerda("", 15); + String aliquotaCofins = StringHelper.preencherZeroEsquerda("", 7); + String valorCofins = StringHelper.preencherZeroEsquerda("", 15); + String aliquotaCSLL = StringHelper.preencherZeroEsquerda("", 7); + String valorCSLL = StringHelper.preencherZeroEsquerda("", 15); + String aliquotaISS = StringHelper.preencherZeroEsquerda("", 7); + String valorISS = StringHelper.preencherZeroEsquerda("", 15); + + String numeroPDV = StringHelper.preencherStringEspacoDireita(item.getNumpdv(), 10); + String numeroSeriePDV = StringHelper.preencherStringEspacoDireita(item.getNumImpressora(), 20); + String modeloImpressora = StringHelper.preencherStringEspacoDireita(item.getModeloImpressora(), 40); + String numCaixa = StringHelper.preencherStringEspacoDireita(item.getNumCaixa(), 10); + String status = StringHelper.preencherStringEspacoEsquerda(item.getStatus(), 1); + + String coo = null; + String serie = null; + + coo = StringHelper.preencherStringEspacoDireita(item.getCoo(), 9); + serie = item.getNumImpressora(); + if (serie.length() >= 20) { + serie = serie.substring(17); + serie = StringHelper.preencherStringEspacoEsquerda(serie, 3); + } else { + serie = StringHelper.preencherStringEspacoEsquerda(null, 3); + } + + String brancos99 = StringHelper.preencherStringEspacoEsquerda(null, 99); + + seq++; + String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String itemDoc = UtiliteriasFiscal.itensDocumentoFiscal("2", numItem, cfop, codigoTES, codProduto, + unidade, quantidade, valorUnitario, valorTotal, aliquotaItem, impostoItem, + aliquotaPIS, valorPIS, aliquotaCofins, valorCofins, aliquotaCSLL, valorCSLL, + aliquotaISS, valorISS, totalICMSIsentoItem, totalICMSNaotributadoItem, + numeroPDV, numeroSeriePDV, modeloImpressora, numCaixa, status, coo, serie, + brancos99, sequencial); + return itemDoc; + + } + + private void grabarHeaderItens(PrintWriter gravarArq, String header, List itensDocs) { + gravarArq.print(header + UtiliteriasFiscal.QUEBRA_LINHA); + + for (String doc : itensDocs) { + gravarArq.print(doc + UtiliteriasFiscal.QUEBRA_LINHA); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFManual.java b/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFManual.java new file mode 100644 index 000000000..937e43d57 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFManual.java @@ -0,0 +1,260 @@ +package com.rjconsultores.ventaboletos.utilerias.archivointegracion; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.StringHelper; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionManualFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.SubItens; + +public class ArchivoIntegracionECFManual { + + private static Logger log = Logger.getLogger(ArchivoIntegracionECFManual.class); + + public File importacionFiscalECFManual(Date inicio, Date fim, Empresa empresa, List listManual) { + + try { + String nomeArquivo = "fiscal_ecf_manual_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + File arquivo = File.createTempFile(nomeArquivo, ".txt"); + + PrintWriter gravarArq = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivo), Constantes.UTF_8)); + + Integer seq = 1; + + String cnpjFilial = empresa.getCnpj(); + String brancos371 = StringHelper.preencherStringEspacoEsquerda(null, 371); + String dataAgora = DateUtil.getStringDate(Calendar.getInstance().getTime(), UtiliteriasFiscal.DATE_FORMAT_FISCAL); + String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String abertura = UtiliteriasFiscal.aberturaDeArquivo("0", dataAgora, cnpjFilial, brancos371, sequencial); + gravarArq.print(abertura + UtiliteriasFiscal.QUEBRA_LINHA); + + Integer qtdDoc = 0; + Integer qtdItens = 0; + + inicio = DateUtil.inicioFecha(inicio); + fim = DateUtil.fimFecha(fim); + + List list = agruparItensFiscaisManual(listManual); + for (ImportacionManualFiscalVO imf : list) { + + qtdDoc++; + + String data = imf.getDataEmissao(); + + String coo = StringHelper.preencherZeroEsquerda(imf.getCoo(), 9); + String serie = StringHelper.preencherStringEspacoEsquerda(imf.getSerie(), 3); + String especie = StringHelper.preencherStringEspacoDireita("RMD", 5); + + String codigoCliente = StringHelper.preencherStringEsquerda(null, 6, "9"); + String filialCliente = StringHelper.preencherStringEsquerda(null, 2, "9"); + String condicaoPagamento = StringHelper.preencherStringEsquerda(null, 3, "9"); + + BigDecimal valorTotal = UtiliteriasFiscal.arredondar(calculaValorTotalECFManual(imf)); + String valorTotalDocumanto = UtiliteriasFiscal.formataEspacosDecimalDireita(valorTotal, 14); + String valorItens = valorTotalDocumanto; + + BigDecimal valorICMS = imf.getIcms() == null ? BigDecimal.ZERO : UtiliteriasFiscal.arredondar(imf.getIcms()); + String baseCalICMS = UtiliteriasFiscal.formataZeroDecimal(valorICMS, 14); + + BigDecimal aliquotaCalc = imf.getIcms() == null ? BigDecimal.ZERO : UtiliteriasFiscal.arredondar(imf.getIcms()); + BigDecimal baseCalculo = UtiliteriasFiscal.arredondar(imf.getValorTotal()); + BigDecimal valorImposto = UtiliteriasFiscal.arredondar(baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM))); + String valorTotalICMS = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 14); + + String valorPIS = StringHelper.preencherZeroEsquerda("", 14); + String valorCofins = StringHelper.preencherZeroEsquerda("", 14); + String valorCSLL = StringHelper.preencherZeroEsquerda("", 14); + String totalICMSIsento = StringHelper.preencherZeroEsquerda("", 14); + String totalICMSNaotributado = StringHelper.preencherZeroEsquerda("", 14); + + String origenUf = StringHelper.preencherStringEspacoEsquerda(imf.getOrigenUf(), 2); + String origen = imf.getOrigenId().toString(); + if (origen.length() > 2) { + origen = origen.substring(2); + origen = StringHelper.preencherStringEspacoEsquerda(origen, 5); + } else { + origen = StringHelper.preencherStringEspacoEsquerda(origen, 5); + } + + String destinoUf = StringHelper.preencherStringEspacoEsquerda(imf.getDestinoUf(), 2); + String destino = imf.getDestinoId().toString(); + if (destino.length() > 2) { + destino = destino.substring(2); + destino = StringHelper.preencherStringEspacoEsquerda(destino, 5); + } else { + destino = StringHelper.preencherStringEspacoEsquerda(destino, 5); + } + + String subSerie = StringHelper.preencherStringEspacoEsquerda(imf.getSubSerie(), 2); + String aidf = StringHelper.preencherStringEspacoEsquerda(imf.getAidf(), 30); + String status = StringHelper.preencherStringEspacoEsquerda(imf.getStatus(), 1); + String claseServicio = StringHelper.preencherStringEspacoDireita(imf.getClaseServicio(), 30); + String brancos170 = StringHelper.preencherStringEspacoEsquerda(null, 170); + + seq++; + sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String header = UtiliteriasFiscal.headerDocumentoFiscal("1", data, cnpjFilial, coo, serie, especie, codigoCliente, + filialCliente, condicaoPagamento, valorTotalDocumanto, valorItens, baseCalICMS, valorTotalICMS, + valorPIS, valorCofins, valorCSLL, totalICMSIsento, totalICMSNaotributado, origenUf, origen, + destinoUf, destino, subSerie, + aidf, status, null, null, brancos170, claseServicio, sequencial); + gravarArq.print(header + UtiliteriasFiscal.QUEBRA_LINHA); + + for (String itemDoc : montarItensFiscaisManual(imf, imf.getSubItens(), seq)) { + + qtdItens++; + gravarArq.print(itemDoc + UtiliteriasFiscal.QUEBRA_LINHA); + seq++; + } + } + + seq++; + + String qtdeDocGerados = StringHelper.preencherZeroEsquerda(qtdDoc.toString(), 6); + String qtdeItensDocGerados = StringHelper.preencherZeroEsquerda(qtdItens.toString(), 6); + String brancos381 = StringHelper.preencherStringEspacoEsquerda(null, 381); + sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String fechamento = UtiliteriasFiscal.fechamentoDeArquivo("3", qtdeDocGerados, qtdeItensDocGerados, brancos381, sequencial); + gravarArq.print(fechamento + UtiliteriasFiscal.QUEBRA_LINHA); + + gravarArq.close(); + return arquivo; + + } catch (IOException e) { + log.error("", e); + } + + return null; + } + + private BigDecimal calculaValorTotalECFManual(ImportacionManualFiscalVO imf) { + BigDecimal valorTotal = BigDecimal.ZERO; + valorTotal = valorTotal.add(imf.getValorTotal()); + valorTotal = valorTotal.add(imf.getImporteoutros() == null ? BigDecimal.ZERO : imf.getImporteoutros()); + valorTotal = valorTotal.add(imf.getImportepedagio() == null ? BigDecimal.ZERO : imf.getImportepedagio()); + valorTotal = valorTotal.add(imf.getImporteseguro() == null ? BigDecimal.ZERO : imf.getImporteseguro()); + valorTotal = valorTotal.add(imf.getImportetaxaembarque() == null ? BigDecimal.ZERO : imf.getImportetaxaembarque()); + return valorTotal; + } + + private List montarItensFiscaisManual(ImportacionManualFiscalVO imf, List itensFiscais, Integer seq) { + + List itensDocs = new ArrayList(); + Integer num = 0; + + for (SubItens item : itensFiscais) { + + num++; + String numItem = StringHelper.preencherZeroEsquerda(num.toString(), 3); + + String cfop = null; + if (imf.getEstadoIdOrigen() != imf.getEstadoIdDestino()) { + cfop = StringHelper.preencherStringEspacoDireita("6357", 5); + } else { + cfop = StringHelper.preencherStringEspacoDireita("5357", 5); + } + + String codigoTES = StringHelper.preencherStringEsquerda(null, 3, "9"); + String prod = imf.getCodProduto() == null ? item.getCodProduto() : imf.getCodProduto(); + String codProduto = StringHelper.preencherStringEspacoEsquerda(prod, 15); + + String unidade = "UN"; + String quantidade = "001"; + + BigDecimal valorItem = UtiliteriasFiscal.arredondar(item.getValor()); + String valorUnitario = UtiliteriasFiscal.formataZeroDecimal(valorItem, 15); + String valorTotal = UtiliteriasFiscal.formataZeroDecimal(valorItem, 15); + + String aliquotaItem = UtiliteriasFiscal.formataZeroDecimal(null, 7); + String impostoItem = UtiliteriasFiscal.formataZeroDecimal(null, 15); + String totalICMSIsentoItem = StringHelper.preencherZeroEsquerda("", 15); + String totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda("", 15); + + if (codProduto.indexOf("TA") >= 0) { + BigDecimal aliquotaCalc = UtiliteriasFiscal.arredondar(imf.getIcms() == null ? BigDecimal.ZERO : imf.getIcms()); + BigDecimal baseCalculo = UtiliteriasFiscal.arredondar(imf.getValorTotal() == null ? BigDecimal.ZERO : imf.getValorTotal()); + BigDecimal valorImposto = UtiliteriasFiscal.arredondar(baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM))); + impostoItem = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 15); + } else { + totalICMSNaotributadoItem = StringHelper.preencherZeroEsquerda(valorTotal, 15); + } + + String aliquotaPIS = StringHelper.preencherZeroEsquerda("", 7); + String valorPIS = StringHelper.preencherZeroEsquerda("", 15); + String aliquotaCofins = StringHelper.preencherZeroEsquerda("", 7); + String valorCofins = StringHelper.preencherZeroEsquerda("", 15); + String aliquotaCSLL = StringHelper.preencherZeroEsquerda("", 7); + String valorCSLL = StringHelper.preencherZeroEsquerda("", 15); + String aliquotaISS = StringHelper.preencherZeroEsquerda("", 7); + String valorISS = StringHelper.preencherZeroEsquerda("", 15); + + String numeroPDV = StringHelper.preencherStringEspacoDireita(imf.getNumpdv(), 10); + String numeroSeriePDV = StringHelper.preencherStringEspacoDireita(imf.getNumImpressora(), 20); + String modeloImpressora = StringHelper.preencherStringEspacoDireita(imf.getModeloImpressora(), 40); + String numCaixa = StringHelper.preencherStringEspacoDireita(imf.getNumCaixa(), 10); + String status = StringHelper.preencherStringEspacoEsquerda(imf.getStatus(), 1); + + seq++; + String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + String brancos111 = StringHelper.preencherStringEspacoDireita(null, 111); + + String itemDoc = UtiliteriasFiscal.itensDocumentoFiscal("2", numItem, cfop, codigoTES, codProduto, + unidade, quantidade, valorUnitario, valorTotal, aliquotaItem, impostoItem, + aliquotaPIS, valorPIS, aliquotaCofins, valorCofins, aliquotaCSLL, valorCSLL, + aliquotaISS, valorISS, totalICMSIsentoItem, totalICMSNaotributadoItem, + numeroPDV, numeroSeriePDV, modeloImpressora, numCaixa, status, null, null, + brancos111, sequencial); + itensDocs.add(itemDoc); + } + + return itensDocs; + } + + private List agruparItensFiscaisManual(List list) { + + List aux = new ArrayList(); + + for (ImportacionManualFiscalVO imf : list) { + + List itens = new ArrayList(); + if (imf.getImportepedagio() != null) { + itens.add(new SubItens(imf.getImportepedagio(), "00000000000-PE")); + } + + if (imf.getImporteseguro() != null) { + if (imf.getImporteseguro().signum() > BigDecimal.ZERO.intValue()) + itens.add(new SubItens(imf.getImporteseguro(), "00000000000-SE")); + } + + if (imf.getImportetaxaembarque() != null) { + itens.add(new SubItens(imf.getImportetaxaembarque(), "00000000000-TX")); + } + + if (imf.getValorTotal() != null) { + itens.add(new SubItens(imf.getValorTotal(), "00000000000-TA")); + } + + imf.setSubItens(itens); + aux.add(imf); + } + + return aux; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFReducaoZ.java b/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFReducaoZ.java new file mode 100644 index 000000000..9bca0d5c6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionECFReducaoZ.java @@ -0,0 +1,221 @@ +package com.rjconsultores.ventaboletos.utilerias.archivointegracion; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.AgpImpressoraEcfVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.AgpImpressoraReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.TipoPendencia; + +public class ArchivoIntegracionECFReducaoZ { + + private List listAgpEcf; + private List listAgpRedZ; + + private List listEcfValidos; + private List listRedZValidos; + + private List listEcfInvalidos; + private List listRedZInvalidos; + + public ArchivoIntegracionECFReducaoZ() { + listAgpEcf = new ArrayList(); + listAgpRedZ = new ArrayList(); + + listEcfValidos = new ArrayList(); + listRedZValidos = new ArrayList(); + + listEcfInvalidos = new ArrayList(); + listRedZInvalidos = new ArrayList(); + } + + public void importacionFiscalECFValidaReducaoZ(List listEcf, List listRedZ) { + + listAgpEcf = agruparEcf(listEcf); + listAgpRedZ = agruparReducaoZ(listRedZ); + + for (AgpImpressoraReducaoZVO agpRedZ : listAgpRedZ) { + + AgpImpressoraEcfVO agpEcf = buscaRegistroEcf(agpRedZ.getNumserie20(), agpRedZ.getDatamov()); + if (agpEcf == null) { + + for (ImportacionFiscalReducaoZVO reZ : agpRedZ.getItens()) { + reZ.setInconsistente(true); + listRedZInvalidos.add(reZ); + } + continue; + } + + BigDecimal valorEcf = BigDecimal.ZERO; + for (ImportacionFiscalVO ecf : agpEcf.getItens()) { + BigDecimal valorBoleto = UtiliteriasFiscal.arredondar(UtiliteriasFiscal.valorTotalItensECF(ecf)); + valorEcf = valorEcf.add(valorBoleto); + } + + String valorFormatado = UtiliteriasFiscal.formataZeroDecimal(valorEcf, 0); + valorEcf = new BigDecimal(valorFormatado); + + BigDecimal valorRedZ = agpRedZ.getItens().get(0).getVendabrutadiaria(); + for (ImportacionFiscalReducaoZVO reZ : agpRedZ.getItens()) { + + String tipoMovimento = reZ.getAliquota(); + if (tipoMovimento.equals(SituacaoTributaria.CANCELADO.getValue()) || + tipoMovimento.equals(SituacaoTributaria.DESCONTO.getValue())) { + BigDecimal valorTrib = reZ.getImposto(); + valorRedZ = valorRedZ.subtract(valorTrib); + } + } + + if (valorRedZ.compareTo(valorEcf) == 0) { + for (ImportacionFiscalVO ecf : agpEcf.getItens()) { + listEcfValidos.add(ecf); + } + + for (ImportacionFiscalReducaoZVO reZ : agpRedZ.getItens()) { + listRedZValidos.add(reZ); + } + + } else { + + if (valorRedZ.compareTo(valorEcf) > 0) { + + for (ImportacionFiscalVO ecf : agpEcf.getItens()) { + listEcfValidos.add(ecf); + } + + BigDecimal dif = valorRedZ.subtract(valorEcf); + for (ImportacionFiscalReducaoZVO reZv : agpRedZ.getItens()) { + BigDecimal vendabrutadiaria = reZv.getVendabrutadiaria().subtract(dif); + reZv.setVendabrutadiaria(vendabrutadiaria); + listRedZValidos.add(reZv); + } + + ImportacionFiscalReducaoZVO reZ = new ImportacionFiscalReducaoZVO(agpRedZ.getItens().get(0)); + reZ.setStatus(TipoPendencia.DIF_RED_Z.toString()); + reZ.setAliquota("01"); + reZ.setImposto(dif); + reZ.setVendabrutadiaria(dif); + reZ.setInconsistente(true); + + listRedZInvalidos.add(reZ); + + } else if (valorRedZ.compareTo(valorEcf) < 0) { + + for (ImportacionFiscalVO ecf : agpEcf.getItens()) { + listEcfValidos.add(ecf); + } + + BigDecimal dif = valorEcf.subtract(valorRedZ); + for (ImportacionFiscalReducaoZVO reZv : agpRedZ.getItens()) { + BigDecimal vendabrutadiaria = reZv.getVendabrutadiaria().add(dif); + reZv.setVendabrutadiaria(vendabrutadiaria); + listRedZValidos.add(reZv); + } + + ImportacionFiscalReducaoZVO reZ = new ImportacionFiscalReducaoZVO(agpRedZ.getItens().get(0)); + reZ.setStatus(TipoPendencia.DIF_ECF.toString()); + reZ.setAliquota("01"); + reZ.setImposto(dif); + reZ.setVendabrutadiaria(dif); + reZ.setInconsistente(true); + listRedZInvalidos.add(reZ); + } + } + } + } + + private AgpImpressoraEcfVO buscaRegistroEcf(String numserie20, String datamov) { + try { + int index = listAgpEcf.indexOf(new AgpImpressoraEcfVO(numserie20, datamov)); + return listAgpEcf.get(index); + } catch (ArrayIndexOutOfBoundsException e) { + } + return null; + } + + private List agruparReducaoZ(List list) { + + List agps = new ArrayList(); + + AgpImpressoraReducaoZVO atual = null; + for (ImportacionFiscalReducaoZVO redz : list) { + AgpImpressoraReducaoZVO novo = new AgpImpressoraReducaoZVO(redz.getNumserie20(), redz.getDatamov()); + + if (atual == null) { + atual = novo; + atual.getItens().add(redz); + + } else if (atual.equals(novo)) { + atual.getItens().add(redz); + + } else { + agps.add(atual); + atual = novo; + atual.getItens().add(redz); + } + } + + if (atual != null) + agps.add(atual); + + return agps; + } + + private List agruparEcf(List list) { + + List agps = new ArrayList(); + + AgpImpressoraEcfVO atual = null; + for (ImportacionFiscalVO ecf : list) { + AgpImpressoraEcfVO novo = new AgpImpressoraEcfVO(ecf.getNumImpressora(), ecf.getDataEmissao()); + + if (atual == null) { + atual = novo; + atual.getItens().add(ecf); + + } else if (atual.equals(novo)) { + atual.getItens().add(ecf); + + } else { + agps.add(atual); + atual = novo; + atual.getItens().add(ecf); + } + } + + if (atual != null) + agps.add(atual); + + return agps; + } + + public List getListAgpEcf() { + return listAgpEcf; + } + + public List getListAgpRedZ() { + return listAgpRedZ; + } + + public List getListEcfValidos() { + return listEcfValidos; + } + + public List getListRedZValidos() { + return listRedZValidos; + } + + public List getListEcfInvalidos() { + return listEcfInvalidos; + } + + public List getListRedZInvalidos() { + return listRedZInvalidos; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionNaoFiscal.java b/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionNaoFiscal.java new file mode 100644 index 000000000..57c669d1e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionNaoFiscal.java @@ -0,0 +1,94 @@ +package com.rjconsultores.ventaboletos.utilerias.archivointegracion; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.util.Calendar; +import java.util.List; + +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.exception.BusinessException; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.StringHelper; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionNaoFiscalVO; + +public class ArchivoIntegracionNaoFiscal { + + private static Logger log = Logger.getLogger(ArchivoIntegracionNaoFiscal.class); + + private String cnpjFilial; + private Integer sequencial = 0; + + private List importacionNaoFiscalVOs; + + private StringBuilder getAberturaArquivo() { + StringBuilder aberturaArquivo = new StringBuilder(); + aberturaArquivo.append("0") //Identificador Registro = "0" + .append(DateUtil.getStringCurrentDate("yyyyMMdd")) //Data geração arquivo + .append(StringHelper.preencherStringEspacoEsquerda(cnpjFilial.replace("[^0-9]", ""), 14)) //Cnpj filial + .append(StringHelper.preencherStringEspacoEsquerda(null, 371)) //Brancos + .append(StringHelper.preencherZeroEsquerda((++sequencial).toString(), 6)) //Sequencial + .append(StringHelper.QUEBRA_LINHA); + return aberturaArquivo; + } + + private StringBuilder getHeaderArquivo() { + StringBuilder headerArquivo = new StringBuilder(); + for (ImportacionNaoFiscalVO importacionNaoFiscalVO : importacionNaoFiscalVOs) { + headerArquivo.append("1") //Identificador Registro = "1" + .append(DateUtil.getStringDate(importacionNaoFiscalVO.getFechorvta(),"yyyyMMdd")) //Data emissão documento + .append(StringHelper.preencherStringEspacoEsquerda(cnpjFilial.replace("[^0-9]", ""), 14)) //Cnpj filial + .append(StringHelper.preencherStringEspacoEsquerda(importacionNaoFiscalVO.getNumeroDocumento(), 9)) //Numero do Documento + .append(StringHelper.preencherStringEspacoEsquerda(null, 3)) //Série + .append(StringHelper.preencherStringEspacoEsquerda("SVP", 5)) //Prefixo = "SVP" + .append(StringHelper.preencherStringEsquerda(null, 6, "9")) //Codigo Cliente "999999" + .append(StringHelper.preencherStringEsquerda(null, 2, "9")) //Filial cliente="99" + .append(StringHelper.preencherStringEsquerda(null, 3, "9")) //Condição pagamento = "999" + .append(UtiliteriasFiscal.formataZeroDecimal(importacionNaoFiscalVO.getTotal(), 2, 14)) //Valor Total documento + .append(StringHelper.preencherStringEspacoEsquerda("REC", 3)) //Tipo = "REC" + .append(StringHelper.preencherStringEspacoEsquerda(importacionNaoFiscalVO.getTipoeventoextraId()+"", 10)) //Natureza + .append(StringHelper.preencherStringEspacoEsquerda(null, 316)) //Brancos + .append(StringHelper.preencherZeroEsquerda((++sequencial).toString(), 6)) //Sequencial + .append(StringHelper.QUEBRA_LINHA); + } + return headerArquivo; + } + + private StringBuilder getFechamentoArquivo() { + StringBuilder fechamentoArquivo = new StringBuilder(); + fechamentoArquivo.append("3") //Identificador Registro = "3" + .append(StringHelper.preencherZeroEsquerda((importacionNaoFiscalVOs.size())+"", 6)) //Qtde de Documentos gerados = 1 + .append(StringHelper.preencherZeroEsquerda((importacionNaoFiscalVOs.size())+"", 6)) //Qtde de Itens Documentos gerados = 2 + .append(StringHelper.preencherStringEspacoEsquerda(null, 381)) //Brancos + .append(StringHelper.preencherZeroEsquerda((++sequencial).toString(), 6)); //Sequencial + return fechamentoArquivo; + } + + public File gerarArquivo(String cnpjFilial, List importacionNaoFiscalVOs) throws BusinessException { + try { + String nomeArquivo = UsuarioLogado.getUsuarioLogado().getNombusuario() + "_" + Calendar.getInstance().getTime().getTime() + "_" + "naofiscal"; + File arquivo = File.createTempFile(nomeArquivo, ".tmp"); + PrintWriter gravarArq = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivo), Constantes.UTF_8)); + + /* Gerando arquivo */ + this.cnpjFilial = cnpjFilial; + this.importacionNaoFiscalVOs = importacionNaoFiscalVOs; + gravarArq.print(getAberturaArquivo()); + gravarArq.print(getHeaderArquivo()); + gravarArq.print(getFechamentoArquivo()); + + gravarArq.close(); + + return arquivo; + } catch (Exception e) { + log.error(e.getMessage(), e); + throw new BusinessException(e.getMessage(), e); + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionReducaoZ.java b/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionReducaoZ.java new file mode 100644 index 000000000..85dd712eb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ArchivoIntegracionReducaoZ.java @@ -0,0 +1,190 @@ +package com.rjconsultores.ventaboletos.utilerias.archivointegracion; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.StringHelper; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.ImportacionFiscalReducaoZVO; +import com.rjconsultores.ventaboletos.vo.impressaofiscal.SituacaoTributaria; + +public class ArchivoIntegracionReducaoZ { + + private static Logger log = Logger.getLogger(ArchivoIntegracionReducaoZ.class); + + public File importacionReducaoZ(Date inicio, Date fim, Empresa empresa, boolean isPendencias, List listReducao) { + + try { + String nomeArquivo = "fiscal_reducao_z_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + if (isPendencias) + nomeArquivo = "fiscal_pendencia_reducao_z_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + + File arquivo = File.createTempFile(nomeArquivo, ".txt"); + + PrintWriter gravarArq = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivo), Constantes.UTF_8)); + + Integer seq = 1; + + String cnpjFilial = StringHelper.retornaSomenteNumeros(empresa.getCnpj() == null ? StringHelper.preencherStringEspacoEsquerda(null, 14) : empresa.getCnpj()); + String brancos371 = StringHelper.preencherStringEspacoEsquerda(null, 371); + String dataAgora = DateUtil.getStringDate(Calendar.getInstance().getTime(), UtiliteriasFiscal.DATE_FORMAT_FISCAL); + String sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String abertura = UtiliteriasFiscal.aberturaDeArquivo("0", dataAgora, cnpjFilial, brancos371, sequencial); + gravarArq.print(abertura + UtiliteriasFiscal.QUEBRA_LINHA); + + List list = null; + if (isPendencias) { + list = listReducao; + } else { + list = agruparReducaoZ(listReducao); + } + + for (ImportacionFiscalReducaoZVO ifrZ : list) { + + String dataMovimento = ifrZ.getDatamov(); + String cnpj = StringHelper.retornaSomenteNumeros(ifrZ.getCnpj() == null ? StringHelper.preencherStringEspacoEsquerda(null, 14) : ifrZ.getCnpj()); + + String impAliquota = ifrZ.getAliquota() == null ? "" : ifrZ.getAliquota().substring(0, 2); + String numRelatorio = StringHelper.preencherZeroEsquerda(impAliquota, 6); + + String numPDV = StringHelper.preencherStringEspacoEsquerda(ifrZ.getNumpdv(), 10); + String numSeriePDV = StringHelper.preencherStringEspacoEsquerda(ifrZ.getNumserie20(), 20); + String numReducaoZ = StringHelper.preencherStringEspacoEsquerda(ifrZ.getCrz(), 5); + + String gtInicial = StringHelper.preencherZeroEsquerda(ifrZ.getGtInicial().toString(), 18); + String gtFinal = StringHelper.preencherZeroEsquerda(ifrZ.getGtFinal().toString(), 18); + + String docFiscalInic = StringHelper.preencherStringEspacoEsquerda(ifrZ.getCooinicial(), 9); + String docFiscalFinal = StringHelper.preencherStringEspacoEsquerda(ifrZ.getCoofinal(), 9); + + String valorCancel = StringHelper.preencherZeroEsquerda("", 8); + String valorContabil = StringHelper.preencherZeroEsquerda(ifrZ.getVendabrutadiaria().toString(), 14); + + String subtributaria = StringHelper.preencherZeroEsquerda("", 14); + String descontos = StringHelper.preencherZeroEsquerda("", 14); + String isento = StringHelper.preencherZeroEsquerda("", 14); + + String valorNaoTributado = ifrZ.getValorNaoTributado() == null ? "" : ifrZ.getValorNaoTributado().toString(); + String naoTributado = StringHelper.preencherZeroEsquerda(valorNaoTributado, 14); + + String aliquota = StringHelper.preencherZeroEsquerda("", 14); + if (ifrZ.getAliquota().length() == 7 && ifrZ.getAliquota().substring(2, 3).equals(SituacaoTributaria.TRIBUTADO.getValue())) { + aliquota = ifrZ.getAliquota().substring(3, 7); + aliquota = StringHelper.preencherZeroEsquerda(aliquota, 14); + } + + String aliquota2 = StringHelper.preencherZeroEsquerda("", 14); + String aliquota3 = StringHelper.preencherZeroEsquerda("", 14); + String aliquota4 = StringHelper.preencherZeroEsquerda("", 14); + + String coo = StringHelper.preencherStringEspacoEsquerda(ifrZ.getCoo(), 6); + String outrosRecebimentos = StringHelper.preencherZeroEsquerda("", 14); + + BigDecimal aliquotaCalc = BigDecimal.valueOf(Double.valueOf(aliquota) / UtiliteriasFiscal.CEM.doubleValue()); + aliquotaCalc = UtiliteriasFiscal.arredondar(aliquotaCalc); + + BigDecimal baseCalculo = UtiliteriasFiscal.arredondar(ifrZ.getImposto().divide(UtiliteriasFiscal.CEM)); + baseCalculo = UtiliteriasFiscal.arredondar(baseCalculo); + + BigDecimal valorImposto = baseCalculo.multiply(aliquotaCalc.divide(UtiliteriasFiscal.CEM)); + valorImposto = UtiliteriasFiscal.arredondar(valorImposto); + String impostoDebitado = UtiliteriasFiscal.formataZeroDecimal(valorImposto, 13); + + String dataReducaoZ = ifrZ.getDatareducao(); + String horaReducaoZ = ifrZ.getHorareducao(); + + String valorDocFiscal = StringHelper.preencherZeroEsquerda(ifrZ.getImposto().toString(), 13); + + String cro = StringHelper.preencherZeroEsquerda(ifrZ.getCro(), 4); + + String brancos = StringHelper.preencherStringEspacoEsquerda(null, 68); + String status = StringHelper.preencherStringEspacoEsquerda(null, 10); + if (isPendencias) + status = StringHelper.preencherStringEspacoEsquerda(ifrZ.getStatus(), 10); + + seq++; + sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String redZ = UtiliteriasFiscal.reducaoZ("1", dataMovimento, cnpj, numRelatorio, numPDV, numSeriePDV, numReducaoZ, + gtInicial, gtFinal, docFiscalInic, docFiscalFinal, valorCancel, valorContabil, subtributaria, + descontos, isento, naoTributado, aliquota, aliquota2, aliquota3, aliquota4, coo, outrosRecebimentos, + impostoDebitado, dataReducaoZ, horaReducaoZ, valorDocFiscal, cro, status, brancos, sequencial); + gravarArq.print(redZ + UtiliteriasFiscal.QUEBRA_LINHA); + } + + Integer qtdeDoc = seq - 1; + seq++; + + String qtdeDocGerados = StringHelper.preencherZeroEsquerda(qtdeDoc.toString(), 6); + String brancos387 = StringHelper.preencherStringEspacoEsquerda(null, 387); + sequencial = StringHelper.preencherZeroEsquerda(seq.toString(), 6); + + String fechamento = UtiliteriasFiscal.fechamentoDeArquivo("3", qtdeDocGerados, null, brancos387, sequencial); + gravarArq.print(fechamento + UtiliteriasFiscal.QUEBRA_LINHA); + + gravarArq.close(); + return arquivo; + + } catch (IOException e) { + log.error("", e); + } + + return null; + } + + private List agruparReducaoZ(List list) { + + List aux = new ArrayList(); + + BigDecimal valorNaoTributado = null; + BigDecimal valorNaoIncluido = BigDecimal.ZERO; + + ImportacionFiscalReducaoZVO item = null; + + for (ImportacionFiscalReducaoZVO ifr : list) { + + if (!ifr.equals(item)) { + valorNaoIncluido = BigDecimal.ZERO; + item = ifr; + } + + String tipoMovimento = ifr.getAliquota(); + if (tipoMovimento.equals(SituacaoTributaria.CANCELADO.getValue()) || + tipoMovimento.equals(SituacaoTributaria.DESCONTO.getValue())) { + + valorNaoIncluido = valorNaoIncluido.add(ifr.getImposto()); + ifr.setValorNaoIncluido(valorNaoIncluido); + + } else if (tipoMovimento.equals(SituacaoTributaria.NAO_TRIBUTADO.getValue())) { + valorNaoTributado = ifr.getImposto(); + } else { + + ifr.setValorNaoTributado(valorNaoTributado); + ifr.setValorNaoIncluido(valorNaoIncluido); + + BigDecimal valorReducaoZ = ifr.getVendabrutadiaria().subtract(valorNaoIncluido); + ifr.setVendabrutadiaria(valorReducaoZ); + + aux.add(ifr); + + } + } + + return aux; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ValidaIntegracionECFRedZxls.java b/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ValidaIntegracionECFRedZxls.java new file mode 100644 index 000000000..3c493543d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/archivointegracion/ValidaIntegracionECFRedZxls.java @@ -0,0 +1,410 @@ +package com.rjconsultores.ventaboletos.utilerias.archivointegracion; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import org.apache.poi.hssf.usermodel.HSSFRow; +import org.apache.poi.hssf.usermodel.HSSFSheet; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; + +public class ValidaIntegracionECFRedZxls { + + private List listEcf; + private List listRedZ; + + public static void main(String[] args) { + ValidaIntegracionECFRedZxls ss = new ValidaIntegracionECFRedZxls(); + ss.executar(); + } + + private void executar() { + + listEcf = verificaArquivoEcf(); + listRedZ = verificaArquivoRedZ(); + + try { + + HSSFWorkbook workbook = new HSSFWorkbook(); + HSSFSheet firstSheet = workbook.createSheet(); + + int linha = 0; + + // Cabecalho + HSSFRow row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue("EMPRESA"); + row.createCell(1).setCellValue("DATA_MOVIMENTO"); + row.createCell(2).setCellValue("SERIE"); + row.createCell(3).setCellValue("PDV"); + row.createCell(4).setCellValue("NUMERO_BILHETES"); + row.createCell(5).setCellValue("VALOR_ECF"); + row.createCell(6).setCellValue("VALOR_REDUCAO_Z"); + row.createCell(7).setCellValue("STATUS_DIFERENÇA"); + + for (FiscalVO ecf : listEcf) { + + RedZVO redz = buscaRegistroRedZ(ecf.getNumserie20(), ecf.getDatamov()); + boolean isValoresIguais = true; + + row = firstSheet.createRow(linha++); + row.createCell(0).setCellValue("UTIL"); + row.createCell(1).setCellValue(ecf.getDatamov()); + row.createCell(2).setCellValue(redz.getNumserie20()); + row.createCell(3).setCellValue(ecf.getPdv()); + row.createCell(4).setCellValue(ecf.getQuantidade()); + row.createCell(5).setCellValue(ecf.getValorTotal().doubleValue()); + row.createCell(6).setCellValue(redz.getValorTotal().doubleValue()); + + if (!redz.getValorTotal().equals(ecf.getValorTotal())) { + isValoresIguais = false; + } + + if (isValoresIguais) { + row.createCell(7).setCellValue("VALIDO"); + System.out.println(" VALIDO ---- SERIE: " + redz.getNumserie20() + " DATAMOV: " + ecf.getDatamov() + " VALOR ECF: " + ecf.getValorTotal() + " VALOR RED Z: " + redz.getValorTotal() + " CONT: " + ecf.getQuantidade() + " PDV: " + ecf.getPdv()); + } else { + row.createCell(7).setCellValue("INVALIDO"); + System.out.println(" !!! INVALIDO ---- SERIE: " + redz.getNumserie20() + " DATAMOV: " + ecf.getDatamov() + " VALOR ECF: " + ecf.getValorTotal() + " VALOR RED Z: " + redz.getValorTotal() + " CONT: " + ecf.getQuantidade() + " PDV: " + ecf.getPdv()); + } + + } + + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + workbook.write(bos); + + File arquivo = new File("C:\\Users\\rjgw\\Desktop\\dif.xls"); + + FileOutputStream fos = new FileOutputStream(arquivo); + fos.write(bos.toByteArray()); + fos.close(); + + } catch (IOException e) { + e.printStackTrace(); + } + } + + private RedZVO buscaRegistroRedZ(String numserie20, String datamov) { + try { + int index = listRedZ.indexOf(new RedZVO(datamov, numserie20)); + return listRedZ.get(index); + } catch (ArrayIndexOutOfBoundsException e) { + } + return null; + } + + public List verificaArquivoRedZ() { + + List list = new ArrayList(); + + File arquivoTxt = new File("C:\\Users\\rjgw\\Desktop\\fiscal_reducao_z_201606240529438877750410577735828.txt"); + BufferedReader br; + + try { + br = new BufferedReader(new FileReader(arquivoTxt)); + String linha = br.readLine(); + + RedZVO atual = null; + while (linha != null) { + + if (linha.startsWith("1")) { + + String datamov = linha.substring(1, 9).trim(); + String numserie20 = linha.substring(39, 60).trim(); + RedZVO novo = new RedZVO(datamov, numserie20); + novo.setPdv(linha.substring(56, 60).trim()); + + String valor = linha.substring(128, 140).trim(); + try { + novo.setValorTotal(new BigDecimal(valor)); + } catch (Exception e) { + } + + if (atual == null) { + atual = novo; + + } else if (atual.equals(novo)) { + + } else { + list.add(atual); + atual = novo; + + } + } + + linha = br.readLine(); + } + + list.add(atual); + + br.close(); + + return list; + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + return null; + } + + public List verificaArquivoEcf() { + + List list = new ArrayList(); + + File arquivoTxt = new File("C:\\Users\\rjgw\\Desktop\\fiscal_ecf_201606240529405088610479025318030.txt"); + BufferedReader br; + + try { + br = new BufferedReader(new FileReader(arquivoTxt)); + String linha = br.readLine(); + int cont = 0; + + FiscalVO atual = null; + while (linha != null) { + + if (linha.startsWith("1")) { + + String datamov = linha.substring(1, 9).trim(); + String pdv = linha.substring(32, 35).trim(); + FiscalVO novo = new FiscalVO(datamov, pdv); + + String valor = linha.substring(56, 70).trim(); + + if (atual == null) { + atual = novo; + atual.soma(valor); + cont++; + + } else if (atual.equals(novo)) { + atual.soma(valor); + cont++; + } else { + atual.setQuantidade(cont); + list.add(atual); + + cont = 0; + + atual = novo; + atual.soma(valor); + cont++; + } + } + + if (linha.startsWith("2")) { + atual.setNumserie20(linha.substring(212, 232).trim()); + } + + linha = br.readLine(); + } + + list.add(atual); + + br.close(); + + return list; + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + return null; + } + + public class RedZVO { + private String datamov; + private String pdv; + private String numserie20; + private BigDecimal valorTotal; + + public RedZVO(String datamov, String numserie20) { + this.datamov = datamov; + this.numserie20 = numserie20; + this.valorTotal = BigDecimal.ZERO; + } + + public void soma(String valor) { + BigDecimal vl = new BigDecimal(valor); + this.valorTotal = valorTotal.add(vl); + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public String getNumserie20() { + return numserie20; + } + + public void setNumserie20(String numserie20) { + this.numserie20 = numserie20; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public String getPdv() { + return pdv; + } + + public void setPdv(String pdv) { + this.pdv = pdv; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + getOuterType().hashCode(); + result = prime * result + ((datamov == null) ? 0 : datamov.hashCode()); + result = prime * result + ((numserie20 == null) ? 0 : numserie20.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + RedZVO other = (RedZVO) obj; + if (!getOuterType().equals(other.getOuterType())) + return false; + if (datamov == null) { + if (other.datamov != null) + return false; + } else if (!datamov.equals(other.datamov)) + return false; + if (numserie20 == null) { + if (other.numserie20 != null) + return false; + } else if (!numserie20.equals(other.numserie20)) + return false; + return true; + } + + private ValidaIntegracionECFRedZxls getOuterType() { + return ValidaIntegracionECFRedZxls.this; + } + + } + + public class FiscalVO { + private String datamov; + private String pdv; + private String numserie20; + private BigDecimal valorTotal; + private int quantidade; + + public FiscalVO(String datamov, String pdv) { + super(); + this.datamov = datamov; + this.pdv = pdv; + this.valorTotal = BigDecimal.ZERO; + this.quantidade = 0; + } + + public void soma(String valor) { + BigDecimal vl = new BigDecimal(valor); + this.valorTotal = valorTotal.add(vl); + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public String getNumserie20() { + return numserie20; + } + + public void setNumserie20(String numserie20) { + this.numserie20 = numserie20; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public int getQuantidade() { + return quantidade; + } + + public void setQuantidade(int quantidade) { + this.quantidade = quantidade; + } + + public String getPdv() { + return pdv; + } + + public void setPdv(String pdv) { + this.pdv = pdv; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + getOuterType().hashCode(); + result = prime * result + ((datamov == null) ? 0 : datamov.hashCode()); + result = prime * result + ((pdv == null) ? 0 : pdv.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + FiscalVO other = (FiscalVO) obj; + if (!getOuterType().equals(other.getOuterType())) + return false; + if (datamov == null) { + if (other.datamov != null) + return false; + } else if (!datamov.equals(other.datamov)) + return false; + if (pdv == null) { + if (other.pdv != null) + return false; + } else if (!pdv.equals(other.pdv)) + return false; + return true; + } + + private ValidaIntegracionECFRedZxls getOuterType() { + return ValidaIntegracionECFRedZxls.this; + } + + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/ExportacaoBpe.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/ExportacaoBpe.java new file mode 100644 index 000000000..bafbeb1af --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/ExportacaoBpe.java @@ -0,0 +1,266 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacao; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.entidad.Constante; +import com.rjconsultores.ventaboletos.service.ConstanteService; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.ExportacaoBPEBase; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.ExportacaoBPETipoBPE; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.ExportacaoBPETipoDPE; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.ExportacaoBPETipoOBE; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.ExportacaoBPETipoPRC; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.ExportacaoBPEVo; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Service("exportacaoBpe") +public class ExportacaoBpe { + private static Logger log = Logger.getLogger(ExportacaoBpe.class); + + private static String VAZIO = ""; + private static String SEPARADOR = "|"; + + public ExportacaoBpe() { + + } + + public String gerarArquivoBPE(final Date dataInicial, final Date dataFinal, String nomeArquivo, final String nomeEmpresa, ExportacaoBPEVo registro) { + + log.info(" Inicio -- Retorno da lista " + new Date()); + try { + StringBuilder writer = new StringBuilder(); + + ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService"); + Constante contante = constanteService.buscarPorNomeConstante("IMPORT_BPE_LAYOUT_DIF"); + String valorConstante = contante == null ? null : contante.getValorconstante(); + + boolean isVersao131 = StringUtils.isBlank(valorConstante) || "131".equals(valorConstante) ? true : false; + String versaoLayout = StringUtils.isBlank(valorConstante) || "131".equals(valorConstante) ? "131" : valorConstante; + + adicionarRegistroBPETipoCAB(writer, dataInicial, dataFinal, nomeEmpresa, nomeArquivo, versaoLayout); + + int linhas = 2; + + if (registro.getListaRegistroBaseBPE() != null && registro.getListaRegistroBaseBPE().size() == 0) { + return null; + } + + for (ExportacaoBPEBase ee : registro.getListaRegistroBaseBPE()) { + + for (ExportacaoBPETipoBPE tipoBPE : ee.getListaRegistroBPE()) { + adicionarRegistroBPETipoBEP(writer, tipoBPE, isVersao131); + linhas++; + } + + for (ExportacaoBPETipoDPE tipoDPE : ee.getListaRegistroDPE()) { + adicionarRegistroBPETipoDPE(writer, tipoDPE); + linhas++; + } + + /* + * Expecificado na documenta��o original + * + * for (ExportacaoBPETipoOBE tipoOBE : ee.getListaRegistroOBE()) { adicionarRegistroBPETipoOBE(writer, tipoOBE); linhas++; + * + * + * for (ExportacaoBPETipoPRC tipoPRC : ee.getListaRegistroPRC()) { adicionarRegistroBPETipoRPC(writer, tipoPRC); linhas++; } + */ + } + + writer.append("TRA|" + linhas + UtiliteriasFiscal.QUEBRA_LINHA); + + log.info(" Fim -- Retorno da lista " + new Date()); + + return writer.toString(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + return null; + } + + private void adicionarRegistroBPETipoCAB(final StringBuilder sb, final Date dataInicial, final Date dataFinal, final String nomeEmpresa, final String arquivo, String versaoLayout) { + sb.append("CAB").append(SEPARADOR); + sb.append(versaoLayout).append(SEPARADOR); + sb.append("TotalBus").append(SEPARADOR); + sb.append(new SimpleDateFormat("yyyyMMdd").format(new Date())).append(SEPARADOR); + sb.append(formataCaracter(nomeEmpresa, false, 15)).append(SEPARADOR); + sb.append(new SimpleDateFormat("yyyyMMdd").format(dataInicial)).append(SEPARADOR); + sb.append(new SimpleDateFormat("yyyyMMdd").format(dataFinal)).append(SEPARADOR); + sb.append(arquivo).append(SEPARADOR); + sb.append("N"); + sb.append(UtiliteriasFiscal.QUEBRA_LINHA); + } + + private void adicionarRegistroBPETipoBEP(final StringBuilder sb, ExportacaoBPETipoBPE tipoBPE, boolean isVersao131) { + + String tipoRegistro = "BPE"; + /** + * Mantis 18267 + */ + String estabelecimento = StringUtils.isBlank(tipoBPE.getEstabelecimento()) ? VAZIO : tipoBPE.getEstabelecimento(); + String chaveEletronica = tipoBPE.getChaveEletronica(); + String serie = tipoBPE.getSerie(); + String numero = tipoBPE.getNumero(); + String dataEmissao = StringUtils.isBlank(tipoBPE.getDataEmissao()) ? VAZIO : tipoBPE.getDataEmissao(); + String dataPrestacao = StringUtils.isBlank(tipoBPE.getDataPrestacao()) ? VAZIO : tipoBPE.getDataPrestacao(); + String situacaoDocumento = tipoBPE.getSituacaoDoc(); + + String valorBruto = tipoBPE.getValorBruto() == null ? VAZIO : formataValor(tipoBPE.getValorBruto(), 15); + String valorDesconto = tipoBPE.getValorDesconto() == null ? VAZIO : formataValor(tipoBPE.getValorDesconto(), 15); + String UFOrigem = tipoBPE.getUFOrigem(); + String muniOrigem = tipoBPE.getMunicipioOrigem(); + String UFDestino = tipoBPE.getUFDestino(); + String muniDestino = tipoBPE.getMunicipioDestino(); + String CSTCOFINS = tipoBPE.getCstCofins(); + String receitaTributavelCOFINS = tipoBPE.getReceitaTriCofins() == null ? VAZIO : formataValor(tipoBPE.getReceitaTriCofins(), 15); + String naturezaReceitaCOFINS = VAZIO; + String CSTPIS = tipoBPE.getCstPis(); + String receitaTributavelPIS = tipoBPE.getReceitaTriCofins() == null ? VAZIO : formataValor(tipoBPE.getReceitaTriCofins(), 15); + String naturezaReceitaPIS = VAZIO; + String receitaCSL1 = VAZIO; + String receitaCSL2 = VAZIO; + String receitaIRPJ1 = VAZIO; + String receitaIRPJ2 = VAZIO; + String receitaIRPJ3 = VAZIO; + String receitaIRPJ4 = VAZIO; + String tipoBPe = tipoBPE.getTipoBPe(); + String chaveEletRef = StringUtils.isBlank(tipoBPE.getChaveEletronicaReferencia()) ? VAZIO : tipoBPE.getChaveEletronicaReferencia(); + String codigoContabil = StringUtils.isBlank(tipoBPE.getCodigoContabil()) ? VAZIO : tipoBPE.getCodigoContabil(); + String codigoPrevidenciaria = tipoBPE.getIndContribuicaoPrevidenciaria(); + String codigoComplementar = VAZIO; + String observacao = VAZIO; + String codAjusteFiscal = VAZIO; + String exclussaoBCPISCOFINS = VAZIO; + + String baseCalculoAjusteICMS = VAZIO; + String aliquotaAjusteICMS = VAZIO; + String valorAjusteICMS = VAZIO; + + sb.append(tipoRegistro).append(SEPARADOR); + sb.append(estabelecimento).append(SEPARADOR); + sb.append(chaveEletronica).append(SEPARADOR); + sb.append(serie).append(SEPARADOR); + sb.append(numero).append(SEPARADOR); + sb.append(dataEmissao).append(SEPARADOR); + sb.append(situacaoDocumento).append(SEPARADOR); + sb.append(dataPrestacao).append(SEPARADOR); + sb.append(valorBruto).append(SEPARADOR); + sb.append(valorDesconto).append(SEPARADOR); + sb.append(UFOrigem).append(SEPARADOR); + sb.append(muniOrigem).append(SEPARADOR); + sb.append(UFDestino).append(SEPARADOR); + sb.append(muniDestino).append(SEPARADOR); + sb.append(CSTCOFINS).append(SEPARADOR); + sb.append(receitaTributavelCOFINS).append(SEPARADOR); + sb.append(naturezaReceitaCOFINS).append(SEPARADOR); + sb.append(CSTPIS).append(SEPARADOR); + sb.append(receitaTributavelPIS).append(SEPARADOR); + sb.append(naturezaReceitaPIS).append(SEPARADOR); + sb.append(receitaCSL1).append(SEPARADOR); + sb.append(receitaCSL2).append(SEPARADOR); + sb.append(receitaIRPJ1).append(SEPARADOR); + sb.append(receitaIRPJ2).append(SEPARADOR); + sb.append(receitaIRPJ3).append(SEPARADOR); + sb.append(receitaIRPJ4).append(SEPARADOR); + sb.append(tipoBPe).append(SEPARADOR); + sb.append(chaveEletRef).append(SEPARADOR); + sb.append(codigoContabil).append(SEPARADOR); + sb.append(codigoPrevidenciaria).append(SEPARADOR); + sb.append(codigoComplementar).append(SEPARADOR); + sb.append(observacao).append(SEPARADOR); + sb.append(codAjusteFiscal).append(isVersao131 ? VAZIO : SEPARADOR); + + if(!isVersao131) { + sb.append(exclussaoBCPISCOFINS).append(SEPARADOR); + sb.append(baseCalculoAjusteICMS).append(SEPARADOR); + sb.append(aliquotaAjusteICMS).append(SEPARADOR); + sb.append(valorAjusteICMS); + } + + sb.append(UtiliteriasFiscal.QUEBRA_LINHA); + } + + private void adicionarRegistroBPETipoDPE(final StringBuilder sb, ExportacaoBPETipoDPE tipoDPE) { + String tipoRegistro = "DBE"; + String valor = formataValor(tipoDPE.getValor(), 15); + String CFOP = tipoDPE.getCfop(); + String CSTB = tipoDPE.getCstb(); + String CSOSNB = tipoDPE.getCsosnb(); + String baseCalculoICMS = formataValor(tipoDPE.getBaseCalculoICMS(), 15); + String aliquotaICMS = formataValor(tipoDPE.getAliquotaICMS(), 15); + String ICMS = formataValor(tipoDPE.getIcms(), 15); + String isentas = formataValor(tipoDPE.getIsentas(), 15); + String outras = formataValor(tipoDPE.getOutras(), 15); + + sb.append(tipoRegistro).append(SEPARADOR); + sb.append(valor).append(SEPARADOR); + sb.append(CFOP).append(SEPARADOR); + sb.append(CSTB).append(SEPARADOR); + sb.append(CSOSNB).append(SEPARADOR); + sb.append(baseCalculoICMS).append(SEPARADOR); + sb.append(aliquotaICMS).append(SEPARADOR); + sb.append(ICMS).append(SEPARADOR); + sb.append(isentas).append(SEPARADOR); + sb.append(outras); + sb.append(UtiliteriasFiscal.QUEBRA_LINHA); + } + + /* + * Expecificado na documenta��o original + */ + @SuppressWarnings("unused") + private void adicionarRegistroBPETipoOBE(final StringBuilder sb, ExportacaoBPETipoOBE tipoOBE) { + String tipoRegistro = "OBE"; + String codigo = tipoOBE.getCodigo(); + String valor = formataValor(tipoOBE.getValor(), 15); + + sb.append(tipoRegistro).append(SEPARADOR); + sb.append(codigo).append(SEPARADOR); + sb.append(valor); + sb.append(UtiliteriasFiscal.QUEBRA_LINHA); + } + + /* + * Expecificado na documenta��o original + */ + @SuppressWarnings("unused") + private void adicionarRegistroBPETipoRPC(final StringBuilder sb, ExportacaoBPETipoPRC tipoPRC) { + String tipoRegistro = "RPC"; + String UF = tipoPRC.getUf(); + String municipio = tipoPRC.getMunicipio(); + String valor = formataValor(tipoPRC.getValor(), 15); + String baseCalculoICMS = formataValor(tipoPRC.getBaseCalculoICMS(), 15); + String ICMS = formataValor(tipoPRC.getIcms(), 15); + + sb.append(tipoRegistro).append(SEPARADOR); + sb.append(UF).append(SEPARADOR); + sb.append(municipio).append(SEPARADOR); + sb.append(valor).append(SEPARADOR); + sb.append(baseCalculoICMS).append(SEPARADOR); + sb.append(ICMS); + sb.append(UtiliteriasFiscal.QUEBRA_LINHA); + } + + private String formataValor(final BigDecimal valor, final int tamanho) { + if (valor == null) { + return "0"; + } else { + return valor.setScale(2, BigDecimal.ROUND_HALF_EVEN).toString(); + } + } + + private String formataCaracter(String valor, boolean removeMascara, int tamanho) { + if (valor == null) { + valor = VAZIO; + } + return valor; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEBase.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEBase.java new file mode 100644 index 000000000..373511c17 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEBase.java @@ -0,0 +1,776 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacao.bpe; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +public class ExportacaoBPEBase { + + private Long boletoId; + private String numfoliosistema; + private BigDecimal valortotal; + private BigDecimal vDesconto; + private String chbpe; + private String chbpeSub; + private String dhrecbto; + private String dhEmisao; + private String tpBpe; + private String retorno; + private String nprot; + private String numBpe; + private String numSerieBpe; + private String codEstabelecimento; + private String municipioOrigem; + private String estadoOrigem; + private String municipioDestino; + private String estadoDestino; + private BigDecimal valortributado; + private BigDecimal redBaseCalcEstadual; + private BigDecimal redBaseCalcMunicipal; + private BigDecimal porcRedMunicipal; + private BigDecimal porcRedEstadual; + private BigDecimal tributacaoImportacao; + private String pagamentos; + private String codstatus; + private String tipoevento; + private String codigoContabilEstadual; + private String codigocontabilMunicipal; + private Integer crt; + private String xml; + private String xmlAnterior; + private Boolean indTarifaMunicipal; + private Boolean indSeguroMunicipal; + private Boolean indTxEmbarqueMunicipal; + private Boolean indPedagioMunicipal; + private Boolean indTarifaEstadual; + private Boolean indSeguroEstadual; + private Boolean indTxEmbarqueEstadual; + private Boolean indPedadioEstdual; + + private String cmunini; + private String cmunfim; + private String ufini; + private String uffim; + private String nbp; + private String dhemb; + private String cst00; + private String cst20; + private String cst45; + private String cst90; + private String cstoutrauf; + private String cstsn; + private String vbc00; + private String picms00; + private String vicms00; + private String vbc20; + private String picms20; + private String vicms20; + private String vbp; + private String vdesconto; + private String vpgto; + private String tpcomp01; + private String tpcomp02; + private String tpcomp03; + private String tpcomp04; + private String tpcomp05; + private String tpcomp06; + private String tpcomp99; + private String vcomp01; + private String vcomp02; + private String vcomp03; + private String vcomp04; + private String vcomp05; + private String vcomp06; + private String vcomp99; + private String pRedBC; + + private String dhrecbtoBPe; + private boolean activoBPe; + private int motivoCancelacionId; + private String indContribuicaoPrevidenciaria; + + private List listaRegistroBPE; + private List listaRegistroDPE; + private List listaRegistroOBE; + private List listaRegistroPRC; + + public ExportacaoBPEBase() { + listaRegistroBPE = new ArrayList(0); + listaRegistroDPE = new ArrayList(0); + listaRegistroOBE = new ArrayList(0); + listaRegistroPRC = new ArrayList(0); + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public String getNumfoliosistema() { + return numfoliosistema; + } + + public void setNumfoliosistema(String numfoliosistema) { + this.numfoliosistema = numfoliosistema; + } + + public BigDecimal getValortotal() { + return valortotal; + } + + public void setValortotal(BigDecimal valortotal) { + this.valortotal = valortotal; + } + + public BigDecimal getvDesconto() { + return vDesconto; + } + + public void setvDesconto(BigDecimal vDesconto) { + this.vDesconto = vDesconto; + } + + public String getChbpe() { + return chbpe; + } + + public void setChbpe(String chbpe) { + this.chbpe = chbpe; + } + + public String getChbpeSub() { + return chbpeSub; + } + + public void setChbpeSub(String chbpeSub) { + this.chbpeSub = chbpeSub; + } + + public String getDhrecbto() { + return dhrecbto; + } + + public void setDhrecbto(String dhrecbto) { + this.dhrecbto = dhrecbto; + } + + public String getDhEmisao() { + return dhEmisao; + } + + public void setDhEmisao(String dhEmisao) { + this.dhEmisao = dhEmisao; + } + + public String getTpBpe() { + return tpBpe; + } + + public void setTpBpe(String tpBpe) { + this.tpBpe = tpBpe; + } + + public String getRetorno() { + return retorno; + } + + public void setRetorno(String retorno) { + this.retorno = retorno; + } + + public String getNprot() { + return nprot; + } + + public void setNprot(String nprot) { + this.nprot = nprot; + } + + public String getNumBpe() { + return numBpe; + } + + public void setNumBpe(String numBpe) { + this.numBpe = numBpe; + } + + public String getNumSerieBpe() { + return numSerieBpe; + } + + public void setNumSerieBpe(String numSerieBpe) { + this.numSerieBpe = numSerieBpe; + } + + public String getCodEstabelecimento() { + return codEstabelecimento; + } + + public void setCodEstabelecimento(String codEstabelecimento) { + this.codEstabelecimento = codEstabelecimento; + } + + public String getMunicipioOrigem() { + return municipioOrigem; + } + + public void setMunicipioOrigem(String municipioOrigem) { + this.municipioOrigem = municipioOrigem; + } + + public String getEstadoOrigem() { + return estadoOrigem; + } + + public void setEstadoOrigem(String estadoOrigem) { + this.estadoOrigem = estadoOrigem; + } + + public String getMunicipioDestino() { + return municipioDestino; + } + + public void setMunicipioDestino(String municipioDestino) { + this.municipioDestino = municipioDestino; + } + + public String getEstadoDestino() { + return estadoDestino; + } + + public void setEstadoDestino(String estadoDestino) { + this.estadoDestino = estadoDestino; + } + + public BigDecimal getValortributado() { + return valortributado; + } + + public void setValortributado(BigDecimal valortributado) { + this.valortributado = valortributado; + } + + public BigDecimal getRedBaseCalcEstadual() { + return redBaseCalcEstadual; + } + + public void setRedBaseCalcEstadual(BigDecimal redBaseCalcEstadual) { + this.redBaseCalcEstadual = redBaseCalcEstadual; + } + + public BigDecimal getRedBaseCalcMunicipal() { + return redBaseCalcMunicipal; + } + + public void setRedBaseCalcMunicipal(BigDecimal redBaseCalcMunicipal) { + this.redBaseCalcMunicipal = redBaseCalcMunicipal; + } + + public BigDecimal getPorcRedMunicipal() { + return porcRedMunicipal; + } + + public void setPorcRedMunicipal(BigDecimal porcRedMunicipal) { + this.porcRedMunicipal = porcRedMunicipal; + } + + public BigDecimal getPorcRedEstadual() { + return porcRedEstadual; + } + + public void setPorcRedEstadual(BigDecimal porcRedEstadual) { + this.porcRedEstadual = porcRedEstadual; + } + + public BigDecimal getTributacaoImportacao() { + return tributacaoImportacao; + } + + public void setTributacaoImportacao(BigDecimal tributacaoImportacao) { + this.tributacaoImportacao = tributacaoImportacao; + } + + public String getPagamentos() { + return pagamentos; + } + + public void setPagamentos(String pagamentos) { + this.pagamentos = pagamentos; + } + + public String getCodstatus() { + return codstatus; + } + + public void setCodstatus(String codstatus) { + this.codstatus = codstatus; + } + + public String getTipoevento() { + return tipoevento; + } + + public void setTipoevento(String tipoevento) { + this.tipoevento = tipoevento; + } + + public String getCodigoContabilEstadual() { + return codigoContabilEstadual; + } + + public void setCodigoContabilEstadual(String codigoContabilEstadual) { + this.codigoContabilEstadual = codigoContabilEstadual; + } + + public String getCodigocontabilMunicipal() { + return codigocontabilMunicipal; + } + + public void setCodigocontabilMunicipal(String codigocontabilMunicipal) { + this.codigocontabilMunicipal = codigocontabilMunicipal; + } + + public Integer getCrt() { + return crt; + } + + public void setCrt(Integer crt) { + this.crt = crt; + } + + public String getXml() { + return xml; + } + + public void setXml(String xml) { + this.xml = xml; + } + + public Boolean getIndTarifaMunicipal() { + return indTarifaMunicipal; + } + + public void setIndTarifaMunicipal(Boolean indTarifaMunicipal) { + this.indTarifaMunicipal = indTarifaMunicipal; + } + + public Boolean getIndSeguroMunicipal() { + return indSeguroMunicipal; + } + + public void setIndSeguroMunicipal(Boolean indSeguroMunicipal) { + this.indSeguroMunicipal = indSeguroMunicipal; + } + + public Boolean getIndTxEmbarqueMunicipal() { + return indTxEmbarqueMunicipal; + } + + public void setIndTxEmbarqueMunicipal(Boolean indTxEmbarqueMunicipal) { + this.indTxEmbarqueMunicipal = indTxEmbarqueMunicipal; + } + + public Boolean getIndPedagioMunicipal() { + return indPedagioMunicipal; + } + + public void setIndPedagioMunicipal(Boolean indPedagioMunicipal) { + this.indPedagioMunicipal = indPedagioMunicipal; + } + + public Boolean getIndTarifaEstadual() { + return indTarifaEstadual; + } + + public void setIndTarifaEstadual(Boolean indTarifaEstadual) { + this.indTarifaEstadual = indTarifaEstadual; + } + + public Boolean getIndSeguroEstadual() { + return indSeguroEstadual; + } + + public void setIndSeguroEstadual(Boolean indSeguroEstadual) { + this.indSeguroEstadual = indSeguroEstadual; + } + + public Boolean getIndTxEmbarqueEstadual() { + return indTxEmbarqueEstadual; + } + + public void setIndTxEmbarqueEstadual(Boolean indTxEmbarqueEstadual) { + this.indTxEmbarqueEstadual = indTxEmbarqueEstadual; + } + + public Boolean getIndPedadioEstdual() { + return indPedadioEstdual; + } + + public void setIndPedadioEstdual(Boolean indPedadioEstdual) { + this.indPedadioEstdual = indPedadioEstdual; + } + + public List getListaRegistroBPE() { + return listaRegistroBPE; + } + + public void setListaRegistroBPE(List listaRegistroBPE) { + this.listaRegistroBPE = listaRegistroBPE; + } + + public List getListaRegistroDPE() { + return listaRegistroDPE; + } + + public void setListaRegistroDPE(List listaRegistroDPE) { + this.listaRegistroDPE = listaRegistroDPE; + } + + public List getListaRegistroOBE() { + return listaRegistroOBE; + } + + public void setListaRegistroOBE(List listaRegistroOBE) { + this.listaRegistroOBE = listaRegistroOBE; + } + + public List getListaRegistroPRC() { + return listaRegistroPRC; + } + + public void setListaRegistroPRC(List listaRegistroPRC) { + this.listaRegistroPRC = listaRegistroPRC; + } + + public String getXmlAnterior() { + return xmlAnterior; + } + + public void setXmlAnterior(String xmlAnterior) { + this.xmlAnterior = xmlAnterior; + } + + public String getCmunini() { + return cmunini; + } + + public void setCmunini(String cmunini) { + this.cmunini = cmunini; + } + + public String getCmunfim() { + return cmunfim; + } + + public void setCmunfim(String cmunfim) { + this.cmunfim = cmunfim; + } + + public String getUfini() { + return ufini; + } + + public void setUfini(String ufini) { + this.ufini = ufini; + } + + public String getUffim() { + return uffim; + } + + public void setUffim(String uffim) { + this.uffim = uffim; + } + + public String getNbp() { + return nbp; + } + + public void setNbp(String nbp) { + this.nbp = nbp; + } + + public String getDhemb() { + return dhemb; + } + + public void setDhemb(String dhemb) { + this.dhemb = dhemb; + } + + public String getCst00() { + return cst00; + } + + public void setCst00(String cst00) { + this.cst00 = cst00; + } + + public String getCst20() { + return cst20; + } + + public void setCst20(String cst20) { + this.cst20 = cst20; + } + + public String getCst45() { + return cst45; + } + + public void setCst45(String cst45) { + this.cst45 = cst45; + } + + public String getCst90() { + return cst90; + } + + public void setCst90(String cst90) { + this.cst90 = cst90; + } + + public String getCstoutrauf() { + return cstoutrauf; + } + + public void setCstoutrauf(String cstoutrauf) { + this.cstoutrauf = cstoutrauf; + } + + public String getCstsn() { + return cstsn; + } + + public void setCstsn(String cstsn) { + this.cstsn = cstsn; + } + + public String getVbc00() { + return vbc00; + } + + public void setVbc00(String vbc00) { + this.vbc00 = vbc00; + } + + public String getPicms00() { + return picms00; + } + + public void setPicms00(String picms00) { + this.picms00 = picms00; + } + + public String getVicms00() { + return vicms00; + } + + public void setVicms00(String vicms00) { + this.vicms00 = vicms00; + } + + public String getVbc20() { + return vbc20; + } + + public void setVbc20(String vbc20) { + this.vbc20 = vbc20; + } + + public String getPicms20() { + return picms20; + } + + public void setPicms20(String picms20) { + this.picms20 = picms20; + } + + public String getVicms20() { + return vicms20; + } + + public void setVicms20(String vicms20) { + this.vicms20 = vicms20; + } + + public String getVbp() { + return vbp; + } + + public void setVbp(String vbp) { + this.vbp = vbp; + } + + public String getVdesconto() { + return vdesconto; + } + + public void setVdesconto(String vdesconto) { + this.vdesconto = vdesconto; + } + + public String getVpgto() { + return vpgto; + } + + public void setVpgto(String vpgto) { + this.vpgto = vpgto; + } + + public String getTpcomp01() { + return tpcomp01; + } + + public void setTpcomp01(String tpcomp01) { + this.tpcomp01 = tpcomp01; + } + + public String getTpcomp02() { + return tpcomp02; + } + + public void setTpcomp02(String tpcomp02) { + this.tpcomp02 = tpcomp02; + } + + public String getTpcomp03() { + return tpcomp03; + } + + public void setTpcomp03(String tpcomp03) { + this.tpcomp03 = tpcomp03; + } + + public String getTpcomp04() { + return tpcomp04; + } + + public void setTpcomp04(String tpcomp04) { + this.tpcomp04 = tpcomp04; + } + + public String getTpcomp05() { + return tpcomp05; + } + + public void setTpcomp05(String tpcomp05) { + this.tpcomp05 = tpcomp05; + } + + public String getTpcomp06() { + return tpcomp06; + } + + public void setTpcomp06(String tpcomp06) { + this.tpcomp06 = tpcomp06; + } + + public String getTpcomp99() { + return tpcomp99; + } + + public void setTpcomp99(String tpcomp99) { + this.tpcomp99 = tpcomp99; + } + + public String getVcomp01() { + return vcomp01; + } + + public void setVcomp01(String vcomp01) { + this.vcomp01 = vcomp01; + } + + public String getVcomp02() { + return vcomp02; + } + + public void setVcomp02(String vcomp02) { + this.vcomp02 = vcomp02; + } + + public String getVcomp03() { + return vcomp03; + } + + public void setVcomp03(String vcomp03) { + this.vcomp03 = vcomp03; + } + + public String getVcomp04() { + return vcomp04; + } + + public void setVcomp04(String vcomp04) { + this.vcomp04 = vcomp04; + } + + public String getVcomp05() { + return vcomp05; + } + + public void setVcomp05(String vcomp05) { + this.vcomp05 = vcomp05; + } + + public String getVcomp06() { + return vcomp06; + } + + public void setVcomp06(String vcomp06) { + this.vcomp06 = vcomp06; + } + + public String getVcomp99() { + return vcomp99; + } + + public void setVcomp99(String vcomp99) { + this.vcomp99 = vcomp99; + } + + public String getpRedBC() { + return pRedBC; + } + + public void setpRedBC(String pRedBC) { + this.pRedBC = pRedBC; + } + + public String getDhrecbtoBPe() { + return dhrecbtoBPe; + } + + public void setDhrecbtoBPe(String dhrecbtoBPe) { + this.dhrecbtoBPe = dhrecbtoBPe; + } + + public boolean isActivoBPe() { + return activoBPe; + } + + public void setActivoBPe(boolean activoBPe) { + this.activoBPe = activoBPe; + } + + public int getMotivoCancelacionId() { + return motivoCancelacionId; + } + + public void setMotivoCancelacionId(int motivoCancelacionId) { + this.motivoCancelacionId = motivoCancelacionId; + } + + public String getIndContribuicaoPrevidenciaria() { + return indContribuicaoPrevidenciaria; + } + + public void setIndContribuicaoPrevidenciaria(String indContribuicaoPrevidenciaria) { + this.indContribuicaoPrevidenciaria = indContribuicaoPrevidenciaria; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoBPE.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoBPE.java new file mode 100644 index 000000000..f6aabe556 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoBPE.java @@ -0,0 +1,234 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacao.bpe; + +import java.math.BigDecimal; + +public class ExportacaoBPETipoBPE { + + private String estabelecimento; + private String chaveEletronica; + private String serie; + private String numero; + private String dataEmissao; + private String situacaoDoc; + private String dataPrestacao; + private BigDecimal valorBruto; + private BigDecimal valorDesconto; + private String UFOrigem; + private String municipioOrigem; + private String UFDestino; + private String municipioDestino; + private String cstCofins; + private BigDecimal receitaTriCofins; + private String cstPis; + private BigDecimal receitaTributavelPis; + private String tipoBPe; + private String chaveEletronicaReferencia; + private String codigoContabil; + private String indContribuicaoPrevidenciaria; + private String tpDesconto; + + public ExportacaoBPETipoBPE() { + } + + public ExportacaoBPETipoBPE(String estabelecimento, String chaveEletronica, String serie, String numero, String dataEmissao, String situacaoDoc, String dataPrestacao, BigDecimal valorBruto, BigDecimal valorDesconto, String uFOrigem, String municipioOrigem, String uFDestino, String municipioDestino, String cstCofins, BigDecimal receitaTriCofins, String tipoBPe, String chaveEletronicaReferencia, String codigoContabil, String indContribuicaoPrevidenciaria, String tpDesconto, String cstPis) { + super(); + this.estabelecimento = estabelecimento; + this.chaveEletronica = chaveEletronica; + this.serie = serie; + this.numero = numero; + this.dataEmissao = dataEmissao; + this.situacaoDoc = situacaoDoc; + this.dataPrestacao = dataPrestacao; + this.valorBruto = valorBruto; + this.valorDesconto = valorDesconto; + this.UFOrigem = uFOrigem; + this.municipioOrigem = municipioOrigem; + this.UFDestino = uFDestino; + this.municipioDestino = municipioDestino; + this.cstCofins = cstCofins; + this.receitaTriCofins = receitaTriCofins; + this.tipoBPe = tipoBPe; + this.chaveEletronicaReferencia = chaveEletronicaReferencia; + this.codigoContabil = codigoContabil; + this.indContribuicaoPrevidenciaria = indContribuicaoPrevidenciaria; + this.tpDesconto = tpDesconto; + this.cstPis = cstPis; + } + + public String getEstabelecimento() { + return estabelecimento; + } + + public void setEstabelecimento(String estabelecimento) { + this.estabelecimento = estabelecimento; + } + + public String getChaveEletronica() { + return chaveEletronica; + } + + public void setChaveEletronica(String chaveEletronica) { + this.chaveEletronica = chaveEletronica; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public String getSituacaoDoc() { + return situacaoDoc; + } + + public void setSituacaoDoc(String situacaoDoc) { + this.situacaoDoc = situacaoDoc; + } + + public String getDataPrestacao() { + return dataPrestacao; + } + + public void setDataPrestacao(String dataPrestacao) { + this.dataPrestacao = dataPrestacao; + } + + public BigDecimal getValorBruto() { + return valorBruto; + } + + public void setValorBruto(BigDecimal valorBruto) { + this.valorBruto = valorBruto; + } + + public BigDecimal getValorDesconto() { + return valorDesconto; + } + + public void setValorDesconto(BigDecimal valorDesconto) { + this.valorDesconto = valorDesconto; + } + + public String getUFOrigem() { + return UFOrigem; + } + + public void setUFOrigem(String uFOrigem) { + this.UFOrigem = uFOrigem; + } + + public String getMunicipioOrigem() { + return municipioOrigem; + } + + public void setMunicipioOrigem(String municipioOrigem) { + this.municipioOrigem = municipioOrigem; + } + + public String getUFDestino() { + return UFDestino; + } + + public void setUFDestino(String uFDestino) { + this.UFDestino = uFDestino; + } + + public String getMunicipioDestino() { + return municipioDestino; + } + + public void setMunicipioDestino(String municipioDestino) { + this.municipioDestino = municipioDestino; + } + + public String getCstCofins() { + return cstCofins; + } + + public void setCstCofins(String cstCofins) { + this.cstCofins = cstCofins; + } + + public BigDecimal getReceitaTriCofins() { + return receitaTriCofins; + } + + public void setReceitaTriCofins(BigDecimal receitaTriCofins) { + this.receitaTriCofins = receitaTriCofins; + } + + public String getCstPis() { + return cstPis; + } + + public void setCstPis(String cstPis) { + this.cstPis = cstPis; + } + + public BigDecimal getReceitaTributavelPis() { + return receitaTributavelPis; + } + + public void setReceitaTributavelPis(BigDecimal receitaTributavelPis) { + this.receitaTributavelPis = receitaTributavelPis; + } + + public String getTipoBPe() { + return tipoBPe; + } + + public void setTipoBPe(String tipoBPe) { + this.tipoBPe = tipoBPe; + } + + public String getChaveEletronicaReferencia() { + return chaveEletronicaReferencia; + } + + public void setChaveEletronicaReferencia(String chaveEletronicaReferencia) { + this.chaveEletronicaReferencia = chaveEletronicaReferencia; + } + + public String getCodigoContabil() { + return codigoContabil; + } + + public void setCodigoContabil(String codigoContabil) { + this.codigoContabil = codigoContabil; + } + + public String getIndContribuicaoPrevidenciaria() { + return indContribuicaoPrevidenciaria; + } + + public void setIndContribuicaoPrevidenciaria(String indContribuicaoPrevidenciaria) { + this.indContribuicaoPrevidenciaria = indContribuicaoPrevidenciaria; + } + + public String getTpDesconto() { + return tpDesconto; + } + + public void setTpDesconto(String tpDesconto) { + this.tpDesconto = tpDesconto; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoDPE.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoDPE.java new file mode 100644 index 000000000..339321854 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoDPE.java @@ -0,0 +1,105 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacao.bpe; + +import java.math.BigDecimal; + +public class ExportacaoBPETipoDPE { + + private BigDecimal valor; + private String cfop; + private String cstb; + private String csosnb; + private BigDecimal baseCalculoICMS; + private BigDecimal aliquotaICMS; + private BigDecimal icms; + private BigDecimal isentas; + private BigDecimal outras; + + public ExportacaoBPETipoDPE() { + } + + public ExportacaoBPETipoDPE(BigDecimal valor, String cfop, String cstb, String csosnb, BigDecimal baseCalculoICMS, BigDecimal aliquotaICMS, BigDecimal icms, BigDecimal isentas, BigDecimal outras) { + super(); + this.valor = valor; + this.cfop = cfop; + this.cstb = cstb; + this.csosnb = csosnb; + this.baseCalculoICMS = baseCalculoICMS; + this.aliquotaICMS = aliquotaICMS; + this.icms = icms; + this.isentas = isentas; + this.outras = outras; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public String getCfop() { + return cfop; + } + + public void setCfop(String cfop) { + this.cfop = cfop; + } + + public String getCstb() { + return cstb; + } + + public void setCstb(String cstb) { + this.cstb = cstb; + } + + public String getCsosnb() { + return csosnb; + } + + public void setCsosnb(String csosnb) { + this.csosnb = csosnb; + } + + public BigDecimal getBaseCalculoICMS() { + return baseCalculoICMS; + } + + public void setBaseCalculoICMS(BigDecimal baseCalculoICMS) { + this.baseCalculoICMS = baseCalculoICMS; + } + + public BigDecimal getAliquotaICMS() { + return aliquotaICMS; + } + + public void setAliquotaICMS(BigDecimal aliquotaICMS) { + this.aliquotaICMS = aliquotaICMS; + } + + public BigDecimal getIcms() { + return icms; + } + + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + + public BigDecimal getIsentas() { + return isentas; + } + + public void setIsentas(BigDecimal isentas) { + this.isentas = isentas; + } + + public BigDecimal getOutras() { + return outras; + } + + public void setOutras(BigDecimal outras) { + this.outras = outras; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoOBE.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoOBE.java new file mode 100644 index 000000000..417fa74b5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoOBE.java @@ -0,0 +1,35 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacao.bpe; + +import java.math.BigDecimal; + +public class ExportacaoBPETipoOBE { + + private String codigo; + private BigDecimal valor; + + public ExportacaoBPETipoOBE() { + } + + public ExportacaoBPETipoOBE(String codigo, BigDecimal valor) { + super(); + this.codigo = codigo; + this.valor = valor; + } + + public String getCodigo() { + return codigo; + } + + public void setCodigo(String codigo) { + this.codigo = codigo; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoPRC.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoPRC.java new file mode 100644 index 000000000..a90413cd8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPETipoPRC.java @@ -0,0 +1,65 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacao.bpe; + +import java.math.BigDecimal; + +public class ExportacaoBPETipoPRC { + + private String uf; + private String municipio; + private BigDecimal valor; + private BigDecimal baseCalculoICMS; + private BigDecimal icms; + + public ExportacaoBPETipoPRC() { + } + + public ExportacaoBPETipoPRC(String uf, String municipio, BigDecimal valor, BigDecimal baseCalculoICMS, BigDecimal icms) { + super(); + this.uf = uf; + this.municipio = municipio; + this.valor = valor; + this.baseCalculoICMS = baseCalculoICMS; + this.icms = icms; + } + + public String getUf() { + return uf; + } + + public void setUf(String uf) { + this.uf = uf; + } + + public String getMunicipio() { + return municipio; + } + + public void setMunicipio(String municipio) { + this.municipio = municipio; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public BigDecimal getBaseCalculoICMS() { + return baseCalculoICMS; + } + + public void setBaseCalculoICMS(BigDecimal baseCalculoICMS) { + this.baseCalculoICMS = baseCalculoICMS; + } + + public BigDecimal getIcms() { + return icms; + } + + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEVo.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEVo.java new file mode 100644 index 000000000..f1ceee121 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/ExportacaoBPEVo.java @@ -0,0 +1,406 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacao.bpe; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.xml.BPeUtil; + +import br.inf.portalfiscal.bpe.TBPe; + +public class ExportacaoBPEVo { + + static String VAZIO = ""; + static final BigDecimal ZERO = BigDecimal.ZERO; + static int MOTIVO_CANCELACION_AGRUPACION_CORRIDA = 17; + + public class StatusBpe { + static final String CONTIGENCIA_ENVIADA = "-1"; + static final String VENDA = "100"; + static final String CANCELAMENTO_BPE_HOMOLOGADO = "101"; + static final String SUBSTITUICAO_BPE_HOMOLOGADA = "102"; + static final String VENDA_CONTIGENCIA = "150"; + static final String EVENTOS = "135"; + } + + public class EventosBpe { + static final String CANCELAMENTO = "110111"; + static final String NAO_EMBARQUE = "110115"; + static final String TROCA_POLTRONA = "110116"; + } + + public static class CrtBpe { + static final Integer SIMPLES_NACIONAL = 1; + static final Integer SIMPLES_NACIONAL_EXCESSO_RECEITA_BRUTA = 2; + static final Integer REGIME_NORMAL = 3; + } + + public class TipoComp { + public static final String TARIFA = "01"; + public static final String PEDAGIO = "02"; + public static final String TAXA_EMBARQUE = "03"; + public static final String SEGURO = "04"; + public static final String TAXA_MANUTENCAO_RODOVIA = "05"; + public static final String SERVICO_VENDA_INTEGRADA = "06"; + public static final String OUTROS = "99"; + + } + + private List listaRegistroBaseBPE; + + public ExportacaoBPEVo() { + listaRegistroBaseBPE = new ArrayList(0); + } + + public List getListaRegistroBaseBPE() { + return listaRegistroBaseBPE; + } + + public void setListaRegistroBaseBPE(List listaRegistroBaseBPE) { + this.listaRegistroBaseBPE = listaRegistroBaseBPE; + } + + public static boolean isBpeCancelado(String codstatus) { + return (codstatus == null ? false : (codstatus.equals(StatusBpe.EVENTOS) || codstatus.equals(StatusBpe.CANCELAMENTO_BPE_HOMOLOGADO))); + } + + public static boolean validaBPeCorridaAgrupada(ExportacaoBPEBase registro) { + if (registro.getMotivoCancelacionId() == MOTIVO_CANCELACION_AGRUPACION_CORRIDA) { + return true; + } else { + if (!StringUtils.equals(registro.getDhEmisao(), registro.getDhrecbtoBPe()) + && registro.isActivoBPe() && StringUtils.equals(registro.getCodstatus(), StatusBpe.VENDA)) { + return true; + } else { + return false; + } + } + } + + public static ExportacaoBPEBase gerarListas(ExportacaoBPEBase registro) { + + String indContribuicaoPrevidenciaria = StringUtils.isBlank(registro.getIndContribuicaoPrevidenciaria()) ? "00000060" : StringUtils.leftPad(registro.getIndContribuicaoPrevidenciaria(), 8, "0"); + boolean isCancelamento = isBpeCancelado(registro.getCodstatus()); + String tpDoc = isCancelamento ? "1" : (StringUtils.isBlank(registro.getChbpeSub()) ? "0" : "0"); + String numBpe = StringUtils.isBlank(registro.getNbp()) ? registro.getNumBpe() : registro.getNbp(); + String dhEmisao = registro.getDhEmisao(); + + if (isCancelamento) { + + ExportacaoBPETipoBPE tipoBPE = new ExportacaoBPETipoBPE(registro.getCodEstabelecimento(), + registro.getChbpe(), registro.getNumSerieBpe(), + numBpe, dhEmisao, tpDoc, VAZIO, null, null, + VAZIO, VAZIO, VAZIO, VAZIO, VAZIO, null, VAZIO, VAZIO, VAZIO, + VAZIO, registro.getRetorno(), VAZIO); + registro.getListaRegistroBPE().add(tipoBPE); + + } else { + String municipioOrigem = StringUtils.substring(registro.getCmunini(), 2); + String municipioDestino = StringUtils.substring(registro.getCmunfim(), 2); + String estadoOrigem = registro.getUfini(); + String estadoDestino = registro.getUffim(); + + boolean isInterMunicipal = estadoOrigem.equals(estadoDestino); + String codigoContabil = isInterMunicipal ? registro.getCodigocontabilMunicipal() : registro.getCodigoContabilEstadual(); + + String dataPrestacao = StringUtils.isBlank(registro.getDhemb()) ? registro.getDhrecbto() + : DateUtil.changeFormatStringDate(registro.getDhemb(), DateUtil.formatGMT, DateUtil.formatExp); + + String vBC = null; + String pICMS = null; + String vICMS = null; + String cst = null; + String pRedBC = null; + String vBP = null; + String vDesconto = null; + String vPgto = null; + + String vTxEmbarque = null; + String vPedagio = null; + String vSeguro = null; + + if (StringUtils.isNotBlank(registro.getPicms00())) { + vBC = registro.getVbc00(); + pICMS = registro.getPicms00(); + vICMS = registro.getVicms00(); + } else if (StringUtils.isNotBlank(registro.getPicms20())) { + vBC = registro.getVbc20(); + pICMS = registro.getPicms20(); + vICMS = registro.getVicms20(); + pRedBC = registro.getpRedBC(); + } + + vBP = registro.getVbp(); + vDesconto = registro.getVdesconto(); + vPgto = registro.getVpgto(); + + vPedagio = (isInterMunicipal && !registro.getIndPedadioEstdual()) ? (registro.getVcomp02() == null ? "0.0" : registro.getVcomp02()) : "0.0"; + if (vPedagio.equals("0.0")) + vPedagio = (!isInterMunicipal && !registro.getIndPedagioMunicipal()) ? (registro.getVcomp02() == null ? "0.0" : registro.getVcomp02()) : "0.0"; + + vTxEmbarque = (isInterMunicipal && !registro.getIndTxEmbarqueEstadual()) ? (registro.getVcomp03() == null ? "0.0" : registro.getVcomp03()) : "0.0"; + if (vTxEmbarque.equals("0.0")) + vTxEmbarque = (!isInterMunicipal && !registro.getIndTxEmbarqueMunicipal()) ? (registro.getVcomp03() == null ? "0.0" : registro.getVcomp03()) : "0.0"; + + vSeguro = (isInterMunicipal && !registro.getIndSeguroEstadual()) ? (registro.getVcomp04() == null ? "0.0" : registro.getVcomp04()) : "0.0"; + if (vSeguro.equals("0.0")) + vSeguro = (!isInterMunicipal && !registro.getIndSeguroMunicipal()) ? (registro.getVcomp04() == null ? "0.0" : registro.getVcomp04()) : "0.0"; + + // validar cst enviado + if (StringUtils.isNotBlank(registro.getCst00())) + cst = registro.getCst00(); + else if (StringUtils.isNotBlank(registro.getCst20())) + cst = registro.getCst20(); + else if (StringUtils.isNotBlank(registro.getCst45())) + cst = registro.getCst45(); + else if (StringUtils.isNotBlank(registro.getCst90())) + cst = registro.getCst90(); + else if (StringUtils.isNotBlank(registro.getCstoutrauf())) + cst = registro.getCstoutrauf(); + else if (StringUtils.isNotBlank(registro.getCstsn())) + cst = registro.getCstsn(); + + String cstCofins = "01"; + String cstPis = "01"; + + // dependende dos parametros + BigDecimal valorPago = new BigDecimal(vPgto == null ? "0.0" : vPgto); + BigDecimal txEmbarque = new BigDecimal(vTxEmbarque == null ? "0.0" : vTxEmbarque); + BigDecimal pedagio = new BigDecimal(vPedagio == null ? "0.0" : vPedagio); + BigDecimal seguro = new BigDecimal(vSeguro == null ? "0.0" : vSeguro); + + BigDecimal txExtras = txEmbarque.add(pedagio).add(seguro); + + BigDecimal receitaTriCofins = new BigDecimal(vBC == null ? "0.0" : vBC); + if (pRedBC != null) { + receitaTriCofins = valorPago.subtract(txExtras); + } + + BigDecimal valorBruto = StringUtils.isBlank(vBP) ? registro.getValortotal() : new BigDecimal(vBP == null ? "0.0" : vBP); + BigDecimal desconto = StringUtils.isBlank(vDesconto) ? registro.getvDesconto() : new BigDecimal(vDesconto == null ? "0.0" : vDesconto); + + String chbpeSub = registro.getChbpeSub(); + String tpBpe = StringUtils.isBlank(registro.getChbpeSub()) ? "1" : "2"; + + ExportacaoBPETipoBPE tipoBPE = new ExportacaoBPETipoBPE(registro.getCodEstabelecimento(), registro.getChbpe(), registro.getNumSerieBpe(), + numBpe, dhEmisao, tpDoc, dataPrestacao, valorBruto, + desconto, estadoOrigem, municipioOrigem, estadoDestino, municipioDestino, + cstCofins, receitaTriCofins, tpBpe, chbpeSub, codigoContabil, + indContribuicaoPrevidenciaria, registro.getRetorno(), cstPis); + + registro.getListaRegistroBPE().add(tipoBPE); + + String cfop = isInterMunicipal ? "5357" : "6357"; + + String csosnb = ""; + if (registro.getCrt().equals(CrtBpe.SIMPLES_NACIONAL)) { + csosnb = CrtBpe.SIMPLES_NACIONAL.toString(); + csosnb = UtiliteriasFiscal.formataNumerico(csosnb, 3); + } else if (registro.getCrt().equals(CrtBpe.SIMPLES_NACIONAL_EXCESSO_RECEITA_BRUTA)) { + csosnb = CrtBpe.SIMPLES_NACIONAL_EXCESSO_RECEITA_BRUTA.toString(); + csosnb = UtiliteriasFiscal.formataNumerico(csosnb, 3); + } + + BigDecimal baseCalculoICMS = new BigDecimal(vBC == null ? "0.0" : vBC); + BigDecimal aliquotaICMS = new BigDecimal(pICMS == null ? "0.0" : pICMS); + BigDecimal icms = new BigDecimal(vICMS == null ? "0.0" : vICMS); + + BigDecimal isentas = registro.getValortotal().subtract(baseCalculoICMS); + if (pRedBC != null) { + isentas = txExtras; + } + + BigDecimal outras = new BigDecimal(pRedBC == null ? "0.0" : pRedBC); + if (pRedBC != null) { + outras = valorPago.subtract(baseCalculoICMS); + outras = outras.subtract(isentas); + } + + ExportacaoBPETipoDPE tipoDPE = new ExportacaoBPETipoDPE(registro.getValortotal(), cfop, cst, csosnb, + baseCalculoICMS, aliquotaICMS, icms, isentas, outras); + registro.getListaRegistroDPE().add(tipoDPE); + + } + + return registro; + } + + /* + * Apos a implementação dos novos campos na taleta BPE na venda não utilizar mais este metodo para importação de dados BPe + */ + @Deprecated + public static ExportacaoBPEBase gerarListasXML(ExportacaoBPEBase registro) { + + String indContribuicaoPrevidenciaria = StringUtils.isBlank(registro.getIndContribuicaoPrevidenciaria()) ? "00000060" : StringUtils.leftPad(registro.getIndContribuicaoPrevidenciaria(), 8, "0"); + + boolean isCancelamento = isBpeCancelado(registro.getCodstatus()); + + String numBpe = registro.getNumBpe(); + String tpDoc = isCancelamento ? "1" : (StringUtils.isBlank(registro.getChbpeSub()) ? "0" : "0"); + String dhEmisao = registro.getDhEmisao(); + + if (isCancelamento) { + ExportacaoBPETipoBPE tipoBPE = new ExportacaoBPETipoBPE(registro.getCodEstabelecimento(), registro.getChbpe(), registro.getNumSerieBpe(), + numBpe, dhEmisao, tpDoc, VAZIO, null, null, + VAZIO, VAZIO, VAZIO, VAZIO, VAZIO, null, VAZIO, VAZIO, VAZIO, + VAZIO, registro.getRetorno(), VAZIO); + + registro.getListaRegistroBPE().add(tipoBPE); + + } else { + + TBPe tbpe = null; + String xml = StringUtils.isNotBlank(registro.getXmlAnterior()) ? registro.getXmlAnterior() : registro.getXml(); + + if (StringUtils.isNotBlank(xml)) + tbpe = BPeUtil.convertXmlToBpe(xml); + + String municipioOrigem = StringUtils.substring((StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getCMunIni() : registro.getMunicipioOrigem()), 2); + String municipioDestino = StringUtils.substring((StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getCMunFim() : registro.getMunicipioDestino()), 2); + String estadoOrigem = (StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getUFIni().value() : registro.getEstadoOrigem()); + String estadoDestino = (StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getUFFim().value() : registro.getEstadoDestino()); + + boolean isInterMunicipal = estadoOrigem.equals(estadoDestino); + String codigoContabil = isInterMunicipal ? registro.getCodigocontabilMunicipal() : registro.getCodigoContabilEstadual(); + numBpe = StringUtils.isNotBlank(xml) ? tbpe.getInfBPe().getIde().getNBP() : registro.getNumBpe(); + String dataPrestacao = StringUtils.isBlank(xml) ? registro.getDhrecbto() + : DateUtil.changeFormatStringDate(tbpe.getInfBPe().getInfPassagem().getDhEmb(), DateUtil.formatGMT, DateUtil.formatExp); + + String vBC = null; + String pICMS = null; + String vICMS = null; + String cst = null; + String pRedBC = null; + String vBP = null; + String vDesconto = null; + String vPgto = null; + + String vTxEmbarque = null; + String vPedagio = null; + String vSeguro = null; + + if (StringUtils.isNotBlank(xml)) { + if (tbpe.getInfBPe().getImp().getICMS().getICMS00() != null) { + vBC = tbpe.getInfBPe().getImp().getICMS().getICMS00().getVBC(); + pICMS = tbpe.getInfBPe().getImp().getICMS().getICMS00().getPICMS(); + vICMS = tbpe.getInfBPe().getImp().getICMS().getICMS00().getVICMS(); + } else if (tbpe.getInfBPe().getImp().getICMS().getICMS20() != null) { + vBC = tbpe.getInfBPe().getImp().getICMS().getICMS20().getVBC(); + pICMS = tbpe.getInfBPe().getImp().getICMS().getICMS20().getPICMS(); + vICMS = tbpe.getInfBPe().getImp().getICMS().getICMS20().getVICMS(); + pRedBC = tbpe.getInfBPe().getImp().getICMS().getICMS20().getPRedBC(); + } + + if (tbpe.getInfBPe().getInfValorBPe() != null) { + vBP = tbpe.getInfBPe().getInfValorBPe().getVBP(); + vDesconto = tbpe.getInfBPe().getInfValorBPe().getVDesconto(); + vPgto = tbpe.getInfBPe().getInfValorBPe().getVPgto(); + + for (TBPe.InfBPe.InfValorBPe.Comp comp : tbpe.getInfBPe().getInfValorBPe().getComp()) { + + if (comp.getTpComp().equals(TipoComp.PEDAGIO)) { + vPedagio = (isInterMunicipal && !registro.getIndPedadioEstdual()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; + if (vPedagio.equals("0.0")) + vPedagio = (!isInterMunicipal && !registro.getIndPedagioMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; + } + + if (comp.getTpComp().equals(TipoComp.TAXA_EMBARQUE)) { + vTxEmbarque = (isInterMunicipal && !registro.getIndTxEmbarqueEstadual()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; + if (vTxEmbarque.equals("0.0")) + vTxEmbarque = (!isInterMunicipal && !registro.getIndTxEmbarqueMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; + } + + if (comp.getTpComp().equals(TipoComp.SEGURO)) { + vSeguro = (isInterMunicipal && !registro.getIndSeguroEstadual()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; + if (vSeguro.equals("0.0")) + vSeguro = (!isInterMunicipal && !registro.getIndSeguroMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0"; + } + } + } + + // validar cst enviado + if (tbpe.getInfBPe().getImp().getICMS().getICMS00() != null) + cst = tbpe.getInfBPe().getImp().getICMS().getICMS00().getCST(); + else if (tbpe.getInfBPe().getImp().getICMS().getICMS20() != null) + cst = tbpe.getInfBPe().getImp().getICMS().getICMS20().getCST(); + else if (tbpe.getInfBPe().getImp().getICMS().getICMS45() != null) + cst = tbpe.getInfBPe().getImp().getICMS().getICMS45().getCST(); + else if (tbpe.getInfBPe().getImp().getICMS().getICMS90() != null) + cst = tbpe.getInfBPe().getImp().getICMS().getICMS90().getCST(); + else if (tbpe.getInfBPe().getImp().getICMS().getICMSOutraUF() != null) + cst = tbpe.getInfBPe().getImp().getICMS().getICMSOutraUF().getCST(); + else if (tbpe.getInfBPe().getImp().getICMS().getICMSSN() != null) + cst = tbpe.getInfBPe().getImp().getICMS().getICMSSN().getCST(); + + } + + String cstCofins = "01"; + String cstPis = "01"; + + // dependende dos parametros + BigDecimal valorPago = new BigDecimal(vPgto == null ? "0.0" : vPgto); + BigDecimal txEmbarque = new BigDecimal(vTxEmbarque == null ? "0.0" : vTxEmbarque); + BigDecimal pedagio = new BigDecimal(vPedagio == null ? "0.0" : vPedagio); + BigDecimal seguro = new BigDecimal(vSeguro == null ? "0.0" : vSeguro); + + BigDecimal txExtras = txEmbarque.add(pedagio).add(seguro); + + BigDecimal receitaTriCofins = new BigDecimal(vBC == null ? "0.0" : vBC); + if (pRedBC != null) { + receitaTriCofins = valorPago.subtract(txExtras); + } + + BigDecimal valorBruto = StringUtils.isBlank(xml) ? registro.getValortotal() : new BigDecimal(vBP == null ? "0.0" : vBP); + BigDecimal desconto = StringUtils.isBlank(xml) ? registro.getvDesconto() : new BigDecimal(vDesconto == null ? "0.0" : vDesconto); + + String chbpeSub = StringUtils.isBlank(xml) ? "" : (tbpe.getInfBPe().getInfBPeSub() == null ? "" : tbpe.getInfBPe().getInfBPeSub().getChBPe()); + String tpBpe = StringUtils.isBlank(xml) ? "" : (StringUtils.isBlank(tbpe.getInfBPe().getInfBPeSub() == null ? "" : tbpe.getInfBPe().getInfBPeSub().getChBPe()) ? "1" : "2"); + + ExportacaoBPETipoBPE tipoBPE = new ExportacaoBPETipoBPE(registro.getCodEstabelecimento(), registro.getChbpe(), registro.getNumSerieBpe(), + numBpe, dhEmisao, tpDoc, dataPrestacao, valorBruto, + desconto, estadoOrigem, municipioOrigem, estadoDestino, municipioDestino, + cstCofins, receitaTriCofins, tpBpe, chbpeSub, codigoContabil, + indContribuicaoPrevidenciaria, registro.getRetorno(), cstPis); + + registro.getListaRegistroBPE().add(tipoBPE); + + String cfop = isInterMunicipal ? "5357" : "6357"; + + String csosnb = ""; + if (registro.getCrt().equals(CrtBpe.SIMPLES_NACIONAL)) { + csosnb = CrtBpe.SIMPLES_NACIONAL.toString(); + csosnb = UtiliteriasFiscal.formataNumerico(csosnb, 3); + } else if (registro.getCrt().equals(CrtBpe.SIMPLES_NACIONAL_EXCESSO_RECEITA_BRUTA)) { + csosnb = CrtBpe.SIMPLES_NACIONAL_EXCESSO_RECEITA_BRUTA.toString(); + csosnb = UtiliteriasFiscal.formataNumerico(csosnb, 3); + } + + BigDecimal baseCalculoICMS = new BigDecimal(vBC == null ? "0.0" : vBC); + BigDecimal aliquotaICMS = new BigDecimal(pICMS == null ? "0.0" : pICMS); + BigDecimal icms = new BigDecimal(vICMS == null ? "0.0" : vICMS); + + BigDecimal isentas = registro.getValortotal().subtract(baseCalculoICMS); + if (pRedBC != null) { + isentas = txExtras; + } + + BigDecimal outras = new BigDecimal(pRedBC == null ? "0.0" : pRedBC); + if (pRedBC != null) { + outras = valorPago.subtract(baseCalculoICMS); + outras = outras.subtract(isentas); + } + + ExportacaoBPETipoDPE tipoDPE = new ExportacaoBPETipoDPE(registro.getValortotal(), cfop, cst, csosnb, + baseCalculoICMS, aliquotaICMS, icms, isentas, outras); + registro.getListaRegistroDPE().add(tipoDPE); + + } + + return registro; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/xml/BPeUtil.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/xml/BPeUtil.java new file mode 100644 index 000000000..c74ec00d5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/xml/BPeUtil.java @@ -0,0 +1,164 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.xml; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import javax.xml.transform.stream.StreamSource; + +import org.apache.commons.io.IOUtils; +import org.apache.log4j.Logger; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.ExportacaoBPEVo; +import com.rjconsultores.ventaboletos.vo.bpe.BPeVO; + +import br.inf.portalfiscal.bpe.TBPe; + +public class BPeUtil { + + private static Logger log = Logger.getLogger(ExportacaoBPEVo.class); + + public static TBPe convertXmlToBpe(String xml) { + TBPe objeto = null; + if (xml != null) { + try { + JAXBContext jc = JAXBContext.newInstance(TBPe.class); + Unmarshaller unmarshaller = jc.createUnmarshaller(); + InputStream input = new ByteArrayInputStream(xml.getBytes(Constantes.UTF_8)); + StreamSource source = new StreamSource(input); + objeto = (TBPe) unmarshaller.unmarshal(source); + } catch (JAXBException e) { + log.info("Nao encontrou o xml bpe"); + } catch (UnsupportedEncodingException e) { + log.info("Nao encontrou o xml bpe"); + } + } + return objeto; + } + + public static Map convertBPeXmlRegularToArquivoXml(BPeVO bpe) { + try { + String complemento = "BPeRecepacao_E"; + String nomeArquivo = getNomeArquivo(bpe, complemento); + return gerarArquivo(bpe.getXmlEnvio(), nomeArquivo); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + return null; + } + + public static Map convertBPeXmlRepostaToArquivoXml(BPeVO bpe) { + try { + String complemento = "BPeRecepacao_R"; + String nomeArquivo = getNomeArquivo(bpe, complemento); + return gerarArquivo(bpe.getXmlResposta(), nomeArquivo); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + return null; + } + + public static Map convertBPeXmlRegularEventoToArquivoXml(BPeVO bpe) { + try { + String complemento = "BPeRecepacaoEvento_" + bpe.getTipoevento() + "_E"; + String nomeArquivo = getNomeArquivo(bpe, complemento); + return gerarArquivo(bpe.getXmlEnvio(), nomeArquivo); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + return null; + } + + public static Map convertBPeXmlRepostaEventoToArquivoXml(BPeVO bpe) { + try { + String complemento = "BPeRecepacaoEvento_" + bpe.getTipoevento() + "_R"; + String nomeArquivo = getNomeArquivo(bpe, complemento); + return gerarArquivo(bpe.getXmlResposta(), nomeArquivo); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + return null; + } + + private static Map gerarArquivo(String xml, String nomeArquivo) throws IOException { + InputStream file = IOUtils.toInputStream(xml, Constantes.UTF_8); + Map arquivo = new HashMap(); + arquivo.put(nomeArquivo, file); + return arquivo; + } + + private static String getNomeArquivo(BPeVO bpe, String complemento) { + StringBuilder nomeArquivo = new StringBuilder(); + nomeArquivo.append(DateUtil.getStringDate(bpe.getFechorventa(), "yyyyMMddHHmmss")) + .append("_") + .append(bpe.getChbpe()) + .append("_") + .append(bpe.getNumserieBpe()) + .append("_") + .append(bpe.getNumBpe()) + .append("_") + .append(complemento) + .append(".xml"); + + return nomeArquivo.toString(); + + } + + public static byte[] zipFiles(Map arquivos) { + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ZipOutputStream outputStream = new ZipOutputStream(baos); + InputStream inputStream = null; + + try { + for (Entry arquivo : arquivos.entrySet()) { + outputStream.putNextEntry(new ZipEntry(arquivo.getKey())); + byte[] readBuff = new byte[4096]; + int readLen = -1; + + while ((readLen = arquivo.getValue().read(readBuff)) != -1) { + outputStream.write(readBuff, 0, readLen); + } + outputStream.closeEntry(); + arquivo.getValue().close(); + } + + outputStream.finish(); + + } catch (Exception e) { + log.error(e.getMessage(), e); + + } finally { + if (outputStream != null) { + try { + outputStream.close(); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + } + + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + } + } + + return baos.toByteArray(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/xml/BpeBuscaCamposXml.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/xml/BpeBuscaCamposXml.java new file mode 100644 index 000000000..2507aba3e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacao/bpe/xml/BpeBuscaCamposXml.java @@ -0,0 +1,105 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacao.bpe.xml; + +import org.json.JSONObject; +import org.json.XML; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; + +public class BpeBuscaCamposXml { + + private static BpeBuscaCamposXml instance = null; + private String json; + + protected BpeBuscaCamposXml(String xml) { + controiJson(xml); + } + + public static BpeBuscaCamposXml getInstance(String xml) { + if (instance == null) { + instance = new BpeBuscaCamposXml(xml); + } + return instance; + } + + private void controiJson(String xml) { + if (xml != null) { + try { + JSONObject xmlJSONObj = XML.toJSONObject(xml); + this.json = xmlJSONObj.toString(4); + } catch (Exception je) { + je.printStackTrace(); + } + } + } + + public String buscaCamposXml(String campo) { + try { + + JsonElement root = new JsonParser().parse(json); + String resp = null; + if (campo.equals("CST")) + resp = root.getAsJsonObject().get("BPe").getAsJsonObject().get("infBPe").getAsJsonObject().get("imp") + .getAsJsonObject().get("ICMS").getAsJsonObject().get("ICMS00").getAsJsonObject().get("CST").toString(); + if (campo.equals("pICMS")) + resp = root.getAsJsonObject().get("BPe").getAsJsonObject().get("infBPe").getAsJsonObject().get("imp") + .getAsJsonObject().get("ICMS").getAsJsonObject().get("ICMS00").getAsJsonObject().get("pICMS").toString(); + if (campo.equals("vICMS")) + resp = root.getAsJsonObject().get("BPe").getAsJsonObject().get("infBPe").getAsJsonObject().get("imp") + .getAsJsonObject().get("ICMS").getAsJsonObject().get("ICMS00").getAsJsonObject().get("vICMS").toString(); + if (campo.equals("vBC")) + resp = root.getAsJsonObject().get("BPe").getAsJsonObject().get("infBPe").getAsJsonObject().get("imp") + .getAsJsonObject().get("ICMS").getAsJsonObject().get("ICMS00").getAsJsonObject().get("vBC").toString(); + if (campo.equals("UFIni")) + resp = root.getAsJsonObject().get("BPe").getAsJsonObject().get("infBPe").getAsJsonObject().get("ide") + .getAsJsonObject().get("UFIni").toString(); + if (campo.equals("vBP")) + resp = root.getAsJsonObject().get("BPe").getAsJsonObject().get("infBPe").getAsJsonObject().get("infValorBPe") + .getAsJsonObject().get("vBP").toString(); + + resp = resp.replace("\"", ""); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public String[] buscaCamposXmlArray(String campo) { + try { + JsonElement root = new JsonParser().parse(json); + JsonArray array = null; + + array = root.getAsJsonObject().get("BPe").getAsJsonObject().get("infBPe").getAsJsonObject().get("infValorBPe") + .getAsJsonObject().get("Comp").getAsJsonArray(); + + if (campo.equals("tpComp")) { + String[] a = new String[array.size()]; + int cont = 0; + for (JsonElement jsonElement : array) { + String aux = jsonElement.getAsJsonObject().get("tpComp").toString(); + aux = aux.replace("\"", ""); + a[cont] = aux; + cont++; + } + return a; + } + + if (campo.equals("vComp")) { + String[] a = new String[array.size()]; + int cont = 0; + for (JsonElement jsonElement : array) { + String aux = jsonElement.getAsJsonObject().get("vComp").toString(); + aux = aux.replace("\"", ""); + a[cont] = aux; + cont++; + } + return a; + } + } catch (Exception e) { + e.printStackTrace(); + } + return null; + + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/ExportacaoFiscal.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/ExportacaoFiscal.java new file mode 100644 index 000000000..f36fd1f7a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/ExportacaoFiscal.java @@ -0,0 +1,890 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoCCF; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoCFC; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoICF; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoECFTipoPRC; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoBPS; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoDBP; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoPAR; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoRMD; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoSeqBPS; +import com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo.ExportacaoRMDTipoSeqDBP; + +@Service("exportacaoFiscal") +public class ExportacaoFiscal { + private static Logger log = Logger.getLogger(ExportacaoFiscal.class); + + private static String VAZIO = ""; + private static String SEPARADOR = "|"; + + public ExportacaoFiscal() { + + } + + public File gerarArquivoECF(final List tempos, String nomeArquivo, final Date dataInicial, final Date dataFinal, final String estado, final String nomeEmpresa, final List listaRegistroECFTipoCFC, + final List listaRegistroECFTipoCCF, final List listaRegistroECFTipoICF, final List listaRegistroECFTipoPRC) { + try { +// String nomeArquivo = "fiscal_vendas_impressas_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + + File arquivo = File.createTempFile(nomeArquivo + "-", ".fs"); + + PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivo), Constantes.UTF_8)); + +// for (String tempo : tempos) { +// writer.print("-- " + tempo + UtiliteriasFiscal.QUEBRA_LINHA); +// } + + adicionarRegistroECFTipoCAB(writer, dataInicial, dataFinal, nomeEmpresa, nomeArquivo); +// adicionarRegistroECFTipoCFC(writer, listaRegistroECFTipoCFC); +// adicionarRegistroECFTipoCCF(writer, listaRegistroECFTipoCCF); +// adicionarRegistroECFTipoICF(writer, listaRegistroECFTipoICF); +// adicionarRegistroECFTipoPRC(writer, listaRegistroECFTipoPRC); + adicionarRegistroECF(writer, listaRegistroECFTipoCFC, listaRegistroECFTipoCCF, listaRegistroECFTipoICF, listaRegistroECFTipoPRC); + + writer.close(); + + return arquivo; + + } catch (IOException e) { + log.error( e.getMessage(), e); + } + + return null; + } + + private void adicionarRegistroECFTipoCAB(final PrintWriter writer, final Date dataInicial, final Date dataFinal, final String nomeEmpresa, final String arquivo) { + StringBuilder sb = new StringBuilder(); + sb.append("CAB").append(SEPARADOR); + sb.append("116").append(SEPARADOR); + sb.append("TotalBus").append(SEPARADOR); + sb.append(new SimpleDateFormat("yyyyMMdd").format(new Date())).append(SEPARADOR); + sb.append(formataCaracter(nomeEmpresa, false, 15)).append(SEPARADOR); + sb.append(new SimpleDateFormat("yyyyMMdd").format(dataInicial)).append(SEPARADOR); + sb.append(new SimpleDateFormat("yyyyMMdd").format(dataFinal)).append(SEPARADOR); + sb.append(arquivo).append(SEPARADOR); + sb.append("N"); + + writer.print(sb.toString() + UtiliteriasFiscal.QUEBRA_LINHA); + } + +// @SuppressWarnings("unused") +// private void adicionarRegistroECFTipoCFC(PrintWriter writer, final List listaRegistroECFTipoCFC) { +// for (ExportacaoECFTipoCFC registro : listaRegistroECFTipoCFC) { +// adicionarLinhaCFC(writer, registro); +// } +// } +// +// @SuppressWarnings("unused") +// private void adicionarRegistroECFTipoCCF(PrintWriter writer, final List listaRegistroECFTipoCCF) { +// for (ExportacaoECFTipoCCF registro : listaRegistroECFTipoCCF) { +// adicionarLinhaCCF(writer, registro); +// } +// } +// +// @SuppressWarnings("unused") +// private void adicionarRegistroECFTipoICF(PrintWriter writer, final List listaRegistroECFTipoICF) { +// for (ExportacaoECFTipoICF registro : listaRegistroECFTipoICF) { +// adicionarLinhaICF(writer, registro); +// } +// } +// +// @SuppressWarnings("unused") +// private void adicionarRegistroECFTipoPRC(PrintWriter writer, final List listaRegistroECFTipoPRC) { +// for (ExportacaoECFTipoPRC registro : listaRegistroECFTipoPRC) { +// adicionarLinhaPRC(writer, registro); +// } +// } + + private void adicionarRegistroECF(PrintWriter writer, final List listaRegistroECFTipoCFC, final List listaRegistroECFTipoCCF, + List listaRegistroECFTipoICF, List listaRegistroECFTipoPRC) { + Map> groupCCF = new HashMap>(); + Map> groupICF = new HashMap>(); + Map> groupPRC = new HashMap>(); + + List itensCCF = new ArrayList(); + List itensICF = new ArrayList(); + List itensPRC = new ArrayList(); + + for (ExportacaoECFTipoCCF registro : listaRegistroECFTipoCCF) { + itensCCF = new ArrayList(); + + if (groupCCF.containsKey(registro.getEcf() + "|" + registro.getDataEmissao())) { + itensCCF.addAll(groupCCF.get(registro.getEcf() + "|" + registro.getDataEmissao())); + } + + itensCCF.add(registro); + + groupCCF.put(registro.getEcf() + "|" + registro.getDataEmissao(), itensCCF); + } + + for (ExportacaoECFTipoICF registro : listaRegistroECFTipoICF) { + itensICF = new ArrayList(); + + if (groupICF.containsKey(registro.getEcf() + "|" + registro.getDataEmissao())) { + itensICF.addAll(groupICF.get(registro.getEcf() + "|" + registro.getDataEmissao())); + } + + itensICF.add(registro); + + groupICF.put(registro.getEcf() + "|" + registro.getDataEmissao(), itensICF); + } + + for (ExportacaoECFTipoPRC registro : listaRegistroECFTipoPRC) { + itensPRC = new ArrayList(); + + if (groupPRC.containsKey(registro.getEcf() + "|" + registro.getDataEmissao())) { + itensPRC.addAll(groupPRC.get(registro.getEcf() + "|" + registro.getDataEmissao())); + } + + itensPRC.add(registro); + + groupPRC.put(registro.getEcf() + "|" + registro.getDataEmissao(), itensPRC); + } + + int linhas = 2; + + Map valoresBaseCalculoICMS = new HashMap(0); + + Map totalBaseCalculoICMS = new HashMap(0); + + for (ExportacaoECFTipoCFC registro : listaRegistroECFTipoCFC) { + adicionarLinhaCFC(writer, registro); + + linhas++; + + if (registro.getEstabelecimentoECF() == null) { + log.info("- Estabelecimento da ECF indefinido para a ECF [" + registro.getEcf() + "]"); + } + + if (registro.getNumeroIdentificacaoECF() == null) { + log.info("- Número de identificação da ECF indefinido para a ECF [" + registro.getEcf() + "]"); + } + + itensCCF = groupCCF.get(registro.getEcf() + "|" + registro.getDataEmissao()); + + totalBaseCalculoICMS.clear(); + valoresBaseCalculoICMS.clear(); + + if (itensCCF != null) { + for (ExportacaoECFTipoCCF itemCCF : itensCCF) { + BigDecimal baseCalculoICMS = BigDecimal.ZERO; + BigDecimal valorBaseCalculoICMS = itemCCF.getValorBaseCalculoICMS() == null ? BigDecimal.ZERO : itemCCF.getValorBaseCalculoICMS(); + + String key = itemCCF.getEcf() + "|" + itemCCF.getUfDestino() + "|" + itemCCF.getMunicipioOrigem(); + + if (valoresBaseCalculoICMS.containsKey(key)) { + baseCalculoICMS = valoresBaseCalculoICMS.get(key); + } + + baseCalculoICMS = baseCalculoICMS.add(valorBaseCalculoICMS.setScale(2, BigDecimal.ROUND_HALF_EVEN)); + + valoresBaseCalculoICMS.put(key, baseCalculoICMS); + + adicionarLinhaCCF(writer, itemCCF); + + linhas++; + + BigDecimal valor = BigDecimal.ZERO; + + if (totalBaseCalculoICMS.containsKey(itemCCF.getMunicipioOrigem())) { + valor = totalBaseCalculoICMS.get(itemCCF.getMunicipioOrigem()); + } + + valor = valor.add(valorBaseCalculoICMS.setScale(2, BigDecimal.ROUND_HALF_EVEN)); + + totalBaseCalculoICMS.put(itemCCF.getMunicipioOrigem(), valor); + } + } + + BigDecimal valorBaseCalculoICMS = BigDecimal.ZERO; + + itensICF = groupICF.get(registro.getEcf() + "|" + registro.getDataEmissao()); + + if (itensICF != null) { + for (ExportacaoECFTipoICF itemICF : itensICF) { + valorBaseCalculoICMS = BigDecimal.ZERO; + + if (valoresBaseCalculoICMS.containsKey(itemICF.getEcf() + "|" + itemICF.getUfDestino() + "|" + itemICF.getMunicipioOrigem())) { + valorBaseCalculoICMS = valoresBaseCalculoICMS.get(itemICF.getEcf() + "|" + itemICF.getUfDestino() + "|" + itemICF.getMunicipioOrigem()); + } + + adicionarLinhaICF(writer, itemICF, valorBaseCalculoICMS); + + linhas++; + } + } + + itensPRC = groupPRC.get(registro.getEcf() + "|" + registro.getDataEmissao()); + + if (itensPRC != null) { + for (ExportacaoECFTipoPRC itemPRC : itensPRC) { + adicionarLinhaPRC(writer, itemPRC, totalBaseCalculoICMS); + + linhas++; + } + } + } + + writer.print("TRA|" + linhas + UtiliteriasFiscal.QUEBRA_LINHA); + } + + private void adicionarLinhaCFC(PrintWriter writer, ExportacaoECFTipoCFC registro) { + String estabelecimento = registro.getEstabelecimento(); + String dataEmissao = registro.getDataEmissao(); + String numeroIdentificacaoECF = registro.getNumeroIdentificacaoECF(); + Integer cooReducaoZ = registro.getCooReducaoZ(); + Integer cooInicial = registro.getCooInicial(); + Integer cooFinal = registro.getCooFinal(); + Integer contadorReducao = registro.getContadorReducao(); + Integer cro = registro.getCro(); + BigDecimal valorTotal = registro.getValorTotal(); + BigDecimal valorIsentas = registro.getValorIsentas(); + String estabelecimentoECF = registro.getEstabelecimentoECF(); + String infoPadraoBilhetePassagem = registro.getInfoPadraoBilhetePassagem(); + String numeroSerie = registro.getNumeroSerie(); + + StringBuilder sb = new StringBuilder(); + sb.append("CFC").append(SEPARADOR); + sb.append(formataCaracter(estabelecimento, false, 4)).append(SEPARADOR); + sb.append(formataCaracter(dataEmissao, true, 8)).append(SEPARADOR); + sb.append(formataCaracter(numeroIdentificacaoECF, false, 3)).append(SEPARADOR); + sb.append(formataNumerico(cooReducaoZ, true, 6)).append(SEPARADOR); + sb.append(formataNumerico(cooInicial, true, 6)).append(SEPARADOR); + sb.append(formataNumerico(cooFinal, true, 6)).append(SEPARADOR); + sb.append(formataNumerico(contadorReducao, true, 6)).append(SEPARADOR); + sb.append(formataNumerico(cro, true, 6)).append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 12 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 13 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 14 + sb.append(formataValor(valorIsentas, 15)).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 16 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 17 + sb.append("N").append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 25)).append(SEPARADOR); // Posição 19 + sb.append(formataCaracter(VAZIO, false, 3)).append(SEPARADOR); // Posição 20 + sb.append(formataCaracter(VAZIO, false, 3)).append(SEPARADOR); // Posição 21 + sb.append(formataCaracter(VAZIO, false, 6)).append(SEPARADOR); // Posição 22 + sb.append(formataCaracter(VAZIO, false, 2)).append(SEPARADOR); // Posição 23 + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 26 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 27 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 28 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 29 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 30 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 31 + sb.append("").append(SEPARADOR); // Posição 32 + sb.append("V").append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 34 + sb.append(formataCaracter(estabelecimentoECF, false, 4)).append(SEPARADOR); + sb.append(formataCaracter(infoPadraoBilhetePassagem, false, 8)); + /*sb.append(formataCaracter(numeroSerie, false, 6))*/; + + writer.print(sb.toString() + UtiliteriasFiscal.QUEBRA_LINHA); + } + + private void adicionarLinhaCCF(PrintWriter writer, ExportacaoECFTipoCCF item) { + Integer coo = item.getCoo(); + BigDecimal valorServico = item.getValorServico(); + BigDecimal descontoGlobal = item.getDescontoGlobal(); + Integer codigoParticipante = item.getCodigoParticipante(); + Integer situacaoCOO = item.getSituacaoCOO(); // 0 - Documento Regular; 2 - Documento Cancelado + BigDecimal acrescimo = item.getAcrescimo(); + String ufOrigem = item.getUfOrigem(); + String municipioOrigem = item.getMunicipioOrigem() == null ? null : item.getMunicipioOrigem().toString(); + String ufDestino = item.getUfDestino(); + Integer cfop = item.getCfop(); // IM=5357; Serviço IE= 6357 + Integer codigoSituacaoTribColunaB = item.getCodigoSituacaoTribColunaB(); // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + BigDecimal valorTotal = item.getValorTotal(); + Integer tributacaoICMS = item.getTributacaoICMS(); // 1 - Demais; 2 - Região Metropolitanao ou seja, quando o campo CSTB for "40", esse campo deve vir "2". Do contrário, deve vir "1" + BigDecimal valorBaseCalculoICMS = item.getValorBaseCalculoICMS(); + BigDecimal aliquotaICMS = item.getAliquotaICMS(); + String numFolioSistema = item.getNumFolioSistema(); + + if (municipioOrigem != null && municipioOrigem.length() > 5) { + municipioOrigem = municipioOrigem.substring(municipioOrigem.length() - 5, municipioOrigem.length()); + } + + StringBuilder sb = new StringBuilder(); + sb.append("CCF").append(SEPARADOR); + sb.append(formataNumerico(coo, true, 6)).append(SEPARADOR); + sb.append(formataValor(valorServico, 15)).append(SEPARADOR); + sb.append(descontoGlobal == null ? "" : formataValor(descontoGlobal, 15)).append(SEPARADOR); + sb.append(codigoParticipante == null ? "" : formataNumerico(codigoParticipante, true, 15)).append(SEPARADOR); + sb.append(formataNumerico(situacaoCOO, true, 1)).append(SEPARADOR); + sb.append(acrescimo == null ? "" : formataValor(acrescimo, 15)).append(SEPARADOR); + sb.append(formataCaracter(ufOrigem, true, 2)).append(SEPARADOR); + sb.append(formataNumerico(municipioOrigem, true, 5)).append(SEPARADOR); + sb.append(formataCaracter(ufDestino, true, 2)).append(SEPARADOR); + sb.append(formataNumerico(cfop, true, 4)).append(SEPARADOR); + sb.append("0").append(SEPARADOR); + sb.append(codigoSituacaoTribColunaB == 0 ? "00" : formataNumerico(codigoSituacaoTribColunaB, true, 2)).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 1)).append(SEPARADOR); // Posição 14 + sb.append(formataCaracter(VAZIO, false, 1)).append(SEPARADOR); // Posição 15 + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataNumerico(tributacaoICMS, true, 1)).append(SEPARADOR); + sb.append(valorBaseCalculoICMS == null ? "" : formataValor(valorBaseCalculoICMS, 15)).append(SEPARADOR); + sb.append(formataValor(aliquotaICMS, 5)).append(SEPARADOR); + sb.append("01").append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 5)).append(SEPARADOR); // Posição 22 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 23 + sb.append(formataCaracter(VAZIO, false, 3)).append(SEPARADOR); // Posição 24 + sb.append("01").append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 5)).append(SEPARADOR); // Posição 27 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 28 + sb.append(formataCaracter(VAZIO, false, 3)); // Posição 29 + + writer.print(sb.toString() + UtiliteriasFiscal.QUEBRA_LINHA); + } + + private void adicionarLinhaICF(PrintWriter writer, ExportacaoECFTipoICF item, BigDecimal valorBaseCalculoICMS) { + BigDecimal valorTotal = item.getValorTotal(); + String ufDestino = item.getUfDestino(); + Integer cfop = item.getCfop(); // IM=5357; Serviço IE= 6357 + // BigDecimal valorBaseCalculoICMS = item.getValorBaseCalculoICMS(); + BigDecimal aliquotaICMS = item.getAliquotaICMS(); + BigDecimal valorICMSIsento = item.getValorICMSIsento(); + // BigDecimal valorICMSOutros = item.getValorICMSOutros(); + + // BigDecimal valorICMSDebitado = item.getValorICMSDebitado(); + BigDecimal valorICMSDebitado = BigDecimal.ZERO; + if (item.getAliquotaICMS() != null) { + BigDecimal aTributacao_importacao = MoneyHelper.dividir(item.getAliquotaICMS(), BigDecimal.valueOf(100d)); + valorICMSDebitado = MoneyHelper.multiplicar(valorBaseCalculoICMS, aTributacao_importacao); + } + + BigDecimal difValorTotalICMS = valorTotal.subtract(valorBaseCalculoICMS); + + Integer codigoSituacaoTribColunaB = item.getCodigoSituacaoTribColunaB(); // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + String ufOrigem = item.getUfOrigem(); + String municipioOrigem = item.getMunicipioOrigem() == null ? null : item.getMunicipioOrigem().toString(); + + if (municipioOrigem != null && municipioOrigem.length() > 5) { + municipioOrigem = municipioOrigem.substring(municipioOrigem.length() - 5, municipioOrigem.length()); + } + + if (item.getRedutorBaseCalculoIcms() == null) { + valorBaseCalculoICMS = valorTotal; + } + + StringBuilder sb = new StringBuilder(); + sb.append("ICF").append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataCaracter(ufDestino, true, 2)).append(SEPARADOR); + sb.append(formataNumerico(cfop, true, 4)).append(SEPARADOR); + sb.append(formataValor(valorBaseCalculoICMS, 15)).append(SEPARADOR); + sb.append(formataValor(aliquotaICMS, 5)).append(SEPARADOR); + sb.append(formataValor(valorICMSDebitado, 15)).append(SEPARADOR); + sb.append(formataValor(valorICMSIsento, 15)).append(SEPARADOR); + sb.append(formataValor(difValorTotalICMS, 15)).append(SEPARADOR); + sb.append("N").append(SEPARADOR); + sb.append("N").append(SEPARADOR); + sb.append("N").append(SEPARADOR); + sb.append("0").append(SEPARADOR); + sb.append(codigoSituacaoTribColunaB == 0 ? "00" : formataNumerico(codigoSituacaoTribColunaB, true, 2)).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 1)).append(SEPARADOR); // Posição 15 + sb.append(formataCaracter(VAZIO, false, 3)).append(SEPARADOR); // Posição 16 + sb.append("N").append(SEPARADOR); + sb.append("N").append(SEPARADOR); + sb.append(formataCaracter(ufOrigem, true, 2)).append(SEPARADOR); + sb.append(formataNumerico(municipioOrigem, true, 5)); + + writer.print(sb.toString() + UtiliteriasFiscal.QUEBRA_LINHA); + } + + private void adicionarLinhaPRC(PrintWriter writer, ExportacaoECFTipoPRC item, Map totalBaseCalculoICMS) { + String ufOrigem = item.getUfOrigem(); + String municipioOrigem = item.getMunicipioOrigem() == null ? null : item.getMunicipioOrigem().toString(); + BigDecimal valorTotal = item.getValorTotal(); + BigDecimal valorBaseCalculoICMS = totalBaseCalculoICMS.containsKey(item.getMunicipioOrigem()) ? totalBaseCalculoICMS.get(item.getMunicipioOrigem()) : item.getValorBaseCalculoICMS(); + BigDecimal valorICMS = BigDecimal.ZERO; + // BigDecimal valorICMS = item.getValorICMS(); + + if (municipioOrigem != null && municipioOrigem.length() > 5) { + municipioOrigem = municipioOrigem.substring(municipioOrigem.length() - 5, municipioOrigem.length()); + } + + if (item.getTributacao() != null && item.getTributacao().compareTo(BigDecimal.ZERO) > 0) { + valorICMS = MoneyHelper.multiplicar(valorBaseCalculoICMS, item.getTributacao()); + } + + StringBuilder sb = new StringBuilder(); + sb.append("PRC").append(SEPARADOR); + sb.append(formataCaracter(ufOrigem, true, 2)).append(SEPARADOR); + sb.append(formataNumerico(municipioOrigem, true, 5)).append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataValor(valorBaseCalculoICMS, 15)).append(SEPARADOR); + sb.append(formataValor(valorICMS, 15)); + + writer.print(sb.toString() + UtiliteriasFiscal.QUEBRA_LINHA); + } + + public File gerarArquivoRMD(final Date dataInicial, final Date dataFinal, String nomeArquivo, final String nomeEmpresa, List listaRegistroRMDTipoPAR, + List listaRegistroRMDTipoRMD, List listaRegistroRMDTipoBPS, List listaRegistroRMDTipoDBP, + List listaRegistroRMDTipoSeqBPS) { + try { +// String nomeArquivo = "fiscal_vendas_manual_" + DateUtil.getStringDate(Calendar.getInstance().getTime(), "yyyyMMddhhmmss"); + + File arquivo = File.createTempFile(nomeArquivo + "-", ".fs"); + + PrintWriter writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream(arquivo), Constantes.UTF_8)); + + adicionarRegistroRMDTipoCAB(writer, dataInicial, dataFinal, nomeEmpresa, nomeArquivo); + adicionarRegistroRMDTipoPAR(writer, listaRegistroRMDTipoPAR); + adicionarRegistroRMDTipoRMD(writer, listaRegistroRMDTipoRMD); +// adicionarRegistroRMDTipoBPS(writer, listaRegistroRMDTipoBPS); +// adicionarRegistroRMDTipoDBP(writer, listaRegistroRMDTipoDBP); + adicionarRegistroRMDTipoSeqBPS(writer, listaRegistroRMDTipoSeqBPS); + + int linhas = listaRegistroRMDTipoPAR.size() + listaRegistroRMDTipoRMD.size() + 1 + 1; + + for (ExportacaoRMDTipoSeqBPS seq : listaRegistroRMDTipoSeqBPS) { + linhas++; + + linhas = linhas + seq.getListaDBP().size(); + } + + writer.print("TRA|" + linhas + UtiliteriasFiscal.QUEBRA_LINHA); + + writer.close(); + + return arquivo; + + } catch (IOException e) { + log.error( e.getMessage(), e); + } + + return null; + } + + private void adicionarRegistroRMDTipoCAB(PrintWriter writer, Date dataInicial, Date dataFinal, String nomeEmpresa, String nomeArquivo) { + StringBuilder sb = new StringBuilder(); + sb.append("CAB").append(SEPARADOR); + sb.append("116").append(SEPARADOR); + sb.append("TotalBus").append(SEPARADOR); + sb.append(new SimpleDateFormat("yyyyMMdd").format(new Date())).append(SEPARADOR); + sb.append(formataCaracter(nomeEmpresa, false, 15)).append(SEPARADOR); + sb.append(new SimpleDateFormat("yyyyMMdd").format(dataInicial)).append(SEPARADOR); + sb.append(new SimpleDateFormat("yyyyMMdd").format(dataFinal)).append(SEPARADOR); + sb.append(nomeArquivo).append(SEPARADOR); + sb.append("N"); + + writer.print(sb.toString() + UtiliteriasFiscal.QUEBRA_LINHA); + } + + private void adicionarRegistroRMDTipoPAR(PrintWriter writer, List listaRegistroRMDTipoPAR) { + for (ExportacaoRMDTipoPAR registro : listaRegistroRMDTipoPAR) { + Integer codigoParticipante = registro.getCodigoParticipante(); + Integer codigoEstabelecimento = registro.getCodigoEstabelecimento(); + String nomeParticipante = registro.getNomeParticipante(); + String ufParticipante = registro.getUfParticipante(); + String cpfParticipante = registro.getCpfParticipante(); + String ieParticipante = registro.getIeParticipante(); + String logradouro = registro.getLogradouro(); + String numero = registro.getNumero(); + String complemento = registro.getComplemento(); + String bairro = registro.getBairro(); + Integer cep = registro.getCep(); + + StringBuilder sb = new StringBuilder(); + sb.append("PAR").append(SEPARADOR); + sb.append(formataNumerico(codigoEstabelecimento, true, 9)).append(SEPARADOR); + sb.append(formataCaracter(nomeParticipante, false, 60)).append(SEPARADOR); + sb.append(formataCaracter(ufParticipante, false, 2)).append(SEPARADOR); + sb.append(formataCaracter(cpfParticipante, true, 14)).append(SEPARADOR); + sb.append(formataCaracter(ieParticipante, true, 14)).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 20)).append(SEPARADOR); // Posição 7 + sb.append("N").append(SEPARADOR); + sb.append("N").append(SEPARADOR); + sb.append("N").append(SEPARADOR); + sb.append("N").append(SEPARADOR); + sb.append("N").append(SEPARADOR); + sb.append("N").append(SEPARADOR); + sb.append("N").append(SEPARADOR); + sb.append("N").append(SEPARADOR); + sb.append("0").append(SEPARADOR); + sb.append(formataCaracter(logradouro, false, 60)).append(SEPARADOR); + sb.append(formataNumerico(numero, true, 6)).append(SEPARADOR); + sb.append(formataCaracter(complemento, false, 60)).append(SEPARADOR); + sb.append("0").append(SEPARADOR); + sb.append(formataCaracter(bairro, false, 50)).append(SEPARADOR); + sb.append(formataNumerico(cep, true, 8)).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 5)).append(SEPARADOR); // Posição 23 + sb.append(formataCaracter(VAZIO, false, 3)).append(SEPARADOR); // Posição 24 + sb.append(formataCaracter(VAZIO, false, 9)).append(SEPARADOR); // Posição 25 + sb.append(formataCaracter(VAZIO, false, 14)).append(SEPARADOR); // Posição 26 + sb.append("N").append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 28 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 29 + sb.append("1058").append(SEPARADOR); + sb.append("N").append(SEPARADOR); + sb.append("1").append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 60)).append(SEPARADOR); // Posição 33 + sb.append("N").append(SEPARADOR); // Posição 34 + sb.append("N").append(SEPARADOR); // Posição 35 + sb.append(formataCaracter(VAZIO, false, 7)); // Posição 36 + + writer.print(sb.toString() + UtiliteriasFiscal.QUEBRA_LINHA); + } + } + + private void adicionarRegistroRMDTipoRMD(PrintWriter writer, List listaRegistroRMDTipoRMD) { + for (ExportacaoRMDTipoRMD registro : listaRegistroRMDTipoRMD) { + Integer codigoEstabelecimento = registro.getCodigoEstabelecimento(); + String numeroAIDF = registro.getNumeroAIDF(); + String serieAIDF = registro.getSerieAIDF(); + String subSerieAIDF = registro.getSubSerieAIDF(); + Long numeroBilheteAIDF = registro.getNumeroBilheteAIDF(); + Long numeroFormularioAIDF = registro.getNumeroFormularioAIDF(); + String dataEmissao = registro.getDataEmissao(); + Boolean cancelado = registro.getCancelado(); + // Integer codigoParticipante = registro.getCodigoParticipante(); + String codigoContabil = registro.getCodigoContabil(); + + StringBuilder sb = new StringBuilder(); + sb.append("RMD").append(SEPARADOR); + // sb.append(String.format("%04d", cancelado ? codigoParticipante : codigoEstabelecimento)).append(SEPARADOR); + sb.append(String.format("%04d", codigoEstabelecimento)).append(SEPARADOR); + sb.append(formataNumerico(numeroAIDF, true, 25)).append(SEPARADOR); + sb.append(formataCaracter(serieAIDF, false, 3)).append(SEPARADOR); + sb.append(formataCaracter(subSerieAIDF, false, 3)).append(SEPARADOR); + sb.append(String.format("%06d", numeroBilheteAIDF)).append(SEPARADOR); + sb.append(String.format("%06d", numeroFormularioAIDF)).append(SEPARADOR); + sb.append(formataCaracter(dataEmissao, false, 6)).append(SEPARADOR); + sb.append(cancelado ? "S" : "N").append(SEPARADOR); + sb.append("").append(SEPARADOR); // Posição 10 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 11 + sb.append(formataCaracter(VAZIO, false, 4)).append(SEPARADOR); // Posição 12 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 13 + sb.append(formataCaracter(VAZIO, false, 5)).append(SEPARADOR); // Posição 14 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 15 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 16 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 17 + sb.append(cancelado ? "" : formataNumerico(codigoEstabelecimento, true, 9)).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 19 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 20 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 21 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 22 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 23 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 24 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 25 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 26 + sb.append(cancelado ? "" : "01").append(SEPARADOR); + sb.append(cancelado ? "" : "01").append(SEPARADOR); + sb.append(formataCaracter(codigoContabil, false, 15)).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 9)).append(SEPARADOR); // Posição 30 + sb.append(formataCaracter(VAZIO, false, 9)).append(SEPARADOR); // Posição 31 + sb.append(formataCaracter(VAZIO, false, 9)).append(SEPARADOR); // Posição 32 + sb.append(formataCaracter(VAZIO, false, 8)).append(SEPARADOR); // Posição 33 + sb.append(formataCaracter(VAZIO, false, 3)).append(SEPARADOR); // Posição 34 + sb.append(formataCaracter(VAZIO, false, 3)).append(SEPARADOR); // Posição 35 + sb.append(formataCaracter("N", false, 3)); // Posição 36 + + writer.print(sb.toString() + UtiliteriasFiscal.QUEBRA_LINHA); + } + } + + @Deprecated + private void adicionarRegistroRMDTipoBPS(PrintWriter writer, List listaRegistroRMDTipoBPS) { + for (ExportacaoRMDTipoBPS registro : listaRegistroRMDTipoBPS) { + Integer codigoEstabelecimento = registro.getCodigoEstabelecimento(); + String especie = registro.getEspecie(); + Long numeroAIDF = registro.getNumeroAIDF(); + String serieAIDF = registro.getSerieAIDF(); + String subSerieAIDF = registro.getSubSerieAIDF(); + Long numeroInicial = registro.getNumeroInicial(); + Long numeroFinal = registro.getNumeroFinal(); + Integer quantidadeCancelados = registro.getQuantidadeCancelados(); + String dataEmissao = registro.getDataEmissao(); + BigDecimal valorTotal = registro.getValorTotal(); + Boolean resumoMovimentoDiario = registro.getResumoMovimentoDiario(); + Long numeroAIDFRMD = registro.getNumeroAIDFRMD(); + String serieAIDFRMD = registro.getSerieAIDFRMD(); + String subSerieAIDFRMD = registro.getSubSerieAIDFRMD(); + Integer numeroRMD = registro.getNumeroRMD(); + + StringBuilder sb = new StringBuilder(); + sb.append("BPS").append(SEPARADOR); + sb.append(String.format("%04d", codigoEstabelecimento)).append(SEPARADOR); + sb.append(formataCaracter(especie, false, 5)).append(SEPARADOR); + sb.append(formataNumerico(numeroAIDF, true, 25)).append(SEPARADOR); + sb.append(formataCaracter(serieAIDF, false, 3)).append(SEPARADOR); + sb.append(formataCaracter(subSerieAIDF, false, 3)).append(SEPARADOR); + sb.append(formataNumerico(numeroInicial, true, 6)).append(SEPARADOR); + sb.append(formataNumerico(numeroFinal, true, 6)).append(SEPARADOR); + sb.append(formataNumerico(quantidadeCancelados, true, 9)).append(SEPARADOR); + sb.append(formataNumerico(numeroInicial, true, 6)).append(SEPARADOR); + sb.append(formataNumerico(numeroFinal, true, 6)).append(SEPARADOR); + sb.append(formataCaracter(dataEmissao, true, 8)).append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(resumoMovimentoDiario == null ? "" : resumoMovimentoDiario ? "S" : "N").append(SEPARADOR); + sb.append(formataNumerico(numeroAIDFRMD, true, 25)).append(SEPARADOR); + sb.append(formataCaracter(serieAIDFRMD, false, 3)).append(SEPARADOR); + sb.append(formataCaracter(subSerieAIDFRMD, false, 3)).append(SEPARADOR); + sb.append(formataNumerico(numeroRMD, true, 6)).append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 21 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 22 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 23 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 24 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 25 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 26 + sb.append("").append(SEPARADOR); // Posição 27 + sb.append("01").append(SEPARADOR); + sb.append("01").append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 3)).append(SEPARADOR); // Posição 30 + sb.append(formataCaracter(VAZIO, false, 3)).append(SEPARADOR); // Posição 31 + sb.append(formataCaracter(VAZIO, false, 8)); // Posição 32 + + writer.print(sb.toString() + UtiliteriasFiscal.QUEBRA_LINHA); + } + } + + @Deprecated + private void adicionarRegistroRMDTipoDBP(PrintWriter writer, List listaRegistroRMDTipoDBP) { + for (ExportacaoRMDTipoDBP registro : listaRegistroRMDTipoDBP) { + String ufDestino = registro.getUfDestino(); + Integer cfop = registro.getCfop(); // IM=5357; Serviço IE= 6357 + BigDecimal valorTotal = registro.getValorTotal(); + BigDecimal valorBaseCalculoICMS = registro.getValorBaseCalculoICMS(); + BigDecimal aliquotaICMS = registro.getAliquotaICMS(); + BigDecimal valorICMS = registro.getValorICMS(); + BigDecimal valorICMSIsento = registro.getValorICMSIsento(); + BigDecimal valorICMSOutros = registro.getValorICMSOutros(); + Integer codigoSituacaoTribColunaB = registro.getCodigoSituacaoTribColunaB(); // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + String ufOrigem = registro.getUfOrigem(); + Integer municipioestadoOrigem = registro.getMunicipioOrigem(); + + String municipioOrigem = municipioestadoOrigem.toString(); + + if (municipioOrigem.length() > 5) { + municipioOrigem = municipioOrigem.substring(municipioOrigem.length() - 5, municipioOrigem.length()); + } + + StringBuilder sb = new StringBuilder(); + sb.append("DBP").append(SEPARADOR); + sb.append(formataCaracter(ufDestino, true, 2)).append(SEPARADOR); + sb.append(formataNumerico(cfop, true, 4)).append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataValor(valorBaseCalculoICMS, 15)).append(SEPARADOR); + sb.append(formataValor(aliquotaICMS, 5)).append(SEPARADOR); + sb.append(formataValor(valorICMS, 15)).append(SEPARADOR); + sb.append(formataValor(valorICMSIsento, 15)).append(SEPARADOR); + sb.append(formataValor(valorICMSOutros, 15)).append(SEPARADOR); + sb.append(codigoSituacaoTribColunaB == 0 ? "00" : formataNumerico(codigoSituacaoTribColunaB, true, 2)).append(SEPARADOR); + sb.append(formataCaracter(ufOrigem, true, 2)).append(SEPARADOR); + sb.append(municipioOrigem).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 3)); // Posição 13 + + writer.print(sb.toString() + UtiliteriasFiscal.QUEBRA_LINHA); + } + } + + private void adicionarRegistroRMDTipoSeqBPS(PrintWriter writer, List listaRegistroRMDTipoBPS) { + for (ExportacaoRMDTipoSeqBPS registro : listaRegistroRMDTipoBPS) { + Integer codigoEstabelecimento = registro.getCodigoEstabelecimento(); + String especie = registro.getEspecie(); + String numeroAIDF = registro.getNumeroAIDF(); + String serieAIDF = registro.getSerieAIDF(); + String subSerieAIDF = registro.getSubSerieAIDF(); + Long numeroInicial = registro.getNumeroInicial(); + Long numeroFinal = registro.getNumeroFinal(); + Integer quantidadeCancelados = registro.getQuantidadeCancelados(); + String dataEmissao = registro.getDataEmissao(); + BigDecimal valorTotal = registro.getValorTotal(); + Boolean resumoMovimentoDiario = registro.getResumoMovimentoDiario(); + String numeroAIDFRMD = registro.getNumeroAIDFRMD(); + String serieAIDFRMD = registro.getSerieAIDFRMD(); + String subSerieAIDFRMD = registro.getSubSerieAIDFRMD(); + Integer numeroRMD = registro.getNumeroRMD(); + String infoPadraoBilhetePassagem = registro.getInfoPadraoBilhetePassagem(); + + StringBuilder sb = new StringBuilder(); + sb.append("BPS").append(SEPARADOR); + sb.append(String.format("%04d", codigoEstabelecimento)).append(SEPARADOR); + sb.append(formataCaracter(especie, false, 5)).append(SEPARADOR); + sb.append(formataNumerico(numeroAIDF, true, 25)).append(SEPARADOR); + sb.append(formataCaracter(serieAIDF, false, 3)).append(SEPARADOR); + sb.append(formataCaracter(subSerieAIDF, false, 3)).append(SEPARADOR); + sb.append(formataNumerico(numeroInicial, true, 6)).append(SEPARADOR); + sb.append(formataNumerico(numeroFinal, true, 6)).append(SEPARADOR); + sb.append(formataNumerico(quantidadeCancelados, true, 9)).append(SEPARADOR); + sb.append(formataNumerico(numeroInicial, true, 6)).append(SEPARADOR); + sb.append(formataNumerico(numeroFinal, true, 6)).append(SEPARADOR); + sb.append(formataCaracter(dataEmissao, true, 8)).append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(resumoMovimentoDiario == null ? "" : resumoMovimentoDiario ? "S" : "N").append(SEPARADOR); + sb.append(formataNumerico(numeroAIDFRMD, true, 25)).append(SEPARADOR); + sb.append(formataCaracter(serieAIDFRMD, false, 3)).append(SEPARADOR); + sb.append(formataCaracter(subSerieAIDFRMD, false, 3)).append(SEPARADOR); + sb.append(String.format("%06d", numeroRMD)).append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 21 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 22 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 23 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 24 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 25 + sb.append(formataCaracter(VAZIO, false, 15)).append(SEPARADOR); // Posição 26 + sb.append("").append(SEPARADOR); // Posição 27 + sb.append("01").append(SEPARADOR); + sb.append("01").append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 3)).append(SEPARADOR); // Posição 30 + sb.append(formataCaracter(VAZIO, false, 3)).append(SEPARADOR); // Posição 31 + sb.append(formataCaracter(infoPadraoBilhetePassagem, false, 8)); + + writer.print(sb.toString() + UtiliteriasFiscal.QUEBRA_LINHA); + + adicionarRegistroRMDTipoSeqDBP(writer, registro.getListaDBP()); + } + } + + private void adicionarRegistroRMDTipoSeqDBP(PrintWriter writer, List listaRegistroRMDTipoDBP) { + for (ExportacaoRMDTipoSeqDBP registro : listaRegistroRMDTipoDBP) { + String ufDestino = registro.getUfDestino(); + Integer cfop = registro.getCfop(); // IM=5357; Serviço IE= 6357 + BigDecimal valorTotal = registro.getValorTotal(); + BigDecimal valorBaseCalculoICMS = registro.getValorBaseCalculoICMS(); + BigDecimal aliquotaICMS = registro.getAliquotaICMS(); + BigDecimal valorICMS = registro.getValorICMS(); + BigDecimal valorICMSIsento = registro.getValorICMSIsento(); +// BigDecimal valorICMSOutros = registro.getValorICMSOutros(); + + BigDecimal difValorTotalICMS = valorTotal.subtract(valorBaseCalculoICMS); + + Integer codigoSituacaoTribColunaB = registro.getCodigoSituacaoTribColunaB(); // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + String ufOrigem = registro.getUfOrigem(); + Integer municipioestadoOrigem = registro.getMunicipioOrigem(); + + String municipioOrigem = municipioestadoOrigem.toString(); + + if (municipioOrigem.length() > 5) { + municipioOrigem = municipioOrigem.substring(municipioOrigem.length() - 5, municipioOrigem.length()); + } + + StringBuilder sb = new StringBuilder(); + sb.append("DBP").append(SEPARADOR); + sb.append(formataCaracter(ufDestino, true, 2)).append(SEPARADOR); + sb.append(formataNumerico(cfop, true, 4)).append(SEPARADOR); + sb.append(formataValor(valorTotal, 15)).append(SEPARADOR); + sb.append(formataValor(valorBaseCalculoICMS, 15)).append(SEPARADOR); + sb.append(formataValor(aliquotaICMS, 5)).append(SEPARADOR); + sb.append(formataValor(valorICMS, 15)).append(SEPARADOR); + sb.append(formataValor(valorICMSIsento, 15)).append(SEPARADOR); + sb.append(formataValor(difValorTotalICMS, 15)).append(SEPARADOR); + sb.append(codigoSituacaoTribColunaB == 0 ? "00" : formataNumerico(codigoSituacaoTribColunaB, true, 2)).append(SEPARADOR); + sb.append(formataCaracter(ufOrigem, true, 2)).append(SEPARADOR); + sb.append(municipioOrigem).append(SEPARADOR); + sb.append(formataCaracter(VAZIO, false, 3)); // Posição 13 + + writer.print(sb.toString() + UtiliteriasFiscal.QUEBRA_LINHA); + } + } + + private String formataCaracter(String valor, boolean removeMascara, int tamanho) { + if (valor == null) { + valor = ""; + } + +// if (removeMascara) { +// valor = valor.replace("-", "").replace(".", "").replace("/", ""); +// } +// +// if (valor.length() > tamanho) { +// valor = valor.substring(0, tamanho); +// } +// +// return String.format("%1$-" + tamanho + "s", valor); + + return valor; + } + + private String formataNumerico(final String valor, final boolean removeMascara, final int tamanho) { + String retorno = StringUtils.trim(valor); + + if (retorno == null) { + retorno = "0"; + } + +// if (removeMascara) { +// retorno = retorno.replace("-", "").replace(".", "").replace("/", ""); +// } +// +// retorno = retorno.replace(".", "").replace(",",""); +// +// if (tamanho > 0) { +// if (retorno.length() > tamanho) { +// retorno = retorno.substring(retorno.length() - tamanho, retorno.length()); +// } +// +// return StringUtils.leftPad(retorno, tamanho, "0"); +// } + + return retorno; + } + + private String formataNumerico(final Long valor, final boolean removeMascara, final int tamanho) { +// if (valor == null) { +// return formataCaracter(" ", true, tamanho); +// } else { +// return formataNumerico(valor.toString(), removeMascara, tamanho); +// } + if (valor == null) { + return "0"; + } else { + return formataNumerico(valor.toString(), removeMascara, tamanho); + } + } + + private String formataNumerico(final Integer valor, final boolean removeMascara, final int tamanho) { +// if (valor == null) { +// return formataCaracter(" ", true, tamanho); +// } else { +// return formataNumerico(valor.toString(), removeMascara, tamanho); +// } + if (valor == null) { + return "0"; + } else { + return formataNumerico(valor.toString(), removeMascara, tamanho); + } + } + + private String formataValor(final BigDecimal valor, final int tamanho) { +// if (valor == null) { +// return formataCaracter(" ", true, tamanho); +// } else { +// return formataNumerico(valor.setScale(2).toString(), false, tamanho); +// } + if (valor == null) { + return "0"; + } else { + return valor.setScale(2, BigDecimal.ROUND_HALF_EVEN).toString(); + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoBPR.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoBPR.java new file mode 100644 index 000000000..b50f63346 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoBPR.java @@ -0,0 +1,341 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; + +public class ExportacaoBPR { + private static final String CODIGO_INDICADOR_CONTR_PREVIDENCIARIA = "00000060"; + + private List listaRegistroBPR; + + private List listaRegistroBPRTipoPAR; + private List listaRegistroBPRTipoRMD; + private List listaRegistroBPRTipoSeqBPS; + + public ExportacaoBPR() { + listaRegistroBPR = new ArrayList(0); + + listaRegistroBPRTipoPAR = new ArrayList(0); + listaRegistroBPRTipoRMD = new ArrayList(0); + listaRegistroBPRTipoSeqBPS = new ArrayList(0); + } + + public List getListaRegistroBPR() { + return listaRegistroBPR; + } + + public List getListaRegistroBPRTipoPAR() { + return listaRegistroBPRTipoPAR; + } + + public List getListaRegistroBPRTipoRMD() { + return listaRegistroBPRTipoRMD; + } + + public List getListaRegistroBPRTipoSeqBPS() { + return listaRegistroBPRTipoSeqBPS; + } + + public void gerarListas() { + ordenarLista(); + + gerarPAR(); + gerarRMD(); + gerarBPS_DBP(); + } + + private void ordenarLista() { + Collections.sort(listaRegistroBPR, new Comparator(){ + public int compare(ExportacaoBPRBase e1, ExportacaoBPRBase e2) { + String c1 = e1.getDataEmissao() + "-" + e1.getNumeroFormulario() + "-" + e1.getCfop() + "-" + e1.getUfDestino(); + String c2 = e2.getDataEmissao() + "-" + e2.getNumeroFormulario() + "-" + e2.getCfop() + "-" + e2.getUfDestino(); + + return c1.compareToIgnoreCase(c2); + } + }); + } + + private void gerarPAR() { + listaRegistroBPRTipoPAR.clear(); + + ExportacaoRMDTipoPAR registro = null; + + Map group = new HashMap(0); + + for (ExportacaoBPRBase base : listaRegistroBPR) { + String key = base.getCodigoEstabelecimentoPar() + "-" + base.getCodigoEstabelecimentoPar() + "-" + base.getNomeParticipante(); + + if (group.containsKey(key)) { + continue; + } + + registro = new ExportacaoRMDTipoPAR(); + registro.setCodigoParticipante(base.getCodigoParticipantePar()); + registro.setCodigoEstabelecimento(base.getCodigoEstabelecimentoPar()); + registro.setNomeParticipante(base.getNomeParticipante()); + registro.setUfParticipante(base.getUfParticipante()); + registro.setCpfParticipante(base.getCpfParticipante()); + registro.setIeParticipante(base.getIeParticipante()); + registro.setLogradouro(base.getLogradouro()); + registro.setNumero(base.getNumero()); + registro.setComplemento(base.getComplemento()); + registro.setBairro(base.getBairro()); + registro.setCep(base.getCep()); + + group.put(key, registro); + } + + for (Map.Entry entry : group.entrySet()) { + listaRegistroBPRTipoPAR.add(entry.getValue()); + } + + Collections.sort(listaRegistroBPRTipoPAR, new Comparator(){ + public int compare(ExportacaoRMDTipoPAR e1, ExportacaoRMDTipoPAR e2) { + String c1 = e1.getCodigoParticipante() + "-" + e1.getCodigoEstabelecimento() + "-" + e1.getNomeParticipante(); + String c2 = e2.getCodigoParticipante() + "-" + e2.getCodigoEstabelecimento() + "-" + e2.getNomeParticipante(); + + return c1.compareToIgnoreCase(c2); + } + }); + } + + private void gerarRMD() { + listaRegistroBPRTipoRMD.clear(); + + ExportacaoRMDTipoRMD registro = null; + + Map group = new HashMap(0); + + for (ExportacaoBPRBase base : listaRegistroBPR) { + + // String numeroAIDF = base.getNumeroAIDF(); + // if (numeroAIDF == null || numeroAIDF.trim().isEmpty() || numeroAIDF.trim().equals("0")) { + // continue; + // } + + String key = base.getCodigoEstabelecimento() + "-" + base.getNumeroAIDFRMD() + "-" + base.getNumeroFormularioBilheteAIDF(); + + if (group.containsKey(key)) { + continue; + } + + registro = new ExportacaoRMDTipoRMD(); + registro.setDataEmissao(base.getDataEmissaoRMD()); + registro.setCodigoParticipante(base.getDocumentoCancelado() ? base.getCodigoParticipantePar() : base.getCodigoParticipante()); + registro.setCodigoEstabelecimento( base.getDocumentoCancelado() ? base.getCodigoEstabelecimentoPar() : base.getCodigoEstabelecimento()); + registro.setNumeroAIDF(base.getNumeroAIDFRMD()); + registro.setSerieAIDF(base.getSerieAIDFRMD()); + registro.setSubSerieAIDF(base.getSubSerieAIDFRMD()); + registro.setNumeroBilheteAIDF(base.getNumeroFormularioBilheteAIDF()); + registro.setNumeroFormularioAIDF(base.getNumeroFormularioBilheteAIDF()); + registro.setCancelado(base.getDocumentoCancelado()); + registro.setCodigoContabil(base.getCodigoContabil()); + + group.put(key, registro); + } + + for (Map.Entry entry : group.entrySet()) { + listaRegistroBPRTipoRMD.add(entry.getValue()); + } + + Collections.sort(listaRegistroBPRTipoRMD, new Comparator(){ + public int compare(ExportacaoRMDTipoRMD e1, ExportacaoRMDTipoRMD e2) { + String c1 = e1.getCodigoEstabelecimento() + "-" + e1.getNumeroAIDF() + "-" + e1.getNumeroBilheteAIDF(); + String c2 = e2.getCodigoEstabelecimento() + "-" + e2.getNumeroAIDF() + "-" + e2.getNumeroBilheteAIDF(); + + return c1.compareToIgnoreCase(c2); + } + }); + } + + private void gerarBPS_DBP() { + listaRegistroBPRTipoSeqBPS.clear(); + + ExportacaoRMDTipoSeqBPS registroBPS = null; + ExportacaoRMDTipoSeqDBP registroDBP = null; + + Long numeroInicial = 0l; + Long numeroFinal = 0l; + + String dataEmissaoControle = ""; + Integer cfopControle = 0; + + Integer quantidadeTotal = 0; + Integer quantidadeCancelado = 0; + + BigDecimal totalizador = BigDecimal.ZERO; + + for (ExportacaoBPRBase base : listaRegistroBPR) { + Integer codigoEstabelecimento = base.getCodigoEstabelecimento(); + String numeroAIDF = base.getNumeroAIDF(); + String serieAIDF = base.getSerieAIDF(); + String subSerieAIDF = base.getSubSerieAIDF(); + String numeroAIDFRMD = base.getNumeroAIDFRMD(); + String serieAIDFRMD = base.getSerieAIDFRMD(); + String subSerieAIDFRMD = base.getSubSerieAIDFRMD(); + Integer numeroRMD = base.getNumeroRMD(); + String dataEmissao = base.getDataEmissao(); + Long numeroFormulario = base.getNumeroFormulario(); + String ufDestino = base.getUfDestino(); + Integer cfop = base.getCfop(); + String ufOrigem = base.getUfOrigem(); + Integer municipioOrigem = base.getMunicipioOrigem(); + Boolean isenta = (base.getBoletoIsento() == 1); + Boolean cancelado = (base.getBoletoCancelado() == 1); + BigDecimal valorTotal = base.getValorPago(); + BigDecimal red_base_calc_icms = base.getReducaoBaseCalcICMS(); + BigDecimal porc_red_municipal = base.getPorcReducaoMunicipal(); + BigDecimal porc_red_estadual = base.getPorcReducaoEstadual(); + BigDecimal tributacao_importacao = base.getTributacaoImportacao(); + + if (base.getDocumentoCancelado()) + continue; + + if (numeroAIDF == null || numeroAIDF.trim().isEmpty() || numeroAIDF.trim().equals("0")) { + continue; + } + + // BPR + if ((numeroFinal + 1) != numeroFormulario || !dataEmissaoControle.equals(dataEmissao) || !cfopControle.equals(cfop)) { + numeroInicial = numeroFormulario; + dataEmissaoControle = dataEmissao; + cfopControle = cfop; + + registroBPS = new ExportacaoRMDTipoSeqBPS(); + registroBPS.setEspecie("BPR"); + registroBPS.setNumeroInicial(numeroInicial); + registroBPS.setCodigoEstabelecimento(codigoEstabelecimento); + registroBPS.setNumeroAIDF(numeroAIDF); + registroBPS.setSerieAIDF(serieAIDF); + registroBPS.setSubSerieAIDF(subSerieAIDF); + registroBPS.setNumeroAIDFRMD(numeroAIDFRMD); + registroBPS.setSerieAIDFRMD(serieAIDFRMD); + registroBPS.setSubSerieAIDFRMD(subSerieAIDFRMD); + registroBPS.setNumeroRMD(numeroRMD); + registroBPS.setDataEmissao(dataEmissao); + registroBPS.setInfoPadraoBilhetePassagem(CODIGO_INDICADOR_CONTR_PREVIDENCIARIA); + + listaRegistroBPRTipoSeqBPS.add(registroBPS); + + quantidadeTotal = 0; + quantidadeCancelado = 0; + + totalizador = BigDecimal.ZERO; + } + + quantidadeTotal++; + + if (cancelado) { + quantidadeCancelado++; + } else { + totalizador = MoneyHelper.somar(totalizador, valorTotal); + } + + numeroFinal = numeroFormulario; + + registroBPS.setNumeroFinal(numeroFinal); + + registroBPS.setQuantidadeTotal(quantidadeTotal); + registroBPS.setQuantidadeCancelados(quantidadeCancelado); + registroBPS.setValorTotal(totalizador); + + // DBP + registroDBP = new ExportacaoRMDTipoSeqDBP(ufDestino); + + Integer indice = registroBPS.getListaDBP().indexOf(registroDBP); + + if (indice == -1) { + registroBPS.getListaDBP().add(registroDBP); + + registroDBP.setCfop(cfop); // IM=5357; Serviço IE= 6357 + registroDBP.setUfOrigem(ufOrigem); + registroDBP.setMunicipioOrigem(municipioOrigem); + + registroDBP.setCodigoSituacaoTribColunaB(null); + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + if (isenta) { + registroDBP.setCodigoSituacaoTribColunaB(40); + } + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + if (registroDBP.getCodigoSituacaoTribColunaB() == null) { + registroDBP.setCodigoSituacaoTribColunaB(red_base_calc_icms == null || red_base_calc_icms.compareTo(BigDecimal.ZERO) == 0 ? 0 : 20); + } + + registroDBP.setValorBaseCalculoICMS(BigDecimal.ZERO); + registroDBP.setValorTotal(BigDecimal.ZERO); + registroDBP.setValorICMS(BigDecimal.ZERO); + registroDBP.setValorICMSIsento(BigDecimal.ZERO); + registroDBP.setValorICMSOutros(BigDecimal.ZERO); + } else { + registroDBP = registroBPS.getListaDBP().get(indice); + } + + BigDecimal valorBaseCalculoICMS = BigDecimal.ZERO; + + BigDecimal valorIsenta = BigDecimal.ZERO; + BigDecimal valorIsentaOutros = BigDecimal.ZERO; + + if (base.getBoletoIsento() == 1) { + valorIsenta = valorTotal; + valorTotal = BigDecimal.ZERO; + } else { + if (red_base_calc_icms != null) { + valorBaseCalculoICMS = valorTotal.subtract(valorTotal.multiply(red_base_calc_icms.divide(BigDecimal.valueOf(100d)))); + } else { + valorBaseCalculoICMS = valorTotal; + } + } + + registroDBP.setAliquotaICMS(tributacao_importacao); + + if (tributacao_importacao == null) { + tributacao_importacao = BigDecimal.ZERO; + } else { + if (red_base_calc_icms != null) { + BigDecimal porc_red = BigDecimal.ZERO; + + if (ufOrigem.equals(ufDestino)) { + if (porc_red_municipal != null) { + porc_red = porc_red_municipal; + } + } else { + if (porc_red_estadual != null) { + porc_red = porc_red_estadual; + } + } + + BigDecimal porc = tributacao_importacao.subtract(porc_red.divide(BigDecimal.valueOf(100d))); + valorIsentaOutros = valorTotal.multiply(porc); + } + + tributacao_importacao = MoneyHelper.dividir(tributacao_importacao, BigDecimal.valueOf(100d)); + } + + BigDecimal valorICMS = MoneyHelper.multiplicar(valorBaseCalculoICMS, tributacao_importacao); + + registroDBP.setValorBaseCalculoICMS(registroDBP.getValorBaseCalculoICMS().add(valorBaseCalculoICMS)); + registroDBP.setValorTotal(registroDBP.getValorTotal().add(valorTotal)); + registroDBP.setValorICMS(registroDBP.getValorICMS().add(valorICMS)); + registroDBP.setValorICMSIsento(registroDBP.getValorICMSIsento().add(valorIsenta)); + registroDBP.setValorICMSOutros(registroDBP.getValorICMSOutros().add(valorIsentaOutros)); + } + + Collections.sort(listaRegistroBPRTipoSeqBPS, new Comparator(){ + public int compare(ExportacaoRMDTipoSeqBPS e1, ExportacaoRMDTipoSeqBPS e2) { + String c1 = e1.getDataEmissao(); + String c2 = e2.getDataEmissao(); + + return c1.compareToIgnoreCase(c2); + } + }); + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoBPRBase.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoBPRBase.java new file mode 100644 index 000000000..98ae4ed2c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoBPRBase.java @@ -0,0 +1,364 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +import java.math.BigDecimal; + +public class ExportacaoBPRBase { + // PAR + private Integer codigoParticipantePar; + private Integer codigoEstabelecimentoPar; + private String nomeParticipante; + private String ufParticipante; + private String cpfParticipante; + private String ieParticipante; + private String imParticipante; + private String logradouro; + private String numero; + private String complemento; + private String bairro; + private Integer cep; + + // RMD + private String dataEmissaoRMD; + private Integer codigoParticipante; + private Integer codigoEstabelecimento; + private String numeroAIDF; + private String serieAIDF; + private String subSerieAIDF; + private Long numeroFormularioBilheteAIDF; + private Boolean documentoCancelado; + private String codigoContabil; + + // BPS + private String dataEmissao; + private Long numeroFormulario; + private String numeroAIDFRMD; + private String serieAIDFRMD; + private String subSerieAIDFRMD; + private Integer numeroRMD; + private Integer boletoIsento; + private Integer boletoCancelado; + private BigDecimal valorPago; + + // DBP + private String ufDestino; + private String ufOrigem; + private Integer municipioOrigem; + private Integer cfop; + private BigDecimal reducaoBaseCalcICMS; + private BigDecimal porcReducaoMunicipal; + private BigDecimal porcReducaoEstadual; + private BigDecimal tributacaoImportacao; + + public ExportacaoBPRBase() { + + } + + public Integer getCodigoParticipantePar() { + return codigoParticipantePar; + } + + public void setCodigoParticipantePar(Integer codigoParticipantePar) { + this.codigoParticipantePar = codigoParticipantePar; + } + + public Integer getCodigoEstabelecimentoPar() { + return codigoEstabelecimentoPar; + } + + public void setCodigoEstabelecimentoPar(Integer codigoEstabelecimentoPar) { + this.codigoEstabelecimentoPar = codigoEstabelecimentoPar; + } + + public String getNomeParticipante() { + return nomeParticipante; + } + + public void setNomeParticipante(String nomeParticipante) { + this.nomeParticipante = nomeParticipante; + } + + public String getUfParticipante() { + return ufParticipante; + } + + public void setUfParticipante(String ufParticipante) { + this.ufParticipante = ufParticipante; + } + + public String getCpfParticipante() { + return cpfParticipante; + } + + public void setCpfParticipante(String cpfParticipante) { + this.cpfParticipante = cpfParticipante; + } + + public String getIeParticipante() { + return ieParticipante; + } + + public void setIeParticipante(String ieParticipante) { + this.ieParticipante = ieParticipante; + } + + public String getImParticipante() { + return imParticipante; + } + + public void setImParticipante(String imParticipante) { + this.imParticipante = imParticipante; + } + + public String getLogradouro() { + return logradouro; + } + + public void setLogradouro(String logradouro) { + this.logradouro = logradouro; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public Integer getCep() { + return cep; + } + + public void setCep(Integer cep) { + this.cep = cep; + } + + public String getDataEmissaoRMD() { + return dataEmissaoRMD; + } + + public void setDataEmissaoRMD(String dataEmissaoRMD) { + this.dataEmissaoRMD = dataEmissaoRMD; + } + + public Integer getCodigoParticipante() { + return codigoParticipante; + } + + public void setCodigoParticipante(Integer codigoParticipante) { + this.codigoParticipante = codigoParticipante; + } + + public Integer getCodigoEstabelecimento() { + return codigoEstabelecimento; + } + + public void setCodigoEstabelecimento(Integer codigoEstabelecimento) { + this.codigoEstabelecimento = codigoEstabelecimento; + } + + public String getNumeroAIDF() { + return numeroAIDF; + } + + public void setNumeroAIDF(String numeroAIDF) { + this.numeroAIDF = numeroAIDF; + } + + public String getSerieAIDF() { + return serieAIDF; + } + + public void setSerieAIDF(String serieAIDF) { + this.serieAIDF = serieAIDF; + } + + public String getSubSerieAIDF() { + return subSerieAIDF; + } + + public void setSubSerieAIDF(String subSerieAIDF) { + this.subSerieAIDF = subSerieAIDF; + } + + public Long getNumeroFormularioBilheteAIDF() { + return numeroFormularioBilheteAIDF; + } + + public void setNumeroFormularioBilheteAIDF(Long numeroFormularioBilheteAIDF) { + this.numeroFormularioBilheteAIDF = numeroFormularioBilheteAIDF; + } + + public Boolean getDocumentoCancelado() { + return documentoCancelado; + } + + public void setDocumentoCancelado(Boolean documentoCancelado) { + this.documentoCancelado = documentoCancelado; + } + + public String getCodigoContabil() { + return codigoContabil; + } + + public void setCodigoContabil(String codigoContabil) { + this.codigoContabil = codigoContabil; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public Long getNumeroFormulario() { + return numeroFormulario; + } + + public void setNumeroFormulario(Long numeroFormulario) { + this.numeroFormulario = numeroFormulario; + } + + public String getNumeroAIDFRMD() { + return numeroAIDFRMD; + } + + public void setNumeroAIDFRMD(String numeroAIDFRMD) { + this.numeroAIDFRMD = numeroAIDFRMD; + } + + public String getSerieAIDFRMD() { + return serieAIDFRMD; + } + + public void setSerieAIDFRMD(String serieAIDFRMD) { + this.serieAIDFRMD = serieAIDFRMD; + } + + public String getSubSerieAIDFRMD() { + return subSerieAIDFRMD; + } + + public void setSubSerieAIDFRMD(String subSerieAIDFRMD) { + this.subSerieAIDFRMD = subSerieAIDFRMD; + } + + public Integer getNumeroRMD() { + return numeroRMD; + } + + public void setNumeroRMD(Integer numeroRMD) { + this.numeroRMD = numeroRMD; + } + + public Integer getBoletoIsento() { + return boletoIsento == null ? 0 : boletoIsento; + } + + public void setBoletoIsento(Integer boletoIsento) { + this.boletoIsento = boletoIsento; + } + + public Integer getBoletoCancelado() { + return boletoCancelado == null ? 0 : boletoCancelado; + } + + public void setBoletoCancelado(Integer boletoCancelado) { + this.boletoCancelado = boletoCancelado; + } + + public BigDecimal getValorPago() { + return valorPago; + } + + public void setValorPago(BigDecimal valorPago) { + this.valorPago = valorPago; + } + + public String getUfDestino() { + return ufDestino; + } + + public void setUfDestino(String ufDestino) { + this.ufDestino = ufDestino; + } + + public String getUfOrigem() { + return ufOrigem; + } + + public void setUfOrigem(String ufOrigem) { + this.ufOrigem = ufOrigem; + } + + public Integer getMunicipioOrigem() { + return municipioOrigem; + } + + public void setMunicipioOrigem(Integer municipioOrigem) { + this.municipioOrigem = municipioOrigem; + } + + public Integer getCfop() { + return cfop; + } + + public void setCfop(Integer cfop) { + this.cfop = cfop; + } + + public BigDecimal getReducaoBaseCalcICMS() { + return reducaoBaseCalcICMS; + } + + public void setReducaoBaseCalcICMS(BigDecimal reducaoBaseCalcICMS) { + this.reducaoBaseCalcICMS = reducaoBaseCalcICMS; + } + + public BigDecimal getPorcReducaoMunicipal() { + return porcReducaoMunicipal; + } + + public void setPorcReducaoMunicipal(BigDecimal porcReducaoMunicipal) { + this.porcReducaoMunicipal = porcReducaoMunicipal; + } + + public BigDecimal getPorcReducaoEstadual() { + return porcReducaoEstadual; + } + + public void setPorcReducaoEstadual(BigDecimal porcReducaoEstadual) { + this.porcReducaoEstadual = porcReducaoEstadual; + } + + public BigDecimal getTributacaoImportacao() { + return tributacaoImportacao; + } + + public void setTributacaoImportacao(BigDecimal tributacaoImportacao) { + this.tributacaoImportacao = tributacaoImportacao; + } + + @Override + public String toString() { + return "ExportacaoRMDBase [codigoParticipantePar=" + codigoParticipantePar + ", codigoEstabelecimentoPar=" + codigoEstabelecimentoPar + ", nomeParticipante=" + nomeParticipante + ", ufParticipante=" + ufParticipante + ", cpfParticipante=" + cpfParticipante + ", ieParticipante=" + ieParticipante + ", imParticipante=" + imParticipante + ", logradouro=" + logradouro + ", numero=" + numero + ", complemento=" + complemento + ", bairro=" + bairro + ", cep=" + cep + ", dataEmissaoRMD=" + dataEmissaoRMD + ", codigoParticipante=" + codigoParticipante + ", codigoEstabelecimento=" + codigoEstabelecimento + ", numeroAIDF=" + numeroAIDF + ", serieAIDF=" + serieAIDF + ", subSerieAIDF=" + subSerieAIDF + ", numeroFormularioBilheteAIDF=" + numeroFormularioBilheteAIDF + ", documentoCancelado=" + documentoCancelado + ", codigoContabil=" + codigoContabil + ", dataEmissao=" + dataEmissao + ", numeroFormulario=" + numeroFormulario + ", numeroAIDFRMD=" + numeroAIDFRMD + ", serieAIDFRMD=" + serieAIDFRMD + ", subSerieAIDFRMD=" + subSerieAIDFRMD + ", numeroRMD=" + numeroRMD + ", boletoCancelado=" + boletoCancelado + ", valorPago=" + valorPago + ", ufDestino=" + ufDestino + ", ufOrigem=" + ufOrigem + ", municipioOrigem=" + municipioOrigem + ", cfop=" + cfop + ", reducaoBaseCalcICMS=" + reducaoBaseCalcICMS + ", porcReducaoMunicipal=" + porcReducaoMunicipal + ", porcReducaoEstadual=" + porcReducaoEstadual + ", tributacaoImportacao=" + tributacaoImportacao + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECF.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECF.java new file mode 100644 index 000000000..5ddee781f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECF.java @@ -0,0 +1,418 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; + +public class ExportacaoECF { + private List listaRegistroECF; + + private List listaRegistroECFTipoCFC; + private List listaRegistroECFTipoCCF; + private List listaRegistroECFTipoICF; + private List listaRegistroECFTipoPRC; + + public ExportacaoECF() { + listaRegistroECF = new ArrayList(0); + + listaRegistroECFTipoCFC = new ArrayList(0); + listaRegistroECFTipoCCF = new ArrayList(0); + listaRegistroECFTipoICF = new ArrayList(0); + listaRegistroECFTipoPRC = new ArrayList(0); + } + + public List getListaRegistroECF() { + return listaRegistroECF; + } + + public List getListaRegistroECFTipoCFC() { + return listaRegistroECFTipoCFC; + } + + public List getListaRegistroECFTipoCCF() { + return listaRegistroECFTipoCCF; + } + + public List getListaRegistroECFTipoICF() { + return listaRegistroECFTipoICF; + } + + public List getListaRegistroECFTipoPRC() { + return listaRegistroECFTipoPRC; + } + + public void gerarListas() { + gerarCFC(); + gerarCCF(); + gerarICF(); + gerarPRC(); + } + + private void gerarCFC() { + listaRegistroECFTipoCFC.clear(); + + ExportacaoECFTipoCFC registro = null; + + Map group = new HashMap(0); + + for (ExportacaoECFBase base : listaRegistroECF) { + String key = base.getEcf() + "-" + base.getNumeroSerie() + "-" + base.getDataEmissao() + "-" + base.getCooInicial() + "-" + base.getCooFinal() + "-" + base.getCooReducaoZ() + "-" + base.getCro() + "-" + base.getCooReducaoZ() + "-" + base.getEstabelecimento() + "-" + base.getEstabelecimentoECF() + "-" + base.getNumeroIdentificacaoECF() + "-" + base.getUfOrigem(); + + BigDecimal totalisenta = BigDecimal.ZERO; + BigDecimal totalvenda = BigDecimal.ZERO; + + if (base.getIsenta().intValue() == 1) { + totalisenta = MoneyHelper.somar(totalisenta, base.getValorTributado()); + } + + totalvenda = MoneyHelper.somar(totalvenda, base.getValorTributado()); + + if (group.containsKey(key)) { + registro = group.get(key); + + totalisenta = MoneyHelper.somar(totalisenta, registro.getValorIsentas()); + totalvenda = MoneyHelper.somar(totalvenda, registro.getValorTotal()); + + } else { + registro = new ExportacaoECFTipoCFC(); + } + + registro.setEstabelecimento(base.getEstabelecimento()); + registro.setDataEmissao(base.getDataEmissao()); + registro.setNumeroIdentificacaoECF(base.getNumeroIdentificacaoECF()); + registro.setEcf(base.getEcf()); + registro.setCooReducaoZ(base.getCooReducaoZ()); + registro.setCooInicial(base.getCooInicial()); + registro.setCooFinal(base.getCooFinal()); + registro.setContadorReducao(base.getContadorReducao()); + registro.setCro(base.getCro()); + registro.setEstabelecimentoECF(base.getEstabelecimentoECF()); + registro.setNumeroSerie(base.getNumeroSerie()); + registro.setInfoPadraoBilhetePassagem(base.getInfoPadraoBilhetePassagem()); + + registro.setValorIsentas(totalisenta); + registro.setValorTotal(totalvenda); + + group.put(key, registro); + } + + for (Map.Entry entry : group.entrySet()) { + listaRegistroECFTipoCFC.add(entry.getValue()); + } + + Collections.sort(listaRegistroECFTipoCFC, new Comparator(){ + public int compare(ExportacaoECFTipoCFC e1, ExportacaoECFTipoCFC e2) { + String c1 = e1.getDataEmissao() + (e1.getNumeroIdentificacaoECF() == null ? "000" : e1.getNumeroIdentificacaoECF()); + String c2 = e2.getDataEmissao() + (e2.getNumeroIdentificacaoECF() == null ? "000" : e2.getNumeroIdentificacaoECF()); + + return c1.compareToIgnoreCase(c2); + } + }); + } + + private void gerarCCF() { + listaRegistroECFTipoCCF.clear(); + + ExportacaoECFTipoCCF registro = null; + + for (ExportacaoECFBase base : listaRegistroECF) { + BigDecimal valorTributado = base.getValorTributado(); + + registro = new ExportacaoECFTipoCCF(); + registro.setEcf(base.getEcf()); + registro.setDataEmissao(base.getDataEmissao()); + registro.setCoo(base.getCoo()); + registro.setValorServico(valorTributado); + registro.setDescontoGlobal(null); + registro.setCodigoParticipante(null); + registro.setSituacaoCOO(0); // 0 - Documento Regular; 2 - Documento Cancelado + registro.setAcrescimo(null); + registro.setNumFolioSistema(base.getNumFolioSistema()); + + registro.setCodigoSituacaoTribColunaB(null); + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + if (base.getIsenta() == 1) { + registro.setCodigoSituacaoTribColunaB(40); + } + + registro.setUfOrigem(base.getUfOrigem()); + registro.setMunicipioOrigem(base.getMunicipioOrigem()); + registro.setUfDestino(base.getUfDestino()); + + // IM=5357; Serviço IE= 6357 + if (base.getUfOrigem().equals(base.getUfDestino())) { + registro.setCfop(5357); + } else { + registro.setCfop(6357); + } + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + if (registro.getCodigoSituacaoTribColunaB() == null) { + registro.setCodigoSituacaoTribColunaB(base.getReducaoBaseCalcICMS().compareTo(BigDecimal.ZERO) == 0 ? 0 : 20); + } + + BigDecimal valorTotal = valorTributado; + + BigDecimal red_base_calc_icms = MoneyHelper.instanciar(base.getReducaoBaseCalcICMS()); + BigDecimal tributacao_importacao = MoneyHelper.instanciar(base.getTributacaoImportacao()); + BigDecimal valorBaseCalculoICMS = BigDecimal.ZERO; + + if (registro.getCodigoSituacaoTribColunaB() != 0) { + if ("30|40|41|50|60".contains(registro.getCodigoSituacaoTribColunaB().toString())) { + tributacao_importacao = BigDecimal.ZERO; + } + } + + if (red_base_calc_icms != null) { + valorBaseCalculoICMS = valorTotal.subtract(valorTotal.multiply(red_base_calc_icms.divide(BigDecimal.valueOf(100d)))); + } else { + valorBaseCalculoICMS = valorTotal; + } + + if (base.getIsenta() == 1) { + valorBaseCalculoICMS = null; + } + + registro.setValorTotal(valorTotal); + + // 1 - Demais; 2 - Região Metropolitanao ou seja, quando o campo CSTB for "40", esse campo deve vir "2". Do contrário, deve vir "1" + registro.setTributacaoICMS(registro.getCodigoSituacaoTribColunaB() == 40 ? 2 : 1); + + registro.setValorBaseCalculoICMS(valorBaseCalculoICMS); + registro.setAliquotaICMS(tributacao_importacao); + + if (valorTotal.doubleValue() != 0) { + listaRegistroECFTipoCCF.add(registro); + } + } + + Collections.sort(listaRegistroECFTipoCCF, new Comparator(){ + public int compare(ExportacaoECFTipoCCF e1, ExportacaoECFTipoCCF e2) { + String c1 = String.format("%06d", e1.getCoo()); + String c2 = String.format("%06d", e2.getCoo()); + + if (c1.equals("000001")) { + c1 = "999999"; + } + + if (c2.equals("000001")) { + c2 = "999999"; + } + + return c1.compareToIgnoreCase(c2); + } + }); + } + + private void gerarICF() { + listaRegistroECFTipoICF.clear(); + + ExportacaoECFTipoICF registro = null; + + Map group = new HashMap(); + + for (ExportacaoECFBase base : listaRegistroECF) { + BigDecimal valorTotal = base.getValorTributado(); + + if (valorTotal == null || valorTotal.doubleValue() == 0) { + continue; + } + + BigDecimal red_base_calc_icms = MoneyHelper.instanciar(base.getReducaoBaseCalcICMS()); + BigDecimal porc_red_municipal = MoneyHelper.instanciar(base.getPorcReducaoMunicipal()); + BigDecimal porc_red_estadual = MoneyHelper.instanciar(base.getPorcReducaoEstadual()); + BigDecimal tributacao_importacao = MoneyHelper.instanciar(base.getTributacaoImportacao()); + BigDecimal valorBaseCalculoICMS = BigDecimal.ZERO; + + if (red_base_calc_icms != null) { + BigDecimal aRed_base_calc_icms = MoneyHelper.dividir(red_base_calc_icms, BigDecimal.valueOf(100d)); + valorBaseCalculoICMS = MoneyHelper.subtrair(valorTotal, MoneyHelper.multiplicar(valorTotal, aRed_base_calc_icms)); + } else { + valorBaseCalculoICMS = valorTotal; + } + + BigDecimal valorICMSDebitado = BigDecimal.ZERO; + + if (tributacao_importacao != null) { + BigDecimal aTributacao_importacao = MoneyHelper.dividir(tributacao_importacao, BigDecimal.valueOf(100d)); + valorICMSDebitado = MoneyHelper.multiplicar(valorBaseCalculoICMS, aTributacao_importacao); + } + + BigDecimal valorICMSIsento = BigDecimal.ZERO; + BigDecimal valorICMSOutros = MoneyHelper.subtrair(valorTotal, valorBaseCalculoICMS); + + String ecf = base.getEcf(); + String datamov = base.getDataEmissao(); + String ufDestino = ""; + String ufOrigem = ""; + Integer municipioOrigem = 0; + Integer cfop = 0; // IM=5357; Serviço IE= 6357 + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + Integer codigoSituacaoTribColunaB = null; + + if (base.getIsenta() == 1) { + codigoSituacaoTribColunaB = 40; + + valorICMSOutros = valorTotal; + } + + ufDestino = base.getUfDestino(); + ufOrigem = base.getUfOrigem(); + municipioOrigem = base.getMunicipioOrigem(); + + // IM=5357; Serviço IE= 6357 + if (base.getUfOrigem().equals(base.getUfDestino())) { + cfop = 5357; + } else { + cfop = 6357; + } + + // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + if (codigoSituacaoTribColunaB == null) { + codigoSituacaoTribColunaB = base.getReducaoBaseCalcICMS().compareTo(BigDecimal.ZERO) == 0 ? 0 : 20; + } + + if (codigoSituacaoTribColunaB == 40) { + tributacao_importacao = BigDecimal.ZERO; + valorBaseCalculoICMS = BigDecimal.ZERO; + valorICMSDebitado = BigDecimal.ZERO; + valorICMSOutros = BigDecimal.ZERO; + + valorICMSIsento = valorTotal; + } + + String key = ecf + "|" + datamov + "|" + ufDestino + "|" + cfop.toString() + "|" + codigoSituacaoTribColunaB.toString() + "|" + municipioOrigem; + + if (group.containsKey(key)) { + registro = group.get(key); + + valorTotal = MoneyHelper.somar(valorTotal, registro.getValorTotal()); + valorBaseCalculoICMS = MoneyHelper.somar(valorBaseCalculoICMS, registro.getValorBaseCalculoICMS()); + valorICMSDebitado = MoneyHelper.somar(valorICMSDebitado, registro.getValorICMSDebitado()); + valorICMSIsento = MoneyHelper.somar(valorICMSIsento, registro.getValorICMSIsento()); + valorICMSOutros = MoneyHelper.somar(valorICMSOutros, registro.getValorICMSOutros()); + } else { + registro = new ExportacaoECFTipoICF(); + registro.setEcf(ecf); + registro.setDataEmissao(datamov); + registro.setUfDestino(ufDestino); + registro.setCfop(cfop); // IM=5357; Serviço IE= 6357 + registro.setCodigoSituacaoTribColunaB(codigoSituacaoTribColunaB); // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + registro.setAliquotaICMS(tributacao_importacao); + registro.setUfOrigem(ufOrigem); + registro.setMunicipioOrigem(municipioOrigem); + + registro.setRedutorBaseCalculoIcms(red_base_calc_icms); + registro.setRedutorMunicipalIcms(porc_red_municipal); + registro.setRedutorEstadualIcms(porc_red_estadual); + + group.put(key, registro); + } + + registro.setValorTotal(valorTotal); + registro.setValorBaseCalculoICMS(valorBaseCalculoICMS); + registro.setValorICMSDebitado(valorICMSDebitado); + registro.setValorICMSIsento(valorICMSIsento); + registro.setValorICMSOutros(valorICMSOutros); + } + + for (Map.Entry entry : group.entrySet()) { + if (entry.getValue().getAliquotaICMS() != null && entry.getValue().getValorBaseCalculoICMS() != null) { + BigDecimal valorICMSDebitado = BigDecimal.ZERO; + + BigDecimal aTributacao_importacao = MoneyHelper.dividir(entry.getValue().getAliquotaICMS(), BigDecimal.valueOf(100d)); + valorICMSDebitado = MoneyHelper.multiplicar(entry.getValue().getValorBaseCalculoICMS(), aTributacao_importacao); + + entry.getValue().setValorICMSDebitado(valorICMSDebitado); + } + + listaRegistroECFTipoICF.add(entry.getValue()); + } + + Collections.sort(listaRegistroECFTipoICF, new Comparator(){ + public int compare(ExportacaoECFTipoICF e1, ExportacaoECFTipoICF e2) { + String c1 = e1.getUfDestino(); + String c2 = e2.getUfDestino(); + + return c1.compareToIgnoreCase(c2); + } + }); + } + + private void gerarPRC() { + listaRegistroECFTipoPRC.clear(); + + ExportacaoECFTipoPRC registro = null; + + Map group = new HashMap(); + + for (ExportacaoECFBase base : listaRegistroECF) { + BigDecimal valorTotal = base.getValorTributado(); + + BigDecimal red_base_calc_icms = MoneyHelper.instanciar(base.getReducaoBaseCalcICMS()); + BigDecimal tributacao_importacao = MoneyHelper.instanciar(base.getTributacaoImportacao()); + BigDecimal valorBaseCalculoICMS = BigDecimal.ZERO; + + if (tributacao_importacao != null) { + tributacao_importacao = MoneyHelper.dividir(tributacao_importacao, BigDecimal.valueOf(100d)); + } + + if (red_base_calc_icms != null) { + BigDecimal aRed_base_calc_icms = MoneyHelper.dividir(red_base_calc_icms, BigDecimal.valueOf(100d)); + valorBaseCalculoICMS = MoneyHelper.subtrair(valorTotal, MoneyHelper.multiplicar(valorTotal, aRed_base_calc_icms)); + } else { + valorBaseCalculoICMS = valorTotal; + } + + BigDecimal valorICMS = BigDecimal.ZERO; + + if (tributacao_importacao != null) { + valorICMS = MoneyHelper.multiplicar(valorBaseCalculoICMS, tributacao_importacao); + } + + String key = base.getEcf() + "|" + base.getDataEmissao() + "|" + base.getUfOrigem() + "|" + base.getMunicipioOrigem(); + + if (group.containsKey(key)) { + registro = group.get(key); + + registro.setValorTotal(MoneyHelper.somar(registro.getValorTotal(), valorTotal)); + registro.setValorBaseCalculoICMS(MoneyHelper.somar(registro.getValorBaseCalculoICMS(), valorBaseCalculoICMS)); + registro.setValorICMS(MoneyHelper.somar(registro.getValorICMS(), valorICMS)); + + } else { + registro = new ExportacaoECFTipoPRC(); + registro.setEcf(base.getEcf()); + registro.setDataEmissao(base.getDataEmissao()); + registro.setUfOrigem(base.getUfOrigem()); + registro.setMunicipioOrigem(base.getMunicipioOrigem()); + registro.setValorTotal(valorTotal); + registro.setValorBaseCalculoICMS(valorBaseCalculoICMS); + registro.setValorICMS(valorICMS); + registro.setTributacao(tributacao_importacao); + } + + group.put(key, registro); + } + + for (Map.Entry entry : group.entrySet()) { + listaRegistroECFTipoPRC.add(entry.getValue()); + } + + Collections.sort(listaRegistroECFTipoPRC, new Comparator(){ + public int compare(ExportacaoECFTipoPRC e1, ExportacaoECFTipoPRC e2) { + String c1 = String.valueOf(e1.getMunicipioOrigem()); + String c2 = String.valueOf(e2.getMunicipioOrigem()); + + return c1.compareToIgnoreCase(c2); + } + }); + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFBase.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFBase.java new file mode 100644 index 000000000..715b47aec --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFBase.java @@ -0,0 +1,236 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +import java.math.BigDecimal; + +public class ExportacaoECFBase { + private String estabelecimento; + private String dataEmissao; + private String numeroIdentificacaoECF; + private Integer cooReducaoZ; + private Integer cooInicial; + private Integer cooFinal; + private Integer contadorReducao; + private Integer cro; + private String estabelecimentoECF; + private String ecf; + private String numeroSerie; + private Integer coo; + private String numFolioSistema; + private String ufOrigem; + private Integer municipioOrigem; + private String ufDestino; + private Integer municipioDestino; + private BigDecimal reducaoBaseCalcICMS; + private BigDecimal porcReducaoMunicipal; + private BigDecimal porcReducaoEstadual; + private BigDecimal tributacaoImportacao; + private String infoPadraoBilhetePassagem; + + private Integer isenta; + private BigDecimal valorTributado; + private BigDecimal valorTotal; + + public ExportacaoECFBase() { + + } + + public String getEstabelecimento() { + return estabelecimento; + } + + public void setEstabelecimento(String estabelecimento) { + this.estabelecimento = estabelecimento; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public String getNumeroIdentificacaoECF() { + return numeroIdentificacaoECF; + } + + public void setNumeroIdentificacaoECF(String numeroIdentificacaoECF) { + this.numeroIdentificacaoECF = numeroIdentificacaoECF; + } + + public Integer getCooReducaoZ() { + return cooReducaoZ; + } + + public void setCooReducaoZ(Integer cooReducaoZ) { + this.cooReducaoZ = cooReducaoZ; + } + + public Integer getCooInicial() { + return cooInicial; + } + + public void setCooInicial(Integer cooInicial) { + this.cooInicial = cooInicial; + } + + public Integer getCooFinal() { + return cooFinal; + } + + public void setCooFinal(Integer cooFinal) { + this.cooFinal = cooFinal; + } + + public Integer getContadorReducao() { + return contadorReducao; + } + + public void setContadorReducao(Integer contadorReducao) { + this.contadorReducao = contadorReducao; + } + + public Integer getCro() { + return cro; + } + + public void setCro(Integer cro) { + this.cro = cro; + } + + public String getEstabelecimentoECF() { + return estabelecimentoECF; + } + + public void setEstabelecimentoECF(String estabelecimentoECF) { + this.estabelecimentoECF = estabelecimentoECF; + } + + public String getEcf() { + return ecf; + } + + public void setEcf(String ecf) { + this.ecf = ecf; + } + + public String getNumeroSerie() { + return numeroSerie; + } + + public void setNumeroSerie(String numeroSerie) { + this.numeroSerie = numeroSerie; + } + + public Integer getCoo() { + return coo; + } + + public void setCoo(Integer coo) { + this.coo = coo; + } + + public String getNumFolioSistema() { + return numFolioSistema; + } + + public void setNumFolioSistema(String numFolioSistema) { + this.numFolioSistema = numFolioSistema; + } + + public String getUfOrigem() { + return ufOrigem; + } + + public void setUfOrigem(String ufOrigem) { + this.ufOrigem = ufOrigem; + } + + public Integer getMunicipioOrigem() { + return municipioOrigem; + } + + public void setMunicipioOrigem(Integer municipioOrigem) { + this.municipioOrigem = municipioOrigem; + } + + public String getUfDestino() { + return ufDestino; + } + + public void setUfDestino(String ufDestino) { + this.ufDestino = ufDestino; + } + + public Integer getMunicipioDestino() { + return municipioDestino; + } + + public void setMunicipioDestino(Integer municipioDestino) { + this.municipioDestino = municipioDestino; + } + + public BigDecimal getReducaoBaseCalcICMS() { + return reducaoBaseCalcICMS == null ? BigDecimal.ZERO : reducaoBaseCalcICMS; + } + + public void setReducaoBaseCalcICMS(BigDecimal reducaoBaseCalcICMS) { + this.reducaoBaseCalcICMS = reducaoBaseCalcICMS; + } + + public BigDecimal getPorcReducaoMunicipal() { + return porcReducaoMunicipal; + } + + public void setPorcReducaoMunicipal(BigDecimal porcReducaoMunicipal) { + this.porcReducaoMunicipal = porcReducaoMunicipal; + } + + public BigDecimal getPorcReducaoEstadual() { + return porcReducaoEstadual; + } + + public void setPorcReducaoEstadual(BigDecimal porcReducaoEstadual) { + this.porcReducaoEstadual = porcReducaoEstadual; + } + + public BigDecimal getTributacaoImportacao() { + return tributacaoImportacao; + } + + public void setTributacaoImportacao(BigDecimal tributacaoImportacao) { + this.tributacaoImportacao = tributacaoImportacao; + } + + public String getInfoPadraoBilhetePassagem() { + return infoPadraoBilhetePassagem; + } + + public void setInfoPadraoBilhetePassagem(String infoPadraoBilhetePassagem) { + this.infoPadraoBilhetePassagem = infoPadraoBilhetePassagem; + } + + public Integer getIsenta() { + return isenta; + } + + public void setIsenta(Integer isenta) { + this.isenta = isenta; + } + + public BigDecimal getValorTributado() { + return valorTributado; + } + + public void setValorTributado(BigDecimal valorTributado) { + this.valorTributado = valorTributado; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoCCF.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoCCF.java new file mode 100644 index 000000000..bbe77eea7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoCCF.java @@ -0,0 +1,177 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +import java.math.BigDecimal; + +public class ExportacaoECFTipoCCF { + private Integer coo; + private BigDecimal valorServico; + private BigDecimal descontoGlobal; + private Integer codigoParticipante; + private Integer situacaoCOO; // 0 - Documento Regular; 2 - Documento Cancelado + private BigDecimal acrescimo; + private String ufOrigem; + private Integer municipioOrigem; + private String ufDestino; + private Integer cfop; // IM=5357; Serviço IE= 6357 + private Integer codigoSituacaoTribColunaB; // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + private BigDecimal valorTotal; + private Integer tributacaoICMS; // 1 - Demais; 2 - Região Metropolitanao ou seja, quando o campo CSTB for "40", esse campo deve vir "2". Do contrário, deve vir "1" + private BigDecimal valorBaseCalculoICMS; + private BigDecimal aliquotaICMS; + private String ecf; + private String dataEmissao; + private String numFolioSistema; + + public ExportacaoECFTipoCCF() { + + } + + public Integer getCoo() { + return coo; + } + + public void setCoo(Integer coo) { + this.coo = coo; + } + + public BigDecimal getValorServico() { + return valorServico; + } + + public void setValorServico(BigDecimal valorServico) { + this.valorServico = valorServico; + } + + public BigDecimal getDescontoGlobal() { + return descontoGlobal; + } + + public void setDescontoGlobal(BigDecimal descontoGlobal) { + this.descontoGlobal = descontoGlobal; + } + + public Integer getCodigoParticipante() { + return codigoParticipante; + } + + public void setCodigoParticipante(Integer codigoParticipante) { + this.codigoParticipante = codigoParticipante; + } + + public Integer getSituacaoCOO() { + return situacaoCOO; + } + + public void setSituacaoCOO(Integer situacaoCOO) { + this.situacaoCOO = situacaoCOO; + } + + public BigDecimal getAcrescimo() { + return acrescimo; + } + + public void setAcrescimo(BigDecimal acrescimo) { + this.acrescimo = acrescimo; + } + + public String getUfOrigem() { + return ufOrigem; + } + + public void setUfOrigem(String ufOrigem) { + this.ufOrigem = ufOrigem; + } + + public Integer getMunicipioOrigem() { + return municipioOrigem; + } + + public void setMunicipioOrigem(Integer municipioOrigem) { + this.municipioOrigem = municipioOrigem; + } + + public String getUfDestino() { + return ufDestino; + } + + public void setUfDestino(String ufDestino) { + this.ufDestino = ufDestino; + } + + public Integer getCfop() { + return cfop; + } + + public void setCfop(Integer cfop) { + this.cfop = cfop; + } + + public Integer getCodigoSituacaoTribColunaB() { + return codigoSituacaoTribColunaB; + } + + public void setCodigoSituacaoTribColunaB(Integer codigoSituacaoTribColunaB) { + this.codigoSituacaoTribColunaB = codigoSituacaoTribColunaB; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public Integer getTributacaoICMS() { + return tributacaoICMS; + } + + public void setTributacaoICMS(Integer tributacaoICMS) { + this.tributacaoICMS = tributacaoICMS; + } + + public BigDecimal getValorBaseCalculoICMS() { + return valorBaseCalculoICMS; + } + + public void setValorBaseCalculoICMS(BigDecimal valorBaseCalculoICMS) { + this.valorBaseCalculoICMS = valorBaseCalculoICMS; + } + + public BigDecimal getAliquotaICMS() { + return aliquotaICMS; + } + + public void setAliquotaICMS(BigDecimal aliquotaICMS) { + this.aliquotaICMS = aliquotaICMS; + } + + public String getEcf() { + return ecf; + } + + public void setEcf(String ecf) { + this.ecf = ecf; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public String getNumFolioSistema() { + return numFolioSistema; + } + + public void setNumFolioSistema(String numFolioSistema) { + this.numFolioSistema = numFolioSistema; + } + + @Override + public String toString() { + return "ExportacaoECFTipoCCF [coo=" + coo + ", valorServico=" + valorServico + ", descontoGlobal=" + descontoGlobal + ", codigoParticipante=" + codigoParticipante + ", situacaoCOO=" + situacaoCOO + ", acrescimo=" + acrescimo + ", ufOrigem=" + ufOrigem + ", municipioOrigem=" + municipioOrigem + ", ufDestino=" + ufDestino + ", cfop=" + cfop + ", codigoSituacaoTribColunaB=" + codigoSituacaoTribColunaB + ", valorTotal=" + valorTotal + ", tributacaoICMS=" + tributacaoICMS + ", valorBaseCalculoICMS=" + valorBaseCalculoICMS + ", aliquotaICMS=" + aliquotaICMS + ", ecf=" + ecf + ", dataEmissao=" + dataEmissao + ", numFolioSistema=" + numFolioSistema + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoCFC.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoCFC.java new file mode 100644 index 000000000..93f1ccd0a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoCFC.java @@ -0,0 +1,141 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +import java.math.BigDecimal; + +public class ExportacaoECFTipoCFC { + private String estabelecimento; + private String dataEmissao; + private String numeroIdentificacaoECF; + private Integer cooReducaoZ; + private Integer cooInicial; + private Integer cooFinal; + private Integer contadorReducao; + private Integer cro; + private BigDecimal valorTotal; + private BigDecimal valorIsentas; + private String estabelecimentoECF; + private String ecf; + private String numeroSerie; + private String infoPadraoBilhetePassagem; + + public ExportacaoECFTipoCFC() { + + } + + public String getEstabelecimento() { + return estabelecimento; + } + + public void setEstabelecimento(String estabelecimento) { + this.estabelecimento = estabelecimento; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public String getNumeroIdentificacaoECF() { + return numeroIdentificacaoECF; + } + + public void setNumeroIdentificacaoECF(String numeroIdentificacaoECF) { + this.numeroIdentificacaoECF = numeroIdentificacaoECF; + } + + public Integer getCooReducaoZ() { + return cooReducaoZ; + } + + public void setCooReducaoZ(Integer cooReducaoZ) { + this.cooReducaoZ = cooReducaoZ; + } + + public Integer getCooInicial() { + return cooInicial; + } + + public void setCooInicial(Integer cooInicial) { + this.cooInicial = cooInicial; + } + + public Integer getCooFinal() { + return cooFinal; + } + + public void setCooFinal(Integer cooFinal) { + this.cooFinal = cooFinal; + } + + public Integer getContadorReducao() { + return contadorReducao; + } + + public void setContadorReducao(Integer contadorReducao) { + this.contadorReducao = contadorReducao; + } + + public Integer getCro() { + return cro; + } + + public void setCro(Integer cro) { + this.cro = cro; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public BigDecimal getValorIsentas() { + return valorIsentas; + } + + public void setValorIsentas(BigDecimal valorIsentas) { + this.valorIsentas = valorIsentas; + } + + public String getEstabelecimentoECF() { + return estabelecimentoECF; + } + + public void setEstabelecimentoECF(String estabelecimentoECF) { + this.estabelecimentoECF = estabelecimentoECF; + } + + public String getEcf() { + return ecf; + } + + public void setEcf(String ecf) { + this.ecf = ecf; + } + + public String getNumeroSerie() { + return numeroSerie; + } + + public void setNumeroSerie(String numeroSerie) { + this.numeroSerie = numeroSerie; + } + + public String getInfoPadraoBilhetePassagem() { + return infoPadraoBilhetePassagem; + } + + public void setInfoPadraoBilhetePassagem(String infoPadraoBilhetePassagem) { + this.infoPadraoBilhetePassagem = infoPadraoBilhetePassagem; + } + + @Override + public String toString() { + return "ExportacaoECFTipoCFC [estabelecimento=" + estabelecimento + ", dataEmissao=" + dataEmissao + ", numeroIdentificacaoECF=" + numeroIdentificacaoECF + ", cooReducaoZ=" + cooReducaoZ + ", cooInicial=" + cooInicial + ", cooFinal=" + cooFinal + ", contadorReducao=" + contadorReducao + ", cro=" + cro + ", valorTotal=" + valorTotal + ", valorIsentas=" + valorIsentas + ", estabelecimentoECF=" + estabelecimentoECF + ", ecf=" + ecf + ", numeroSerie=" + numeroSerie + ", infoPadraoBilhetePassagem=" + infoPadraoBilhetePassagem + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoICF.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoICF.java new file mode 100644 index 000000000..93d2606b1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoICF.java @@ -0,0 +1,161 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +import java.math.BigDecimal; + +public class ExportacaoECFTipoICF { + private BigDecimal valorTotal; + private String ufDestino; + private Integer cfop; // IM=5357; Serviço IE= 6357 + private BigDecimal valorBaseCalculoICMS; + private BigDecimal aliquotaICMS; + private BigDecimal valorICMSDebitado; + private BigDecimal valorICMSIsento; + private BigDecimal valorICMSOutros; + private Integer codigoSituacaoTribColunaB; // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + private String ufOrigem; + private Integer municipioOrigem; + private String ecf; + private String dataEmissao; + + private BigDecimal redutorBaseCalculoIcms; + private BigDecimal redutorMunicipalIcms; + private BigDecimal redutorEstadualIcms; + + + public ExportacaoECFTipoICF() { + + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public String getUfDestino() { + return ufDestino; + } + + public void setUfDestino(String ufDestino) { + this.ufDestino = ufDestino; + } + + public Integer getCfop() { + return cfop; + } + + public void setCfop(Integer cfop) { + this.cfop = cfop; + } + + public BigDecimal getValorBaseCalculoICMS() { + return valorBaseCalculoICMS; + } + + public void setValorBaseCalculoICMS(BigDecimal valorBaseCalculoICMS) { + this.valorBaseCalculoICMS = valorBaseCalculoICMS; + } + + public BigDecimal getAliquotaICMS() { + return aliquotaICMS; + } + + public void setAliquotaICMS(BigDecimal aliquotaICMS) { + this.aliquotaICMS = aliquotaICMS; + } + + public BigDecimal getValorICMSDebitado() { + return valorICMSDebitado; + } + + public void setValorICMSDebitado(BigDecimal valorICMSDebitado) { + this.valorICMSDebitado = valorICMSDebitado; + } + + public BigDecimal getValorICMSIsento() { + return valorICMSIsento; + } + + public void setValorICMSIsento(BigDecimal valorICMSIsento) { + this.valorICMSIsento = valorICMSIsento; + } + + public BigDecimal getValorICMSOutros() { + return valorICMSOutros; + } + + public void setValorICMSOutros(BigDecimal valorICMSOutros) { + this.valorICMSOutros = valorICMSOutros; + } + + public Integer getCodigoSituacaoTribColunaB() { + return codigoSituacaoTribColunaB; + } + + public void setCodigoSituacaoTribColunaB(Integer codigoSituacaoTribColunaB) { + this.codigoSituacaoTribColunaB = codigoSituacaoTribColunaB; + } + + public String getUfOrigem() { + return ufOrigem; + } + + public void setUfOrigem(String ufOrigem) { + this.ufOrigem = ufOrigem; + } + + public Integer getMunicipioOrigem() { + return municipioOrigem; + } + + public void setMunicipioOrigem(Integer municipioOrigem) { + this.municipioOrigem = municipioOrigem; + } + + public String getEcf() { + return ecf; + } + + public void setEcf(String ecf) { + this.ecf = ecf; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public BigDecimal getRedutorBaseCalculoIcms() { + return redutorBaseCalculoIcms; + } + + public void setRedutorBaseCalculoIcms(BigDecimal redutorBaseCalculoIcms) { + this.redutorBaseCalculoIcms = redutorBaseCalculoIcms; + } + + public BigDecimal getRedutorMunicipalIcms() { + return redutorMunicipalIcms; + } + + public void setRedutorMunicipalIcms(BigDecimal redutorMunicipalIcms) { + this.redutorMunicipalIcms = redutorMunicipalIcms; + } + + public BigDecimal getRedutorEstadualIcms() { + return redutorEstadualIcms; + } + + public void setRedutorEstadualIcms(BigDecimal redutorEstadualIcms) { + this.redutorEstadualIcms = redutorEstadualIcms; + } + + @Override + public String toString() { + return "ExportacaoECFTipoICF [valorTotal=" + valorTotal + ", ufDestino=" + ufDestino + ", cfop=" + cfop + ", valorBaseCalculoICMS=" + valorBaseCalculoICMS + ", aliquotaICMS=" + aliquotaICMS + ", valorICMSDebitado=" + valorICMSDebitado + ", valorICMSIsento=" + valorICMSIsento + ", valorICMSOutros=" + valorICMSOutros + ", codigoSituacaoTribColunaB=" + codigoSituacaoTribColunaB + ", ufOrigem=" + ufOrigem + ", municipioOrigem=" + municipioOrigem + ", ecf=" + ecf + ", dataEmissao=" + dataEmissao + ", redutorBaseCalculoIcms=" + redutorBaseCalculoIcms + ", redutorMunicipalIcms=" + redutorMunicipalIcms + ", redutorEstadualIcms=" + redutorEstadualIcms + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoPRC.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoPRC.java new file mode 100644 index 000000000..a4b275739 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoECFTipoPRC.java @@ -0,0 +1,87 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +import java.math.BigDecimal; + +public class ExportacaoECFTipoPRC { + private String ufOrigem; + private Integer municipioOrigem ; + private BigDecimal valorTotal; + private BigDecimal valorBaseCalculoICMS; + private BigDecimal valorICMS; + private String ecf; + private String dataEmissao; + private BigDecimal tributacao; + + public ExportacaoECFTipoPRC() { + + } + + public String getUfOrigem() { + return ufOrigem; + } + + public void setUfOrigem(String ufOrigem) { + this.ufOrigem = ufOrigem; + } + + public Integer getMunicipioOrigem() { + return municipioOrigem; + } + + public void setMunicipioOrigem(Integer municipioOrigem) { + this.municipioOrigem = municipioOrigem; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public BigDecimal getValorBaseCalculoICMS() { + return valorBaseCalculoICMS; + } + + public void setValorBaseCalculoICMS(BigDecimal valorBaseCalculoICMS) { + this.valorBaseCalculoICMS = valorBaseCalculoICMS; + } + + public BigDecimal getValorICMS() { + return valorICMS; + } + + public void setValorICMS(BigDecimal valorICMS) { + this.valorICMS = valorICMS; + } + + public String getEcf() { + return ecf; + } + + public void setEcf(String ecf) { + this.ecf = ecf; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public BigDecimal getTributacao() { + return tributacao; + } + + public void setTributacao(BigDecimal tributacao) { + this.tributacao = tributacao; + } + + @Override + public String toString() { + return "ExportacaoECFTipoPRC [ufOrigem=" + ufOrigem + ", municipioOrigem=" + municipioOrigem + ", valorTotal=" + valorTotal + ", valorBaseCalculoICMS=" + valorBaseCalculoICMS + ", valorICMS=" + valorICMS + ", ecf=" + ecf + ", dataEmissao=" + dataEmissao + ", tributacao=" + tributacao + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoBPS.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoBPS.java new file mode 100644 index 000000000..ca6381c09 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoBPS.java @@ -0,0 +1,159 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +import java.math.BigDecimal; + +public class ExportacaoRMDTipoBPS { + private Integer codigoEstabelecimento; + private String especie; + private Long numeroAIDF; + private String serieAIDF; + private String subSerieAIDF; + private Long numeroInicial; + private Long numeroFinal; + private Integer quantidadeCancelados; + private String dataEmissao; + private BigDecimal valorTotal; + private Boolean resumoMovimentoDiario; + private Long numeroAIDFRMD; + private String serieAIDFRMD; + private String subSerieAIDFRMD; + private Integer numeroRMD; + private Integer quantidadeTotal; + + public ExportacaoRMDTipoBPS() { + + } + + public Integer getCodigoEstabelecimento() { + return codigoEstabelecimento; + } + + public void setCodigoEstabelecimento(Integer codigoEstabelecimento) { + this.codigoEstabelecimento = codigoEstabelecimento; + } + + public String getEspecie() { + return especie; + } + + public void setEspecie(String especie) { + this.especie = especie; + } + + public Long getNumeroAIDF() { + return numeroAIDF; + } + + public void setNumeroAIDF(Long numeroAIDF) { + this.numeroAIDF = numeroAIDF; + } + + public String getSerieAIDF() { + return serieAIDF; + } + + public void setSerieAIDF(String serieAIDF) { + this.serieAIDF = serieAIDF; + } + + public String getSubSerieAIDF() { + return subSerieAIDF; + } + + public void setSubSerieAIDF(String subSerieAIDF) { + this.subSerieAIDF = subSerieAIDF; + } + + public Long getNumeroInicial() { + return numeroInicial; + } + + public void setNumeroInicial(Long numeroInicial) { + this.numeroInicial = numeroInicial; + } + + public Long getNumeroFinal() { + return numeroFinal; + } + + public void setNumeroFinal(Long numeroFinal) { + this.numeroFinal = numeroFinal; + } + + public Integer getQuantidadeCancelados() { + return quantidadeCancelados; + } + + public void setQuantidadeCancelados(Integer quantidadeCancelados) { + this.quantidadeCancelados = quantidadeCancelados; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public Boolean getResumoMovimentoDiario() { + return resumoMovimentoDiario; + } + + public void setResumoMovimentoDiario(Boolean resumoMovimentoDiario) { + this.resumoMovimentoDiario = resumoMovimentoDiario; + } + + public Long getNumeroAIDFRMD() { + return numeroAIDFRMD; + } + + public void setNumeroAIDFRMD(Long numeroAIDFRMD) { + this.numeroAIDFRMD = numeroAIDFRMD; + } + + public String getSerieAIDFRMD() { + return serieAIDFRMD; + } + + public void setSerieAIDFRMD(String serieAIDFRMD) { + this.serieAIDFRMD = serieAIDFRMD; + } + + public String getSubSerieAIDFRMD() { + return subSerieAIDFRMD; + } + + public void setSubSerieAIDFRMD(String subSerieAIDFRMD) { + this.subSerieAIDFRMD = subSerieAIDFRMD; + } + + public Integer getNumeroRMD() { + return numeroRMD; + } + + public void setNumeroRMD(Integer numeroRMD) { + this.numeroRMD = numeroRMD; + } + + public Integer getQuantidadeTotal() { + return quantidadeTotal; + } + + public void setQuantidadeTotal(Integer quantidadeTotal) { + this.quantidadeTotal = quantidadeTotal; + } + + @Override + public String toString() { + return "ExportacaoRMDTipoBPS [codigoEstabelecimento=" + codigoEstabelecimento + ", especie=" + especie + ", numeroAIDF=" + numeroAIDF + ", serieAIDF=" + serieAIDF + ", subSerieAIDF=" + subSerieAIDF + ", numeroInicial=" + numeroInicial + ", numeroFinal=" + numeroFinal + ", quantidadeCancelados=" + quantidadeCancelados + ", dataEmissao=" + dataEmissao + ", valorTotal=" + valorTotal + ", resumoMovimentoDiario=" + resumoMovimentoDiario + ", numeroAIDFRMD=" + numeroAIDFRMD + ", serieAIDFRMD=" + serieAIDFRMD + ", subSerieAIDFRMD=" + subSerieAIDFRMD + ", numeroRMD=" + numeroRMD + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoDBP.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoDBP.java new file mode 100644 index 000000000..5a2b7daad --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoDBP.java @@ -0,0 +1,114 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +import java.math.BigDecimal; + +public class ExportacaoRMDTipoDBP { + private String ufDestino; + private Integer cfop; // IM=5357; Serviço IE= 6357 + private BigDecimal valorTotal; + private BigDecimal valorBaseCalculoICMS; + private BigDecimal aliquotaICMS; + private BigDecimal valorICMS; + private BigDecimal valorICMSIsento; + private BigDecimal valorICMSOutros; + private Integer codigoSituacaoTribColunaB; // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + private String ufOrigem; + private Integer municipioOrigem; + + public ExportacaoRMDTipoDBP() { + + } + + public String getUfDestino() { + return ufDestino; + } + + public void setUfDestino(String ufDestino) { + this.ufDestino = ufDestino; + } + + public Integer getCfop() { + return cfop; + } + + public void setCfop(Integer cfop) { + this.cfop = cfop; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public BigDecimal getValorBaseCalculoICMS() { + return valorBaseCalculoICMS; + } + + public void setValorBaseCalculoICMS(BigDecimal valorBaseCalculoICMS) { + this.valorBaseCalculoICMS = valorBaseCalculoICMS; + } + + public BigDecimal getAliquotaICMS() { + return aliquotaICMS; + } + + public void setAliquotaICMS(BigDecimal aliquotaICMS) { + this.aliquotaICMS = aliquotaICMS; + } + + public BigDecimal getValorICMS() { + return valorICMS; + } + + public void setValorICMS(BigDecimal valorICMS) { + this.valorICMS = valorICMS; + } + + public BigDecimal getValorICMSIsento() { + return valorICMSIsento; + } + + public void setValorICMSIsento(BigDecimal valorICMSIsento) { + this.valorICMSIsento = valorICMSIsento; + } + + public BigDecimal getValorICMSOutros() { + return valorICMSOutros; + } + + public void setValorICMSOutros(BigDecimal valorICMSOutros) { + this.valorICMSOutros = valorICMSOutros; + } + + public Integer getCodigoSituacaoTribColunaB() { + return codigoSituacaoTribColunaB; + } + + public void setCodigoSituacaoTribColunaB(Integer codigoSituacaoTribColunaB) { + this.codigoSituacaoTribColunaB = codigoSituacaoTribColunaB; + } + + public String getUfOrigem() { + return ufOrigem; + } + + public void setUfOrigem(String ufOrigem) { + this.ufOrigem = ufOrigem; + } + + public Integer getMunicipioOrigem() { + return municipioOrigem; + } + + public void setMunicipioOrigem(Integer municipioOrigem) { + this.municipioOrigem = municipioOrigem; + } + + @Override + public String toString() { + return "ExportacaoRMDTipoDBP [ufDestino=" + ufDestino + ", cfop=" + cfop + ", valorTotal=" + valorTotal + ", valorBaseCalculoICMS=" + valorBaseCalculoICMS + ", aliquotaICMS=" + aliquotaICMS + ", valorICMS=" + valorICMS + ", valorICMSIsento=" + valorICMSIsento + ", valorICMSOutros=" + valorICMSOutros + ", codigoSituacaoTribColunaB=" + codigoSituacaoTribColunaB + ", ufOrigem=" + ufOrigem + ", municipioOrigem=" + municipioOrigem + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoPAR.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoPAR.java new file mode 100644 index 000000000..bc6ac9fbc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoPAR.java @@ -0,0 +1,121 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +public class ExportacaoRMDTipoPAR { + private Integer codigoParticipante; + private Integer codigoEstabelecimento; + private String nomeParticipante; + private String ufParticipante; + private String cpfParticipante; + private String ieParticipante; + private String imParticipante; + private String logradouro; + private String numero; + private String complemento; + private String bairro; + private Integer cep; + + public ExportacaoRMDTipoPAR() { + + } + + public Integer getCodigoParticipante() { + return codigoParticipante; + } + + public void setCodigoParticipante(Integer codigoParticipante) { + this.codigoParticipante = codigoParticipante; + } + + public String getNomeParticipante() { + return nomeParticipante; + } + + public void setNomeParticipante(String nomeParticipante) { + this.nomeParticipante = nomeParticipante; + } + + public String getUfParticipante() { + return ufParticipante; + } + + public void setUfParticipante(String ufParticipante) { + this.ufParticipante = ufParticipante; + } + + public String getCpfParticipante() { + return cpfParticipante; + } + + public void setCpfParticipante(String cpfParticipante) { + this.cpfParticipante = cpfParticipante; + } + + public String getIeParticipante() { + return ieParticipante; + } + + public void setIeParticipante(String ieParticipante) { + this.ieParticipante = ieParticipante; + } + + public String getImParticipante() { + return imParticipante; + } + + public void setImParticipante(String imParticipante) { + this.imParticipante = imParticipante; + } + + public String getLogradouro() { + return logradouro; + } + + public void setLogradouro(String logradouro) { + this.logradouro = logradouro; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public Integer getCep() { + return cep; + } + + public void setCep(Integer cep) { + this.cep = cep; + } + + public Integer getCodigoEstabelecimento() { + return codigoEstabelecimento; + } + + public void setCodigoEstabelecimento(Integer codigoEstabelecimento) { + this.codigoEstabelecimento = codigoEstabelecimento; + } + + @Override + public String toString() { + return "ExportacaoRMDTipoPAR [codigoParticipante=" + codigoParticipante + ", codigoEstabelecimento=" + codigoEstabelecimento + ", nomeParticipante=" + nomeParticipante + ", ufParticipante=" + ufParticipante + ", cpfParticipante=" + cpfParticipante + ", ieParticipante=" + ieParticipante + ", imParticipante=" + imParticipante + ", logradouro=" + logradouro + ", numero=" + numero + ", complemento=" + complemento + ", bairro=" + bairro + ", cep=" + cep + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoRMD.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoRMD.java new file mode 100644 index 000000000..251661716 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoRMD.java @@ -0,0 +1,103 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +public class ExportacaoRMDTipoRMD { + private Integer codigoEstabelecimento; + private String numeroAIDF; + private String serieAIDF; + private String subSerieAIDF; + private Long numeroBilheteAIDF; + private Long numeroFormularioAIDF; + private String dataEmissao; + private Boolean cancelado; + private Integer codigoParticipante; + private String codigoContabil; + + public ExportacaoRMDTipoRMD() { + + } + + public Integer getCodigoEstabelecimento() { + return codigoEstabelecimento; + } + + public void setCodigoEstabelecimento(Integer codigoEstabelecimento) { + this.codigoEstabelecimento = codigoEstabelecimento; + } + + public String getNumeroAIDF() { + return numeroAIDF; + } + + public void setNumeroAIDF(String numeroAIDF) { + this.numeroAIDF = numeroAIDF; + } + + public String getSerieAIDF() { + return serieAIDF; + } + + public void setSerieAIDF(String serieAIDF) { + this.serieAIDF = serieAIDF; + } + + public String getSubSerieAIDF() { + return subSerieAIDF; + } + + public void setSubSerieAIDF(String subSerieAIDF) { + this.subSerieAIDF = subSerieAIDF; + } + + public Long getNumeroBilheteAIDF() { + return numeroBilheteAIDF; + } + + public void setNumeroBilheteAIDF(Long numeroBilheteAIDF) { + this.numeroBilheteAIDF = numeroBilheteAIDF; + } + + public Long getNumeroFormularioAIDF() { + return numeroFormularioAIDF; + } + + public void setNumeroFormularioAIDF(Long numeroFormularioAIDF) { + this.numeroFormularioAIDF = numeroFormularioAIDF; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public Boolean getCancelado() { + return cancelado; + } + + public void setCancelado(Boolean cancelado) { + this.cancelado = cancelado; + } + + public Integer getCodigoParticipante() { + return codigoParticipante; + } + + public void setCodigoParticipante(Integer codigoParticipante) { + this.codigoParticipante = codigoParticipante; + } + + public String getCodigoContabil() { + return codigoContabil; + } + + public void setCodigoContabil(String codigoContabil) { + this.codigoContabil = codigoContabil; + } + + @Override + public String toString() { + return "ExportacaoRMDTipoRMD [codigoEstabelecimento=" + codigoEstabelecimento + ", numeroAIDF=" + numeroAIDF + ", serieAIDF=" + serieAIDF + ", subSerieAIDF=" + subSerieAIDF + ", numeroBilheteAIDF=" + numeroBilheteAIDF + ", numeroFormularioAIDF=" + numeroFormularioAIDF + ", dataEmissao=" + dataEmissao + ", cancelado=" + cancelado + ", codigoParticipante=" + codigoParticipante + ", codigoContabil=" + codigoContabil + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoSeqBPS.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoSeqBPS.java new file mode 100644 index 000000000..c648f79fe --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoSeqBPS.java @@ -0,0 +1,185 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +public class ExportacaoRMDTipoSeqBPS { + private Integer codigoEstabelecimento; + private String especie; + private String numeroAIDF; + private String serieAIDF; + private String subSerieAIDF; + private Long numeroInicial; + private Long numeroFinal; + private Integer quantidadeCancelados; + private String dataEmissao; + private BigDecimal valorTotal; + private String numeroAIDFRMD; + private String serieAIDFRMD; + private String subSerieAIDFRMD; + private Integer numeroRMD; + private Integer quantidadeTotal; + private String infoPadraoBilhetePassagem; + private List listaDBP; + + public ExportacaoRMDTipoSeqBPS() { + listaDBP = new ArrayList(0); + + quantidadeTotal = 0; + quantidadeCancelados = 0; + } + + public Integer getCodigoEstabelecimento() { + return codigoEstabelecimento; + } + + public void setCodigoEstabelecimento(Integer codigoEstabelecimento) { + this.codigoEstabelecimento = codigoEstabelecimento; + } + + public String getEspecie() { + return especie; + } + + public void setEspecie(String especie) { + this.especie = especie; + } + + public String getNumeroAIDF() { + return numeroAIDF; + } + + public void setNumeroAIDF(String numeroAIDF) { + this.numeroAIDF = numeroAIDF; + } + + public String getSerieAIDF() { + return serieAIDF; + } + + public void setSerieAIDF(String serieAIDF) { + this.serieAIDF = serieAIDF; + } + + public String getSubSerieAIDF() { + return subSerieAIDF; + } + + public void setSubSerieAIDF(String subSerieAIDF) { + this.subSerieAIDF = subSerieAIDF; + } + + public Long getNumeroInicial() { + return numeroInicial; + } + + public void setNumeroInicial(Long numeroInicial) { + this.numeroInicial = numeroInicial; + } + + public Long getNumeroFinal() { + return numeroFinal; + } + + public void setNumeroFinal(Long numeroFinal) { + this.numeroFinal = numeroFinal; + } + + public Integer getQuantidadeCancelados() { + return quantidadeCancelados; + } + + public void setQuantidadeCancelados(Integer quantidadeCancelados) { + this.quantidadeCancelados = quantidadeCancelados; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public BigDecimal getValorTotal() { + if (quantidadeTotal.intValue() == quantidadeCancelados.intValue()) { + return null; + } + + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public Boolean getResumoMovimentoDiario() { + if (quantidadeTotal.intValue() == quantidadeCancelados.intValue()) { + return null; + } else { + return Boolean.TRUE; + } + } + + public String getNumeroAIDFRMD() { + return numeroAIDFRMD; + } + + public void setNumeroAIDFRMD(String numeroAIDFRMD) { + this.numeroAIDFRMD = numeroAIDFRMD; + } + + public String getSerieAIDFRMD() { + return serieAIDFRMD; + } + + public void setSerieAIDFRMD(String serieAIDFRMD) { + this.serieAIDFRMD = serieAIDFRMD; + } + + public String getSubSerieAIDFRMD() { + return subSerieAIDFRMD; + } + + public void setSubSerieAIDFRMD(String subSerieAIDFRMD) { + this.subSerieAIDFRMD = subSerieAIDFRMD; + } + + public Integer getNumeroRMD() { + return numeroRMD; + } + + public void setNumeroRMD(Integer numeroRMD) { + this.numeroRMD = numeroRMD; + } + + public Integer getQuantidadeTotal() { + return quantidadeTotal; + } + + public void setQuantidadeTotal(Integer quantidadeTotal) { + this.quantidadeTotal = quantidadeTotal; + } + + public String getInfoPadraoBilhetePassagem() { + return infoPadraoBilhetePassagem; + } + + public void setInfoPadraoBilhetePassagem(String infoPadraoBilhetePassagem) { + this.infoPadraoBilhetePassagem = infoPadraoBilhetePassagem; + } + + public List getListaDBP() { + return listaDBP; + } + + public void setListaDBP(List listaDBP) { + this.listaDBP = listaDBP; + } + + @Override + public String toString() { + return "ExportacaoRMDTipoSeqBPS [codigoEstabelecimento=" + codigoEstabelecimento + ", especie=" + especie + ", numeroAIDF=" + numeroAIDF + ", serieAIDF=" + serieAIDF + ", subSerieAIDF=" + subSerieAIDF + ", numeroInicial=" + numeroInicial + ", numeroFinal=" + numeroFinal + ", quantidadeCancelados=" + quantidadeCancelados + ", dataEmissao=" + dataEmissao + ", valorTotal=" + valorTotal + ", resumoMovimentoDiario=" + getResumoMovimentoDiario() + ", numeroAIDFRMD=" + numeroAIDFRMD + ", serieAIDFRMD=" + serieAIDFRMD + ", subSerieAIDFRMD=" + subSerieAIDFRMD + ", numeroRMD=" + numeroRMD + ", quantidadeTotal=" + quantidadeTotal + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoSeqDBP.java b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoSeqDBP.java new file mode 100644 index 000000000..45f20c916 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/exportacaofiscal/vo/ExportacaoRMDTipoSeqDBP.java @@ -0,0 +1,139 @@ +package com.rjconsultores.ventaboletos.utilerias.exportacaofiscal.vo; + +import java.math.BigDecimal; + +public class ExportacaoRMDTipoSeqDBP { + private String ufDestino; + private Integer cfop; // IM=5357; Serviço IE= 6357 + private BigDecimal valorTotal; + private BigDecimal valorBaseCalculoICMS; + private BigDecimal aliquotaICMS; + private BigDecimal valorICMS; + private BigDecimal valorICMSIsento; + private BigDecimal valorICMSOutros; + private Integer codigoSituacaoTribColunaB; // 00 - tributação normal; 20 - tributação com redução na base de calculo; 40 - isentos + private String ufOrigem; + private Integer municipioOrigem; + + public ExportacaoRMDTipoSeqDBP(String ufDestino) { + this.ufDestino = ufDestino; + } + + public String getUfDestino() { + return ufDestino; + } + + public void setUfDestino(String ufDestino) { + this.ufDestino = ufDestino; + } + + public Integer getCfop() { + return cfop; + } + + public void setCfop(Integer cfop) { + this.cfop = cfop; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public BigDecimal getValorBaseCalculoICMS() { + return valorBaseCalculoICMS; + } + + public void setValorBaseCalculoICMS(BigDecimal valorBaseCalculoICMS) { + this.valorBaseCalculoICMS = valorBaseCalculoICMS; + } + + public BigDecimal getAliquotaICMS() { + return aliquotaICMS; + } + + public void setAliquotaICMS(BigDecimal aliquotaICMS) { + this.aliquotaICMS = aliquotaICMS; + } + + public BigDecimal getValorICMS() { + return valorICMS; + } + + public void setValorICMS(BigDecimal valorICMS) { + this.valorICMS = valorICMS; + } + + public BigDecimal getValorICMSIsento() { + return valorICMSIsento; + } + + public void setValorICMSIsento(BigDecimal valorICMSIsento) { + this.valorICMSIsento = valorICMSIsento; + } + + public BigDecimal getValorICMSOutros() { + return valorICMSOutros; + } + + public void setValorICMSOutros(BigDecimal valorICMSOutros) { + this.valorICMSOutros = valorICMSOutros; + } + + public Integer getCodigoSituacaoTribColunaB() { + return codigoSituacaoTribColunaB; + } + + public void setCodigoSituacaoTribColunaB(Integer codigoSituacaoTribColunaB) { + this.codigoSituacaoTribColunaB = codigoSituacaoTribColunaB; + } + + public String getUfOrigem() { + return ufOrigem; + } + + public void setUfOrigem(String ufOrigem) { + this.ufOrigem = ufOrigem; + } + + public Integer getMunicipioOrigem() { + return municipioOrigem; + } + + public void setMunicipioOrigem(Integer municipioOrigem) { + this.municipioOrigem = municipioOrigem; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((ufDestino == null) ? 0 : ufDestino.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ExportacaoRMDTipoSeqDBP other = (ExportacaoRMDTipoSeqDBP) obj; + if (ufDestino == null) { + if (other.ufDestino != null) + return false; + } else if (!ufDestino.equals(other.ufDestino)) + return false; + return true; + } + + @Override + public String toString() { + return "ExportacaoRMDTipoSeqDBP [ufDestino=" + ufDestino + ", cfop=" + cfop + ", valorTotal=" + valorTotal + ", valorBaseCalculoICMS=" + valorBaseCalculoICMS + ", aliquotaICMS=" + aliquotaICMS + ", valorICMS=" + valorICMS + ", valorICMSIsento=" + valorICMSIsento + ", valorICMSOutros=" + valorICMSOutros + ", codigoSituacaoTribColunaB=" + codigoSituacaoTribColunaB + ", ufOrigem=" + ufOrigem + ", municipioOrigem=" + municipioOrigem + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/DetalhadoFiscal.java b/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/DetalhadoFiscal.java new file mode 100644 index 000000000..995e9df6d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/DetalhadoFiscal.java @@ -0,0 +1,633 @@ +package com.rjconsultores.ventaboletos.utilerias.fiscal.vo; + +import java.math.BigDecimal; +import java.util.Date; + +public class DetalhadoFiscal { + + private Long cajaId; + private String tipoReceita; + private String numoperacion; + private Integer estadoId; + private Date fechorVenta; + private String estadoOrigem; + private String estadoDestino; + private String municipioOrigem; + private boolean isInterEstadual; + private BigDecimal icmsInterestadual; + private BigDecimal icmsIntermunicipal; + private BigDecimal redBaseCalcIcms; + private BigDecimal porcRedMunicipal; + private BigDecimal porcRedEstadual; + private BigDecimal tributacaoImportacao; + private Boolean indTarifaMunicipal; + private Boolean indSeguroMunicipal; + private Boolean indTxembarqueMunicipal; + private Boolean indPedagioMunicipal; + private Boolean indTarifaEstadual; + private Boolean indSeguroEstadual; + private Boolean indTxembarqueEstadual; + private Boolean indPedagioEstdual; + private Boolean isenta; + private BigDecimal tarifa; + private BigDecimal taxaEmbarque; + private BigDecimal pedagio; + private BigDecimal seguro; + private BigDecimal outros; + private String datamov; + + private String xml; + + private String codstatus; + private String chbpe; + + private String cmunini; + private String cmunfim; + private String ufini; + private String uffim; + private String nbp; + private String dhemb; + private String cst00; + private String cst20; + private String cst45; + private String cst90; + private String cstoutrauf; + private String cstsn; + private String vbc00; + private String picms00; + private String vicms00; + private String vbc20; + private String picms20; + private String vicms20; + private String vbp; + private String vdesconto; + private String vpgto; + private String tpcomp01; + private String tpcomp02; + private String tpcomp03; + private String tpcomp04; + private String tpcomp05; + private String tpcomp06; + private String tpcomp99; + private String vcomp01; + private String vcomp02; + private String vcomp03; + private String vcomp04; + private String vcomp05; + private String vcomp06; + private String vcomp99; + private String pRedBC; + + public Long getCajaId() { + return cajaId; + } + + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + + public String getTipoReceita() { + return tipoReceita; + } + + public void setTipoReceita(String tipoReceita) { + this.tipoReceita = tipoReceita; + } + + public String getNumoperacion() { + return numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public Integer getEstadoId() { + return estadoId; + } + + public void setEstadoId(Integer estadoId) { + this.estadoId = estadoId; + } + + public Date getFechorVenta() { + return fechorVenta; + } + + public void setFechorVenta(Date fechorVenta) { + this.fechorVenta = fechorVenta; + } + + public String getEstadoOrigem() { + return estadoOrigem; + } + + public void setEstadoOrigem(String estadoOrigem) { + this.estadoOrigem = estadoOrigem; + } + + public String getEstadoDestino() { + return estadoDestino; + } + + public void setEstadoDestino(String estadoDestino) { + this.estadoDestino = estadoDestino; + } + + public String getMunicipioOrigem() { + return municipioOrigem; + } + + public void setMunicipioOrigem(String municipioOrigem) { + this.municipioOrigem = municipioOrigem; + } + + public boolean isInterEstadual() { + return isInterEstadual; + } + + public void setInterEstadual(boolean isInterEstadual) { + this.isInterEstadual = isInterEstadual; + } + + public BigDecimal getIcmsInterestadual() { + return icmsInterestadual; + } + + public void setIcmsInterestadual(BigDecimal icmsInterestadual) { + this.icmsInterestadual = icmsInterestadual; + } + + public BigDecimal getIcmsIntermunicipal() { + return icmsIntermunicipal; + } + + public void setIcmsIntermunicipal(BigDecimal icmsIntermunicipal) { + this.icmsIntermunicipal = icmsIntermunicipal; + } + + public BigDecimal getRedBaseCalcIcms() { + return redBaseCalcIcms; + } + + public void setRedBaseCalcIcms(BigDecimal redBaseCalcIcms) { + this.redBaseCalcIcms = redBaseCalcIcms; + } + + public BigDecimal getPorcRedMunicipal() { + return porcRedMunicipal; + } + + public void setPorcRedMunicipal(BigDecimal porcRedMunicipal) { + this.porcRedMunicipal = porcRedMunicipal; + } + + public BigDecimal getPorcRedEstadual() { + return porcRedEstadual; + } + + public void setPorcRedEstadual(BigDecimal porcRedEstadual) { + this.porcRedEstadual = porcRedEstadual; + } + + public BigDecimal getTributacaoImportacao() { + return tributacaoImportacao; + } + + public void setTributacaoImportacao(BigDecimal tributacaoImportacao) { + this.tributacaoImportacao = tributacaoImportacao; + } + + public Boolean getIndTarifaMunicipal() { + return indTarifaMunicipal; + } + + public void setIndTarifaMunicipal(Boolean indTarifaMunicipal) { + this.indTarifaMunicipal = indTarifaMunicipal; + } + + public Boolean getIndSeguroMunicipal() { + return indSeguroMunicipal; + } + + public void setIndSeguroMunicipal(Boolean indSeguroMunicipal) { + this.indSeguroMunicipal = indSeguroMunicipal; + } + + public Boolean getIndTxembarqueMunicipal() { + return indTxembarqueMunicipal; + } + + public void setIndTxembarqueMunicipal(Boolean indTxembarqueMunicipal) { + this.indTxembarqueMunicipal = indTxembarqueMunicipal; + } + + public Boolean getIndPedagioMunicipal() { + return indPedagioMunicipal; + } + + public void setIndPedagioMunicipal(Boolean indPedagioMunicipal) { + this.indPedagioMunicipal = indPedagioMunicipal; + } + + public Boolean getIndTarifaEstadual() { + return indTarifaEstadual; + } + + public void setIndTarifaEstadual(Boolean indTarifaEstadual) { + this.indTarifaEstadual = indTarifaEstadual; + } + + public Boolean getIndSeguroEstadual() { + return indSeguroEstadual; + } + + public void setIndSeguroEstadual(Boolean indSeguroEstadual) { + this.indSeguroEstadual = indSeguroEstadual; + } + + public Boolean getIndTxembarqueEstadual() { + return indTxembarqueEstadual; + } + + public void setIndTxembarqueEstadual(Boolean indTxembarqueEstadual) { + this.indTxembarqueEstadual = indTxembarqueEstadual; + } + + public Boolean getIndPedagioEstdual() { + return indPedagioEstdual; + } + + public void setIndPedagioEstdual(Boolean indPedagioEstdual) { + this.indPedagioEstdual = indPedagioEstdual; + } + + public Boolean getIsenta() { + return isenta; + } + + public void setIsenta(Boolean isenta) { + this.isenta = isenta; + } + + public BigDecimal getTarifa() { + return tarifa; + } + + public void setTarifa(BigDecimal tarifa) { + this.tarifa = tarifa; + } + + public BigDecimal getTaxaEmbarque() { + return taxaEmbarque; + } + + public void setTaxaEmbarque(BigDecimal taxaEmbarque) { + this.taxaEmbarque = taxaEmbarque; + } + + public BigDecimal getPedagio() { + return pedagio; + } + + public void setPedagio(BigDecimal pedagio) { + this.pedagio = pedagio; + } + + public BigDecimal getSeguro() { + return seguro; + } + + public void setSeguro(BigDecimal seguro) { + this.seguro = seguro; + } + + public BigDecimal getOutros() { + return outros; + } + + public void setOutros(BigDecimal outros) { + this.outros = outros; + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public String getXml() { + return xml; + } + + public void setXml(String xml) { + this.xml = xml; + } + + public String getCmunini() { + return cmunini; + } + + public void setCmunini(String cmunini) { + this.cmunini = cmunini; + } + + public String getCmunfim() { + return cmunfim; + } + + public void setCmunfim(String cmunfim) { + this.cmunfim = cmunfim; + } + + public String getUfini() { + return ufini; + } + + public void setUfini(String ufini) { + this.ufini = ufini; + } + + public String getUffim() { + return uffim; + } + + public void setUffim(String uffim) { + this.uffim = uffim; + } + + public String getNbp() { + return nbp; + } + + public void setNbp(String nbp) { + this.nbp = nbp; + } + + public String getDhemb() { + return dhemb; + } + + public void setDhemb(String dhemb) { + this.dhemb = dhemb; + } + + public String getCst00() { + return cst00; + } + + public void setCst00(String cst00) { + this.cst00 = cst00; + } + + public String getCst20() { + return cst20; + } + + public void setCst20(String cst20) { + this.cst20 = cst20; + } + + public String getCst45() { + return cst45; + } + + public void setCst45(String cst45) { + this.cst45 = cst45; + } + + public String getCst90() { + return cst90; + } + + public void setCst90(String cst90) { + this.cst90 = cst90; + } + + public String getCstoutrauf() { + return cstoutrauf; + } + + public void setCstoutrauf(String cstoutrauf) { + this.cstoutrauf = cstoutrauf; + } + + public String getCstsn() { + return cstsn; + } + + public void setCstsn(String cstsn) { + this.cstsn = cstsn; + } + + public String getVbc00() { + return vbc00; + } + + public void setVbc00(String vbc00) { + this.vbc00 = vbc00; + } + + public String getPicms00() { + return picms00; + } + + public void setPicms00(String picms00) { + this.picms00 = picms00; + } + + public String getVicms00() { + return vicms00; + } + + public void setVicms00(String vicms00) { + this.vicms00 = vicms00; + } + + public String getVbc20() { + return vbc20; + } + + public void setVbc20(String vbc20) { + this.vbc20 = vbc20; + } + + public String getPicms20() { + return picms20; + } + + public void setPicms20(String picms20) { + this.picms20 = picms20; + } + + public String getVicms20() { + return vicms20; + } + + public void setVicms20(String vicms20) { + this.vicms20 = vicms20; + } + + public String getVbp() { + return vbp; + } + + public void setVbp(String vbp) { + this.vbp = vbp; + } + + public String getVdesconto() { + return vdesconto; + } + + public void setVdesconto(String vdesconto) { + this.vdesconto = vdesconto; + } + + public String getVpgto() { + return vpgto; + } + + public void setVpgto(String vpgto) { + this.vpgto = vpgto; + } + + public String getTpcomp01() { + return tpcomp01; + } + + public void setTpcomp01(String tpcomp01) { + this.tpcomp01 = tpcomp01; + } + + public String getTpcomp02() { + return tpcomp02; + } + + public void setTpcomp02(String tpcomp02) { + this.tpcomp02 = tpcomp02; + } + + public String getTpcomp03() { + return tpcomp03; + } + + public void setTpcomp03(String tpcomp03) { + this.tpcomp03 = tpcomp03; + } + + public String getTpcomp04() { + return tpcomp04; + } + + public void setTpcomp04(String tpcomp04) { + this.tpcomp04 = tpcomp04; + } + + public String getTpcomp05() { + return tpcomp05; + } + + public void setTpcomp05(String tpcomp05) { + this.tpcomp05 = tpcomp05; + } + + public String getTpcomp06() { + return tpcomp06; + } + + public void setTpcomp06(String tpcomp06) { + this.tpcomp06 = tpcomp06; + } + + public String getTpcomp99() { + return tpcomp99; + } + + public void setTpcomp99(String tpcomp99) { + this.tpcomp99 = tpcomp99; + } + + public String getVcomp01() { + return vcomp01; + } + + public void setVcomp01(String vcomp01) { + this.vcomp01 = vcomp01; + } + + public String getVcomp02() { + return vcomp02; + } + + public void setVcomp02(String vcomp02) { + this.vcomp02 = vcomp02; + } + + public String getVcomp03() { + return vcomp03; + } + + public void setVcomp03(String vcomp03) { + this.vcomp03 = vcomp03; + } + + public String getVcomp04() { + return vcomp04; + } + + public void setVcomp04(String vcomp04) { + this.vcomp04 = vcomp04; + } + + public String getVcomp05() { + return vcomp05; + } + + public void setVcomp05(String vcomp05) { + this.vcomp05 = vcomp05; + } + + public String getVcomp06() { + return vcomp06; + } + + public void setVcomp06(String vcomp06) { + this.vcomp06 = vcomp06; + } + + public String getVcomp99() { + return vcomp99; + } + + public void setVcomp99(String vcomp99) { + this.vcomp99 = vcomp99; + } + + public String getpRedBC() { + return pRedBC; + } + + public void setpRedBC(String pRedBC) { + this.pRedBC = pRedBC; + } + + public String getCodstatus() { + return codstatus; + } + + public void setCodstatus(String codstatus) { + this.codstatus = codstatus; + } + + public String getChbpe() { + return chbpe; + } + + public void setChbpe(String chbpe) { + this.chbpe = chbpe; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/FinanceiroAnalitico.java b/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/FinanceiroAnalitico.java new file mode 100644 index 000000000..6e11fd7e4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/FinanceiroAnalitico.java @@ -0,0 +1,282 @@ +package com.rjconsultores.ventaboletos.utilerias.fiscal.vo; + +import java.math.BigDecimal; +import java.util.Date; + +public class FinanceiroAnalitico implements Comparable { + + private String uf; + private String codigoAgencia; + private Date fechorVenta; + private BigDecimal receitaBPR; + private BigDecimal gapVenda; + private BigDecimal gapImpressa; + private BigDecimal totalVendaPassagens; + private BigDecimal receitaEb; + private BigDecimal multaComp; + private BigDecimal difTrocaOCD; + private BigDecimal difTarifaMaior; + private BigDecimal totalOutrasReceitas; + private BigDecimal txEmb; + private BigDecimal pedagio; + private BigDecimal segFacult; + private BigDecimal totalTerceiros; + private BigDecimal receitaBruta; + private BigDecimal devolBPR; + private BigDecimal devolGAP; + private BigDecimal receitaLiquida; + private BigDecimal despesas; + private BigDecimal pgOCD; + private BigDecimal difTarifaMenor; + private BigDecimal cartaoCredito; + private BigDecimal cartaoDebito; + private BigDecimal boletoBancario; + private BigDecimal deposito; + private BigDecimal totalDetalhamento; + private BigDecimal saldo; + + @Override + public int compareTo(FinanceiroAnalitico o) { + int retorno = getFechorVenta().compareTo(o.getFechorVenta()); + if (retorno == 0 && (getUf()!=null && o.getUf()!= null ) ) { + retorno = getUf().compareTo(o.getUf()); + } + if (retorno == 0 && (getCodigoAgencia()!=null && o.getCodigoAgencia()!= null ) ) { + retorno = getCodigoAgencia().compareTo(o.getCodigoAgencia()); + } + return retorno; + } + + public String getUf() { + return uf; + } + + public void setUf(String uf) { + this.uf = uf; + } + + public String getCodigoAgencia() { + return codigoAgencia; + } + + public void setCodigoAgencia(String codigoAgencia) { + this.codigoAgencia = codigoAgencia; + } + + public Date getFechorVenta() { + return fechorVenta; + } + + public void setFechorVenta(Date fechorVenta) { + this.fechorVenta = fechorVenta; + } + + public BigDecimal getReceitaBPR() { + return receitaBPR; + } + + public void setReceitaBPR(BigDecimal receitaBPR) { + this.receitaBPR = receitaBPR; + } + + public BigDecimal getGapVenda() { + return gapVenda; + } + + public void setGapVenda(BigDecimal gapVenda) { + this.gapVenda = gapVenda; + } + + public BigDecimal getGapImpressa() { + return gapImpressa; + } + + public void setGapImpressa(BigDecimal gapImpressa) { + this.gapImpressa = gapImpressa; + } + + public BigDecimal getTotalVendaPassagens() { + return totalVendaPassagens; + } + + public void setTotalVendaPassagens(BigDecimal totalVendaPassagens) { + this.totalVendaPassagens = totalVendaPassagens; + } + + public BigDecimal getMultaComp() { + return multaComp; + } + + public void setMultaComp(BigDecimal multaComp) { + this.multaComp = multaComp; + } + + public BigDecimal getDifTrocaOCD() { + return difTrocaOCD; + } + + public void setDifTrocaOCD(BigDecimal difTrocaOCD) { + this.difTrocaOCD = difTrocaOCD; + } + + public BigDecimal getDifTarifaMaior() { + return difTarifaMaior; + } + + public void setDifTarifaMaior(BigDecimal difTarifaMaior) { + this.difTarifaMaior = difTarifaMaior; + } + + public BigDecimal getTotalOutrasReceitas() { + return totalOutrasReceitas; + } + + public void setTotalOutrasReceitas(BigDecimal totalOutrasReceitas) { + this.totalOutrasReceitas = totalOutrasReceitas; + } + + public BigDecimal getTxEmb() { + return txEmb; + } + + public void setTxEmb(BigDecimal txEmb) { + this.txEmb = txEmb; + } + + public BigDecimal getPedagio() { + return pedagio; + } + + public void setPedagio(BigDecimal pedagio) { + this.pedagio = pedagio; + } + + public BigDecimal getSegFacult() { + return segFacult; + } + + public void setSegFacult(BigDecimal segFacult) { + this.segFacult = segFacult; + } + + public BigDecimal getTotalTerceiros() { + return totalTerceiros; + } + + public void setTotalTerceiros(BigDecimal totalTerceiros) { + this.totalTerceiros = totalTerceiros; + } + + public BigDecimal getReceitaBruta() { + return receitaBruta; + } + + public void setReceitaBruta(BigDecimal receitaBruta) { + this.receitaBruta = receitaBruta; + } + + public BigDecimal getDevolBPR() { + return devolBPR; + } + + public void setDevolBPR(BigDecimal devolBPR) { + this.devolBPR = devolBPR; + } + + public BigDecimal getDevolGAP() { + return devolGAP; + } + + public void setDevolGAP(BigDecimal devolGAP) { + this.devolGAP = devolGAP; + } + + public BigDecimal getReceitaLiquida() { + return receitaLiquida; + } + + public void setReceitaLiquida(BigDecimal receitaLiquida) { + this.receitaLiquida = receitaLiquida; + } + + public BigDecimal getDespesas() { + return despesas; + } + + public void setDespesas(BigDecimal despesas) { + this.despesas = despesas; + } + + public BigDecimal getPgOCD() { + return pgOCD; + } + + public void setPgOCD(BigDecimal pgOCD) { + this.pgOCD = pgOCD; + } + + public BigDecimal getDifTarifaMenor() { + return difTarifaMenor; + } + + public void setDifTarifaMenor(BigDecimal difTarifaMenor) { + this.difTarifaMenor = difTarifaMenor; + } + + public BigDecimal getCartaoCredito() { + return cartaoCredito; + } + + public void setCartaoCredito(BigDecimal cartaoCredito) { + this.cartaoCredito = cartaoCredito; + } + + public BigDecimal getCartaoDebito() { + return cartaoDebito; + } + + public void setCartaoDebito(BigDecimal cartaoDebito) { + this.cartaoDebito = cartaoDebito; + } + + public BigDecimal getBoletoBancario() { + return boletoBancario; + } + + public void setBoletoBancario(BigDecimal boletoBancario) { + this.boletoBancario = boletoBancario; + } + + public BigDecimal getDeposito() { + return deposito; + } + + public void setDeposito(BigDecimal deposito) { + this.deposito = deposito; + } + + public BigDecimal getTotalDetalhamento() { + return totalDetalhamento; + } + + public void setTotalDetalhamento(BigDecimal totalDetalhamento) { + this.totalDetalhamento = totalDetalhamento; + } + + public BigDecimal getSaldo() { + return saldo; + } + + public void setSaldo(BigDecimal saldo) { + this.saldo = saldo; + } + + public BigDecimal getReceitaEb() { + return receitaEb; + } + + public void setReceitaEb(BigDecimal receitaEb) { + this.receitaEb = receitaEb; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/FinanceiroSintetico.java b/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/FinanceiroSintetico.java new file mode 100644 index 000000000..7e2c31011 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/FinanceiroSintetico.java @@ -0,0 +1,287 @@ +package com.rjconsultores.ventaboletos.utilerias.fiscal.vo; + +import java.math.BigDecimal; + +public class FinanceiroSintetico implements Comparable { + + private String uf; + private String codigoAgencia; + private BigDecimal receitaBPR; + private BigDecimal gapVenda; + private BigDecimal gapImpressa; + private BigDecimal totalVendaPassagens; + private BigDecimal receitaEb; + private BigDecimal multaComp; + private BigDecimal difTrocaOCD; + private BigDecimal difTarifaMaior; + private BigDecimal totalOutrasReceitas; + private BigDecimal txEmb; + private BigDecimal txConveniencia; + private BigDecimal pedagio; + private BigDecimal segFacult; + private BigDecimal totalTerceiros; + private BigDecimal receitaBruta; + private BigDecimal devolBPR; + private BigDecimal devolGAP; + private BigDecimal devolOCD; + private BigDecimal receitaLiquida; + private BigDecimal despesas; + private BigDecimal pgOCD; + private BigDecimal difTarifaMenor; + private BigDecimal cartaoCredito; + private BigDecimal cartaoDebito; + private BigDecimal boletoBancario; + private BigDecimal deposito; + private BigDecimal totalDetalhamento; + private BigDecimal saldo; + + @Override + public int compareTo(FinanceiroSintetico o) { + int retorno = getUf().compareTo(o.getUf()); + if (retorno == 0) { + retorno = getCodigoAgencia().compareTo(o.getCodigoAgencia()); + } + return retorno; + } + + public String getUf() { + return uf; + } + + public void setUf(String uf) { + this.uf = uf; + } + + public String getCodigoAgencia() { + return codigoAgencia; + } + + public void setCodigoAgencia(String codigoAgencia) { + this.codigoAgencia = codigoAgencia; + } + + public BigDecimal getReceitaBPR() { + return receitaBPR; + } + + public void setReceitaBPR(BigDecimal receitaBPR) { + this.receitaBPR = receitaBPR; + } + + public BigDecimal getGapVenda() { + return gapVenda; + } + + public void setGapVenda(BigDecimal gapVenda) { + this.gapVenda = gapVenda; + } + + public BigDecimal getGapImpressa() { + return gapImpressa; + } + + public void setGapImpressa(BigDecimal gapImpressa) { + this.gapImpressa = gapImpressa; + } + + public BigDecimal getTotalVendaPassagens() { + return totalVendaPassagens; + } + + public void setTotalVendaPassagens(BigDecimal totalVendaPassagens) { + this.totalVendaPassagens = totalVendaPassagens; + } + + public BigDecimal getMultaComp() { + return multaComp; + } + + public void setMultaComp(BigDecimal multaComp) { + this.multaComp = multaComp; + } + + public BigDecimal getDifTrocaOCD() { + return difTrocaOCD; + } + + public void setDifTrocaOCD(BigDecimal difTrocaOCD) { + this.difTrocaOCD = difTrocaOCD; + } + + public BigDecimal getDifTarifaMaior() { + return difTarifaMaior; + } + + public void setDifTarifaMaior(BigDecimal difTarifaMaior) { + this.difTarifaMaior = difTarifaMaior; + } + + public BigDecimal getTotalOutrasReceitas() { + return totalOutrasReceitas; + } + + public void setTotalOutrasReceitas(BigDecimal totalOutrasReceitas) { + this.totalOutrasReceitas = totalOutrasReceitas; + } + + public BigDecimal getTxEmb() { + return txEmb; + } + + public void setTxEmb(BigDecimal txEmb) { + this.txEmb = txEmb; + } + + public BigDecimal getPedagio() { + return pedagio; + } + + public void setPedagio(BigDecimal pedagio) { + this.pedagio = pedagio; + } + + public BigDecimal getSegFacult() { + return segFacult; + } + + public void setSegFacult(BigDecimal segFacult) { + this.segFacult = segFacult; + } + + public BigDecimal getTotalTerceiros() { + return totalTerceiros; + } + + public void setTotalTerceiros(BigDecimal totalTerceiros) { + this.totalTerceiros = totalTerceiros; + } + + public BigDecimal getReceitaBruta() { + return receitaBruta; + } + + public void setReceitaBruta(BigDecimal receitaBruta) { + this.receitaBruta = receitaBruta; + } + + public BigDecimal getDevolBPR() { + return devolBPR; + } + + public void setDevolBPR(BigDecimal devolBPR) { + this.devolBPR = devolBPR; + } + + public BigDecimal getDevolGAP() { + return devolGAP; + } + + public void setDevolGAP(BigDecimal devolGAP) { + this.devolGAP = devolGAP; + } + + public BigDecimal getReceitaLiquida() { + return receitaLiquida; + } + + public void setReceitaLiquida(BigDecimal receitaLiquida) { + this.receitaLiquida = receitaLiquida; + } + + public BigDecimal getDespesas() { + return despesas; + } + + public void setDespesas(BigDecimal despesas) { + this.despesas = despesas; + } + + public BigDecimal getPgOCD() { + return pgOCD; + } + + public void setPgOCD(BigDecimal pgOCD) { + this.pgOCD = pgOCD; + } + + public BigDecimal getDifTarifaMenor() { + return difTarifaMenor; + } + + public void setDifTarifaMenor(BigDecimal difTarifaMenor) { + this.difTarifaMenor = difTarifaMenor; + } + + public BigDecimal getCartaoCredito() { + return cartaoCredito; + } + + public void setCartaoCredito(BigDecimal cartaoCredito) { + this.cartaoCredito = cartaoCredito; + } + + public BigDecimal getCartaoDebito() { + return cartaoDebito; + } + + public void setCartaoDebito(BigDecimal cartaoDebito) { + this.cartaoDebito = cartaoDebito; + } + + public BigDecimal getBoletoBancario() { + return boletoBancario; + } + + public void setBoletoBancario(BigDecimal boletoBancario) { + this.boletoBancario = boletoBancario; + } + + public BigDecimal getDeposito() { + return deposito; + } + + public void setDeposito(BigDecimal deposito) { + this.deposito = deposito; + } + + public BigDecimal getTotalDetalhamento() { + return totalDetalhamento; + } + + public void setTotalDetalhamento(BigDecimal totalDetalhamento) { + this.totalDetalhamento = totalDetalhamento; + } + + public BigDecimal getSaldo() { + return saldo; + } + + public void setSaldo(BigDecimal saldo) { + this.saldo = saldo; + } + + public BigDecimal getReceitaEb() { + return receitaEb; + } + + public void setReceitaEb(BigDecimal receitaEb) { + this.receitaEb = receitaEb; + } + + public BigDecimal getTxConveniencia() { + return txConveniencia; + } + + public void setTxConveniencia(BigDecimal txConveniencia) { + this.txConveniencia = txConveniencia; + } + + public BigDecimal getDevolOCD() { + return devolOCD; + } + + public void setDevolOCD(BigDecimal devolOCD) { + this.devolOCD = devolOCD; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/FiscalRdi.java b/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/FiscalRdi.java new file mode 100644 index 000000000..f45c17eea --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/FiscalRdi.java @@ -0,0 +1,269 @@ +package com.rjconsultores.ventaboletos.utilerias.fiscal.vo; + +import java.math.BigDecimal; + +public class FiscalRdi implements Comparable { + + private String estado; + private String tipoViagem; + private String tipoReceita; + private BigDecimal quantBilhetes; + private BigDecimal tarifa; + private BigDecimal seguro; + private BigDecimal txEmbarque; + private BigDecimal pedagio; + private BigDecimal passagem; + private BigDecimal isentos; + private BigDecimal outros; + private BigDecimal rbc; + private BigDecimal baseCalculo; + private BigDecimal aliquota; + private BigDecimal icms; + private BigDecimal cp; + private BigDecimal credPres; + private BigDecimal icmsRec; + + public FiscalRdi() { + super(); + } + + public FiscalRdi(String estado, String tipoViagem, String tipoReceita) { + super(); + this.estado = estado; + this.tipoViagem = tipoViagem; + this.tipoReceita = tipoReceita; + initDados(); + } + + public FiscalRdi(String estado, String tipoViagem, String tipoReceita, BigDecimal tarifa, BigDecimal seguro, BigDecimal txEmbarque, BigDecimal pedagio, BigDecimal passagem, BigDecimal isentos, BigDecimal outros, BigDecimal rbc, BigDecimal baseCalculo, BigDecimal aliquota, BigDecimal icms, BigDecimal cp, BigDecimal credPres, BigDecimal icmsRec) { + super(); + this.estado = estado; + this.tipoViagem = tipoViagem; + this.tipoReceita = tipoReceita; + this.tarifa = tarifa; + this.seguro = seguro; + this.txEmbarque = txEmbarque; + this.pedagio = pedagio; + this.passagem = passagem; + this.isentos = isentos; + this.outros = outros; + this.rbc = rbc; + this.baseCalculo = baseCalculo; + this.aliquota = aliquota; + this.icms = icms; + this.cp = cp; + this.credPres = credPres; + this.icmsRec = icmsRec; + } + + public void initDados() { + this.quantBilhetes = BigDecimal.ZERO; + this.tarifa = BigDecimal.ZERO; + this.seguro = BigDecimal.ZERO; + this.txEmbarque = BigDecimal.ZERO; + this.pedagio = BigDecimal.ZERO; + this.passagem = BigDecimal.ZERO; + this.isentos = BigDecimal.ZERO; + this.outros = BigDecimal.ZERO; + this.rbc = BigDecimal.ZERO; + this.baseCalculo = BigDecimal.ZERO; + this.aliquota = BigDecimal.ZERO; + this.icms = BigDecimal.ZERO; + this.cp = BigDecimal.ZERO; + this.credPres = BigDecimal.ZERO; + this.icmsRec = BigDecimal.ZERO; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getTipoViagem() { + return tipoViagem; + } + + public void setTipoViagem(String tipoViagem) { + this.tipoViagem = tipoViagem; + } + + public String getTipoReceita() { + return tipoReceita; + } + + public void setTipoReceita(String tipoReceita) { + this.tipoReceita = tipoReceita; + } + + public BigDecimal getQuantBilhetes() { + return quantBilhetes; + } + + public void setQuantBilhetes(BigDecimal quantBilhetes) { + this.quantBilhetes = quantBilhetes; + } + + public BigDecimal getTarifa() { + return tarifa; + } + + public void setTarifa(BigDecimal tarifa) { + this.tarifa = tarifa; + } + + public BigDecimal getSeguro() { + return seguro; + } + + public void setSeguro(BigDecimal seguro) { + this.seguro = seguro; + } + + public BigDecimal getTxEmbarque() { + return txEmbarque; + } + + public void setTxEmbarque(BigDecimal txEmbarque) { + this.txEmbarque = txEmbarque; + } + + public BigDecimal getPedagio() { + return pedagio; + } + + public void setPedagio(BigDecimal pedagio) { + this.pedagio = pedagio; + } + + public BigDecimal getPassagem() { + return passagem; + } + + public void setPassagem(BigDecimal passagem) { + this.passagem = passagem; + } + + public BigDecimal getIsentos() { + return isentos; + } + + public void setIsentos(BigDecimal isentos) { + this.isentos = isentos; + } + + public BigDecimal getOutros() { + return outros; + } + + public void setOutros(BigDecimal outros) { + this.outros = outros; + } + + public BigDecimal getRbc() { + return rbc; + } + + public void setRbc(BigDecimal rbc) { + this.rbc = rbc; + } + + public BigDecimal getBaseCalculo() { + return baseCalculo; + } + + public void setBaseCalculo(BigDecimal baseCalculo) { + this.baseCalculo = baseCalculo; + } + + public BigDecimal getAliquota() { + return aliquota; + } + + public void setAliquota(BigDecimal aliquota) { + this.aliquota = aliquota; + } + + public BigDecimal getIcms() { + return icms; + } + + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + + public BigDecimal getCp() { + return cp; + } + + public void setCp(BigDecimal cp) { + this.cp = cp; + } + + public BigDecimal getCredPres() { + return credPres; + } + + public void setCredPres(BigDecimal credPres) { + this.credPres = credPres; + } + + public BigDecimal getIcmsRec() { + return icmsRec; + } + + public void setIcmsRec(BigDecimal icmsRec) { + this.icmsRec = icmsRec; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((estado == null) ? 0 : estado.hashCode()); + result = prime * result + ((tipoReceita == null) ? 0 : tipoReceita.hashCode()); + result = prime * result + ((tipoViagem == null) ? 0 : tipoViagem.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + FiscalRdi other = (FiscalRdi) obj; + if (estado == null) { + if (other.estado != null) + return false; + } else if (!estado.equals(other.estado)) + return false; + if (tipoReceita == null) { + if (other.tipoReceita != null) + return false; + } else if (!tipoReceita.equals(other.tipoReceita)) + return false; + if (tipoViagem == null) { + if (other.tipoViagem != null) + return false; + } else if (!tipoViagem.equals(other.tipoViagem)) + return false; + return true; + } + + @Override + public int compareTo(FiscalRdi o) { + int result = this.estado.compareToIgnoreCase(o.estado); + if (result == 0) { + result = o.tipoViagem.compareToIgnoreCase(this.tipoViagem); + } + if (result == 0) { + return o.tipoReceita.compareToIgnoreCase(this.tipoReceita); + } + return result; + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/RdiValidacion.java b/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/RdiValidacion.java new file mode 100644 index 000000000..83ae06980 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/fiscal/vo/RdiValidacion.java @@ -0,0 +1,85 @@ +package com.rjconsultores.ventaboletos.utilerias.fiscal.vo; + +public class RdiValidacion { + + private String estado; + private boolean temIMRec; + private boolean temIMDev; + private boolean temIERec; + private boolean temIEDev; + + public RdiValidacion(String estado) { + super(); + this.estado = estado; + this.temIMRec = false; + this.temIMDev = false; + this.temIERec = false; + this.temIEDev = false; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public boolean isTemIMRec() { + return temIMRec; + } + + public void setTemIMRec(boolean temIMRec) { + this.temIMRec = temIMRec; + } + + public boolean isTemIMDev() { + return temIMDev; + } + + public void setTemIMDev(boolean temIMDev) { + this.temIMDev = temIMDev; + } + + public boolean isTemIERec() { + return temIERec; + } + + public void setTemIERec(boolean temIERec) { + this.temIERec = temIERec; + } + + public boolean isTemIEDev() { + return temIEDev; + } + + public void setTemIEDev(boolean temIEDev) { + this.temIEDev = temIEDev; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((estado == null) ? 0 : estado.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + RdiValidacion other = (RdiValidacion) obj; + if (estado == null) { + if (other.estado != null) + return false; + } else if (!estado.equals(other.estado)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/impressaormd/vo/DetalhadoRMD.java b/src/com/rjconsultores/ventaboletos/utilerias/impressaormd/vo/DetalhadoRMD.java new file mode 100644 index 000000000..fb01d2591 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/impressaormd/vo/DetalhadoRMD.java @@ -0,0 +1,345 @@ +package com.rjconsultores.ventaboletos.utilerias.impressaormd.vo; + +import java.math.BigDecimal; +import java.util.Date; + +public class DetalhadoRMD { + + private Long cajaId; + private String numoperacion; + private String serie; + private Integer folio; + private Integer estadoId; + private Date fechorVenta; + private String empresa; + private String enderecoEmpresa; + private String cnpjEmpresa; + private String ieEmpresa; + private BigDecimal icmsInterestadual; + private BigDecimal icmsIntermunicipal; + private String estadoOrigem; + private String estadoDestino; + private String municipioOrigem; + private boolean isInterEstadual; + private BigDecimal redBaseCalcIcms; + private BigDecimal porcRedMunicipal; + private BigDecimal porcRedEstadual; + private BigDecimal tributacaoImportacao; + private boolean isenta; + private String rmd; + private BigDecimal tarifa; + private BigDecimal taxaEmbarque; + private BigDecimal pedagio; + private BigDecimal seguro; + private BigDecimal outros; + private String nombPuntoVenta; + private String numPuntoVenta; + + // CAMPOS ECF + private String ecf; + private String datamov; + private String coo; + private String ccf; + private String totalFiscal; + private String estadoImpressora; + + private Integer rmdId; + private String foliormd; + + public Long getCajaId() { + return cajaId; + } + + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + + public String getNumoperacion() { + return numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public Integer getFolio() { + return folio; + } + + public void setFolio(Integer folio) { + this.folio = folio; + } + + public Integer getEstadoId() { + return estadoId; + } + + public void setEstadoId(Integer estadoId) { + this.estadoId = estadoId; + } + + public Date getFechorVenta() { + return fechorVenta; + } + + public void setFechorVenta(Date fechorVenta) { + this.fechorVenta = fechorVenta; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public String getEnderecoEmpresa() { + return enderecoEmpresa; + } + + public void setEnderecoEmpresa(String enderecoEmpresa) { + this.enderecoEmpresa = enderecoEmpresa; + } + + public String getCnpjEmpresa() { + return cnpjEmpresa; + } + + public void setCnpjEmpresa(String cnpjEmpresa) { + this.cnpjEmpresa = cnpjEmpresa; + } + + public String getIeEmpresa() { + return ieEmpresa; + } + + public void setIeEmpresa(String ieEmpresa) { + this.ieEmpresa = ieEmpresa; + } + + public BigDecimal getIcmsInterestadual() { + return icmsInterestadual; + } + + public void setIcmsInterestadual(BigDecimal icmsInterestadual) { + this.icmsInterestadual = icmsInterestadual; + } + + public BigDecimal getIcmsIntermunicipal() { + return icmsIntermunicipal; + } + + public void setIcmsIntermunicipal(BigDecimal icmsIntermunicipal) { + this.icmsIntermunicipal = icmsIntermunicipal; + } + + public String getEstadoOrigem() { + return estadoOrigem; + } + + public void setEstadoOrigem(String estadoOrigem) { + this.estadoOrigem = estadoOrigem; + } + + public String getEstadoDestino() { + return estadoDestino; + } + + public void setEstadoDestino(String estadoDestino) { + this.estadoDestino = estadoDestino; + } + + public String getMunicipioOrigem() { + return municipioOrigem; + } + + public void setMunicipioOrigem(String municipioOrigem) { + this.municipioOrigem = municipioOrigem; + } + + public boolean isInterEstadual() { + return isInterEstadual; + } + + public void setInterEstadual(boolean isInterEstadual) { + this.isInterEstadual = isInterEstadual; + } + + public BigDecimal getRedBaseCalcIcms() { + return redBaseCalcIcms; + } + + public void setRedBaseCalcIcms(BigDecimal redBaseCalcIcms) { + this.redBaseCalcIcms = redBaseCalcIcms; + } + + public BigDecimal getPorcRedMunicipal() { + return porcRedMunicipal; + } + + public void setPorcRedMunicipal(BigDecimal porcRedMunicipal) { + this.porcRedMunicipal = porcRedMunicipal; + } + + public BigDecimal getPorcRedEstadual() { + return porcRedEstadual; + } + + public void setPorcRedEstadual(BigDecimal porcRedEstadual) { + this.porcRedEstadual = porcRedEstadual; + } + + public BigDecimal getTributacaoImportacao() { + return tributacaoImportacao; + } + + public void setTributacaoImportacao(BigDecimal tributacaoImportacao) { + this.tributacaoImportacao = tributacaoImportacao; + } + + public boolean getIsenta() { + return isenta; + } + + public void setIsenta(boolean isenta) { + this.isenta = isenta; + } + + public String getRmd() { + return rmd; + } + + public void setRmd(String rmd) { + this.rmd = rmd; + } + + public BigDecimal getTarifa() { + return tarifa; + } + + public void setTarifa(BigDecimal tarifa) { + this.tarifa = tarifa; + } + + public BigDecimal getTaxaEmbarque() { + return taxaEmbarque; + } + + public void setTaxaEmbarque(BigDecimal taxaEmbarque) { + this.taxaEmbarque = taxaEmbarque; + } + + public BigDecimal getPedagio() { + return pedagio; + } + + public void setPedagio(BigDecimal pedagio) { + this.pedagio = pedagio; + } + + public BigDecimal getSeguro() { + return seguro; + } + + public void setSeguro(BigDecimal seguro) { + this.seguro = seguro; + } + + public BigDecimal getOutros() { + return outros; + } + + public void setOutros(BigDecimal outros) { + this.outros = outros; + } + + public String getEcf() { + return ecf; + } + + public void setEcf(String ecf) { + this.ecf = ecf; + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public String getCoo() { + return coo; + } + + public void setCoo(String coo) { + this.coo = coo; + } + + public String getTotalFiscal() { + return totalFiscal; + } + + public void setTotalFiscal(String totalFiscal) { + this.totalFiscal = totalFiscal; + } + + public String getCcf() { + return ccf; + } + + public void setCcf(String ccf) { + this.ccf = ccf; + } + + public String getNombPuntoVenta() { + return nombPuntoVenta; + } + + public void setNombPuntoVenta(String nombPuntoVenta) { + this.nombPuntoVenta = nombPuntoVenta; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + + public String getEstadoImpressora() { + return estadoImpressora; + } + + public void setEstadoImpressora(String estadoImpressora) { + this.estadoImpressora = estadoImpressora; + } + + public Integer getRmdId() { + return rmdId; + } + + public void setRmdId(Integer rmdId) { + this.rmdId = rmdId; + } + + public String getFoliormd() { + return foliormd; + } + + public void setFoliormd(String foliormd) { + this.foliormd = foliormd; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/impressaormd/vo/FolioRMD.java b/src/com/rjconsultores/ventaboletos/utilerias/impressaormd/vo/FolioRMD.java new file mode 100644 index 000000000..83d5e269c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/impressaormd/vo/FolioRMD.java @@ -0,0 +1,144 @@ +package com.rjconsultores.ventaboletos.utilerias.impressaormd.vo; + +import java.math.BigDecimal; +import java.util.Date; + +public class FolioRMD { + + private String foliormd; + private String status; + private String fechorfolio; + private String empresa; + private String uf; + private String estado; + private String tipo; + private Date fechorfolioDate; + private String doc; + private BigDecimal valorContabil; + private BigDecimal baseCalculo; + private BigDecimal aliquota; + private BigDecimal isentos; + private BigDecimal outros; + private BigDecimal icms; + + public String getFoliormd() { + return foliormd; + } + + public void setFoliormd(String foliormd) { + this.foliormd = foliormd; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getFechorfolio() { + return fechorfolio; + } + + public void setFechorfolio(String fechorfolio) { + this.fechorfolio = fechorfolio; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public String getUf() { + return uf; + } + + public void setUf(String uf) { + this.uf = uf; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getTipo() { + return tipo; + } + + public void setTipo(String tipo) { + this.tipo = tipo; + } + + public Date getFechorfolioDate() { + return fechorfolioDate; + } + + public void setFechorfolioDate(Date fechorfolioDate) { + this.fechorfolioDate = fechorfolioDate; + } + + public String getDoc() { + return doc; + } + + public void setDoc(String doc) { + this.doc = doc; + } + + public BigDecimal getValorContabil() { + return valorContabil; + } + + public void setValorContabil(BigDecimal valorContabil) { + this.valorContabil = valorContabil; + } + + public BigDecimal getBaseCalculo() { + return baseCalculo; + } + + public void setBaseCalculo(BigDecimal baseCalculo) { + this.baseCalculo = baseCalculo; + } + + public BigDecimal getAliquota() { + return aliquota; + } + + public void setAliquota(BigDecimal aliquota) { + this.aliquota = aliquota; + } + + public BigDecimal getIsentos() { + return isentos; + } + + public void setIsentos(BigDecimal isentos) { + this.isentos = isentos; + } + + public BigDecimal getOutros() { + return outros; + } + + public void setOutros(BigDecimal outros) { + this.outros = outros; + } + + public BigDecimal getIcms() { + return icms; + } + + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/impressaormd/vo/ImpressaoRMD.java b/src/com/rjconsultores/ventaboletos/utilerias/impressaormd/vo/ImpressaoRMD.java new file mode 100644 index 000000000..f0454f80a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/impressaormd/vo/ImpressaoRMD.java @@ -0,0 +1,222 @@ +package com.rjconsultores.ventaboletos.utilerias.impressaormd.vo; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +public class ImpressaoRMD { + + private String empresa; + private String enderecoEmpresa; + private String cnpjEmpresa; + private String ieEmpresa; + private Date data; + private String rmd; + private String naturezaOperacao; + private String tipo; + private String serie; + private String numero; + private BigDecimal valorContabil; + private BigDecimal baseCalculo; + private BigDecimal aliquota; + private BigDecimal isentos; + private BigDecimal outros; + private BigDecimal icms; + private String obs; + private String folio; + + private List detalhada; + + public ImpressaoRMD(String empresa, String enderecoEmpresa, String cnpjEmpresa, String ieEmpresa, + Date data, String rmd, String naturezaOperacao, String tipo, String serie, String obs) { + super(); + this.empresa = empresa; + this.enderecoEmpresa = enderecoEmpresa; + this.cnpjEmpresa = cnpjEmpresa; + this.ieEmpresa = ieEmpresa; + this.data = data; + this.rmd = rmd; + this.naturezaOperacao = naturezaOperacao; + this.tipo = tipo; + this.serie = serie; + this.obs = obs; + } + + public ImpressaoRMD(String empresa, String enderecoEmpresa, String cnpjEmpresa, String ieEmpresa, + Date data, String rmd, String naturezaOperacao, String tipo, String serie, String obs, String folio) { + super(); + this.empresa = empresa; + this.enderecoEmpresa = enderecoEmpresa; + this.cnpjEmpresa = cnpjEmpresa; + this.ieEmpresa = ieEmpresa; + this.data = data; + this.rmd = rmd; + this.naturezaOperacao = naturezaOperacao; + this.tipo = tipo; + this.serie = serie; + this.obs = obs; + this.folio = folio; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public String getEnderecoEmpresa() { + return enderecoEmpresa; + } + + public void setEnderecoEmpresa(String enderecoEmpresa) { + this.enderecoEmpresa = enderecoEmpresa; + } + + public String getCnpjEmpresa() { + return cnpjEmpresa; + } + + public void setCnpjEmpresa(String cnpjEmpresa) { + this.cnpjEmpresa = cnpjEmpresa; + } + + public String getIeEmpresa() { + return ieEmpresa; + } + + public void setIeEmpresa(String ieEmpresa) { + this.ieEmpresa = ieEmpresa; + } + + public Date getData() { + return data; + } + + public void setData(Date data) { + this.data = data; + } + + public String getRmd() { + return rmd; + } + + public void setRmd(String rmd) { + this.rmd = rmd; + } + + public String getNaturezaOperacao() { + return naturezaOperacao; + } + + public void setNaturezaOperacao(String naturezaOperacao) { + this.naturezaOperacao = naturezaOperacao; + } + + public String getTipo() { + return tipo; + } + + public void setTipo(String tipo) { + this.tipo = tipo; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public BigDecimal getValorContabil() { + return valorContabil == null ? BigDecimal.ZERO : valorContabil; + } + + public void setValorContabil(BigDecimal valorContabil) { + this.valorContabil = valorContabil; + } + + public BigDecimal getBaseCalculo() { + return baseCalculo == null ? BigDecimal.ZERO : baseCalculo; + } + + public void setBaseCalculo(BigDecimal baseCalculo) { + this.baseCalculo = baseCalculo; + } + + public BigDecimal getAliquota() { + return aliquota; + } + + public void setAliquota(BigDecimal aliquota) { + this.aliquota = aliquota; + } + + public BigDecimal getIsentos() { + return isentos; + } + + public void setIsentos(BigDecimal isentos) { + this.isentos = isentos; + } + + public BigDecimal getOutros() { + return outros; + } + + public void setOutros(BigDecimal outros) { + this.outros = outros; + } + + public String getObs() { + return obs; + } + + public void setObs(String obs) { + this.obs = obs; + } + + public List getDetalhada() { + if (detalhada == null) { + detalhada = new ArrayList(); + } + return detalhada; + } + + public void setDetalhada(List detalhada) { + this.detalhada = detalhada; + } + + public BigDecimal getIcms() { + return icms; + } + + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + + @Override + public String toString() { + return "ImpressaoRMD [empresa=" + empresa + ", enderecoEmpresa=" + enderecoEmpresa + ", cnpjEmpresa=" + cnpjEmpresa + ", ieEmpresa=" + ieEmpresa + ", data=" + data + ", rmd=" + rmd + ", naturezaOperacao=" + naturezaOperacao + ", tipo=" + tipo + ", serie=" + serie + ", numero=" + numero + ", valorContabil=" + valorContabil + ", baseCalculo=" + baseCalculo + ", aliquota=" + aliquota + ", isentos=" + isentos + ", outros=" + outros + ", icms=" + icms + ", obs=" + obs + ", detalhada=" + detalhada + "]"; + } + + public String getFolio() { + return folio; + } + + public void setFolio(String folio) { + this.folio = folio; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/seguridad/Base64.java b/src/com/rjconsultores/ventaboletos/utilerias/seguridad/Base64.java new file mode 100644 index 000000000..d0f8c3e5d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/seguridad/Base64.java @@ -0,0 +1,203 @@ +/* + * @(#)Base64.java 1.3 01/12/03 + * + * Copyright 2002 Sun Microsystems, Inc. All rights reserved. + * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. + */ +package com.rjconsultores.ventaboletos.utilerias.seguridad; + +/** + * Static methods for translating Base64 encoded strings to byte arrays and vice-versa. + * + * @author Josh Bloch + * @version 1.3, 12/03/01 + * @see Preferences + * @since 1.4 + */ +public class Base64 { + + /** + * Translates the specified byte array into a Base64 string as per Preferences.put(byte[]). + */ + public static String byteArrayToBase64(byte[] a) { + return byteArrayToBase64(a, false); + } + + /** + * Translates the specified byte array into an "aternate representation" Base64 string. This non-standard variant uses an alphabet that does not contain the uppercase alphabetic characters, which makes it suitable for use in situations where case-folding occurs. + */ + public static String byteArrayToAltBase64(byte[] a) { + return byteArrayToBase64(a, true); + } + + private static String byteArrayToBase64(byte[] a, boolean alternate) { + int aLen = a.length; + int numFullGroups = aLen / 3; + int numBytesInPartialGroup = aLen - 3 * numFullGroups; + int resultLen = 4 * ((aLen + 2) / 3); + StringBuffer result = new StringBuffer(resultLen); + char[] intToAlpha = (alternate ? intToAltBase64 : intToBase64); + + // Translate all full groups from byte array elements to Base64 + int inCursor = 0; + for (int i = 0; i < numFullGroups; i++) { + int byte0 = a[inCursor++] & 0xff; + int byte1 = a[inCursor++] & 0xff; + int byte2 = a[inCursor++] & 0xff; + result.append(intToAlpha[byte0 >> 2]); + result.append(intToAlpha[(byte0 << 4) & 0x3f | (byte1 >> 4)]); + result.append(intToAlpha[(byte1 << 2) & 0x3f | (byte2 >> 6)]); + result.append(intToAlpha[byte2 & 0x3f]); + } + + // Translate partial group if present + if (numBytesInPartialGroup != 0) { + int byte0 = a[inCursor++] & 0xff; + result.append(intToAlpha[byte0 >> 2]); + if (numBytesInPartialGroup == 1) { + result.append(intToAlpha[(byte0 << 4) & 0x3f]); + result.append("=="); + } else { + // assert numBytesInPartialGroup == 2; + int byte1 = a[inCursor++] & 0xff; + result.append(intToAlpha[(byte0 << 4) & 0x3f | (byte1 >> 4)]); + result.append(intToAlpha[(byte1 << 2) & 0x3f]); + result.append('='); + } + } + // assert inCursor == a.length; + // assert result.length() == resultLen; + return result.toString(); + } + + /** + * This array is a lookup table that translates 6-bit positive integer index values into their "Base64 Alphabet" equivalents as specified in Table 1 of RFC 2045. + */ + private static final char intToBase64[] = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' + }; + /** + * This array is a lookup table that translates 6-bit positive integer index values into their "Alternate Base64 Alphabet" equivalents. This is NOT the real Base64 Alphabet as per in Table 1 of RFC 2045. This alternate alphabet does not use the capital letters. It is designed for use in environments where "case folding" occurs. + */ + private static final char intToAltBase64[] = { + '!', '"', '#', '$', '%', '&', '\'', '(', ')', ',', '-', '.', ':', + ';', '<', '>', '@', '[', ']', '^', '`', '_', '{', '|', '}', '~', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '?' + }; + + /** + * Translates the specified Base64 string (as per Preferences.get(byte[])) into a byte array. + * + * @throw IllegalArgumentException if s is not a valid Base64 string. + */ + public static byte[] base64ToByteArray(String s) { + return base64ToByteArray(s, false); + } + + /** + * Translates the specified "aternate representation" Base64 string into a byte array. + * + * @throw IllegalArgumentException or ArrayOutOfBoundsException if s is not a valid alternate representation Base64 string. + */ + public static byte[] altBase64ToByteArray(String s) { + return base64ToByteArray(s, true); + } + + private static byte[] base64ToByteArray(String s, boolean alternate) { + byte[] alphaToInt = (alternate ? altBase64ToInt : base64ToInt); + int sLen = s.length(); + int numGroups = sLen / 4; + if (4 * numGroups != sLen) { + throw new IllegalArgumentException( + "String length must be a multiple of four."); + } + int missingBytesInLastGroup = 0; + int numFullGroups = numGroups; + if (sLen != 0) { + if (s.charAt(sLen - 1) == '=') { + missingBytesInLastGroup++; + numFullGroups--; + } + if (s.charAt(sLen - 2) == '=') { + missingBytesInLastGroup++; + } + } + byte[] result = new byte[3 * numGroups - missingBytesInLastGroup]; + + // Translate all full groups from base64 to byte array elements + int inCursor = 0, outCursor = 0; + for (int i = 0; i < numFullGroups; i++) { + int ch0 = base64toInt(s.charAt(inCursor++), alphaToInt); + int ch1 = base64toInt(s.charAt(inCursor++), alphaToInt); + int ch2 = base64toInt(s.charAt(inCursor++), alphaToInt); + int ch3 = base64toInt(s.charAt(inCursor++), alphaToInt); + result[outCursor++] = (byte) ((ch0 << 2) | (ch1 >> 4)); + result[outCursor++] = (byte) ((ch1 << 4) | (ch2 >> 2)); + result[outCursor++] = (byte) ((ch2 << 6) | ch3); + } + + // Translate partial group, if present + if (missingBytesInLastGroup != 0) { + int ch0 = base64toInt(s.charAt(inCursor++), alphaToInt); + int ch1 = base64toInt(s.charAt(inCursor++), alphaToInt); + result[outCursor++] = (byte) ((ch0 << 2) | (ch1 >> 4)); + + if (missingBytesInLastGroup == 1) { + int ch2 = base64toInt(s.charAt(inCursor++), alphaToInt); + result[outCursor++] = (byte) ((ch1 << 4) | (ch2 >> 2)); + } + } + return result; + } + + /** + * Translates the specified character, which is assumed to be in the "Base 64 Alphabet" into its equivalent 6-bit positive integer. + * + * @throw IllegalArgumentException or ArrayOutOfBoundsException if c is not in the Base64 Alphabet. + */ + private static int base64toInt(char c, byte[] alphaToInt) { + int result = alphaToInt[c]; + if (result < 0) { + throw new IllegalArgumentException("Illegal character " + c); + } + return result; + } + + /** + * This array is a lookup table that translates unicode characters drawn from the "Base64 Alphabet" (as specified in Table 1 of RFC 2045) into their 6-bit positive integer equivalents. Characters that are not in the Base64 alphabet but fall within the bounds of the array are translated to -1. + */ + private static final byte base64ToInt[] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 + }; + /** + * This array is the analogue of base64ToInt, but for the nonstandard variant that avoids the use of uppercase alphabetic characters. + */ + private static final byte altBase64ToInt[] = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, + 2, 3, 4, 5, 6, 7, 8, -1, 62, 9, 10, 11, -1, 52, 53, 54, 55, 56, 57, + 58, 59, 60, 61, 12, 13, 14, -1, 15, 63, 16, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 17, -1, 18, 19, 21, 20, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 22, 23, 24, 25 + }; + + public static void main(String args[]) { + Integer i = new Integer(-1); + Short s = i.shortValue(); + System.out.println(s); + } +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/seguridad/ContrasenaUtileria.java b/src/com/rjconsultores/ventaboletos/utilerias/seguridad/ContrasenaUtileria.java new file mode 100644 index 000000000..3f40bc9a5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/seguridad/ContrasenaUtileria.java @@ -0,0 +1,71 @@ +package com.rjconsultores.ventaboletos.utilerias.seguridad; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.regex.Pattern; + +import com.rjconsultores.ventaboletos.exception.BusinessException; + +public class ContrasenaUtileria { + private int CANT_MIN_CARACTER = 6; + private int CANT_MIN_NUMERO = 1; + private int CANT_MIN_LETRA = 1; + private int CANT_ESPECIALES = 0; + + private Pattern patternHayNumero = null; + private Pattern patternHayLetra = null; + private Pattern patternHayEspeciales = null; + + public ContrasenaUtileria(){ + this.cargarPattern(); + } + + private void cargarPattern(){ + patternHayNumero = Pattern.compile(String.format(".*[0-9]{%s,}+.*",CANT_MIN_NUMERO)); + patternHayLetra = Pattern.compile(String.format(".*[a-zA-Z]{%s,}+.*",CANT_MIN_LETRA)); + patternHayEspeciales = Pattern.compile(String.format("((.*[\\W]){%s,})",CANT_ESPECIALES)); + + } + + public ContrasenaUtileria(int cantMinCaracteres,int cantMinNumeros,int cantMinLetra,int cantEspeciales){ + CANT_ESPECIALES = cantEspeciales; + CANT_MIN_CARACTER = cantMinCaracteres; + CANT_MIN_LETRA = cantMinLetra; + CANT_MIN_NUMERO = cantMinNumeros; + + this.cargarPattern(); + } + + public static String encriptarContrasena(String contrasena){ + MessageDigest md; + try { + md = MessageDigest.getInstance("MD5"); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException(e); + } + + byte[] pass = md.digest(contrasena.getBytes()); + return Base64.byteArrayToBase64(pass); + } + public void validarContrasenaCompleja(String contrasena) throws BusinessException{ + int length = contrasena.length(); + + if (length< CANT_MIN_CARACTER){ + throw new BusinessException("complejidadContrasena.CANT_MIN_CARACTER", new Object[]{CANT_MIN_CARACTER}); + } + + if (!patternHayLetra.matcher(contrasena).find()){ + throw new BusinessException("complejidadContrasena.CANT_MIN_LETRA", new Object[]{CANT_MIN_LETRA}); + } + + if (!patternHayNumero.matcher(contrasena).find()){ + throw new BusinessException("complejidadContrasena.CANT_MIN_NUMERO", new Object[]{CANT_MIN_NUMERO}); + } + + if (!patternHayEspeciales.matcher(contrasena).find()){ + throw new BusinessException("complejidadContrasena.CANT_ESPECIALES", new Object[]{CANT_ESPECIALES}); + } + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/spring/MyAnnotationSessionFactoryBean.java b/src/com/rjconsultores/ventaboletos/utilerias/spring/MyAnnotationSessionFactoryBean.java new file mode 100644 index 000000000..3c8cce2c7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/spring/MyAnnotationSessionFactoryBean.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.utilerias.spring; + +import org.hibernate.HibernateException; +import org.hibernate.cfg.AnnotationConfiguration; +import org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean; + +import com.rjconsultores.ventaboletos.auditoria.interceptor.AuditInterceptor; +import com.rjconsultores.ventaboletos.dao.hibernate.sqlfunction.FnArredondamentoTarifa; +import com.rjconsultores.ventaboletos.dao.util.DBUtil; + +@SuppressWarnings("deprecation") +public class MyAnnotationSessionFactoryBean extends AnnotationSessionFactoryBean{ + + + public MyAnnotationSessionFactoryBean() { + super(); + super.setEntityInterceptor(new AuditInterceptor()); + } + + @Override + protected void postProcessAnnotationConfiguration(AnnotationConfiguration config) throws HibernateException { + config.addSqlFunction("FN_ARREDONDAMENTO_TARIFA", new FnArredondamentoTarifa()); + } + + @Override + protected void afterSessionFactoryCreation() throws Exception { + DBUtil.getInstance().setSessionFactory(this.getSessionFactory()); + super.afterSessionFactoryCreation(); + } +} + + + diff --git a/src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiGrantedAuthority.java b/src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiGrantedAuthority.java new file mode 100644 index 000000000..6ad892c06 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiGrantedAuthority.java @@ -0,0 +1,23 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.utilerias.spring.security; + +import org.springframework.security.core.GrantedAuthority; + +/** + * @author gleimar + * + */ +public interface MiGrantedAuthority extends GrantedAuthority { + /** + * Indica si para el permiso actual tienes acceso de lectura y escrita. + * + * + * @return + * true - Acceso de lectura y escrita
+ * false - Acceso de lectura
+ * + */ + public boolean fullAccess(); +} diff --git a/src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiPasswordEncoder.java b/src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiPasswordEncoder.java new file mode 100644 index 000000000..b6d98ebc6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/utilerias/spring/security/MiPasswordEncoder.java @@ -0,0 +1,22 @@ +package com.rjconsultores.ventaboletos.utilerias.spring.security; + +import org.springframework.dao.DataAccessException; +import org.springframework.security.authentication.encoding.PasswordEncoder; + +import com.rjconsultores.ventaboletos.utilerias.seguridad.ContrasenaUtileria; + +public class MiPasswordEncoder implements PasswordEncoder { + + @Override + public String encodePassword(String pwd, Object salt) throws DataAccessException { + + return ContrasenaUtileria.encriptarContrasena(pwd); + + } + + @Override + public boolean isPasswordValid(String encPass, String pwd, Object salt) throws DataAccessException { + return encodePassword(pwd, salt).equals(encPass); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/version/model/entidadesAdmVta.version b/src/com/rjconsultores/ventaboletos/version/model/entidadesAdmVta.version new file mode 100644 index 000000000..78d70ae1d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/version/model/entidadesAdmVta.version @@ -0,0 +1 @@ +entidadesAdmVta_20120227_1RC17 \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/vo/OrgaoConcedente/OrgaoConcedenteVO.java b/src/com/rjconsultores/ventaboletos/vo/OrgaoConcedente/OrgaoConcedenteVO.java new file mode 100644 index 000000000..f4b74c674 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/OrgaoConcedente/OrgaoConcedenteVO.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.vo.OrgaoConcedente; + +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; + +public class OrgaoConcedenteVO { + + private Integer orgaoConcedenteId; + private String descOrgao; + private Boolean indValDocObligatorioEmbarcada; + + public OrgaoConcedenteVO(Integer orgaoConcedenteId, String descOrgao) { + this.orgaoConcedenteId = orgaoConcedenteId; + this.descOrgao = descOrgao; + } + + public OrgaoConcedenteVO(Integer orgaoConcedenteId, String descOrgao, Boolean indValDocObligatorioEmbarcada) { + this.orgaoConcedenteId = orgaoConcedenteId; + this.descOrgao = descOrgao; + this.indValDocObligatorioEmbarcada = indValDocObligatorioEmbarcada; + } + + public OrgaoConcedenteVO(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedenteId = orgaoConcedente.getOrgaoConcedenteId(); + this.descOrgao = orgaoConcedente.getDescOrgao(); + this.indValDocObligatorioEmbarcada = orgaoConcedente.getIndValDocObligatorioEmbarcada(); + } + + public Integer getOrgaoConcedenteId() { + return orgaoConcedenteId; + } + + public void setOrgaoConcedenteId(Integer orgaoConcedenteId) { + this.orgaoConcedenteId = orgaoConcedenteId; + } + + public String getDescOrgao() { + return descOrgao; + } + + public void setDescOrgao(String descOrgao) { + this.descOrgao = descOrgao; + } + + public Boolean getIndValDocObligatorioEmbarcada() { + return indValDocObligatorioEmbarcada; + } + + public void setIndValDocObligatorioEmbarcada(Boolean indValDocObligatorioEmbarcada) { + this.indValDocObligatorioEmbarcada = indValDocObligatorioEmbarcada; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/OrgaoConcedente/RelatorioGratuidadeAgepanVO.java b/src/com/rjconsultores/ventaboletos/vo/OrgaoConcedente/RelatorioGratuidadeAgepanVO.java new file mode 100644 index 000000000..7cfbc6658 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/OrgaoConcedente/RelatorioGratuidadeAgepanVO.java @@ -0,0 +1,204 @@ +package com.rjconsultores.ventaboletos.vo.OrgaoConcedente; + +import java.math.BigDecimal; +import java.util.Date; + +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; + +public class RelatorioGratuidadeAgepanVO { + + private String numBpe; + private Date fechorventa; + private Integer origenId; + private Integer puntoventaId; + private String origem; + private String destino; + private String dhemb; + private String nombpasajero; + private String desctipodoc; + private String descnumdoc; + private String desctipodoc2; + private String descnumdoc2; + private String corridaextra; + private String tiposervicobpe; + private Date fechorviaje; + private String prefixo; + private String numasiento; + private BigDecimal totalbilhete; + private BigDecimal totalbase; + private String descontobpe; + private String chbpe; + + public String getNumBpe() { + return numBpe; + } + + public void setNumBpe(String numBpe) { + this.numBpe = numBpe; + } + + public Date getFechorventa() { + return fechorventa; + } + + public void setFechorventa(Date fechorventa) { + this.fechorventa = fechorventa; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public String getOrigem() { + return origem; + } + + public void setOrigem(String origem) { + this.origem = origem; + } + + public String getDestino() { + return destino; + } + + public void setDestino(String destino) { + this.destino = destino; + } + + public String getDhemb() { + return dhemb; + } + + public void setDhemb(String dhemb) { + this.dhemb = dhemb; + } + + public String getNombpasajero() { + return nombpasajero; + } + + public void setNombpasajero(String nombpasajero) { + this.nombpasajero = nombpasajero; + } + + public String getDesctipodoc() { + return desctipodoc; + } + + public void setDesctipodoc(String desctipodoc) { + this.desctipodoc = desctipodoc; + } + + public String getDescnumdoc() { + return descnumdoc; + } + + public void setDescnumdoc(String descnumdoc) { + this.descnumdoc = descnumdoc; + } + + public String getDesctipodoc2() { + return desctipodoc2; + } + + public void setDesctipodoc2(String desctipodoc2) { + this.desctipodoc2 = desctipodoc2; + } + + public String getDescnumdoc2() { + return descnumdoc2; + } + + public void setDescnumdoc2(String descnumdoc2) { + this.descnumdoc2 = descnumdoc2; + } + + public String getCorridaextra() { + return corridaextra; + } + + public void setCorridaextra(String corridaextra) { + this.corridaextra = corridaextra; + } + + public String getTiposervicobpe() { + return tiposervicobpe; + } + + public void setTiposervicobpe(String tiposervicobpe) { + this.tiposervicobpe = tiposervicobpe; + } + + public Date getFechorviaje() { + return fechorviaje; + } + + public void setFechorviaje(Date fechorviaje) { + this.fechorviaje = fechorviaje; + } + + public String getPrefixo() { + return prefixo; + } + + public void setPrefixo(String prefixo) { + this.prefixo = prefixo; + } + + public String getNumasiento() { + return numasiento; + } + + public void setNumasiento(String numasiento) { + this.numasiento = numasiento; + } + + public BigDecimal getTotalbilhete() { + return totalbilhete; + } + + public void setTotalbilhete(BigDecimal totalbilhete) { + this.totalbilhete = totalbilhete; + } + + public BigDecimal getTotalbase() { + return totalbase; + } + + public void setTotalbase(BigDecimal totalbase) { + this.totalbase = totalbase; + } + + public String getDescontobpe() { + return descontobpe; + } + + public void setDescontobpe(String descontobpe) { + this.descontobpe = descontobpe; + } + + public String getChbpe() { + return chbpe; + } + + public void setChbpe(String chbpe) { + this.chbpe = chbpe; + } + + public BigDecimal getDesconto() { + return MoneyHelper.subtrair(getTotalbase(), getTotalbilhete()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/aidf/AidfVo.java b/src/com/rjconsultores/ventaboletos/vo/aidf/AidfVo.java new file mode 100644 index 000000000..48baf69d0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/aidf/AidfVo.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.vo.aidf; + +import java.util.Date; + +import com.rjconsultores.ventaboletos.entidad.AidfTipo; + +public class AidfVo { + + private Long aidfId; + private AidfTipo aidfTipo; + private Integer aidfEspecieId; + private Integer estadoId; + private String docfiscal; + private String acfiscal; + private String serie; + private String subserie; + private String forminicial; + private String formfinal; + private Date fecadquisicion; + private Date fecvencimiento; + private String inscestadual; + private Integer empresaId; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private String cnpj; + private String tipoValidaVenta; + public Long getAidfId() { + return aidfId; + } + public void setAidfId(Long aidfId) { + this.aidfId = aidfId; + } + public AidfTipo getAidfTipo() { + return aidfTipo; + } + public void setAidfTipo(AidfTipo aidfTipo) { + this.aidfTipo = aidfTipo; + } + public Integer getAidfEspecieId() { + return aidfEspecieId; + } + public void setAidfEspecieId(Integer aidfEspecieId) { + this.aidfEspecieId = aidfEspecieId; + } + public Integer getEstadoId() { + return estadoId; + } + public void setEstadoId(Integer estadoId) { + this.estadoId = estadoId; + } + public String getDocfiscal() { + return docfiscal; + } + public void setDocfiscal(String docfiscal) { + this.docfiscal = docfiscal; + } + public String getAcfiscal() { + return acfiscal; + } + public void setAcfiscal(String acfiscal) { + this.acfiscal = acfiscal; + } + public String getSerie() { + return serie; + } + public void setSerie(String serie) { + this.serie = serie; + } + public String getSubserie() { + return subserie; + } + public void setSubserie(String subserie) { + this.subserie = subserie; + } + public String getForminicial() { + return forminicial; + } + public void setForminicial(String forminicial) { + this.forminicial = forminicial; + } + public String getFormfinal() { + return formfinal; + } + public void setFormfinal(String formfinal) { + this.formfinal = formfinal; + } + public Date getFecadquisicion() { + return fecadquisicion; + } + public void setFecadquisicion(Date fecadquisicion) { + this.fecadquisicion = fecadquisicion; + } + public Date getFecvencimiento() { + return fecvencimiento; + } + public void setFecvencimiento(Date fecvencimiento) { + this.fecvencimiento = fecvencimiento; + } + public String getInscestadual() { + return inscestadual; + } + public void setInscestadual(String inscestadual) { + this.inscestadual = inscestadual; + } + public Integer getEmpresaId() { + return empresaId; + } + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public String getCnpj() { + return cnpj; + } + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + public String getTipoValidaVenta() { + return tipoValidaVenta; + } + public void setTipoValidaVenta(String tipoValidaVenta) { + this.tipoValidaVenta = tipoValidaVenta; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/aidf/ItemRelatorioMovimentoEstoque.java b/src/com/rjconsultores/ventaboletos/vo/aidf/ItemRelatorioMovimentoEstoque.java new file mode 100644 index 000000000..9a77e41f4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/aidf/ItemRelatorioMovimentoEstoque.java @@ -0,0 +1,125 @@ +package com.rjconsultores.ventaboletos.vo.aidf; + +import java.util.Date; + +public class ItemRelatorioMovimentoEstoque { + + private Date data; + private String aidf; + private String serie; + private String subserie; + private String empresa; + private String puntoventaEnv; + private String puntoventaRec; + private String estacionEnv; + private String estacionRec; + private String numFolioInicial; + private String numFolioFinal; + private String usuario; + private Integer total; + + public Date getData() { + return data; + } + + public void setData(Date data) { + this.data = data; + } + + public String getAidf() { + return aidf; + } + + public void setAidf(String aidf) { + this.aidf = aidf; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public String getSubserie() { + return subserie; + } + + public void setSubserie(String subserie) { + this.subserie = subserie; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public String getPuntoventaEnv() { + return puntoventaEnv; + } + + public void setPuntoventaEnv(String puntoventaEnv) { + this.puntoventaEnv = puntoventaEnv; + } + + public String getPuntoventaRec() { + return puntoventaRec; + } + + public void setPuntoventaRec(String puntoventaRec) { + this.puntoventaRec = puntoventaRec; + } + + public String getEstacionEnv() { + return estacionEnv; + } + + public void setEstacionEnv(String estacionEnv) { + this.estacionEnv = estacionEnv; + } + + public String getEstacionRec() { + return estacionRec; + } + + public void setEstacionRec(String estacionRec) { + this.estacionRec = estacionRec; + } + + public String getNumFolioInicial() { + return numFolioInicial; + } + + public void setNumFolioInicial(String numFolioInicial) { + this.numFolioInicial = numFolioInicial; + } + + public String getNumFolioFinal() { + return numFolioFinal; + } + + public void setNumFolioFinal(String numFolioFinal) { + this.numFolioFinal = numFolioFinal; + } + + public String getUsuario() { + return usuario; + } + + public void setUsuario(String usuario) { + this.usuario = usuario; + } + + public Integer getTotal() { + return total; + } + + public void setTotal(Integer total) { + this.total = total; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/bpe/BPeVO.java b/src/com/rjconsultores/ventaboletos/vo/bpe/BPeVO.java new file mode 100644 index 000000000..9a6440685 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/bpe/BPeVO.java @@ -0,0 +1,138 @@ +package com.rjconsultores.ventaboletos.vo.bpe; + +import java.util.Date; + +import org.apache.commons.lang.StringUtils; + +public class BPeVO { + + private Integer bpeId; + private String codstat; + private String chbpe; + private String numBpe; + private String numserieBpe; + private String uf; + private String motivo; + private String errocontingencia; + private Date fechorventa; + private String nombempresa; + private String xmlEnvio; + private String xmlResposta; + private String tipoevento; + + public Integer getBpeId() { + return bpeId; + } + + public void setBpeId(Integer bpeId) { + this.bpeId = bpeId; + } + + public String getCodstat() { + return codstat; + } + + public void setCodstat(String codstat) { + this.codstat = codstat; + } + + public String getChbpe() { + return chbpe; + } + + public void setChbpe(String chbpe) { + this.chbpe = chbpe; + } + + public String getNumBpeSerie() { + StringBuilder numBpeSerie = new StringBuilder(); + if(StringUtils.isNotBlank(numBpe)) { + numBpeSerie.append(numBpe); + } + if(numBpeSerie.length() > 0 && StringUtils.isNotBlank(numserieBpe)) { + numBpeSerie.append("/").append(numserieBpe); + } + return numBpeSerie.toString(); + } + + public String getUf() { + return uf; + } + + public void setUf(String uf) { + this.uf = uf; + } + + public String getMotivo() { + return motivo; + } + + public void setMotivo(String motivo) { + this.motivo = motivo; + } + + public String getErrocontingencia() { + return errocontingencia; + } + + public void setErrocontingencia(String errocontingencia) { + this.errocontingencia = errocontingencia; + } + + public Date getFechorventa() { + return fechorventa; + } + + public void setFechorventa(Date fechorventa) { + this.fechorventa = fechorventa; + } + + public String getNumBpe() { + return numBpe; + } + + public void setNumBpe(String numBpe) { + this.numBpe = numBpe; + } + + public String getNumserieBpe() { + return numserieBpe; + } + + public void setNumserieBpe(String numserieBpe) { + this.numserieBpe = numserieBpe; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public String getXmlResposta() { + return xmlResposta; + } + + public void setXmlResposta(String xmlResposta) { + this.xmlResposta = xmlResposta; + } + + public String getTipoevento() { + return tipoevento; + } + + public void setTipoevento(String tipoevento) { + this.tipoevento = tipoevento; + } + + public String getXmlEnvio() { + return xmlEnvio; + } + + public void setXmlEnvio(String xmlEnvio) { + this.xmlEnvio = xmlEnvio; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ClientePacoteVO.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ClientePacoteVO.java new file mode 100644 index 000000000..1743049be --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ClientePacoteVO.java @@ -0,0 +1,174 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +import com.rjconsultores.ventaboletos.enums.TipoPessoa; + +@XmlRootElement(name = "cliente") +@XmlType(propOrder = {"razaoSocial", "cpfCnpj", "tipoPessoa", "descemail", "desctelefone", "descfax", "endereco", "numero", "complemento", + "bairro", "cidade", "estado", "cep", "pais"}) +public class ClientePacoteVO { + + private Long vendapacoteId; + private String razaoSocial; + private String cpfCnpj; + private String tipoPessoa; + private String descemail; + private String desctelefone; + private String descfax; + private String endereco; + private String numero; + private String complemento; + private String bairro; + private String cidade; + private String estado; + private String cep; + private String pais; + + public ClientePacoteVO() { + super(); + } + + public ClientePacoteVO(String razaoSocial, String cpfCnpj, TipoPessoa tipoPessoa, String descemail, String desctelefone, String descfax, String cep, + String endereco, String numero, String complemento, String pais, String estado, String cidade, String bairro) { + this(); + setRazaoSocial(razaoSocial); + setCpfCnpj(cpfCnpj); + setTipoPessoa(tipoPessoa.toString()); + setDescemail(descemail); + setDesctelefone(desctelefone); + setDescfax(descfax); + setCep(cep); + setEndereco(endereco); + setNumero(numero); + setComplemento(complemento); + setPais(pais); + setEstado(estado); + setCidade(cidade); + setBairro(bairro); + } + + public String getRazaoSocial() { + return razaoSocial; + } + + public void setRazaoSocial(String razaoSocial) { + this.razaoSocial = razaoSocial; + } + + public String getCpfCnpj() { + return cpfCnpj; + } + + public void setCpfCnpj(String cpfCnpj) { + this.cpfCnpj = cpfCnpj; + } + + public String getTipoPessoa() { + return tipoPessoa; + } + + public void setTipoPessoa(String tipoPessoa) { + this.tipoPessoa = tipoPessoa; + } + + public String getDescemail() { + return descemail; + } + + public void setDescemail(String descemail) { + this.descemail = descemail; + } + + public String getDesctelefone() { + return desctelefone; + } + + public void setDesctelefone(String desctelefone) { + this.desctelefone = desctelefone; + } + + public String getDescfax() { + return descfax; + } + + public void setDescfax(String descfax) { + this.descfax = descfax; + } + + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + public String getEndereco() { + return endereco; + } + + public void setEndereco(String endereco) { + this.endereco = endereco; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getPais() { + return pais; + } + + public void setPais(String pais) { + this.pais = pais; + } + + public String getEstado() { + return estado; + } + + public void setEstado(String estado) { + this.estado = estado; + } + + public String getCidade() { + return cidade; + } + + public void setCidade(String cidade) { + this.cidade = cidade; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/DadosBancarioVO.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/DadosBancarioVO.java new file mode 100644 index 000000000..62d9a7adf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/DadosBancarioVO.java @@ -0,0 +1,50 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "dadosBancarios") +@XmlType(propOrder = {"banco", "identificadorDeposito", "data", "valor"}) +public class DadosBancarioVO { + + private String banco; + private String identificadorDeposito; + private Date data; + private BigDecimal valor; + + public String getBanco() { + return banco; + } + + public void setBanco(String banco) { + this.banco = banco; + } + + public String getIdentificadorDeposito() { + return identificadorDeposito; + } + + public void setIdentificadorDeposito(String identificadorDeposito) { + this.identificadorDeposito = identificadorDeposito; + } + + public Date getData() { + return data; + } + + public void setData(Date data) { + this.data = data; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/EnderecoApanheVO.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/EnderecoApanheVO.java new file mode 100644 index 000000000..90a68390a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/EnderecoApanheVO.java @@ -0,0 +1,103 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "pacote") +@XmlType(propOrder = { "local", "deschotel", "cep", "endereco", "cidade", "numero", "bairro", "complemento", "referencia" }) +public class EnderecoApanheVO { + + private Long vendapacoteId; + private String local; + private String cep; + private String endereco; + private String cidade; + private String numero; + private String bairro; + private String complemento; + private String referencia; + private String deschotel; + + public String getLocal() { + return local; + } + + public void setLocal(String local) { + this.local = local; + } + + public String getCep() { + return cep; + } + + public void setCep(String cep) { + this.cep = cep; + } + + public String getEndereco() { + return endereco; + } + + public void setEndereco(String endereco) { + this.endereco = endereco; + } + + public String getCidade() { + return cidade; + } + + public void setCidade(String cidade) { + this.cidade = cidade; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public String getComplemento() { + return complemento; + } + + public void setComplemento(String complemento) { + this.complemento = complemento; + } + + public String getReferencia() { + return referencia; + } + + public void setReferencia(String referencia) { + this.referencia = referencia; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + + public String getDeschotel() { + return deschotel; + } + + public void setDeschotel(String deschotel) { + this.deschotel = deschotel; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ItemAdicionalVO.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ItemAdicionalVO.java new file mode 100644 index 000000000..99104d6a4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ItemAdicionalVO.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement +@XmlType(propOrder = {"descitemadicional"}) +public class ItemAdicionalVO { + + private Long itemadicionalId; + private String descitemadicional; + private Long vendapacoteId; + + public String getDescitemadicional() { + return descitemadicional; + } + + public void setDescitemadicional(String descitemadicional) { + this.descitemadicional = descitemadicional; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + + @XmlTransient + public Long getItemadicionalId() { + return itemadicionalId; + } + + public void setItemadicionalId(Long itemadicionalId) { + this.itemadicionalId = itemadicionalId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/NotaCreditoVendaPacoteVO.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/NotaCreditoVendaPacoteVO.java new file mode 100644 index 000000000..6ccac0321 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/NotaCreditoVendaPacoteVO.java @@ -0,0 +1,29 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "notacredito") +@XmlType(propOrder = { "vouchernotacredito", "numoperacaopacotecancelamento" }) +public class NotaCreditoVendaPacoteVO { + + private String numoperacaopacotecancelamento; + private String vouchernotacredito; + + public String getNumoperacaopacotecancelamento() { + return numoperacaopacotecancelamento; + } + + public void setNumoperacaopacotecancelamento(String numoperacaopacotecancelamento) { + this.numoperacaopacotecancelamento = numoperacaopacotecancelamento; + } + + public String getVouchernotacredito() { + return vouchernotacredito; + } + + public void setVouchernotacredito(String vouchernotacredito) { + this.vouchernotacredito = vouchernotacredito; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/OcdPacoteVO.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/OcdPacoteVO.java new file mode 100644 index 000000000..8f8805a55 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/OcdPacoteVO.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "ocd") +@XmlType(propOrder = { "voucherocd" }) +public class OcdPacoteVO { + + private String voucherocd; + + public String getVoucherocd() { + return voucherocd; + } + + public void setVoucherocd(String voucherocd) { + this.voucherocd = voucherocd; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PacoteVO.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PacoteVO.java new file mode 100644 index 000000000..5088a5327 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PacoteVO.java @@ -0,0 +1,315 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "pacote") +@XmlType(propOrder = { "numoperacao", "datavenda", "datapacote", "dataalteracao", "datacancelamento", "nompacote", "pacoteId", "descpacote", "usuariovenda", + "status", "pontoVenda", "empresaId", "empresa", "quantidade", "totalTarifa", "totalSeguro", "totalOutros", "totalPedagio", "totalTaxaEmbarque", + "valorsubtotal", "valortotal", "valordesconto", "formaspagamento", "servico", "pax", "enderecoApanhe", "clientePacote", "itens", "indEncargoVenta" }) +public class PacoteVO { + + private Long vendapacoteId; + private Date datapacote; + private Date datavenda; + private Date datacancelamento; + private Date dataalteracao; + private Long pacoteId; + private String nompacote; + private String descpacote; + private String numoperacao; + private Integer usuariovenda; + private String status; + private String pontoVenda; + private String empresa; + private Integer quantidade = 0; + private BigDecimal totalTarifa = BigDecimal.ZERO; + private BigDecimal totalSeguro = BigDecimal.ZERO; + private BigDecimal totalOutros = BigDecimal.ZERO; + private BigDecimal totalPedagio = BigDecimal.ZERO; + private BigDecimal totalTaxaEmbarque = BigDecimal.ZERO; + + private BigDecimal valorsubtotal = BigDecimal.ZERO; + private BigDecimal valortotal = BigDecimal.ZERO; + private BigDecimal valordesconto = BigDecimal.ZERO; + + private ClientePacoteVO clientePacote; + private ServicoVO servico; + private EnderecoApanheVO enderecoApanhe; + + private List formaspagamento = new ArrayList(); + private List pax = new ArrayList(); + private List itens = new ArrayList(); + + private Integer empresaId; + + /* Auxiliares */ + private Integer qtdePacoteFormaspago; + + private Boolean indEncargoVenta; + + public Integer getQuantidade() { + return quantidade; + } + + public void setQuantidade(Integer quantidade) { + this.quantidade = quantidade; + } + + public String getNumoperacao() { + return numoperacao; + } + + public void setNumoperacao(String numoperacao) { + this.numoperacao = numoperacao; + } + + public Integer getUsuariovenda() { + return usuariovenda; + } + + public void setUsuariovenda(Integer usuariovenda) { + this.usuariovenda = usuariovenda; + } + + public Date getDatavenda() { + return datavenda; + } + + public void setDatavenda(Date datavenda) { + this.datavenda = datavenda; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public BigDecimal getValortotal() { + return valortotal; + } + + public void setValortotal(BigDecimal valortotal) { + this.valortotal = valortotal; + } + + public BigDecimal getValordesconto() { + return valordesconto; + } + + public void setValordesconto(BigDecimal valordesconto) { + this.valordesconto = valordesconto; + } + + @XmlElementWrapper + @XmlElement(name = "pagamento", type = PagamentoVO.class) + public List getFormaspagamento() { + return formaspagamento; + } + + public void setFormaspagamento(List formaspagamento) { + this.formaspagamento = formaspagamento; + } + + public ServicoVO getServico() { + return servico; + } + + public void setServico(ServicoVO servico) { + this.servico = servico; + } + + @XmlElementWrapper + @XmlElement(name = "passageiro", type = PassageiroVO.class) + public List getPax() { + return pax; + } + + public void setPax(List pax) { + this.pax = pax; + } + + public Date getDatapacote() { + return datapacote; + } + + public void setDatapacote(Date datapacote) { + this.datapacote = datapacote; + } + + public String getPontoVenda() { + return pontoVenda; + } + + public void setPontoVenda(String pontoVenda) { + this.pontoVenda = pontoVenda; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public BigDecimal getValorsubtotal() { + return valorsubtotal; + } + + public void setValorsubtotal(BigDecimal valorsubtotal) { + this.valorsubtotal = valorsubtotal; + } + + public BigDecimal getTotalTarifa() { + return totalTarifa; + } + + public void setTotalTarifa(BigDecimal totalTarifa) { + this.totalTarifa = totalTarifa; + } + + public BigDecimal getTotalSeguro() { + return totalSeguro; + } + + public void setTotalSeguro(BigDecimal totalSeguro) { + this.totalSeguro = totalSeguro; + } + + public BigDecimal getTotalOutros() { + return totalOutros; + } + + public void setTotalOutros(BigDecimal totalOutros) { + this.totalOutros = totalOutros; + } + + public ClientePacoteVO getClientePacote() { + return clientePacote; + } + + public void setClientePacote(ClientePacoteVO clientePacote) { + this.clientePacote = clientePacote; + } + + public BigDecimal getTotalTaxaEmbarque() { + return totalTaxaEmbarque; + } + + public void setTotalTaxaEmbarque(BigDecimal totalTaxaEmbarque) { + this.totalTaxaEmbarque = totalTaxaEmbarque; + } + + public BigDecimal getTotalPedagio() { + return totalPedagio; + } + + public void setTotalPedagio(BigDecimal totalPedagio) { + this.totalPedagio = totalPedagio; + } + + public String getNompacote() { + return nompacote; + } + + public void setNompacote(String nompacote) { + this.nompacote = nompacote; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + + public EnderecoApanheVO getEnderecoApanhe() { + return enderecoApanhe; + } + + public void setEnderecoApanhe(EnderecoApanheVO enderecoApanhe) { + this.enderecoApanhe = enderecoApanhe; + } + + @XmlTransient + public Integer getQtdePacoteFormaspago() { + return qtdePacoteFormaspago; + } + + public void setQtdePacoteFormaspago(Integer qtdePacoteFormaspago) { + this.qtdePacoteFormaspago = qtdePacoteFormaspago; + } + + public String getDescpacote() { + return descpacote; + } + + public void setDescpacote(String descpacote) { + this.descpacote = descpacote; + } + + @XmlElementWrapper + @XmlElement(name = "itemPacote", type = ItemAdicionalVO.class) + public List getItens() { + return itens; + } + + public void setItens(List itens) { + this.itens = itens; + } + + public Long getPacoteId() { + return pacoteId; + } + + public void setPacoteId(Long pacoteId) { + this.pacoteId = pacoteId; + } + + public Date getDatacancelamento() { + return datacancelamento; + } + + public void setDatacancelamento(Date datacancelamento) { + this.datacancelamento = datacancelamento; + } + + public Date getDataalteracao() { + return dataalteracao; + } + + public void setDataalteracao(Date dataalteracao) { + this.dataalteracao = dataalteracao; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public Boolean getIndEncargoVenta() { + return indEncargoVenta; + } + + public void setIndEncargoVenta(Boolean indEncargoVenta) { + this.indEncargoVenta = indEncargoVenta; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PagamentoVO.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PagamentoVO.java new file mode 100644 index 000000000..a55360bb8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PagamentoVO.java @@ -0,0 +1,151 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import java.math.BigDecimal; +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +import com.rjconsultores.ventaboletos.enums.TipoFormapago; +import com.rjconsultores.ventaboletos.vo.caja.PagamentoCartaoVO; + +@XmlRootElement(name = "pagamento") +@XmlType(propOrder = { "formapagamento", "moeda", "valor", "notacredito", "ocd", "cartao", "dadosBancarios" }) +public class PagamentoVO { + + private String formapagamento; + private String moeda; + private BigDecimal valor; + private PagamentoCartaoVO cartao; + private Long vendapacoteId; + private Integer formapagoId; + private NotaCreditoVendaPacoteVO notacredito; + private TipoFormapago tipoFormapago; + private Long cajadiversospagoId; + private OcdPacoteVO ocd; + + private List dadosBancarios; + + public String getMoeda() { + return moeda; + } + + public void setMoeda(String moeda) { + this.moeda = moeda; + } + + public String getFormapagamento() { + return formapagamento; + } + + public void setFormapagamento(String formapagamento) { + this.formapagamento = formapagamento; + } + + public PagamentoCartaoVO getCartao() { + return cartao; + } + + public void setCartao(PagamentoCartaoVO cartao) { + this.cartao = cartao; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + + @XmlTransient + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public NotaCreditoVendaPacoteVO getNotacredito() { + return notacredito; + } + + public void setNotacredito(NotaCreditoVendaPacoteVO notacredito) { + this.notacredito = notacredito; + } + + @XmlTransient + public TipoFormapago getTipoFormapago() { + return tipoFormapago; + } + + public void setTipoFormapago(TipoFormapago tipoFormapago) { + this.tipoFormapago = tipoFormapago; + } + + @XmlTransient + public Long getCajadiversospagoId() { + return cajadiversospagoId; + } + + public void setCajadiversospagoId(Long cajadiversospagoId) { + this.cajadiversospagoId = cajadiversospagoId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((formapagoId == null) ? 0 : formapagoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof PagamentoVO)) + return false; + PagamentoVO other = (PagamentoVO) obj; + if (formapagoId == null) { + if (other.formapagoId != null) + return false; + } else if (!formapagoId.equals(other.formapagoId)) + return false; + return true; + } + + @XmlElementWrapper + @XmlElement(name = "dadosBancario", type = DadosBancarioVO.class) + public List getDadosBancarios() { + return dadosBancarios; + } + + public void setDadosBancarios(List dadosBancarios) { + this.dadosBancarios = dadosBancarios; + } + + public OcdPacoteVO getOcd() { + return ocd; + } + + public void setOcd(OcdPacoteVO ocd) { + this.ocd = ocd; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PassageiroVO.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PassageiroVO.java new file mode 100644 index 000000000..b50e3f11f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/PassageiroVO.java @@ -0,0 +1,67 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name="passageiro") +@XmlType(propOrder = { "nome", "documento", "categoria", "assento", "boletoId" }) +public class PassageiroVO { + + private Long vendapacoteId; + private Long tarifavendapacoteId; + private Long boletoId; + private String assento; + private String nome; + private String documento; + private String categoria; + + public String getNome() { + return nome; + } + public void setNome(String nome) { + this.nome = nome; + } + public String getDocumento() { + return documento; + } + public void setDocumento(String documento) { + this.documento = documento; + } + public String getCategoria() { + return categoria; + } + public void setCategoria(String categoria) { + this.categoria = categoria; + } + public Long getBoletoId() { + return boletoId; + } + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + + @XmlTransient + public Long getTarifavendapacoteId() { + return tarifavendapacoteId; + } + public void setTarifavendapacoteId(Long tarifavendapacoteId) { + this.tarifavendapacoteId = tarifavendapacoteId; + } + public String getAssento() { + return assento; + } + public void setAssento(String assento) { + this.assento = assento; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ServicoVO.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ServicoVO.java new file mode 100644 index 000000000..6cdb32123 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/ServicoVO.java @@ -0,0 +1,78 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement +@XmlType(propOrder = {"localorigem", "origem", "destino", "dataviagem", "horario", "horarioapanhe"}) +public class ServicoVO { + + private Long vendapacoteId; + private Integer localorigem; + private Date dataviagem; + private Date horario; + private Date horarioapanhe; + private String destino; + private String origem; + + public Integer getLocalorigem() { + return localorigem; + } + + public void setLocalorigem(Integer localorigem) { + this.localorigem = localorigem; + } + + public Date getDataviagem() { + return dataviagem; + } + + public void setDataviagem(Date dataviagem) { + this.dataviagem = dataviagem; + } + + public Date getHorario() { + return horario; + } + + public void setHorario(Date horario) { + this.horario = horario; + } + + public Date getHorarioapanhe() { + return horarioapanhe; + } + + public void setHorarioapanhe(Date horarioapanhe) { + this.horarioapanhe = horarioapanhe; + } + + public String getDestino() { + return destino; + } + + public void setDestino(String destino) { + this.destino = destino; + } + + public String getOrigem() { + return origem; + } + + public void setOrigem(String origem) { + this.origem = origem; + } + + @XmlTransient + public Long getVendapacoteId() { + return vendapacoteId; + } + + public void setVendapacoteId(Long vendapacoteId) { + this.vendapacoteId = vendapacoteId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosClientePacoteResultTransformer.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosClientePacoteResultTransformer.java new file mode 100644 index 000000000..1f52c2f38 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosClientePacoteResultTransformer.java @@ -0,0 +1,80 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO; + +public class DatosClientePacoteResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public List transformList(List mapList) { + Map passageiros = new HashMap(); + + for (Object objmap : mapList) { + Map tupleMap = (Map) objmap; + Long vendapacoteId = (Long) tupleMap.get("VENDAPACOTE_ID"); + + if(!passageiros.containsKey(vendapacoteId)){ + ClientePacoteVO clientePacote = new ClientePacoteVO(); + clientePacote.setVendapacoteId(vendapacoteId); + setDatosClientePacote(clientePacote, tupleMap); + passageiros.put(vendapacoteId, clientePacote); + } + } + + List clientesPacoteList = new ArrayList(); + clientesPacoteList.addAll(passageiros.values()); + + return clientesPacoteList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + + private void setDatosClientePacote(ClientePacoteVO clientePacote, Map tupleMap) { + StringBuilder sRazaoSocial = new StringBuilder(); + if(tupleMap.get("NOMBCLIENTE") != null) { + sRazaoSocial.append(tupleMap.get("NOMBCLIENTE")); + } + if(tupleMap.get("APELLIDOPATERNO") != null) { + if(sRazaoSocial.length() > 0) { + sRazaoSocial.append(" "); + } + sRazaoSocial.append(tupleMap.get("APELLIDOPATERNO")); + } + if(tupleMap.get("APELLIDOMATERNO") != null) { + if(sRazaoSocial.length() > 0) { + sRazaoSocial.append(" "); + } + sRazaoSocial.append(tupleMap.get("APELLIDOMATERNO")); + } + clientePacote.setRazaoSocial(sRazaoSocial.toString()); + clientePacote.setCpfCnpj((String) tupleMap.get("NUMIDENTIFICAUNO")); + clientePacote.setDescemail((String) tupleMap.get("DESCCORREO")); + clientePacote.setDesctelefone((String) tupleMap.get("DESCTELEFONE")); + clientePacote.setCep((String) tupleMap.get("CODPOSTAL")); + clientePacote.setEndereco((String) tupleMap.get("DESCCALLE")); + clientePacote.setNumero((String) tupleMap.get("NUMINTERIOR")); + clientePacote.setComplemento((String) tupleMap.get("DESCCALLECOMP")); + clientePacote.setEstado((String) tupleMap.get("DESESTADO")); + clientePacote.setCidade((String) tupleMap.get("DESCIUDAD")); + clientePacote.setBairro((String) tupleMap.get("DESCCOLONIA")); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosDadosBancarioResultTransformer.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosDadosBancarioResultTransformer.java new file mode 100644 index 000000000..99d43c7ba --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosDadosBancarioResultTransformer.java @@ -0,0 +1,46 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.vo.busquedapacotes.DadosBancarioVO; + +public class DatosDadosBancarioResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) + public List transformList(List mapList) { + List dadosBancarios = new ArrayList(); + for(Object objmap : mapList ) { + Map tupleMap = (Map) objmap; + DadosBancarioVO dadosBancario = new DadosBancarioVO(); + dadosBancario.setIdentificadorDeposito((String) tupleMap.get("IDENTIFICACAO_DEPOSITO")); + dadosBancario.setData((Date) tupleMap.get("FECDEPOSITO")); + dadosBancario.setValor((BigDecimal) tupleMap.get("IMPORTE")); + + dadosBancarios.add(dadosBancario); + } + + return dadosBancarios; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosEmpresaResultTransformer.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosEmpresaResultTransformer.java new file mode 100644 index 000000000..120b00e06 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosEmpresaResultTransformer.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.entidad.Empresa; + +public class DatosEmpresaResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public List transformList(List mapList) { + Map empresas = new HashMap(); + + for(Object objmap : mapList ){ + + Map tupleMap = (Map) objmap; + Integer empresaId = (Integer) tupleMap.get("EMPRESA_ID"); + + if(!empresas.containsKey(empresaId)){ + Empresa empresa = new Empresa(); + empresa.setEmpresaId(empresaId); + empresa.setNombempresa((String) tupleMap.get("NOMBEMPRESA")); + empresa.setActivo((Boolean) tupleMap.get("ACTIVO")); + empresas.put(empresaId, empresa); + } + } + + List empresaList = new ArrayList(); + empresaList.addAll(empresas.values()); + + return empresaList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosEnderecoApanheResultTransformer.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosEnderecoApanheResultTransformer.java new file mode 100644 index 000000000..d22d3ebfd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosEnderecoApanheResultTransformer.java @@ -0,0 +1,65 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.enums.LocalEnderecoApanhe; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.EnderecoApanheVO; + +public class DatosEnderecoApanheResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public List transformList(List mapList) { + Map passageiros = new HashMap(); + + for (Object objmap : mapList) { + Map tupleMap = (Map) objmap; + Long vendapacoteId = (Long) tupleMap.get("VENDAPACOTE_ID"); + + if(!passageiros.containsKey(vendapacoteId)){ + EnderecoApanheVO enderecoApanhe = new EnderecoApanheVO(); + enderecoApanhe.setVendapacoteId(vendapacoteId); + setDatosEnderecoApanhe(enderecoApanhe, tupleMap); + passageiros.put(vendapacoteId, enderecoApanhe); + } + } + + List enderecosApanheList = new ArrayList(); + enderecosApanheList.addAll(passageiros.values()); + + return enderecosApanheList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + + private void setDatosEnderecoApanhe(EnderecoApanheVO enderecoApanhe, Map tupleMap) { + LocalEnderecoApanhe localEnderecoApanhe = LocalEnderecoApanhe.getLocalEnderecoApanhe((Integer) tupleMap.get("LOCAL")); + enderecoApanhe.setLocal(localEnderecoApanhe.toString()); + enderecoApanhe.setDeschotel((String) tupleMap.get("DESCHOTEL")); + enderecoApanhe.setCep((String) tupleMap.get("CEP")); + enderecoApanhe.setEndereco((String) tupleMap.get("ENDERECO")); + enderecoApanhe.setNumero((String) tupleMap.get("NUMERO")); + enderecoApanhe.setComplemento((String) tupleMap.get("COMPLEMENTO")); + enderecoApanhe.setCidade((String) tupleMap.get("CIDADE")); + enderecoApanhe.setBairro((String) tupleMap.get("BAIRRO")); + enderecoApanhe.setReferencia((String) tupleMap.get("REFERENCIA")); + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosItemAdicionalResultTransformer.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosItemAdicionalResultTransformer.java new file mode 100644 index 000000000..8059188e9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosItemAdicionalResultTransformer.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ItemAdicionalVO; + +public class DatosItemAdicionalResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public List transformList(List mapList) { + Map itens = new HashMap(); + + for (Object objmap : mapList) { + Map tupleMap = (Map) objmap; + Long itemadicionalId = (Long) tupleMap.get("ITEMADICIONAL_ID"); + + if(!itens.containsKey(itemadicionalId)){ + ItemAdicionalVO itemAdicional = new ItemAdicionalVO(); + itemAdicional.setItemadicionalId(itemadicionalId); + setDatosItemAdicional(itemAdicional, tupleMap); + itens.put(itemadicionalId+""+itemAdicional.getVendapacoteId(), itemAdicional); + } + } + + List itemAdicionalList = new ArrayList(); + itemAdicionalList.addAll(itens.values()); + + return itemAdicionalList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + + private void setDatosItemAdicional(ItemAdicionalVO itemAdicional, Map tupleMap) { + itemAdicional.setVendapacoteId((Long) tupleMap.get("VENDAPACOTE_ID")); + itemAdicional.setDescitemadicional((String) tupleMap.get("DESCITEMADICIONAL")); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPagamentoResultTransformer.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPagamentoResultTransformer.java new file mode 100644 index 000000000..a1cda2a47 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPagamentoResultTransformer.java @@ -0,0 +1,121 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.enums.TipoFormapago; +import com.rjconsultores.ventaboletos.utilerias.OcdUtil; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.NotaCreditoVendaPacoteVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.OcdPacoteVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PagamentoVO; +import com.rjconsultores.ventaboletos.vo.caja.PagamentoCartaoVO; + +public class DatosPagamentoResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) + public List transformList(List mapList) { + Map pacotes = new HashMap(); + + for(Object objmap : mapList ) { + + Map tupleMap = (Map) objmap; + Long cajadiversospagoId = (Long) tupleMap.get("CAJADIVERSOSPAGO_ID"); + + if(!pacotes.containsKey(cajadiversospagoId)){ + PagamentoVO pagamento = new PagamentoVO(); + setDatosPacote(pagamento, tupleMap); + if(pagamento.getValor().signum() >= 0) { + pacotes.put(cajadiversospagoId, pagamento); + } + } + } + + List pacotesList = new ArrayList(); + pacotesList.addAll(pacotes.values()); + Collections.sort(pacotesList, new Comparator() { + @Override + public int compare(PagamentoVO o1, PagamentoVO o2) { + return o1.getVendapacoteId().compareTo(o2.getVendapacoteId()); + } + }); + + return pacotesList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + + private void setDatosPacote(PagamentoVO pagamento, Map tupleMap) { + pagamento.setMoeda("R$"); + pagamento.setVendapacoteId((Long) tupleMap.get("VENDAPACOTE_ID")); + pagamento.setFormapagoId((Integer) tupleMap.get("FORMAPAGO_ID")); + pagamento.setFormapagamento((String) tupleMap.get("DESCPAGO")); + pagamento.setValor((BigDecimal) tupleMap.get("VALOR")); + + Integer tipoPago = (Integer) tupleMap.get("TIPO_PAGO"); + pagamento.setTipoFormapago(TipoFormapago.getTipoFormapagoByValor(tipoPago)); + + if(isVentaCartaoCredito(pagamento.getTipoFormapago()) || isVentaCartaoDebito(pagamento.getTipoFormapago())) { + PagamentoCartaoVO cartao = new PagamentoCartaoVO(); + cartao.setBandeira((String) tupleMap.get("TIPOTARJETA")); + cartao.setNumautorizacao((String) tupleMap.get("NUMAUTORIZACION")); + cartao.setParcelas((Integer) tupleMap.get("CANTPARCELAS")); + cartao.setTitular((String) tupleMap.get("NOMBTITULAR")); + cartao.setDatapagamento((Date) tupleMap.get("FECOPERACION")); + cartao.setNumcartao((String) tupleMap.get("NUMTARJETA")); + cartao.setNumcartao((String) tupleMap.get("NUMTARJETA")); + cartao.setOperadoracartao((String) tupleMap.get("DESCOPERADORACARTAO")); + + pagamento.setCartao(cartao); + } + + if(isVentaNotaCredito(pagamento.getTipoFormapago())) { + if(tupleMap.get("NOTACREDITOVENDAPACOTE_ID") != null) { + NotaCreditoVendaPacoteVO notacredito = new NotaCreditoVendaPacoteVO(); + notacredito.setVouchernotacredito(((Long) tupleMap.get("NOTACREDITOVENDAPACOTE_ID")).toString()); + notacredito.setNumoperacaopacotecancelamento((String) tupleMap.get("NUMOPERACAOPACOTECANCELAMENTO")); + pagamento.setNotacredito(notacredito); + } + + if(tupleMap.get("OCD_ID") != null) { + String voucherocd = OcdUtil.generaLocalizadorOCD((String) tupleMap.get("NUMOPERACION_OCD"), (Long) tupleMap.get("OCD_ID")); + OcdPacoteVO ocdPacote = new OcdPacoteVO(); + ocdPacote.setVoucherocd(voucherocd); + pagamento.setOcd(ocdPacote); + } + } + + } + + private boolean isVentaCartaoCredito(TipoFormapago tipoFormapago) { + return TipoFormapago.CREDITO.equals(tipoFormapago); + } + + private boolean isVentaCartaoDebito(TipoFormapago tipoFormapago) { + return TipoFormapago.DEBITO.equals(tipoFormapago); + } + + private boolean isVentaNotaCredito(TipoFormapago tipoFormapago) { + return TipoFormapago.NOTA_CREDITO.equals(tipoFormapago); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPassageiroResultTransformer.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPassageiroResultTransformer.java new file mode 100644 index 000000000..ac8abcbb3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPassageiroResultTransformer.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PassageiroVO; + +public class DatosPassageiroResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public List transformList(List mapList) { + Map passageiros = new HashMap(); + + for (Object objmap : mapList) { + + Map tupleMap = (Map) objmap; + Long tarifavendapacoteId = (Long) tupleMap.get("TARIFAVENDAPACOTE_ID"); + + if(!passageiros.containsKey(tarifavendapacoteId)){ + PassageiroVO passageiro = new PassageiroVO(); + passageiro.setTarifavendapacoteId(tarifavendapacoteId); + setDatosPassageiro(passageiro, tupleMap); + passageiros.put(tarifavendapacoteId, passageiro); + } + } + + List passageirosList = new ArrayList(); + passageirosList.addAll(passageiros.values()); + + return passageirosList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + + private void setDatosPassageiro(PassageiroVO passageiro, Map tupleMap){ + + passageiro.setVendapacoteId((Long) tupleMap.get("VENDAPACOTE_ID")); + passageiro.setDocumento((String) tupleMap.get("DOCUMENTO")); + passageiro.setNome((String) tupleMap.get("NOMEPASSAGEIRO")); + passageiro.setBoletoId((Long) tupleMap.get("BOLETO_ID")); + passageiro.setAssento((String) tupleMap.get("NUMASIENTO")); + passageiro.setCategoria((String) tupleMap.get("CVECATEGORIA")); + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPuntoVentaResultTransformer.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPuntoVentaResultTransformer.java new file mode 100644 index 000000000..be4e51c29 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosPuntoVentaResultTransformer.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public class DatosPuntoVentaResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "unchecked", "rawtypes" }) + public List transformList(List mapList) { + Map puntoventas = new HashMap(); + + for(Object objmap : mapList ){ + + Map tupleMap = (Map) objmap; + Integer puntoventaId = (Integer) tupleMap.get("PUNTOVENTA_ID"); + + if(!puntoventas.containsKey(puntoventaId)){ + PuntoVenta puntoventa = new PuntoVenta(); + puntoventa.setPuntoventaId(puntoventaId); + puntoventa.setNombpuntoventa((String) tupleMap.get("NOMBPUNTOVENTA")); + puntoventa.setActivo((Boolean) tupleMap.get("ACTIVO")); + puntoventas.put(puntoventaId, puntoventa); + } + } + + List puntoventaList = new ArrayList(); + puntoventaList.addAll(puntoventas.values()); + + return puntoventaList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosServicoResultTransformer.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosServicoResultTransformer.java new file mode 100644 index 000000000..f00e9c8ba --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosServicoResultTransformer.java @@ -0,0 +1,60 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ServicoVO; + +public class DatosServicoResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) + public List transformList(List mapList) { + Map servicos = new HashMap(); + + for (Object objmap : mapList) { + + Map tupleMap = (Map) objmap; + Long vendapacoteId = (Long) tupleMap.get("VENDAPACOTE_ID"); + + if(!servicos.containsKey(vendapacoteId)){ + ServicoVO servico = new ServicoVO(); + servico.setVendapacoteId(vendapacoteId); + setDatosServico(servico, tupleMap); + servicos.put(vendapacoteId, servico); + } + } + + List servicosList = new ArrayList(); + servicosList.addAll(servicos.values()); + + return servicosList; + } + + private void setDatosServico(ServicoVO servico, Map tupleMap) { + servico.setDataviagem((Date) tupleMap.get("FECHORVIAJE")); + servico.setHorario((Date) tupleMap.get("FECHORVIAJE")); + servico.setLocalorigem((Integer) tupleMap.get("ORIGEN_ID")); + servico.setOrigem((String) tupleMap.get("ORIGEM")); + servico.setDestino((String) tupleMap.get("DESTINO")); + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosTicketResultTransformer.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosTicketResultTransformer.java new file mode 100644 index 000000000..df80f5b95 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/DatosTicketResultTransformer.java @@ -0,0 +1,97 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang.StringUtils; +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.enums.SituacaoVendaPacote; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PacoteVO; + +public class DatosTicketResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) + public List transformList(List mapList) { + + Map pacotes = new HashMap(); + + for(Object objmap : mapList ){ + + Map tupleMap = (Map) objmap; + Long vendapacoteId = (Long) tupleMap.get("VENDAPACOTE_ID"); + + if(!pacotes.containsKey(vendapacoteId)){ + PacoteVO pacote = new PacoteVO(); + pacote.setVendapacoteId(vendapacoteId); + setDatosPacote(pacote, tupleMap); + pacotes.put(vendapacoteId, pacote); + } + } + + List pacotesList = new ArrayList(); + pacotesList.addAll(pacotes.values()); + + return pacotesList; + } + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + + Map row = new HashMap(); + + for(int index = 0; index < aliases.length; index++){ + row.put(aliases[index], data[index]); + } + + return row; + } + + private void setDatosPacote(PacoteVO pacote, Map tupleMap){ + pacote.setNumoperacao((String) tupleMap.get("NUMOPERACION")); + pacote.setUsuariovenda((Integer) tupleMap.get("USUARIO_ID")); + pacote.setDatavenda((Date) tupleMap.get("DATAVENDA")); + pacote.setDatapacote((Date) tupleMap.get("DATAPACOTE")); + + if(tupleMap.get("SITUACAO") != null) { + SituacaoVendaPacote situacaoVendaPacote = SituacaoVendaPacote.getSituacaoVendaPacote((Integer) tupleMap.get("SITUACAO")); + if(situacaoVendaPacote != null) { + pacote.setStatus(situacaoVendaPacote.toString()); + } + } + + pacote.setPacoteId((Long) tupleMap.get("PACOTE_ID")); + pacote.setDescpacote((String) tupleMap.get("DESCPACOTE")); + pacote.setNompacote((String) tupleMap.get("NOMPACOTE")); + pacote.setPontoVenda((String) tupleMap.get("NOMBPUNTOVENTA")); + pacote.setEmpresa((String) tupleMap.get("NOMBEMPRESA")); + pacote.setQuantidade((Integer) tupleMap.get("QTDEPASSAGEIRO")); + pacote.setTotalTarifa((BigDecimal) tupleMap.get("TOTALTARIFA")); + pacote.setTotalTaxaEmbarque((BigDecimal) tupleMap.get("TOTALTAXAEMBARQUE")); + pacote.setTotalPedagio((BigDecimal) tupleMap.get("TOTALPEDAGIO")); + pacote.setTotalOutros((BigDecimal) tupleMap.get("TOTALOUTROS")); + pacote.setTotalSeguro((BigDecimal) tupleMap.get("TOTALSEGURO")); + pacote.setValorsubtotal((BigDecimal) tupleMap.get("SUBTOTAL")); + pacote.setValortotal((BigDecimal) tupleMap.get("TOTAL")); + pacote.setValordesconto((BigDecimal) tupleMap.get("DESCONTO")); + pacote.setQtdePacoteFormaspago((Integer) tupleMap.get("QTDEPACOTEFORMAPAGO")); + pacote.setDataalteracao((Date) tupleMap.get("FECMODIF")); + pacote.setDatacancelamento((Date) tupleMap.get("DATACANCELAMENTO")); + pacote.setEmpresaId((Integer) tupleMap.get("EMPRESA_ID")); + pacote.setIndEncargoVenta((Boolean) tupleMap.get("INDENCARGOVENTA")); + + if(StringUtils.isNotBlank(pacote.getDescpacote())){ + pacote.setDescpacote(StringEscapeUtils.unescapeHtml(pacote.getDescpacote().replaceAll(" ", " ").replaceAll("\\<.*?\\>", " ")).replaceAll("\\s+", " ")); + } + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/RelatorioVendaCartaoCashMonitorResultTransformer.java b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/RelatorioVendaCartaoCashMonitorResultTransformer.java new file mode 100644 index 000000000..3be5822e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/busquedapacotes/transformer/RelatorioVendaCartaoCashMonitorResultTransformer.java @@ -0,0 +1,53 @@ +package com.rjconsultores.ventaboletos.vo.busquedapacotes.transformer; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hibernate.transform.ResultTransformer; + +import com.rjconsultores.ventaboletos.vo.cashmonitor.RelatorioVendaCartaoCashMonitorVO; + +public class RelatorioVendaCartaoCashMonitorResultTransformer implements ResultTransformer { + + private static final long serialVersionUID = 1L; + + @Override + public Object transformTuple(Object[] data, String[] aliases) { + Map row = new HashMap(); + + for (int index = 0; index < aliases.length; index++) { + row.put(aliases[index], data[index]); + } + + return row; + } + + @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) + public List transformList(List mapList) { + List listaVO = new ArrayList(); + + for (Object object : mapList) { + Map tupleMap = (Map) object; + RelatorioVendaCartaoCashMonitorVO vo = new RelatorioVendaCartaoCashMonitorVO(); + vo.setDataTransacao((String) tupleMap.get("data_transacao")); + vo.setLoja((String) tupleMap.get("loja")); + vo.setAdquirente((String) tupleMap.get("adquirente")); + vo.setNsu((String) tupleMap.get("nsu")); + vo.setAutorizacao((String) tupleMap.get("autorizacao")); + vo.setValorBruto((BigDecimal) tupleMap.get("valor_bruto")); + vo.setFormapago_id((Integer) tupleMap.get("formapago_id")); + vo.setBandeira((String) tupleMap.get("bandeira")); + vo.setCodigoPedido((String) tupleMap.get("codigo_pedido")); + vo.setValorParcela((BigDecimal) tupleMap.get("valor_parcela")); + vo.setParcelas((Integer) tupleMap.get("parcelas")); + + listaVO.add(vo); + } + + return listaVO; + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/vo/caja/CajaCerradoVO.java b/src/com/rjconsultores/ventaboletos/vo/caja/CajaCerradoVO.java new file mode 100644 index 000000000..36c52487a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/caja/CajaCerradoVO.java @@ -0,0 +1,174 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class CajaCerradoVO { + + private Long cajaId; + private String numFolioSistema; + private String origen; + private String destino; + private Integer corridaId; + private BigDecimal precioPagado; + private Date fecHorVenta; + private BigDecimal importeTaxaEmbarque; + private String ruta; + private String numAutorizacion; + private String ordenSevicio; + private String secretaria; + private String cvesecretaria; + private String emissorTarjeta; + private String tipoPasaje; + private String formaPago; + + public CajaCerradoVO() { + this.cajaId = new Long(-1); + this.numFolioSistema = ""; + this.origen = ""; + this.destino = ""; + this.corridaId = new Integer(-1); + this.precioPagado = new BigDecimal(0); + this.fecHorVenta = new Date(); + this.importeTaxaEmbarque = new BigDecimal(0); + this.ruta = ""; + this.numAutorizacion = ""; + this.ordenSevicio = ""; + this.secretaria = ""; + this.cvesecretaria = ""; + this.emissorTarjeta = ""; + this.tipoPasaje = ""; + this.formaPago = ""; + } + + public Long getCajaId() { + return cajaId; + } + + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + + public String getNumFolioSistema() { + return numFolioSistema; + } + + public void setNumFolioSistema(String numFolioSistema) { + this.numFolioSistema = numFolioSistema; + } + + public String getOrigen() { + return origen; + } + + public void setOrigen(String origen) { + this.origen = origen; + } + + public String getDestino() { + return destino; + } + + public void setDestino(String destino) { + this.destino = destino; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public BigDecimal getPrecioPagado() { + return precioPagado; + } + + public void setPrecioPagado(BigDecimal precioPagado) { + this.precioPagado = precioPagado; + } + + public Date getFecHorVenta() { + return fecHorVenta; + } + + public void setFecHorVenta(Date fecHorVenta) { + this.fecHorVenta = fecHorVenta; + } + + public BigDecimal getImporteTaxaEmbarque() { + return importeTaxaEmbarque; + } + + public void setImporteTaxaEmbarque(BigDecimal importeTaxaEmbarque) { + this.importeTaxaEmbarque = importeTaxaEmbarque; + } + + public String getRuta() { + return ruta; + } + + public void setRuta(String ruta) { + this.ruta = ruta; + } + + public String getNumAutorizacion() { + return numAutorizacion; + } + + public void setNumAutorizacion(String numAutorizacion) { + this.numAutorizacion = numAutorizacion; + } + + public String getOrdenSevicio() { + return ordenSevicio; + } + + public void setOrdenSevicio(String ordenSevicio) { + this.ordenSevicio = ordenSevicio; + } + + public String getCodigoSecretaria() { + return secretaria; + } + + public void setCodigoSecretaria(String secretaria) { + this.secretaria = secretaria; + } + + public String getCvesecretaria() { + return cvesecretaria; + } + + public void setCvesecretaria(String cvesecretaria) { + this.cvesecretaria = cvesecretaria; + } + + public String getEmissorTarjeta() { + return emissorTarjeta; + } + + public void setEmissorTarjeta(String emissorTarjeta) { + this.emissorTarjeta = emissorTarjeta; + } + + public String getTipoPasaje() { + return tipoPasaje; + } + + public void setTipoPasaje(String tipoPasaje) { + this.tipoPasaje = tipoPasaje; + } + + public String getFormaPago() { + return formaPago; + } + + public void setFormaPago(String formaPago) { + this.formaPago = formaPago; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/caja/CajaDetalleVO.java b/src/com/rjconsultores/ventaboletos/vo/caja/CajaDetalleVO.java new file mode 100644 index 000000000..73d7098c4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/caja/CajaDetalleVO.java @@ -0,0 +1,514 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + + +@XmlRootElement +public class CajaDetalleVO { + + private Long cajaId; + private String numAsiento; + private Integer categoriaId; + private String numFolioSistema; + private Integer claseServicioId; + private Integer marcaId; + private Integer origenId; + private Integer destinoId; + private Integer corridaId; + private Date fecCorrida; + private String nombPasajero; + private BigDecimal precioBase; + private BigDecimal precioPagado; + private Integer tipoVentaId; + private String numSeriePreimpresa; + private String numFolioPreImpreso; + private Date fecHorViaje; + private Date fecHorVenta; + private Integer puntoVentaId; + private String numPuntoVenta; + private BigDecimal numKmViaje; + private String numOperacion; + private Integer motivoCancelacionId; + private Integer empresaPuntoVentaId; + private Integer empresaCorridaId; + private Integer turnoId; + private BigDecimal importeTaxaEmbarque; + private BigDecimal importePedagio; + private BigDecimal importeOutros; + private BigDecimal importeSeguro; + private Integer rutaId; + private Integer usuarioId; + private String numAutorizacion; + private String ordenSevicio; + private String uf; + private String desccategoria; + private List formaspagamento = new ArrayList(); + private String descPago; + private String cveCategoria; + private Integer formaPagoId; + private BigDecimal vlrFormaPago; + private String descMotivo; + private Long transacaoId; + private Long transacaooriginalId; + + private String descnumdoc; + private String descnumdoc2; + private String desctipodoc; + private String desctipodoc2; + private String desctelefono; + + private String tipotarjeta; + private Integer cantparcelas; + private String numtarjeta; + private Date fecoperacion; + private String nombtitular; + + private Long notacreditovendapacoteId; + private Long ocdId; + private String numoperacionOcd; + private String operadoracartao; + private String cvesecretaria; + private String descsecretaria; + private Boolean indEncargoVenta; + + private String descconvenio; + private String cveconvenio; + + private Integer tipoPago; + + public Long getCajaId() { + return cajaId; + } + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + public String getNumAsiento() { + return numAsiento; + } + public void setNumAsiento(String numAsiento) { + this.numAsiento = numAsiento; + } + public Integer getCategoriaId() { + return categoriaId; + } + public void setCategoriaId(Integer categoriaId) { + this.categoriaId = categoriaId; + } + public String getNumFolioSistema() { + return numFolioSistema; + } + public void setNumFolioSistema(String numFolioSistema) { + this.numFolioSistema = numFolioSistema; + } + public Integer getClaseServicioId() { + return claseServicioId; + } + public void setClaseServicioId(Integer claseServicioId) { + this.claseServicioId = claseServicioId; + } + public Integer getMarcaId() { + return marcaId; + } + public void setMarcaId(Integer marcaId) { + this.marcaId = marcaId; + } + public Integer getOrigenId() { + return origenId; + } + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + public Integer getDestinoId() { + return destinoId; + } + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + public Integer getCorridaId() { + return corridaId; + } + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + public Date getFecCorrida() { + return fecCorrida; + } + public void setFecCorrida(Date fecCorrida) { + this.fecCorrida = fecCorrida; + } + public String getNombPasajero() { + return nombPasajero; + } + public void setNombPasajero(String nombPasajero) { + this.nombPasajero = nombPasajero; + } + public BigDecimal getPrecioBase() { + return precioBase; + } + public void setPrecioBase(BigDecimal precioBase) { + this.precioBase = precioBase; + } + public BigDecimal getPrecioPagado() { + return precioPagado; + } + public void setPrecioPagado(BigDecimal precioPagado) { + this.precioPagado = precioPagado; + } + public Integer getTipoVentaId() { + return tipoVentaId; + } + public void setTipoVentaId(Integer tipoVentaId) { + this.tipoVentaId = tipoVentaId; + } + public String getNumSeriePreimpresa() { + return numSeriePreimpresa; + } + public void setNumSeriePreimpresa(String numSeriePreimpresa) { + this.numSeriePreimpresa = numSeriePreimpresa; + } + public String getNumFolioPreImpreso() { + return numFolioPreImpreso; + } + public void setNumFolioPreImpreso(String numFolioPreImpreso) { + this.numFolioPreImpreso = numFolioPreImpreso; + } + public Date getFecHorViaje() { + return fecHorViaje; + } + public void setFecHorViaje(Date fecHorViaje) { + this.fecHorViaje = fecHorViaje; + } + public Date getFecHorVenta() { + return fecHorVenta; + } + public void setFecHorVenta(Date fecHorVenta) { + this.fecHorVenta = fecHorVenta; + } + public Integer getPuntoVentaId() { + return puntoVentaId; + } + public void setPuntoVentaId(Integer puntoVentaId) { + this.puntoVentaId = puntoVentaId; + } + public BigDecimal getNumKmViaje() { + return numKmViaje; + } + public void setNumKmViaje(BigDecimal numKmViaje) { + this.numKmViaje = numKmViaje; + } + public String getNumOperacion() { + return numOperacion; + } + public void setNumOperacion(String numOperacion) { + this.numOperacion = numOperacion; + } + public Integer getMotivoCancelacionId() { + return motivoCancelacionId; + } + public void setMotivoCancelacionId(Integer motivoCancelacionId) { + this.motivoCancelacionId = motivoCancelacionId; + } + public Integer getEmpresaPuntoVentaId() { + return empresaPuntoVentaId; + } + public void setEmpresaPuntoVentaId(Integer empresaPuntoVentaId) { + this.empresaPuntoVentaId = empresaPuntoVentaId; + } + public Integer getEmpresaCorridaId() { + return empresaCorridaId; + } + public void setEmpresaCorridaId(Integer empresaCorridaId) { + this.empresaCorridaId = empresaCorridaId; + } + public Integer getTurnoId() { + return turnoId; + } + public void setTurnoId(Integer turnoId) { + this.turnoId = turnoId; + } + public BigDecimal getImporteTaxaEmbarque() { + return importeTaxaEmbarque; + } + public void setImporteTaxaEmbarque(BigDecimal importeTaxaEmbarque) { + this.importeTaxaEmbarque = importeTaxaEmbarque; + } + public BigDecimal getImportePedagio() { + return importePedagio; + } + public void setImportePedagio(BigDecimal importePedagio) { + this.importePedagio = importePedagio; + } + public BigDecimal getImporteOutros() { + return importeOutros; + } + public void setImporteOutros(BigDecimal importeOutros) { + this.importeOutros = importeOutros; + } + public BigDecimal getImporteSeguro() { + return importeSeguro; + } + public void setImporteSeguro(BigDecimal importeSeguro) { + this.importeSeguro = importeSeguro; + } + public Integer getRutaId() { + return rutaId; + } + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public String getNumAutorizacion() { + return numAutorizacion; + } + public void setNumAutorizacion(String numAutorizacion) { + this.numAutorizacion = numAutorizacion; + } + public String getOrdenSevicio() { + return ordenSevicio; + } + public void setOrdenSevicio(String ordenSevicio) { + this.ordenSevicio = ordenSevicio; + } + public String getNumPuntoVenta() { + return numPuntoVenta; + } + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + public String getUf() { + return uf; + } + public void setUf(String uf) { + this.uf = uf; + } + public String getDesccategoria() { + return desccategoria; + } + public void setDesccategoria(String desccategoria) { + this.desccategoria = desccategoria; + } + @XmlElementWrapper + @XmlElement(name = "pagamento", type = PagamentoVO.class) + public List getFormaspagamento() { + return formaspagamento; + } + public void setFormaspagamento(List formaspagamento) { + this.formaspagamento = formaspagamento; + } + @XmlTransient + public String getDescPago() { + return descPago; + } + public void setDescPago(String descPago) { + this.descPago = descPago; + } + public String getCveCategoria() { + return cveCategoria; + } + public void setCveCategoria(String cveCategoria) { + this.cveCategoria = cveCategoria; + } + + public Integer getFormaPagoId() { + return formaPagoId; + } + public void setFormaPagoId(Integer formaPagoId) { + this.formaPagoId = formaPagoId; + } + @XmlTransient + public BigDecimal getVlrFormaPago() { + return vlrFormaPago; + } + public void setVlrFormaPago(BigDecimal vlrFormaPago) { + this.vlrFormaPago = vlrFormaPago; + } + + + public String getDescMotivo() { + return descMotivo; + } + public void setDescMotivo(String descMotivo) { + this.descMotivo = descMotivo; + } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((cajaId == null) ? 0 : cajaId.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + CajaDetalleVO other = (CajaDetalleVO) obj; + if (cajaId == null) { + if (other.cajaId != null) + return false; + } else if (!cajaId.equals(other.cajaId)) + return false; + return true; + } + public Long getTransacaoId() { + return transacaoId; + } + public void setTransacaoId(Long transacaoId) { + this.transacaoId = transacaoId; + } + public Long getTransacaooriginalId() { + return transacaooriginalId; + } + public void setTransacaooriginalId(Long transacaooriginalId) { + this.transacaooriginalId = transacaooriginalId; + } + public String getDescnumdoc() { + return descnumdoc; + } + public void setDescnumdoc(String descnumdoc) { + this.descnumdoc = descnumdoc; + } + public String getDescnumdoc2() { + return descnumdoc2; + } + public void setDescnumdoc2(String descnumdoc2) { + this.descnumdoc2 = descnumdoc2; + } + public String getDesctipodoc() { + return desctipodoc; + } + public void setDesctipodoc(String desctipodoc) { + this.desctipodoc = desctipodoc; + } + public String getDesctipodoc2() { + return desctipodoc2; + } + public void setDesctipodoc2(String desctipodoc2) { + this.desctipodoc2 = desctipodoc2; + } + public String getDesctelefono() { + return desctelefono; + } + public void setDesctelefono(String desctelefono) { + this.desctelefono = desctelefono; + } + @XmlTransient + public String getTipotarjeta() { + return tipotarjeta; + } + public void setTipotarjeta(String tipotarjeta) { + this.tipotarjeta = tipotarjeta; + } + @XmlTransient + public Integer getCantparcelas() { + return cantparcelas; + } + public void setCantparcelas(Integer cantparcelas) { + this.cantparcelas = cantparcelas; + } + @XmlTransient + public String getNumtarjeta() { + return numtarjeta; + } + public void setNumtarjeta(String numtarjeta) { + this.numtarjeta = numtarjeta; + } + @XmlTransient + public Date getFecoperacion() { + return fecoperacion; + } + public void setFecoperacion(Date fecoperacion) { + this.fecoperacion = fecoperacion; + } + @XmlTransient + public String getNombtitular() { + return nombtitular; + } + public void setNombtitular(String nombtitular) { + this.nombtitular = nombtitular; + } + @XmlTransient + public Long getNotacreditovendapacoteId() { + return notacreditovendapacoteId; + } + public void setNotacreditovendapacoteId(Long notacreditovendapacoteId) { + this.notacreditovendapacoteId = notacreditovendapacoteId; + } + @XmlTransient + public Long getOcdId() { + return ocdId; + } + public void setOcdId(Long ocdId) { + this.ocdId = ocdId; + } + @XmlTransient + public String getNumoperacionOcd() { + return numoperacionOcd; + } + public void setNumoperacionOcd(String numoperacionOcd) { + this.numoperacionOcd = numoperacionOcd; + } + @XmlTransient + public String getOperadoracartao() { + return operadoracartao; + } + public void setOperadoracartao(String operadoracartao) { + this.operadoracartao = operadoracartao; + } + @XmlTransient + public String getCvesecretaria() { + return cvesecretaria; + } + public void setCvesecretaria(String cvesecretaria) { + this.cvesecretaria = cvesecretaria; + } + @XmlTransient + public Integer getTipoPago() { + return tipoPago; + } + public void setTipoPago(Integer tipoPago) { + this.tipoPago = tipoPago; + } + public Boolean getIndEncargoVenta() { + return indEncargoVenta; + } + public void setIndEncargoVenta(Boolean indEncargoVenta) { + this.indEncargoVenta = indEncargoVenta; + } + public String getDescconvenio() { + return descconvenio; + } + public void setDescconvenio(String descconvenio) { + this.descconvenio = descconvenio; + } + public String getCveconvenio() { + return cveconvenio; + } + public void setCveconvenio(String cveconvenio) { + this.cveconvenio = cveconvenio; + } + @XmlTransient + public String getDescsecretaria() { + return descsecretaria; + } + public void setDescsecretaria(String descsecretaria) { + this.descsecretaria = descsecretaria; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/caja/CajaVO.java b/src/com/rjconsultores/ventaboletos/vo/caja/CajaVO.java new file mode 100644 index 000000000..83e784e6a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/caja/CajaVO.java @@ -0,0 +1,264 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import java.math.BigDecimal; +import java.util.Date; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class CajaVO { + + private Long cajaId; + private String numAsiento; + private Integer categoriaId; + private String numFolioSistema; + private Integer claseServicioId; + private Integer marcaId; + private Integer origenId; + private Integer destinoId; + private Integer corridaId; + private Date fecCorrida; + private String nombPasajero; + private BigDecimal precioBase; + private BigDecimal precioPagado; + private Integer tipoVentaId; + private String numSeriePreimpresa; + private String numFolioPreImpreso; + private Date fecHorViaje; + private Date fecHorVenta; + private Integer puntoVentaId; + private String numPuntoVenta; + private BigDecimal numKmViaje; + private String numOperacion; + private Integer motivoCancelacionId; + private Integer empresaPuntoVentaId; + private Integer empresaCorridaId; + private Integer turnoId; + private BigDecimal importeTaxaEmbarque; + private BigDecimal importePedagio; + private BigDecimal importeOutros; + private BigDecimal importeSeguro; + private Integer rutaId; + private Integer usuarioId; + private String numAutorizacion; + private String ordenSevicio; + private String uf; + private String desccategoria; + + public Long getCajaId() { + return cajaId; + } + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + public String getNumAsiento() { + return numAsiento; + } + public void setNumAsiento(String numAsiento) { + this.numAsiento = numAsiento; + } + public Integer getCategoriaId() { + return categoriaId; + } + public void setCategoriaId(Integer categoriaId) { + this.categoriaId = categoriaId; + } + public String getNumFolioSistema() { + return numFolioSistema; + } + public void setNumFolioSistema(String numFolioSistema) { + this.numFolioSistema = numFolioSistema; + } + public Integer getClaseServicioId() { + return claseServicioId; + } + public void setClaseServicioId(Integer claseServicioId) { + this.claseServicioId = claseServicioId; + } + public Integer getMarcaId() { + return marcaId; + } + public void setMarcaId(Integer marcaId) { + this.marcaId = marcaId; + } + public Integer getOrigenId() { + return origenId; + } + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + public Integer getDestinoId() { + return destinoId; + } + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + public Integer getCorridaId() { + return corridaId; + } + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + public Date getFecCorrida() { + return fecCorrida; + } + public void setFecCorrida(Date fecCorrida) { + this.fecCorrida = fecCorrida; + } + public String getNombPasajero() { + return nombPasajero; + } + public void setNombPasajero(String nombPasajero) { + this.nombPasajero = nombPasajero; + } + public BigDecimal getPrecioBase() { + return precioBase; + } + public void setPrecioBase(BigDecimal precioBase) { + this.precioBase = precioBase; + } + public BigDecimal getPrecioPagado() { + return precioPagado; + } + public void setPrecioPagado(BigDecimal precioPagado) { + this.precioPagado = precioPagado; + } + public Integer getTipoVentaId() { + return tipoVentaId; + } + public void setTipoVentaId(Integer tipoVentaId) { + this.tipoVentaId = tipoVentaId; + } + public String getNumSeriePreimpresa() { + return numSeriePreimpresa; + } + public void setNumSeriePreimpresa(String numSeriePreimpresa) { + this.numSeriePreimpresa = numSeriePreimpresa; + } + public String getNumFolioPreImpreso() { + return numFolioPreImpreso; + } + public void setNumFolioPreImpreso(String numFolioPreImpreso) { + this.numFolioPreImpreso = numFolioPreImpreso; + } + public Date getFecHorViaje() { + return fecHorViaje; + } + public void setFecHorViaje(Date fecHorViaje) { + this.fecHorViaje = fecHorViaje; + } + public Date getFecHorVenta() { + return fecHorVenta; + } + public void setFecHorVenta(Date fecHorVenta) { + this.fecHorVenta = fecHorVenta; + } + public Integer getPuntoVentaId() { + return puntoVentaId; + } + public void setPuntoVentaId(Integer puntoVentaId) { + this.puntoVentaId = puntoVentaId; + } + public BigDecimal getNumKmViaje() { + return numKmViaje; + } + public void setNumKmViaje(BigDecimal numKmViaje) { + this.numKmViaje = numKmViaje; + } + public String getNumOperacion() { + return numOperacion; + } + public void setNumOperacion(String numOperacion) { + this.numOperacion = numOperacion; + } + public Integer getMotivoCancelacionId() { + return motivoCancelacionId; + } + public void setMotivoCancelacionId(Integer motivoCancelacionId) { + this.motivoCancelacionId = motivoCancelacionId; + } + public Integer getEmpresaPuntoVentaId() { + return empresaPuntoVentaId; + } + public void setEmpresaPuntoVentaId(Integer empresaPuntoVentaId) { + this.empresaPuntoVentaId = empresaPuntoVentaId; + } + public Integer getEmpresaCorridaId() { + return empresaCorridaId; + } + public void setEmpresaCorridaId(Integer empresaCorridaId) { + this.empresaCorridaId = empresaCorridaId; + } + public Integer getTurnoId() { + return turnoId; + } + public void setTurnoId(Integer turnoId) { + this.turnoId = turnoId; + } + public BigDecimal getImporteTaxaEmbarque() { + return importeTaxaEmbarque; + } + public void setImporteTaxaEmbarque(BigDecimal importeTaxaEmbarque) { + this.importeTaxaEmbarque = importeTaxaEmbarque; + } + public BigDecimal getImportePedagio() { + return importePedagio; + } + public void setImportePedagio(BigDecimal importePedagio) { + this.importePedagio = importePedagio; + } + public BigDecimal getImporteOutros() { + return importeOutros; + } + public void setImporteOutros(BigDecimal importeOutros) { + this.importeOutros = importeOutros; + } + public BigDecimal getImporteSeguro() { + return importeSeguro; + } + public void setImporteSeguro(BigDecimal importeSeguro) { + this.importeSeguro = importeSeguro; + } + public Integer getRutaId() { + return rutaId; + } + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public String getNumAutorizacion() { + return numAutorizacion; + } + public void setNumAutorizacion(String numAutorizacion) { + this.numAutorizacion = numAutorizacion; + } + public String getOrdenSevicio() { + return ordenSevicio; + } + public void setOrdenSevicio(String ordenSevicio) { + this.ordenSevicio = ordenSevicio; + } + public String getNumPuntoVenta() { + return numPuntoVenta; + } + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + public String getUf() { + return uf; + } + public void setUf(String uf) { + this.uf = uf; + } + public String getDesccategoria() { + return desccategoria; + } + public void setDesccategoria(String desccategoria) { + this.desccategoria = desccategoria; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/caja/PagamentoCartaoVO.java b/src/com/rjconsultores/ventaboletos/vo/caja/PagamentoCartaoVO.java new file mode 100644 index 000000000..40440c786 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/caja/PagamentoCartaoVO.java @@ -0,0 +1,62 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + +@XmlRootElement(name="cartao") +public class PagamentoCartaoVO { + + private String bandeira; + private String numautorizacao; + private Integer parcelas; + private String titular; + private String numcartao; + private Date datapagamento; + private String operadoracartao; + + public String getBandeira() { + return bandeira; + } + public void setBandeira(String bandeira) { + this.bandeira = bandeira; + } + public String getNumautorizacao() { + return numautorizacao; + } + public void setNumautorizacao(String numautorizacao) { + this.numautorizacao = numautorizacao; + } + public Integer getParcelas() { + return parcelas; + } + public void setParcelas(Integer parcelas) { + this.parcelas = parcelas; + } + public String getTitular() { + return titular; + } + public void setTitular(String titular) { + this.titular = titular; + } + public String getNumcartao() { + return numcartao; + } + public void setNumcartao(String numcartao) { + this.numcartao = numcartao; + } + public Date getDatapagamento() { + return datapagamento; + } + public void setDatapagamento(Date datapagamento) { + this.datapagamento = datapagamento; + } + public String getOperadoracartao() { + return operadoracartao; + } + public void setOperadoracartao(String operadoracartao) { + this.operadoracartao = operadoracartao; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/caja/PagamentoVO.java b/src/com/rjconsultores/ventaboletos/vo/caja/PagamentoVO.java new file mode 100644 index 000000000..feb7e4c61 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/caja/PagamentoVO.java @@ -0,0 +1,115 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import java.math.BigDecimal; +import java.util.List; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; +import javax.xml.bind.annotation.XmlType; + +import com.rjconsultores.ventaboletos.enums.TipoFormapago; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.DadosBancarioVO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.NotaCreditoVendaPacoteVO; + +@XmlRootElement(name = "pagamento") +@XmlType(propOrder = { "formapagamento", "moeda", "valor", "cartao", "notacredito", "identificacaoEmpresa", "razaoSocial", "dadosBancarios"}) +public class PagamentoVO { + + private String formapagamento; + private String moeda; + private BigDecimal valor; + private PagamentoCartaoVO cartao; + private Integer formapagoId; + private NotaCreditoVendaPacoteVO notacredito; + private String identificacaoEmpresa; + private String razaoSocial; + private TipoFormapago tipoFormapago; + + private List dadosBancarios; + + public String getMoeda() { + return moeda; + } + + public void setMoeda(String moeda) { + this.moeda = moeda; + } + + public String getFormapagamento() { + return formapagamento; + } + + public void setFormapagamento(String formapagamento) { + this.formapagamento = formapagamento; + } + + public PagamentoCartaoVO getCartao() { + return cartao; + } + + public void setCartao(PagamentoCartaoVO cartao) { + this.cartao = cartao; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + @XmlTransient + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public NotaCreditoVendaPacoteVO getNotacredito() { + return notacredito; + } + + public void setNotacredito(NotaCreditoVendaPacoteVO notacredito) { + this.notacredito = notacredito; + } + + public String getIdentificacaoEmpresa() { + return identificacaoEmpresa; + } + + public void setIdentificacaoEmpresa(String identificacaoEmpresa) { + this.identificacaoEmpresa = identificacaoEmpresa; + } + + @XmlTransient + public TipoFormapago getTipoFormapago() { + return tipoFormapago; + } + + public void setTipoFormapago(TipoFormapago tipoFormapago) { + this.tipoFormapago = tipoFormapago; + } + + @XmlElementWrapper + @XmlElement(name = "dadosBancario", type = DadosBancarioVO.class) + public List getDadosBancarios() { + return dadosBancarios; + } + + public void setDadosBancarios(List dadosBancarios) { + this.dadosBancarios = dadosBancarios; + } + + public String getRazaoSocial() { + return razaoSocial; + } + + public void setRazaoSocial(String razaoSocial) { + this.razaoSocial = razaoSocial; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/caja/ReceitaDespesaVO.java b/src/com/rjconsultores/ventaboletos/vo/caja/ReceitaDespesaVO.java new file mode 100644 index 000000000..42ab136a1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/caja/ReceitaDespesaVO.java @@ -0,0 +1,24 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import java.math.BigDecimal; + +import javax.xml.bind.annotation.XmlRootElement; + + +public class ReceitaDespesaVO { + private BigDecimal precio; + private String tipoEvento; + + public BigDecimal getPrecio() { + return precio; + } + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + public String getTipoEvento() { + return tipoEvento; + } + public void setTipoEvento(String tipoEvento) { + this.tipoEvento = tipoEvento; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/caja/UsuarioActivoVO.java b/src/com/rjconsultores/ventaboletos/vo/caja/UsuarioActivoVO.java new file mode 100644 index 000000000..4174cb02c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/caja/UsuarioActivoVO.java @@ -0,0 +1,37 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class UsuarioActivoVO { + private Integer usuarioId; + private String nombusuario; + private String cveusuario; + + public UsuarioActivoVO() { + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getNombusuario() { + return nombusuario; + } + + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + + public String getCveusuario() { + return cveusuario; + } + + public void setCveusuario(String cveUsuario) { + this.cveusuario = cveUsuario; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/caja/UsuarioVO.java b/src/com/rjconsultores/ventaboletos/vo/caja/UsuarioVO.java new file mode 100644 index 000000000..aaac27fd6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/caja/UsuarioVO.java @@ -0,0 +1,84 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement +public class UsuarioVO { + private Integer usuarioId; + private String cveusuario; + private Integer puntoVentaId; + private String numPuntoVenta; + private Integer turnoId; + private Date fecCorte; + private BigDecimal importeTotal; + private List pasajes; + private List diversos; + + public UsuarioVO() { + this.puntoVentaId = new Integer(-1); + this.fecCorte = new Date();; + this.turnoId = new Integer(-1); + this.importeTotal = new BigDecimal(0); + } + + public List getPasajes() { + return pasajes; + } + public void setPasajes(List pasajes) { + this.pasajes = pasajes; + } + public List getDiversos() { + return diversos; + } + public void setDiversos(List diversos) { + this.diversos = diversos; + } + public String getCveusuario() { + return cveusuario; + } + public void setCveusuario(String cveusuario) { + this.cveusuario = cveusuario; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public Integer getPuntoVentaId() { + return puntoVentaId; + } + public void setPuntoVentaId(Integer puntoVentaId) { + this.puntoVentaId = puntoVentaId; + } + public Date getFecCorte() { + return fecCorte; + } + public void setFecCorte(Date fecCorte) { + this.fecCorte = fecCorte; + } + public Integer getTurnoId() { + return turnoId; + } + public void setTurnoId(Integer turnoId) { + this.turnoId = turnoId; + } + public BigDecimal getImporteTotal() { + return importeTotal; + } + public void setImporteTotal(BigDecimal importeTotal) { + this.importeTotal = importeTotal; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/caja/VendaEmbarcadaVO.java b/src/com/rjconsultores/ventaboletos/vo/caja/VendaEmbarcadaVO.java new file mode 100644 index 000000000..64356a57f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/caja/VendaEmbarcadaVO.java @@ -0,0 +1,292 @@ +package com.rjconsultores.ventaboletos.vo.caja; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.sql.Date; + +public class VendaEmbarcadaVO { + private Long cajaId; + private String numAsiento; + private Integer categoriaId; + private Integer claseServicioId; + private Integer marcaId; + private Integer origemId; + private Integer destinoId; + private Integer corridaId; + private Date fecCorrida; + private Integer tipoVentaId; + private Date fechorViaje; + private Date fechorVenta; + private Integer puntoVentaId; + private String numOperacion; + private Integer empresaPuntoVentaId; + private Integer empresaCorridaId; + private Integer estacionId; + private Integer usuarioId; + private Integer clienteId; + private BigDecimal precio; + private BigDecimal importeTaxaEmbarque; + private BigDecimal importePedagio; + private BigDecimal importeOutros; + private BigDecimal importeSeguro; + private Integer rutaId; + private Integer formaPagoId; + private BigInteger empresaId; + private Long boletoId; + private Date fecModIf; + private String numFolioPreimpresso; + private String serieImpFiscal; + + public VendaEmbarcadaVO() { + fecModIf = new Date(System.currentTimeMillis()); + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public BigInteger getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(BigInteger empresaId) { + this.empresaId = empresaId; + } + + public Integer getFormaPagoId() { + return formaPagoId; + } + + public void setFormaPagoId(Integer formaPagoId) { + this.formaPagoId = formaPagoId; + } + + public Long getCajaId() { + return cajaId; + } + + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + + public String getNumAsiento() { + return numAsiento; + } + + public void setNumAsiento(String numAsiento) { + this.numAsiento = numAsiento; + } + + public Integer getCategoriaId() { + return categoriaId; + } + + public void setCategoriaId(Integer categoriaId) { + this.categoriaId = categoriaId; + } + + public Integer getClaseServicioId() { + return claseServicioId; + } + + public void setClaseServicioId(Integer claseServicioId) { + this.claseServicioId = claseServicioId; + } + + public Integer getMarcaId() { + return marcaId; + } + + public void setMarcaId(Integer marcaId) { + this.marcaId = marcaId; + } + + public Integer getOrigemId() { + return origemId; + } + + public void setOrigemId(Integer origemId) { + this.origemId = origemId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Date getFecCorrida() { + return fecCorrida; + } + + public void setFecCorrida(Date fecCorrida) { + this.fecCorrida = fecCorrida; + } + + public Integer getTipoVentaId() { + return tipoVentaId; + } + + public void setTipoVentaId(Integer tipoVentaId) { + this.tipoVentaId = tipoVentaId; + } + + public Date getFechorViaje() { + return fechorViaje; + } + + public void setFechorViaje(Date fechorViaje) { + this.fechorViaje = fechorViaje; + } + + public Date getFechorVenta() { + return fechorVenta; + } + + public void setFechorVenta(Date fechorVenta) { + this.fechorVenta = fechorVenta; + } + + public Integer getPuntoVentaId() { + return puntoVentaId; + } + + public void setPuntoVentaId(Integer puntoVentaId) { + this.puntoVentaId = puntoVentaId; + } + + public String getNumOperacion() { + return numOperacion; + } + + public void setNumOperacion(String numOperacion) { + this.numOperacion = numOperacion; + } + + public Integer getEmpresaPuntoVentaId() { + return empresaPuntoVentaId; + } + + public void setEmpresaPuntoVentaId(Integer empresaPuntoVentaId) { + this.empresaPuntoVentaId = empresaPuntoVentaId; + } + + public Integer getEmpresaCorridaId() { + return empresaCorridaId; + } + + public void setEmpresaCorridaId(Integer empresaCorridaId) { + this.empresaCorridaId = empresaCorridaId; + } + + public Integer getEstacionId() { + return estacionId; + } + + public void setEstacionId(Integer estacionId) { + this.estacionId = estacionId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getClienteId() { + return clienteId; + } + + public void setClienteId(Integer clienteId) { + this.clienteId = clienteId; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getImporteTaxaEmbarque() { + return importeTaxaEmbarque; + } + + public void setImporteTaxaEmbarque(BigDecimal importeTaxaEmbarque) { + this.importeTaxaEmbarque = importeTaxaEmbarque; + } + + public BigDecimal getImportePedagio() { + return importePedagio; + } + + public void setImportePedagio(BigDecimal importePedagio) { + this.importePedagio = importePedagio; + } + + public BigDecimal getImporteOutros() { + return importeOutros; + } + + public void setImporteOutros(BigDecimal importeOutros) { + this.importeOutros = importeOutros; + } + + public BigDecimal getImporteSeguro() { + return importeSeguro; + } + + public void setImporteSeguro(BigDecimal importeSeguro) { + this.importeSeguro = importeSeguro; + } + + public Integer getRutaId() { + return rutaId; + } + + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + + public Date getFecModIf() { + return fecModIf; + } + + public void setFecModIf(Date fecModIf) { + this.fecModIf = fecModIf; + } + + public String getNumFolioPreimpresso() { + return numFolioPreimpresso; + } + + public void setNumFolioPreimpresso(String numFolioPreimpresso) { + this.numFolioPreimpresso = numFolioPreimpresso; + } + + public String getSerieImpFiscal() { + return serieImpFiscal; + } + + public void setSerieImpFiscal(String serieImpFiscal) { + this.serieImpFiscal = serieImpFiscal; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/cashmonitor/RelatorioVendaCartaoCashMonitorVO.java b/src/com/rjconsultores/ventaboletos/vo/cashmonitor/RelatorioVendaCartaoCashMonitorVO.java new file mode 100644 index 000000000..7579ce1c5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/cashmonitor/RelatorioVendaCartaoCashMonitorVO.java @@ -0,0 +1,122 @@ +package com.rjconsultores.ventaboletos.vo.cashmonitor; + +import java.io.Serializable; +import java.math.BigDecimal; + +@SuppressWarnings("serial") +public class RelatorioVendaCartaoCashMonitorVO implements Serializable { + + private String dataTransacao; + private String loja; + private String adquirente; + private String nsu; + private String autorizacao; + private BigDecimal valorBruto; + private Integer formapago_id; + private String bandeira; + private String codigoPedido; + private BigDecimal valorParcela; + private Integer parcelas; + + public String getDataTransacao() { + return dataTransacao; + } + + public String getLoja() { + return loja; + } + + public String getAdquirente() { + return adquirente; + } + + public String getNsu() { + return nsu; + } + + public String getAutorizacao() { + return autorizacao; + } + + public BigDecimal getValorBruto() { + return valorBruto; + } + + public Integer getFormapago_id() { + return formapago_id; + } + + public String getBandeira() { + return bandeira; + } + + public String getCodigoPedido() { + return codigoPedido; + } + + public BigDecimal getValorParcela() { + return valorParcela; + } + + public Integer getParcelas() { + return parcelas; + } + + public void setDataTransacao(String dataTransacao) { + this.dataTransacao = dataTransacao; + } + + public void setLoja(String loja) { + this.loja = loja; + } + + public void setAdquirente(String adquirente) { + this.adquirente = adquirente; + } + + public void setNsu(String nsu) { + this.nsu = nsu; + } + + public void setAutorizacao(String autorizacao) { + this.autorizacao = autorizacao; + } + + public void setValorBruto(BigDecimal valorBruto) { + this.valorBruto = valorBruto; + } + + public void setFormapago_id(Integer formapago_id) { + this.formapago_id = formapago_id; + } + + public void setBandeira(String bandeira) { + this.bandeira = bandeira; + } + + public void setCodigoPedido(String codigoPedido) { + this.codigoPedido = codigoPedido; + } + + public void setValorParcela(BigDecimal valorParcela) { + this.valorParcela = valorParcela; + } + + public void setParcelas(Integer parcelas) { + this.parcelas = parcelas; + } + + public String getCondicaoVenda() { + // Espec01 - Relatorio de vendas de cartões.docx + // CONDICAO DE VENDA: débito/a vista/parcelada + if (getFormapago_id()==3) { + return "débito"; + } else { + if (getParcelas() == 1) { + return "a vista"; + } else { + return "parcelada"; + } + } + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/vo/clase/ClaseVO.java b/src/com/rjconsultores/ventaboletos/vo/clase/ClaseVO.java new file mode 100644 index 000000000..75636c8ad --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/clase/ClaseVO.java @@ -0,0 +1,36 @@ +package com.rjconsultores.ventaboletos.vo.clase; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; + +public class ClaseVO { + private Integer claseId; + private String descClase; + + public ClaseVO(Integer claseId, String descClase) { + super(); + this.claseId = claseId; + this.descClase = descClase; + } + + public ClaseVO(ClaseServicio clase) { + this.claseId = clase.getClaseservicioId(); + this.descClase = clase.getDescclase(); + } + + public Integer getClaseId() { + return claseId; + } + + public void setClaseId(Integer claseId) { + this.claseId = claseId; + } + + public String getDescClase() { + return descClase; + } + + public void setDescClase(String descClase) { + this.descClase = descClase; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java b/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java new file mode 100644 index 000000000..cb5c27e79 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java @@ -0,0 +1,1092 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.constantes.Constantes; +import com.rjconsultores.ventaboletos.constantes.DescricaoTipoVenta; +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.enums.IndStatusBoleto; +import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +public class BoletoComissao { + + private Long boletoId; + private Long boletoOriginalId; + private Integer empresaId; + private Integer puntoVentaId; + private String datavenda; + private Integer tipoVenta; + private String indstatusboleto; + private Integer motivoCancelacionId; + private Integer motivoCancelacionOriginal1; + private Integer motivoCancelacionOriginal2; + private String descmotivocancelacion; + private BigDecimal valorbase; + private BigDecimal valorpagado; + private BigDecimal valorTabela; + private BigDecimal seguro; + private BigDecimal pedagio; + private BigDecimal embarque; + private BigDecimal excessoBagagem; + private BigDecimal seguroOpcional; + private BigDecimal seguroOutros; + private Boolean ptoVtaOrigem; + private String numAsiento; + private String numAsientoVinculado; + private String numFolioSistema; + private String numSeriePreimpresa; + private String numFolioPreImpreso; + private String uf; + private String desccategoria; + private String nombpasajero; + private Integer status; + private String numoperacion; + private Integer tipoVentaOriginal1; + private Integer tipoVentaOriginal2; + private Integer ocdId; + private BigDecimal valorPagarOcd; + private BigDecimal valorTarjetaOcd; + + private Integer estadoId; + private Integer formapagoId; + private String descpago; + private Boolean indconferenciafisicacomissao; + private BigDecimal importeFp; + + private List formapagos; + private BigDecimal icmsBase; + private String nombusuario; + private Integer comempformapagoId; + private Integer comempcategoriaId; + private Long logconferenciaId; + + private boolean exigeConferenciaDevolvido; + private Boolean indcarboletosdevolvidosconf; + + private boolean exigeConferenciaAba; + + private boolean conferido; + + private Date feccorrida; + + private Integer corridaId; + + private Boolean indCancelacion; + + private Boolean indreimpresion; + + private Integer tipoventaAnteriorId; + + private Long cajaId; + + private Long transacaoOriginalId; + + private Conferencia conferencia; + + private Date feccorte; + + private Long transacaoId; + + private Boolean conferidoEntrega; + + private Integer ptovtaventaId; + + private Integer usuarioId; + + private Integer turnoId; + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public Integer getPuntoVentaId() { + return puntoVentaId; + } + + public void setPuntoVentaId(Integer puntoVentaId) { + this.puntoVentaId = puntoVentaId; + } + + public String getDatavenda() { + return datavenda; + } + + public void setDatavenda(String datavenda) { + this.datavenda = datavenda; + } + + public Integer getTipoVenta() { + return tipoVenta; + } + + public void setTipoVenta(Integer tipoVenta) { + this.tipoVenta = tipoVenta; + } + + public Integer getMotivoCancelacionId() { + return motivoCancelacionId; + } + + public void setMotivoCancelacionId(Integer motivoCancelacionId) { + this.motivoCancelacionId = motivoCancelacionId; + } + + public BigDecimal getValorpagado() { + return valorpagado; + } + + public void setValorpagado(BigDecimal valorpagado) { + this.valorpagado = valorpagado; + } + + public BigDecimal getSeguro() { + return seguro; + } + + public void setSeguro(BigDecimal seguro) { + this.seguro = seguro; + } + + public BigDecimal getPedagio() { + return pedagio; + } + + public void setPedagio(BigDecimal pedagio) { + this.pedagio = pedagio; + } + + public BigDecimal getEmbarque() { + return embarque; + } + + public void setEmbarque(BigDecimal embarque) { + this.embarque = embarque; + } + + public BigDecimal getExcessoBagagem() { + return excessoBagagem; + } + + public void setExcessoBagagem(BigDecimal excessoBagagem) { + this.excessoBagagem = excessoBagagem; + } + + public BigDecimal getSeguroOpcional() { + return seguroOpcional; + } + + public void setSeguroOpcional(BigDecimal seguroOpcional) { + this.seguroOpcional = seguroOpcional; + } + + public BigDecimal getSeguroOutros() { + return seguroOutros; + } + + public void setSeguroOutros(BigDecimal seguroOutros) { + this.seguroOutros = seguroOutros; + } + + public void setPtoVtaOrigem(Boolean ptoVtaOrigem) { + this.ptoVtaOrigem = ptoVtaOrigem; + } + + public String getIndstatusboleto() { + return indstatusboleto; + } + + public void setIndstatusboleto(String indstatusboleto) { + this.indstatusboleto = indstatusboleto; + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public void setBoletoOriginalId(Long boletoOriginalId) { + this.boletoOriginalId = boletoOriginalId; + } + + public Long getBoletoOriginalId() { + return boletoOriginalId; + } + + public String getNumAsiento() { + return numAsiento; + } + + public void setNumAsiento(String numAsiento) { + this.numAsiento = numAsiento; + } + + public String getNumFolioSistema() { + return numFolioSistema; + } + + public void setNumFolioSistema(String numFolioSistema) { + this.numFolioSistema = numFolioSistema; + } + + public String getNumSeriePreimpresa() { + return numSeriePreimpresa; + } + + public void setNumSeriePreimpresa(String numSeriePreimpresa) { + this.numSeriePreimpresa = numSeriePreimpresa; + } + + public String getNumFolioPreImpreso() { + return numFolioPreImpreso; + } + + public void setNumFolioPreImpreso(String numFolioPreImpreso) { + this.numFolioPreImpreso = numFolioPreImpreso; + } + + public String getUf() { + return uf; + } + + public void setUf(String uf) { + this.uf = uf; + } + + public String getDesccategoria() { + return desccategoria; + } + + public void setDesccategoria(String desccategoria) { + this.desccategoria = desccategoria; + } + + public Boolean getPtoVtaOrigem() { + return ptoVtaOrigem; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getStatusDescricao() { + StatusLogConferencia statusLogConferencia = StatusLogConferencia.getStatusLogConferencia(status); + if (statusLogConferencia != null) { + return statusLogConferencia.toString(); + } + return ""; + } + + public String getDescFormapagos() { + StringBuilder sFormapagos = new StringBuilder(); + for (FormapagoVO formapago : formapagos) { + if (sFormapagos.length() > 0) { + sFormapagos.append(", "); + } + sFormapagos.append(formapago.getDescpago()); + } + + return sFormapagos.toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getCajaId() == null) ? 0 : getCajaId().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + BoletoComissao other = (BoletoComissao) obj; + if (getCajaId() == null) { + if (other.getCajaId() != null) + return false; + } else if (!getCajaId().equals(other.getCajaId())) + return false; + return true; + } + + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public String getDescpago() { + return descpago; + } + + public void setDescpago(String descpago) { + this.descpago = descpago; + } + + public Boolean getIndconferenciafisicacomissao() { + return indconferenciafisicacomissao; + } + + public void setIndconferenciafisicacomissao(Boolean indconferenciafisicacomissao) { + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + } + + public List getFormapagos() { + return formapagos; + } + + public void setFormapagos(List formapagos) { + this.formapagos = formapagos; + } + + public BigDecimal getIcmsBase() { + return icmsBase; + } + + public void setIcmsBase(BigDecimal icmsBase) { + this.icmsBase = icmsBase; + } + + public String getDescmotivocancelacion() { + return descmotivocancelacion; + } + + public void setDescmotivocancelacion(String descmotivocancelacion) { + this.descmotivocancelacion = descmotivocancelacion; + } + + public Integer getEstadoId() { + return estadoId; + } + + public void setEstadoId(Integer estadoId) { + this.estadoId = estadoId; + } + + public String getNumAsientoVinculado() { + return numAsientoVinculado; + } + + public void setNumAsientoVinculado(String numAsientoVinculado) { + this.numAsientoVinculado = numAsientoVinculado; + } + + public BigDecimal getTotal() { + BigDecimal total = BigDecimal.ZERO; + for (FormapagoVO formapagoVO : formapagos) { + total = total.add(formapagoVO.getImporte()); + } + return total; + } + + public String getDescTipoVenta() { + return DescricaoTipoVenta.getDescricaoTipoVenta(getTipoVenta()); + } + + public String getSituacaoBilhete() { + if (isOcd()) { + return "OCD"; + } + + if(isMotivocancelacionAgrupamento()) { + return getDescmotivocancelacion(); + } + + if(isStatusVendido()) { + return IndStatusBoleto.getIndStatusBoleto(getIndstatusboleto()).getValue(); + } + + if ((isStatusCancelado()) && (isMotivocancelacionDevolvido() || isMotivocancelacionCancelado()) + && StringUtils.isNotBlank(getDescmotivocancelacion())) { + return getDescmotivocancelacion(); + } + + if (isStatusCancelado()) { + if (isMotivocancelacionTrocado() || (isMotivocancelacionGeracaoOcd() && isFormapagoTrocaPassagem())) { + return "TROCADO"; + } else if (isMotivocancelacionTransferido()) { + return "TRANSFERIDO"; + } + } + + if (isStatusTroca()) { + if (isVendaBilheteTroca(getTipoVenta()) || isVendaGap(getTipoVenta())) { + return "B. DA TROCA"; + } else if (isVendaBilheteTransferencia(getTipoVenta()) || isVendaGap(getTipoVenta())) { + return "B. DA TRANSFERENCIA"; + } else if (isVendaBilheteConfirmaAberto(getTipoVenta())) { + return "CONFIRMAÇÃO ABERTO"; + } else if (isVendaBilheteCheckin(getTipoVenta())) { + return "CHECKIN"; + } + } + + IndStatusBoleto indStatusBoleto = IndStatusBoleto.getIndStatusBoleto(getIndstatusboleto()); + return indStatusBoleto != null ? indStatusBoleto.getValue() : ""; + } + + public boolean isFormapagoTrocaPassagem() { + boolean fpTrocapassagem = false; + for (FormapagoVO formapagoVO : formapagos) { + fpTrocapassagem = formapagoVO.getFormapagoId().equals(Constantes.FORMA_PAGO_TROCA_PASSAGEM.intValue()); + } + return fpTrocapassagem; + } + + public boolean isOcd() { + return isMotivocancelacionGeracaoOcd() && isStatusCancelado() && !isFormapagoTrocaPassagem(); + } + + public String getNombusuario() { + return nombusuario; + } + + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + + public BigDecimal getImporteFp() { + return importeFp; + } + + public void setImporteFp(BigDecimal importeFp) { + this.importeFp = importeFp; + } + + public Integer getComempformapagoId() { + return comempformapagoId; + } + + public void setComempformapagoId(Integer comempformapagoId) { + this.comempformapagoId = comempformapagoId; + } + + public Integer getComempcategoriaId() { + return comempcategoriaId; + } + + public void setComempcategoriaId(Integer comempcategoriaId) { + this.comempcategoriaId = comempcategoriaId; + } + + public boolean isExigeConferencia() { + return getComempcategoriaId() != null || getComempformapagoId() != null; + } + + public boolean isExigeConferenciaBoletoDevolvido() { + return exigeConferenciaDevolvido; + } + + public boolean isConferido() { + return conferido; + } + + public void setConferido(boolean conferido) { + this.conferido = conferido; + } + + public Long getLogconferenciaId() { + return logconferenciaId; + } + + public void setLogconferenciaId(Long logconferenciaId) { + this.logconferenciaId = logconferenciaId; + } + + public String getNumoperacion() { + return numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public Integer getTipoVentaOriginal() { + return tipoVenta; + } + + public Integer getTipoVentaOriginal1() { + return tipoVentaOriginal1; + } + + public void setTipoVentaOriginal1(Integer tipoVentaOriginal1) { + this.tipoVentaOriginal1 = tipoVentaOriginal1; + } + + public Integer getTipoVentaOriginal2() { + return tipoVentaOriginal2; + } + + public void setTipoVentaOriginal2(Integer tipoVentaOriginal2) { + this.tipoVentaOriginal2 = tipoVentaOriginal2; + } + + public Integer getOcdId() { + return ocdId; + } + + public void setOcdId(Integer ocdId) { + this.ocdId = ocdId; + } + +/* private boolean isBoletoOriginal() { + return boletoOriginalId == null + && getMotivoCancelacionOriginal() != null + && getMotivoCancelacionOriginal() == Constantes.MVO_CANCEL_BOLETO_AGRUPAMENTO.intValue(); + }*/ + + public Integer getMotivoCancelacionOriginal() { + return motivoCancelacionOriginal2 != null ? motivoCancelacionOriginal2 : motivoCancelacionOriginal1; + } + + public Integer getMotivoCancelacionOriginal1() { + return motivoCancelacionOriginal1; + } + + public void setMotivoCancelacionOriginal1(Integer motivoCancelacionOriginal1) { + this.motivoCancelacionOriginal1 = motivoCancelacionOriginal1; + } + + public Integer getMotivoCancelacionOriginal2() { + return motivoCancelacionOriginal2; + } + + public void setMotivoCancelacionOriginal2(Integer motivoCancelacionOriginal2) { + this.motivoCancelacionOriginal2 = motivoCancelacionOriginal2; + } + + public boolean isVendaManual(Integer tipoVenta) { + return tipoVenta != null && tipoVenta == Constantes.TPV_MANUAL.intValue(); + } + + public boolean isVendaGap(Integer tipoVenta) { + return tipoVenta != null && (tipoVenta == Constantes.TPV_BOLETO_REMOTO.intValue() + || tipoVenta == Constantes.TPV_CALL_CENTER.intValue() + || tipoVenta == Constantes.TPV_POR_INTERNET.intValue()); + } + + public boolean isVendaBilheteNormal(Integer tipoVenta) { + return tipoVenta != null && tipoVenta == Constantes.TPV_DIRECTO_NORMAL.intValue(); + } + + public boolean isVendaBilheteTroca(Integer tipoVenta) { + return tipoVenta != null && tipoVenta == Constantes.TPV_TRANSFERENCIAS.intValue(); + } + + public boolean isVendaBilheteTransferencia(Integer tipoVenta) { + return tipoVenta != null && tipoVenta == Constantes.TPV_CAMBIO_VIAJE.intValue(); + } + + public boolean isVendaBilheteManual(Integer tipoVenta) { + return tipoVenta != null && tipoVenta == Constantes.TPV_MANUAL.intValue(); + } + + public boolean isVendaBilheteAbertoManual(Integer tipoVenta) { + return tipoVenta != null && tipoVenta == Constantes.TPV_VENDA_BOLETO_ABERTO_MANUAL.intValue(); + } + + public boolean isVendaBilheteAberto(Integer tipoVenta) { + return tipoVenta != null && tipoVenta == Constantes.TPV_BOLETO_ABIERTO.intValue(); + } + + public boolean isVendaBilheteConfirmaAberto(Integer tipoVenta) { + return tipoVenta != null && tipoVenta == Constantes.TPV_CONFIRMA_ABIERTO.intValue(); + } + + public boolean isVendaBilheteCheckin(Integer tipoVenta) { + return tipoVenta != null && tipoVenta == Constantes.TPV_CHECKIN_VIAGEM.intValue(); + } + + public boolean isSemMotivocancelacion() { + return getMotivoCancelacionId() == null; + } + + public boolean isMotivocancelacionAgrupamento() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_BOLETO_AGRUPAMENTO.intValue(); + } + + public boolean isMotivocancelacionCancelado() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_CANCELACION.intValue(); + } + + public boolean isMotivocancelacionDevolvido() { + return !isSemMotivocancelacion() && (getMotivoCancelacionId() == Constantes.MVO_CANCEL_DEVOLUCAO.intValue() + || getMotivoCancelacionId() == Constantes.MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_50.intValue() + || getMotivoCancelacionId() == Constantes.MVO_CANCEL_DEVOLUCAO_CONTIGENCIA_100.intValue()); + } + + public boolean isMotivocancelacionEntregaGap() { + return !isSemMotivocancelacion() + && getMotivoCancelacionId() == Constantes.MVO_CANCEL_BOLETO_ENTREGADO.intValue(); + } + + public boolean isMotivocancelacionTransferido() { + return !isSemMotivocancelacion() + && getMotivoCancelacionId() == Constantes.MVO_CANCEL_TRANSFERENCIA.intValue(); + } + + public boolean isMotivocancelacionTrocado() { + return !isSemMotivocancelacion() + && getMotivoCancelacionId() == Constantes.MVO_CANCEL_TROCA.intValue(); + } + + public boolean isMotivocancelacionCheckin() { + return !isSemMotivocancelacion() + && getMotivoCancelacionId() == Constantes.MVO_CANCEL_CHECKIN.intValue(); + } + + public boolean isMotivocancelacionGeracaoOcd() { + return !isSemMotivocancelacion() + && getMotivoCancelacionId() == Constantes.MVO_CANCEL_GERACAO_OCD.intValue(); + } + + public boolean isMotivocancelacionQuitacaoOcd() { + return !isSemMotivocancelacion() + && getMotivoCancelacionId() == Constantes.MVO_CANCEL_QUITACAO_OCD.intValue(); + } + + /** ABA BILHETE MANUAL */ + public boolean isBilhetesManualVendido() { + return (isVendaBilheteManual(getTipoVenta()) && isStatusVendido() && isSemMotivocancelacion()) || // Venda sem alteracao + (isVendaBilheteManual(getTipoVenta()) && isStatusVendido() && isMotivocancelacionTransferido()); // Venda transferida; + } + + /** ABA BILHETE MANUAL */ + public boolean isBilhetesAbertoManualVendido() { + return (isVendaBilheteAbertoManual(getTipoVenta()) && isStatusVendido() && isSemMotivocancelacion()) || // Venda sem alteracao + (isVendaBilheteAbertoManual(getTipoVenta()) && isStatusVendido() && isMotivocancelacionTransferido()); // Venda transferida; + } + + public boolean isStatusVendido() { + return IndStatusBoleto.V.equals(getIndstatusboletoEnum()); + } + + public boolean isStatusCancelado() { + return IndStatusBoleto.C.equals(getIndstatusboletoEnum()); + } + + public boolean isStatusEntregue() { + return IndStatusBoleto.E.equals(getIndstatusboletoEnum()); + } + + public boolean isStatusTroca() { + return IndStatusBoleto.T.equals(getIndstatusboletoEnum()); + } + + public boolean isStatusExtraviado() { + return IndStatusBoleto.X.equals(getIndstatusboletoEnum()); + } + + public boolean isStatusMarcado() { + return IndStatusBoleto.M.equals(getIndstatusboletoEnum()); + } + + public String getNombpasajero() { + return nombpasajero; + } + + public void setNombpasajero(String nombpasajero) { + this.nombpasajero = nombpasajero; + } + + public boolean isBilheteEntregaConferidoVenda() { + return isStatusEntregue() && this.getLogconferenciaId() != null; + } + + public IndStatusBoleto getIndstatusboletoEnum() { + return IndStatusBoleto.getIndStatusBoleto(getIndstatusboleto()); + } + + public Boolean getIndcarboletosdevolvidosconf() { + return indcarboletosdevolvidosconf; + } + + public void setIndcarboletosdevolvidosconf(Boolean indcarboletosdevolvidosconf) { + this.indcarboletosdevolvidosconf = indcarboletosdevolvidosconf; + } + + public boolean getExigeConferenciaDevolvido() { + return exigeConferenciaDevolvido; + } + + public void setExigeConferenciaDevolvido(boolean exigeConferenciaDevolvido) { + this.exigeConferenciaDevolvido = exigeConferenciaDevolvido; + } + + public boolean isExigeConferenciaAba() { + return exigeConferenciaAba; + } + + public void setExigeConferenciaAba(boolean exigeConferenciaAba) { + this.exigeConferenciaAba = exigeConferenciaAba; + } + + public Date getFeccorrida() { + return feccorrida; + } + + public void setFeccorrida(Date feccorrida) { + this.feccorrida = feccorrida; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public BigDecimal getValorTabela() { + return valorTabela; + } + + public void setValorTabela(BigDecimal valorTabela) { + this.valorTabela = valorTabela; + } + + public String getFeccorridaServico() { + StringBuilder str = new StringBuilder(); + if (getFeccorrida() != null) { + str.append(DateUtil.getStringDate(getFeccorrida(), "dd/MM")); + } + if (getCorridaId() != null) { + if (str.length() > 0) { + str.append(" - "); + } + str.append(getCorridaId()); + } + + return str.toString(); + } + + public boolean isBilheteGap() { + return isAbaGapVendido() || isAbaGapCancelado() || isAbaGapDevolvido(); + } + + public boolean isTotalizarFormapago() { + boolean totalizar = isTotalizarTipovenda(); + if(totalizar) { + totalizar = !isOcd(); + } + if(totalizar) { + totalizar = !getIndreimpresion(); + } + if(totalizar) { + totalizar = !(isStatusTroca() && isVendaBilheteTransferencia(getTipoVenta())); + } + if(totalizar) { + totalizar = !isVendaBilheteConfirmaAberto(getTipoVenta()); + } + return totalizar; + } + + public boolean isTotalizarTipovenda() { + return isAbaBilheteManual() || + isAbaBilheteVendido() || + isAbaBilheteCancelado() || + isAbaBilheteDevolvido() || + isAbaGapVendido() || + isAbaGapCancelado() || + isAbaGapDevolvido(); + } + + public String getOrderExigeConferencia() { + if (isExigeConferenciaAba() || isExigeConferencia() || isExigeConferenciaBoletoDevolvido()) { + if (!isConferido()) { + return "A"; + } else if (isConferido()) { + return "B"; + } + } + return "C"; + } + + public Date getOrderDataMovimento(){ + return conferencia.getDatamovimento(); + } + + /** Define bilhete na aba de venda manual */ + public boolean isAbaBilheteManual() { + return isBilhetesManualVendido() || + isBilhetesAbertoManualVendido(); + } + + /** Define bilhete na aba de venda normal */ + public boolean isAbaBilheteVendido() { + if(isVendaManual(getTipoVenta()) || isVendaBilheteAbertoManual(getTipoVenta())) { + return false; + } + + if(isStatusCancelado()) { + return false; + } + + if(isVendaGap(getTipoVenta()) && !isStatusEntregue()) { + return false; + } + + if(isVendaBilheteTransferencia(getTipoVenta())) { + return false; + } + + return isStatusVendido() || isStatusTroca() || isStatusEntregue(); + } + public boolean isQuitacaoOCD() { + if(getMotivoCancelacionId() != null){ + if(getMotivoCancelacionId() == Constantes.MVO_CANCEL_QUITACAO_OCD.intValue()){ + return true; + } + } + return false; + } + + /** Define bilhete na aba de venda cancelada */ + public boolean isAbaBilheteCancelado() { + if(isVendaManual(getTipoVenta()) && isStatusCancelado()) { + return isMotivocancelacionCancelado(); + } + + + if(isVendaManual(getTipoVenta()) || isVendaBilheteAbertoManual(getTipoVenta())) { + return false; + } + + if(!isStatusCancelado()) { + return false; + } + + if(isVendaGap(getTipoVenta()) && isNotNumFolioPreImpressoGerado()) { + return false; + } + + return isMotivocancelacionCancelado(); + } + + /** Define bilhete na aba de venda devolvida */ + public boolean isAbaBilheteDevolvido() { + + if(isVendaManual(getTipoVenta()) || isVendaBilheteAbertoManual(getTipoVenta())) { + if(isMotivocancelacionDevolvido() || isMotivocancelacionGeracaoOcd() || isMotivocancelacionTrocado()) { + return true; + } + return false; + } + + if(!isStatusCancelado()) { + return false; + } + + if(isVendaGap(getTipoVenta()) && isNotNumFolioPreImpressoGerado()) { + return false; + } + + return isMotivocancelacionDevolvido() || isMotivocancelacionGeracaoOcd() || isMotivocancelacionTrocado(); + } + + /** Define bilhete na aba de gap */ + public boolean isAbaGapVendido() { + if(isStatusCancelado()) { + return false; + } + + if(!isVendaGap(getTipoVenta()) && !isVendaBilheteTransferencia(getTipoVenta())) { + return false; + } + + return (isStatusVendido() || isStatusTroca()) && isNotNumFolioPreImpressoGerado(); + } + + /** Define bilhete na aba de gap cancelada */ + public boolean isAbaGapCancelado() { + if(!isStatusCancelado()) { + return false; + } + + if(!isVendaGap(getTipoVenta())) { + return false; + } + + return isMotivocancelacionCancelado() && isNotNumFolioPreImpressoGerado(); + } + + /** Define bilhete na aba de gap devolvida */ + public boolean isAbaGapDevolvido() { + if(!isStatusCancelado()) { + return false; + } + + if(!isVendaGap(getTipoVenta())) { + return false; + } + + return (isMotivocancelacionDevolvido() || isMotivocancelacionGeracaoOcd() || isMotivocancelacionTrocado()) && isNotNumFolioPreImpressoGerado(); + } + + public BigDecimal getValorPagarOcd() { + return valorPagarOcd; + } + + public void setValorPagarOcd(BigDecimal valorPagarOcd) { + this.valorPagarOcd = valorPagarOcd; + } + + public BigDecimal getValorTarjetaOcd() { + return valorTarjetaOcd; + } + + public void setValorTarjetaOcd(BigDecimal valorTarjetaOcd) { + this.valorTarjetaOcd = valorTarjetaOcd; + } + + public Boolean getIndCancelacion() { + return indCancelacion; + } + + public void setIndCancelacion(Boolean indCancelacion) { + this.indCancelacion = indCancelacion; + } + + public Integer getTipoventaAnteriorId() { + return tipoventaAnteriorId; + } + + public void setTipoventaAnteriorId(Integer tipoventaAnteriorId) { + this.tipoventaAnteriorId = tipoventaAnteriorId; + } + + private boolean isNotNumFolioPreImpressoGerado() { + return StringUtils.isBlank(getNumFolioPreImpreso()); + } + + public Boolean getIndreimpresion() { + return indreimpresion != null ? indreimpresion : false; + } + + public void setIndreimpresion(Boolean indreimpresion) { + this.indreimpresion = indreimpresion; + } + + @Override + public String toString() { + return "BoletoComissao [boletoId=" + boletoId + ", tipoVenta=" + tipoVenta + ", indstatusboleto=" + indstatusboleto + ", motivoCancelacionId=" + motivoCancelacionId + ", descmotivocancelacion=" + descmotivocancelacion + ", tipoVentaOriginal1=" + tipoVentaOriginal1 + ", tipoVentaOriginal2=" + tipoVentaOriginal2 + ", indCancelacion=" + indCancelacion + ", indreimpresion=" + indreimpresion + ", nombpasajero=" + nombpasajero + ", total=" + getTotal() + "]"; + } + + public boolean isNotSomarBilhete() { + if(getIndreimpresion()) { + return true; + } + + return false; + } + + public Long getCajaId() { + return cajaId; + } + + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + + public Long getTransacaoOriginalId() { + return transacaoOriginalId; + } + + public void setTransacaoOriginalId(Long transacaoOriginalId) { + this.transacaoOriginalId = transacaoOriginalId; + } + + public Conferencia getConferencia() { + return conferencia; + } + + public void setConferencia(Conferencia conferencia) { + this.conferencia = conferencia; + } + + public Date getFeccorte() { + return feccorte; + } + + public void setFeccorte(Date feccorte) { + this.feccorte = feccorte; + } + + public BigDecimal getValorbase() { + return valorbase; + } + + public void setValorbase(BigDecimal valorbase) { + this.valorbase = valorbase; + } + + public Long getTransacaoId() { + return transacaoId; + } + + public void setTransacaoId(Long transacaoId) { + this.transacaoId = transacaoId; + } + + public Boolean getConferidoEntrega() { + return conferidoEntrega; + } + + public void setConferidoEntrega(Boolean conferidoEntrega) { + this.conferidoEntrega = conferidoEntrega; + } + + /** + * Retorna TRUE se o motivo de cancelamento for uma geração de OCD e a forma de pagamento for Geração de OCD + * @return + */ + public boolean isDiferencaTrocaGeracaoOcd() { + return isMotivocancelacionGeracaoOcd() && + getFormapagoId() != null && getFormapagoId() == Constantes.FORMA_PAGO_GERACAO_OCD.intValue(); + } + + public Integer getPtovtaventaId() { + return ptovtaventaId; + } + + public void setPtovtaventaId(Integer ptovtaventaId) { + this.ptovtaventaId = ptovtaventaId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getTurnoId() { + return turnoId; + } + + public void setTurnoId(Integer turnoId) { + this.turnoId = turnoId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoDesconto.java b/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoDesconto.java new file mode 100644 index 000000000..7007d87ae --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoDesconto.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; + +public class ComissaoDesconto { + + public enum TipoDesconto { + FIXO, EVENTUAL; + } + + private String nomeDesconto; + private BigDecimal valorDesconto; + private TipoDesconto tipo; + private String tipoDesconto; + + public String getNomeDesconto() { + return nomeDesconto; + } + + public void setNomeDesconto(String nomeDesconto) { + this.nomeDesconto = nomeDesconto; + } + + public BigDecimal getValorDesconto() { + return valorDesconto; + } + + public void setValorDesconto(BigDecimal valorDesconto) { + this.valorDesconto = valorDesconto; + } + + public String getTipoDesconto() { + if(this.tipo != null) + return tipo.toString(); + + return tipoDesconto; + } + + public void setTipoDesconto(String tipoDesconto) { + this.tipoDesconto = tipoDesconto; + } + + public TipoDesconto getTipo() { + return tipo; + } + + public void setTipo(TipoDesconto tipo) { + this.tipo = tipo; + } + + @Override + public String toString() { + return "RegistroCalculoDesconto [nomeDesconto=" + nomeDesconto + ", valorDesconto=" + valorDesconto + ", tipoDesconto=" + tipoDesconto + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoLogVO.java b/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoLogVO.java new file mode 100644 index 000000000..4928d3d1b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoLogVO.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.Date; + +public class ComissaoLogVO { + + private Integer puntoventaId; + private Integer empresaId; + private Date feccorte; + private Integer usuarioId; + private Integer turnoId; + private Long cajaId; + private Long cajadiversosId; + private BigDecimal porcComissao; + private BigDecimal valorBase; + private BigDecimal valorComissao; + private String origem; + private String texto; + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public Date getFeccorte() { + return feccorte; + } + + public void setFeccorte(Date feccorte) { + this.feccorte = feccorte; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getTurnoId() { + return turnoId; + } + + public void setTurnoId(Integer turnoId) { + this.turnoId = turnoId; + } + + public Long getCajaId() { + return cajaId; + } + + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + + public Long getCajadiversosId() { + return cajadiversosId; + } + + public void setCajadiversosId(Long cajadiversosId) { + this.cajadiversosId = cajadiversosId; + } + + public BigDecimal getPorcComissao() { + return porcComissao; + } + + public void setPorcComissao(BigDecimal porcComissao) { + this.porcComissao = porcComissao; + } + + public BigDecimal getValorBase() { + return valorBase; + } + + public void setValorBase(BigDecimal valorBase) { + this.valorBase = valorBase; + } + + public BigDecimal getValorComissao() { + return valorComissao; + } + + public void setValorComissao(BigDecimal valorComissao) { + this.valorComissao = valorComissao; + } + + public String getOrigem() { + return origem; + } + + public void setOrigem(String origem) { + this.origem = origem; + } + + public String getTexto() { + return texto; + } + + public void setTexto(String texto) { + this.texto = texto; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoReceita.java b/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoReceita.java new file mode 100644 index 000000000..5755d6dc8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/ComissaoReceita.java @@ -0,0 +1,326 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +public class ComissaoReceita { + + private Date data; + private BigDecimal receitaComissao; + private BigDecimal receitaBPR; + private BigDecimal receitaGAP; + private BigDecimal gapImpressa; + private BigDecimal internet; + private BigDecimal cancelados; + private BigDecimal canceladosGAP; + private BigDecimal devolvidos; + private BigDecimal devolvidosGAP; + private BigDecimal devolucoesOrigem; + private BigDecimal devolucoesOrigemGAP; + private BigDecimal receitaExcessoBagagem; + private BigDecimal receitaSeguro; + private BigDecimal receitaSeguroOpcional; + private BigDecimal receitaSeguroOutros; + private Integer contImpressa; + + private BigDecimal comissaoBPRDiaria; + private BigDecimal comissaoExcessoBagagemDiaria; + private BigDecimal comissaoSegOpcionalDiaria; + private BigDecimal comissaoEntregaPassagemDiaria; + private BigDecimal comissaoOutrosDiaria; + private BigDecimal comissaoSeguroObrigatorioDiaria; + + private String nombpuntoventa; + private String numPuntoVenta; + + private List lsComissaoLog; + + public ComissaoReceita() { + super(); + this.receitaComissao = BigDecimal.ZERO; + this.receitaBPR = BigDecimal.ZERO; + this.receitaGAP = BigDecimal.ZERO; + this.gapImpressa = BigDecimal.ZERO; + this.internet = BigDecimal.ZERO; + this.cancelados = BigDecimal.ZERO; + this.canceladosGAP = BigDecimal.ZERO; + this.devolvidos = BigDecimal.ZERO; + this.devolvidosGAP = BigDecimal.ZERO; + this.devolucoesOrigem = BigDecimal.ZERO; + this.devolucoesOrigemGAP = BigDecimal.ZERO; + this.receitaExcessoBagagem = BigDecimal.ZERO; + this.receitaSeguro = BigDecimal.ZERO; + this.receitaSeguroOpcional = BigDecimal.ZERO; + this.receitaSeguroOutros = BigDecimal.ZERO; + this.contImpressa = 0; + this.comissaoBPRDiaria = BigDecimal.ZERO; + this.comissaoExcessoBagagemDiaria = BigDecimal.ZERO; + this.comissaoSegOpcionalDiaria = BigDecimal.ZERO; + this.comissaoEntregaPassagemDiaria = BigDecimal.ZERO; + this.comissaoOutrosDiaria = BigDecimal.ZERO; + this.comissaoSeguroObrigatorioDiaria = BigDecimal.ZERO; + this.lsComissaoLog = new ArrayList(); + } + + public Date getData() { + return data; + } + + public void setData(Date data) { + this.data = data; + } + + public BigDecimal getReceitaComissao() { + return receitaComissao; + } + + public void setReceitaComissao(BigDecimal receitaComissao) { + this.receitaComissao = receitaComissao; + } + + public BigDecimal getReceitaBPR() { + return receitaBPR; + } + + public void setReceitaBPR(BigDecimal receitaBPR) { + this.receitaBPR = receitaBPR; + } + + public BigDecimal getReceitaGAP() { + return receitaGAP; + } + + public void setReceitaGAP(BigDecimal receitaGAP) { + this.receitaGAP = receitaGAP; + } + + public BigDecimal getGapImpressa() { + return gapImpressa; + } + + public void setGapImpressa(BigDecimal gapImpressa) { + this.gapImpressa = gapImpressa; + } + + public BigDecimal getInternet() { + return internet; + } + + public void setInternet(BigDecimal internet) { + this.internet = internet; + } + + public BigDecimal getCancelados() { + return cancelados; + } + + public void setCancelados(BigDecimal cancelados) { + this.cancelados = cancelados; + } + + public BigDecimal getCanceladosGAP() { + return canceladosGAP; + } + + public void setCanceladosGAP(BigDecimal canceladosGAP) { + this.canceladosGAP = canceladosGAP; + } + + public BigDecimal getDevolvidos() { + return devolvidos; + } + + public void setDevolvidos(BigDecimal devolvidos) { + this.devolvidos = devolvidos; + } + + public BigDecimal getDevolvidosRelatorio() { + return getDevolvidos(); + } + + public BigDecimal getDevolvidosGAPRelatorio() { + return getDevolvidosGAP(); + } + + public BigDecimal getDevolvidosGAP() { + return devolvidosGAP; + } + + public void setDevolvidosGAP(BigDecimal devolvidosGAP) { + this.devolvidosGAP = devolvidosGAP; + } + + public BigDecimal getDevolucoesOrigem() { + return devolucoesOrigem; + } + + public void setDevolucoesOrigem(BigDecimal devolucoesOrigem) { + this.devolucoesOrigem = devolucoesOrigem; + } + + public BigDecimal getDevolucoesOrigemGAP() { + return devolucoesOrigemGAP; + } + + public void setDevolucoesOrigemGAP(BigDecimal devolucoesOrigemGAP) { + this.devolucoesOrigemGAP = devolucoesOrigemGAP; + } + + public BigDecimal getReceitaExcessoBagagem() { + return receitaExcessoBagagem; + } + + public void setReceitaExcessoBagagem(BigDecimal receitaExcessoBagagem) { + this.receitaExcessoBagagem = receitaExcessoBagagem; + } + + public BigDecimal getReceitaSeguroOpcional() { + return receitaSeguroOpcional; + } + + public void setReceitaSeguroOpcional(BigDecimal receitaSeguroOpcional) { + this.receitaSeguroOpcional = receitaSeguroOpcional; + } + + public Integer getContImpressa() { + return contImpressa; + } + + public void setContImpressa(Integer contImpressa) { + this.contImpressa = contImpressa; + } + + public BigDecimal getComissaoBPRDiaria() { + return comissaoBPRDiaria; + } + + public void setComissaoBPRDiaria(BigDecimal comissaoBPRDiaria) { + this.comissaoBPRDiaria = comissaoBPRDiaria; + } + + public BigDecimal getComissaoExcessoBagagemDiaria() { + return comissaoExcessoBagagemDiaria; + } + + public void setComissaoExcessoBagagemDiaria(BigDecimal comissaoExcessoBagagemDiaria) { + this.comissaoExcessoBagagemDiaria = comissaoExcessoBagagemDiaria; + } + + public BigDecimal getComissaoSegOpcionalDiaria() { + return comissaoSegOpcionalDiaria; + } + + public void setComissaoSegOpcionalDiaria(BigDecimal comissaoSegOpcionalDiaria) { + this.comissaoSegOpcionalDiaria = comissaoSegOpcionalDiaria; + } + + public BigDecimal getComissaoEntregaPassagemDiaria() { + return comissaoEntregaPassagemDiaria; + } + + public void setComissaoEntregaPassagemDiaria(BigDecimal comissaoEntregaPassagemDiaria) { + this.comissaoEntregaPassagemDiaria = comissaoEntregaPassagemDiaria; + } + + public BigDecimal getReceitaSeguroOutros() { + return receitaSeguroOutros; + } + + public void setReceitaSeguroOutros(BigDecimal receitaSeguroOutros) { + this.receitaSeguroOutros = receitaSeguroOutros; + } + + public BigDecimal getComissaoOutrosDiaria() { + return comissaoOutrosDiaria; + } + + public void setComissaoOutrosDiaria(BigDecimal comissaoOutrosDiaria) { + this.comissaoOutrosDiaria = comissaoOutrosDiaria; + } + + @Override + public String toString() { + return "ComissaoReceita [data=" + data + ", receitaComissao=" + receitaComissao + ", receitaBPR=" + receitaBPR + ", receitaGAP=" + receitaGAP + ", gapImpressa=" + gapImpressa + ", internet=" + internet + ", cancelados=" + cancelados + ", canceladosGAP=" + canceladosGAP + ", devolvidos=" + devolvidos + ", devolvidosGAP=" + devolvidosGAP + ", devolucoesOrigem=" + devolucoesOrigem + ", devolucoesOrigemGAP=" + devolucoesOrigemGAP + ", receitaExcessoBagagem=" + receitaExcessoBagagem + ", receitaSeguroOpcional=" + receitaSeguroOpcional + ", contImpressa=" + contImpressa + ", comissaoBPRDiaria=" + comissaoBPRDiaria + ", comissaoExcessoBagagemDiaria=" + comissaoExcessoBagagemDiaria + ", comissaoSegOpcionalDiaria=" + comissaoSegOpcionalDiaria + ", comissaoEntregaPassagemDiaria=" + comissaoEntregaPassagemDiaria + "]"; + } + + public BigDecimal getTotal() { + BigDecimal total = BigDecimal.ZERO; + total = total.add(getReceitaBPR() != null ? getReceitaBPR() : BigDecimal.ZERO) + .add(getReceitaGAP() != null ? getReceitaGAP() : BigDecimal.ZERO) + .add(getInternet() != null ? getInternet() : BigDecimal.ZERO) + .subtract(getDevolvidos() != null ? getDevolvidos() : BigDecimal.ZERO) + .subtract(getDevolvidosGAP() != null ? getDevolvidosGAP() : BigDecimal.ZERO) + .subtract(getCancelados() != null ? getCancelados() : BigDecimal.ZERO) + .subtract(getCanceladosGAP() != null ? getCanceladosGAP() : BigDecimal.ZERO); + return total; + } + + public BigDecimal getTotalComissao() { + BigDecimal totalComissao = BigDecimal.ZERO; + totalComissao = totalComissao.add(getComissaoBPRDiaria() != null ? getComissaoBPRDiaria() : BigDecimal.ZERO) + .add(getComissaoEntregaPassagemDiaria() != null ? getComissaoEntregaPassagemDiaria() : BigDecimal.ZERO) + .add(getComissaoExcessoBagagemDiaria() != null ? getComissaoExcessoBagagemDiaria() : BigDecimal.ZERO) + .add(getComissaoOutrosDiaria() != null ? getComissaoOutrosDiaria() : BigDecimal.ZERO) + .add(getComissaoSeguroObrigatorioDiaria() != null ? getComissaoSeguroObrigatorioDiaria() : BigDecimal.ZERO) + .add(getComissaoSegOpcionalDiaria() != null ? getComissaoSegOpcionalDiaria() : BigDecimal.ZERO); + return totalComissao; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + + public String getDescricaoPuntoVenta() { + StringBuilder str = new StringBuilder(); + + if(StringUtils.isNotBlank(nombpuntoventa)) { + if(str.length() > 0) { + str.append(" - "); + } + str.append(nombpuntoventa); + } + + return str.toString(); + } + + public BigDecimal getComissaoSeguroObrigatorioDiaria() { + return comissaoSeguroObrigatorioDiaria; + } + + public void setComissaoSeguroObrigatorioDiaria(BigDecimal comissaoSeguroObrigatorioDiaria) { + this.comissaoSeguroObrigatorioDiaria = comissaoSeguroObrigatorioDiaria; + } + + public BigDecimal getReceitaSeguro() { + return receitaSeguro; + } + + public void setReceitaSeguro(BigDecimal receitaSeguro) { + this.receitaSeguro = receitaSeguro; + } + + public List getLsComissaoLog() { + return lsComissaoLog; + } + + public void setLsComissaoLog(List lsComissaoLog) { + this.lsComissaoLog = lsComissaoLog; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/ConferenciaComissaoVO.java b/src/com/rjconsultores/ventaboletos/vo/comissao/ConferenciaComissaoVO.java new file mode 100644 index 000000000..e0fb7441f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/ConferenciaComissaoVO.java @@ -0,0 +1,147 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +public class ConferenciaComissaoVO implements Comparable { + + private Integer puntoventaId; + private String nombpuntoventa; + private String numPuntoVenta; + private String competencia; + private Date datamovimento; + private Date dataInicial; + private Date dataFinal; + + private Set diasSemMovimentos = new TreeSet(); + + private List dias = new ArrayList(); + + public ConferenciaComissaoVO() { + super(); + } + + public ConferenciaComissaoVO(Integer puntoventaId, String competencia) { + this(); + this.puntoventaId = puntoventaId; + this.competencia = competencia; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + + public List getDias() { + return dias; + } + + public void setDias(List dias) { + this.dias = dias; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public String getCompetencia() { + return competencia; + } + + public void setCompetencia(String competencia) { + this.competencia = competencia; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((competencia == null) ? 0 : competencia.hashCode()); + result = prime * result + ((puntoventaId == null) ? 0 : puntoventaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + ConferenciaComissaoVO other = (ConferenciaComissaoVO) obj; + if (competencia == null) { + if (other.competencia != null) + return false; + } else if (!competencia.equals(other.competencia)) + return false; + if (puntoventaId == null) { + if (other.puntoventaId != null) + return false; + } else if (!puntoventaId.equals(other.puntoventaId)) + return false; + return true; + } + + public Set getDiasSemMovimentos() { + return diasSemMovimentos; + } + + public void setDiasSemMovimentos(Set diasSemMovimentos) { + this.diasSemMovimentos = diasSemMovimentos; + } + + public List getDiasOrdenado() { + if(getDias() != null){ + Collections.sort(getDias()); + } + return getDias(); + } + + @Override + public int compareTo(ConferenciaComissaoVO o) { + return this.getNombpuntoventa().compareToIgnoreCase(o.getNombpuntoventa()); + } + + public Date getDataMovimento() { + return datamovimento; + } + + public void setDataMovimento(Date datamovimento) { + this.datamovimento = datamovimento; + } + + public Date getDataInicial() { + return dataInicial; + } + + public void setDataInicial(Date dataInicial) { + this.dataInicial = dataInicial; + } + + public Date getDataFinal() { + return dataFinal; + } + + public void setDataFinal(Date dataFinal) { + this.dataFinal = dataFinal; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/DiaConferenciaComissaoVO.java b/src/com/rjconsultores/ventaboletos/vo/comissao/DiaConferenciaComissaoVO.java new file mode 100644 index 000000000..704e37c16 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/DiaConferenciaComissaoVO.java @@ -0,0 +1,156 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.util.Date; + +import com.rjconsultores.ventaboletos.enums.comissao.CoresConferencia; + +public class DiaConferenciaComissaoVO implements Comparable { + + private Integer dia; + private Date data; + private Long conferenciaId; + + private Boolean indboletogerado; + private Boolean indconferido; + private Boolean indpendencia; + private Boolean indsemmovimento; + private Boolean indmaloterecebido; + + public DiaConferenciaComissaoVO() { + super(); + this.indboletogerado = Boolean.FALSE; + this.indconferido = Boolean.FALSE; + this.indpendencia = Boolean.FALSE; + this.indsemmovimento = Boolean.FALSE; + this.indmaloterecebido = Boolean.FALSE; + } + + public DiaConferenciaComissaoVO(Integer dia) { + this(); + this.dia = dia; + } + + public Integer getDia() { + return dia; + } + + public void setDia(Integer dia) { + this.dia = dia; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((dia == null) ? 0 : dia.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + DiaConferenciaComissaoVO other = (DiaConferenciaComissaoVO) obj; + if (dia == null) { + if (other.dia != null) + return false; + } else if (!dia.equals(other.dia)) + return false; + return true; + } + + @Override + public int compareTo(DiaConferenciaComissaoVO o) { + return this.getDia().compareTo(o.getDia()); + } + + public CoresConferencia getCor() { + CoresConferencia cor = CoresConferencia.BRANCO; + + if (getIndsemmovimento() != null && getIndsemmovimento()) { + cor = CoresConferencia.BRANCO; + } + + if ((getIndsemmovimento() == null || !getIndsemmovimento()) && (getIndmaloterecebido() == null || !getIndmaloterecebido())) { + cor = CoresConferencia.PRETO; + } + + if (getIndmaloterecebido() != null && getIndmaloterecebido()) { + if (getIndconferido() == null || !getIndconferido()) { + cor = CoresConferencia.VERMELHO; + } + } + + if (getIndconferido() != null && getIndconferido()) { + if (getIndboletogerado() != null && getIndboletogerado()) { + cor = CoresConferencia.AZUL; + if (getIndpendencia() != null && getIndpendencia()) { + cor = CoresConferencia.AMARELO; + } + } else if (getIndboletogerado() == null || !getIndboletogerado()) { + cor = CoresConferencia.LARANJA; + } + } + + return cor; + } + + public Boolean getIndboletogerado() { + return indboletogerado; + } + + public void setIndboletogerado(Boolean indboletogerado) { + this.indboletogerado = indboletogerado; + } + + public Boolean getIndconferido() { + return indconferido; + } + + public void setIndconferido(Boolean indconferido) { + this.indconferido = indconferido; + } + + public Boolean getIndpendencia() { + return indpendencia; + } + + public void setIndpendencia(Boolean indpendencia) { + this.indpendencia = indpendencia; + } + + public Boolean getIndsemmovimento() { + return indsemmovimento; + } + + public void setIndsemmovimento(Boolean indsemmovimento) { + this.indsemmovimento = indsemmovimento; + } + + public Boolean getIndmaloterecebido() { + return indmaloterecebido; + } + + public void setIndmaloterecebido(Boolean indmaloterecebido) { + this.indmaloterecebido = indmaloterecebido; + } + + public Long getConferenciaId() { + return conferenciaId; + } + + public void setConferenciaId(Long conferenciaId) { + this.conferenciaId = conferenciaId; + } + + public Date getData() { + return data; + } + + public void setData(Date data) { + this.data = data; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/EmailConfigVO.java b/src/com/rjconsultores/ventaboletos/vo/comissao/EmailConfigVO.java new file mode 100644 index 000000000..771d77925 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/EmailConfigVO.java @@ -0,0 +1,69 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +public class EmailConfigVO { + + private String smtp; + private String senha; + private String smtpPorta; + private String smtpEmail; + private String smtpUser; + private boolean autenticacao; + private String tipoAutorizacao; + + public String getSmtp() { + return smtp; + } + + public void setSmtp(String smtp) { + this.smtp = smtp; + } + + public String getSenha() { + return senha; + } + + public void setSenha(String senha) { + this.senha = senha; + } + + public String getSmtpPorta() { + return smtpPorta; + } + + public void setSmtpPorta(String smtpPorta) { + this.smtpPorta = smtpPorta; + } + + public String getSmtpEmail() { + return smtpEmail; + } + + public void setSmtpEmail(String smtpEmail) { + this.smtpEmail = smtpEmail; + } + + public boolean isAutenticacao() { + return autenticacao; + } + + public void setAutenticacao(boolean autenticacao) { + this.autenticacao = autenticacao; + } + + public String getSmtpUser() { + return smtpUser; + } + + public void setSmtpUser(String smtpUser) { + this.smtpUser = smtpUser; + } + + public String getTipoAutorizacao() { + return tipoAutorizacao; + } + + public void setTipoAutorizacao(String tipoAutorizacao) { + this.tipoAutorizacao = tipoAutorizacao; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/EtiquetaMalote.java b/src/com/rjconsultores/ventaboletos/vo/comissao/EtiquetaMalote.java new file mode 100644 index 000000000..3a9c620aa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/EtiquetaMalote.java @@ -0,0 +1,78 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.util.Date; + +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +public class EtiquetaMalote { + + private Integer empresaId; + private String nombempresa; + private Integer puntoventaId; + private String nombpuntoventa; + + private String numeroMalote; + private Date dataInicial; + private Date dataFinal; + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getNumeroMalote() { + return numeroMalote; + } + + public void setNumeroMalote(String numeroMalote) { + this.numeroMalote = numeroMalote; + } + + public Date getDataInicial() { + return dataInicial; + } + + public void setDataInicial(Date dataInicial) { + this.dataInicial = dataInicial; + } + + public Date getDataFinal() { + return dataFinal; + } + + public void setDataFinal(Date dataFinal) { + this.dataFinal = dataFinal; + } + + public String getDatasMalote() { + return DateUtil.getStringDate(getDataInicial(), "dd/MM/yyyy") + " - " + DateUtil.getStringDate(getDataFinal(), "dd/MM/yyyy"); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/EventosFinanceirosVO.java b/src/com/rjconsultores/ventaboletos/vo/comissao/EventosFinanceirosVO.java new file mode 100644 index 000000000..77c314a5d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/EventosFinanceirosVO.java @@ -0,0 +1,369 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.Date; + +import org.apache.commons.lang.StringUtils; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; + +public class EventosFinanceirosVO { + + private Long eventoextraId; + private String numdocumento; + private Date fechoringreso; + private BigDecimal impingreso; + private String desctipoevento; + private String descinfo; + private Integer status; + private Integer formapagoId; + private String descpago; + private Boolean indconferenciafisicacomissao; + private String indtipo; /* 0- Debito, 1- Credito */ + private String nombusuario; + + private Integer comemptipoeventoextraId; + private Integer tipoeventoextradebcred; + private Integer comempformapagoId; + + private Long logconferenciaId; + private boolean conferido; + + private Boolean exigeConferenciaAba; + + private Long boletoId; + + private String numFolioSistema; + + private Conferencia conferencia; + + private String cvetipoevento; + + private Date feccorte; + + private BigDecimal icmsBase; + private Integer estadoId; + + private Long cajaDiversosId; + private Integer usuarioId; + private Integer turnoId; + + public EventosFinanceirosVO(Long eventoextraId, Long logconferenciaId) { + this.eventoextraId = eventoextraId; + this.logconferenciaId = logconferenciaId; + } + + public EventosFinanceirosVO() { + + } + + public Long getEventoextraId() { + return eventoextraId; + } + + public void setEventoextraId(Long eventoextraId) { + this.eventoextraId = eventoextraId; + } + + public String getNumdocumento() { + return numdocumento; + } + + public void setNumdocumento(String numdocumento) { + this.numdocumento = numdocumento; + } + + public Date getFechoringreso() { + return fechoringreso; + } + + public void setFechoringreso(Date fechoringreso) { + this.fechoringreso = fechoringreso; + } + + public BigDecimal getImpingreso() { + return impingreso; + } + + public void setImpingreso(BigDecimal impingreso) { + this.impingreso = impingreso; + } + + public String getDesctipoevento() { + return desctipoevento; + } + + public void setDesctipoevento(String desctipoevento) { + this.desctipoevento = desctipoevento; + } + + public String getDescinfo() { + return descinfo; + } + + public void setDescinfo(String descinfo) { + this.descinfo = descinfo; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getStatusDescricao() { + StatusLogConferencia statusLogConferencia = StatusLogConferencia.getStatusLogConferencia(status); + if (statusLogConferencia != null) { + return statusLogConferencia.toString(); + } + return ""; + } + + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public String getDescpago() { + return descpago; + } + + public void setDescpago(String descpago) { + this.descpago = descpago; + } + + public Boolean getIndconferenciafisicacomissao() { + return indconferenciafisicacomissao; + } + + public void setIndconferenciafisicacomissao(Boolean indconferenciafisicacomissao) { + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + } + + public String getIndtipo() { + return indtipo; + } + + public void setIndtipo(String indtipo) { + this.indtipo = indtipo; + } + + public boolean isCredito() { + return StringUtils.isNotBlank(getIndtipo()) && "1".equals(getIndtipo()); + } + + public boolean isDebito() { + return StringUtils.isNotBlank(getIndtipo()) && "0".equals(getIndtipo()); + } + + public String getDebitoCredito() { + return isCredito() ? Labels.getLabel("conferenciaController.lbCredito.value") : Labels.getLabel("conferenciaController.lbDebito.value"); + } + + public String getNombusuario() { + return nombusuario; + } + + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + + public Long getLogconferenciaId() { + return logconferenciaId; + } + + public void setLogconferenciaId(Long logconferenciaId) { + this.logconferenciaId = logconferenciaId; + } + + public boolean isConferido() { + return conferido; + } + + public void setConferido(boolean conferido) { + this.conferido = conferido; + } + + public Integer getComemptipoeventoextraId() { + return comemptipoeventoextraId; + } + + public void setComemptipoeventoextraId(Integer comemptipoeventoextraId) { + this.comemptipoeventoextraId = comemptipoeventoextraId; + } + + public Integer getTipoeventoextradebcred() { + return tipoeventoextradebcred; + } + + public void setTipoeventoextradebcred(Integer tipoeventoextradebcred) { + this.tipoeventoextradebcred = tipoeventoextradebcred; + } + + public Integer getComempformapagoId() { + return comempformapagoId; + } + + public void setComempformapagoId(Integer comempformapagoId) { + this.comempformapagoId = comempformapagoId; + } + + public boolean isExigeConferencia() { + return getComemptipoeventoextraId() != null || getComempformapagoId() != null || isExigeConferenciaTipoEvento(); + } + + public boolean isExigeConferenciaTipoEvento() { + if(getTipoeventoextradebcred() != null && getTipoeventoextradebcred() != 0) { + if(getTipoeventoextradebcred() == 1){ + return true; + }else if(isDebito() && getTipoeventoextradebcred() == 2){ + return true; + }else if(isCredito() && getTipoeventoextradebcred() == 3){ + return true; + } + } + return false; + } + + public Boolean getExigeConferenciaAba() { + return exigeConferenciaAba; + } + + public void setExigeConferenciaAba(Boolean exigeConferenciaAba) { + this.exigeConferenciaAba = exigeConferenciaAba; + } + + public String getOrderExigeConferencia() { + if ((getExigeConferenciaAba() != null && getExigeConferenciaAba()) || isExigeConferencia()) { + if (!isConferido()) { + return "A"; + } else if (isConferido()) { + return "B"; + } + } + return "C"; + } + + public Date getOrderDataMovimento(){ + return conferencia.getDatamovimento(); + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public String getNumFolioSistema() { + return numFolioSistema; + } + + public void setNumFolioSistema(String numFolioSistema) { + this.numFolioSistema = numFolioSistema; + } + + public Conferencia getConferencia() { + return conferencia; + } + + public void setConferencia(Conferencia conferencia) { + this.conferencia = conferencia; + } + + public String getCvetipoevento() { + return cvetipoevento; + } + + public void setCvetipoevento(String cvetipoevento) { + this.cvetipoevento = cvetipoevento; + } + + public Date getFeccorte() { + return feccorte; + } + + public void setFeccorte(Date feccorte) { + this.feccorte = feccorte; + } + + public BigDecimal getIcmsBase() { + return icmsBase; + } + + public void setIcmsBase(BigDecimal icmsBase) { + this.icmsBase = icmsBase; + } + + public Integer getEstadoId() { + return estadoId; + } + + public void setEstadoId(Integer estadoId) { + this.estadoId = estadoId; + } + + public Long getCajaDiversosId() { + return cajaDiversosId; + } + + public void setCajaDiversosId(Long cajaDiversosId) { + this.cajaDiversosId = cajaDiversosId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getTurnoId() { + return turnoId; + } + + public void setTurnoId(Integer turnoId) { + this.turnoId = turnoId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((eventoextraId == null) ? 0 : eventoextraId.hashCode()); + result = prime * result + ((logconferenciaId == null) ? 0 : logconferenciaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + EventosFinanceirosVO other = (EventosFinanceirosVO) obj; + if (eventoextraId == null) { + if (other.eventoextraId != null) + return false; + } else if (!eventoextraId.equals(other.eventoextraId)) + return false; + if (logconferenciaId == null) { + if (other.logconferenciaId != null) + return false; + } else if (!logconferenciaId.equals(other.logconferenciaId)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/FormapagoVO.java b/src/com/rjconsultores/ventaboletos/vo/comissao/FormapagoVO.java new file mode 100644 index 000000000..89275355f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/FormapagoVO.java @@ -0,0 +1,100 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; + +import com.rjconsultores.ventaboletos.utilerias.BigDecimalUtil; +import com.rjconsultores.ventaboletos.utilerias.LocaleUtil; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; + +public class FormapagoVO { + + private Integer formapagoId; + private String descpago; + private Boolean indconferenciafisicacomissao; + private BigDecimal importe; + + public FormapagoVO() { + super(); + } + + public FormapagoVO(Integer formapagoId) { + super(); + this.formapagoId = formapagoId; + } + + public FormapagoVO(Integer formapagoId, String descpago, Boolean indconferenciafisicacomissao, BigDecimal importeFp) { + this(); + this.formapagoId = formapagoId; + this.descpago = descpago; + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + this.importe = importeFp; + } + + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public String getDescpago() { + return descpago; + } + + public void setDescpago(String descpago) { + this.descpago = descpago; + } + + public Boolean getIndconferenciafisicacomissao() { + return indconferenciafisicacomissao; + } + + public void setIndconferenciafisicacomissao(Boolean indconferenciafisicacomissao) { + this.indconferenciafisicacomissao = indconferenciafisicacomissao; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((formapagoId == null) ? 0 : formapagoId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + FormapagoVO other = (FormapagoVO) obj; + if (formapagoId == null) { + if (other.formapagoId != null) + return false; + } else if (!formapagoId.equals(other.formapagoId)) + return false; + return true; + } + + public String getImporteFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getImporte(), LocaleUtil.getLocale()); + } + + public void add(BigDecimal importe) { + this.importe = MoneyHelper.somar(this.importe, (importe != null ? importe : BigDecimal.ZERO)); + } + + public void subtract(BigDecimal importe) { + this.importe = MoneyHelper.subtrair(this.importe,(importe != null ? importe : BigDecimal.ZERO)); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/HistoricoComissao.java b/src/com/rjconsultores/ventaboletos/vo/comissao/HistoricoComissao.java new file mode 100644 index 000000000..32ef71748 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/HistoricoComissao.java @@ -0,0 +1,331 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.text.NumberFormat; +import java.text.ParseException; + +import org.apache.commons.lang.StringUtils; +import org.brazilutils.text.RealToWords; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.entidad.Comissao; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.DocumentosUtil; +import com.rjconsultores.ventaboletos.utilerias.LocaleUtil; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; + +public class HistoricoComissao extends Comissao { + + private static final Logger log = LoggerFactory.getLogger(HistoricoComissao.class); + + private static final long serialVersionUID = 1L; + + private static final NumberFormat NF = NumberFormat.getCurrencyInstance(LocaleUtil.getLocale()); + + private String pagamento; + private String usuarioPagamento; + private String usuarioLancamento; + private String nombpuntoventa; + private String numpuntoventa; + private String sigla; + private String nome; + private String banco; + private String conta; + private String agencia; + private String cidade; + private String nombempresa; + private String cnpj; + private String descCorreo; + private String razonsocial; + private String cnpjPuntoventa; + + public HistoricoComissao() { + super(); + setComissaoBpr(BigDecimal.ZERO); + setReceitaExcessobagagem(BigDecimal.ZERO); + setReceitaSeguroopcional(BigDecimal.ZERO); + setReceitaSeguro(BigDecimal.ZERO); + setReceitaOutros(BigDecimal.ZERO); + setDescontosFixos(BigDecimal.ZERO); + setDescontosEventuais(BigDecimal.ZERO); + setRoyaties(BigDecimal.ZERO); + setIssRetido(BigDecimal.ZERO); + setBonificacaoMetas(BigDecimal.ZERO); + setEntregasPassagem(BigDecimal.ZERO); + setReceitaBPR(BigDecimal.ZERO); + setDevolvidos(BigDecimal.ZERO); + setReceitaGAP(BigDecimal.ZERO); + } + + public String getPagamento() { + return pagamento; + } + + public void setPagamento(String pagamento) { + this.pagamento = pagamento; + } + + public String getUsuarioPagamento() { + return usuarioPagamento; + } + + public void setUsuarioPagamento(String usuarioPagamento) { + this.usuarioPagamento = usuarioPagamento; + } + + public String getUsuarioLancamento() { + return usuarioLancamento; + } + + public void setUsuarioLancamento(String usuarioLancamento) { + this.usuarioLancamento = usuarioLancamento; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getNumpuntoventa() { + return numpuntoventa; + } + + public void setNumpuntoventa(String numpuntoventa) { + this.numpuntoventa = numpuntoventa; + } + + public BigDecimal getTotal() { + BigDecimal total = MoneyHelper.somar((getComissaoBpr() != null ? getComissaoBpr() : BigDecimal.ZERO), + (getReceitaExcessobagagem() != null ? getReceitaExcessobagagem() : BigDecimal.ZERO), + (getReceitaSeguroopcional() != null ? getReceitaSeguroopcional() : BigDecimal.ZERO), + (getReceitaSeguro() != null ? getReceitaSeguro() : BigDecimal.ZERO), + (getReceitaOutros() != null ? getReceitaOutros() : BigDecimal.ZERO), + (getBonificacaoMetas() != null ? getBonificacaoMetas() : BigDecimal.ZERO), + (getEntregasPassagem() != null ? getEntregasPassagem() : BigDecimal.ZERO)); + + return MoneyHelper.arredondar(total, 2); + } + + public BigDecimal getTotalLiquido() { + BigDecimal totalLiquido = getTotal(); + totalLiquido = MoneyHelper.subtrair(totalLiquido, getDescontosEventuais() != null ? getDescontosEventuais() : BigDecimal.ZERO); + totalLiquido = MoneyHelper.subtrair(totalLiquido, getDescontosFixos() != null ? getDescontosFixos() : BigDecimal.ZERO); + totalLiquido = MoneyHelper.subtrair(totalLiquido, getIssRetido() != null ? getIssRetido() : BigDecimal.ZERO); + totalLiquido = MoneyHelper.subtrair(totalLiquido, getRoyaties() != null ? getRoyaties() : BigDecimal.ZERO); + + return MoneyHelper.arredondar(totalLiquido, 2); + } + + public BigDecimal getReceitaBaseComissao() { + BigDecimal receitaBaseComissao = BigDecimal.ZERO; + receitaBaseComissao = MoneyHelper.somar(receitaBaseComissao, (getReceitaBPR() != null ? getReceitaBPR() : BigDecimal.ZERO)); + receitaBaseComissao = MoneyHelper.subtrair(receitaBaseComissao,(getDevolvidos() != null ? getDevolvidos() : BigDecimal.ZERO)); + return MoneyHelper.arredondar(receitaBaseComissao, 2); + } + + public String getSigla() { + return sigla; + } + + public void setSigla(String sigla) { + this.sigla = sigla; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public String getBanco() { + return banco; + } + + public void setBanco(String banco) { + this.banco = banco; + } + + public String getConta() { + return conta; + } + + public void setConta(String conta) { + this.conta = conta; + } + + public String getAgencia() { + return agencia; + } + + public void setAgencia(String agencia) { + this.agencia = agencia; + } + + public String getCidade() { + return cidade; + } + + public void setCidade(String cidade) { + this.cidade = cidade; + } + + public String getTexto() { + return Labels.getLabel("busquedaCalculoComissaoController.recibo.texto", + new String[]{getNombempresa(), + getCnpjFormatado(), + getTextoValor()}); + } + + public String getTexto1() { + try { + if(StringUtils.isNotBlank(getCompetencia())) { + return Labels.getLabel("busquedaCalculoComissaoController.recibo.texto1", + new String[]{DateUtil.getStringDate(DateUtil.getDataInicialCompetencia(getCompetencia()), "dd/MM/yyyy"), + DateUtil.getStringDate(DateUtil.getDataFinalCompetencia(getCompetencia()), "dd/MM/yyyy")}); + } else { + return Labels.getLabel("busquedaCalculoComissaoController.recibo.texto1", + new String[]{DateUtil.getStringDate(getDataInicial(), "dd/MM/yyyy"), + DateUtil.getStringDate(getDataFinal(), "dd/MM/yyyy")}); + } + } catch (ParseException e) { + log.error(e.getMessage(), e); + } + return null; + } + + public String getTexto2() { + return Labels.getLabel("busquedaCalculoComissaoController.recibo.texto2"); + } + + private String getTextoValor() { + StringBuilder sTextoValor = new StringBuilder(); + sTextoValor.append(NF.format(getTotalLiquido().doubleValue())) + .append(" (") + .append(new RealToWords().toWords(getTotalLiquido())) + .append(") **********"); + return sTextoValor.toString(); + } + + public String getMsg() { + return Labels.getLabel("busquedaCalculoComissaoController.recibo.msg", new String[]{getNombempresa()}); + } + + public String getMsg1() { + return Labels.getLabel("busquedaCalculoComissaoController.recibo.msg1", new String[]{getNombempresa()}); + } + + public String getCnpj() { + return cnpj; + } + + public String getCnpjFormatado() { + return DocumentosUtil.formataCnpj(getCnpj()); + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public String getDescCorreo() { + return descCorreo; + } + + public void setDescCorreo(String descCorreo) { + this.descCorreo = descCorreo; + } + + @Override + public BigDecimal getComissaoBpr() { + return super.getComissaoBpr() != null ? super.getComissaoBpr() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getReceitaExcessobagagem() { + return super.getReceitaExcessobagagem() != null ? super.getReceitaExcessobagagem() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getReceitaSeguroopcional() { + return super.getReceitaSeguroopcional() != null ? super.getReceitaSeguroopcional() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getDescontosFixos() { + return super.getDescontosFixos() != null ? super.getDescontosFixos() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getDescontosEventuais() { + return super.getDescontosEventuais() != null ? super.getDescontosEventuais() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getRoyaties() { + return super.getRoyaties() != null ? super.getRoyaties() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getIssRetido() { + return super.getIssRetido() != null ? super.getIssRetido() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getBonificacaoMetas() { + return super.getBonificacaoMetas() != null ? super.getBonificacaoMetas() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getEntregasPassagem() { + return super.getEntregasPassagem() != null ? super.getEntregasPassagem() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getReceitaOutros() { + return super.getReceitaOutros() != null ? super.getReceitaOutros() : BigDecimal.ZERO; + } + + @Override + public BigDecimal getReceitaSeguro() { + return super.getReceitaSeguro() != null ? super.getReceitaSeguro() : BigDecimal.ZERO; + } + + public String getCnpjPuntoventaFormatado() { + if(!getCnpjPuntoventa().contains(".") && !getCnpjPuntoventa().contains("-") && !getCnpjPuntoventa().contains("/")) { + return DocumentosUtil.formataCnpj(getCnpjPuntoventa()); + }else { + return getCnpjPuntoventa(); + } + } + + public String getCnpjPuntoventa() { + return cnpjPuntoventa; + } + + public void setCnpjPuntoventa(String cnpjPuntoventa) { + this.cnpjPuntoventa = cnpjPuntoventa; + } + + public String getRazonsocial() { + return razonsocial; + } + + public void setRazonsocial(String razonsocial) { + this.razonsocial = razonsocial; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/LogConferenciaVO.java b/src/com/rjconsultores/ventaboletos/vo/comissao/LogConferenciaVO.java new file mode 100644 index 000000000..51bb7e6c5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/LogConferenciaVO.java @@ -0,0 +1,320 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.Date; + +import com.rjconsultores.ventaboletos.constantes.DescricaoTipoVenta; +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; +import com.rjconsultores.ventaboletos.enums.comissao.TipoLogConferencia; + +public class LogConferenciaVO { + + private Long logconferenciaId; + private String observacao; + private BigDecimal preco; + private Integer status; + private String numfoliosistema; + private Long boletoId; + private Long eventoextraId; + private Long ocdId; + private Integer tipo; + private String numoperacion; + private String desctipoevento; + private String nombusuario; + private Date fecmodif; + private Short indcredito; + private String nombempresa; + private String nombpuntoventa; + private Date datamovimento; + private String desccategoria; + private Integer tipoventa; + private String descinfoevento; + private String desctipoinformativo; + private String descpendencia; + private String descComportamentoData; + private Long cajaId; + private Conferencia conferencia; + private Integer pendenciaId; + + public LogConferenciaVO() { + super(); + } + + public LogConferenciaVO(Long logconferenciaId, String observacao, BigDecimal preco, Integer status, String numfoliosistema) { + this(); + this.logconferenciaId = logconferenciaId; + this.observacao = observacao; + this.preco = preco; + this.status = status; + this.numfoliosistema = numfoliosistema; + } + + public LogConferenciaVO(Long logconferenciaId) { + this(); + this.logconferenciaId = logconferenciaId; + } + + public Long getLogconferenciaId() { + return logconferenciaId; + } + + public void setLogconferenciaId(Long logconferenciaId) { + this.logconferenciaId = logconferenciaId; + } + + public String getObservacao() { + return observacao; + } + + public void setObservacao(String observacao) { + this.observacao = observacao; + } + + public BigDecimal getPreco() { + return preco; + } + + public void setPreco(BigDecimal preco) { + this.preco = preco; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getNumfoliosistema() { + return numfoliosistema; + } + + public void setNumfoliosistema(String numfoliosistema) { + this.numfoliosistema = numfoliosistema; + } + + public String getStatusDescricao() { + StatusLogConferencia statusLogConferencia = StatusLogConferencia.getStatusLogConferencia(status); + if (statusLogConferencia != null) { + return statusLogConferencia.toString(); + } + return ""; + } + + public Long getEventoextraId() { + return eventoextraId; + } + + public void setEventoextraId(Long eventoextraId) { + this.eventoextraId = eventoextraId; + } + + public Long getOcdId() { + return ocdId; + } + + public void setOcdId(Long ocdId) { + this.ocdId = ocdId; + } + + public Integer getTipo() { + return tipo; + } + + public void setTipo(Integer tipo) { + this.tipo = tipo; + } + + public String getTipoDescricao() { + TipoLogConferencia tipoLogConferencia = TipoLogConferencia.getTipoLogConferencia(tipo); + if (tipoLogConferencia != null) { + return tipoLogConferencia.toString(); + } + return ""; + } + + public String getNumoperacion() { + return numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public String getDesctipoevento() { + return desctipoevento; + } + + public void setDesctipoevento(String desctipoevento) { + this.desctipoevento = desctipoevento; + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public String getNombusuario() { + return nombusuario; + } + + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((logconferenciaId == null) ? 0 : logconferenciaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + LogConferenciaVO other = (LogConferenciaVO) obj; + if (logconferenciaId == null) { + if (other.logconferenciaId != null) + return false; + } else if (!logconferenciaId.equals(other.logconferenciaId)) + return false; + return true; + } + + public Short isIndcredito() { + return indcredito; + } + + public void setIndcredito(Short indcredito) { + this.indcredito = indcredito; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public Date getDatamovimento() { + return datamovimento; + } + + public void setDatamovimento(Date datamovimento) { + this.datamovimento = datamovimento; + } + + public String getDesccategoria() { + return desccategoria; + } + + public void setDesccategoria(String desccategoria) { + this.desccategoria = desccategoria; + } + + public String getDebitoCredito() { + return isIndcredito().equals((short) 0) ? "D" : isIndcredito().equals((short) 1) ? "C" : "I"; + } + + public Integer getTipoventa() { + return tipoventa; + } + + public void setTipoventa(Integer tipoventa) { + this.tipoventa = tipoventa; + } + + public String getDescinfoevento() { + return descinfoevento; + } + + public void setDescinfoevento(String descinfoevento) { + this.descinfoevento = descinfoevento; + } + + public String getDescricaoTipoventa() { + return DescricaoTipoVenta.getDescricaoTipoVenta(getTipoventa()); + } + + public String getDescdebitocredito() { + return isIndcredito().equals((short) 0) ? "D" : isIndcredito().equals((short) 1) ? "C" : "I"; + } + + public String getDesctipoinformativo() { + return desctipoinformativo; + } + + public void setDesctipoinformativo(String desctipoinformativo) { + this.desctipoinformativo = desctipoinformativo; + } + + public String getDescpendencia() { + return descpendencia; + } + + public void setDescpendencia(String descpendencia) { + this.descpendencia = descpendencia; + } + + public String getDescComportamentoData() { + return descComportamentoData != null ? descComportamentoData.equals("0") ? "Dia posterior" : "Mesmo dia" : null; + } + + public void setDescComportamentoData(String descComportamentoData) { + this.descComportamentoData = descComportamentoData; + } + + public Long getCajaId() { + return cajaId; + } + + public void setCajaId(Long cajaId) { + this.cajaId = cajaId; + } + + public Conferencia getConferencia() { + return conferencia; + } + + public void setConferencia(Conferencia conferencia) { + this.conferencia = conferencia; + } + + public Date getOrderDataMovimento(){ + return conferencia.getDatamovimento(); + } + + public Integer getPendenciaId() { + return pendenciaId; + } + + public void setPendenciaId(Integer pendenciaId) { + this.pendenciaId = pendenciaId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/MovimentosAtrasoVO.java b/src/com/rjconsultores/ventaboletos/vo/comissao/MovimentosAtrasoVO.java new file mode 100644 index 000000000..d215e82d7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/MovimentosAtrasoVO.java @@ -0,0 +1,236 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Set; + +import com.rjconsultores.ventaboletos.constantes.Constantes; + +public class MovimentosAtrasoVO implements Comparable { + + private Integer puntoventaId; + private String nombpuntoventa; + private String numPuntoVenta; + private String competencia; + private Integer diasemtransito; + private Date dataMovimento; + private SituacaoDiaMovimento situacao; + private String numtelefonouno; + private String uf; + private String nombpuntoventaPadre; + private Integer intervalofechamento; + + private Set diasEmAtraso; + + public MovimentosAtrasoVO() { + super(); + } + + public MovimentosAtrasoVO(Integer puntoventaId, Date dataMovimento) { + this(); + this.puntoventaId = puntoventaId; + this.dataMovimento = dataMovimento; + } + + public MovimentosAtrasoVO(Integer puntoventaId, String nombpuntoventa, String numPuntoVenta, String competencia, Integer diasemtransito, Date dataMovimento, SituacaoDiaMovimento situacao, Integer intervalofechamento, String nombpuntoventaPadre, String uf, String numtelefonouno) { + this(); + this.puntoventaId = puntoventaId; + this.nombpuntoventa = nombpuntoventa; + this.numPuntoVenta = numPuntoVenta; + this.competencia = competencia; + this.diasemtransito = diasemtransito; + this.dataMovimento = dataMovimento; + this.situacao = situacao; + this.intervalofechamento = intervalofechamento; + this.nombpuntoventaPadre = nombpuntoventaPadre; + this.uf = uf; + this.numtelefonouno = numtelefonouno; + + /*movimentosAtrasoVO.setIntervalofechamento(rset.getInt("INTERVALOFECHAMENTO")); + movimentosAtrasoVO.setNombpuntoventaPadre(rset.getString("NOMPUNTOVENTAPADRE")); + movimentosAtrasoVO.setUf(rset.getString("UF")); + movimentosAtrasoVO.setNumtelefonouno(rset.getString("NUMTELEFONOUNO"));*/ + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + + public String getCompetencia() { + return competencia; + } + + public void setCompetencia(String competencia) { + this.competencia = competencia; + } + + public enum SituacaoDiaMovimento { + ENTREGUE("EN","Entregue"), + ATRASADO("AT","Atrasado"), + AGUARDANDO("AG","Aguardando"); + + private String shortDescricao; + private String descricao; + + private SituacaoDiaMovimento(String shortDescricao, String descricao) { + this.shortDescricao = shortDescricao; + this.descricao = descricao; + } + + public String getShortDescricao() { + return shortDescricao; + } + + @Override + public String toString() { + return this.descricao; + } + + } + + @Override + public int compareTo(MovimentosAtrasoVO o) { + return this.nombpuntoventa.compareTo(o.nombpuntoventa); + } + + public Integer getDiasemtransito() { + return diasemtransito; + } + + public void setDiasemtransito(Integer diasemtransito) { + this.diasemtransito = diasemtransito; + } + + public Date getDataMovimento() { + return dataMovimento; + } + + public void setDataMovimento(Date dataMovimento) { + this.dataMovimento = dataMovimento; + } + + public SituacaoDiaMovimento getSituacao() { + return situacao; + } + + public void setSituacao(SituacaoDiaMovimento situacao) { + this.situacao = situacao; + } + + public String getDescricaoSituacao() { + return getSituacao() != null ? getSituacao().toString() : ""; + } + + public String getShortDescricaoSituacao() { + return getSituacao() != null ? getSituacao().getShortDescricao() : ""; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((dataMovimento == null) ? 0 : dataMovimento.hashCode()); + result = prime * result + ((puntoventaId == null) ? 0 : puntoventaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + MovimentosAtrasoVO other = (MovimentosAtrasoVO) obj; + if (puntoventaId == null) { + if (other.puntoventaId != null) + return false; + } else if (!puntoventaId.equals(other.puntoventaId)) + return false; + return true; + } + + public String getNumtelefonouno() { + return numtelefonouno; + } + + public void setNumtelefonouno(String numtelefonouno) { + this.numtelefonouno = numtelefonouno; + } + + public String getUf() { + return uf; + } + + public void setUf(String uf) { + this.uf = uf; + } + + public String getNombpuntoventaPadre() { + return nombpuntoventaPadre; + } + + public void setNombpuntoventaPadre(String nombpuntoventaPadre) { + this.nombpuntoventaPadre = nombpuntoventaPadre; + } + + public Integer getIntervalofechamento() { + return intervalofechamento; + } + + public void setIntervalofechamento(Integer intervalofechamento) { + this.intervalofechamento = intervalofechamento; + } + + public Set getDiasEmAtraso() { + return diasEmAtraso; + } + + public void setDiasEmAtraso(Set diasEmAtraso) { + this.diasEmAtraso = diasEmAtraso; + } + + public String getStrDiasEmAtraso() { + List dias = Arrays.asList(getDiasEmAtraso().toArray(new Integer[0])); + java.util.Collections.sort(dias); + return dias.toString().replaceAll("[^0-9,]", ""); + } + + public String getDesIntervalofechamento() { + switch (intervalofechamento) { + case Constantes.INTERVALO_FECHAMENTO_DIARIO: + return "Diário"; + case Constantes.INTERVALO_FECHAMENTO_SEMANAL: + return "Semanal"; + case Constantes.INTERVALO_FECHAMENTO_DECENDIAL: + return "Decendial"; + case Constantes.INTERVALO_FECHAMENTO_QUINZENAL: + return "Quinzenal"; + case Constantes.INTERVALO_FECHAMENTO_MENSAL: + return "Mensal"; + default: + return ""; + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/OcdVO.java b/src/com/rjconsultores/ventaboletos/vo/comissao/OcdVO.java new file mode 100644 index 000000000..90fb33e22 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/OcdVO.java @@ -0,0 +1,290 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.Date; + +import org.apache.commons.lang.StringUtils; +import org.zkoss.util.resource.Labels; + +import com.rjconsultores.ventaboletos.entidad.Conferencia; +import com.rjconsultores.ventaboletos.enums.comissao.StatusLogConferencia; +import com.rjconsultores.ventaboletos.utilerias.BigDecimalUtil; +import com.rjconsultores.ventaboletos.utilerias.LocaleUtil; + +public class OcdVO { + + private Long ocdId; + + private Long boletoId; + private Integer puntoventaId; + + private String numoperacion; + + private Date fecpagar; + private BigDecimal valorPagar; + private BigDecimal penalizacion; + + private Integer usuarioIncId; + private Date fecinc; + + private Boolean indpago; + private Integer usuarioPagoId; + private Date fecpago; + private Integer puntoventapagoId; + + private Date fecmodif; + private Integer usuarioId; + private Boolean activo; + private String nombusuario; + private String login; + private String numFolioSistema; + + private Integer status; + private Long logconferenciaId; + private boolean conferido; + + private boolean exigeConferenciaAba; + + private Conferencia conferencia; + + public Long getOcdId() { + return ocdId; + } + + public void setOcdId(Long ocdId) { + this.ocdId = ocdId; + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public String getNumoperacion() { + return numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public Date getFecpagar() { + return fecpagar; + } + + public void setFecpagar(Date fecpagar) { + this.fecpagar = fecpagar; + } + + public BigDecimal getValorPagar() { + return valorPagar; + } + + public void setValorPagar(BigDecimal valorPagar) { + this.valorPagar = valorPagar; + } + + public BigDecimal getPenalizacion() { + return penalizacion; + } + + public void setPenalizacion(BigDecimal penalizacion) { + this.penalizacion = penalizacion; + } + + public Integer getUsuarioIncId() { + return usuarioIncId; + } + + public void setUsuarioIncId(Integer usuarioIncId) { + this.usuarioIncId = usuarioIncId; + } + + public Date getFecinc() { + return fecinc; + } + + public void setFecinc(Date fecinc) { + this.fecinc = fecinc; + } + + public Boolean getIndpago() { + return indpago; + } + + public void setIndpago(Boolean indpago) { + this.indpago = indpago; + } + + public Integer getUsuarioPagoId() { + return usuarioPagoId; + } + + public void setUsuarioPagoId(Integer usuarioPagoId) { + this.usuarioPagoId = usuarioPagoId; + } + + public Date getFecpago() { + return fecpago; + } + + public void setFecpago(Date fecpago) { + this.fecpago = fecpago; + } + + public Integer getPuntoventapagoId() { + return puntoventapagoId; + } + + public void setPuntoventapagoId(Integer puntoventapagoId) { + this.puntoventapagoId = puntoventapagoId; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getStatusDescricao() { + StatusLogConferencia statusLogConferencia = StatusLogConferencia.getStatusLogConferencia(status); + if(statusLogConferencia != null) { + return statusLogConferencia.toString(); + } + return ""; + } + + public String getDescindpago() { + return getIndpago() != null && getIndpago() ? Labels.getLabel("conferenciaController.lbl.sim") : Labels.getLabel("conferenciaController.lbl.nao"); + } + + public String getNombusuario() { + return nombusuario; + } + + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + + public String getValorPagarFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getValorPagar(), LocaleUtil.getLocale()); + } + + public String getPenalizacionFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getPenalizacion(), LocaleUtil.getLocale()); + } + + public Long getLogconferenciaId() { + return logconferenciaId; + } + + public void setLogconferenciaId(Long logconferenciaId) { + this.logconferenciaId = logconferenciaId; + } + + public boolean isConferido() { + return conferido; + } + + public void setConferido(boolean conferido) { + this.conferido = conferido; + } + + public String getLogin() { + return login; + } + + public void setLogin(String login) { + this.login = login; + } + + public String getNumFolioSistema() { + return numFolioSistema; + } + + public void setNumFolioSistema(String numFolioSistema) { + this.numFolioSistema = numFolioSistema; + } + + public String getNombusuarioLogin() { + StringBuilder nombusuarioLogin = new StringBuilder(); + + nombusuarioLogin.append(StringUtils.isNotBlank(getNombusuario()) ? getNombusuario() : ""); + + if(nombusuarioLogin.length() > 0) { + nombusuarioLogin.append(" - ") + .append(StringUtils.isNotBlank(getLogin()) ? getLogin() : ""); + } + + return nombusuarioLogin.toString(); + } + + public boolean isExigeConferenciaAba() { + return exigeConferenciaAba; + } + + public void setExigeConferenciaAba(boolean exigeConferenciaAba) { + this.exigeConferenciaAba = exigeConferenciaAba; + } + + public String getOrderExigeConferencia() { + if(isExigeConferenciaAba()) { + if(!isConferido()) { + return "A"; + } else if (isConferido()){ + return "B"; + } + } + return "C"; + } + + public Conferencia getConferencia() { + return conferencia; + } + + public void setConferencia(Conferencia conferencia) { + this.conferencia = conferencia; + } + + public Date getOrderDataMovimento(){ + return conferencia.getDatamovimento(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/RegistroCalculo.java b/src/com/rjconsultores/ventaboletos/vo/comissao/RegistroCalculo.java new file mode 100644 index 000000000..a212d29f5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/RegistroCalculo.java @@ -0,0 +1,152 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.List; + +public class RegistroCalculo { + + private BigDecimal comissaoPagar; + private BigDecimal comissaoBPR; + private BigDecimal comissaoSeguro; + private BigDecimal comissaoSegOpcional; + private BigDecimal comissaoExcessoBagagem; + private BigDecimal comissaoEntregaPassagem; + private BigDecimal comissaoOutros; + private BigDecimal comissaoBonificaoMetas; + + private BigDecimal royaties; + private BigDecimal retidoISS; + + private BigDecimal descontos; + private List lsDescontos; + private List lsReceitas; + + private String nombpuntoventa; + private String numPuntoVenta; + + public BigDecimal getComissaoPagar() { + return comissaoPagar; + } + + public void setComissaoPagar(BigDecimal comissaoPagar) { + this.comissaoPagar = comissaoPagar; + } + + public BigDecimal getComissaoBPR() { + return comissaoBPR; + } + + public void setComissaoBPR(BigDecimal comissaoBPR) { + this.comissaoBPR = comissaoBPR; + } + + public BigDecimal getComissaoSegOpcional() { + return comissaoSegOpcional; + } + + public void setComissaoSegOpcional(BigDecimal comissaoSegOpcional) { + this.comissaoSegOpcional = comissaoSegOpcional; + } + + public BigDecimal getComissaoExcessoBagagem() { + return comissaoExcessoBagagem; + } + + public void setComissaoExcessoBagagem(BigDecimal comissaoExcessoBagagem) { + this.comissaoExcessoBagagem = comissaoExcessoBagagem; + } + + public BigDecimal getComissaoEntregaPassagem() { + return comissaoEntregaPassagem; + } + + public void setComissaoEntregaPassagem(BigDecimal comissaoEntregaPassagem) { + this.comissaoEntregaPassagem = comissaoEntregaPassagem; + } + + public BigDecimal getComissaoBonificaoMetas() { + return comissaoBonificaoMetas; + } + + public void setComissaoBonificaoMetas(BigDecimal comissaoBonificaoMetas) { + this.comissaoBonificaoMetas = comissaoBonificaoMetas; + } + + public BigDecimal getRoyaties() { + return royaties; + } + + public void setRoyaties(BigDecimal royaties) { + this.royaties = royaties; + } + + public BigDecimal getRetidoISS() { + return retidoISS; + } + + public void setRetidoISS(BigDecimal retidoISS) { + this.retidoISS = retidoISS; + } + + public BigDecimal getDescontos() { + return descontos; + } + + public void setDescontos(BigDecimal descontos) { + this.descontos = descontos; + } + + public List getLsDescontos() { + return lsDescontos; + } + + public void setLsDescontos(List lsDescontos) { + this.lsDescontos = lsDescontos; + } + + public List getLsReceitas() { + return lsReceitas; + } + + public void setLsReceitas(List lsReceitas) { + this.lsReceitas = lsReceitas; + } + + public BigDecimal getComissaoOutros() { + return comissaoOutros; + } + + public void setComissaoOutros(BigDecimal comissaoOutros) { + this.comissaoOutros = comissaoOutros; + } + + @Override + public String toString() { + return "RegistroCalculo [comissaoPagar=" + comissaoPagar + ", comissaoBPR=" + comissaoBPR + ", comissaoSegOpcional=" + comissaoSegOpcional + ", comissaoExcessoBagagem=" + comissaoExcessoBagagem + ", comissaoEntregaPassagem=" + comissaoEntregaPassagem + ", comissaoBonificaoMetas=" + comissaoBonificaoMetas + ", royaties=" + royaties + ", retidoISS=" + retidoISS + ", descontos=" + descontos + ", lsDescontos=" + lsDescontos + ", lsReceitas=" + lsReceitas + "]"; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + + public BigDecimal getComissaoSeguro() { + return comissaoSeguro; + } + + public void setComissaoSeguro(BigDecimal comissaoSeguro) { + this.comissaoSeguro = comissaoSeguro; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/ResumoComissao.java b/src/com/rjconsultores/ventaboletos/vo/comissao/ResumoComissao.java new file mode 100644 index 000000000..b9292f5fa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/ResumoComissao.java @@ -0,0 +1,142 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; +import java.util.List; + +import com.rjconsultores.ventaboletos.utilerias.BigDecimalUtil; +import com.rjconsultores.ventaboletos.utilerias.LocaleUtil; + +public class ResumoComissao { + + private BigDecimal totalVendas; + private BigDecimal totalCancelados; + private BigDecimal totalDevolvidos; + private BigDecimal totalTroca; + private BigDecimal totalReceitas; + private BigDecimal totalDespesas; + private BigDecimal valorDeposito; + private List listNumSerieECF; + + private OcdVO totalOcd; + + private List totalFormapago; + + public BigDecimal getTotalVendas() { + return totalVendas; + } + + public void setTotalVendas(BigDecimal totalVendas) { + this.totalVendas = totalVendas; + } + + public BigDecimal getTotalCancelados() { + return totalCancelados; + } + + public void setTotalCancelados(BigDecimal totalCancelados) { + this.totalCancelados = totalCancelados; + } + + public BigDecimal getTotalDevolvidos() { + return totalDevolvidos; + } + + public void setTotalDevolvidos(BigDecimal totalDevolvidos) { + this.totalDevolvidos = totalDevolvidos; + } + + public BigDecimal getTotalTroca() { + return totalTroca; + } + + public void setTotalTroca(BigDecimal totalTroca) { + this.totalTroca = totalTroca; + } + + public BigDecimal getTotalReceitas() { + return totalReceitas; + } + + public void setTotalReceitas(BigDecimal totalReceitas) { + this.totalReceitas = totalReceitas; + } + + public BigDecimal getTotalDespesas() { + return totalDespesas; + } + + public void setTotalDespesas(BigDecimal totalDespesas) { + this.totalDespesas = totalDespesas; + } + + public BigDecimal getValorDeposito() { + return valorDeposito; + } + + public void setValorDeposito(BigDecimal valorDeposito) { + this.valorDeposito = valorDeposito; + } + + public List getTotalFormapago() { + return totalFormapago; + } + + public void setTotalFormapago(List totalFormapago) { + this.totalFormapago = totalFormapago; + } + + public OcdVO getTotalOcd() { + return totalOcd; + } + + public void setTotalOcd(OcdVO totalOcd) { + this.totalOcd = totalOcd; + } + + public List getListNumSerieECF() { + return listNumSerieECF; + } + + public void setListNumSerieECF(List listNumSerieECF) { + this.listNumSerieECF = listNumSerieECF; + } + + public String getTotalVendasFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalVendas(), LocaleUtil.getLocale()); + } + + public String getTotalCanceladosFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalCancelados(), LocaleUtil.getLocale()); + } + + public String getTotalDevolvidosFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalDevolvidos(), LocaleUtil.getLocale()); + } + + public String getTotalTrocaFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalTroca(), LocaleUtil.getLocale()); + } + + public String getTotalReceitasFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalReceitas(), LocaleUtil.getLocale()); + } + + public String getTotalDespesasFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalDespesas(), LocaleUtil.getLocale()); + } + + public BigDecimal getTotalDiferenca() { + return getTotalReceitas().subtract(getTotalDespesas()); + } + + public String getTotalDiferencaFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getTotalDiferenca(), LocaleUtil.getLocale()); + } + + public String getValorDepositoFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getValorDeposito(), LocaleUtil.getLocale()); + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/TarifaOficialVO.java b/src/com/rjconsultores/ventaboletos/vo/comissao/TarifaOficialVO.java new file mode 100644 index 000000000..22fdd2cb8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/TarifaOficialVO.java @@ -0,0 +1,124 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; + +public class TarifaOficialVO { + + private Integer tarifaoficialid; + private BigDecimal precio; + private BigDecimal preciooriginal; + private BigDecimal importepedagio; + private BigDecimal importetaxaembarque; + private BigDecimal importeseguro; + private BigDecimal importetpp; + private BigDecimal importeoutros; + private String descparadaorigem; + private String descparadadestino; + private String nomevia; + private String descmarca; + private String descorgao; + private String rutaprefixo; + private String numruta; + private String descclasse; + + + public Integer getTarifaoficialid() { + return tarifaoficialid; + } + public void setTarifaoficialid(Integer tarifaoficialid) { + this.tarifaoficialid = tarifaoficialid; + } + public BigDecimal getPrecio() { + return precio; + } + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + public BigDecimal getPreciooriginal() { + return preciooriginal; + } + public void setPreciooriginal(BigDecimal preciooriginal) { + this.preciooriginal = preciooriginal; + } + public BigDecimal getImportepedagio() { + return importepedagio; + } + public void setImportepedagio(BigDecimal importepedagio) { + this.importepedagio = importepedagio; + } + public BigDecimal getImportetaxaembarque() { + return importetaxaembarque; + } + public void setImportetaxaembarque(BigDecimal importetaxaembarque) { + this.importetaxaembarque = importetaxaembarque; + } + public BigDecimal getImporteseguro() { + return importeseguro; + } + public void setImporteseguro(BigDecimal importeseguro) { + this.importeseguro = importeseguro; + } + public BigDecimal getImportetpp() { + return importetpp; + } + public void setImportetpp(BigDecimal importetpp) { + this.importetpp = importetpp; + } + public BigDecimal getImporteoutros() { + return importeoutros; + } + public void setImporteoutros(BigDecimal importeoutros) { + this.importeoutros = importeoutros; + } + public String getDescparadaorigem() { + return descparadaorigem; + } + public void setDescparadaorigem(String descparadaorigem) { + this.descparadaorigem = descparadaorigem; + } + public String getDescparadadestino() { + return descparadadestino; + } + public void setDescparadadestino(String descparadadestino) { + this.descparadadestino = descparadadestino; + } + public String getNomevia() { + return nomevia; + } + public void setNomevia(String nomevia) { + this.nomevia = nomevia; + } + public String getDescmarca() { + return descmarca; + } + public void setDescmarca(String descmarca) { + this.descmarca = descmarca; + } + public String getDescorgao() { + return descorgao; + } + public void setDescorgao(String descorgao) { + this.descorgao = descorgao; + } + public String getRutaprefixo() { + return rutaprefixo; + } + public void setRutaprefixo(String rutaprefixo) { + this.rutaprefixo = rutaprefixo; + } + public String getNumruta() { + return numruta; + } + public void setNumruta(String numruta) { + this.numruta = numruta; + } + public String getDescclasse() { + return descclasse; + } + public void setDescclasse(String descclasse) { + this.descclasse = descclasse; + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/TarifaVO.java b/src/com/rjconsultores/ventaboletos/vo/comissao/TarifaVO.java new file mode 100644 index 000000000..7c6b00932 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/TarifaVO.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; + +public class TarifaVO { + + + + private Integer tarifaid; + private BigDecimal precio; + private BigDecimal preciooriginal; + private BigDecimal importepedagio; + private BigDecimal importetaxaembarque; + private BigDecimal importeseguro; + private BigDecimal importetpp; + private BigDecimal importeoutros; + private String statustarifa; + private String descparadaOrigem; + private String descparadaDestino; + private String nomeVia; + private String descMarca; + private java.util.Date feciniciovigencia; + private java.util.Date fecfimvigencia; + private String descorgao; + private String rutaprefixo; + private String numruta; + private String descclasse; + public Integer getTarifaid() { + return tarifaid; + } + public void setTarifaid(Integer tarifaid) { + this.tarifaid = tarifaid; + } + public BigDecimal getPrecio() { + return precio; + } + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + public BigDecimal getPreciooriginal() { + return preciooriginal; + } + public void setPreciooriginal(BigDecimal preciooriginal) { + this.preciooriginal = preciooriginal; + } + public BigDecimal getImportepedagio() { + return importepedagio; + } + public void setImportepedagio(BigDecimal importepedagio) { + this.importepedagio = importepedagio; + } + public BigDecimal getImportetaxaembarque() { + return importetaxaembarque; + } + public void setImportetaxaembarque(BigDecimal importetaxaembarque) { + this.importetaxaembarque = importetaxaembarque; + } + public BigDecimal getImporteseguro() { + return importeseguro; + } + public void setImporteseguro(BigDecimal importeseguro) { + this.importeseguro = importeseguro; + } + public BigDecimal getImportetpp() { + return importetpp; + } + public void setImportetpp(BigDecimal importetpp) { + this.importetpp = importetpp; + } + public BigDecimal getImporteoutros() { + return importeoutros; + } + public void setImporteoutros(BigDecimal importeoutros) { + this.importeoutros = importeoutros; + } + public String getStatustarifa() { + return statustarifa; + } + public void setStatustarifa(String statustarifa) { + this.statustarifa = statustarifa; + } + public String getDescparadaOrigem() { + return descparadaOrigem; + } + public void setDescparadaOrigem(String descparadaOrigem) { + this.descparadaOrigem = descparadaOrigem; + } + public String getDescparadaDestino() { + return descparadaDestino; + } + public void setDescparadaDestino(String descparadaDestino) { + this.descparadaDestino = descparadaDestino; + } + public String getNomeVia() { + return nomeVia; + } + public void setNomeVia(String nomeVia) { + this.nomeVia = nomeVia; + } + public String getDescMarca() { + return descMarca; + } + public void setDescMarca(String descMarca) { + this.descMarca = descMarca; + } + public java.util.Date getFeciniciovigencia() { + return feciniciovigencia; + } + public void setFeciniciovigencia(java.util.Date feciniciovigencia) { + this.feciniciovigencia = feciniciovigencia; + } + public java.util.Date getFecfimvigencia() { + return fecfimvigencia; + } + public void setFecfimvigencia(java.util.Date fecfimvigencia) { + this.fecfimvigencia = fecfimvigencia; + } + public String getDescorgao() { + return descorgao; + } + public void setDescorgao(String descorgao) { + this.descorgao = descorgao; + } + public String getRutaprefixo() { + return rutaprefixo; + } + public void setRutaprefixo(String rutaprefixo) { + this.rutaprefixo = rutaprefixo; + } + public String getNumruta() { + return numruta; + } + public void setNumruta(String numruta) { + this.numruta = numruta; + } + public String getDescclasse() { + return descclasse; + } + public void setDescclasse(String descclasse) { + this.descclasse = descclasse; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionRutaVO.java b/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionRutaVO.java new file mode 100644 index 000000000..0a453a7b5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionRutaVO.java @@ -0,0 +1,152 @@ +package com.rjconsultores.ventaboletos.vo.conexion; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Ruta; + +public class ConexionRutaVO { + + private Integer rutaOrigenId; + private Integer numRutaOrigen; + private String descLinhaOrigem; + private Integer numRutaDestino; + private Integer rutaDestinoId; + private String descLinhaDestino; + private String tramoOrigen; + private String tramoDestino; + private Integer conexionRutaCtrl; + private Parada parada; + private Ruta ruta; + + + public ConexionRutaVO() { + super(); + } + + + public ConexionRutaVO(Parada parada, Ruta ruta) { + super(); + this.parada = parada; + this.ruta = ruta; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Integer getRutaOrigenId() { + return rutaOrigenId; + } + + public void setRutaOrigenId(Integer rutaOrigenId) { + this.rutaOrigenId = rutaOrigenId; + } + + public Integer getNumRutaOrigen() { + return numRutaOrigen; + } + + public void setNumRutaOrigen(Integer numRutaOrigen) { + this.numRutaOrigen = numRutaOrigen; + } + + public Integer getNumRutaDestino() { + return numRutaDestino; + } + + public void setNumRutaDestino(Integer numRutaDestino) { + this.numRutaDestino = numRutaDestino; + } + + public Integer getRutaDestinoId() { + return rutaDestinoId; + } + + public void setRutaDestinoId(Integer rutaDestinoId) { + this.rutaDestinoId = rutaDestinoId; + } + + public String getDescLinhaOrigem() { + return descLinhaOrigem; + } + + public void setDescLinhaOrigem(String descLinhaOrigem) { + this.descLinhaOrigem = descLinhaOrigem; + } + + public String getDescLinhaDestino() { + return descLinhaDestino; + } + + public void setDescLinhaDestino(String descLinhaDestino) { + this.descLinhaDestino = descLinhaDestino; + } + + public String getTramoOrigen() { + return tramoOrigen; + } + + public void setTramoOrigen(String tramoOrigen) { + this.tramoOrigen = tramoOrigen; + } + + public String getTramoDestino() { + return tramoDestino; + } + + public void setTramoDestino(String tramoDestino) { + this.tramoDestino = tramoDestino; + } + + public Integer getConexionRutaCtrl() { + return conexionRutaCtrl; + } + + public void setConexionRutaCtrl(Integer conexionRutaCtrl) { + this.conexionRutaCtrl = conexionRutaCtrl; + } + + public Parada getParada() { + return parada; + } + + public void setParada(Parada parada) { + this.parada = parada; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((parada == null) ? 0 : parada.hashCode()); + return result; + } + + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConexionRutaVO other = (ConexionRutaVO) obj; + if (parada == null) { + if (other.parada != null) + return false; + } else if (!parada.equals(other.parada)) + return false; + return true; + } + + + @Override + public String toString() { + return "ConexionRutaVO [rutaOrigenId=" + rutaOrigenId + ", numRutaOrigen=" + numRutaOrigen + ", descLinhaOrigem=" + descLinhaOrigem + ", numRutaDestino=" + numRutaDestino + ", rutaDestinoId=" + rutaDestinoId + ", descLinhaDestino=" + descLinhaDestino + ", tramoOrigen=" + tramoOrigen + ", tramoDestino=" + tramoDestino + ", conexionRutaCtrl=" + conexionRutaCtrl + ", parada=" + parada + ", ruta=" + ruta + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java b/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java new file mode 100644 index 000000000..18ed9e03f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java @@ -0,0 +1,63 @@ +package com.rjconsultores.ventaboletos.vo.conexion; + +public class ConexionVO { + private String conOrigen; + private String conDestino; + private Integer grupo; + private String tramoOrigen; + private String tramoDestino; + private Long conexionCtrlId; + + public String getConOrigen() { + return conOrigen; + } + + public void setConOrigen(String conOrigen) { + this.conOrigen = conOrigen; + } + + public String getConDestino() { + return conDestino; + } + + public void setConDestino(String conDestino) { + this.conDestino = conDestino; + } + + public Integer getGrupo() { + return grupo; + } + + public void setGrupo(Integer grupo) { + this.grupo = grupo; + } + + public String getTramoOrigen() { + return tramoOrigen; + } + + public void setTramoOrigen(String tramoOrigen) { + this.tramoOrigen = tramoOrigen; + } + + public String getTramoDestino() { + return tramoDestino; + } + + public void setTramoDestino(String tramoDestino) { + this.tramoDestino = tramoDestino; + } + + public Long getConexionCtrlId() { + return conexionCtrlId; + } + + public void setConexionCtrlId(Long conexionCtrlId) { + this.conexionCtrlId = conexionCtrlId; + } + + @Override + public String toString() { + return "ConexionVO [conOrigen=" + conOrigen + ", conDestino=" + conDestino + ", grupo=" + grupo + ", tramoOrigen=" + tramoOrigen + ", tramoDestino=" + tramoDestino + ", conexionCtrlId=" + conexionCtrlId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/conexion/OrdenarLocalidadesGeradas.java b/src/com/rjconsultores/ventaboletos/vo/conexion/OrdenarLocalidadesGeradas.java new file mode 100644 index 000000000..ccbd4b5bd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/conexion/OrdenarLocalidadesGeradas.java @@ -0,0 +1,24 @@ +package com.rjconsultores.ventaboletos.vo.conexion; + +import java.util.Comparator; + +import com.rjconsultores.ventaboletos.vo.parada.ParadaVOConexionRuta; + +public class OrdenarLocalidadesGeradas implements Comparator { + + @Override + public int compare(ParadaVOConexionRuta o1, ParadaVOConexionRuta o2) { + int retorno = o1.getParadaOrigemTrecho().getParadaId().compareTo(o2.getParadaOrigemTrecho().getParadaId()); + if(retorno == 0) { + retorno = o1.getParadaDestinoTrecho().getParadaId().compareTo(o2.getParadaDestinoTrecho().getParadaId()); + } + if(retorno == 0) { + retorno = o1.getGrupo().compareTo(o2.getGrupo()); + } + if(retorno == 0) { + retorno = o1.getSecuencia().compareTo(o2.getSecuencia()); + } + return retorno; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/configuracioneccomerciales/ConfLayoutContratoVO.java b/src/com/rjconsultores/ventaboletos/vo/configuracioneccomerciales/ConfLayoutContratoVO.java new file mode 100644 index 000000000..1b6fa9cb2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/configuracioneccomerciales/ConfLayoutContratoVO.java @@ -0,0 +1,270 @@ +package com.rjconsultores.ventaboletos.vo.configuracioneccomerciales; + +import java.math.BigDecimal; +import java.util.Date; + +public class ConfLayoutContratoVO { + + private String nomeLocalidade; + private String CNPJ; + private Date dataAbertura; + private String razaoSocial; + private String nomeCidade; + private String email; + private String codigoPostal; + private String numero; + private BigDecimal passagemAlta; + private BigDecimal passagemBaixa; + private BigDecimal seguroObrigatorioBaixa; + private BigDecimal seguroObrigatorioAlta; + private BigDecimal valorVendaGapBaixa; + private BigDecimal valorVendaGapAlta; + private BigDecimal valorVendaGapBaixaImp; + private BigDecimal valorVendaGapAltaImp; + private BigDecimal seguroBaixa; + private BigDecimal seguroAlta; + private BigDecimal outrosBaixa; + private BigDecimal outrosAlta; + private BigDecimal excesssoBaixa; + private BigDecimal excesssoAlta; + private String nomeTitular; + private String nomeBanco; + private String numeroAgencia; + private String numeroConta; + private String tipoSocio; + private String bairro; + private String rua; + + public String getNomeLocalidade() { + return nomeLocalidade; + } + + public void setNomeLocalidade(String nomeLocalidade) { + this.nomeLocalidade = nomeLocalidade; + } + + public String getCNPJ() { + return CNPJ; + } + + public void setCNPJ(String CNPJ) { + this.CNPJ = CNPJ; + } + + public Date getDataAbertura() { + return dataAbertura; + } + + public void setDataAbertura(Date dataAbertura) { + this.dataAbertura = dataAbertura; + } + + public String getRazaoSocial() { + return razaoSocial; + } + + public void setRazaoSocial(String razaoSocial) { + this.razaoSocial = razaoSocial; + } + + public String getNomeCidade() { + return nomeCidade; + } + + public void setNomeCidade(String nomeCidade) { + this.nomeCidade = nomeCidade; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getCodigoPostal() { + return codigoPostal; + } + + public void setCodigoPostal(String codigoPostal) { + this.codigoPostal = codigoPostal; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public BigDecimal getPassagemAlta() { + return passagemAlta; + } + + public void setPassagemAlta(BigDecimal passagemAlta) { + this.passagemAlta = passagemAlta; + } + + public BigDecimal getPassagemBaixa() { + return passagemBaixa; + } + + public void setPassagemBaixa(BigDecimal passagemBaixa) { + this.passagemBaixa = passagemBaixa; + } + + public BigDecimal getSeguroObrigatorioBaixa() { + return seguroObrigatorioBaixa; + } + + public void setSeguroObrigatorioBaixa(BigDecimal seguroObrigatorioBaixa) { + this.seguroObrigatorioBaixa = seguroObrigatorioBaixa; + } + + public BigDecimal getSeguroObrigatorioAlta() { + return seguroObrigatorioAlta; + } + + public void setSeguroObrigatorioAlta(BigDecimal seguroObrigatorioAlta) { + this.seguroObrigatorioAlta = seguroObrigatorioAlta; + } + + public BigDecimal getValorVendaGapBaixa() { + return valorVendaGapBaixa; + } + + public void setValorVendaGapBaixa(BigDecimal valorVendaGapBaixa) { + this.valorVendaGapBaixa = valorVendaGapBaixa; + } + + public BigDecimal getValorVendaGapAlta() { + return valorVendaGapAlta; + } + + public void setValorVendaGapAlta(BigDecimal valorVendaGapAlta) { + this.valorVendaGapAlta = valorVendaGapAlta; + } + + public BigDecimal getValorVendaGapBaixaImp() { + return valorVendaGapBaixaImp; + } + + public void setValorVendaGapBaixaImp(BigDecimal valorVendaGapBaixaImp) { + this.valorVendaGapBaixaImp = valorVendaGapBaixaImp; + } + + public BigDecimal getValorVendaGapAltaImp() { + return valorVendaGapAltaImp; + } + + public void setValorVendaGapAltaImp(BigDecimal valorVendaGapAltaImp) { + this.valorVendaGapAltaImp = valorVendaGapAltaImp; + } + + public BigDecimal getSeguroBaixa() { + return seguroBaixa; + } + + public void setSeguroBaixa(BigDecimal seguroBaixa) { + this.seguroBaixa = seguroBaixa; + } + + public BigDecimal getSeguroAlta() { + return seguroAlta; + } + + public void setSeguroAlta(BigDecimal seguroAlta) { + this.seguroAlta = seguroAlta; + } + + public BigDecimal getOutrosBaixa() { + return outrosBaixa; + } + + public void setOutrosBaixa(BigDecimal outrosBaixa) { + this.outrosBaixa = outrosBaixa; + } + + public BigDecimal getOutrosAlta() { + return outrosAlta; + } + + public void setOutrosAlta(BigDecimal outrosAlta) { + this.outrosAlta = outrosAlta; + } + + public BigDecimal getExcesssoBaixa() { + return excesssoBaixa; + } + + public void setExcesssoBaixa(BigDecimal excesssoBaixa) { + this.excesssoBaixa = excesssoBaixa; + } + + public BigDecimal getExcesssoAlta() { + return excesssoAlta; + } + + public void setExcesssoAlta(BigDecimal excesssoAlta) { + this.excesssoAlta = excesssoAlta; + } + + public String getNomeTitular() { + return nomeTitular; + } + + public void setNomeTitular(String nomeTitular) { + this.nomeTitular = nomeTitular; + } + + public String getNomeBanco() { + return nomeBanco; + } + + public void setNomeBanco(String nomeBanco) { + this.nomeBanco = nomeBanco; + } + + public String getNumeroAgencia() { + return numeroAgencia; + } + + public void setNumeroAgencia(String numeroAgencia) { + this.numeroAgencia = numeroAgencia; + } + + public String getNumeroConta() { + return numeroConta; + } + + public void setNumeroConta(String numeroConta) { + this.numeroConta = numeroConta; + } + + public String getTipoSocio() { + return tipoSocio; + } + + public void setTipoSocio(String tipoSocio) { + this.tipoSocio = tipoSocio; + } + + public String getBairro() { + return bairro; + } + + public void setBairro(String bairro) { + this.bairro = bairro; + } + + public String getRua() { + return rua; + } + + public void setRua(String rua) { + this.rua = rua; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/configuracioneccomerciales/ConfigCoordenadas.java b/src/com/rjconsultores/ventaboletos/vo/configuracioneccomerciales/ConfigCoordenadas.java new file mode 100644 index 000000000..57ab1b970 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/configuracioneccomerciales/ConfigCoordenadas.java @@ -0,0 +1,87 @@ +package com.rjconsultores.ventaboletos.vo.configuracioneccomerciales; + +public class ConfigCoordenadas { + private String lbCampo; + private String campo; + private String mensagem; + private Integer linha; + private Integer coluna; + private Integer tamanho; + + public ConfigCoordenadas() { + super(); + } + + public String getLbCampo() { + return lbCampo; + } + + public void setLbCampo(String lbCampo) { + this.lbCampo = lbCampo; + } + + public String getCampo() { + return campo; + } + + public void setCampo(String campo) { + this.campo = campo; + } + + public Integer getLinha() { + return linha; + } + + public void setLinha(Integer linha) { + this.linha = linha; + } + + public Integer getColuna() { + return coluna; + } + + public void setColuna(Integer coluna) { + this.coluna = coluna; + } + + public String getMensagem() { + return mensagem; + } + + public void setMensagem(String mensagem) { + this.mensagem = mensagem; + } + + public Integer getTamanho() { + return tamanho; + } + + public void setTamanho(Integer tamanho) { + this.tamanho = tamanho; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((campo == null) ? 0 : campo.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfigCoordenadas other = (ConfigCoordenadas) obj; + if (campo == null) { + if (other.campo != null) + return false; + } else if (!campo.equals(other.campo)) + return false; + return true; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/corrida/ColunasConsultaCorridaVO.java b/src/com/rjconsultores/ventaboletos/vo/corrida/ColunasConsultaCorridaVO.java new file mode 100644 index 000000000..e415e9a73 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/corrida/ColunasConsultaCorridaVO.java @@ -0,0 +1,311 @@ +package com.rjconsultores.ventaboletos.vo.corrida; + +import java.math.BigDecimal; + +public class ColunasConsultaCorridaVO { + + private Integer corridaId; + private Integer numCorrida; + private String descServico; + private String fechorsalidaAtual; + private String fechorsalidaAnterior; + private Integer tiposervicioId; + private String descservicio; + private Integer roloperativoId; + private String descroloperativo; + private Integer tramoId; + private String desctramo; + private Integer origemId; + private String descOrigem; + private Integer destinoId; + private String descDestino; + private Integer viaId; + private String nombVia; + private Integer numsecuencia; + private Integer tramoIdAtual; + private String desctramoAtual; + private Integer origemIdAtual; + private String descOrigemAtual; + private Integer destinoIdAtual; + private String descDestinoAtual; + private Integer viaIdAtual; + private String nombViaAtual; + private Integer numsecuenciaAtual; + private Integer oriestado_id; + private String orinombestado; + private Integer desestado_id; + private String desnombestado; + private Integer oriciudad_id; + private String orinombciudad; + private Integer desciudad_id; + private String desnombciudad; + private String oricveestado; + private String descveestado; + private Integer rutaId; + private BigDecimal valorTarifa = BigDecimal.ZERO; + private BigDecimal valorTaxa = BigDecimal.ZERO; + private BigDecimal valorSeguro = BigDecimal.ZERO; + private BigDecimal valorPedagio = BigDecimal.ZERO; + private BigDecimal valorOutros = BigDecimal.ZERO; + + + public Integer getCorridaId() { + return corridaId; + } + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + public Integer getNumCorrida() { + return numCorrida; + } + public void setNumCorrida(Integer numCorrida) { + this.numCorrida = numCorrida; + } + public String getDescServico() { + return descServico; + } + public void setDescServico(String descServico) { + this.descServico = descServico; + } + public String getFechorsalidaAtual() { + return fechorsalidaAtual; + } + public void setFechorsalidaAtual(String fechorsalidaAtual) { + this.fechorsalidaAtual = fechorsalidaAtual; + } + public String getFechorsalidaAnterior() { + return fechorsalidaAnterior; + } + public void setFechorsalidaAnterior(String fechorsalidaAnterior) { + this.fechorsalidaAnterior = fechorsalidaAnterior; + } + public Integer getTiposervicioId() { + return tiposervicioId; + } + public void setTiposervicioId(Integer tiposervicioId) { + this.tiposervicioId = tiposervicioId; + } + public String getDescservicio() { + return descservicio; + } + public void setDescservicio(String descservicio) { + this.descservicio = descservicio; + } + public Integer getRoloperativoId() { + return roloperativoId; + } + public void setRoloperativoId(Integer roloperativoId) { + this.roloperativoId = roloperativoId; + } + public String getDescroloperativo() { + return descroloperativo; + } + public void setDescroloperativo(String descroloperativo) { + this.descroloperativo = descroloperativo; + } + public Integer getTramoId() { + return tramoId; + } + public void setTramoId(Integer tramoId) { + this.tramoId = tramoId; + } + public String getDesctramo() { + return desctramo; + } + public void setDesctramo(String desctramo) { + this.desctramo = desctramo; + } + public Integer getOrigemId() { + return origemId; + } + public void setOrigemId(Integer origemId) { + this.origemId = origemId; + } + public String getDescOrigem() { + return descOrigem; + } + public void setDescOrigem(String descOrigem) { + this.descOrigem = descOrigem; + } + public Integer getDestinoId() { + return destinoId; + } + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + public String getDescDestino() { + return descDestino; + } + public void setDescDestino(String descDestino) { + this.descDestino = descDestino; + } + public Integer getViaId() { + return viaId; + } + public void setViaId(Integer viaId) { + this.viaId = viaId; + } + public String getNombVia() { + return nombVia; + } + public void setNombVia(String nombVia) { + this.nombVia = nombVia; + } + public Integer getNumsecuencia() { + return numsecuencia; + } + public void setNumsecuencia(Integer numsecuencia) { + this.numsecuencia = numsecuencia; + } + public Integer getTramoIdAtual() { + return tramoIdAtual; + } + public void setTramoIdAtual(Integer tramoIdAtual) { + this.tramoIdAtual = tramoIdAtual; + } + public String getDesctramoAtual() { + return desctramoAtual; + } + public void setDesctramoAtual(String desctramoAtual) { + this.desctramoAtual = desctramoAtual; + } + public Integer getOrigemIdAtual() { + return origemIdAtual; + } + public void setOrigemIdAtual(Integer origemIdAtual) { + this.origemIdAtual = origemIdAtual; + } + public String getDescOrigemAtual() { + return descOrigemAtual; + } + public void setDescOrigemAtual(String descOrigemAtual) { + this.descOrigemAtual = descOrigemAtual; + } + public Integer getDestinoIdAtual() { + return destinoIdAtual; + } + public void setDestinoIdAtual(Integer destinoIdAtual) { + this.destinoIdAtual = destinoIdAtual; + } + public String getDescDestinoAtual() { + return descDestinoAtual; + } + public void setDescDestinoAtual(String descDestinoAtual) { + this.descDestinoAtual = descDestinoAtual; + } + public Integer getViaIdAtual() { + return viaIdAtual; + } + public void setViaIdAtual(Integer viaIdAtual) { + this.viaIdAtual = viaIdAtual; + } + public String getNombViaAtual() { + return nombViaAtual; + } + public void setNombViaAtual(String nombViaAtual) { + this.nombViaAtual = nombViaAtual; + } + public Integer getNumsecuenciaAtual() { + return numsecuenciaAtual; + } + public void setNumsecuenciaAtual(Integer numsecuenciaAtual) { + this.numsecuenciaAtual = numsecuenciaAtual; + } + public Integer getOriestado_id() { + return oriestado_id; + } + public void setOriestado_id(Integer oriestado_id) { + this.oriestado_id = oriestado_id; + } + public String getOrinombestado() { + return orinombestado; + } + public void setOrinombestado(String orinombestado) { + this.orinombestado = orinombestado; + } + public Integer getDesestado_id() { + return desestado_id; + } + public void setDesestado_id(Integer desestado_id) { + this.desestado_id = desestado_id; + } + public String getDesnombestado() { + return desnombestado; + } + public void setDesnombestado(String desnombestado) { + this.desnombestado = desnombestado; + } + public Integer getOriciudad_id() { + return oriciudad_id; + } + public void setOriciudad_id(Integer oriciudad_id) { + this.oriciudad_id = oriciudad_id; + } + public String getOrinombciudad() { + return orinombciudad; + } + public void setOrinombciudad(String orinombciudad) { + this.orinombciudad = orinombciudad; + } + public Integer getDesciudad_id() { + return desciudad_id; + } + public void setDesciudad_id(Integer desciudad_id) { + this.desciudad_id = desciudad_id; + } + public String getDesnombciudad() { + return desnombciudad; + } + public void setDesnombciudad(String desnombciudad) { + this.desnombciudad = desnombciudad; + } + public String getOricveestado() { + return oricveestado; + } + public void setOricveestado(String oricveestado) { + this.oricveestado = oricveestado; + } + public String getDescveestado() { + return descveestado; + } + public void setDescveestado(String descveestado) { + this.descveestado = descveestado; + } + public Integer getRutaId() { + return rutaId; + } + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + public BigDecimal getValorTarifa() { + return valorTarifa; + } + public void setValorTarifa(BigDecimal valorTarifa) { + this.valorTarifa = valorTarifa; + } + public BigDecimal getValorTaxa() { + return valorTaxa; + } + public void setValorTaxa(BigDecimal valorTaxa) { + this.valorTaxa = valorTaxa; + } + public BigDecimal getValorSeguro() { + return valorSeguro; + } + public void setValorSeguro(BigDecimal valorSeguro) { + this.valorSeguro = valorSeguro; + } + public BigDecimal getValorPedagio() { + return valorPedagio; + } + public void setValorPedagio(BigDecimal valorPedagio) { + this.valorPedagio = valorPedagio; + } + public BigDecimal getValorOutros() { + return valorOutros; + } + public void setValorOutros(BigDecimal valorOutros) { + this.valorOutros = valorOutros; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/corrida/CorridaVO.java b/src/com/rjconsultores/ventaboletos/vo/corrida/CorridaVO.java new file mode 100644 index 000000000..ea09b73c1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/corrida/CorridaVO.java @@ -0,0 +1,273 @@ +package com.rjconsultores.ventaboletos.vo.corrida; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Corrida; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.vo.roloperativo.RolOperativoVO; +import com.rjconsultores.ventaboletos.vo.secuencia.SecuenciaVO; +import com.rjconsultores.ventaboletos.vo.tiposervicio.TipoServicioVO; +import com.rjconsultores.ventaboletos.vo.tramo.TramoVO; + +public class CorridaVO { + private Integer corridaId; + private String feccorrida; + private Integer numCorrida; + private String descServico; + private String fechorsalida; + private Integer origenId; + private Integer destinoId; + private String descOrigen; + private String descDestino; + private String oricveestado; + private String descveestado; + private Integer rutaId; + private Integer claseServicioId; + private Integer marcaId; + private Integer empresaId; + private TipoServicioVO tipoServicioVO; + private RolOperativoVO rolOperativoVO; + private List lsTramoVO; + private List lsSecuenciaVO; + //campos usados nas consultas resumidas + private Integer tipoServicioId; + private Integer rolOperativoId; + private List listTramos; + private String chaveCorrida; + private boolean tarifaEmbarcada; + + public CorridaVO() { + super(); + } + + public CorridaVO( Corrida corrida ) { + super(); + this.corridaId = corrida.getId().getCorridaId(); + this.feccorrida = DateUtil.getStringDate( corrida.getId().getFeccorrida()); + this.numCorrida = corrida.getId().getCorridaId(); + this.fechorsalida = DateUtil.getStringDate(corrida.getFechorsalida(), "dd/MM/yyyy HH:mm:ss.SSS"); + this.origenId = corrida.getOrigem().getParadaId(); + this.destinoId = corrida.getDestino().getParadaId(); + this.tipoServicioId = corrida.getTipoServicio().intValue(); + this.rolOperativoId = corrida.getRolOperativo().getRoloperativoId(); + this.marcaId = corrida.getMarca().getMarcaId().intValue(); + this.claseServicioId = corrida.getClaseServicio().getClaseservicioId(); + this.empresaId = corrida.getEmpresa().getEmpresaId(); + this.rutaId = corrida.getRuta().getRutaId(); + this.tarifaEmbarcada = corrida.getEmpresa().getIndTabelaPrecoEmbarcada(); + } + + public CorridaVO(Integer corridaId, Integer numCorrida, String descServico, String fechorsalida, + Integer tiposervicioId, String descservicio, Integer roloperativoId, String descroloperativo, + List lsTramoVO, List lsSecuenciaVO, Integer rutaId, Integer origenId, + Integer destinoId, String descOrigen, String descDestino, String oricveestado, String descveestado) { + this.corridaId = corridaId; + this.numCorrida = numCorrida; + this.descServico = descServico; + this.fechorsalida = fechorsalida; + this.tipoServicioVO = new TipoServicioVO(tiposervicioId, descservicio); + this.rolOperativoVO = new RolOperativoVO(roloperativoId, descroloperativo); + this.lsTramoVO = lsTramoVO; + this.lsSecuenciaVO = lsSecuenciaVO; + this.rutaId = rutaId; + this.origenId = origenId; + this.descOrigen = descOrigen; + this.destinoId = destinoId; + this.descDestino = descDestino; + this.oricveestado = oricveestado; + this.descveestado = descveestado; + } + + public Integer getCorridaId() { + return corridaId; + } + + public void setCorridaId(Integer corridaId) { + this.corridaId = corridaId; + } + + public Integer getNumCorrida() { + return numCorrida; + } + + public void setNumCorrida(Integer numCorrida) { + this.numCorrida = numCorrida; + } + + public String getDescServico() { + return descServico; + } + + public void setDescServico(String descServico) { + this.descServico = descServico; + } + + public String getFechorsalida() { + return fechorsalida; + } + + public void setFechorsalida(String fechorsalida) { + this.fechorsalida = fechorsalida; + } + + public TipoServicioVO getTipoServicioVO() { + return tipoServicioVO; + } + + public void setTipoServicioVO(TipoServicioVO tipoServicioVO) { + this.tipoServicioVO = tipoServicioVO; + } + + public RolOperativoVO getRolOperativoVO() { + return rolOperativoVO; + } + + public void setRolOperativoVO(RolOperativoVO rolOperativoVO) { + this.rolOperativoVO = rolOperativoVO; + } + + public List getLsTramoVO() { + return lsTramoVO; + } + + public void setLsTramoVO(List lsTramoVO) { + this.lsTramoVO = lsTramoVO; + } + + public List getLsSecuenciaVO() { + return lsSecuenciaVO; + } + + public void setLsSecuenciaVO(List lsSecuenciaVO) { + this.lsSecuenciaVO = lsSecuenciaVO; + } + + public Integer getRutaId() { + return rutaId; + } + + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public String getDescOrigen() { + return descOrigen; + } + + public void setDescOrigen(String descOrigen) { + this.descOrigen = descOrigen; + } + + public String getDescDestino() { + return descDestino; + } + + public void setDescDestino(String descDestino) { + this.descDestino = descDestino; + } + + public String getOricveestado() { + return oricveestado; + } + + public void setOricveestado(String oricveestado) { + this.oricveestado = oricveestado; + } + + public String getDescveestado() { + return descveestado; + } + + public void setDescveestado(String descveestado) { + this.descveestado = descveestado; + } + + public Integer getClaseServicioId() { + return claseServicioId; + } + + public void setClaseServicioId(Integer claseServicioId) { + this.claseServicioId = claseServicioId; + } + + public Integer getMarcaId() { + return marcaId; + } + + public void setMarcaId(Integer marcaId) { + this.marcaId = marcaId; + } + + public String getFeccorrida() { + return feccorrida; + } + + public void setFeccorrida(String feccorrida) { + this.feccorrida = feccorrida; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public Integer getTipoServicioId() { + return tipoServicioId; + } + + public void setTipoServicioId(Integer tipoServicioId) { + this.tipoServicioId = tipoServicioId; + } + + public Integer getRolOperativoId() { + return rolOperativoId; + } + + public void setRolOperativoId(Integer rolOperativoId) { + this.rolOperativoId = rolOperativoId; + } + + public List getListTramos() { + return listTramos; + } + + public void setListTramos(List listTramos) { + this.listTramos = listTramos; + } + + public String getChaveCorrida() { + return chaveCorrida; + } + + public void setChaveCorrida(String chaveCorrida) { + this.chaveCorrida = chaveCorrida; + } + + public boolean isTarifaEmbarcada() { + return tarifaEmbarcada; + } + + public void setTarifaEmbarcada(boolean tarifaEmbarcada) { + this.tarifaEmbarcada = tarifaEmbarcada; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/corrida/TramoSequenciaVO.java b/src/com/rjconsultores/ventaboletos/vo/corrida/TramoSequenciaVO.java new file mode 100644 index 000000000..aa376237f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/corrida/TramoSequenciaVO.java @@ -0,0 +1,236 @@ +package com.rjconsultores.ventaboletos.vo.corrida; + +import java.math.BigDecimal; + +public class TramoSequenciaVO { + private Integer tramoId; + private String desctramo; + private Integer origemId; + private String descOrigem; + private Integer cidadeOrigemId; + private String nomeCidadeOrigem; + private Integer estadoOrigemId; + private String nomeEstadoOrigem; + private String cveEstadoOrigem; + private Integer destinoId; + private String descDestino; + private Integer cidadeDestinoId; + private String nomeCidadeDestino; + private Integer estadoDestinoId; + private String nomeEstadoDestino; + private String cveEstadoDestino; + private Integer viaId; + private String nomeVia; + private Integer sequencia; + private BigDecimal importeTaxaEmbarque; + private BigDecimal importePedagio; + private BigDecimal importeOutros; + private BigDecimal importeSeguro; + private BigDecimal precio; + private BigDecimal tarifaMinima; + + public TramoSequenciaVO() { + + } + + public Integer getTramoId() { + return tramoId; + } + + public void setTramoId(Integer tramoId) { + this.tramoId = tramoId; + } + + public String getDesctramo() { + return desctramo; + } + + public void setDesctramo(String desctramo) { + this.desctramo = desctramo; + } + + public Integer getOrigemId() { + return origemId; + } + + public void setOrigemId(Integer origemId) { + this.origemId = origemId; + } + + public String getDescOrigem() { + return descOrigem; + } + + public void setDescOrigem(String descOrigem) { + this.descOrigem = descOrigem; + } + + public Integer getCidadeOrigemId() { + return cidadeOrigemId; + } + + public void setCidadeOrigemId(Integer cidadeOrigemId) { + this.cidadeOrigemId = cidadeOrigemId; + } + + public String getNomeCidadeOrigem() { + return nomeCidadeOrigem; + } + + public void setNomeCidadeOrigem(String nomeCidadeOrigem) { + this.nomeCidadeOrigem = nomeCidadeOrigem; + } + + public Integer getEstadoOrigemId() { + return estadoOrigemId; + } + + public void setEstadoOrigemId(Integer estadoOrigemId) { + this.estadoOrigemId = estadoOrigemId; + } + + public String getNomeEstadoOrigem() { + return nomeEstadoOrigem; + } + + public void setNomeEstadoOrigem(String nomeEstadoOrigem) { + this.nomeEstadoOrigem = nomeEstadoOrigem; + } + + public String getCveEstadoOrigem() { + return cveEstadoOrigem; + } + + public void setCveEstadoOrigem(String cveEstadoOrigem) { + this.cveEstadoOrigem = cveEstadoOrigem; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public String getDescDestino() { + return descDestino; + } + + public void setDescDestino(String descDestino) { + this.descDestino = descDestino; + } + + public Integer getCidadeDestinoId() { + return cidadeDestinoId; + } + + public void setCidadeDestinoId(Integer cidadeDestinoId) { + this.cidadeDestinoId = cidadeDestinoId; + } + + public String getNomeCidadeDestino() { + return nomeCidadeDestino; + } + + public void setNomeCidadeDestino(String nomeCidadeDestino) { + this.nomeCidadeDestino = nomeCidadeDestino; + } + + public Integer getEstadoDestinoId() { + return estadoDestinoId; + } + + public void setEstadoDestinoId(Integer estadoDestinoId) { + this.estadoDestinoId = estadoDestinoId; + } + + public String getNomeEstadoDestino() { + return nomeEstadoDestino; + } + + public void setNomeEstadoDestino(String nomeEstadoDestino) { + this.nomeEstadoDestino = nomeEstadoDestino; + } + + public String getCveEstadoDestino() { + return cveEstadoDestino; + } + + public void setCveEstadoDestino(String cveEstadoDestino) { + this.cveEstadoDestino = cveEstadoDestino; + } + + public Integer getViaId() { + return viaId; + } + + public void setViaId(Integer viaId) { + this.viaId = viaId; + } + + public String getNomeVia() { + return nomeVia; + } + + public void setNomeVia(String nomeVia) { + this.nomeVia = nomeVia; + } + + public Integer getSequencia() { + return sequencia; + } + + public void setSequencia(Integer sequencia) { + this.sequencia = sequencia; + } + + public BigDecimal getImporteTaxaEmbarque() { + return importeTaxaEmbarque; + } + + public void setImporteTaxaEmbarque(BigDecimal importeTaxaEmbarque) { + this.importeTaxaEmbarque = importeTaxaEmbarque; + } + + public BigDecimal getImportePedagio() { + return importePedagio; + } + + public void setImportePedagio(BigDecimal importePedagio) { + this.importePedagio = importePedagio; + } + + public BigDecimal getImporteOutros() { + return importeOutros; + } + + public void setImporteOutros(BigDecimal importeOutros) { + this.importeOutros = importeOutros; + } + + public BigDecimal getImporteSeguro() { + return importeSeguro; + } + + public void setImporteSeguro(BigDecimal importeSeguro) { + this.importeSeguro = importeSeguro; + } + + public BigDecimal getPrecio() { + return precio; + } + + public void setPrecio(BigDecimal precio) { + this.precio = precio; + } + + public BigDecimal getTarifaMinima() { + return tarifaMinima; + } + + public void setTarifaMinima(BigDecimal tarifaMinima) { + this.tarifaMinima = tarifaMinima; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/AutorizacaoUsoSerieEmbarcadaVO.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/AutorizacaoUsoSerieEmbarcadaVO.java new file mode 100644 index 000000000..f6c22f82c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/AutorizacaoUsoSerieEmbarcadaVO.java @@ -0,0 +1,133 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +public class AutorizacaoUsoSerieEmbarcadaVO { + private Long id; + private String empresa; + private String uf; + private String serie; + private String numero; + private String descricao; + private String registro; + private String mac; + private String bloqueado; + private String manutencao; + private String baixado; + private String agencia; + private String ultimoAcessoUsuario; + private String ultimoAcessoDataHora; + + public AutorizacaoUsoSerieEmbarcadaVO() { + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public String getUf() { + return uf; + } + + public void setUf(String uf) { + this.uf = uf; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public String getRegistro() { + return registro; + } + + public void setRegistro(String registro) { + this.registro = registro; + } + + public String getMac() { + return mac; + } + + public void setMac(String mac) { + this.mac = mac; + } + + public String getBloqueado() { + return bloqueado; + } + + public void setBloqueado(String bloqueado) { + this.bloqueado = bloqueado; + } + + public String getManutencao() { + return manutencao; + } + + public void setManutencao(String manutencao) { + this.manutencao = manutencao; + } + + public String getBaixado() { + return baixado; + } + + public void setBaixado(String baixado) { + this.baixado = baixado; + } + + public String getAgencia() { + return agencia; + } + + public void setAgencia(String agencia) { + this.agencia = agencia; + } + + public String getUltimoAcessoUsuario() { + return ultimoAcessoUsuario; + } + + public void setUltimoAcessoUsuario(String ultimoAcessoUsuario) { + this.ultimoAcessoUsuario = ultimoAcessoUsuario; + } + + public String getUltimoAcessoDataHora() { + return ultimoAcessoDataHora; + } + + public void setUltimoAcessoDataHora(String ultimoAcessoDataHora) { + this.ultimoAcessoDataHora = ultimoAcessoDataHora; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/CidadeVO.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/CidadeVO.java new file mode 100644 index 000000000..4cd00b288 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/CidadeVO.java @@ -0,0 +1,21 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +public class CidadeVO { + private Integer ciudadId; + private String nombciudad; + + public Integer getCiudadId() { + return ciudadId; + } + public void setCiudadId(Integer ciudadId) { + this.ciudadId = ciudadId; + } + public String getNombciudad() { + return nombciudad; + } + public void setNombciudad(String nombciudad) { + this.nombciudad = nombciudad; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/DetalheCorridaVO.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/DetalheCorridaVO.java new file mode 100644 index 000000000..e1dbe7ab2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/DetalheCorridaVO.java @@ -0,0 +1,31 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +import java.util.List; + +import com.rjconsultores.ventaboletos.vo.secuencia.SecuenciaVO; +import com.rjconsultores.ventaboletos.vo.tramo.TramoVO; + +public class DetalheCorridaVO { + private List lsTramoVO; + private List lsSecuenciaVO; + + public DetalheCorridaVO() { + + } + + public List getLsTramoVO() { + return lsTramoVO; + } + + public void setLsTramoVO(List lsTramoVO) { + this.lsTramoVO = lsTramoVO; + } + + public List getLsSecuenciaVO() { + return lsSecuenciaVO; + } + + public void setLsSecuenciaVO(List lsSecuenciaVO) { + this.lsSecuenciaVO = lsSecuenciaVO; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/DispositivoEmbarcadaVO.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/DispositivoEmbarcadaVO.java new file mode 100644 index 000000000..82c3ea43c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/DispositivoEmbarcadaVO.java @@ -0,0 +1,212 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +import java.util.ArrayList; +import java.util.List; + +public class DispositivoEmbarcadaVO { + private Long dispositivoId; + private Long idAgencia; + private String descAgencia; + private String numagencia; + private String descEquipamento; + private Integer bloqueado; + private Integer manutencao; + private Integer baixado; + private Long idempresa; + private String descEmpresa; + private List estados = new ArrayList(); + private String cnpjAgencia; + private String enderecoAgencia; + private String cnpjEmpresa; + private String enderecoEmpresa; + private String msg; + private Integer estacionId; + private List empresasVenda = new ArrayList(); + private List lsFormasPagamento; + private List lsSeguroTaxaEmbarque; + private List lsTiposPassagensBloqueadas; + private Boolean indVendeNaoBpe; + private String versaoUltimaSinc; + private String dataUltimaSinc; + + + public void add(EstadoDispositivoEmbarcadaVO estado){ + estados.add(estado); + } + + public Long getIdAgencia() { + return idAgencia; + } + public void setIdAgencia(Long idAgencia) { + this.idAgencia = idAgencia; + } + public String getDescAgencia() { + return descAgencia; + } + public void setDescAgencia(String descAgencia) { + this.descAgencia = descAgencia; + } + public String getDescEquipamento() { + return descEquipamento; + } + public void setDescEquipamento(String descEquipamento) { + this.descEquipamento = descEquipamento; + } + public Integer getBloqueado() { + return bloqueado; + } + public void setBloqueado(Integer bloqueado) { + this.bloqueado = bloqueado; + } + public Integer getManutencao() { + return manutencao; + } + public void setManutencao(Integer manutencao) { + this.manutencao = manutencao; + } + public Integer getBaixado() { + return baixado; + } + public void setBaixado(Integer baixado) { + this.baixado = baixado; + } + public Long getIdempresa() { + return idempresa; + } + public void setIdempresa(Long idempresa) { + this.idempresa = idempresa; + } + public String getDescEmpresa() { + return descEmpresa; + } + public void setDescEmpresa(String descEmpresa) { + this.descEmpresa = descEmpresa; + } + public List getEstados() { + return estados; + } + public void setEstados(List estados) { + this.estados = estados; + } + + public String getCnpjAgencia() { + return cnpjAgencia; + } + + public void setCnpjAgencia(String cnpjAgencia) { + this.cnpjAgencia = cnpjAgencia; + } + + public String getEnderecoAgencia() { + return enderecoAgencia; + } + + public void setEnderecoAgencia(String enderecoAgencia) { + this.enderecoAgencia = enderecoAgencia; + } + + public String getCnpjEmpresa() { + return cnpjEmpresa; + } + + public void setCnpjEmpresa(String cnpjEmpresa) { + this.cnpjEmpresa = cnpjEmpresa; + } + + public String getEnderecoEmpresa() { + return enderecoEmpresa; + } + + public void setEnderecoEmpresa(String enderecoEmpresa) { + this.enderecoEmpresa = enderecoEmpresa; + } + + public Long getDispositivoId() { + return dispositivoId; + } + + public void setDispositivoId(Long dispositivoId) { + this.dispositivoId = dispositivoId; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public Integer getEstacionId() { + return estacionId; + } + + public void setEstacionId(Integer estacionId) { + this.estacionId = estacionId; + } + + public List getEmpresasVenda() { + return empresasVenda; + } + + public void setEmpresasVenda(List empresasVenda) { + this.empresasVenda = empresasVenda; + } + + public String getNumagencia() { + return numagencia; + } + + public void setNumagencia(String numagencia) { + this.numagencia = numagencia; + } + + public Boolean getIndVendeNaoBpe() { + return indVendeNaoBpe; + } + + public void setIndVendeNaoBpe(Boolean indVendeNaoBpe) { + this.indVendeNaoBpe = indVendeNaoBpe; + } + + public String getVersaoUltimaSinc() { + return versaoUltimaSinc; + } + + public void setVersaoUltimaSinc(String versaoUltimaSinc) { + this.versaoUltimaSinc = versaoUltimaSinc; + } + + public String getDataUltimaSinc() { + return dataUltimaSinc; + } + + public void setDataUltimaSinc(String dataUltimaSinc) { + this.dataUltimaSinc = dataUltimaSinc; + } + + public List getLsFormasPagamento() { + return lsFormasPagamento; + } + + public void setLsFormasPagamento(List lsFormasPagamento) { + this.lsFormasPagamento = lsFormasPagamento; + } + + public List getLsSeguroTaxaEmbarque() { + return lsSeguroTaxaEmbarque; + } + + public void setLsSeguroTaxaEmbarque(List lsSeguroTaxaEmbarque) { + this.lsSeguroTaxaEmbarque = lsSeguroTaxaEmbarque; + } + + public List getLsTiposPassagensBloqueadas() { + return lsTiposPassagensBloqueadas; + } + + public void setLsTiposPassagensBloqueadas(List lsTiposPassagensBloqueadas) { + this.lsTiposPassagensBloqueadas = lsTiposPassagensBloqueadas; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/EmpresaVO.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/EmpresaVO.java new file mode 100644 index 000000000..7438b2d97 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/EmpresaVO.java @@ -0,0 +1,82 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +import java.util.ArrayList; +import java.util.List; + +public class EmpresaVO { + private Long empresaId; + private String nombempresa; + private String cnpj; + private Boolean indImprimeRelFechamentoViagemDetalhadoEmarcada; + private Boolean indImprimeLogoBilheteVendaEmbarcada; + private Boolean indImpressaoCanhotoEmbarcada; + private Boolean indSegundaViaFechamentoCaixa; + + private List inscricoesEstaduais = new ArrayList(); + + public Long getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Long empresaId) { + this.empresaId = empresaId; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public List getInscricoesEstaduais() { + return inscricoesEstaduais; + } + + public void setInscricoesEstaduais(List inscricoesEstaduais) { + this.inscricoesEstaduais = inscricoesEstaduais; + } + + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + public Boolean getIndImprimeRelFechamentoViagemDetalhadoEmarcada() { + return indImprimeRelFechamentoViagemDetalhadoEmarcada; + } + + public void setIndImprimeRelFechamentoViagemDetalhadoEmarcada(Boolean indImprimeRelFechamentoViagemDetalhadoEmarcada) { + this.indImprimeRelFechamentoViagemDetalhadoEmarcada = indImprimeRelFechamentoViagemDetalhadoEmarcada; + } + + public Boolean getIndImprimeLogoBilheteVendaEmbarcada() { + return indImprimeLogoBilheteVendaEmbarcada; + } + + public void setIndImprimeLogoBilheteVendaEmbarcada(Boolean indImprimeLogoBilheteVendaEmbarcada) { + this.indImprimeLogoBilheteVendaEmbarcada = indImprimeLogoBilheteVendaEmbarcada; + } + + public Boolean getIndImpressaoCanhotoEmbarcada() { + return indImpressaoCanhotoEmbarcada; + } + + public void setIndImpressaoCanhotoEmbarcada(Boolean indImpressaoCanhotoEmbarcada) { + this.indImpressaoCanhotoEmbarcada = indImpressaoCanhotoEmbarcada; + } + + public Boolean getIndSegundaViaFechamentoCaixa() { + return indSegundaViaFechamentoCaixa ==null ? Boolean.FALSE : indSegundaViaFechamentoCaixa; + } + + public void setIndSegundaViaFechamentoCaixa(Boolean indSegundaViaFechamentoCaixa) { + this.indSegundaViaFechamentoCaixa = indSegundaViaFechamentoCaixa; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/EstadoDispositivoEmbarcadaVO.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/EstadoDispositivoEmbarcadaVO.java new file mode 100644 index 000000000..7e7d4163b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/EstadoDispositivoEmbarcadaVO.java @@ -0,0 +1,40 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +public class EstadoDispositivoEmbarcadaVO { + private Long idUf; + private String descUf; + private String serie; + private String numBpe; + private Long empresaId; + + public Long getIdUf() { + return idUf; + } + public void setIdUf(Long idUf) { + this.idUf = idUf; + } + public String getDescUf() { + return descUf; + } + public void setDescUf(String descUf) { + this.descUf = descUf; + } + public String getSerie() { + return serie; + } + public void setSerie(String serie) { + this.serie = serie; + } + public String getNumBpe() { + return numBpe; + } + public void setNumBpe(String numBpe) { + this.numBpe = numBpe; + } + public Long getEmpresaId() { + return empresaId; + } + public void setEmpresaId(Long empresaId) { + this.empresaId = empresaId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/FormaPagamentoVO.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/FormaPagamentoVO.java new file mode 100644 index 000000000..0f5c91cb6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/FormaPagamentoVO.java @@ -0,0 +1,63 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +public class FormaPagamentoVO { + private Integer empresaId; + private String nombempresa; + private Integer formapagoId; + private String descpago; + private String descTipoFormaPago; + + + public FormaPagamentoVO() { + + } + + public FormaPagamentoVO(Integer empresaId, String nombempresa, Integer formapagoId, String descpago, String descTipoFormaPago) { + super(); + this.empresaId = empresaId; + this.nombempresa = nombempresa; + this.formapagoId = formapagoId; + this.descpago = descpago; + this.descTipoFormaPago = descTipoFormaPago; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public Integer getFormapagoId() { + return formapagoId; + } + + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + + public String getDescpago() { + return descpago; + } + + public void setDescpago(String descpago) { + this.descpago = descpago; + } + + public String getDescTipoFormaPago() { + return descTipoFormaPago; + } + + public void setDescTipoFormaPago(String descTipoFormaPago) { + this.descTipoFormaPago = descTipoFormaPago; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/InscricaoEstadualVO.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/InscricaoEstadualVO.java new file mode 100644 index 000000000..d0d9f2689 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/InscricaoEstadualVO.java @@ -0,0 +1,175 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +import java.math.BigDecimal; +import java.util.Date; + +import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual; + +public class InscricaoEstadualVO { + private Long inscricaoestadualId; + + private EstadoDispositivoEmbarcadaVO estado; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private String numInscricaoEstadual; + private String logradouro; + private String numero; + private String complemento; + private String cep; + private String bairro; + private CidadeVO cidade; + private String cnpj; + private String equivalenciaAG; + private Boolean isBPe; + private BigDecimal porctributo; + private BigDecimal tributacaoImportacao; + private BigDecimal tributacaoImportacaoIM; + + public InscricaoEstadualVO(){} + + public InscricaoEstadualVO(InscricaoEstadual insc){ + this.activo = insc.getActivo(); + this.bairro = insc.getBairro(); + this.cep = insc.getCep(); + this.cidade = new CidadeVO(); + if (insc.getCidade() != null){ + this.cidade.setCiudadId(insc.getCidade().getCiudadId()); + this.cidade.setNombciudad(insc.getCidade().getNombciudad()); + } + this.cnpj = insc.getCnpj(); + this.complemento = insc.getComplemento(); + this.equivalenciaAG = insc.getEquivalenciaAG(); + this.estado = new EstadoDispositivoEmbarcadaVO(); + if (insc.getEstado() != null){ + this.estado.setDescUf(insc.getEstado().getNombestado()); + this.estado.setIdUf(insc.getEstado().getEstadoId().longValue()); + } + this.fecmodif = insc.getFecmodif(); + this.inscricaoestadualId = insc.getInscricaoestadualId(); + this.isBPe = insc.getIsBPe(); + this.logradouro = insc.getLogradouro(); + this.numero = insc.getNumero(); + this.numInscricaoEstadual = insc.getNumInscricaoEstadual(); + this.usuarioId = insc.getUsuarioId(); + } + + public Long getInscricaoestadualId() { + return inscricaoestadualId; + } + public void setInscricaoestadualId(Long inscricaoestadualId) { + this.inscricaoestadualId = inscricaoestadualId; + } + + public EstadoDispositivoEmbarcadaVO getEstado() { + return estado; + } + + public void setEstado(EstadoDispositivoEmbarcadaVO estado) { + this.estado = estado; + } + + public Boolean getActivo() { + return activo; + } + public void setActivo(Boolean activo) { + this.activo = activo; + } + public Date getFecmodif() { + return fecmodif; + } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + public Integer getUsuarioId() { + return usuarioId; + } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + public String getNumInscricaoEstadual() { + return numInscricaoEstadual; + } + public void setNumInscricaoEstadual(String numInscricaoEstadual) { + this.numInscricaoEstadual = numInscricaoEstadual; + } + public String getLogradouro() { + return logradouro; + } + public void setLogradouro(String logradouro) { + this.logradouro = logradouro; + } + public String getNumero() { + return numero; + } + public void setNumero(String numero) { + this.numero = numero; + } + public String getComplemento() { + return complemento; + } + public void setComplemento(String complemento) { + this.complemento = complemento; + } + public String getCep() { + return cep; + } + public void setCep(String cep) { + this.cep = cep; + } + public String getBairro() { + return bairro; + } + public void setBairro(String bairro) { + this.bairro = bairro; + } + public CidadeVO getCidade() { + return cidade; + } + public void setCidade(CidadeVO cidade) { + this.cidade = cidade; + } + public String getCnpj() { + return cnpj; + } + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + public String getEquivalenciaAG() { + return equivalenciaAG; + } + public void setEquivalenciaAG(String equivalenciaAG) { + this.equivalenciaAG = equivalenciaAG; + } + public Boolean getIsBPe() { + return isBPe; + } + public void setIsBPe(Boolean isBPe) { + this.isBPe = isBPe; + } + + public BigDecimal getPorctributo() { + return porctributo; + } + + public void setPorctributo(BigDecimal porctributo) { + this.porctributo = porctributo; + } + + public BigDecimal getTributacaoImportacao() { + return tributacaoImportacao; + } + + public void setTributacaoImportacao(BigDecimal tributacaoImportacao) { + this.tributacaoImportacao = tributacaoImportacao; + } + + public BigDecimal getTributacaoImportacaoIM() { + return tributacaoImportacaoIM; + } + + public void setTributacaoImportacaoIM(BigDecimal tributacaoImportacaoIM) { + this.tributacaoImportacaoIM = tributacaoImportacaoIM; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/OperadorEmbarcadaVO.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/OperadorEmbarcadaVO.java new file mode 100644 index 000000000..4d6078c94 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/OperadorEmbarcadaVO.java @@ -0,0 +1,115 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +import java.util.List; + +import com.rjconsultores.ventaboletos.vo.corrida.CorridaVO; +import com.rjconsultores.ventaboletos.vo.ruta.RutaVO; + +public class OperadorEmbarcadaVO { + private Integer idOperador; + private String operador; + private String descOperador; + private Integer idAgencia; + private String descAgencia; + private Boolean indcorteautomatico; + private ListlsRutas; + private ListlsCorridas; + private List lsFormasPagamento; + private List lsSeguroTaxaEmbarque; + private List lsTiposPassagensBloqueadas; + //lista usadas nas consultas resumidas + private ListlistRutas; + private ListlistCorridas; + + public Integer getIdOperador() { + return idOperador; + } + public void setIdOperador(Integer idOperador) { + this.idOperador = idOperador; + } + public String getOperador() { + return operador; + } + public void setOperador(String operador) { + this.operador = operador; + } + public String getDescOperador() { + return descOperador; + } + public void setDescOperador(String descOperador) { + this.descOperador = descOperador; + } + public Integer getIdAgencia() { + return idAgencia; + } + public void setIdAgencia(Integer idAgencia) { + this.idAgencia = idAgencia; + } + public String getDescAgencia() { + return descAgencia; + } + public void setDescAgencia(String descAgencia) { + this.descAgencia = descAgencia; + } + public List getLsRutas() { + return lsRutas; + } + public void setLsRutas(List lsRutas) { + this.lsRutas = lsRutas; + } + public List getLsCorridas() { + return lsCorridas; + } + public void setLsCorridas(List lsCorridas) { + this.lsCorridas = lsCorridas; + } + + public Boolean getIndcorteautomatico() { + return indcorteautomatico; + } + + public void setIndcorteautomatico(Boolean indcorteautomatico) { + this.indcorteautomatico = indcorteautomatico; + } + + public List getListCorridas() { + return listCorridas; + } + + public void setListCorridas(List listCorridas) { + this.listCorridas = listCorridas; + } + + public List getListRutas() { + return listRutas; + } + + public void setListRutas(List listRutas) { + this.listRutas = listRutas; + } + + public List getLsFormasPagamento() { + return lsFormasPagamento; + } + + public void setLsFormasPagamento(List lsFormasPagamento) { + this.lsFormasPagamento = lsFormasPagamento; + } + + public List getLsSeguroTaxaEmbarque() { + return lsSeguroTaxaEmbarque; + } + + public void setLsSeguroTaxaEmbarque(List lsSeguroTaxaEmbarque) { + this.lsSeguroTaxaEmbarque = lsSeguroTaxaEmbarque; + } + + public List getLsTiposPassagensBloqueadas() { + return lsTiposPassagensBloqueadas; + } + + public void setLsTiposPassagensBloqueadas(List lsTiposPassagensBloqueadas) { + this.lsTiposPassagensBloqueadas = lsTiposPassagensBloqueadas; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/PtoVtaUsuarioUltimaVendaDispositivoVO.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/PtoVtaUsuarioUltimaVendaDispositivoVO.java new file mode 100644 index 000000000..5f160c183 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/PtoVtaUsuarioUltimaVendaDispositivoVO.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +public class PtoVtaUsuarioUltimaVendaDispositivoVO { + private Long puntoventaId; + private Long usuarioId; + private String nombusuario; + private String nombpuntoventa; + private String imei; + + public PtoVtaUsuarioUltimaVendaDispositivoVO(){} + + public PtoVtaUsuarioUltimaVendaDispositivoVO(Long puntoventaId, Long usuarioId, String nombusuario, String nombpuntoventa, String imei) { + super(); + this.puntoventaId = puntoventaId; + this.usuarioId = usuarioId; + this.nombusuario = nombusuario; + this.nombpuntoventa = nombpuntoventa; + this.imei = imei; + } + + public Long getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Long puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public Long getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Long usuarioId) { + this.usuarioId = usuarioId; + } + + public String getNombusuario() { + return nombusuario; + } + public void setNombusuario(String nombusuario) { + this.nombusuario = nombusuario; + } + public String getNombpuntoventa() { + return nombpuntoventa; + } + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + public String getImei() { + return imei; + } + public void setImei(String imei) { + this.imei = imei; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/SeguroTaxaEmbarqueVO.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/SeguroTaxaEmbarqueVO.java new file mode 100644 index 000000000..553dd977c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/SeguroTaxaEmbarqueVO.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +public class SeguroTaxaEmbarqueVO { + private Integer empresaId; + private Boolean indVendeSeguroOpcEmbarcada; + private Boolean indVendeSeguroTabelaEmbarcada; + private Boolean indTaxaEmbarqueEmbarcada; + + public SeguroTaxaEmbarqueVO() { + + } + + public SeguroTaxaEmbarqueVO(Integer empresaId, Boolean indVendeSeguroOpcEmbarcada, Boolean indVendeSeguroTabelaEmbarcada, Boolean indTaxaEmbarqueEmbarcada) { + super(); + this.empresaId = empresaId; + this.indVendeSeguroOpcEmbarcada = indVendeSeguroOpcEmbarcada; + this.indVendeSeguroTabelaEmbarcada = indVendeSeguroTabelaEmbarcada; + this.indTaxaEmbarqueEmbarcada = indTaxaEmbarqueEmbarcada; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public Boolean getIndVendeSeguroOpcEmbarcada() { + return indVendeSeguroOpcEmbarcada; + } + + public void setIndVendeSeguroOpcEmbarcada(Boolean indVendeSeguroOpcEmbarcada) { + this.indVendeSeguroOpcEmbarcada = indVendeSeguroOpcEmbarcada; + } + + public Boolean getIndVendeSeguroTabelaEmbarcada() { + return indVendeSeguroTabelaEmbarcada; + } + + public void setIndVendeSeguroTabelaEmbarcada(Boolean indVendeSeguroTabelaEmbarcada) { + this.indVendeSeguroTabelaEmbarcada = indVendeSeguroTabelaEmbarcada; + } + + public Boolean getIndTaxaEmbarqueEmbarcada() { + return indTaxaEmbarqueEmbarcada; + } + + public void setIndTaxaEmbarqueEmbarcada(Boolean indTaxaEmbarqueEmbarcada) { + this.indTaxaEmbarqueEmbarcada = indTaxaEmbarqueEmbarcada; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/SerieEmbarcada.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/SerieEmbarcada.java new file mode 100644 index 000000000..3545a2046 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/SerieEmbarcada.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +import com.rjconsultores.ventaboletos.entidad.CtrlSerieEmbarcada; + +public class SerieEmbarcada { + private CtrlSerieEmbarcada ctrlSerieEmbarcada; + private String serie; + private String numero; + + public SerieEmbarcada() { + + } + + public CtrlSerieEmbarcada getCtrlSerieEmbarcada() { + return ctrlSerieEmbarcada; + } + + public void setCtrlSerieEmbarcada(CtrlSerieEmbarcada ctrlSerieEmbarcada) { + this.ctrlSerieEmbarcada = ctrlSerieEmbarcada; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + @Override + public String toString() { + return "SerieEmbarcada [ctrlSerieEmbarcadaId=" + (ctrlSerieEmbarcada == null ? "null" : ctrlSerieEmbarcada.getCtrlSerieEmbarcadaId()) + ", serie=" + serie + ", numero=" + numero + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/TiposPassagensBloqueadasVO.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/TiposPassagensBloqueadasVO.java new file mode 100644 index 000000000..5bd13eb11 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/TiposPassagensBloqueadasVO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +public class TiposPassagensBloqueadasVO { + private Integer categoriaId; + private Integer usuarioId; + private Integer empresaId; + + public TiposPassagensBloqueadasVO() { + + } + + public TiposPassagensBloqueadasVO(Integer categoriaId, Integer usuarioId, Integer empresaId) { + super(); + this.categoriaId = categoriaId; + this.usuarioId = usuarioId; + this.empresaId = empresaId; + } + + public Integer getCategoriaId() { + return categoriaId; + } + + public void setCategoriaId(Integer categoriaId) { + this.categoriaId = categoriaId; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/embarcada/UsuarioEmbarcadaVO.java b/src/com/rjconsultores/ventaboletos/vo/embarcada/UsuarioEmbarcadaVO.java new file mode 100644 index 000000000..f43a6ca44 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/embarcada/UsuarioEmbarcadaVO.java @@ -0,0 +1,71 @@ +package com.rjconsultores.ventaboletos.vo.embarcada; + +public class UsuarioEmbarcadaVO { + private Long usuarioId; + private String nome; + private String cveusuario; + private String senha; + private String email; + + public UsuarioEmbarcadaVO() { + } + + public UsuarioEmbarcadaVO(Long usuarioId, String nome, String cveusuario, String senha, String email) { + super(); + this.usuarioId = usuarioId; + this.nome = nome; + this.cveusuario = cveusuario; + this.senha = senha; + this.email = email; + } + + public Long getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Long usuarioId) { + this.usuarioId = usuarioId; + } + + public String getNome() { + return nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public String getCveusuario() { + return cveusuario; + } + + public void setCveusuario(String cveusuario) { + this.cveusuario = cveusuario; + } + + public String getSenha() { + return senha; + } + + public void setSenha(String senha) { + this.senha = senha; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Override + public boolean equals(Object obj) { + if (((UsuarioEmbarcadaVO) obj).usuarioId != null && usuarioId != null && + ((UsuarioEmbarcadaVO) obj).usuarioId.intValue() == usuarioId.intValue()) { + return true; + } + + return false; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java new file mode 100644 index 000000000..3ff0f6d72 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java @@ -0,0 +1,181 @@ +package com.rjconsultores.ventaboletos.vo.esquemaoperacional; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.rjconsultores.ventaboletos.entidad.ClaseServicio; +import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.ParadaSecuenciaCombinacaoLinha; + +public class RutaTramoVO { + + private Boolean ventaHandHeld; + private Boolean solicitaNombrePasajero; + private ClaseServicio claseServicio; + private OrgaoConcedente orgaoConcedente; + private List lsSecuenciaRutaTramoVO; + private List lsCombinacionRutaTramoVO; + private List lsEmpresa; + private CoeficienteTarifa coeficienteDefault1; + private CoeficienteTarifa coeficienteDefault2; + private CoeficienteTarifa coeficienteDefault3; + private String prefixo; + private String descRuta; + private Boolean indSentidoIda; + private String numRuta; + private List lsParadaSecuenciaCombinacaoLinhas; + + public RutaTramoVO() { + lsSecuenciaRutaTramoVO = new ArrayList(); + lsEmpresa = new ArrayList(); + lsCombinacionRutaTramoVO = new ArrayList(); + } + + public Boolean getVentaHandHeld() { + return ventaHandHeld; + } + + public void setVentaHandHeld(Boolean ventaHandHeld) { + this.ventaHandHeld = ventaHandHeld; + } + + public Boolean getSolicitaNombrePasajero() { + return solicitaNombrePasajero; + } + + public void setSolicitaNombrePasajero(Boolean solicitaNombrePasajero) { + this.solicitaNombrePasajero = solicitaNombrePasajero; + } + + public ClaseServicio getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(ClaseServicio claseServicio) { + this.claseServicio = claseServicio; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + + public String getNumRuta() { + return numRuta; + } + + public void setNumRuta(String numRuta) { + this.numRuta = numRuta; + } + + /** + * Regresa una unmodifiable list + * + * @return + */ + public List getLsSecuenciaRutaTramoVO() { + return Collections.unmodifiableList(lsSecuenciaRutaTramoVO); + } + + public void setLsSecuenciaRutaTramoVO(List lsSecuenciaRutaTramoVO) { + this.lsSecuenciaRutaTramoVO = lsSecuenciaRutaTramoVO; + } + + /** + * Regresa una unmodifiable list + * + * @return + */ + public List getLsCombinacionRutaTramoVO() { + return Collections.unmodifiableList(lsCombinacionRutaTramoVO); + } + + public void setLsCombinacionRutaTramoVO(List lsCombinacionRutaTramoVO) { + this.lsCombinacionRutaTramoVO = lsCombinacionRutaTramoVO; + } + + public List getLsEmpresa() { + return lsEmpresa; + } + + public void setLsEmpresa(List lsEmpresa) { + this.lsEmpresa = lsEmpresa; + } + + public String getPrefixo() { + return prefixo; + } + + public void setPrefixo(String prefixo) { + this.prefixo = prefixo; + } + + public String getDescRuta() { + return descRuta; + } + + public void setDescRuta(String descRuta) { + this.descRuta = descRuta; + } + + public Boolean getIndSentidoIda() { + return indSentidoIda; + } + + public void setIndSentidoIda(Boolean indSentidoIda) { + this.indSentidoIda = indSentidoIda; + } + + public CoeficienteTarifa getCoeficienteDefault1() { + return coeficienteDefault1; + } + + public void setCoeficienteDefaul1(CoeficienteTarifa coeficienteDefault1) { + this.coeficienteDefault1 = coeficienteDefault1; + } + + public CoeficienteTarifa getCoeficienteDefault2() { + return coeficienteDefault2; + } + + public void setCoeficienteDefaul2(CoeficienteTarifa coeficienteDefault2) { + this.coeficienteDefault2 = coeficienteDefault2; + } + + public CoeficienteTarifa getCoeficienteDefault3() { + return coeficienteDefault3; + } + + public void setCoeficienteDefaul3(CoeficienteTarifa coeficienteDefault3) { + this.coeficienteDefault3 = coeficienteDefault3; + } + + public List getLsParadaSecuenciaCombinacaoLinhas() { + return lsParadaSecuenciaCombinacaoLinhas; + } + + public void setLsParadaSecuenciaCombinacaoLinhas(List lsParadaSecuenciaCombinacaoLinhas) { + this.lsParadaSecuenciaCombinacaoLinhas = lsParadaSecuenciaCombinacaoLinhas; + } + + public Map getParadasComKmEntradaSaida(){ + Map kmEntradaSaida = new HashMap(); + for (SecuenciaRutaTramoVO s : getLsSecuenciaRutaTramoVO()){ + if (s.getKmSaidaOrigen() != null && s.getKmSaidaOrigen().compareTo(BigDecimal.ZERO) == 1){ + kmEntradaSaida.put(s.getOrigen(), s.getKmSaidaOrigen()); + } + } + return kmEntradaSaida; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java new file mode 100644 index 000000000..5d9465e9c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java @@ -0,0 +1,262 @@ +package com.rjconsultores.ventaboletos.vo.esquemaoperacional; + +import java.math.BigDecimal; + +import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.utilerias.HoraSistema; + +public class SecuenciaRutaTramoCoeficienteVO { + + private Parada origen; + private Parada destino; + private Via via; + private Integer secuencia; + private BigDecimal kmReal; + private BigDecimal kmSaidaOrigen; + private BigDecimal kmEntradaDestino; + private HoraSistema tiempoRecorrido; + private Integer tramoId; + private Integer tramoServicioId; + private String numRuta; + private Integer orgaoTramoId; + private CoeficienteTarifa coeficienteTarifa1; + private BigDecimal kmCoeficiente1; + private CoeficienteTarifa coeficienteTarifa2; + private BigDecimal kmCoeficiente2; + private CoeficienteTarifa coeficienteTarifa3; + private BigDecimal kmCoeficiente3; + private Boolean permiteVenda; + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, HoraSistema tiempoRecorrido) { + super(); + this.origen = origen; + this.destino = destino; + this.via = via; + this.secuencia = secuencia; + this.kmReal = kmReal; + this.setTiempoRecorrido(tiempoRecorrido); + } + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, HoraSistema tiempoRecorrido, String numruta) { + this(origen, destino, via, secuencia, kmReal, tiempoRecorrido); + this.numRuta = numruta; + } + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, HoraSistema tiempoRecorrido, String numruta, BigDecimal kmSaidaOrigen) { + this(origen, destino, via, secuencia, kmReal, tiempoRecorrido); + this.numRuta = numruta; + this.kmSaidaOrigen = kmSaidaOrigen; + } + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Integer secuencia, Via via) { + super(); + this.origen = origen; + this.destino = destino; + this.secuencia = secuencia; + this.via = via; + this.setTiempoRecorrido(null); + } + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Integer secuencia, Via via, String numruta) { + this(origen, destino, secuencia, via); + this.numRuta = numruta; + } + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, + HoraSistema tiempoRecorrido, Integer tramoId, Integer tramoServicioId) { + super(); + this.origen = origen; + this.destino = destino; + this.via = via; + this.secuencia = secuencia; + this.kmReal = kmReal; + this.setTiempoRecorrido(tiempoRecorrido); + this.tramoId = tramoId; + this.tramoServicioId = tramoId; + } + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, + HoraSistema tiempoRecorrido, Integer tramoId, Integer tramoServicioId, String numruta) { + this(origen, destino, via, secuencia, kmReal, tiempoRecorrido, tramoId, tramoServicioId); + this.numRuta = numruta; + } + + public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, + HoraSistema tiempoRecorrido, Integer tramoId, Integer tramoServicioId, String numruta, BigDecimal kmSaidaOrigen) { + this(origen, destino, via, secuencia, kmReal, tiempoRecorrido, tramoId, tramoServicioId); + this.numRuta = numruta; + this.kmSaidaOrigen = kmSaidaOrigen; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public HoraSistema getTiempoRecorrido() { + return tiempoRecorrido; + } + + public void setTiempoRecorrido(HoraSistema tiempoRecorrido) { + if (tiempoRecorrido == null) { + tiempoRecorrido = new HoraSistema(); + } + this.tiempoRecorrido = tiempoRecorrido; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Via getVia() { + return via; + } + + public void setVia(Via via) { + this.via = via; + } + + public Integer getSecuencia() { + return secuencia; + } + + public void setSecuencia(Integer secuencia) { + this.secuencia = secuencia; + } + + public BigDecimal getKmReal() { + return kmReal; + } + + public void setKmReal(BigDecimal kmReal) { + this.kmReal = kmReal; + } + + public Integer getTramoId() { + return tramoId; + } + + public void setTramoId(Integer tramoId) { + this.tramoId = tramoId; + } + + public Integer getTramoServicioId() { + return tramoServicioId; + } + + public void setTramoServicioId(Integer tramoServicioId) { + this.tramoServicioId = tramoServicioId; + } + + public String getNumRuta() { + return numRuta; + } + + public void setNumRuta(String numRuta) { + this.numRuta = numRuta; + } + + @Override + public String toString() { + HoraSistema hora = getTiempoRecorrido(); + + return secuencia + ";" + origen + ";" + destino + ";" + via + ";" + kmReal + ";" + + ((hora != null) ? hora.getHora() : "-") + ";" + ((hora != null) ? hora.getMinuto() : "-"); + } + + public Integer getOrgaoTramoId() { + return orgaoTramoId; + } + + public void setOrgaoTramoId(Integer orgaoTramoId) { + this.orgaoTramoId = orgaoTramoId; + } + + public CoeficienteTarifa getCoeficienteTarifa1() { + return coeficienteTarifa1; + } + + public void setCoeficienteTarifa1(CoeficienteTarifa coeficienteTarifa1) { + this.coeficienteTarifa1 = coeficienteTarifa1; + } + + public BigDecimal getKmCoeficiente1() { + return kmCoeficiente1; + } + + public void setKmCoeficiente1(BigDecimal kmCoeficiente1) { + this.kmCoeficiente1 = kmCoeficiente1; + } + + public CoeficienteTarifa getCoeficienteTarifa2() { + return coeficienteTarifa2; + } + + public void setCoeficienteTarifa2(CoeficienteTarifa coeficienteTarifa2) { + this.coeficienteTarifa2 = coeficienteTarifa2; + } + + public BigDecimal getKmCoeficiente2() { + return kmCoeficiente2; + } + + public void setKmCoeficiente2(BigDecimal kmCoeficiente2) { + this.kmCoeficiente2 = kmCoeficiente2; + } + + public CoeficienteTarifa getCoeficienteTarifa3() { + return coeficienteTarifa3; + } + + public void setCoeficienteTarifa3(CoeficienteTarifa coeficienteTarifa3) { + this.coeficienteTarifa3 = coeficienteTarifa3; + } + + public BigDecimal getKmCoeficiente3() { + return kmCoeficiente3; + } + + public void setKmCoeficiente3(BigDecimal kmCoeficiente3) { + this.kmCoeficiente3 = kmCoeficiente3; + } + + public Boolean getPermiteVenda() { + return permiteVenda; + } + + public void setPermiteVenda(Boolean permiteVenda) { + this.permiteVenda = permiteVenda; + } + + public BigDecimal getKmSaidaOrigen() { + return kmSaidaOrigen; + } + + public void setKmSaidaOrigen(BigDecimal kmSaidaOrigen) { + this.kmSaidaOrigen = kmSaidaOrigen; + } + + /** + * @return the kmEntradaDestino + */ + public BigDecimal getKmEntradaDestino() { + return kmEntradaDestino; + } + + /** + * @param kmEntradaDestino the kmEntradaDestino to set + */ + public void setKmEntradaDestino(BigDecimal kmEntradaDestino) { + this.kmEntradaDestino = kmEntradaDestino; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoVO.java b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoVO.java new file mode 100644 index 000000000..80a7a4914 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoVO.java @@ -0,0 +1,225 @@ +package com.rjconsultores.ventaboletos.vo.esquemaoperacional; + +import java.math.BigDecimal; + +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Via; +import com.rjconsultores.ventaboletos.utilerias.HoraSistema; + +public class SecuenciaRutaTramoVO implements Comparable{ + + private Parada origen; + private Parada destino; + private Via via; + private Integer secuencia; + private BigDecimal kmReal; + private BigDecimal kmSaidaOrigen; + private BigDecimal kmEntradaDestino; + private HoraSistema tiempoRecorrido; + private Integer tramoId; + private Integer tramoServicioId; + private Boolean indSentidoIda; + private String numRuta; + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, HoraSistema tiempoRecorrido) { + super(); + this.origen = origen; + this.destino = destino; + this.via = via; + this.secuencia = secuencia; + this.kmReal = kmReal; + this.setTiempoRecorrido(tiempoRecorrido); + } + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, HoraSistema tiempoRecorrido, String numruta, Boolean indSentidoIda) { + this(origen, destino, via, secuencia, kmReal, tiempoRecorrido); + this.numRuta = numruta; + this.indSentidoIda = indSentidoIda; + } + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, HoraSistema tiempoRecorrido, String numruta, Boolean indSentidoIda, BigDecimal kmSaidaOrigen) { + this(origen, destino, via, secuencia, kmReal, tiempoRecorrido); + this.numRuta = numruta; + this.indSentidoIda = indSentidoIda; + this.kmSaidaOrigen = kmSaidaOrigen; + } + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Integer secuencia, Via via) { + super(); + this.origen = origen; + this.destino = destino; + this.secuencia = secuencia; + this.via = via; + this.setTiempoRecorrido(null); + } + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Integer secuencia, Via via, String numruta, Boolean indSentidoIda) { + this(origen, destino, secuencia, via); + this.numRuta = numruta; + this.indSentidoIda = indSentidoIda; + } + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, + HoraSistema tiempoRecorrido, Integer tramoId, Integer tramoServicioId) { + super(); + this.origen = origen; + this.destino = destino; + this.via = via; + this.secuencia = secuencia; + this.kmReal = kmReal; + this.setTiempoRecorrido(tiempoRecorrido); + this.tramoId = tramoId; + this.tramoServicioId = tramoId; + } + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, + HoraSistema tiempoRecorrido, Integer tramoId, Integer tramoServicioId, String numruta, Boolean indSentidoIda) { + this(origen, destino, via, secuencia, kmReal, tiempoRecorrido, tramoId, tramoServicioId); + this.numRuta = numruta; + this.indSentidoIda = indSentidoIda; + } + + public SecuenciaRutaTramoVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, + HoraSistema tiempoRecorrido, Integer tramoId, Integer tramoServicioId, String numruta, Boolean indSentidoIda, BigDecimal kmSaidaOrigen) { + this(origen, destino, via, secuencia, kmReal, tiempoRecorrido, tramoId, tramoServicioId); + this.numRuta = numruta; + this.indSentidoIda = indSentidoIda; + this.kmSaidaOrigen = kmSaidaOrigen; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public HoraSistema getTiempoRecorrido() { + return tiempoRecorrido; + } + + public void setTiempoRecorrido(HoraSistema tiempoRecorrido) { + if (tiempoRecorrido == null) { + tiempoRecorrido = new HoraSistema(); + } + this.tiempoRecorrido = tiempoRecorrido; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Via getVia() { + return via; + } + + public void setVia(Via via) { + this.via = via; + } + + public Integer getSecuencia() { + return secuencia; + } + + public void setSecuencia(Integer secuencia) { + this.secuencia = secuencia; + } + + public BigDecimal getKmReal() { + return kmReal; + } + + public void setKmReal(BigDecimal kmReal) { + this.kmReal = kmReal; + } + + public Integer getTramoId() { + return tramoId; + } + + public void setTramoId(Integer tramoId) { + this.tramoId = tramoId; + } + + public Integer getTramoServicioId() { + return tramoServicioId; + } + + public void setTramoServicioId(Integer tramoServicioId) { + this.tramoServicioId = tramoServicioId; + } + + public Boolean getIndSentidoIda() { + return indSentidoIda; + } + + public void setIndSentidoIda(Boolean indSentidoIda) { + this.indSentidoIda = indSentidoIda; + } + + public String getNumRuta() { + return numRuta; + } + + public void setNumRuta(String numRuta) { + this.numRuta = numRuta; + } + + public BigDecimal getKmSaidaOrigen() { + return kmSaidaOrigen; + } + + public void setKmSaidaOrigen(BigDecimal kmSaidaOrigen) { + this.kmSaidaOrigen = kmSaidaOrigen; + } + + @Override + public String toString() { + HoraSistema hora = getTiempoRecorrido(); + + return secuencia + ";" + origen + ";" + destino + ";" + via + ";" + kmReal + ";" + + ((hora != null) ? hora.getHora() : "-") + ";" + ((hora != null) ? hora.getMinuto() : "-"); + } + + @Override + public int compareTo(SecuenciaRutaTramoVO o) { + return this.getSecuencia().compareTo(o.getSecuencia()); + } + + /** + * @return the kmEntradaDestino + */ + public BigDecimal getKmEntradaDestino() { + return kmEntradaDestino; + } + + /** + * Método retorna valor de km sem considerar a distancia de entrada e saída da localidade. + * + * @return + */ + public BigDecimal getKmOriginal() { + return kmReal.subtract(kmEntradaDestino == null ? BigDecimal.ZERO : kmEntradaDestino).subtract(kmSaidaOrigen == null ? BigDecimal.ZERO : kmSaidaOrigen); + } + + /** + * Método retorna valor de km sem considerar a distancia de entrada e saída da localidade. + * + * @return + */ + public BigDecimal getKmEntradaSaida() { + return (kmEntradaDestino == null ? BigDecimal.ZERO : kmEntradaDestino).add(kmSaidaOrigen == null ? BigDecimal.ZERO : kmSaidaOrigen); + } + + /** + * @param kmEntradaDestino the kmEntradaDestino to set + */ + public void setKmEntradaDestino(BigDecimal kmEntradaDestino) { + this.kmEntradaDestino = kmEntradaDestino; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/TaxaEmbarqueW2i.java b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/TaxaEmbarqueW2i.java new file mode 100644 index 000000000..d6b76f55a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/TaxaEmbarqueW2i.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.vo.esquemaoperacional; + +public class TaxaEmbarqueW2i { + + private long taxpolc_id; + private String nomeEmpresa; + private String categoria; + private String cveParada; + private String orgaoConcedente; + private long km; + private long quantidadeEstoque; + + public long getTaxpolc_id() { + return taxpolc_id; + } + + public void setTaxpolc_id(long taxpolc_id) { + this.taxpolc_id = taxpolc_id; + } + + public String getNomeEmpresa() { + return nomeEmpresa; + } + + public void setNomeEmpresa(String nomeEmpresa) { + this.nomeEmpresa = nomeEmpresa; + } + + public String getCategoria() { + return categoria; + } + + public void setCategoria(String categoria) { + this.categoria = categoria; + } + + public String getCveParada() { + return cveParada; + } + + public void setCveParada(String cveParada) { + this.cveParada = cveParada; + } + + public long getKm() { + return km; + } + + public void setKm(long km) { + this.km = km; + } + + public long getQuantidadeEstoque() { + return quantidadeEstoque; + } + + public void setQuantidadeEstoque(long quantidadeEstoque) { + this.quantidadeEstoque = quantidadeEstoque; + } + + public String getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(String orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/exportacao/QdmpDerCabecaVo.java b/src/com/rjconsultores/ventaboletos/vo/exportacao/QdmpDerCabecaVo.java new file mode 100644 index 000000000..8c74e3f88 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/exportacao/QdmpDerCabecaVo.java @@ -0,0 +1,168 @@ +package com.rjconsultores.ventaboletos.vo.exportacao; + +import java.util.Calendar; + +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.utilerias.StringHelper; + +public class QdmpDerCabecaVo { + + private Integer codEmp; + private String linha; + private String secao; + private Integer digVer; + private Integer viagOrd; + private Integer lugOrd; + private Integer viagMul; + private Integer lugMul; + private Integer viagRft; + private Integer lugRft; + private Integer viagRfp; + private Integer lugRfp; + private Integer totViag; + private Integer totLug; + private Calendar dataHora; + private String codOper; + + public QdmpDerCabecaVo(Object[] obj) { + this.codEmp = obj[0]==null?0:(Integer)obj[0]; + this.linha = obj[1]==null?"":(String)obj[1]; + this.viagOrd = obj[2]==null?0:(Integer)obj[2]; + this.lugOrd = obj[3]==null?0:(Integer)obj[3]; + this.viagRft = obj[4]==null?0:(Integer)obj[4]; + this.lugRft = obj[5]==null?0:(Integer)obj[5]; + this.viagRfp = obj[6]==null?0:(Integer)obj[6]; + this.lugRfp = obj[7]==null?0:(Integer)obj[7]; + this.viagMul = 0; + this.lugMul = 0; + this.totViag = viagOrd+viagMul+viagRft+viagRfp; + this.totLug = lugOrd+lugMul+lugRft+lugRfp; + this.secao = "0000"; + this.digVer = 0; + this.codOper = "I"; + + } + + @Override + public String toString() { + StringBuilder retorno = new StringBuilder(); + retorno.append("J") + .append(codEmp) + .append(StringHelper.preencherStringEspacoEsquerda(linha, 10)) + .append(secao) + .append(digVer) + .append( StringHelper.preencherZeroEsquerda(viagOrd, 5) ) + .append( StringHelper.preencherZeroEsquerda(lugOrd, 7) ) + .append( StringHelper.preencherZeroEsquerda(viagMul, 5) ) + .append( StringHelper.preencherZeroEsquerda(lugMul, 7) ) + .append( StringHelper.preencherZeroEsquerda(viagRft, 5) ) + .append( StringHelper.preencherZeroEsquerda(lugRft, 7) ) + .append( StringHelper.preencherZeroEsquerda(viagRfp, 5) ) + .append( StringHelper.preencherZeroEsquerda(lugRfp, 7) ) + .append( StringHelper.preencherZeroEsquerda(totViag, 6) ) + .append( StringHelper.preencherZeroEsquerda(totLug, 8) ) + .append( DateUtil.getStringCurrentDate("yyyyMMddHHmm") ) + .append(codOper); + + return retorno.toString(); + } + + public Integer getCodEmp() { + return codEmp; + } + public void setCodEmp(Integer codEmp) { + this.codEmp = codEmp; + } + public String getLinha() { + return linha; + } + public void setLinha(String linha) { + this.linha = linha; + } + public String getSecao() { + return secao; + } + public void setSecao(String secao) { + this.secao = secao; + } + public Integer getDigVer() { + return digVer; + } + public void setDigVer(Integer digVer) { + this.digVer = digVer; + } + public Integer getViagOrd() { + return viagOrd; + } + public void setViagOrd(Integer viagOrd) { + this.viagOrd = viagOrd; + } + public Integer getLugOrd() { + return lugOrd; + } + public void setLugOrd(Integer lugOrd) { + this.lugOrd = lugOrd; + } + public Integer getViagMul() { + return viagMul; + } + public void setViagMul(Integer viagMul) { + this.viagMul = viagMul; + } + public Integer getLugMul() { + return lugMul; + } + public void setLugMul(Integer lugMul) { + this.lugMul = lugMul; + } + public Integer getViagRft() { + return viagRft; + } + public void setViagRft(Integer viagRft) { + this.viagRft = viagRft; + } + public Integer getLugRft() { + return lugRft; + } + public void setLugRft(Integer lugRft) { + this.lugRft = lugRft; + } + public Integer getViagRfp() { + return viagRfp; + } + public void setViagRfp(Integer viagRfp) { + this.viagRfp = viagRfp; + } + public Integer getLugRfp() { + return lugRfp; + } + public void setLugRfp(Integer lugRfp) { + this.lugRfp = lugRfp; + } + public Integer getTotViag() { + return totViag; + } + + public void setTotViag(Integer totViag) { + this.totViag = totViag; + } + + public Integer getTotLug() { + return totLug; + } + public void setTotLug(Integer totLug) { + this.totLug = totLug; + } + public Calendar getDataHora() { + return dataHora; + } + public void setDataHora(Calendar dataHora) { + this.dataHora = dataHora; + } + public String getCodOper() { + return codOper; + } + public void setCodOper(String codOper) { + this.codOper = codOper; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/exportacao/QdmpDerLinhaVo.java b/src/com/rjconsultores/ventaboletos/vo/exportacao/QdmpDerLinhaVo.java new file mode 100644 index 000000000..be27b4a18 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/exportacao/QdmpDerLinhaVo.java @@ -0,0 +1,173 @@ +package com.rjconsultores.ventaboletos.vo.exportacao; + +import com.rjconsultores.ventaboletos.utilerias.StringHelper; + +public class QdmpDerLinhaVo { + + private Integer codEmp; + private String linha; + private String secao; + private Integer digVer; + private Integer idaOrd; + private Integer volOrd; + private Integer idaMul; + private Integer volMul; + private Integer idaRft; + private Integer volRft; + private Integer idaRfp; + private Integer volRfp; + private Integer viagRfp; + private Integer totMov1; + private Integer totMov2; + private Integer totMov3; + private String codOper; + + public QdmpDerLinhaVo(Object[] obj) { + this.codEmp = obj[0]==null?0:(Integer)obj[0]; + this.linha = obj[1]==null?"":(String)obj[1]; + this.secao = obj[2]==null?"":(String)obj[2]; + this.totMov1 = obj[3]==null?0:(Integer)obj[3]; + this.totMov1 += obj[4]==null?0:(Integer)obj[4]; + this.idaOrd = obj[5]==null?0:(Integer)obj[5]; + this.volOrd = obj[6]==null?0:(Integer)obj[6]; + this.idaRft = obj[7]==null?0:(Integer)obj[7]; + this.viagRfp = obj[8]==null?0:(Integer)obj[8]; + this.idaRfp = obj[9]==null?0:(Integer)obj[9]; + this.volRfp = obj[10]==null?0:(Integer)obj[10]; + this.viagRfp = obj[11]==null?0:(Integer)obj[11]; + this.totMov2 = 0; + this.totMov3 = 0; + this.digVer = 0; + this.codOper = "I"; + + } + + public Integer getCodEmp() { + return codEmp; + } + public void setCodEmp(Integer codEmp) { + this.codEmp = codEmp; + } + public String getLinha() { + return linha; + } + public void setLinha(String linha) { + this.linha = linha; + } + public String getSecao() { + return secao; + } + public void setSecao(String secao) { + this.secao = secao; + } + public Integer getDigVer() { + return digVer; + } + public void setDigVer(Integer digVer) { + this.digVer = digVer; + } + public Integer getIdaOrd() { + return idaOrd; + } + public void setIdaOrd(Integer idaOrd) { + this.idaOrd = idaOrd; + } + public Integer getVolOrd() { + return volOrd; + } + public void setVolOrd(Integer volOrd) { + this.volOrd = volOrd; + } + public Integer getIdaMul() { + return idaMul; + } + public void setIdaMul(Integer idaMul) { + this.idaMul = idaMul; + } + public Integer getVolMul() { + return volMul; + } + public void setVolMul(Integer volMul) { + this.volMul = volMul; + } + public Integer getIdaRft() { + return idaRft; + } + public void setIdaRft(Integer idaRft) { + this.idaRft = idaRft; + } + public Integer getVolRft() { + return volRft; + } + public void setVolRft(Integer volRft) { + this.volRft = volRft; + } + public Integer getViagRfp() { + return viagRfp; + } + public void setViagRfp(Integer viagRfp) { + this.viagRfp = viagRfp; + } + public Integer getIdaRftPar() { + return idaRfp; + } + public void setIdaRftPar(Integer idaRftPar) { + this.idaRfp = idaRftPar; + } + public Integer getVolRftPar() { + return volRfp; + } + public void setVolRftPar(Integer volRftPar) { + this.volRfp = volRftPar; + } + public Integer getTotMov1() { + return totMov1; + } + public void setTotMov1(Integer totMov1) { + this.totMov1 = totMov1; + } + public Integer getTotMov2() { + return totMov2; + } + public void setTotMov2(Integer totMov2) { + this.totMov2 = totMov2; + } + public Integer getTotMov3() { + return totMov3; + } + public void setTotMov3(Integer totMov3) { + this.totMov3 = totMov3; + } + public String getCodOper() { + return codOper; + } + public void setCodOper(String codOper) { + this.codOper = codOper; + } + + @Override + public String toString() { + StringBuilder retorno = new StringBuilder(); + retorno.append("P") + .append(codEmp) + .append(StringHelper.preencherStringEspacoEsquerda(linha, 10)) + .append(secao) + .append(digVer) + .append( StringHelper.preencherZeroEsquerda(idaOrd, 6) ) + .append( StringHelper.preencherZeroEsquerda(volOrd, 6) ) + .append( StringHelper.preencherZeroEsquerda(idaMul, 6) ) + .append( StringHelper.preencherZeroEsquerda(volMul, 6) ) + .append( StringHelper.preencherZeroEsquerda(idaRft, 6) ) + .append( StringHelper.preencherZeroEsquerda(volRft, 6) ) + .append( StringHelper.preencherZeroEsquerda(idaRfp, 6) ) + .append( StringHelper.preencherZeroEsquerda(volRfp, 6) ) + .append( StringHelper.preencherZeroEsquerda(viagRfp, 5) ) + .append( StringHelper.preencherZeroEsquerda(totMov1, 7) ) + .append( StringHelper.preencherZeroEsquerda(totMov2, 7) ) + .append( StringHelper.preencherZeroEsquerda(totMov3, 7) ) + .append(codOper); + + return retorno.toString(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/exportacao/QdmpDerRodapeVo.java b/src/com/rjconsultores/ventaboletos/vo/exportacao/QdmpDerRodapeVo.java new file mode 100644 index 000000000..a0d9787d4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/exportacao/QdmpDerRodapeVo.java @@ -0,0 +1,126 @@ +package com.rjconsultores.ventaboletos.vo.exportacao; + +import java.math.BigDecimal; + +import com.rjconsultores.ventaboletos.utilerias.StringHelper; + +public class QdmpDerRodapeVo { + + private Integer codEmp; + private String linha; + private String secao; + private Integer digVer; + private Integer totMov1; + private Integer totMov2; + private Integer totMov3; + private BigDecimal receita; + private BigDecimal icms; + private BigDecimal iasp; + private String codOper; + + public QdmpDerRodapeVo(Object[] obj) { + this.codEmp = obj[0]==null?0:(Integer)obj[0]; + this.linha = obj[1]==null?"":(String)obj[1]; + this.totMov1 = obj[2]==null?0:(Integer)obj[2]; + this.receita = obj[3]==null?BigDecimal.ZERO:(BigDecimal)obj[3]; + this.icms = obj[4]==null?BigDecimal.ZERO:(BigDecimal)obj[4]; + this.iasp = obj[5]==null?BigDecimal.ZERO:(BigDecimal)obj[5]; + this.secao = "9999"; + this.totMov2 = 0; + this.totMov3 = 0; + this.digVer = 9; + this.codOper = "I"; + + } + + @Override + public String toString() { + this.receita= this.receita.setScale(2, BigDecimal.ROUND_CEILING); + this.icms = this.icms.setScale(2, BigDecimal.ROUND_CEILING); + this.iasp = this.iasp.setScale(2, BigDecimal.ROUND_CEILING); + + StringBuilder retorno = new StringBuilder(); + retorno.append("P") + .append(codEmp) + .append(StringHelper.preencherStringEspacoEsquerda(linha, 10)) + .append(secao) + .append(digVer) + .append( StringHelper.preencherStringEspacoEsquerda("", 20) ) + .append( StringHelper.preencherZeroEsquerda(totMov1, 7) ) + .append( StringHelper.preencherZeroEsquerda(totMov2, 7) ) + .append( StringHelper.preencherZeroEsquerda(totMov3, 7) ) + .append( StringHelper.preencherZeroEsquerda(receita.toString().replace(".", ""), 11) ) + .append( StringHelper.preencherZeroEsquerda(icms.toString().replace(".", ""), 11) ) + .append( StringHelper.preencherZeroEsquerda(iasp.toString().replace(".", ""), 11) ) + .append(codOper); + + return retorno.toString(); + } + + public Integer getCodEmp() { + return codEmp; + } + public void setCodEmp(Integer codEmp) { + this.codEmp = codEmp; + } + public String getLinha() { + return linha; + } + public void setLinha(String linha) { + this.linha = linha; + } + public String getSecao() { + return secao; + } + public void setSecao(String secao) { + this.secao = secao; + } + public Integer getDigVer() { + return digVer; + } + public void setDigVer(Integer digVer) { + this.digVer = digVer; + } + public Integer getTotMov1() { + return totMov1; + } + public void setTotMov1(Integer totMov1) { + this.totMov1 = totMov1; + } + public Integer getTotMov2() { + return totMov2; + } + public void setTotMov2(Integer totMov2) { + this.totMov2 = totMov2; + } + public Integer getTotMov3() { + return totMov3; + } + public void setTotMov3(Integer totMov3) { + this.totMov3 = totMov3; + } + public BigDecimal getReceita() { + return receita; + } + public void setReceita(BigDecimal receita) { + this.receita = receita; + } + public BigDecimal getIcms() { + return icms; + } + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + public BigDecimal getIasp() { + return iasp; + } + public void setIasp(BigDecimal iasp) { + this.iasp = iasp; + } + public String getCodOper() { + return codOper; + } + public void setCodOper(String codOper) { + this.codOper = codOper; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraEcfVO.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraEcfVO.java new file mode 100644 index 000000000..9b9dc7323 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraEcfVO.java @@ -0,0 +1,78 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.util.ArrayList; +import java.util.List; + +public class AgpImpressoraEcfVO { + + private String numImpressora; + private String dataEmissao; + + private List itens; + + public AgpImpressoraEcfVO() { + } + + public AgpImpressoraEcfVO(String numImpressora, String dataEmissao) { + super(); + this.numImpressora = numImpressora; + this.dataEmissao = dataEmissao; + this.itens = new ArrayList(); + } + + public String getNumImpressora() { + return numImpressora; + } + + public void setNumImpressora(String numImpressora) { + this.numImpressora = numImpressora; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public List getItens() { + return itens; + } + + public void setItens(List itens) { + this.itens = itens; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((dataEmissao == null) ? 0 : dataEmissao.hashCode()); + result = prime * result + ((numImpressora == null) ? 0 : numImpressora.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + AgpImpressoraEcfVO other = (AgpImpressoraEcfVO) obj; + if (dataEmissao == null) { + if (other.dataEmissao != null) + return false; + } else if (!dataEmissao.equals(other.dataEmissao)) + return false; + if (numImpressora == null) { + if (other.numImpressora != null) + return false; + } else if (!numImpressora.equals(other.numImpressora)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraReducaoZVO.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraReducaoZVO.java new file mode 100644 index 000000000..084b941f8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/AgpImpressoraReducaoZVO.java @@ -0,0 +1,78 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.util.ArrayList; +import java.util.List; + +public class AgpImpressoraReducaoZVO { + + private String numserie20; + private String datamov; + + private List itens; + + public AgpImpressoraReducaoZVO() { + } + + public AgpImpressoraReducaoZVO(String numserie20, String datamov) { + super(); + this.numserie20 = numserie20; + this.datamov = datamov; + this.itens = new ArrayList(); + } + + public String getNumserie20() { + return numserie20; + } + + public void setNumserie20(String numserie20) { + this.numserie20 = numserie20; + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public List getItens() { + return itens; + } + + public void setItens(List itens) { + this.itens = itens; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((datamov == null) ? 0 : datamov.hashCode()); + result = prime * result + ((numserie20 == null) ? 0 : numserie20.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + AgpImpressoraReducaoZVO other = (AgpImpressoraReducaoZVO) obj; + if (datamov == null) { + if (other.datamov != null) + return false; + } else if (!datamov.equals(other.datamov)) + return false; + if (numserie20 == null) { + if (other.numserie20 != null) + return false; + } else if (!numserie20.equals(other.numserie20)) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalReducaoZVO.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalReducaoZVO.java new file mode 100644 index 000000000..089a73465 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalReducaoZVO.java @@ -0,0 +1,272 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class ImportacionFiscalReducaoZVO { + + private String datamov; + private String cnpj; + private String numreducoes; + private String crz; + private String numserie20; + private String coo; + private String cro; + private String cooinicial; + private String coofinal; + private BigDecimal vendabrutadiaria; + private String datareducao; + private String horareducao; + private String aliquota; + private BigDecimal imposto; + private BigDecimal valorNaoTributado; + private String numpdv; + private BigDecimal gtFinal; + private BigDecimal gtInicial; + private BigDecimal valorNaoIncluido; + private String status; + private boolean inconsistente; + + public ImportacionFiscalReducaoZVO() { + } + + public ImportacionFiscalReducaoZVO(ImportacionFiscalReducaoZVO item) { + this.datamov = item.getDatamov(); + this.cnpj = item.getCnpj(); + this.numreducoes = item.getNumreducoes(); + this.crz = item.getCrz(); + this.numserie20 = item.getNumserie20(); + this.coo = item.getCoo(); + this.cro = item.getCro(); + this.cooinicial = item.getCooinicial(); + this.coofinal = item.getCoofinal(); + this.vendabrutadiaria = item.getVendabrutadiaria(); + this.datareducao = item.getDatareducao(); + this.horareducao = item.getHorareducao(); + this.aliquota = item.getAliquota(); + this.imposto = item.getImposto(); + this.valorNaoTributado = item.getValorNaoTributado(); + this.numpdv = item.getNumpdv(); + this.gtFinal = item.getGtFinal(); + this.gtInicial = item.getGtInicial(); + this.valorNaoIncluido = item.getValorNaoIncluido(); + this.status = item.getStatus(); + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + public String getNumreducoes() { + return numreducoes; + } + + public void setNumreducoes(String numreducoes) { + this.numreducoes = numreducoes; + } + + public String getCrz() { + return crz; + } + + public void setCrz(String crz) { + this.crz = crz; + } + + public String getNumserie20() { + return numserie20; + } + + public void setNumserie20(String numserie20) { + this.numserie20 = numserie20; + } + + public String getCoo() { + return coo; + } + + public void setCoo(String coo) { + this.coo = coo; + } + + public String getCooinicial() { + return cooinicial; + } + + public void setCooinicial(String cooinicial) { + this.cooinicial = cooinicial; + } + + public String getCoofinal() { + return coofinal; + } + + public void setCoofinal(String coofinal) { + this.coofinal = coofinal; + } + + public BigDecimal getVendabrutadiaria() { + return vendabrutadiaria; + } + + public void setVendabrutadiaria(BigDecimal vendabrutadiaria) { + this.vendabrutadiaria = vendabrutadiaria; + } + + public String getDatareducao() { + return datareducao; + } + + public void setDatareducao(String datareducao) { + this.datareducao = datareducao; + } + + public String getHorareducao() { + return horareducao; + } + + public void setHorareducao(String horareducao) { + this.horareducao = horareducao; + } + + public String getAliquota() { + return aliquota; + } + + public void setAliquota(String aliquota) { + this.aliquota = aliquota; + } + + public BigDecimal getImposto() { + return imposto; + } + + public void setImposto(BigDecimal imposto) { + this.imposto = imposto; + } + + public BigDecimal getValorNaoTributado() { + return valorNaoTributado; + } + + public void setValorNaoTributado(BigDecimal valorNaoTributado) { + this.valorNaoTributado = valorNaoTributado; + } + + public String getNumpdv() { + return numpdv; + } + + public void setNumpdv(String numpdv) { + this.numpdv = numpdv; + } + + public BigDecimal getGtFinal() { + return gtFinal; + } + + public void setGtFinal(BigDecimal gtFinal) { + this.gtFinal = gtFinal; + } + + public BigDecimal getGtInicial() { + return gtInicial; + } + + public void setGtInicial(BigDecimal gtInicial) { + this.gtInicial = gtInicial; + } + + public BigDecimal getValorNaoIncluido() { + return valorNaoIncluido; + } + + public void setValorNaoIncluido(BigDecimal valorNaoIncluido) { + this.valorNaoIncluido = valorNaoIncluido; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((coofinal == null) ? 0 : coofinal.hashCode()); + result = prime * result + ((cooinicial == null) ? 0 : cooinicial.hashCode()); + result = prime * result + ((datamov == null) ? 0 : datamov.hashCode()); + result = prime * result + ((datareducao == null) ? 0 : datareducao.hashCode()); + result = prime * result + ((numserie20 == null) ? 0 : numserie20.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ImportacionFiscalReducaoZVO other = (ImportacionFiscalReducaoZVO) obj; + if (coofinal == null) { + if (other.coofinal != null) + return false; + } else if (!coofinal.equals(other.coofinal)) + return false; + if (cooinicial == null) { + if (other.cooinicial != null) + return false; + } else if (!cooinicial.equals(other.cooinicial)) + return false; + if (datamov == null) { + if (other.datamov != null) + return false; + } else if (!datamov.equals(other.datamov)) + return false; + if (datareducao == null) { + if (other.datareducao != null) + return false; + } else if (!datareducao.equals(other.datareducao)) + return false; + if (numserie20 == null) { + if (other.numserie20 != null) + return false; + } else if (!numserie20.equals(other.numserie20)) + return false; + return true; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public boolean isInconsistente() { + return inconsistente; + } + + public void setInconsistente(boolean inconsistente) { + this.inconsistente = inconsistente; + } + + public String getCro() { + return cro; + } + + public void setCro(String cro) { + this.cro = cro; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalVO.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalVO.java new file mode 100644 index 000000000..08c6b2cc1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionFiscalVO.java @@ -0,0 +1,342 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +public class ImportacionFiscalVO { + + private String numImpressora; + private String coo; + private Long boletoId; + private Integer empresaId; + private String dataEmissao; + private String cnpjCliente; + private String cnpjImpressora; + private Integer origenId; + private String origenUf; + private Integer destinoId; + private String destinoUf; + private String numpdv; + private String modeloImpressora; + private String numCaixa; + private String status; + private String claseServicio; + private String descmotivocancelamento; + private Integer motivocancelacion; + private BigDecimal valorMulta; + private BigDecimal valorTarifa; + private BigDecimal valorPedagio; + private BigDecimal valorEmbarque; + private BigDecimal valorSeguro; + private String cnpjEcf; + private BigDecimal impostoEstado; + private BigDecimal desconto; + private String indcancelamento; + private boolean inconsistente; + + private List itensFiscais; + + public ImportacionFiscalVO() { + super(); + } + + public ImportacionFiscalVO(String numImpressora, String coo, Long boletoId, Integer empresaId, String dataEmissao, String cnpjCliente, String cnpjImpressora, Integer origenId, String origenUf, Integer destinoId, String destinoUf, String numpdv, String modeloImpressora, String numCaixa, String status, Integer motivocancelacion, BigDecimal valorMulta, BigDecimal valorTarifa, BigDecimal valorPedagio, BigDecimal valorEmbarque, BigDecimal valorSeguro, String claseServicio) { + super(); + this.numImpressora = numImpressora; + this.coo = coo; + this.boletoId = boletoId; + this.empresaId = empresaId; + this.dataEmissao = dataEmissao; + this.cnpjCliente = cnpjCliente; + this.cnpjImpressora = cnpjImpressora; + this.origenId = origenId; + this.origenUf = origenUf; + this.destinoId = destinoId; + this.destinoUf = destinoUf; + this.numpdv = numpdv; + this.modeloImpressora = modeloImpressora; + this.numCaixa = numCaixa; + this.status = status; + this.claseServicio = claseServicio; + this.motivocancelacion = motivocancelacion; + this.valorMulta = valorMulta; + this.valorTarifa = valorTarifa; + this.valorPedagio = valorPedagio; + this.valorEmbarque = valorEmbarque; + this.valorSeguro = valorSeguro; + } + + public String getNumImpressora() { + return numImpressora; + } + + public void setNumImpressora(String numImpressora) { + this.numImpressora = numImpressora; + } + + public String getCoo() { + return coo; + } + + public void setCoo(String coo) { + this.coo = coo; + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public String getCnpjCliente() { + return cnpjCliente; + } + + public void setCnpjCliente(String cnpjCliente) { + this.cnpjCliente = cnpjCliente; + } + + public String getCnpjImpressora() { + return cnpjImpressora; + } + + public void setCnpjImpressora(String cnpjImpressora) { + this.cnpjImpressora = cnpjImpressora; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public List getItensFiscais() { + if (itensFiscais == null) { + itensFiscais = new ArrayList(); + } + return itensFiscais; + } + + public void setItensFiscais(List itensFiscais) { + this.itensFiscais = itensFiscais; + } + + public String getNumpdv() { + return numpdv; + } + + public void setNumpdv(String numpdv) { + this.numpdv = numpdv; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public String getNumCaixa() { + return numCaixa; + } + + public void setNumCaixa(String numCaixa) { + this.numCaixa = numCaixa; + } + + public String getModeloImpressora() { + return modeloImpressora; + } + + public void setModeloImpressora(String modeloImpressora) { + this.modeloImpressora = modeloImpressora; + } + + public String getOrigenUf() { + return origenUf; + } + + public void setOrigenUf(String origenUf) { + this.origenUf = origenUf; + } + + public String getDestinoUf() { + return destinoUf; + } + + public void setDestinoUf(String destinoUf) { + this.destinoUf = destinoUf; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Integer getMotivocancelacion() { + return motivocancelacion; + } + + public void setMotivocancelacion(Integer motivocancelacion) { + this.motivocancelacion = motivocancelacion; + } + + public BigDecimal getValorMulta() { + return valorMulta; + } + + public void setValorMulta(BigDecimal valorMulta) { + this.valorMulta = valorMulta; + } + + public BigDecimal getValorTarifa() { + return valorTarifa; + } + + public void setValorTarifa(BigDecimal valorTarifa) { + this.valorTarifa = valorTarifa; + } + + public BigDecimal getValorPedagio() { + return valorPedagio; + } + + public void setValorPedagio(BigDecimal valorPedagio) { + this.valorPedagio = valorPedagio; + } + + public BigDecimal getValorEmbarque() { + return valorEmbarque; + } + + public void setValorEmbarque(BigDecimal valorEmbarque) { + this.valorEmbarque = valorEmbarque; + } + + public BigDecimal getValorSeguro() { + return valorSeguro; + } + + public void setValorSeguro(BigDecimal valorSeguro) { + this.valorSeguro = valorSeguro; + } + + public String getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(String claseServicio) { + this.claseServicio = claseServicio; + } + + public String getDescmotivocancelamento() { + return descmotivocancelamento; + } + + public void setDescmotivocancelamento(String descmotivocancelamento) { + this.descmotivocancelamento = descmotivocancelamento; + } + + public String getCnpjEcf() { + return cnpjEcf; + } + + public void setCnpjEcf(String cnpjEcf) { + this.cnpjEcf = cnpjEcf; + } + + public BigDecimal getImpostoEstado() { + return impostoEstado; + } + + public void setImpostoEstado(BigDecimal impostoEstado) { + this.impostoEstado = impostoEstado; + } + + public BigDecimal getDesconto() { + return desconto; + } + + public void setDesconto(BigDecimal desconto) { + this.desconto = desconto; + } + + public String getIndcancelamento() { + return indcancelamento; + } + + public void setIndcancelamento(String indcancelamento) { + this.indcancelamento = indcancelamento; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((boletoId == null) ? 0 : boletoId.hashCode()); + result = prime * result + ((coo == null) ? 0 : coo.hashCode()); + result = prime * result + ((numImpressora == null) ? 0 : numImpressora.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ImportacionFiscalVO other = (ImportacionFiscalVO) obj; + if (boletoId == null) { + if (other.boletoId != null) + return false; + } else if (!boletoId.equals(other.boletoId)) + return false; + if (coo == null) { + if (other.coo != null) + return false; + } else if (!coo.equals(other.coo)) + return false; + if (numImpressora == null) { + if (other.numImpressora != null) + return false; + } else if (!numImpressora.equals(other.numImpressora)) + return false; + return true; + } + + public boolean isInconsistente() { + return inconsistente; + } + + public void setInconsistente(boolean inconsistente) { + this.inconsistente = inconsistente; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionManualFiscalVO.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionManualFiscalVO.java new file mode 100644 index 000000000..82f5e17f6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionManualFiscalVO.java @@ -0,0 +1,307 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; +import java.util.List; + +public class ImportacionManualFiscalVO { + + private String numImpressora; + private String coo; + private Long boletoId; + private Integer empresaId; + private String empresa; + private String dataEmissao; + private BigDecimal valorTotal; + private Integer origenId; + private String origenUf; + private Integer destinoId; + private String destinoUf; + private String repTributado; + private BigDecimal valorItem; + private String tipoPassagem; + private String numItem; + private String codProduto; + private String serie; + private BigDecimal icms; + private BigDecimal porctributo; + private Integer estadoIdOrigen; + private Integer estadoIdDestino; + private BigDecimal importetaxaembarque; + private BigDecimal importepedagio; + private BigDecimal importeoutros; + private BigDecimal importeseguro; + private String subSerie; + private String aidf; + private String numpdv; + private String modeloImpressora; + private String numCaixa; + private String status; + private String claseServicio; + + List subItens; + + public String getNumImpressora() { + return numImpressora; + } + + public void setNumImpressora(String numImpressora) { + this.numImpressora = numImpressora; + } + + public String getCoo() { + return coo; + } + + public void setCoo(String coo) { + this.coo = coo; + } + + public Long getBoletoId() { + return boletoId; + } + + public void setBoletoId(Long boletoId) { + this.boletoId = boletoId; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public String getDataEmissao() { + return dataEmissao; + } + + public void setDataEmissao(String dataEmissao) { + this.dataEmissao = dataEmissao; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public String getRepTributado() { + return repTributado; + } + + public void setRepTributado(String repTributado) { + this.repTributado = repTributado; + } + + public BigDecimal getValorItem() { + return valorItem; + } + + public void setValorItem(BigDecimal valorItem) { + this.valorItem = valorItem; + } + + public String getTipoPassagem() { + return tipoPassagem; + } + + public void setTipoPassagem(String tipoPassagem) { + this.tipoPassagem = tipoPassagem; + } + + public String getNumItem() { + return numItem; + } + + public void setNumItem(String numItem) { + this.numItem = numItem; + } + + public String getCodProduto() { + return codProduto; + } + + public void setCodProduto(String codProduto) { + this.codProduto = codProduto; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public BigDecimal getIcms() { + return icms; + } + + public void setIcms(BigDecimal icms) { + this.icms = icms; + } + + public BigDecimal getPorctributo() { + return porctributo; + } + + public void setPorctributo(BigDecimal porctributo) { + this.porctributo = porctributo; + } + + public BigDecimal getImportetaxaembarque() { + return importetaxaembarque; + } + + public void setImportetaxaembarque(BigDecimal importetaxaembarque) { + this.importetaxaembarque = importetaxaembarque; + } + + public BigDecimal getImportepedagio() { + return importepedagio; + } + + public void setImportepedagio(BigDecimal importepedagio) { + this.importepedagio = importepedagio; + } + + public BigDecimal getImporteoutros() { + return importeoutros; + } + + public void setImporteoutros(BigDecimal importeoutros) { + this.importeoutros = importeoutros; + } + + public BigDecimal getImporteseguro() { + return importeseguro; + } + + public void setImporteseguro(BigDecimal importeseguro) { + this.importeseguro = importeseguro; + } + + public List getSubItens() { + return subItens; + } + + public void setSubItens(List subItens) { + this.subItens = subItens; + } + + public Integer getEstadoIdOrigen() { + return estadoIdOrigen; + } + + public void setEstadoIdOrigen(Integer estadoIdOrigen) { + this.estadoIdOrigen = estadoIdOrigen; + } + + public Integer getEstadoIdDestino() { + return estadoIdDestino; + } + + public void setEstadoIdDestino(Integer estadoIdDestino) { + this.estadoIdDestino = estadoIdDestino; + } + + public String getSubSerie() { + return subSerie; + } + + public void setSubSerie(String subSerie) { + this.subSerie = subSerie; + } + + public String getAidf() { + return aidf; + } + + public void setAidf(String aidf) { + this.aidf = aidf; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public String getNumpdv() { + return numpdv; + } + + public void setNumpdv(String numpdv) { + this.numpdv = numpdv; + } + + public String getModeloImpressora() { + return modeloImpressora; + } + + public void setModeloImpressora(String modeloImpressora) { + this.modeloImpressora = modeloImpressora; + } + + public String getNumCaixa() { + return numCaixa; + } + + public void setNumCaixa(String numCaixa) { + this.numCaixa = numCaixa; + } + + public String getOrigenUf() { + return origenUf; + } + + public void setOrigenUf(String origenUf) { + this.origenUf = origenUf; + } + + public String getDestinoUf() { + return destinoUf; + } + + public void setDestinoUf(String destinoUf) { + this.destinoUf = destinoUf; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getClaseServicio() { + return claseServicio; + } + + public void setClaseServicio(String claseServicio) { + this.claseServicio = claseServicio; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionNaoFiscalVO.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionNaoFiscalVO.java new file mode 100644 index 000000000..4b99817ab --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ImportacionNaoFiscalVO.java @@ -0,0 +1,51 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; +import java.util.Date; + +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +public class ImportacionNaoFiscalVO { + + private Integer tipoeventoextraId; + private String desctipoevento; + private BigDecimal total; + private Date fechorvta; + + public Integer getTipoeventoextraId() { + return tipoeventoextraId; + } + + public void setTipoeventoextraId(Integer tipoeventoextraId) { + this.tipoeventoextraId = tipoeventoextraId; + } + + public String getDesctipoevento() { + return desctipoevento; + } + + public void setDesctipoevento(String desctipoevento) { + this.desctipoevento = desctipoevento; + } + + public BigDecimal getTotal() { + return total; + } + + public void setTotal(BigDecimal total) { + this.total = total; + } + + public Date getFechorvta() { + return fechorvta; + } + + public void setFechorvta(Date fechorvta) { + this.fechorvta = fechorvta; + } + + public String getNumeroDocumento() { + return getTipoeventoextraId() + DateUtil.getStringDate(getFechorvta(), "ddMMyy"); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemFiscalVO.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemFiscalVO.java new file mode 100644 index 000000000..72d25e519 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemFiscalVO.java @@ -0,0 +1,120 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class ItemFiscalVO extends ImportacionFiscalVO { + + private String numItem; + private String codProduto; + private String repTributado; + private BigDecimal valorItem; + private String tipoPassagem; + private Boolean inconsistencia; + + public ItemFiscalVO() { + super(); + } + + public ItemFiscalVO(ImportacionFiscalVO item) { + super(item.getNumImpressora(), item.getCoo(), item.getBoletoId(), item.getEmpresaId(), item.getDataEmissao(), + item.getCnpjCliente(), item.getCnpjImpressora(), item.getOrigenId(), item.getOrigenUf(), item.getDestinoId(), + item.getDestinoUf(), item.getNumpdv(), item.getModeloImpressora(), item.getNumCaixa(), item.getStatus(), + item.getMotivocancelacion(), item.getValorMulta(), item.getValorTarifa(), item.getValorPedagio(), + item.getValorEmbarque(), item.getValorSeguro(), item.getClaseServicio()); + super.setImpostoEstado(item.getImpostoEstado()); + } + + public String getNumItem() { + return numItem; + } + + public void setNumItem(String numItem) { + this.numItem = numItem; + } + + public String getCodProduto() { + return codProduto; + } + + public void setCodProduto(String codProduto) { + this.codProduto = codProduto; + } + + public String getRepTributado() { + return repTributado; + } + + public void setRepTributado(String repTributado) { + this.repTributado = repTributado; + } + + public BigDecimal getValorItem() { + return valorItem; + } + + public void setValorItem(BigDecimal valorItem) { + this.valorItem = valorItem; + } + + public String getTipoPassagem() { + return tipoPassagem; + } + + public void setTipoPassagem(String tipoPassagem) { + this.tipoPassagem = tipoPassagem; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((super.getBoletoId() == null) ? 0 : super.getBoletoId().hashCode()); + result = prime * result + ((super.getCoo() == null) ? 0 : super.getCoo().hashCode()); + result = prime * result + ((super.getNumImpressora() == null) ? 0 : super.getNumImpressora().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ImportacionFiscalVO other = (ImportacionFiscalVO) obj; + if (super.getBoletoId() == null) { + if (other.getBoletoId() != null) + return false; + } else if (!super.getBoletoId().equals(other.getBoletoId())) + return false; + if (super.getCoo() == null) { + if (other.getCoo() != null) + return false; + } else if (!super.getCoo().equals(other.getCoo())) + return false; + if (super.getNumImpressora() == null) { + if (other.getNumImpressora() != null) + return false; + } else if (!super.getNumImpressora().equals(other.getNumImpressora())) + return false; + return true; + } + + @Override + public String toString() { + return "ItemFiscalVO [numItem=" + numItem + ", codProduto=" + codProduto + ", repTributado=" + repTributado + ", valorItem=" + valorItem + ", tipoPassagem=" + tipoPassagem + ", getNumImpressora()=" + getNumImpressora() + ", getCoo()=" + getCoo() + ", getBoletoId()=" + getBoletoId() + ", getEmpresaId()=" + getEmpresaId() + ", getDataEmissao()=" + getDataEmissao() + ", getCnpjCliente()=" + getCnpjCliente() + ", getCnpjImpressora()=" + getCnpjImpressora() + ", getOrigenId()=" + getOrigenId() + ", getItensFiscais()=" + getItensFiscais().size() + ", getNumpdv()=" + getNumpdv() + "]"; + } + + public Boolean getInconsistencia() { + return inconsistencia; + } + + public void setInconsistencia(Boolean inconsistencia) { + if (inconsistencia == null) + this.inconsistencia = Boolean.FALSE; + else + this.inconsistencia = inconsistencia; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioFinanceiro.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioFinanceiro.java new file mode 100644 index 000000000..84e850c12 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioFinanceiro.java @@ -0,0 +1,44 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class ItemRelatorioFinanceiro { + + private String movimentacao; + private String empresa; + private BigDecimal valorEnCaja; + private String tipoVenta; + + public String getMovimentacao() { + return movimentacao; + } + + public void setMovimentacao(String movimentacao) { + this.movimentacao = movimentacao; + } + + public String getEmpresa() { + return empresa; + } + + public void setEmpresa(String empresa) { + this.empresa = empresa; + } + + public BigDecimal getValorEnCaja() { + return valorEnCaja; + } + + public void setValorEnCaja(BigDecimal valorEnCaja) { + this.valorEnCaja = valorEnCaja; + } + + public String getTipoVenta() { + return tipoVenta; + } + + public void setTipoVenta(String tipoVenta) { + this.tipoVenta = tipoVenta; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioVoucher.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioVoucher.java new file mode 100644 index 000000000..c8971e50a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/ItemRelatorioVoucher.java @@ -0,0 +1,98 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class ItemRelatorioVoucher { + + private String situacao; + private String competenciaEntrega; + private String competenciaVenda; + private String competenciaCancelamento; + private BigDecimal tarifa; + private BigDecimal pedagio; + private BigDecimal embarque; + private BigDecimal seguro; + private Integer qtde; + + public String getSituacao() { + return situacao; + } + + public void setSituacao(String situacao) { + this.situacao = situacao; + } + + public BigDecimal getTarifa() { + return tarifa; + } + + public void setTarifa(BigDecimal tarifa) { + this.tarifa = tarifa; + } + + public BigDecimal getPedagio() { + return pedagio; + } + + public void setPedagio(BigDecimal pedagio) { + this.pedagio = pedagio; + } + + public BigDecimal getEmbarque() { + return embarque; + } + + public void setEmbarque(BigDecimal embarque) { + this.embarque = embarque; + } + + public BigDecimal getSeguro() { + return seguro; + } + + public void setSeguro(BigDecimal seguro) { + this.seguro = seguro; + } + + public Integer getQtde() { + return qtde; + } + + public void setQtde(Integer qtde) { + this.qtde = qtde; + } + + public BigDecimal getTotal() { + BigDecimal total = BigDecimal.ZERO; + total = total.add(getEmbarque()) + .add(getPedagio()) + .add(getSeguro()) + .add(getTarifa()); + return total; + } + + public String getCompetenciaEntrega() { + return competenciaEntrega; + } + + public void setCompetenciaEntrega(String competenciaEntrega) { + this.competenciaEntrega = competenciaEntrega; + } + + public String getCompetenciaVenda() { + return competenciaVenda; + } + + public void setCompetenciaVenda(String competenciaVenda) { + this.competenciaVenda = competenciaVenda; + } + + public String getCompetenciaCancelamento() { + return competenciaCancelamento; + } + + public void setCompetenciaCancelamento(String competenciaCancelamento) { + this.competenciaCancelamento = competenciaCancelamento; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalReducaoZVO.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalReducaoZVO.java new file mode 100644 index 000000000..379c88fae --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalReducaoZVO.java @@ -0,0 +1,149 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class LeitorFiscalReducaoZVO implements Comparable { + + private Integer empresaId; + private String nombempresa; + private String cnpj; + private String datamov; + private BigDecimal aliquota; + private BigDecimal imposto; + private BigDecimal valorNaoTributado; + private BigDecimal vendabrutadiaria; + + public LeitorFiscalReducaoZVO() { + super(); + setAliquota(BigDecimal.ZERO); + setImposto(BigDecimal.ZERO); + setValorNaoTributado(BigDecimal.ZERO); + setVendabrutadiaria(BigDecimal.ZERO); + } + + @Override + public int compareTo(LeitorFiscalReducaoZVO o) { + int retorno = getDatamov().compareTo(o.getDatamov()); + if(retorno == 0) { + retorno = getNombempresa().compareTo(o.getNombempresa()); + } + if(retorno == 0) { + retorno = getCnpj().compareTo(o.getCnpj()); + } + if(retorno == 0) { + retorno = getAliquota().compareTo(o.getAliquota()); + } + return retorno; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getEmpresaId() == null) ? 0 : getEmpresaId().hashCode()); + result = prime * result + ((getDatamov() == null) ? 0 : getDatamov().hashCode()); + result = prime * result + ((getCnpj() == null) ? 0 : getCnpj().hashCode()); + result = prime * result + ((getAliquota() == null) ? 0 : getAliquota().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + LeitorFiscalReducaoZVO other = (LeitorFiscalReducaoZVO) obj; + if (getEmpresaId() == null) { + if (other.getEmpresaId() != null) + return false; + } else if (!getEmpresaId().equals(other.getEmpresaId())) + return false; + if (getDatamov() == null) { + if (other.getDatamov() != null) + return false; + } else if (!getDatamov().equals(other.getDatamov())) + return false; + if (getCnpj() == null) { + if (other.getCnpj() != null) + return false; + } else if (!getCnpj().equals(other.getCnpj())) + return false; + if (getAliquota() == null) { + if (other.getAliquota() != null) + return false; + } else if (!getAliquota().equals(other.getAliquota())) + return false; + return true; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public BigDecimal getAliquota() { + return aliquota; + } + + public void setAliquota(BigDecimal aliquota) { + this.aliquota = aliquota; + } + + public BigDecimal getImposto() { + return imposto; + } + + public void setImposto(BigDecimal imposto) { + this.imposto = imposto; + } + + public BigDecimal getValorNaoTributado() { + return valorNaoTributado; + } + + public void setValorNaoTributado(BigDecimal valorNaoTributado) { + this.valorNaoTributado = valorNaoTributado; + } + + public BigDecimal getVendabrutadiaria() { + return vendabrutadiaria; + } + + public void setVendabrutadiaria(BigDecimal vendabrutadiaria) { + this.vendabrutadiaria = vendabrutadiaria; + } + + public String getCnpj() { + return cnpj; + } + + public void setCnpj(String cnpj) { + this.cnpj = cnpj; + } + + @Override + public String toString() { + return "LeitorFiscalReducaoZVO [empresaId=" + empresaId + ", nombempresa=" + nombempresa + ", cnpj=" + cnpj + ", datamov=" + datamov + ", aliquota=" + aliquota + ", imposto=" + imposto + ", valorNaoTributado=" + valorNaoTributado + ", vendabrutadiaria=" + vendabrutadiaria + "]"; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalVO.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalVO.java new file mode 100644 index 000000000..3d0c56594 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorFiscalVO.java @@ -0,0 +1,145 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +import com.rjconsultores.ventaboletos.utilerias.UtiliteriasFiscal; + +public class LeitorFiscalVO extends ImportacionFiscalVO implements Comparable { + + private static BigDecimal CEM = new BigDecimal(100); + + private String nombempresa; + private Integer qtdeItens; + private BigDecimal aliquota; + + public LeitorFiscalVO() { + super(); + qtdeItens = 0; + setValorEmbarque(BigDecimal.ZERO); + setValorMulta(BigDecimal.ZERO); + setValorPedagio(BigDecimal.ZERO); + setValorSeguro(BigDecimal.ZERO); + setValorTarifa(BigDecimal.ZERO); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getDataEmissao() == null) ? 0 : getDataEmissao().hashCode()); + result = prime * result + ((getEmpresaId() == null) ? 0 : getEmpresaId().hashCode()); + result = prime * result + ((getOrigenUf() == null) ? 0 : getOrigenUf().hashCode()); + result = prime * result + ((getDestinoUf() == null) ? 0 : getDestinoUf().hashCode()); + result = prime * result + ((getClaseServicio() == null) ? 0 : getClaseServicio().hashCode()); + result = prime * result + ((getDescmotivocancelamento() == null) ? 0 : getDescmotivocancelamento().hashCode()); + result = prime * result + ((getAliquota() == null) ? 0 : getAliquota().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof LeitorFiscalVO)) + return false; + LeitorFiscalVO other = (LeitorFiscalVO) obj; + if (getDataEmissao() == null) { + if (other.getDataEmissao() != null) + return false; + } else if (!getDataEmissao().equals(other.getDataEmissao())) + return false; + if (getEmpresaId() == null) { + if (other.getEmpresaId() != null) + return false; + } else if (!getEmpresaId().equals(other.getEmpresaId())) + return false; + if (getOrigenUf() == null) { + if (other.getOrigenUf() != null) + return false; + } else if (!getOrigenUf().equals(other.getOrigenUf())) + return false; + if (getDestinoUf() == null) { + if (other.getDestinoUf() != null) + return false; + } else if (!getDestinoUf().equals(other.getDestinoUf())) + return false; + if (getClaseServicio() == null) { + if (other.getClaseServicio() != null) + return false; + } else if (!getClaseServicio().equals(other.getClaseServicio())) + return false; + if (getDescmotivocancelamento() == null) { + if (other.getDescmotivocancelamento() != null) + return false; + } else if (!getDescmotivocancelamento().equals(other.getDescmotivocancelamento())) + return false; + if (getAliquota() == null) { + if (other.getAliquota() != null) + return false; + } else if (!getAliquota().equals(other.getAliquota())) + return false; + return true; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public Integer getQtdeItens() { + return qtdeItens; + } + + public void setQtdeItens(Integer qtdeItens) { + this.qtdeItens = qtdeItens; + } + + public BigDecimal getAliquota() { + return aliquota; + } + + public void setAliquota(BigDecimal aliquota) { + this.aliquota = aliquota; + } + + public BigDecimal getTotal() { + BigDecimal total = BigDecimal.ZERO; + total = total.add(getValorEmbarque()) + .add(getValorMulta()) + .add(getValorPedagio()) + .add(getValorTarifa()) + .add(getValorSeguro()); + return total; + } + + @Override + public int compareTo(LeitorFiscalVO o) { + int retorno = getDataEmissao().compareTo(o.getDataEmissao()); + if(retorno == 0) { + retorno = getNombempresa().compareTo(o.getNombempresa()); + } + if(retorno == 0) { + retorno = getOrigenUf().compareTo(o.getOrigenUf()); + } + if(retorno == 0) { + retorno = getDestinoUf().compareTo(o.getDestinoUf()); + } + if(retorno == 0) { + retorno = getClaseServicio().compareTo(o.getClaseServicio()); + } + if(retorno == 0) { + retorno = getDescmotivocancelamento().compareTo(o.getDescmotivocancelamento()); + } + return retorno; + } + + public BigDecimal getValorIcms() { + return UtiliteriasFiscal.arredondar(getValorTarifa().multiply(getAliquota().divide(CEM))); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorManualFiscalVO.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorManualFiscalVO.java new file mode 100644 index 000000000..ab7500bbf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorManualFiscalVO.java @@ -0,0 +1,129 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class LeitorManualFiscalVO extends ImportacionManualFiscalVO implements Comparable { + + private String nombempresa; + private Integer qtdeItens; + private BigDecimal valorIcms; + + public LeitorManualFiscalVO() { + super(); + qtdeItens = 0; + setImportetaxaembarque(BigDecimal.ZERO); + setImporteoutros(BigDecimal.ZERO); + setImportepedagio(BigDecimal.ZERO); + setImporteseguro(BigDecimal.ZERO); + setValorItem(BigDecimal.ZERO); + setValorIcms(BigDecimal.ZERO); + setValorTotal(BigDecimal.ZERO); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getDataEmissao() == null) ? 0 : getDataEmissao().hashCode()); + result = prime * result + ((getEmpresaId() == null) ? 0 : getEmpresaId().hashCode()); + result = prime * result + ((getOrigenUf() == null) ? 0 : getOrigenUf().hashCode()); + result = prime * result + ((getDestinoUf() == null) ? 0 : getDestinoUf().hashCode()); + result = prime * result + ((getClaseServicio() == null) ? 0 : getClaseServicio().hashCode()); + result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); + result = prime * result + ((getIcms() == null) ? 0 : getIcms().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof LeitorManualFiscalVO)) + return false; + LeitorManualFiscalVO other = (LeitorManualFiscalVO) obj; + if (getDataEmissao() == null) { + if (other.getDataEmissao() != null) + return false; + } else if (!getDataEmissao().equals(other.getDataEmissao())) + return false; + if (getEmpresaId() == null) { + if (other.getEmpresaId() != null) + return false; + } else if (!getEmpresaId().equals(other.getEmpresaId())) + return false; + if (getOrigenUf() == null) { + if (other.getOrigenUf() != null) + return false; + } else if (!getOrigenUf().equals(other.getOrigenUf())) + return false; + if (getDestinoUf() == null) { + if (other.getDestinoUf() != null) + return false; + } else if (!getDestinoUf().equals(other.getDestinoUf())) + return false; + if (getClaseServicio() == null) { + if (other.getClaseServicio() != null) + return false; + } else if (!getClaseServicio().equals(other.getClaseServicio())) + return false; + if (getStatus() == null) { + if (other.getStatus() != null) + return false; + } else if (!getStatus().equals(other.getStatus())) + return false; + if (getIcms() == null) { + if (other.getIcms() != null) + return false; + } else if (!getIcms().equals(other.getIcms())) + return false; + return true; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public Integer getQtdeItens() { + return qtdeItens; + } + + public void setQtdeItens(Integer qtdeItens) { + this.qtdeItens = qtdeItens; + } + + @Override + public int compareTo(LeitorManualFiscalVO o) { + int retorno = getDataEmissao().compareTo(o.getDataEmissao()); + if(retorno == 0) { + retorno = getNombempresa().compareTo(o.getNombempresa()); + } + if(retorno == 0) { + retorno = getOrigenUf().compareTo(o.getOrigenUf()); + } + if(retorno == 0) { + retorno = getDestinoUf().compareTo(o.getDestinoUf()); + } + if(retorno == 0) { + retorno = getClaseServicio().compareTo(o.getClaseServicio()); + } + if(retorno == 0) { + retorno = getStatus().compareTo(o.getStatus()); + } + return retorno; + } + + public BigDecimal getValorIcms() { + return this.valorIcms; + } + + public void setValorIcms(BigDecimal valorIcms) { + this.valorIcms = valorIcms; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorNaoFiscalVO.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorNaoFiscalVO.java new file mode 100644 index 000000000..5fb09552a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/LeitorNaoFiscalVO.java @@ -0,0 +1,116 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class LeitorNaoFiscalVO implements Comparable { + + private Integer empresaId; + private String nombempresa; + private String datamov; + private Integer tipoeventoextraId; + private String desctipoevento; + private BigDecimal valorTotal; + + public LeitorNaoFiscalVO() { + super(); + setValorTotal(BigDecimal.ZERO); + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getNombempresa() { + return nombempresa; + } + + public void setNombempresa(String nombempresa) { + this.nombempresa = nombempresa; + } + + public String getDatamov() { + return datamov; + } + + public void setDatamov(String datamov) { + this.datamov = datamov; + } + + public Integer getTipoeventoextraId() { + return tipoeventoextraId; + } + + public void setTipoeventoextraId(Integer tipoeventoextraId) { + this.tipoeventoextraId = tipoeventoextraId; + } + + public String getDesctipoevento() { + return desctipoevento; + } + + public void setDesctipoevento(String desctipoevento) { + this.desctipoevento = desctipoevento; + } + + public BigDecimal getValorTotal() { + return valorTotal; + } + + public void setValorTotal(BigDecimal valorTotal) { + this.valorTotal = valorTotal; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((datamov == null) ? 0 : datamov.hashCode()); + result = prime * result + ((empresaId == null) ? 0 : empresaId.hashCode()); + result = prime * result + ((tipoeventoextraId == null) ? 0 : tipoeventoextraId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + LeitorNaoFiscalVO other = (LeitorNaoFiscalVO) obj; + if (datamov == null) { + if (other.datamov != null) + return false; + } else if (!datamov.equals(other.datamov)) + return false; + if (empresaId == null) { + if (other.empresaId != null) + return false; + } else if (!empresaId.equals(other.empresaId)) + return false; + if (tipoeventoextraId == null) { + if (other.tipoeventoextraId != null) + return false; + } else if (!tipoeventoextraId.equals(other.tipoeventoextraId)) + return false; + return true; + } + + @Override + public int compareTo(LeitorNaoFiscalVO o) { + int retorno = getDatamov().compareTo(o.getDatamov()); + if (retorno == 0) { + retorno = getNombempresa().compareTo(o.getNombempresa()); + } + if (retorno == 0) { + retorno = getDesctipoevento().compareTo(o.getDesctipoevento()); + } + return retorno; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/RelatorioFinanceiro.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/RelatorioFinanceiro.java new file mode 100644 index 000000000..2040553f6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/RelatorioFinanceiro.java @@ -0,0 +1,63 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.util.Date; + +public class RelatorioFinanceiro { + + private Date data; + private String agencia; + private String formaPagamento; + private Double tarifa; + private Double pedagio; + private Double seguro; + private Double taxas; + private Double total; + public Date getData() { + return data; + } + public void setData(Date data) { + this.data = data; + } + public String getAgencia() { + return agencia; + } + public void setAgencia(String agencia) { + this.agencia = agencia; + } + public String getFormaPagamento() { + return formaPagamento; + } + public void setFormaPagamento(String formaPagamento) { + this.formaPagamento = formaPagamento; + } + public Double getTarifa() { + return tarifa; + } + public void setTarifa(Double tarifa) { + this.tarifa = tarifa; + } + public Double getPedagio() { + return pedagio; + } + public void setPedagio(Double pedagio) { + this.pedagio = pedagio; + } + public Double getSeguro() { + return seguro; + } + public void setSeguro(Double seguro) { + this.seguro = seguro; + } + public Double getTaxas() { + return taxas; + } + public void setTaxas(Double taxas) { + this.taxas = taxas; + } + public Double getTotal() { + return total; + } + public void setTotal(Double total) { + this.total = total; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SiglaMotivoCancelacion.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SiglaMotivoCancelacion.java new file mode 100644 index 000000000..79c335541 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SiglaMotivoCancelacion.java @@ -0,0 +1,29 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +public enum SiglaMotivoCancelacion { + + DEVOLUCAO, CANCELAMENTO, CHECKIN, TROCA, TRANSFERENCIA; + + public static SiglaMotivoCancelacion valueOf(Integer motivocancelacionId) { + switch (motivocancelacionId) { + case 31: + return CANCELAMENTO; + + case 32: + return DEVOLUCAO; + + case 10: + return TROCA; + + case 23: + return TRANSFERENCIA; + + case 27: + return CHECKIN; + + default: + return CANCELAMENTO; + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SituacaoTributaria.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SituacaoTributaria.java new file mode 100644 index 000000000..4dae14cdd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SituacaoTributaria.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +public enum SituacaoTributaria { + TRIBUTADO("T"), NAO_TRIBUTADO("N1"), CANCELADO("Can-T"), DESCONTO("DT"), NAO_FISCAL("OPNF"); + + private String value; + + private SituacaoTributaria(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SubItens.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SubItens.java new file mode 100644 index 000000000..42fbb3b2a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/SubItens.java @@ -0,0 +1,30 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class SubItens { + public SubItens(BigDecimal valor, String codProduto) { + super(); + this.valor = valor; + this.codProduto = codProduto; + } + + private BigDecimal valor; + private String codProduto; + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public String getCodProduto() { + return codProduto; + } + + public void setCodProduto(String codProduto) { + this.codProduto = codProduto; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TipoPendencia.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TipoPendencia.java new file mode 100644 index 000000000..f4b26b2af --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TipoPendencia.java @@ -0,0 +1,5 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +public enum TipoPendencia { + DIF_RED_Z, DIF_ECF +} diff --git a/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TotalRelatorioVoucher.java b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TotalRelatorioVoucher.java new file mode 100644 index 000000000..ad6c58c1f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/impressaofiscal/TotalRelatorioVoucher.java @@ -0,0 +1,104 @@ +package com.rjconsultores.ventaboletos.vo.impressaofiscal; + +import java.math.BigDecimal; + +public class TotalRelatorioVoucher { + + private String status; + private BigDecimal tarifa; + private BigDecimal pedagio; + private BigDecimal embarque; + private BigDecimal seguro; + + public TotalRelatorioVoucher() { + super(); + this.tarifa = BigDecimal.ZERO; + this.pedagio = BigDecimal.ZERO; + this.embarque = BigDecimal.ZERO; + this.seguro = BigDecimal.ZERO; + } + + public TotalRelatorioVoucher(String status, BigDecimal tarifa, BigDecimal pedagio, BigDecimal embarque, BigDecimal seguro) { + this(); + this.status = status; + this.tarifa = tarifa; + this.pedagio = pedagio; + this.embarque = embarque; + this.seguro = seguro; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public BigDecimal getTarifa() { + return tarifa; + } + + public void setTarifa(BigDecimal tarifa) { + this.tarifa = tarifa; + } + + public BigDecimal getPedagio() { + return pedagio; + } + + public void setPedagio(BigDecimal pedagio) { + this.pedagio = pedagio; + } + + public BigDecimal getEmbarque() { + return embarque; + } + + public void setEmbarque(BigDecimal embarque) { + this.embarque = embarque; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((status == null) ? 0 : status.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + TotalRelatorioVoucher other = (TotalRelatorioVoucher) obj; + if (status == null) { + if (other.status != null) + return false; + } else if (!status.equals(other.status)) + return false; + return true; + } + + public BigDecimal getTotal() { + BigDecimal total = BigDecimal.ZERO; + total = total.add(getTarifa()) + .add(getEmbarque()) + .add(getPedagio()); + + return total; + } + + public BigDecimal getSeguro() { + return seguro; + } + + public void setSeguro(BigDecimal seguro) { + this.seguro = seguro; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/integracao/FechamentoCntCorrenteVO.java b/src/com/rjconsultores/ventaboletos/vo/integracao/FechamentoCntCorrenteVO.java new file mode 100644 index 000000000..8996cae45 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/integracao/FechamentoCntCorrenteVO.java @@ -0,0 +1,155 @@ +package com.rjconsultores.ventaboletos.vo.integracao; + +import java.math.BigDecimal; + +public class FechamentoCntCorrenteVO { + + public FechamentoCntCorrenteVO() { + super(); + // TODO Auto-generated constructor stub + } + + private Long fechamentocntcorrenteId; + private String fecfechamento; + private String feclancamento; + private String anofechamento; + private String mesfechamento; + private BigDecimal total; + private String nombpuntoventa; + private String cnpjPuntoVenta; + private String numPuntoVenta; + private Integer empresaId; + private String nombEmpresa; + private String ufEmpresa; + private Boolean integradoSap; + private boolean enviar; + + public FechamentoCntCorrenteVO(Long fechamentocntcorrenteId, String fecfechamento, String feclancamento, String anofechamento, String mesfechamento, BigDecimal total, String nombpuntoventa, String cnpjPuntoVenta, Integer empresaId, String nombEmpresa, String ufEmpresa, Boolean integradoSap) { + super(); + this.fechamentocntcorrenteId = fechamentocntcorrenteId; + this.fecfechamento = fecfechamento; + this.feclancamento = feclancamento; + this.anofechamento = anofechamento; + this.mesfechamento = mesfechamento; + this.total = total; + this.nombpuntoventa = nombpuntoventa; + this.cnpjPuntoVenta = cnpjPuntoVenta; + this.empresaId = empresaId; + this.nombEmpresa = nombEmpresa; + this.ufEmpresa = ufEmpresa; + this.integradoSap = integradoSap; + } + + public Long getFechamentocntcorrenteId() { + return fechamentocntcorrenteId; + } + + public void setFechamentocntcorrenteId(Long fechamentocntcorrenteId) { + this.fechamentocntcorrenteId = fechamentocntcorrenteId; + } + + public String getFecfechamento() { + return fecfechamento; + } + + public void setFecfechamento(String fecfechamento) { + this.fecfechamento = fecfechamento; + } + + public BigDecimal getTotal() { + return total; + } + + public void setTotal(BigDecimal total) { + this.total = total; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + + public String getCnpjPuntoVenta() { + return cnpjPuntoVenta; + } + + public void setCnpjPuntoVenta(String cnpjPuntoVenta) { + this.cnpjPuntoVenta = cnpjPuntoVenta; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getNombEmpresa() { + return nombEmpresa; + } + + public void setNombEmpresa(String nombEmpresa) { + this.nombEmpresa = nombEmpresa; + } + + public String getUfEmpresa() { + return ufEmpresa; + } + + public void setUfEmpresa(String ufEmpresa) { + this.ufEmpresa = ufEmpresa; + } + + public boolean isIntegradoSap() { + return Boolean.TRUE.equals(integradoSap); + } + + public void setIntegradoSap(boolean integradoSap) { + this.integradoSap = integradoSap; + } + + public String getFeclancamento() { + return feclancamento; + } + + public void setFeclancamento(String feclancamento) { + this.feclancamento = feclancamento; + } + + public String getMesfechamento() { + return mesfechamento; + } + + public void setMesfechamento(String mesfechamento) { + this.mesfechamento = mesfechamento; + } + + public String getAnofechamento() { + return anofechamento; + } + + public void setAnofechamento(String anofechamento) { + this.anofechamento = anofechamento; + } + + public Boolean isEnviar() { + return enviar; + } + + public void setEnviar(Boolean enviar) { + this.enviar = enviar; + } + + public String getNumPuntoVenta() { + return numPuntoVenta; + } + + public void setNumPuntoVenta(String numPuntoVenta) { + this.numPuntoVenta = numPuntoVenta; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/layout/DiagramaPoltronas.java b/src/com/rjconsultores/ventaboletos/vo/layout/DiagramaPoltronas.java new file mode 100644 index 000000000..12d0508e7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/layout/DiagramaPoltronas.java @@ -0,0 +1,345 @@ +package com.rjconsultores.ventaboletos.vo.layout; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.entidad.DetDiagramaAutobus; + +public class DiagramaPoltronas implements Comparable { + + private static Integer TOTAL_FILAS = 12; + private static Integer TOTAL_COLUNAS = 21; + + private Integer fila; + + private List colunas; + + public DiagramaPoltronas() { + super(); + } + + public DiagramaPoltronas(Integer fila) { + this(); + this.fila = fila; + } + + public DiagramaPoltronas(Short fila) { + this(); + this.fila = fila.intValue(); + } + + public class Coluna implements Comparable { + + private Integer coluna; + + private DiagramaPoltronas fila; + + private List poltronas; + + public Coluna() { + super(); + } + + public Coluna(Integer coluna, DiagramaPoltronas fila) { + this(); + this.fila = fila; + this.coluna = coluna; + } + + public Coluna(Short coluna, DiagramaPoltronas fila) { + this(); + this.fila = fila; + this.coluna = coluna.intValue(); + } + + public Integer getColuna() { + return coluna; + } + + public void setColuna(Integer coluna) { + this.coluna = coluna; + } + + @Override + public int compareTo(Coluna o) { + return this.getColuna().compareTo(o.getColuna()); + } + + public List getPoltronas() { + return poltronas; + } + + public DiagramaPoltronas getFila() { + return fila; + } + + public void setFila(DiagramaPoltronas fila) { + this.fila = fila; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((coluna == null) ? 0 : coluna.hashCode()); + result = prime * result + ((fila == null) ? 0 : fila.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Coluna other = (Coluna) obj; + if (coluna == null) { + if (other.coluna != null) + return false; + } else if (!coluna.equals(other.coluna)) + return false; + if (fila == null) { + if (other.fila != null) + return false; + } else if (!fila.equals(other.fila)) + return false; + return true; + } + + public void adicionarPoltrona(String asiento, Boolean vendible) { + Poltrona poltrona = new Poltrona(getFila(), this, asiento, vendible); + if(poltronas == null) { + poltronas = new ArrayList(); + poltronas.add(poltrona); + } else { + int index = poltronas.indexOf(poltrona); + if(index > -1) { + poltronas.set(index, poltrona); + } else { + poltronas.add(poltrona); + } + } + } + + } + + public class Poltrona { + + private static final String CLASS_GREEN = "myGreen"; + private static final String CLASS_GREY = "myGrey"; + private static final String CLASS_WHITE = "myWhite"; + + private DiagramaPoltronas fila; + private Coluna coluna; + private String asiento; + + private String sClass; + private Boolean vendible; + + public Poltrona(DiagramaPoltronas fila, Coluna coluna, String asiento, Boolean vendible) { + this.fila = fila; + this.coluna = coluna; + this.asiento = asiento; + this.vendible = vendible; + sClass = CLASS_GREY; + if(StringUtils.isBlank(asiento)) { + sClass = CLASS_WHITE; + } else if(vendible != null && vendible) { + sClass = CLASS_GREEN; + } + } + + public DiagramaPoltronas getFila() { + return fila; + } + + public void setFila(DiagramaPoltronas fila) { + this.fila = fila; + } + + public Coluna getColuna() { + return coluna; + } + + public void setColuna(Coluna coluna) { + this.coluna = coluna; + } + + public String getAsiento() { + return asiento; + } + + public void setAsiento(String asiento) { + this.asiento = asiento; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + getOuterType().hashCode(); + result = prime * result + ((asiento == null) ? 0 : asiento.hashCode()); + result = prime * result + ((coluna == null) ? 0 : coluna.hashCode()); + result = prime * result + ((fila == null) ? 0 : fila.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Poltrona other = (Poltrona) obj; + if (!getOuterType().equals(other.getOuterType())) + return false; + if (asiento == null) { + if (other.asiento != null) + return false; + } else if (!asiento.equals(other.asiento)) + return false; + if (coluna == null) { + if (other.coluna != null) + return false; + } else if (!coluna.equals(other.coluna)) + return false; + if (fila == null) { + if (other.fila != null) + return false; + } else if (!fila.equals(other.fila)) + return false; + return true; + } + + private DiagramaPoltronas getOuterType() { + return DiagramaPoltronas.this; + } + + @Override + public String toString() { + return "bbtn_" + fila.getFila() + "_" + coluna.getColuna(); + } + + public String getsClass() { + return sClass; + } + + public void setsClass(String sClass) { + this.sClass = sClass; + } + + public Boolean getNotVendible() { + return !getVendible(); + } + + public Boolean getVendible() { + return vendible; + } + + public void setVendible(Boolean vendible) { + this.vendible = vendible; + } + + } + + public Integer getFila() { + return fila; + } + + public void setFila(Integer fila) { + this.fila = fila; + } + + public List getColunas() { + return colunas; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + fila; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + DiagramaPoltronas other = (DiagramaPoltronas) obj; + if (fila != other.fila) + return false; + return true; + } + + @Override + public int compareTo(DiagramaPoltronas o) { + return this.getFila().compareTo(o.getFila()); + } + + public static List getLayoutVazio() { + List layout = new ArrayList(); + for (int i = 1; i <= TOTAL_FILAS; i++) { + DiagramaPoltronas fila = new DiagramaPoltronas(i); + for (int j = 1; j <= TOTAL_COLUNAS; j++) { + Coluna coluna = fila.new Coluna(j, fila); + coluna.adicionarPoltrona("",false); + fila.adicionarColuna(coluna); + } + layout.add(fila); + } + Collections.sort(layout); + for (DiagramaPoltronas fila : layout) { + Collections.sort(fila.getColunas()); + } + return layout; + } + + private void adicionarColuna(Coluna coluna) { + if(colunas == null) { + colunas = new ArrayList(); + colunas.add(coluna); + } else { + int index = colunas.indexOf(coluna); + if(index > -1) { + colunas.set(index, coluna); + } else { + colunas.add(coluna); + } + } + } + + public static List carregarLayoutExistente(List detDiagramaAutobus) { + List layout = getLayoutVazio(); + for (DetDiagramaAutobus diagramaAutobus : detDiagramaAutobus) { + DiagramaPoltronas fila = new DiagramaPoltronas(diagramaAutobus.getNumefila()); + int index = layout.indexOf(fila); + if(index > -1) { + fila = layout.get(index); + } + + Coluna coluna = fila.new Coluna(diagramaAutobus.getNumecolumna(), fila); + fila.adicionarColuna(coluna); + + coluna.adicionarPoltrona(diagramaAutobus.getAsiento(), diagramaAutobus.getVendible()); + + if(index == -1) { + layout.add(fila); + } + + } + return layout; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/vo/parada/ConexionCtrlVO.java b/src/com/rjconsultores/ventaboletos/vo/parada/ConexionCtrlVO.java new file mode 100644 index 000000000..e63cd0759 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/parada/ConexionCtrlVO.java @@ -0,0 +1,88 @@ +package com.rjconsultores.ventaboletos.vo.parada; + +public class ConexionCtrlVO { + + private Integer origenId; + private Integer destinoId; + private Integer grupo; + private boolean valida; + + public ConexionCtrlVO(Integer origemConexaoCtrl, Integer destinoConexaoCtrl) { + this.grupo = 0; + this.origenId = origemConexaoCtrl; + this.destinoId = destinoConexaoCtrl; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((destinoId == null) ? 0 : destinoId.hashCode()); + result = prime * result + ((origenId == null) ? 0 : origenId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ConexionCtrlVO)) + return false; + ConexionCtrlVO other = (ConexionCtrlVO) obj; + if (getDestinoId() == null) { + if (other.getDestinoId() != null) + return false; + } else if (!getDestinoId().equals(other.getDestinoId())) + return false; + if (getOrigenId() == null) { + if (other.getOrigenId() != null) + return false; + } else if (!getOrigenId().equals(other.getOrigenId())) + return false; + return true; + } + + public void incrementarGrupo() { + grupo++; + } + + public void decrementarGrupo() { + grupo--; + } + + public Integer getGrupo() { + return grupo; + } + + public boolean isOrigemDestinoIgual(Integer origemConexaoCtrl, Integer destinoConexaoCtrl) { + return getOrigenId() != null && getOrigenId().equals(origemConexaoCtrl) && + getDestinoId() !=null && getDestinoId().equals(destinoConexaoCtrl); + } + + public boolean isValida() { + return valida; + } + + public void setValida(boolean valida) { + this.valida = valida; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/parada/ConexionRutaConfVO.java b/src/com/rjconsultores/ventaboletos/vo/parada/ConexionRutaConfVO.java new file mode 100644 index 000000000..922537d4f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/parada/ConexionRutaConfVO.java @@ -0,0 +1,34 @@ +package com.rjconsultores.ventaboletos.vo.parada; + +import java.util.ArrayList; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionCtrl; + +public class ConexionRutaConfVO { + + private List localidadesCombinadas; + private List listConexionCtrl; + + public ConexionRutaConfVO() { + localidadesCombinadas = new ArrayList(); + listConexionCtrl = new ArrayList(); + } + + public List getLocalidadesCombinadas() { + return localidadesCombinadas; + } + + public void setLocalidadesCombinadas(List localidadesCombinadas) { + this.localidadesCombinadas = localidadesCombinadas; + } + + public List getListConexionCtrl() { + return listConexionCtrl; + } + + public void setListConexionCtrl(List listConexionCtrl) { + this.listConexionCtrl = listConexionCtrl; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/parada/ConexionRutaCtrlVO.java b/src/com/rjconsultores/ventaboletos/vo/parada/ConexionRutaCtrlVO.java new file mode 100644 index 000000000..5395921e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/parada/ConexionRutaCtrlVO.java @@ -0,0 +1,76 @@ +package com.rjconsultores.ventaboletos.vo.parada; + +public class ConexionRutaCtrlVO { + + private Integer rutaIdA; + private Integer rutaIdB; + private Integer rutaIdC; + + public ConexionRutaCtrlVO(Integer rutaIdA, Integer rutaIdB, Integer rutaIdC) { + this.rutaIdA = rutaIdA; + this.rutaIdB = rutaIdB; + this.rutaIdC = rutaIdC; + } + + public Integer getRutaIdA() { + return rutaIdA; + } + + public void setRutaIdA(Integer rutaIdA) { + this.rutaIdA = rutaIdA; + } + + public Integer getRutaIdB() { + return rutaIdB; + } + + public void setRutaIdB(Integer rutaIdB) { + this.rutaIdB = rutaIdB; + } + + public Integer getRutaIdC() { + return rutaIdC; + } + + public void setRutaIdC(Integer rutaIdC) { + this.rutaIdC = rutaIdC; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getRutaIdA() == null) ? 0 : getRutaIdA().hashCode()); + result = prime * result + ((getRutaIdB() == null) ? 0 : getRutaIdB().hashCode()); + result = prime * result + ((getRutaIdC() == null) ? 0 : getRutaIdC().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ConexionRutaCtrlVO)) + return false; + ConexionRutaCtrlVO other = (ConexionRutaCtrlVO) obj; + if (getRutaIdA() == null) { + if (other.getRutaIdA() != null) + return false; + } else if (!getRutaIdA().equals(other.getRutaIdA())) + return false; + if (getRutaIdB() == null) { + if (other.getRutaIdB() != null) + return false; + } else if (!getRutaIdB().equals(other.getRutaIdB())) + return false; + if (getRutaIdC() == null) { + if (other.getRutaIdC() != null) + return false; + } else if (!getRutaIdC().equals(other.getRutaIdC())) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/parada/ParadaVO.java b/src/com/rjconsultores/ventaboletos/vo/parada/ParadaVO.java new file mode 100644 index 000000000..cef2b6c92 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/parada/ParadaVO.java @@ -0,0 +1,98 @@ +package com.rjconsultores.ventaboletos.vo.parada; + +import com.rjconsultores.ventaboletos.entidad.Parada; + +public class ParadaVO { + + private Integer paradaId; + private String descparada; + private Integer ciudadId; + private String nombciudad; + private Integer estadoId; + private String nombestado; + private String cveestado; + + public ParadaVO(Integer paradaId, String descparada, Integer ciudadId, String nombciudad, Integer estadoId, String nombestado, String cveestado) { + super(); + this.paradaId = paradaId; + this.descparada = descparada; + this.ciudadId = ciudadId; + this.nombciudad = nombciudad; + this.estadoId = estadoId; + this.nombestado = nombestado; + this.cveestado = cveestado; + } + + public ParadaVO(Parada parada) { + super(); + this.paradaId = parada.getParadaId(); + this.descparada = parada.getDescparada(); + this.ciudadId = parada.getCiudad().getCiudadId(); + this.nombciudad = parada.getCiudad().getNombciudad(); + this.estadoId = parada.getCiudad().getEstado().getEstadoId(); + this.nombestado = parada.getCiudad().getEstado().getNombestado(); + this.cveestado = parada.getCiudad().getEstado().getCveestado(); + } + + public ParadaVO(Integer paradaId) { + super(); + this.paradaId = paradaId; + } + + public Integer getParadaId() { + return paradaId; + } + + public void setParadaId(Integer paradaId) { + this.paradaId = paradaId; + } + + public String getDescparada() { + return descparada; + } + + public void setDescparada(String descparada) { + this.descparada = descparada; + } + + public Integer getCiudadId() { + return ciudadId; + } + + public void setCiudadId(Integer ciudadId) { + this.ciudadId = ciudadId; + } + + public String getNombciudad() { + return nombciudad; + } + + public void setNombciudad(String nombciudad) { + this.nombciudad = nombciudad; + } + + public Integer getEstadoId() { + return estadoId; + } + + public void setEstadoId(Integer estadoId) { + this.estadoId = estadoId; + } + + public String getNombestado() { + return nombestado; + } + + public void setNombestado(String nombestado) { + this.nombestado = nombestado; + } + + public String getCveestado() { + return cveestado; + } + + public void setCveestado(String cveestado) { + this.cveestado = cveestado; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/parada/ParadaVOConexionRuta.java b/src/com/rjconsultores/ventaboletos/vo/parada/ParadaVOConexionRuta.java new file mode 100644 index 000000000..afc19a188 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/parada/ParadaVOConexionRuta.java @@ -0,0 +1,190 @@ +package com.rjconsultores.ventaboletos.vo.parada; + +import com.rjconsultores.ventaboletos.entidad.Parada; + +public class ParadaVOConexionRuta { + + private Long conexionRutaTramoId; + private Parada paradaOrigem; + private Parada paradaDestino; + private Parada paradaOrigemTrecho; + private Parada paradaDestinoTrecho; + private Integer rutaId; + private String numRuta; + private Short secuencia; + private boolean valido; + private Integer grupo; + private String sentido; + + private ConexionCtrlVO conexionCtrl; + private ConexionRutaCtrlVO conexionRutaCtrl; + + public ParadaVOConexionRuta(int grupo, Parada paradaOrigem, Parada paradaDestino, Integer rutaId, String numRuta, Short secuencia, + boolean valido, Parada paradaOrigemTrecho, Parada paradaDestinoTrecho, ConexionCtrlVO conexionCtrl, + ConexionRutaCtrlVO conexionRutaCtrl, String sentido) { + super(); + this.grupo = grupo; + this.paradaOrigem = paradaOrigem; + this.paradaDestino = paradaDestino; + this.rutaId = rutaId; + this.numRuta = numRuta; + this.secuencia = secuencia; + this.valido = valido; + this.paradaOrigemTrecho = paradaOrigemTrecho; + this.paradaDestinoTrecho = paradaDestinoTrecho; + this.conexionCtrl = conexionCtrl; + this.conexionRutaCtrl = conexionRutaCtrl; + this.sentido = sentido; + } + + public Parada getParadaOrigem() { + return paradaOrigem; + } + + public void setParadaOrigem(Parada paradaOrigem) { + this.paradaOrigem = paradaOrigem; + } + + public Parada getParadaDestino() { + return paradaDestino; + } + + public void setParadaDestino(Parada paradaDestino) { + this.paradaDestino = paradaDestino; + } + + public Integer getRutaId() { + return rutaId; + } + + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + + public Short getSecuencia() { + return secuencia; + } + + public void setSecuencia(Short secuencia) { + this.secuencia = secuencia; + } + + public boolean isValido() { + return valido; + } + + public void setValido(boolean valido) { + this.valido = valido; + } + + public Parada getParadaOrigemTrecho() { + return paradaOrigemTrecho; + } + + public void setParadaOrigemTrecho(Parada paradaOrigemTrecho) { + this.paradaOrigemTrecho = paradaOrigemTrecho; + } + + public Parada getParadaDestinoTrecho() { + return paradaDestinoTrecho; + } + + public void setParadaDestinoTrecho(Parada paradaDestinoTrecho) { + this.paradaDestinoTrecho = paradaDestinoTrecho; + } + + public String getNumRuta() { + return numRuta; + } + + public void setNumRuta(String numRuta) { + this.numRuta = numRuta; + } + + public Integer getGrupo() { + return grupo; + } + + public void setGrupo(Integer grupo) { + this.grupo = grupo; + } + + @Override + public String toString() { + return "ParadaVOConexionRuta [paradaOrigem=" + paradaOrigem + ", paradaDestino=" + paradaDestino + ", paradaOrigemTrecho=" + paradaOrigemTrecho + ", paradaDestinoTrecho=" + paradaDestinoTrecho + ", rutaId=" + rutaId + ", numRuta=" + numRuta + ", secuencia=" + secuencia + ", valido=" + valido + "]"; + } + + public ConexionCtrlVO getConexionCtrl() { + return conexionCtrl; + } + + public void setConexionCtrl(ConexionCtrlVO conexionCtrl) { + this.conexionCtrl = conexionCtrl; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getParadaDestino() == null) ? 0 : getParadaDestino().hashCode()); + result = prime * result + ((getParadaOrigem() == null) ? 0 : getParadaOrigem().hashCode()); + result = prime * result + ((getRutaId() == null) ? 0 : getRutaId().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ParadaVOConexionRuta)) + return false; + ParadaVOConexionRuta other = (ParadaVOConexionRuta) obj; + if (getParadaDestino() == null) { + if (other.getParadaDestino() != null) + return false; + } else if (!getParadaDestino().equals(other.getParadaDestino())) + return false; + if (getParadaOrigem() == null) { + if (other.getParadaOrigem() != null) + return false; + } else if (!getParadaOrigem().equals(other.getParadaOrigem())) + return false; + if (getRutaId() == null) { + if (other.getRutaId() != null) + return false; + } else if (!getRutaId().equals(other.getRutaId())) + return false; + return true; + } + + public ConexionRutaCtrlVO getConexionRutaCtrl() { + return conexionRutaCtrl; + } + + public void setConexionRutaCtrl(ConexionRutaCtrlVO conexionRutaCtrl) { + this.conexionRutaCtrl = conexionRutaCtrl; + } + + public Long getConexionRutaTramoId() { + return conexionRutaTramoId; + } + + public void setConexionRutaTramoId(Long conexionRutaTramoId) { + this.conexionRutaTramoId = conexionRutaTramoId; + } + + public String getSentido() { + return sentido; + } + + public void setSentido(String sentido) { + this.sentido = sentido; + } + + public String getNumRutaSentido() { + return numRuta + " - " + sentido; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/Pricing.java b/src/com/rjconsultores/ventaboletos/vo/pricing/Pricing.java new file mode 100644 index 000000000..8aa543fce --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/Pricing.java @@ -0,0 +1,381 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PricingClase; +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; + +public class Pricing implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer pricingId; + private String nomePricing; + private String aplicaFeriadoDtViagem; + private String aplicaFeriadoDtVenda; + private Integer empresaId; + private Integer qtdePoltronas; + private Integer tipoPricingPorcentagem; + private BigDecimal porcentagemIda; + private BigDecimal porcentagemIdaVolta; + private Integer podeTransferir; + private Integer podeCancelar; + private Integer podeReservar; + private Integer diasAtencipacao; + private Integer exibirVenda; + private BigDecimal valor; + + private String pricingoperacao; + + private List poltronas; // + private List canalvendas; // + private List categorias; // + private List classes; // + private List servicos; // + private List dias; // + private List ocupacoes; // + private List puntoventas; // + private List linhas; // + private List tiposervicos; // + private List mercados; // + private List vigencias; // + private List marcas; // + + public Pricing() { + super(); + } + + public Pricing(com.rjconsultores.ventaboletos.entidad.Pricing pricing) { + this(); + pricingId = pricing.getPricingId(); + nomePricing = pricing.getNombPricing(); + aplicaFeriadoDtViagem = pricing.getIndGeneraFeriadoViaje(); + aplicaFeriadoDtVenda = pricing.getIndGeneraFeriadoVenta(); + empresaId = pricing.getEmpresa().getEmpresaId(); + qtdePoltronas = pricing.getCantboleto() != null ? pricing.getCantboleto().intValue() : null; + tipoPricingPorcentagem = pricing.getDescuentoporcentaje() != null ? 1 : 0; + porcentagemIda = pricing.getDescuentoporcentaje(); + porcentagemIdaVolta = pricing.getDescuentoporcredondo(); + podeTransferir = pricing.getIndtransferible() ? 1 : 0; + podeCancelar = pricing.getIndcancelable() ? 1 : 0; + podeReservar = pricing.getIndreservable() ? 1 : 0; + diasAtencipacao = pricing.getCantdiasanticipacion(); + exibirVenda = pricing.getExibeVenda() ? 1 : 0; + + poltronas = new ArrayList(0); + for (com.rjconsultores.ventaboletos.entidad.PricingAsiento pricingAsiento : pricing.getPricingAsientoList()) { + PricingAsiento pricingasientoVO = new PricingAsiento(pricingAsiento); + poltronas.add(pricingasientoVO); + } + + canalvendas = new ArrayList(0); + for (PricingTipoPtoVta pricingTipoPtoVta : pricing.getPricingTipoptovtaList()) { + PricingCanalVenta pricingCanalVenta = new PricingCanalVenta(pricingTipoPtoVta); + canalvendas.add(pricingCanalVenta); + } + + categorias = new ArrayList(0); + for (com.rjconsultores.ventaboletos.entidad.PricingCategoria pricingCategoria : pricing.getPricingCategoriaList()) { + PricingCategoria pricingCategoriaVO = new PricingCategoria(pricingCategoria); + categorias.add(pricingCategoriaVO); + } + + classes = new ArrayList(0); + for (PricingClase pricingClase : pricing.getPricingClaseList()) { + PricingClasse pricingClasse = new PricingClasse(pricingClase); + classes.add(pricingClasse); + } + + servicos = new ArrayList(0); + for (com.rjconsultores.ventaboletos.entidad.PricingCorrida pricingCorrida : pricing.getPricingCorridaList()) { + PricingCorrida pricingCorridaVO = new PricingCorrida(pricingCorrida); + servicos.add(pricingCorridaVO); + } + + dias = new ArrayList(0); + for (com.rjconsultores.ventaboletos.entidad.PricingDia pricingDia : pricing.getPricingDiaList()) { + PricingDia pricingDiaVO = new PricingDia(pricingDia); + dias.add(pricingDiaVO); + } + + ocupacoes = new ArrayList(0); + for (com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa pricingOcupaAntecipa : pricing.getPricingOcupaAntecipaList()) { + PricingOcupaAntecipa pricingOcupaAntecipaVO = new PricingOcupaAntecipa(pricingOcupaAntecipa); + ocupacoes.add(pricingOcupaAntecipaVO); + } + + puntoventas = new ArrayList(0); + for (com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta pricingPuntoVenta : pricing.getPricingPuntoventaList()) { + PricingPuntoVenta pricingPuntoVentaVO = new PricingPuntoVenta(pricingPuntoVenta); + puntoventas.add(pricingPuntoVentaVO); + } + + linhas = new ArrayList(0); + for (com.rjconsultores.ventaboletos.entidad.PricingRuta pricingRuta : pricing.getPricingRutaList()) { + PricingRuta pricingRutaVO = new PricingRuta(pricingRuta); + linhas.add(pricingRutaVO); + } + + tiposervicos = new ArrayList(0); + for (PricingTipoServicio pricingTipoServicio: pricing.getPricingTipoServicioList()) { + PricingTipoCorrida pricingTipoCorrida = new PricingTipoCorrida(pricingTipoServicio); + tiposervicos.add(pricingTipoCorrida); + } + + mercados = new ArrayList(0); + for (com.rjconsultores.ventaboletos.entidad.PricingMercado pricingMercado : pricing.getPricingMercadoList()) { + PricingMercado pricingMercadoVO = new PricingMercado(pricingMercado); + mercados.add(pricingMercadoVO); + } + + vigencias = new ArrayList(0); + for (com.rjconsultores.ventaboletos.entidad.PricingVigencia pricingVigencia : pricing.getPricingVigenciaList()) { + PricingVigencia pricingVigenciaVO = new PricingVigencia(pricingVigencia); + vigencias.add(pricingVigenciaVO); + } + + marcas = new ArrayList(); + for (com.rjconsultores.ventaboletos.entidad.PricingMarca pricingMarca : pricing.getPricingMarcaList()) { + PricingMarca pricingMarcaVO = new PricingMarca(pricingMarca); + marcas.add(pricingMarcaVO); + } + + } + + public Integer getPricingId() { + return pricingId; + } + + public void setPricingId(Integer pricingId) { + this.pricingId = pricingId; + } + + public String getNomePricing() { + return nomePricing; + } + + public void setNomePricing(String nomePricing) { + this.nomePricing = nomePricing; + } + + public String getAplicaFeriadoDtViagem() { + return aplicaFeriadoDtViagem; + } + + public void setAplicaFeriadoDtViagem(String aplicaFeriadoDtViagem) { + this.aplicaFeriadoDtViagem = aplicaFeriadoDtViagem; + } + + public String getAplicaFeriadoDtVenda() { + return aplicaFeriadoDtVenda; + } + + public void setAplicaFeriadoDtVenda(String aplicaFeriadoDtVenda) { + this.aplicaFeriadoDtVenda = aplicaFeriadoDtVenda; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public Integer getQtdePoltronas() { + return qtdePoltronas; + } + + public void setQtdePoltronas(Integer qtdePoltronas) { + this.qtdePoltronas = qtdePoltronas; + } + + public Integer getTipoPricingPorcentagem() { + return tipoPricingPorcentagem; + } + + public void setTipoPricingPorcentagem(Integer tipoPricingPorcentagem) { + this.tipoPricingPorcentagem = tipoPricingPorcentagem; + } + + public BigDecimal getPorcentagemIda() { + return porcentagemIda; + } + + public void setPorcentagemIda(BigDecimal porcentagemIda) { + this.porcentagemIda = porcentagemIda; + } + + public BigDecimal getPorcentagemIdaVolta() { + return porcentagemIdaVolta; + } + + public void setPorcentagemIdaVolta(BigDecimal porcentagemIdaVolta) { + this.porcentagemIdaVolta = porcentagemIdaVolta; + } + + public Integer getPodeTransferir() { + return podeTransferir; + } + + public void setPodeTransferir(Integer podeTransferir) { + this.podeTransferir = podeTransferir; + } + + public Integer getPodeCancelar() { + return podeCancelar; + } + + public void setPodeCancelar(Integer podeCancelar) { + this.podeCancelar = podeCancelar; + } + + public Integer getPodeReservar() { + return podeReservar; + } + + public void setPodeReservar(Integer podeReservar) { + this.podeReservar = podeReservar; + } + + public Integer getDiasAtencipacao() { + return diasAtencipacao; + } + + public void setDiasAtencipacao(Integer diasAtencipacao) { + this.diasAtencipacao = diasAtencipacao; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + public String getPricingoperacao() { + return pricingoperacao; + } + + public void setPricingoperacao(String pricingoperacao) { + this.pricingoperacao = pricingoperacao; + } + + public List getPoltronas() { + return poltronas; + } + + public void setPoltronas(List poltronas) { + this.poltronas = poltronas; + } + + public List getCanalvendas() { + return canalvendas; + } + + public void setCanalvendas(List canalvendas) { + this.canalvendas = canalvendas; + } + + public List getCategorias() { + return categorias; + } + + public void setCategorias(List categorias) { + this.categorias = categorias; + } + + public List getClasses() { + return classes; + } + + public void setClasses(List classes) { + this.classes = classes; + } + + public List getServicos() { + return servicos; + } + + public void setServicos(List servicos) { + this.servicos = servicos; + } + + public List getDias() { + return dias; + } + + public void setDias(List dias) { + this.dias = dias; + } + + public List getOcupacoes() { + return ocupacoes; + } + + public void setOcupacoes(List ocupacoes) { + this.ocupacoes = ocupacoes; + } + + public List getPuntoventas() { + return puntoventas; + } + + public void setPuntoventas(List puntoventas) { + this.puntoventas = puntoventas; + } + + public List getLinhas() { + return linhas; + } + + public void setLinhas(List linhas) { + this.linhas = linhas; + } + + public List getTiposervicos() { + return tiposervicos; + } + + public void setTiposervicos(List tiposervicos) { + this.tiposervicos = tiposervicos; + } + + public Integer getExibirVenda() { + return exibirVenda; + } + + public void setExibirVenda(Integer exibirVenda) { + this.exibirVenda = exibirVenda; + } + + public List getMercados() { + return mercados; + } + + public void setMercados(List mercados) { + this.mercados = mercados; + } + + public List getVigencias() { + return vigencias; + } + + public void setVigencias(List vigencias) { + this.vigencias = vigencias; + } + + public List getMarcas() { + return marcas; + } + + public void setMarcas(List marcas) { + this.marcas = marcas; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/PricingAsiento.java b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingAsiento.java new file mode 100644 index 000000000..06f15eb4a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingAsiento.java @@ -0,0 +1,50 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +import java.io.Serializable; +import java.math.BigDecimal; + +public class PricingAsiento implements Serializable { + + private static final long serialVersionUID = 1L; + + private String numeasiento; + private String nombImagen; + private BigDecimal porcentaje; + + public PricingAsiento() { + super(); + } + + public PricingAsiento(com.rjconsultores.ventaboletos.entidad.PricingAsiento pricingAsiento) { + this(); + + numeasiento = pricingAsiento.getNumeasiento(); + nombImagen = pricingAsiento.getNombImagen(); + porcentaje = pricingAsiento.getPorcentaje(); + } + + public String getNumeasiento() { + return numeasiento; + } + + public void setNumeasiento(String numeasiento) { + this.numeasiento = numeasiento; + } + + public String getNombImagen() { + return nombImagen; + } + + public void setNombImagen(String nombImagen) { + this.nombImagen = nombImagen; + } + + public BigDecimal getPorcentaje() { + return porcentaje; + } + + public void setPorcentaje(BigDecimal porcentaje) { + this.porcentaje = porcentaje; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/PricingCanalVenta.java b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingCanalVenta.java new file mode 100644 index 000000000..4ce5e9171 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingCanalVenta.java @@ -0,0 +1,37 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +import java.io.Serializable; + +import com.rjconsultores.ventaboletos.entidad.PricingTipoPtoVta; + +public class PricingCanalVenta implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer canalventaId; + private String desccanalventa; + + public PricingCanalVenta() { + super(); + } + + public PricingCanalVenta(PricingTipoPtoVta pricingTipoPtoVta) { + this(); + + this.canalventaId = pricingTipoPtoVta.getTipoPtovta().getTipoptovtaId().intValue(); + this.desccanalventa = pricingTipoPtoVta.getTipoPtovta().getDesctipo(); + } + public Integer getCanalventaId() { + return canalventaId; + } + public void setCanalventaId(Integer canalventaId) { + this.canalventaId = canalventaId; + } + public String getDesccanalventa() { + return desccanalventa; + } + public void setDesccanalventa(String desccanalventa) { + this.desccanalventa = desccanalventa; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/PricingCategoria.java b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingCategoria.java new file mode 100644 index 000000000..04d68ea91 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingCategoria.java @@ -0,0 +1,39 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +import java.io.Serializable; + +public class PricingCategoria implements Serializable{ + + private static final long serialVersionUID = 1L; + + private Integer categoriaId; + private String desccategoria; + + public PricingCategoria() { + super(); + } + + public PricingCategoria(com.rjconsultores.ventaboletos.entidad.PricingCategoria pricingCategoria) { + this(); + + this.categoriaId = pricingCategoria.getCategoria().getCategoriaId(); + this.desccategoria = pricingCategoria.getCategoria().getDesccategoria(); + } + + public Integer getCategoriaId() { + return categoriaId; + } + + public void setCategoriaId(Integer categoriaId) { + this.categoriaId = categoriaId; + } + + public String getDesccategoria() { + return desccategoria; + } + + public void setDesccategoria(String desccategoria) { + this.desccategoria = desccategoria; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/PricingClasse.java b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingClasse.java new file mode 100644 index 000000000..88680fc76 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingClasse.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +import java.io.Serializable; + +import com.rjconsultores.ventaboletos.entidad.PricingClase; + +public class PricingClasse implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer classeservicioId; + private String descclasseservicio; + + public PricingClasse() { + super(); + } + + public PricingClasse(PricingClase pricingClase) { + this(); + + this.classeservicioId = pricingClase.getClaseServicio().getClaseservicioId(); + this.descclasseservicio = pricingClase.getClaseServicio().getDescclase(); + } + + public Integer getClasseservicioId() { + return classeservicioId; + } + + public void setClasseservicioId(Integer classeservicioId) { + this.classeservicioId = classeservicioId; + } + + public String getDescclasseservicio() { + return descclasseservicio; + } + + public void setDescclasseservicio(String descclasseservicio) { + this.descclasseservicio = descclasseservicio; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/PricingCorrida.java b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingCorrida.java new file mode 100644 index 000000000..d6fab00d2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingCorrida.java @@ -0,0 +1,29 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +import java.io.Serializable; + +public class PricingCorrida implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer numservico; + + public PricingCorrida() { + super(); + } + + public PricingCorrida(com.rjconsultores.ventaboletos.entidad.PricingCorrida pricingCorrida) { + this(); + + this.numservico = pricingCorrida.getCorridaCtrl().getCorridaId(); + } + + public Integer getNumservico() { + return numservico; + } + + public void setNumservico(Integer numservico) { + this.numservico = numservico; + } + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/PricingDia.java b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingDia.java new file mode 100644 index 000000000..17827c1a8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingDia.java @@ -0,0 +1,121 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +import java.io.Serializable; + +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +public class PricingDia implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer segunda; + private Integer terca; + private Integer quarta; + private Integer quinta; + private Integer sexta; + private Integer sabado; + private Integer domingo; + private String horarioinicio; + private String horariofim; + private Integer dataviagem; + + public PricingDia() { + super(); + } + + public PricingDia(com.rjconsultores.ventaboletos.entidad.PricingDia pricingDia) { + this(); + + segunda = pricingDia.getIndlunes() ? 1 : 0; + terca = pricingDia.getIndmartes() ? 1 : 0; + quarta = pricingDia.getIndmiercoles() ? 1 : 0; + quinta = pricingDia.getIndjueves() ? 1 : 0; + sexta = pricingDia.getIndviernes() ? 1 : 0; + sabado = pricingDia.getIndsabado() ? 1 : 0; + domingo = pricingDia.getInddomingo() ? 1 : 0; + horarioinicio = pricingDia.getHorarioinicio() != null ? DateUtil.getStringDate(pricingDia.getHorarioinicio(), "HH:mm") : null; + horariofim = pricingDia.getHorariofin() != null ? DateUtil.getStringDate(pricingDia.getHorariofin(), "HH:mm") : null; + dataviagem = pricingDia.getIndfecventa() ? 1 : 0; + } + + public Integer getSegunda() { + return segunda; + } + + public void setSegunda(Integer segunda) { + this.segunda = segunda; + } + + public Integer getTerca() { + return terca; + } + + public void setTerca(Integer terca) { + this.terca = terca; + } + + public Integer getQuarta() { + return quarta; + } + + public void setQuarta(Integer quarta) { + this.quarta = quarta; + } + + public Integer getQuinta() { + return quinta; + } + + public void setQuinta(Integer quinta) { + this.quinta = quinta; + } + + public Integer getSexta() { + return sexta; + } + + public void setSexta(Integer sexta) { + this.sexta = sexta; + } + + public Integer getSabado() { + return sabado; + } + + public void setSabado(Integer sabado) { + this.sabado = sabado; + } + + public Integer getDomingo() { + return domingo; + } + + public void setDomingo(Integer domingo) { + this.domingo = domingo; + } + + public String getHorarioinicio() { + return horarioinicio; + } + + public void setHorarioinicio(String horarioinicio) { + this.horarioinicio = horarioinicio; + } + + public String getHorariofim() { + return horariofim; + } + + public void setHorariofim(String horariofim) { + this.horariofim = horariofim; + } + + public Integer getDataviagem() { + return dataviagem; + } + + public void setDataviagem(Integer dataviagem) { + this.dataviagem = dataviagem; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/PricingMarca.java b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingMarca.java new file mode 100644 index 000000000..06dbfe843 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingMarca.java @@ -0,0 +1,34 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +public class PricingMarca { + + private Integer marcaId; + private String descmarca; + + public PricingMarca() { + super(); + } + + public PricingMarca(com.rjconsultores.ventaboletos.entidad.PricingMarca pricingMarca) { + this(); + this.marcaId = pricingMarca.getMarca().getMarcaId().intValue(); + this.descmarca = pricingMarca.getMarca().getDescmarca(); + } + + public Integer getMarcaId() { + return marcaId; + } + + public void setMarcaId(Integer marcaId) { + this.marcaId = marcaId; + } + + public String getDescmarca() { + return descmarca; + } + + public void setDescmarca(String descmarca) { + this.descmarca = descmarca; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/PricingMercado.java b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingMercado.java new file mode 100644 index 000000000..7e5a52eab --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingMercado.java @@ -0,0 +1,57 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +public class PricingMercado { + + private String descorigem; + private Integer origemId; + + private String descdestino; + private Integer destinoId; + + public PricingMercado() { + super(); + } + + public PricingMercado(com.rjconsultores.ventaboletos.entidad.PricingMercado pricingMercado) { + this(); + + this.origemId = pricingMercado.getOrigen() != null ? pricingMercado.getOrigen().getParadaId() : null; + this.descorigem = pricingMercado.getOrigen() != null ? pricingMercado.getOrigen().getDescparada() : null; + + this.destinoId = pricingMercado.getDestino() != null ? pricingMercado.getDestino().getParadaId() : null; + this.descdestino = pricingMercado.getDestino() != null ? pricingMercado.getDestino().getDescparada() : null; + } + + public String getDescorigem() { + return descorigem; + } + + public void setDescorigem(String descorigem) { + this.descorigem = descorigem; + } + + public Integer getOrigemId() { + return origemId; + } + + public void setOrigemId(Integer origemId) { + this.origemId = origemId; + } + + public String getDescdestino() { + return descdestino; + } + + public void setDescdestino(String descdestino) { + this.descdestino = descdestino; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/PricingOcupaAntecipa.java b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingOcupaAntecipa.java new file mode 100644 index 000000000..18b351170 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingOcupaAntecipa.java @@ -0,0 +1,121 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +import java.io.Serializable; +import java.math.BigDecimal; + +public class PricingOcupaAntecipa implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer cantdiasmin; + private Integer cantdiasmax; + private Integer cantasientosmin; + private Integer cantasientosmax; + private BigDecimal porcentaje; + private BigDecimal ocupacioninicial; + private BigDecimal ocupacionfinal; + private BigDecimal importe; + + private Integer classeId; + private String descclasse; + + public PricingOcupaAntecipa() { + super(); + } + + public PricingOcupaAntecipa(com.rjconsultores.ventaboletos.entidad.PricingOcupaAntecipa pricingOcupaAntecipa) { + this(); + + cantdiasmin = pricingOcupaAntecipa.getCantdiasmin(); + cantdiasmax = pricingOcupaAntecipa.getCantdiasmax(); + cantasientosmin = pricingOcupaAntecipa.getCantasientosmin(); + cantasientosmax = pricingOcupaAntecipa.getCantasientosmax(); + porcentaje = pricingOcupaAntecipa.getPorcentaje(); + ocupacioninicial = pricingOcupaAntecipa.getOcupacioninicial(); + ocupacionfinal = pricingOcupaAntecipa.getOcupacionfinal(); + importe = pricingOcupaAntecipa.getImporte(); + classeId = pricingOcupaAntecipa.getPricingClasseTarifaria() != null ? pricingOcupaAntecipa.getPricingClasseTarifaria().getPricingClasseTarifariaId() : null; + descclasse = pricingOcupaAntecipa.getPricingClasseTarifaria() != null ? pricingOcupaAntecipa.getPricingClasseTarifaria().getDescClasseTarifaria() : null; + } + + public Integer getCantdiasmin() { + return cantdiasmin; + } + + public void setCantdiasmin(Integer cantdiasmin) { + this.cantdiasmin = cantdiasmin; + } + + public Integer getCantdiasmax() { + return cantdiasmax; + } + + public void setCantdiasmax(Integer cantdiasmax) { + this.cantdiasmax = cantdiasmax; + } + + public Integer getCantasientosmin() { + return cantasientosmin; + } + + public void setCantasientosmin(Integer cantasientosmin) { + this.cantasientosmin = cantasientosmin; + } + + public Integer getCantasientosmax() { + return cantasientosmax; + } + + public void setCantasientosmax(Integer cantasientosmax) { + this.cantasientosmax = cantasientosmax; + } + + public BigDecimal getPorcentaje() { + return porcentaje; + } + + public void setPorcentaje(BigDecimal porcentaje) { + this.porcentaje = porcentaje; + } + + public BigDecimal getOcupacioninicial() { + return ocupacioninicial; + } + + public void setOcupacioninicial(BigDecimal ocupacioninicial) { + this.ocupacioninicial = ocupacioninicial; + } + + public BigDecimal getOcupacionfinal() { + return ocupacionfinal; + } + + public void setOcupacionfinal(BigDecimal ocupacionfinal) { + this.ocupacionfinal = ocupacionfinal; + } + + public BigDecimal getImporte() { + return importe; + } + + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + public Integer getClasseId() { + return classeId; + } + + public void setClasseId(Integer classeId) { + this.classeId = classeId; + } + + public String getDescclasse() { + return descclasse; + } + + public void setDescclasse(String descclasse) { + this.descclasse = descclasse; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/PricingPuntoVenta.java b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingPuntoVenta.java new file mode 100644 index 000000000..cd0c9e905 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingPuntoVenta.java @@ -0,0 +1,39 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +import java.io.Serializable; + +public class PricingPuntoVenta implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer puntoventaId; + private String nombpuntoventa; + + public PricingPuntoVenta() { + super(); + } + + public PricingPuntoVenta(com.rjconsultores.ventaboletos.entidad.PricingPuntoVenta pricingPuntoVenta) { + this(); + + this.puntoventaId = pricingPuntoVenta.getPuntoVenta().getPuntoventaId(); + this.nombpuntoventa = pricingPuntoVenta.getPuntoVenta().getNombpuntoventa(); + } + + public Integer getPuntoventaId() { + return puntoventaId; + } + + public void setPuntoventaId(Integer puntoventaId) { + this.puntoventaId = puntoventaId; + } + + public String getNombpuntoventa() { + return nombpuntoventa; + } + + public void setNombpuntoventa(String nombpuntoventa) { + this.nombpuntoventa = nombpuntoventa; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/PricingRuta.java b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingRuta.java new file mode 100644 index 000000000..d74460622 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingRuta.java @@ -0,0 +1,39 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +import java.io.Serializable; + +public class PricingRuta implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer rutaId; + private String descruta; + + public PricingRuta() { + super(); + } + + public PricingRuta(com.rjconsultores.ventaboletos.entidad.PricingRuta pricingRuta) { + this(); + + this.rutaId = pricingRuta.getRuta().getRutaId(); + this.descruta = pricingRuta.getRuta().getDescruta(); + } + + public Integer getRutaId() { + return rutaId; + } + + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + + public String getDescruta() { + return descruta; + } + + public void setDescruta(String descruta) { + this.descruta = descruta; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/PricingTipoCorrida.java b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingTipoCorrida.java new file mode 100644 index 000000000..829734044 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingTipoCorrida.java @@ -0,0 +1,41 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +import java.io.Serializable; + +import com.rjconsultores.ventaboletos.entidad.PricingTipoServicio; + +public class PricingTipoCorrida implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer tipocorridaId; + private String desctipocorrida; + + public PricingTipoCorrida() { + super(); + } + + public PricingTipoCorrida(PricingTipoServicio pricingTipoServicio) { + this(); + + this.tipocorridaId = pricingTipoServicio.getTipoServicio().getTiposervicioId(); + this.desctipocorrida = pricingTipoServicio.getTipoServicio().getDescservicio(); + } + + public Integer getTipocorridaId() { + return tipocorridaId; + } + + public void setTipocorridaId(Integer tipocorridaId) { + this.tipocorridaId = tipocorridaId; + } + + public String getDesctipocorrida() { + return desctipocorrida; + } + + public void setDesctipocorrida(String desctipocorrida) { + this.desctipocorrida = desctipocorrida; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/pricing/PricingVigencia.java b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingVigencia.java new file mode 100644 index 000000000..d3cf39f7c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/pricing/PricingVigencia.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.vo.pricing; + +import com.rjconsultores.ventaboletos.utilerias.DateUtil; + +public class PricingVigencia { + + private String inicioDataViagem; + private String fimDataViagem; + private String inicioDataVenda; + private String fimDataVenda; + + public PricingVigencia() { + super(); + } + + public PricingVigencia(com.rjconsultores.ventaboletos.entidad.PricingVigencia pricingVigencia) { + this(); + this.inicioDataVenda = pricingVigencia.getFecinicioventa() != null ? DateUtil.getStringDate(pricingVigencia.getFecinicioventa(), "dd/MM/yyyy HH:mm") : null; + this.fimDataVenda = pricingVigencia.getFecfinventa() != null ? DateUtil.getStringDate(pricingVigencia.getFecfinventa(), "dd/MM/yyyy HH:mm") : null; + this.inicioDataViagem = pricingVigencia.getFecinicioviaje() != null ? DateUtil.getStringDate(pricingVigencia.getFecinicioviaje(), "dd/MM/yyyy HH:mm") : null; + this.fimDataViagem = pricingVigencia.getFecfinviaje() != null ? DateUtil.getStringDate(pricingVigencia.getFecfinviaje(), "dd/MM/yyyy HH:mm") : null; + } + + public String getInicioDataViagem() { + return inicioDataViagem; + } + + public void setInicioDataViagem(String inicioDataViagem) { + this.inicioDataViagem = inicioDataViagem; + } + + public String getFimDataViagem() { + return fimDataViagem; + } + + public void setFimDataViagem(String fimDataViagem) { + this.fimDataViagem = fimDataViagem; + } + + public String getInicioDataVenda() { + return inicioDataVenda; + } + + public void setInicioDataVenda(String inicioDataVenda) { + this.inicioDataVenda = inicioDataVenda; + } + + public String getFimDataVenda() { + return fimDataVenda; + } + + public void setFimDataVenda(String fimDataVenda) { + this.fimDataVenda = fimDataVenda; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/reembolsoocdnotacredito/ReembolsoOcdNotaCreditoVO.java b/src/com/rjconsultores/ventaboletos/vo/reembolsoocdnotacredito/ReembolsoOcdNotaCreditoVO.java new file mode 100644 index 000000000..c0dc8a312 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/reembolsoocdnotacredito/ReembolsoOcdNotaCreditoVO.java @@ -0,0 +1,388 @@ +package com.rjconsultores.ventaboletos.vo.reembolsoocdnotacredito; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.entidad.Boleto; +import com.rjconsultores.ventaboletos.entidad.CajaTarjeta; +import com.rjconsultores.ventaboletos.entidad.NotaCreditoVendaPacote; +import com.rjconsultores.ventaboletos.entidad.OCD; +import com.rjconsultores.ventaboletos.entidad.OCDDatosPagamento; +import com.rjconsultores.ventaboletos.enums.SituacaoNotaCreditoVendaPacote; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; +import com.rjconsultores.ventaboletos.utilerias.OcdUtil; + +@XmlRootElement(name = "ocdNotaCredito") +public class ReembolsoOcdNotaCreditoVO { + + private String numfoliosistema; + private String numoperacion; + private String localizador; + private Date data; + private Date dataPagamento; + private BigDecimal valor; + + private Set datosPagamento; + + private Set tarjetas; + + public ReembolsoOcdNotaCreditoVO() { } + + public static Builder builder() { + return new ReembolsoOcdNotaCreditoVO.Builder(); + } + + public String getLocalizador() { + return localizador; + } + + public void setLocalizador(String localizador) { + this.localizador = localizador; + } + + public Date getData() { + return data; + } + + public void setData(Date data) { + this.data = data; + } + + public Date getDataPagamento() { + return dataPagamento; + } + + public void setDataPagamento(Date dataPagamento) { + this.dataPagamento = dataPagamento; + } + + public BigDecimal getValor() { + return valor; + } + + public void setValor(BigDecimal valor) { + this.valor = valor; + } + + @XmlElementWrapper + @XmlElement(name = "datoPagamento", type = ReembolsoOcdNotaCreditoDatosPagamentoVO.class) + public Set getDatosPagamento() { + return datosPagamento; + } + + public void setDatosPagamento(Set datosPagamento) { + this.datosPagamento = datosPagamento; + } + + @XmlElementWrapper + @XmlElement(name = "tarjeta", type = ReembolsoOcdNotaCreditoTarjetaVO.class) + public Set getTarjetas() { + return tarjetas; + } + + public void setTarjetas(Set tarjetas) { + this.tarjetas = tarjetas; + } + + public String getNumfoliosistema() { + return numfoliosistema; + } + + public void setNumfoliosistema(String numfoliosistema) { + this.numfoliosistema = numfoliosistema; + } + + public String getNumoperacion() { + return numoperacion; + } + + public void setNumoperacion(String numoperacion) { + this.numoperacion = numoperacion; + } + + public static class ReembolsoOcdNotaCreditoTarjetaVO { + + private String numtarjeta; + private String numautorizacion; + private String nsu; + + public ReembolsoOcdNotaCreditoTarjetaVO() { } + + public ReembolsoOcdNotaCreditoTarjetaVO(CajaTarjeta cajaTarjeta) { + this.numtarjeta = cajaTarjeta.getNumtarjeta(); + this.numautorizacion = cajaTarjeta.getNumautorizacion(); + this.nsu = cajaTarjeta.getNsu(); + } + + public ReembolsoOcdNotaCreditoTarjetaVO(OCD ocd) { + this.numtarjeta = ocd.getNumtarjeta(); + this.numautorizacion = ocd.getNumautorizacion(); + this.nsu = ocd.getNsu(); + } + + public String getNumtarjeta() { + return numtarjeta; + } + public void setNumtarjeta(String numtarjeta) { + this.numtarjeta = numtarjeta; + } + public String getNumautorizacion() { + return numautorizacion; + } + public void setNumautorizacion(String numautorizacion) { + this.numautorizacion = numautorizacion; + } + public String getNsu() { + return nsu; + } + public void setNsu(String nsu) { + this.nsu = nsu; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((nsu == null) ? 0 : nsu.hashCode()); + result = prime * result + ((numautorizacion == null) ? 0 : numautorizacion.hashCode()); + result = prime * result + ((numtarjeta == null) ? 0 : numtarjeta.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ReembolsoOcdNotaCreditoTarjetaVO other = (ReembolsoOcdNotaCreditoTarjetaVO) obj; + if (nsu == null) { + if (other.nsu != null) + return false; + } else if (!nsu.equals(other.nsu)) + return false; + if (numautorizacion == null) { + if (other.numautorizacion != null) + return false; + } else if (!numautorizacion.equals(other.numautorizacion)) + return false; + if (numtarjeta == null) { + if (other.numtarjeta != null) + return false; + } else if (!numtarjeta.equals(other.numtarjeta)) + return false; + return true; + } + + } + + public static class ReembolsoOcdNotaCreditoDatosPagamentoVO { + + private String titularcuenta; + private String identificacion; + private String banco; + private String cuentabanco; + private String agencia; + private String email; + private String telefono; + + public ReembolsoOcdNotaCreditoDatosPagamentoVO() { } + + public ReembolsoOcdNotaCreditoDatosPagamentoVO(OCDDatosPagamento datosPagamento) { + this.titularcuenta = datosPagamento.getTitularcuenta(); + this.identificacion = datosPagamento.getIdentificacion(); + this.banco = datosPagamento.getBanco(); + this.cuentabanco = datosPagamento.getCuentabanco(); + this.agencia = datosPagamento.getAgencia(); + this.email = datosPagamento.getEmail(); + this.telefono = datosPagamento.getTelefono(); + } + + public String getTitularcuenta() { + return titularcuenta; + } + public void setTitularcuenta(String titularcuenta) { + this.titularcuenta = titularcuenta; + } + public String getIdentificacion() { + return identificacion; + } + public void setIdentificacion(String identificacion) { + this.identificacion = identificacion; + } + public String getBanco() { + return banco; + } + public void setBanco(String banco) { + this.banco = banco; + } + public String getCuentabanco() { + return cuentabanco; + } + public void setCuentabanco(String cuentabanco) { + this.cuentabanco = cuentabanco; + } + public String getAgencia() { + return agencia; + } + public void setAgencia(String agencia) { + this.agencia = agencia; + } + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + public String getTelefono() { + return telefono; + } + public void setTelefono(String telefono) { + this.telefono = telefono; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((agencia == null) ? 0 : agencia.hashCode()); + result = prime * result + ((banco == null) ? 0 : banco.hashCode()); + result = prime * result + ((cuentabanco == null) ? 0 : cuentabanco.hashCode()); + result = prime * result + ((email == null) ? 0 : email.hashCode()); + result = prime * result + ((identificacion == null) ? 0 : identificacion.hashCode()); + result = prime * result + ((telefono == null) ? 0 : telefono.hashCode()); + result = prime * result + ((titularcuenta == null) ? 0 : titularcuenta.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ReembolsoOcdNotaCreditoDatosPagamentoVO other = (ReembolsoOcdNotaCreditoDatosPagamentoVO) obj; + if (agencia == null) { + if (other.agencia != null) + return false; + } else if (!agencia.equals(other.agencia)) + return false; + if (banco == null) { + if (other.banco != null) + return false; + } else if (!banco.equals(other.banco)) + return false; + if (cuentabanco == null) { + if (other.cuentabanco != null) + return false; + } else if (!cuentabanco.equals(other.cuentabanco)) + return false; + if (email == null) { + if (other.email != null) + return false; + } else if (!email.equals(other.email)) + return false; + if (identificacion == null) { + if (other.identificacion != null) + return false; + } else if (!identificacion.equals(other.identificacion)) + return false; + if (telefono == null) { + if (other.telefono != null) + return false; + } else if (!telefono.equals(other.telefono)) + return false; + if (titularcuenta == null) { + if (other.titularcuenta != null) + return false; + } else if (!titularcuenta.equals(other.titularcuenta)) + return false; + return true; + } + + } + + public static class Builder { + + private ReembolsoOcdNotaCreditoVO vo; + + public Builder() { + vo = new ReembolsoOcdNotaCreditoVO(); + } + + public Builder datosPagamento(List listDatosPagamento) { + vo.datosPagamento = new HashSet(); + for (OCDDatosPagamento datosPagamento : listDatosPagamento) { + vo.datosPagamento.add(new ReembolsoOcdNotaCreditoDatosPagamentoVO(datosPagamento)); + } + return this; + } + + public Builder cajaTarjeta(List listCajaTarjeta) { + vo.tarjetas = new HashSet(); + for (CajaTarjeta cajaTarjeta : listCajaTarjeta) { + vo.tarjetas.add(new ReembolsoOcdNotaCreditoTarjetaVO(cajaTarjeta)); + } + return this; + } + + public Builder ocd(OCD ocd) { + vo.localizador = OcdUtil.generaLocalizadorOCD(ocd); + vo.data = ocd.getFecinc(); + vo.dataPagamento = ocd.getFecpagar(); + + if(ocd.getIndpago() != null && ocd.getIndpago()) { + vo.valor = MoneyHelper.somar(ocd.getValorPagar(), ocd.getValorTarjeta()); + } else { + vo.valor = ocd.getSaldoPagar(); + } + vo.tarjetas = new HashSet(); + if (StringUtils.isNotEmpty(ocd.getNumtarjeta())) { + vo.tarjetas.add(new ReembolsoOcdNotaCreditoTarjetaVO(ocd)); + } + + return this; + } + + public Builder notaCredito(NotaCreditoVendaPacote notaCredito) { + vo.localizador = String.valueOf(notaCredito.getNotaCreditoVendaPacoteId()); + vo.data = notaCredito.getDatanotacredito(); + vo.dataPagamento = notaCredito.getDatapagamento(); + vo.numoperacion = notaCredito.getVendapacotecancelamento().getNumoperacion(); + + if(notaCredito.getSituacao().equals(SituacaoNotaCreditoVendaPacote.UTILIZADA.getValue())) { + vo.valor = notaCredito.getValor(); + } else { + vo.valor = notaCredito.getSaldoPagar(); + } + return this; + } + + public Builder boleto(Boleto boleto) { + vo.numfoliosistema = boleto.getNumfoliosistema(); + vo.numoperacion = boleto.getNumoperacion(); + return this; + } + + public ReembolsoOcdNotaCreditoVO build() { + ReembolsoOcdNotaCreditoVO build = vo; + vo = new ReembolsoOcdNotaCreditoVO(); + return build; + } + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/roloperativo/RolOperativoVO.java b/src/com/rjconsultores/ventaboletos/vo/roloperativo/RolOperativoVO.java new file mode 100644 index 000000000..bbca672a5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/roloperativo/RolOperativoVO.java @@ -0,0 +1,37 @@ +package com.rjconsultores.ventaboletos.vo.roloperativo; + +import com.rjconsultores.ventaboletos.entidad.RolOperativo; + +public class RolOperativoVO { + + private Integer roloperativoId; + private String descroloperativo; + + public RolOperativoVO(Integer roloperativoId, String descroloperativo) { + super(); + this.roloperativoId = roloperativoId; + this.descroloperativo = descroloperativo; + } + + public RolOperativoVO( RolOperativo rolOperativo) { + this.roloperativoId = rolOperativo.getRoloperativoId(); + this.descroloperativo = rolOperativo.getDescroloperativo(); + } + + public Integer getRoloperativoId() { + return roloperativoId; + } + + public void setRoloperativoId(Integer roloperativoId) { + this.roloperativoId = roloperativoId; + } + + public String getDescroloperativo() { + return descroloperativo; + } + + public void setDescroloperativo(String descroloperativo) { + this.descroloperativo = descroloperativo; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/ruta/RutaVO.java b/src/com/rjconsultores/ventaboletos/vo/ruta/RutaVO.java new file mode 100644 index 000000000..f62e1a2a4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/ruta/RutaVO.java @@ -0,0 +1,201 @@ +package com.rjconsultores.ventaboletos.vo.ruta; + +import javax.xml.bind.annotation.XmlRootElement; + +import com.rjconsultores.ventaboletos.entidad.Ruta; +import com.rjconsultores.ventaboletos.vo.OrgaoConcedente.OrgaoConcedenteVO; +import com.rjconsultores.ventaboletos.vo.clase.ClaseVO; + +@XmlRootElement +public class RutaVO { + + private Long rutaId; + private String numRuta; + private String prefixo; + private String descruta; + private String orgaoConcedente; + private Boolean sentido; + private ClaseVO claseVO; + private Boolean indTribTarifa; + private Boolean indTribTaxaEmbarque; + private Boolean indTribPedagio; + private OrgaoConcedenteVO orgaoConcedenteVO; + //campos usados nas consultas resumidas + private Integer claseId; + private Integer orgaoConcedenteId; + + public RutaVO() { + } + + public RutaVO(Integer rutaId) { + super(); + this.rutaId = Long.valueOf(rutaId); + } + + public RutaVO(Long rutaId, String numRuta, String prefixo, String descruta, String orgaoConcedente) { + super(); + this.rutaId = rutaId; + this.numRuta = numRuta; + this.prefixo = prefixo; + this.descruta = descruta; + this.orgaoConcedente = orgaoConcedente; + } + + public RutaVO(Integer rutaId, String numRuta, String prefixo, String descruta, Integer orgaoConcedenteId, String descOrgao, Boolean sentido, Integer claseId, String descClase) { + super(); + this.rutaId = rutaId.longValue(); + this.numRuta = numRuta; + this.prefixo = prefixo; + this.descruta = descruta; + this.orgaoConcedente = descOrgao; + this.orgaoConcedenteVO = new OrgaoConcedenteVO(orgaoConcedenteId, descOrgao); + this.sentido = sentido; + this.claseVO = new ClaseVO(claseId, descClase); + } + + public RutaVO(Integer rutaId, String numRuta, String prefixo, String descruta, Integer orgaoConcedenteId, String descOrgao, Boolean indValDocObligatorioEmbarcada, Boolean sentido, Integer claseId, String descClase) { + super(); + this.rutaId = rutaId.longValue(); + this.numRuta = numRuta; + this.prefixo = prefixo; + this.descruta = descruta; + this.orgaoConcedente = descOrgao; + this.orgaoConcedenteVO = new OrgaoConcedenteVO(orgaoConcedenteId, descOrgao, indValDocObligatorioEmbarcada); + this.sentido = sentido; + this.claseVO = new ClaseVO(claseId, descClase); + } + + public RutaVO(Integer rutaId, String numRuta, String prefixo, String descruta, Integer orgaoConcedenteId, String descOrgao, Boolean indValDocObligatorioEmbarcada, Boolean sentido, Integer claseId, String descClase, Boolean indTribTarifa, Boolean indTribTaxaEmbarque, Boolean indTribPedagio){ + super(); + this.rutaId = rutaId.longValue(); + this.numRuta = numRuta; + this.prefixo = prefixo; + this.descruta = descruta; + this.orgaoConcedente = descOrgao; + this.orgaoConcedenteVO = new OrgaoConcedenteVO(orgaoConcedenteId, descOrgao, indValDocObligatorioEmbarcada); + this.sentido = sentido; + this.claseVO = new ClaseVO(claseId, descClase); + this.indTribTarifa = indTribTarifa; + this.indTribTaxaEmbarque = indTribTaxaEmbarque; + this.indTribPedagio = indTribPedagio; + } + + public RutaVO(Ruta ruta){ + super(); + this.rutaId = ruta.getRutaId().longValue(); + this.numRuta = ruta.getNumRuta(); + this.prefixo = ruta.getPrefixo(); + this.descruta = ruta.getDescruta(); + this.sentido = ruta.getIndSentidoIda(); + this.indTribTarifa = ruta.getIndTribTarifa(); + this.indTribTaxaEmbarque = ruta.getIndTribTaxaEmbarque(); + this.indTribPedagio = ruta.getIndTribPedagio(); + this.claseId = ruta.getClaseServicio().getClaseservicioId(); + this.orgaoConcedenteId = ruta.getOrgaoConcedente().getOrgaoConcedenteId(); + } + + public Long getRutaId() { + return rutaId; + } + + public void setRutaId(Long rutaId) { + this.rutaId = rutaId; + } + + public String getNumRuta() { + return numRuta; + } + + public void setNumRuta(String numRuta) { + this.numRuta = numRuta; + } + + public String getPrefixo() { + return prefixo; + } + + public void setPrefixo(String prefixo) { + this.prefixo = prefixo; + } + + public String getDescruta() { + return descruta; + } + + public void setDescruta(String descruta) { + this.descruta = descruta; + } + + public String getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(String orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public Boolean isSentido() { + return sentido; + } + + public void setSentido(Boolean sentido) { + this.sentido = sentido; + } + + public ClaseVO getClaseVO() { + return claseVO; + } + + public void setClaseVO(ClaseVO claseVO) { + this.claseVO = claseVO; + } + + public OrgaoConcedenteVO getOrgaoConcedenteVO() { + return orgaoConcedenteVO; + } + + public void setOrgaoConcedenteVO(OrgaoConcedenteVO orgaoConcedenteVO) { + this.orgaoConcedenteVO = orgaoConcedenteVO; + } + + public Boolean getIndTribTarifa() { + return indTribTarifa; + } + + public void setIndTribTarifa(Boolean indTribTarifa) { + this.indTribTarifa = indTribTarifa; + } + + public Boolean getIndTribTaxaEmbarque() { + return indTribTaxaEmbarque; + } + + public void setIndTribTaxaEmbarque(Boolean indTribTaxaEmbarque) { + this.indTribTaxaEmbarque = indTribTaxaEmbarque; + } + + public Boolean getIndTribPedagio() { + return indTribPedagio; + } + + public void setIndTribPedagio(Boolean indTribPedagio) { + this.indTribPedagio = indTribPedagio; + } + + public Integer getOrgaoConcedenteId() { + return orgaoConcedenteId; + } + + public void setOrgaoConcedenteId(Integer orgaoConcedenteId) { + this.orgaoConcedenteId = orgaoConcedenteId; + } + + public Integer getClaseId() { + return claseId; + } + + public void setClaseId(Integer claseId) { + this.claseId = claseId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/secuencia/SecuenciaVO.java b/src/com/rjconsultores/ventaboletos/vo/secuencia/SecuenciaVO.java new file mode 100644 index 000000000..bd02683cb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/secuencia/SecuenciaVO.java @@ -0,0 +1,43 @@ +package com.rjconsultores.ventaboletos.vo.secuencia; + +import com.rjconsultores.ventaboletos.vo.parada.ParadaVO; + +public class SecuenciaVO { + private Integer secuencia; + private ParadaVO localidade; + //campos usados nas consultas resumidas + private Integer localidadeId; + + public SecuenciaVO() { + + } + + public SecuenciaVO(Integer secuencia, ParadaVO localidade) { + this.secuencia = secuencia; + this.localidade = localidade; + } + + public Integer getSecuencia() { + return secuencia; + } + + public void setSecuencia(Integer secuencia) { + this.secuencia = secuencia; + } + + public ParadaVO getLocalidade() { + return localidade; + } + + public void setLocalidade(ParadaVO localidade) { + this.localidade = localidade; + } + + public Integer getLocalidadeId() { + return localidadeId; + } + + public void setLocalidadeId(Integer localidadeId) { + this.localidadeId = localidadeId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/segurida/PerfilJerarquia.java b/src/com/rjconsultores/ventaboletos/vo/segurida/PerfilJerarquia.java new file mode 100644 index 000000000..65633aa81 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/segurida/PerfilJerarquia.java @@ -0,0 +1,49 @@ +package com.rjconsultores.ventaboletos.vo.segurida; + +public enum PerfilJerarquia { + + NORMAL(0), ADMIN(1), JERARQUIA_2(2), JERARQUIA_3(3), JERARQUIA_4(4), ADMINISTRADORES("ADMINISTRADORES"); + + private Integer valor; + private String valorCaracter; + + private PerfilJerarquia(Integer valor) { + this.valor = valor; + } + private PerfilJerarquia(String valorCaracter) { + this.valorCaracter = valorCaracter; + } + + public Integer getValor() { + return valor; + } + public String getValorCaracter() { + return valorCaracter; + } + + + public static PerfilJerarquia buscar(Integer valor) { + + if (valor == null) + return NORMAL; + + for (PerfilJerarquia jerarquia : PerfilJerarquia.values()) { + if (jerarquia.getValor().equals(valor)) { + return jerarquia; + } + } + return null; + } + public static PerfilJerarquia buscar(String valorCaracter) { + + if (valorCaracter == null) + return NORMAL; + + for (PerfilJerarquia jerarquia : PerfilJerarquia.values()) { + if (jerarquia.getValor().equals(valorCaracter)) { + return jerarquia; + } + } + return null; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaGroupVO.java b/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaGroupVO.java new file mode 100644 index 000000000..6052db5d8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaGroupVO.java @@ -0,0 +1,106 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.vo.tarifa; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * + * @author Desenvolvimento + */ +public class TarifaEscalaGroupVO { + + private String DESCRUTA; + private BigDecimal RUTA_ID; + private BigDecimal MONEDA_ID; + private BigDecimal VIGENCIATARIFA_ID; + private BigDecimal MARCA_ID; + private String DESCMONEDA; + private Date FECINICIOVIGENCIA; + private Date FECFINVIGENCIA; + private String DESCMARCA; + private String DESCCLASE; + + public String getDESCCLASE() { + return DESCCLASE; + } + + public void setDESCCLASE(String DESCCLASE) { + this.DESCCLASE = DESCCLASE; + } + + public String getDESCMARCA() { + return DESCMARCA; + } + + public void setDESCMARCA(String DESCMARCA) { + this.DESCMARCA = DESCMARCA; + } + + public String getDESCMONEDA() { + return DESCMONEDA; + } + + public void setDESCMONEDA(String DESCMONEDA) { + this.DESCMONEDA = DESCMONEDA; + } + + public String getDESCRUTA() { + return DESCRUTA; + } + + public void setDESCRUTA(String DESCRUTA) { + this.DESCRUTA = DESCRUTA; + } + + public Date getFECFINVIGENCIA() { + return FECFINVIGENCIA; + } + + public void setFECFINVIGENCIA(Date FECFINVIGENCIA) { + this.FECFINVIGENCIA = FECFINVIGENCIA; + } + + public Date getFECINICIOVIGENCIA() { + return FECINICIOVIGENCIA; + } + + public void setFECINICIOVIGENCIA(Date FECINICIOVIGENCIA) { + this.FECINICIOVIGENCIA = FECINICIOVIGENCIA; + } + + public BigDecimal getMARCA_ID() { + return MARCA_ID; + } + + public void setMARCA_ID(BigDecimal MARCA_ID) { + this.MARCA_ID = MARCA_ID; + } + + public BigDecimal getMONEDA_ID() { + return MONEDA_ID; + } + + public void setMONEDA_ID(BigDecimal MONEDA_ID) { + this.MONEDA_ID = MONEDA_ID; + } + + public BigDecimal getRUTA_ID() { + return RUTA_ID; + } + + public void setRUTA_ID(BigDecimal RUTA_ID) { + this.RUTA_ID = RUTA_ID; + } + + public BigDecimal getVIGENCIATARIFA_ID() { + return VIGENCIATARIFA_ID; + } + + public void setVIGENCIATARIFA_ID(BigDecimal VIGENCIATARIFA_ID) { + this.VIGENCIATARIFA_ID = VIGENCIATARIFA_ID; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaVO.java b/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaVO.java new file mode 100644 index 000000000..87ca2a574 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaEscalaVO.java @@ -0,0 +1,99 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.vo.tarifa; + +import java.math.BigDecimal; + +/** + * + * @author Desenvolvimento + */ +public class TarifaEscalaVO { + + private String CVEORIGEM; + private String DESCORIGEM; + private String CVEDESTINO; + private String DESCDESTINO; + private BigDecimal NUMSECORIGEM; + private BigDecimal NUMSECDESTINO; + private BigDecimal PRECIO; + private BigDecimal RUTAID; + private String DESCRUTA; + + public TarifaEscalaVO() { + } + + public String getCVEDESTINO() { + return CVEDESTINO; + } + + public void setCVEDESTINO(String CVEDESTINO) { + this.CVEDESTINO = CVEDESTINO; + } + + public String getCVEORIGEM() { + return CVEORIGEM; + } + + public void setCVEORIGEM(String CVEORIGEM) { + this.CVEORIGEM = CVEORIGEM; + } + + public String getDESCDESTINO() { + return DESCDESTINO; + } + + public void setDESCDESTINO(String DESCDESTINO) { + this.DESCDESTINO = DESCDESTINO; + } + + public String getDESCORIGEM() { + return DESCORIGEM; + } + + public void setDESCORIGEM(String DESCORIGEM) { + this.DESCORIGEM = DESCORIGEM; + } + + public String getDESCRUTA() { + return DESCRUTA; + } + + public void setDESCRUTA(String DESCRUTA) { + this.DESCRUTA = DESCRUTA; + } + + public BigDecimal getNUMSECDESTINO() { + return NUMSECDESTINO; + } + + public void setNUMSECDESTINO(BigDecimal NUMSECDESTINO) { + this.NUMSECDESTINO = NUMSECDESTINO; + } + + public BigDecimal getNUMSECORIGEM() { + return NUMSECORIGEM; + } + + public void setNUMSECORIGEM(BigDecimal NUMSECORIGEM) { + this.NUMSECORIGEM = NUMSECORIGEM; + } + + public BigDecimal getPRECIO() { + return PRECIO; + } + + public void setPRECIO(BigDecimal PRECIO) { + this.PRECIO = PRECIO; + } + + public BigDecimal getRUTAID() { + return RUTAID; + } + + public void setRUTAID(BigDecimal RUTAID) { + this.RUTAID = RUTAID; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaGroupVO.java b/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaGroupVO.java new file mode 100644 index 000000000..2d487f7f1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaGroupVO.java @@ -0,0 +1,78 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.vo.tarifa; + +import java.math.BigDecimal; + +/** + * + * @author Desenvolvimento + */ +public class TarifaOficialEscalaGroupVO { + + private String DESCRUTA; + private BigDecimal RUTA_ID; + private BigDecimal MONEDA_ID; + private BigDecimal MARCA_ID; + private String DESCMONEDA; + private String DESCMARCA; + private String DESCCLASE; + + public String getDESCCLASE() { + return DESCCLASE; + } + + public void setDESCCLASE(String DESCCLASE) { + this.DESCCLASE = DESCCLASE; + } + + public String getDESCMARCA() { + return DESCMARCA; + } + + public void setDESCMARCA(String DESCMARCA) { + this.DESCMARCA = DESCMARCA; + } + + public String getDESCMONEDA() { + return DESCMONEDA; + } + + public void setDESCMONEDA(String DESCMONEDA) { + this.DESCMONEDA = DESCMONEDA; + } + + public String getDESCRUTA() { + return DESCRUTA; + } + + public void setDESCRUTA(String DESCRUTA) { + this.DESCRUTA = DESCRUTA; + } + + public BigDecimal getMARCA_ID() { + return MARCA_ID; + } + + public void setMARCA_ID(BigDecimal MARCA_ID) { + this.MARCA_ID = MARCA_ID; + } + + public BigDecimal getMONEDA_ID() { + return MONEDA_ID; + } + + public void setMONEDA_ID(BigDecimal MONEDA_ID) { + this.MONEDA_ID = MONEDA_ID; + } + + public BigDecimal getRUTA_ID() { + return RUTA_ID; + } + + public void setRUTA_ID(BigDecimal RUTA_ID) { + this.RUTA_ID = RUTA_ID; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaVO.java b/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaVO.java new file mode 100644 index 000000000..d9533949c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/tarifa/TarifaOficialEscalaVO.java @@ -0,0 +1,135 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.vo.tarifa; + +import java.math.BigDecimal; + +/** + * + * @author Desenvolvimento + */ +public class TarifaOficialEscalaVO { + + private String CVEORIGEM; + private String DESCORIGEM; + private String CVEDESTINO; + private String DESCDESTINO; + private BigDecimal NUMSECORIGEM; + private BigDecimal NUMSECDESTINO; + private BigDecimal PRECIO; + private BigDecimal TAXAEMBARQUE; + private BigDecimal PEDAGIO; + private BigDecimal OUTROS; + private BigDecimal SEGURO; + private BigDecimal RUTAID; + private String DESCRUTA; + + public TarifaOficialEscalaVO() { + } + + public String getCVEDESTINO() { + return CVEDESTINO; + } + + public void setCVEDESTINO(String CVEDESTINO) { + this.CVEDESTINO = CVEDESTINO; + } + + public String getCVEORIGEM() { + return CVEORIGEM; + } + + public void setCVEORIGEM(String CVEORIGEM) { + this.CVEORIGEM = CVEORIGEM; + } + + public String getDESCDESTINO() { + return DESCDESTINO; + } + + public void setDESCDESTINO(String DESCDESTINO) { + this.DESCDESTINO = DESCDESTINO; + } + + public String getDESCORIGEM() { + return DESCORIGEM; + } + + public void setDESCORIGEM(String DESCORIGEM) { + this.DESCORIGEM = DESCORIGEM; + } + + public String getDESCRUTA() { + return DESCRUTA; + } + + public void setDESCRUTA(String DESCRUTA) { + this.DESCRUTA = DESCRUTA; + } + + public BigDecimal getNUMSECDESTINO() { + return NUMSECDESTINO; + } + + public void setNUMSECDESTINO(BigDecimal NUMSECDESTINO) { + this.NUMSECDESTINO = NUMSECDESTINO; + } + + public BigDecimal getNUMSECORIGEM() { + return NUMSECORIGEM; + } + + public void setNUMSECORIGEM(BigDecimal NUMSECORIGEM) { + this.NUMSECORIGEM = NUMSECORIGEM; + } + + public BigDecimal getPRECIO() { + return PRECIO; + } + + public void setPRECIO(BigDecimal PRECIO) { + this.PRECIO = PRECIO; + } + + public BigDecimal getRUTAID() { + return RUTAID; + } + + public void setRUTAID(BigDecimal RUTAID) { + this.RUTAID = RUTAID; + } + + public BigDecimal getOUTROS() { + return OUTROS; + } + + public void setOUTROS(BigDecimal OUTROS) { + this.OUTROS = OUTROS; + } + + public BigDecimal getPEDAGIO() { + return PEDAGIO; + } + + public void setPEDAGIO(BigDecimal PEDAGIO) { + this.PEDAGIO = PEDAGIO; + } + + public BigDecimal getSEGURO() { + return SEGURO; + } + + public void setSEGURO(BigDecimal SEGURO) { + this.SEGURO = SEGURO; + } + + public BigDecimal getTAXAEMBARQUE() { + return TAXAEMBARQUE; + } + + public void setTAXAEMBARQUE(BigDecimal TAXAEMBARQUE) { + this.TAXAEMBARQUE = TAXAEMBARQUE; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/tiposervicio/TipoServicioVO.java b/src/com/rjconsultores/ventaboletos/vo/tiposervicio/TipoServicioVO.java new file mode 100644 index 000000000..b138bd9c3 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/tiposervicio/TipoServicioVO.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.vo.tiposervicio; + +import com.rjconsultores.ventaboletos.entidad.TipoServicio; + +public class TipoServicioVO { + + private Integer tiposervicioId; + private String descservicio; + + public TipoServicioVO(Integer tiposervicioId, String descservicio) { + super(); + this.tiposervicioId = tiposervicioId; + this.descservicio = descservicio; + } + + public TipoServicioVO(TipoServicio tipoServicio) { + this.tiposervicioId = tipoServicio.getTiposervicioId(); + this.descservicio = tipoServicio.getDescservicio(); + } + + public Integer getTiposervicioId() { + return tiposervicioId; + } + public void setTiposervicioId(Integer tiposervicioId) { + this.tiposervicioId = tiposervicioId; + } + public String getDescservicio() { + return descservicio; + } + public void setDescservicio(String descservicio) { + this.descservicio = descservicio; + } +} diff --git a/src/com/rjconsultores/ventaboletos/vo/tramo/TramoTarifaVO.java b/src/com/rjconsultores/ventaboletos/vo/tramo/TramoTarifaVO.java new file mode 100644 index 000000000..a196dd408 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/tramo/TramoTarifaVO.java @@ -0,0 +1,48 @@ +package com.rjconsultores.ventaboletos.vo.tramo; + +import java.util.List; + +public class TramoTarifaVO { + + private Integer rutaId; + private String chaveCorrida; + private List listTramos; + + public TramoTarifaVO() { + //construtor default + } + + public TramoTarifaVO(String chaveCorrida, Integer rutaId, List listTramos) { + super(); + this.chaveCorrida = chaveCorrida; + this.rutaId = rutaId; + this.listTramos = listTramos; + } + + public String getChaveCorrida() { + return chaveCorrida; + } + + public void setChaveCorrida(String chaveCorrida) { + this.chaveCorrida = chaveCorrida; + } + + public List getListTramos() { + return listTramos; + } + + public void setListTramos(List listTramos) { + this.listTramos = listTramos; + } + + public Integer getRutaId() { + return rutaId; + } + + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/tramo/TramoVO.java b/src/com/rjconsultores/ventaboletos/vo/tramo/TramoVO.java new file mode 100644 index 000000000..aef5f7378 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/tramo/TramoVO.java @@ -0,0 +1,265 @@ +package com.rjconsultores.ventaboletos.vo.tramo; + +import java.io.Serializable; +import java.math.BigDecimal; + +import org.hibernate.type.IntegerType; + +import com.rjconsultores.ventaboletos.entidad.Tramo; +import com.rjconsultores.ventaboletos.vo.parada.ParadaVO; +import com.rjconsultores.ventaboletos.vo.via.ViaVO; + +public class TramoVO implements Serializable{ + private static final long serialVersionUID = -8840675316985686236L; + private Integer tramoId; + private String desctramo; + private ParadaVO origem; + private ParadaVO destino; + private ViaVO via; + private Integer numsecuencia; + private BigDecimal valorTarifa; + private BigDecimal valorTaxa; + private BigDecimal valorSeguro; + private BigDecimal valorPedagio; + private BigDecimal valorOutros; + private BigDecimal tarifaMinima; + private Integer aliasorigenId; + private Integer aliasdestinoId; + private String descAliasorigen; + private String descAliasdestino; + //campos usados nas consultas resumidas + private Integer origemId; + private Integer destinoId; + private Integer rutaId; + private Integer monedaId; + private Integer empresaId; + + public TramoVO() { + //construtor default + } + + public TramoVO(Integer tramoId) { + super(); + this.tramoId = tramoId; + } + + public TramoVO(Integer tramoId, String desctramo, ParadaVO origem, ParadaVO destino, ViaVO via, Integer numsecuencia, + BigDecimal valorTarifa, BigDecimal valorTaxa, BigDecimal valorSeguro, BigDecimal valorPedagio, + BigDecimal valorOutros) { + super(); + this.tramoId = tramoId; + this.desctramo = desctramo; + this.origem = origem; + this.destino = destino; + this.via = via; + this.numsecuencia = numsecuencia; + this.valorTarifa = valorTarifa; + this.valorTaxa = valorTaxa; + this.valorSeguro = valorSeguro; + this.valorPedagio = valorPedagio; + this.valorOutros = valorOutros; + } + + public TramoVO(Integer tramoId, String desctramo, ParadaVO origem, ParadaVO destino, ViaVO via, Integer numsecuencia, BigDecimal valorTarifa, BigDecimal valorTaxa, BigDecimal valorSeguro, BigDecimal valorPedagio, BigDecimal valorOutros, BigDecimal tarifaMinima, Integer aliasorigenId, Integer aliasdestinoId, String descAliasorigen, String descAliasdestino, Integer origemId, Integer destinoId, Integer rutaId, Integer monedaId, Integer empresaId) { + super(); + this.tramoId = tramoId; + this.desctramo = desctramo; + this.origem = origem; + this.destino = destino; + this.via = via; + this.numsecuencia = numsecuencia; + this.valorTarifa = valorTarifa; + this.valorTaxa = valorTaxa; + this.valorSeguro = valorSeguro; + this.valorPedagio = valorPedagio; + this.valorOutros = valorOutros; + this.tarifaMinima = tarifaMinima; + this.aliasorigenId = aliasorigenId; + this.aliasdestinoId = aliasdestinoId; + this.descAliasorigen = descAliasorigen; + this.descAliasdestino = descAliasdestino; + this.origemId = origemId; + this.destinoId = destinoId; + this.rutaId = rutaId; + this.monedaId = monedaId; + this.empresaId = empresaId; + } + + public TramoVO( Tramo tramo ) { + super(); + this.tramoId = tramo.getTramoId(); + this.desctramo = tramo.getDesctramo(); + this.origemId = tramo.getOrigem().getParadaId(); + this.destinoId = tramo.getDestino().getParadaId(); + + } + + public Integer getTramoId() { + return tramoId; + } + + public void setTramoId(Integer tramoId) { + this.tramoId = tramoId; + } + + public String getDesctramo() { + return desctramo; + } + + public void setDesctramo(String desctramo) { + this.desctramo = desctramo; + } + + public ParadaVO getOrigem() { + return origem; + } + + public void setOrigem(ParadaVO origem) { + this.origem = origem; + } + + public ParadaVO getDestino() { + return destino; + } + + public void setDestino(ParadaVO destino) { + this.destino = destino; + } + + public ViaVO getVia() { + return via; + } + + public void setVia(ViaVO via) { + this.via = via; + } + + public Integer getNumsecuencia() { + return numsecuencia; + } + + public void setNumsecuencia(Integer numsecuencia) { + this.numsecuencia = numsecuencia; + } + + public BigDecimal getValorTarifa() { + return valorTarifa; + } + + public void setValorTarifa(BigDecimal valorTarifa) { + this.valorTarifa = valorTarifa; + } + + public BigDecimal getValorTaxa() { + return valorTaxa; + } + + public void setValorTaxa(BigDecimal valorTaxa) { + this.valorTaxa = valorTaxa; + } + + public BigDecimal getValorSeguro() { + return valorSeguro; + } + + public void setValorSeguro(BigDecimal valorSeguro) { + this.valorSeguro = valorSeguro; + } + + public BigDecimal getValorPedagio() { + return valorPedagio; + } + + public void setValorPedagio(BigDecimal valorPedagio) { + this.valorPedagio = valorPedagio; + } + + public BigDecimal getValorOutros() { + return valorOutros; + } + + public void setValorOutros(BigDecimal valorOutros) { + this.valorOutros = valorOutros; + } + + public Integer getAliasorigenId() { + return aliasorigenId; + } + + public void setAliasorigenId(Integer aliasorigenId) { + this.aliasorigenId = aliasorigenId; + } + + public Integer getAliasdestinoId() { + return aliasdestinoId; + } + + public void setAliasdestinoId(Integer aliasdestinoId) { + this.aliasdestinoId = aliasdestinoId; + } + + public String getDescAliasorigen() { + return descAliasorigen; + } + + public void setDescAliasorigen(String descAliasorigen) { + this.descAliasorigen = descAliasorigen; + } + + public String getDescAliasdestino() { + return descAliasdestino; + } + + public void setDescAliasdestino(String descAliasdestino) { + this.descAliasdestino = descAliasdestino; + } + + public Integer getOrigemId() { + return origemId; + } + + public void setOrigemId(Integer origemId) { + this.origemId = origemId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + public Integer getRutaId() { + return rutaId; + } + + public void setRutaId(Integer rutaId) { + this.rutaId = rutaId; + } + + public BigDecimal getTarifaMinima() { + return tarifaMinima; + } + + public void setTarifaMinima(BigDecimal tarifaMinima) { + this.tarifaMinima = tarifaMinima; + } + + public Integer getMonedaId() { + return monedaId; + } + + public void setMonedaId(Integer monedaId) { + this.monedaId = monedaId; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/via/ViaVO.java b/src/com/rjconsultores/ventaboletos/vo/via/ViaVO.java new file mode 100644 index 000000000..e8f1aab83 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/via/ViaVO.java @@ -0,0 +1,30 @@ +package com.rjconsultores.ventaboletos.vo.via; + +public class ViaVO { + + private Integer viaId; + private String nombvia; + + public ViaVO(Integer viaId, String nombvia) { + super(); + this.viaId = viaId; + this.nombvia = nombvia; + } + + public Integer getViaId() { + return viaId; + } + + public void setViaId(Integer viaId) { + this.viaId = viaId; + } + + public String getNombvia() { + return nombvia; + } + + public void setNombvia(String nombvia) { + this.nombvia = nombvia; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/NamedParameterStatement.java b/src/com/rjconsultores/ventaboletos/web/utilerias/NamedParameterStatement.java new file mode 100644 index 000000000..23184dee7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/NamedParameterStatement.java @@ -0,0 +1,357 @@ +/** + * + */ +package com.rjconsultores.ventaboletos.web.utilerias; + +import java.sql.Connection; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +@SuppressWarnings({"rawtypes", "unchecked"}) +public class NamedParameterStatement { + /** The statement this object is wrapping. */ + private final PreparedStatement statement; + + /** Maps parameter names to arrays of ints which are the parameter indices. */ + + private final Map indexMap; + + /** + * Creates a NamedParameterStatement. Wraps a call to c.{@link Connection#prepareStatement(java.lang.String) prepareStatement}. + * + * @param connection + * the database connection + * @param query + * the parameterized query + * @throws SQLException + * if the statement could not be created + */ + public NamedParameterStatement(Connection connection, String query) throws + SQLException { + this(connection, query, ResultSet.TYPE_FORWARD_ONLY); + } + + /** + * Creates a NamedParameterStatement. Wraps a call to c.{@link Connection#prepareStatement(java.lang.String) prepareStatement}. + * + * @param connection the database connection + * @param query the parameterized query + * @throws SQLException if the statement could not be created + * @param resultSetType type of resultSet + */ + public NamedParameterStatement(Connection connection, String query, int resultSetType) throws + SQLException { + indexMap = new HashMap(); + String parsedQuery = parse(query, indexMap); + statement = connection.prepareStatement(parsedQuery, resultSetType, ResultSet.CONCUR_READ_ONLY); + statement.setFetchSize(1000); + } + + /** + * Parses a query with named parameters. The parameter-index mappings are put into the map, and the parsed query is returned. DO NOT CALL FROM CLIENT CODE. This method is non-private so JUnit code can test it. + * + * @param query + * query to parse + * @param paramMap + * map to hold parameter-index mappings + * @return the parsed query + */ + static final String parse(String query, Map paramMap) { + // I was originally using regular expressions, but they didn't work well for ignoring + // parameter-like strings inside quotes. + int length = query.length(); + StringBuffer parsedQuery = new StringBuffer(length); + boolean inSingleQuote = false; + boolean inDoubleQuote = false; + int index = 1; + + for (int i = 0; i < length; i++) { + char c = query.charAt(i); + if (inSingleQuote) { + if (c == '\'') { + inSingleQuote = false; + } + } else if (inDoubleQuote) { + if (c == '"') { + inDoubleQuote = false; + } + } else { + if (c == '\'') { + inSingleQuote = true; + } else if (c == '"') { + inDoubleQuote = true; + } else if (c == ':' && i + 1 < length && + Character.isJavaIdentifierStart(query.charAt(i + 1))) { + int j = i + 2; + while (j < length && Character.isJavaIdentifierPart(query.charAt(j))) { + j++; + } + String name = query.substring(i + 1, j); + c = '?'; // replace the parameter with a question mark + i += name.length(); // skip past the end if the parameter + + List indexList = (List) paramMap.get(name); + if (indexList == null) { + indexList = new LinkedList(); + paramMap.put(name, indexList); + } + indexList.add(new Integer(index)); + + index++; + } + } + parsedQuery.append(c); + } + + // replace the lists of Integer objects with arrays of ints + for (Iterator itr = paramMap.entrySet().iterator(); itr.hasNext();) { + Map.Entry entry = (Map.Entry) itr.next(); + List list = (List) entry.getValue(); + int[] indexes = new int[list.size()]; + int i = 0; + for (Iterator itr2 = list.iterator(); itr2.hasNext();) { + Integer x = (Integer) itr2.next(); + indexes[i++] = x.intValue(); + } + entry.setValue(indexes); + } + + return parsedQuery.toString(); + } + + /** + * Returns the indexes for a parameter. + * + * @param name + * parameter name + * @return parameter indexes + * @throws IllegalArgumentException + * if the parameter does not exist + */ + private int[] getIndexes(String name) { + int[] indexes = (int[]) indexMap.get(name); + if (indexes == null) { + throw new IllegalArgumentException("Parameter not found: " + name); + } + return indexes; + } + + /** + * Sets a parameter. + * + * @param name + * parameter name + * @param value + * parameter value + * @throws SQLException + * if an error occurred + * @throws IllegalArgumentException + * if the parameter does not exist + * @see PreparedStatement#setObject(int, java.lang.Object) + */ + public void setObject(String name, Object value) throws SQLException { + int[] indexes = getIndexes(name); + for (int i = 0; i < indexes.length; i++) { + statement.setObject(indexes[i], value); + } + } + + /** + * Sets a parameter. + * + * @param name + * parameter name + * @param value + * parameter value + * @throws SQLException + * if an error occurred + * @throws IllegalArgumentException + * if the parameter does not exist + * @see PreparedStatement#setString(int, java.lang.String) + */ + public void setString(String name, String value) throws SQLException { + int[] indexes = getIndexes(name); + for (int i = 0; i < indexes.length; i++) { + statement.setString(indexes[i], value); + } + } + + /** + * Sets a parameter. + * + * @param name + * parameter name + * @param value + * parameter value + * @throws SQLException + * if an error occurred + * @throws IllegalArgumentException + * if the parameter does not exist + * @see PreparedStatement#setInt(int, int) + */ + public void setInt(String name, int value) throws SQLException { + int[] indexes = getIndexes(name); + for (int i = 0; i < indexes.length; i++) { + statement.setInt(indexes[i], value); + } + } + + /** + * Sets a parameter. + * + * @param name + * parameter name + * @param value + * parameter value + * @throws SQLException + * if an error occurred + * @throws IllegalArgumentException + * if the parameter does not exist + * @see PreparedStatement#setInt(int, int) + */ + public void setLong(String name, long value) throws SQLException { + int[] indexes = getIndexes(name); + for (int i = 0; i < indexes.length; i++) { + statement.setLong(indexes[i], value); + } + } + + public void setDate(String name, Date value) throws SQLException { + int[] indexes = getIndexes(name); + for (int i = 0; i < indexes.length; i++) { + statement.setDate(indexes[i], value); + } + } + + + public void setNull(String name, int sqlType) throws SQLException { + int[] indexes = getIndexes(name); + for (int i = 0; i < indexes.length; i++) { + statement.setNull(indexes[i], sqlType); + } + } + + public void setBoolean(String name, Boolean value) throws SQLException { + int[] indexes = getIndexes(name); + for (int i = 0; i < indexes.length; i++) { + statement.setBoolean(indexes[i], value); + } + } + + /** + * Sets a parameter. + * + * @param name + * parameter name + * @param value + * parameter value + * @throws SQLException + * if an error occurred + * @throws IllegalArgumentException + * if the parameter does not exist + * @see PreparedStatement#setTimestamp(int, java.sql.Timestamp) + */ + public void setTimestamp(String name, Timestamp value) throws SQLException + { + int[] indexes = getIndexes(name); + for (int i = 0; i < indexes.length; i++) { + statement.setTimestamp(indexes[i], value); + } + } + + /** + * Returns the underlying statement. + * + * @return the statement + */ + public PreparedStatement getStatement() { + return statement; + } + + /** + * Executes the statement. + * + * @return true if the first result is a {@link ResultSet} + * @throws SQLException + * if an error occurred + * @see PreparedStatement#execute() + */ + public boolean execute() throws SQLException { + return statement.execute(); + } + + /** + * Executes the statement, which must be a query. + * + * @return the query results + * @throws SQLException + * if an error occurred + * @see PreparedStatement#executeQuery() + */ + public ResultSet executeQuery() throws SQLException { + return statement.executeQuery(); + } + + /** + * Executes the statement, which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL statement that returns nothing, such as a DDL statement. + * + * @return number of rows affected + * @throws SQLException + * if an error occurred + * @see PreparedStatement#executeUpdate() + */ + public int executeUpdate() throws SQLException { + return statement.executeUpdate(); + } + + /** + * Closes the statement. + * + * @throws SQLException + * if an error occurred + * @see Statement#close() + */ + public void close() throws SQLException { + statement.close(); + } + + public Boolean isClosed() throws SQLException { + return statement.isClosed(); + } + + public void setFetchSize(int rows) throws SQLException { + statement.setFetchSize(rows); + } + + /** + * Adds the current set of parameters as a batch entry. + * + * @throws SQLException + * if something went wrong + */ + public void addBatch() throws SQLException { + statement.addBatch(); + } + + /** + * Executes all of the batched statements. + * + * See {@link Statement#executeBatch()} for details. + * + * @return update counts for each statement + * @throws SQLException + * if something went wrong + */ + public int[] executeBatch() throws SQLException { + return statement.executeBatch(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java new file mode 100644 index 000000000..f90b46633 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java @@ -0,0 +1,35 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.web.utilerias.spring; + +import org.springframework.context.ApplicationContext; + +/** + * This class provides application-wide access to the Spring ApplicationContext. + * The ApplicationContext is injected by the class "ApplicationContextProvider". + * + * @author Siegfried Bolz + */ +public class AppContext { + + private static ApplicationContext ctx; + + /** + * Injected from the class "ApplicationContextProvider" which is automatically + * loaded during Spring-Initialization. + */ + public static void setApplicationContext(ApplicationContext applicationContext) { + ctx = applicationContext; + } + + /** + * Get access to the Spring ApplicationContext from everywhere in your Application. + * + * @return + */ + public static ApplicationContext getApplicationContext() { + return ctx; + } +} diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java new file mode 100644 index 000000000..4210b4f91 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.web.utilerias.spring; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +/** + * This class provides an application-wide access to the + * Spring ApplicationContext! The ApplicationContext is + * injected in a static method of the class "AppContext". + * + * Use AppContext.getApplicationContext() to get access + * to all Spring Beans. + * + * @author Siegfried Bolz + */ +public class ApplicationContextProvider implements ApplicationContextAware { + + public void setApplicationContext(ApplicationContext ctx) throws BeansException { + // Wiring the ApplicationContext into a static method + AppContext.setApplicationContext(ctx); + } +} diff --git a/src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosClientePacoteRS.java b/src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosClientePacoteRS.java new file mode 100644 index 000000000..c7c5c7884 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosClientePacoteRS.java @@ -0,0 +1,36 @@ +package com.rjconsultores.ventaboletos.ws.rs; + +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.rjconsultores.ventaboletos.dao.ClientePacoteDAO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Path("") +public class BusquedaDatosClientePacoteRS { + + private static Logger log = LoggerFactory.getLogger(BusquedaDatosClientePacoteRS.class); + + @GET + @Path("/busquedadatosclientepacote") + @Produces({ MediaType.APPLICATION_XML }) + public List busquedaDatosClientePacote(@QueryParam("cpfcnpj") String cpfCnpjParam) { + try { + ClientePacoteDAO clientePacoteDao = (ClientePacoteDAO)AppContext.getApplicationContext().getBean("clientePacoteDAO"); + return clientePacoteDao.busquedaDatosClientePacote(cpfCnpjParam); + } catch (Exception e) { + log.error(e.getMessage(), e.getCause()); + } + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosTicketsRS.java b/src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosTicketsRS.java new file mode 100644 index 000000000..2288de14c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/ws/rs/BusquedaDatosTicketsRS.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.ws.rs; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.dao.BusquedaDatosTicketDAO; +import com.rjconsultores.ventaboletos.vo.busquedapacotes.PacoteVO; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Path("") +public class BusquedaDatosTicketsRS { + + @GET + @Path("/busquedadatostickets") + @Produces({ MediaType.APPLICATION_XML }) + public List busquedaDatosTickets(@QueryParam("fecinicial") String fechaIniParam, @QueryParam("fecfinal") String fechaFinParam, + @QueryParam("fecventainicial") String fechaVentaIniParam, @QueryParam("fecventafinal") String fechaVentaFinParam, + @QueryParam("fecalteracaoinicial") String fechaAlteracaoIniParam, @QueryParam("fecalteracaofinal") String fechaAlteracaoFinParam) throws ParseException{ + + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + + Date fecInicial = StringUtils.isNotBlank(fechaIniParam) ? sdf.parse(fechaIniParam) : null; + Date fecFinal = StringUtils.isNotBlank(fechaFinParam) ? sdf.parse(fechaFinParam) : null; + Date fecVentaInicial = StringUtils.isNotBlank(fechaVentaIniParam) ? sdf.parse(fechaVentaIniParam) : null; + Date fecVentaFinal = StringUtils.isNotBlank(fechaVentaFinParam) ? sdf.parse(fechaVentaFinParam) : null; + Date fecAlteracaoInicial = StringUtils.isNotBlank(fechaAlteracaoIniParam) ? sdf.parse(fechaAlteracaoIniParam) : null; + Date fecAlteracaoFinal = StringUtils.isNotBlank(fechaAlteracaoFinParam) ? sdf.parse(fechaAlteracaoFinParam) : null; + + List pacotes = null; + + if(isParametrosInformado(fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal)) { + BusquedaDatosTicketDAO pacoteDao = (BusquedaDatosTicketDAO)AppContext.getApplicationContext().getBean("busquedaDatosTicketDAO"); + pacotes = pacoteDao.buscaDatosTickets(fecInicial, fecFinal, fecVentaInicial, fecVentaFinal, fecAlteracaoInicial, fecAlteracaoFinal); + } + + return pacotes; + } + + private boolean isParametrosInformado(Date fecInicial, Date fecFinal, Date fecVentaInicial, Date fecVentaFinal, Date fecAlteracaoInicial, Date fecAlteracaoFinal) { + return fecInicial != null || + fecFinal != null || + fecVentaInicial != null || + fecVentaFinal != null || + fecAlteracaoInicial != null || + fecAlteracaoFinal != null; + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/ws/rs/CajaCerradoRS.java b/src/com/rjconsultores/ventaboletos/ws/rs/CajaCerradoRS.java new file mode 100644 index 000000000..63c9509bc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/ws/rs/CajaCerradoRS.java @@ -0,0 +1,65 @@ +package com.rjconsultores.ventaboletos.ws.rs; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.dao.CajaDAO; +import com.rjconsultores.ventaboletos.vo.caja.UsuarioVO; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Path("/cajas") +public class CajaCerradoRS { + @GET + @Path("/cerrados") + @Produces({ MediaType.APPLICATION_XML }) + public List buscarCajaCerrado(@QueryParam("fecha") String fecha, @QueryParam("cveusuario") String cveusuario, @QueryParam("turnoid") String turnoid) { + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + + Date fec = new Date(); + + try { + fec = StringUtils.isBlank(fecha) ? new Date() : sdf.parse(fecha); + } catch (Exception e) { + } + + if (cveusuario == null) { + cveusuario = "*"; + } + + if (turnoid == null) { + turnoid = "*"; + } + + CajaDAO cajaDAO = (CajaDAO) AppContext.getApplicationContext().getBean("cajaDAO"); + List list = cajaDAO.buscarCajaCerrado(fec, cveusuario, turnoid); + + return list; + } + @GET + @Path("/usuarios") + @Produces({ MediaType.APPLICATION_XML }) + public List buscarUsuarioCerrado(@QueryParam("fecha") String fecha) { + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + + Date fec = new Date(); + + try { + fec = StringUtils.isBlank(fecha) ? new Date() : sdf.parse(fecha); + } catch (Exception e) { + } + + CajaDAO cajaDAO = (CajaDAO) AppContext.getApplicationContext().getBean("cajaDAO"); + List list = cajaDAO.buscarUsuarioCerrado(fec); + + return list; + } +} diff --git a/src/com/rjconsultores/ventaboletos/ws/rs/CajaRS.java b/src/com/rjconsultores/ventaboletos/ws/rs/CajaRS.java new file mode 100644 index 000000000..50cc577e0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/ws/rs/CajaRS.java @@ -0,0 +1,81 @@ +package com.rjconsultores.ventaboletos.ws.rs; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import org.apache.commons.lang.StringUtils; + +import com.rjconsultores.ventaboletos.dao.CajaDAO; +import com.rjconsultores.ventaboletos.vo.caja.CajaDetalleVO; +import com.rjconsultores.ventaboletos.vo.caja.CajaVO; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Path("/") +public class CajaRS { + @Path("/cajas") + @GET + @Produces({ MediaType.APPLICATION_XML }) + public List buscarCaja(@QueryParam("yaCerrado") boolean yaCerrado, @QueryParam("fecDesde") String fecDesde, @QueryParam("fecHasta") String fecHasta) { + + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + + Date fecDesdeD = new Date(); + Date fecHastaD = new Date(); + + try { + fecDesdeD = StringUtils.isBlank(fecDesde) ? new Date() : sdf.parse(fecDesde); + } catch (Exception e) { + + } + try { + fecHastaD = StringUtils.isBlank(fecHasta) ? new Date() : sdf.parse(fecHasta); + } catch (Exception e) { + + } + + CajaDAO cajaDAO = (CajaDAO) AppContext.getApplicationContext().getBean("cajaDAO"); + List list = cajaDAO.buscarCajaFecha(yaCerrado, fecDesdeD, fecHastaD); + + return list; + } + @Path("/detalleCajas") + @GET + @Produces({ MediaType.APPLICATION_XML }) + public List buscarDetalleCaja(@QueryParam("fecDesde") String fecDesde, @QueryParam("fecHasta") String fecHasta, @QueryParam("sembilhetesPacote") String sembilhetesPacote) { + + SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); + + Date fecDesdeD = new Date(); + Date fecHastaD = new Date(); + Boolean bSembilhetesPacote = Boolean.FALSE; + + try { + fecDesdeD = StringUtils.isBlank(fecDesde) ? new Date() : sdf.parse(fecDesde); + } catch (Exception e) { + + } + try { + fecHastaD = StringUtils.isBlank(fecHasta) ? new Date() : sdf.parse(fecHasta); + } catch (Exception e) { + + } + try { + bSembilhetesPacote = StringUtils.isBlank(sembilhetesPacote) ? Boolean.FALSE : Boolean.valueOf(sembilhetesPacote); + } catch (Exception e) { + + } + + CajaDAO cajaDAO = (CajaDAO) AppContext.getApplicationContext().getBean("cajaDAO"); + List list = cajaDAO.buscarDetalleCaja(fecDesdeD, fecHastaD, bSembilhetesPacote); + + return list; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/ws/rs/ReembolsoOcdNotaCreditoRS.java b/src/com/rjconsultores/ventaboletos/ws/rs/ReembolsoOcdNotaCreditoRS.java new file mode 100644 index 000000000..c65ba463c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/ws/rs/ReembolsoOcdNotaCreditoRS.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.ws.rs; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +import com.rjconsultores.ventaboletos.service.NotaCreditoVendaPacoteService; +import com.rjconsultores.ventaboletos.service.OCDService; +import com.rjconsultores.ventaboletos.vo.reembolsoocdnotacredito.ReembolsoOcdNotaCreditoVO; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Path("/reembolsoocdnotacredito") +public class ReembolsoOcdNotaCreditoRS { + + private static SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + + @GET + @Produces({ MediaType.APPLICATION_XML }) + public List busquedaDatosReembolsoOcdNotaCreditoRS(@QueryParam("fecinicial") String fecInicialParam, + @QueryParam("fecfinal") String fecFinalParam, @QueryParam("fecpagamentoinicial") String fecPagamentoInicialParam, + @QueryParam("fecpagamentofinal") String fecPagamentoFinalParam, @QueryParam("pago") Boolean indPago) { + + Date fecInicial = getDateFromString(fecInicialParam); + Date fecFinal = getDateFromString(fecFinalParam); + Date fecPagamentoInicial = getDateFromString(fecPagamentoInicialParam); + Date fecPagamentoFinal = getDateFromString(fecPagamentoFinalParam); + + OCDService ocdService = (OCDService) AppContext.getApplicationContext().getBean(OCDService.class); + List result = ocdService.busquedaDatosReembolsoOcdNotaCreditoRS(fecInicial, fecFinal, fecPagamentoInicial, fecPagamentoFinal, indPago); + + NotaCreditoVendaPacoteService notaCreditoVendaPacoteService = (NotaCreditoVendaPacoteService) AppContext.getApplicationContext().getBean(NotaCreditoVendaPacoteService.class); + result.addAll(notaCreditoVendaPacoteService.busquedaDatosReembolsoOcdNotaCreditoRS(fecInicial, fecFinal, fecPagamentoInicial, fecPagamentoFinal, indPago)); + + return result; + + } + + private Date getDateFromString(String dateString) { + try { + return dateFormat.parse(dateString); + } catch (Exception e) { + return null; + } + } + +} diff --git a/src/com/rjconsultores/ventaboletos/ws/rs/UsuarioRS.java b/src/com/rjconsultores/ventaboletos/ws/rs/UsuarioRS.java new file mode 100644 index 000000000..7fb1c26b2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/ws/rs/UsuarioRS.java @@ -0,0 +1,24 @@ +package com.rjconsultores.ventaboletos.ws.rs; + +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import com.rjconsultores.ventaboletos.dao.UsuarioDAO; +import com.rjconsultores.ventaboletos.vo.caja.UsuarioActivoVO; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Path("/usuarios") +public class UsuarioRS { + @GET + @Produces({ MediaType.APPLICATION_XML }) + public List buscarUsuarios() { + UsuarioDAO dao = (UsuarioDAO) AppContext.getApplicationContext().getBean("usuarioDAO"); + List retorno = dao.buscarUsuariosActivo(); + + return retorno; + } +} diff --git a/src/com/rjconsultores/ventaboletos/ws/rs/VendaEmbarcadaRS.java b/src/com/rjconsultores/ventaboletos/ws/rs/VendaEmbarcadaRS.java new file mode 100644 index 000000000..bf29924aa --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/ws/rs/VendaEmbarcadaRS.java @@ -0,0 +1,103 @@ +package com.rjconsultores.ventaboletos.ws.rs; + + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.sql.Date; +import java.text.ParseException; +import java.text.SimpleDateFormat; + +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; + +import org.slf4j.Logger; + +import com.rjconsultores.ventaboletos.service.VendaEmbarcadaService; +import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO; +import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext; + +@Path("vendaEmbarcada") +public class VendaEmbarcadaRS { + + private static Logger log = org.slf4j.LoggerFactory.getLogger(VendaEmbarcadaRS.class); + + private final int CATEGORIA_NAO_SUPORTADA = 5; + private final int DATA_COM_FORMATO_INVALIDO = 6; + private final int ERROR_NAO_SUPORTADO_INVALIDO = 7; + + @POST + @Path("/gerarVenda/{numeroAssento}/{categoria}/{origemId}/{destinoId}/{servicoId}/{dataCorrida}/{dataVenda}/{preco}/{tipoVendaId}/{pontoVendaId}/{empresaCorridaId}/{estacaoId}/{usuarioId}/{empresaId}/{taxaEmbarque}/{pedagio}/{outros}/{seguro}/{rutaId}/{formaPagoId}/{classeServicoId}/{numFolioPreImpresso}/{serieImpFiscal}") + @Produces({MediaType.APPLICATION_JSON}) + public String gerarVenda(@PathParam("numeroAssento") String numeroAssento, @PathParam("categoria") String categoria, @PathParam("origemId") Integer origemId, + @PathParam("destinoId") Integer destinoId, @PathParam("servicoId") Integer servicoId, @PathParam("dataCorrida") String dataCorrida, @PathParam("dataVenda") String dataVenda, + @PathParam("preco") BigDecimal preco, @PathParam("tipoVendaId") Integer tipoVendaId, @PathParam("pontoVendaId") Integer pontoVendaId, + @PathParam("empresaCorridaId") Integer empresaCorridaId, @PathParam("estacaoId") Integer estacaoId, @PathParam("usuarioId") Integer usuarioId, + @PathParam("empresaId") BigInteger empresaId, @PathParam("taxaEmbarque") BigDecimal importeTaxaEmbarque, @PathParam("pedagio") BigDecimal importePedagio, + @PathParam("outros") BigDecimal importeOutros, @PathParam("seguro") BigDecimal importeSeguro, @PathParam("rutaId") Integer rutaId, @PathParam("formaPagoId") Integer formaPagoId, + @PathParam("classeServicoId") Integer classeServicoId, @PathParam("numFolioPreImpresso") String numFolioPreImpresso, @PathParam("serieImpFiscal") String serieImpFiscal ){ + + + String retornoJson = "{'response':'"; + + try { + + int categoriaId = 1; + + if (!categoria.equalsIgnoreCase("normal")){ + return retornoJson.concat(CATEGORIA_NAO_SUPORTADA + "'}"); + } + + VendaEmbarcadaVO vendaEmbarcada = new VendaEmbarcadaVO(); + vendaEmbarcada.setUsuarioId(usuarioId); + vendaEmbarcada.setClienteId(vendaEmbarcada.getUsuarioId()); + vendaEmbarcada.setCategoriaId(categoriaId); + vendaEmbarcada.setCorridaId(servicoId); + vendaEmbarcada.setDestinoId(destinoId); + vendaEmbarcada.setOrigemId(origemId); + vendaEmbarcada.setEmpresaCorridaId(empresaCorridaId); + vendaEmbarcada.setTipoVentaId(tipoVendaId); + vendaEmbarcada.setEmpresaId(empresaId); + vendaEmbarcada.setPrecio(preco); + vendaEmbarcada.setNumAsiento(numeroAssento); + vendaEmbarcada.setPuntoVentaId(pontoVendaId); + vendaEmbarcada.setEmpresaPuntoVentaId(empresaId.intValue()); + vendaEmbarcada.setEstacionId(estacaoId); + vendaEmbarcada.setRutaId(rutaId); + vendaEmbarcada.setClaseServicioId(classeServicoId); + vendaEmbarcada.setFormaPagoId(formaPagoId); + + String data[] = dataCorrida.split("__"); + + if (data.length != 2){ + return retornoJson.concat(DATA_COM_FORMATO_INVALIDO + "'}"); + } + + vendaEmbarcada.setFecCorrida(new Date(new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").parse(data[0].replace("_", "/").concat(" ").concat(data[1].replace("_", ":"))).getTime())); + + vendaEmbarcada.setFechorViaje(vendaEmbarcada.getFecCorrida()); + vendaEmbarcada.setFechorVenta(vendaEmbarcada.getFecCorrida()); + vendaEmbarcada.setMarcaId(empresaId.intValue()); + vendaEmbarcada.setImporteTaxaEmbarque(importeTaxaEmbarque); + vendaEmbarcada.setImportePedagio(importePedagio); + vendaEmbarcada.setImporteOutros(importeOutros); + vendaEmbarcada.setImporteSeguro(importeSeguro); + vendaEmbarcada.setNumFolioPreimpresso(numFolioPreImpresso); + vendaEmbarcada.setSerieImpFiscal(serieImpFiscal); + + VendaEmbarcadaService vendaEmbarcadaService = (VendaEmbarcadaService) AppContext.getApplicationContext().getBean("VendaEmbarcadaService"); + + int retornoVenda = vendaEmbarcadaService.gerarVendaEmbarcada(vendaEmbarcada); + + return retornoJson.concat(retornoVenda + "'}"); + } catch (ParseException e) { + log.error(e.getMessage(), e); + return retornoJson.concat(DATA_COM_FORMATO_INVALIDO + "'}"); + } catch (Exception e) { + log.error(e.getMessage(), e); + return retornoJson.concat(ERROR_NAO_SUPORTADO_INVALIDO + "'}"); + } + } +} \ No newline at end of file diff --git a/src/org/w3/_2000/_09/xmldsig_/KeyInfoType.java b/src/org/w3/_2000/_09/xmldsig_/KeyInfoType.java new file mode 100644 index 000000000..a6a8e1886 --- /dev/null +++ b/src/org/w3/_2000/_09/xmldsig_/KeyInfoType.java @@ -0,0 +1,104 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package org.w3._2000._09.xmldsig_; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlID; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

Classe Java de KeyInfoType complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="KeyInfoType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="X509Data" type="{http://www.w3.org/2000/09/xmldsig#}X509DataType"/>
+ *       </sequence>
+ *       <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "KeyInfoType", propOrder = { + "x509Data" +}) +public class KeyInfoType { + + @XmlElement(name = "X509Data", required = true) + protected X509DataType x509Data; + @XmlAttribute(name = "Id") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlID + @XmlSchemaType(name = "ID") + protected String id; + + /** + * Obtém o valor da propriedade x509Data. + * + * @return + * possible object is + * {@link X509DataType } + * + */ + public X509DataType getX509Data() { + return x509Data; + } + + /** + * Define o valor da propriedade x509Data. + * + * @param value + * allowed object is + * {@link X509DataType } + * + */ + public void setX509Data(X509DataType value) { + this.x509Data = value; + } + + /** + * Obtém o valor da propriedade id. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Define o valor da propriedade id. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + +} diff --git a/src/org/w3/_2000/_09/xmldsig_/ObjectFactory.java b/src/org/w3/_2000/_09/xmldsig_/ObjectFactory.java new file mode 100644 index 000000000..0050dbaa3 --- /dev/null +++ b/src/org/w3/_2000/_09/xmldsig_/ObjectFactory.java @@ -0,0 +1,140 @@ +//// +//// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +//// Consulte http://java.sun.com/xml/jaxb +//// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +//// Gerado em: 2017.08.14 às 03:08:29 PM BRT +//// +// +// +//package org.w3._2000._09.xmldsig_; +// +//import javax.xml.bind.JAXBElement; +//import javax.xml.bind.annotation.XmlElementDecl; +//import javax.xml.bind.annotation.XmlRegistry; +//import javax.xml.namespace.QName; +// +// +///** +// * This object contains factory methods for each +// * Java content interface and Java element interface +// * generated in the org.w3._2000._09.xmldsig_ package. +// *

An ObjectFactory allows you to programatically +// * construct new instances of the Java representation +// * for XML content. The Java representation of XML +// * content can consist of schema derived interfaces +// * and classes representing the binding of schema +// * type definitions, element declarations and model +// * groups. Factory methods for each of these are +// * provided in this class. +// * +// */ +//@XmlRegistry +//public class ObjectFactory { +// +// private final static QName _Signature_QNAME = new QName("http://www.w3.org/2000/09/xmldsig#", "Signature"); +// +// /** +// * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.w3._2000._09.xmldsig_ +// * +// */ +// public ObjectFactory() { +// } +// +// /** +// * Create an instance of {@link ReferenceType } +// * +// */ +// public ReferenceType createReferenceType() { +// return new ReferenceType(); +// } +// +// /** +// * Create an instance of {@link SignedInfoType } +// * +// */ +// public SignedInfoType createSignedInfoType() { +// return new SignedInfoType(); +// } +// +// /** +// * Create an instance of {@link SignatureType } +// * +// */ +// public SignatureType createSignatureType() { +// return new SignatureType(); +// } +// +// /** +// * Create an instance of {@link X509DataType } +// * +// */ +// public X509DataType createX509DataType() { +// return new X509DataType(); +// } +// +// /** +// * Create an instance of {@link SignatureValueType } +// * +// */ +// public SignatureValueType createSignatureValueType() { +// return new SignatureValueType(); +// } +// +// /** +// * Create an instance of {@link TransformsType } +// * +// */ +// public TransformsType createTransformsType() { +// return new TransformsType(); +// } +// +// /** +// * Create an instance of {@link TransformType } +// * +// */ +// public TransformType createTransformType() { +// return new TransformType(); +// } +// +// /** +// * Create an instance of {@link KeyInfoType } +// * +// */ +// public KeyInfoType createKeyInfoType() { +// return new KeyInfoType(); +// } +// +// /** +// * Create an instance of {@link ReferenceType.DigestMethod } +// * +// */ +// public ReferenceType.DigestMethod createReferenceTypeDigestMethod() { +// return new ReferenceType.DigestMethod(); +// } +// +// /** +// * Create an instance of {@link SignedInfoType.CanonicalizationMethod } +// * +// */ +// public SignedInfoType.CanonicalizationMethod createSignedInfoTypeCanonicalizationMethod() { +// return new SignedInfoType.CanonicalizationMethod(); +// } +// +// /** +// * Create an instance of {@link SignedInfoType.SignatureMethod } +// * +// */ +// public SignedInfoType.SignatureMethod createSignedInfoTypeSignatureMethod() { +// return new SignedInfoType.SignatureMethod(); +// } +// +// /** +// * Create an instance of {@link JAXBElement }{@code <}{@link SignatureType }{@code >}} +// * +// */ +// @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Signature") +// public JAXBElement createSignature(SignatureType value) { +// return new JAXBElement(_Signature_QNAME, SignatureType.class, null, value); +// } +// +//} diff --git a/src/org/w3/_2000/_09/xmldsig_/ReferenceType.java b/src/org/w3/_2000/_09/xmldsig_/ReferenceType.java new file mode 100644 index 000000000..ceff6f8fd --- /dev/null +++ b/src/org/w3/_2000/_09/xmldsig_/ReferenceType.java @@ -0,0 +1,283 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package org.w3._2000._09.xmldsig_; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlID; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

Classe Java de ReferenceType complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="ReferenceType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Transforms" type="{http://www.w3.org/2000/09/xmldsig#}TransformsType"/>
+ *         <element name="DigestMethod">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <attribute name="Algorithm" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" fixed="http://www.w3.org/2000/09/xmldsig#sha1" />
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element name="DigestValue" type="{http://www.w3.org/2000/09/xmldsig#}DigestValueType"/>
+ *       </sequence>
+ *       <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" />
+ *       <attribute name="URI" use="required">
+ *         <simpleType>
+ *           <restriction base="{http://www.w3.org/2001/XMLSchema}anyURI">
+ *             <minLength value="2"/>
+ *           </restriction>
+ *         </simpleType>
+ *       </attribute>
+ *       <attribute name="Type" type="{http://www.w3.org/2001/XMLSchema}anyURI" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ReferenceType", propOrder = { + "transforms", + "digestMethod", + "digestValue" +}) +public class ReferenceType { + + @XmlElement(name = "Transforms", required = true) + protected TransformsType transforms; + @XmlElement(name = "DigestMethod", required = true) + protected ReferenceType.DigestMethod digestMethod; + @XmlElement(name = "DigestValue", required = true) + protected byte[] digestValue; + @XmlAttribute(name = "Id") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlID + @XmlSchemaType(name = "ID") + protected String id; + @XmlAttribute(name = "URI", required = true) + protected String uri; + @XmlAttribute(name = "Type") + @XmlSchemaType(name = "anyURI") + protected String type; + + /** + * Obtém o valor da propriedade transforms. + * + * @return + * possible object is + * {@link TransformsType } + * + */ + public TransformsType getTransforms() { + return transforms; + } + + /** + * Define o valor da propriedade transforms. + * + * @param value + * allowed object is + * {@link TransformsType } + * + */ + public void setTransforms(TransformsType value) { + this.transforms = value; + } + + /** + * Obtém o valor da propriedade digestMethod. + * + * @return + * possible object is + * {@link ReferenceType.DigestMethod } + * + */ + public ReferenceType.DigestMethod getDigestMethod() { + return digestMethod; + } + + /** + * Define o valor da propriedade digestMethod. + * + * @param value + * allowed object is + * {@link ReferenceType.DigestMethod } + * + */ + public void setDigestMethod(ReferenceType.DigestMethod value) { + this.digestMethod = value; + } + + /** + * Obtém o valor da propriedade digestValue. + * + * @return + * possible object is + * byte[] + */ + public byte[] getDigestValue() { + return digestValue; + } + + /** + * Define o valor da propriedade digestValue. + * + * @param value + * allowed object is + * byte[] + */ + public void setDigestValue(byte[] value) { + this.digestValue = value; + } + + /** + * Obtém o valor da propriedade id. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Define o valor da propriedade id. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + /** + * Obtém o valor da propriedade uri. + * + * @return + * possible object is + * {@link String } + * + */ + public String getURI() { + return uri; + } + + /** + * Define o valor da propriedade uri. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setURI(String value) { + this.uri = value; + } + + /** + * Obtém o valor da propriedade type. + * + * @return + * possible object is + * {@link String } + * + */ + public String getType() { + return type; + } + + /** + * Define o valor da propriedade type. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setType(String value) { + this.type = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <attribute name="Algorithm" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" fixed="http://www.w3.org/2000/09/xmldsig#sha1" />
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "") + public static class DigestMethod { + + @XmlAttribute(name = "Algorithm", required = true) + @XmlSchemaType(name = "anyURI") + protected String algorithm; + + /** + * Obtém o valor da propriedade algorithm. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAlgorithm() { + if (algorithm == null) { + return "http://www.w3.org/2000/09/xmldsig#sha1"; + } else { + return algorithm; + } + } + + /** + * Define o valor da propriedade algorithm. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAlgorithm(String value) { + this.algorithm = value; + } + + } + +} diff --git a/src/org/w3/_2000/_09/xmldsig_/SignatureType.java b/src/org/w3/_2000/_09/xmldsig_/SignatureType.java new file mode 100644 index 000000000..de80b8517 --- /dev/null +++ b/src/org/w3/_2000/_09/xmldsig_/SignatureType.java @@ -0,0 +1,160 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package org.w3._2000._09.xmldsig_; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlID; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

Classe Java de SignatureType complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="SignatureType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="SignedInfo" type="{http://www.w3.org/2000/09/xmldsig#}SignedInfoType"/>
+ *         <element name="SignatureValue" type="{http://www.w3.org/2000/09/xmldsig#}SignatureValueType"/>
+ *         <element name="KeyInfo" type="{http://www.w3.org/2000/09/xmldsig#}KeyInfoType"/>
+ *       </sequence>
+ *       <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SignatureType", propOrder = { + "signedInfo", + "signatureValue", + "keyInfo" +}) +public class SignatureType { + + @XmlElement(name = "SignedInfo", required = true) + protected SignedInfoType signedInfo; + @XmlElement(name = "SignatureValue", required = true) + protected SignatureValueType signatureValue; + @XmlElement(name = "KeyInfo", required = true) + protected KeyInfoType keyInfo; + @XmlAttribute(name = "Id") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlID + @XmlSchemaType(name = "ID") + protected String id; + + /** + * Obtém o valor da propriedade signedInfo. + * + * @return + * possible object is + * {@link SignedInfoType } + * + */ + public SignedInfoType getSignedInfo() { + return signedInfo; + } + + /** + * Define o valor da propriedade signedInfo. + * + * @param value + * allowed object is + * {@link SignedInfoType } + * + */ + public void setSignedInfo(SignedInfoType value) { + this.signedInfo = value; + } + + /** + * Obtém o valor da propriedade signatureValue. + * + * @return + * possible object is + * {@link SignatureValueType } + * + */ + public SignatureValueType getSignatureValue() { + return signatureValue; + } + + /** + * Define o valor da propriedade signatureValue. + * + * @param value + * allowed object is + * {@link SignatureValueType } + * + */ + public void setSignatureValue(SignatureValueType value) { + this.signatureValue = value; + } + + /** + * Obtém o valor da propriedade keyInfo. + * + * @return + * possible object is + * {@link KeyInfoType } + * + */ + public KeyInfoType getKeyInfo() { + return keyInfo; + } + + /** + * Define o valor da propriedade keyInfo. + * + * @param value + * allowed object is + * {@link KeyInfoType } + * + */ + public void setKeyInfo(KeyInfoType value) { + this.keyInfo = value; + } + + /** + * Obtém o valor da propriedade id. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Define o valor da propriedade id. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + +} diff --git a/src/org/w3/_2000/_09/xmldsig_/SignatureValueType.java b/src/org/w3/_2000/_09/xmldsig_/SignatureValueType.java new file mode 100644 index 000000000..508c6e51b --- /dev/null +++ b/src/org/w3/_2000/_09/xmldsig_/SignatureValueType.java @@ -0,0 +1,99 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package org.w3._2000._09.xmldsig_; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlID; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlValue; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

Classe Java de SignatureValueType complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="SignatureValueType">
+ *   <simpleContent>
+ *     <extension base="<http://www.w3.org/2001/XMLSchema>base64Binary">
+ *       <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" />
+ *     </extension>
+ *   </simpleContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SignatureValueType", propOrder = { + "value" +}) +public class SignatureValueType { + + @XmlValue + protected byte[] value; + @XmlAttribute(name = "Id") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlID + @XmlSchemaType(name = "ID") + protected String id; + + /** + * Obtém o valor da propriedade value. + * + * @return + * possible object is + * byte[] + */ + public byte[] getValue() { + return value; + } + + /** + * Define o valor da propriedade value. + * + * @param value + * allowed object is + * byte[] + */ + public void setValue(byte[] value) { + this.value = value; + } + + /** + * Obtém o valor da propriedade id. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Define o valor da propriedade id. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + +} diff --git a/src/org/w3/_2000/_09/xmldsig_/SignedInfoType.java b/src/org/w3/_2000/_09/xmldsig_/SignedInfoType.java new file mode 100644 index 000000000..0b763bdf6 --- /dev/null +++ b/src/org/w3/_2000/_09/xmldsig_/SignedInfoType.java @@ -0,0 +1,288 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package org.w3._2000._09.xmldsig_; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlID; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + + +/** + *

Classe Java de SignedInfoType complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="SignedInfoType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="CanonicalizationMethod">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <attribute name="Algorithm" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" fixed="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element name="SignatureMethod">
+ *           <complexType>
+ *             <complexContent>
+ *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *                 <attribute name="Algorithm" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" fixed="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
+ *               </restriction>
+ *             </complexContent>
+ *           </complexType>
+ *         </element>
+ *         <element name="Reference" type="{http://www.w3.org/2000/09/xmldsig#}ReferenceType"/>
+ *       </sequence>
+ *       <attribute name="Id" type="{http://www.w3.org/2001/XMLSchema}ID" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "SignedInfoType", propOrder = { + "canonicalizationMethod", + "signatureMethod", + "reference" +}) +public class SignedInfoType { + + @XmlElement(name = "CanonicalizationMethod", required = true) + protected SignedInfoType.CanonicalizationMethod canonicalizationMethod; + @XmlElement(name = "SignatureMethod", required = true) + protected SignedInfoType.SignatureMethod signatureMethod; + @XmlElement(name = "Reference", required = true) + protected ReferenceType reference; + @XmlAttribute(name = "Id") + @XmlJavaTypeAdapter(CollapsedStringAdapter.class) + @XmlID + @XmlSchemaType(name = "ID") + protected String id; + + /** + * Obtém o valor da propriedade canonicalizationMethod. + * + * @return + * possible object is + * {@link SignedInfoType.CanonicalizationMethod } + * + */ + public SignedInfoType.CanonicalizationMethod getCanonicalizationMethod() { + return canonicalizationMethod; + } + + /** + * Define o valor da propriedade canonicalizationMethod. + * + * @param value + * allowed object is + * {@link SignedInfoType.CanonicalizationMethod } + * + */ + public void setCanonicalizationMethod(SignedInfoType.CanonicalizationMethod value) { + this.canonicalizationMethod = value; + } + + /** + * Obtém o valor da propriedade signatureMethod. + * + * @return + * possible object is + * {@link SignedInfoType.SignatureMethod } + * + */ + public SignedInfoType.SignatureMethod getSignatureMethod() { + return signatureMethod; + } + + /** + * Define o valor da propriedade signatureMethod. + * + * @param value + * allowed object is + * {@link SignedInfoType.SignatureMethod } + * + */ + public void setSignatureMethod(SignedInfoType.SignatureMethod value) { + this.signatureMethod = value; + } + + /** + * Obtém o valor da propriedade reference. + * + * @return + * possible object is + * {@link ReferenceType } + * + */ + public ReferenceType getReference() { + return reference; + } + + /** + * Define o valor da propriedade reference. + * + * @param value + * allowed object is + * {@link ReferenceType } + * + */ + public void setReference(ReferenceType value) { + this.reference = value; + } + + /** + * Obtém o valor da propriedade id. + * + * @return + * possible object is + * {@link String } + * + */ + public String getId() { + return id; + } + + /** + * Define o valor da propriedade id. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setId(String value) { + this.id = value; + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <attribute name="Algorithm" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" fixed="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "") + public static class CanonicalizationMethod { + + @XmlAttribute(name = "Algorithm", required = true) + @XmlSchemaType(name = "anyURI") + protected String algorithm; + + /** + * Obtém o valor da propriedade algorithm. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAlgorithm() { + if (algorithm == null) { + return "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; + } else { + return algorithm; + } + } + + /** + * Define o valor da propriedade algorithm. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAlgorithm(String value) { + this.algorithm = value; + } + + } + + + /** + *

Classe Java de anonymous complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+     * <complexType>
+     *   <complexContent>
+     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+     *       <attribute name="Algorithm" use="required" type="{http://www.w3.org/2001/XMLSchema}anyURI" fixed="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
+     *     </restriction>
+     *   </complexContent>
+     * </complexType>
+     * 
+ * + * + */ + @XmlAccessorType(XmlAccessType.FIELD) + @XmlType(name = "") + public static class SignatureMethod { + + @XmlAttribute(name = "Algorithm", required = true) + @XmlSchemaType(name = "anyURI") + protected String algorithm; + + /** + * Obtém o valor da propriedade algorithm. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAlgorithm() { + if (algorithm == null) { + return "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; + } else { + return algorithm; + } + } + + /** + * Define o valor da propriedade algorithm. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAlgorithm(String value) { + this.algorithm = value; + } + + } + +} diff --git a/src/org/w3/_2000/_09/xmldsig_/TransformType.java b/src/org/w3/_2000/_09/xmldsig_/TransformType.java new file mode 100644 index 000000000..65c232eb1 --- /dev/null +++ b/src/org/w3/_2000/_09/xmldsig_/TransformType.java @@ -0,0 +1,104 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package org.w3._2000._09.xmldsig_; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Classe Java de TransformType complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TransformType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence maxOccurs="unbounded" minOccurs="0">
+ *         <element name="XPath" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *       </sequence>
+ *       <attribute name="Algorithm" use="required" type="{http://www.w3.org/2000/09/xmldsig#}TTransformURI" />
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TransformType", propOrder = { + "xPath" +}) +public class TransformType { + + @XmlElement(name = "XPath") + protected List xPath; + @XmlAttribute(name = "Algorithm", required = true) + protected String algorithm; + + /** + * Gets the value of the xPath property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the xPath property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getXPath().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link String } + * + * + */ + public List getXPath() { + if (xPath == null) { + xPath = new ArrayList(); + } + return this.xPath; + } + + /** + * Obtém o valor da propriedade algorithm. + * + * @return + * possible object is + * {@link String } + * + */ + public String getAlgorithm() { + return algorithm; + } + + /** + * Define o valor da propriedade algorithm. + * + * @param value + * allowed object is + * {@link String } + * + */ + public void setAlgorithm(String value) { + this.algorithm = value; + } + +} diff --git a/src/org/w3/_2000/_09/xmldsig_/TransformsType.java b/src/org/w3/_2000/_09/xmldsig_/TransformsType.java new file mode 100644 index 000000000..4873a4603 --- /dev/null +++ b/src/org/w3/_2000/_09/xmldsig_/TransformsType.java @@ -0,0 +1,76 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package org.w3._2000._09.xmldsig_; + +import java.util.ArrayList; +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Classe Java de TransformsType complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="TransformsType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="Transform" type="{http://www.w3.org/2000/09/xmldsig#}TransformType" maxOccurs="2" minOccurs="2"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "TransformsType", propOrder = { + "transform" +}) +public class TransformsType { + + @XmlElement(name = "Transform", required = true) + protected List transform; + + /** + * Gets the value of the transform property. + * + *

+ * This accessor method returns a reference to the live list, + * not a snapshot. Therefore any modification you make to the + * returned list will be present inside the JAXB object. + * This is why there is not a set method for the transform property. + * + *

+ * For example, to add a new item, do as follows: + *

+     *    getTransform().add(newItem);
+     * 
+ * + * + *

+ * Objects of the following type(s) are allowed in the list + * {@link TransformType } + * + * + */ + public List getTransform() { + if (transform == null) { + transform = new ArrayList(); + } + return this.transform; + } + +} diff --git a/src/org/w3/_2000/_09/xmldsig_/X509DataType.java b/src/org/w3/_2000/_09/xmldsig_/X509DataType.java new file mode 100644 index 000000000..7bbcf11f6 --- /dev/null +++ b/src/org/w3/_2000/_09/xmldsig_/X509DataType.java @@ -0,0 +1,67 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + + +package org.w3._2000._09.xmldsig_; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Classe Java de X509DataType complex type. + * + *

O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe. + * + *

+ * <complexType name="X509DataType">
+ *   <complexContent>
+ *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       <sequence>
+ *         <element name="X509Certificate" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
+ *       </sequence>
+ *     </restriction>
+ *   </complexContent>
+ * </complexType>
+ * 
+ * + * + */ +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "X509DataType", propOrder = { + "x509Certificate" +}) +public class X509DataType { + + @XmlElement(name = "X509Certificate", required = true) + protected byte[] x509Certificate; + + /** + * Obtém o valor da propriedade x509Certificate. + * + * @return + * possible object is + * byte[] + */ + public byte[] getX509Certificate() { + return x509Certificate; + } + + /** + * Define o valor da propriedade x509Certificate. + * + * @param value + * allowed object is + * byte[] + */ + public void setX509Certificate(byte[] value) { + this.x509Certificate = value; + } + +} diff --git a/src/org/w3/_2000/_09/xmldsig_/package-info.java b/src/org/w3/_2000/_09/xmldsig_/package-info.java new file mode 100644 index 000000000..a5ab1cf5c --- /dev/null +++ b/src/org/w3/_2000/_09/xmldsig_/package-info.java @@ -0,0 +1,9 @@ +// +// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802 +// Consulte http://java.sun.com/xml/jaxb +// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem. +// Gerado em: 2017.08.14 às 03:08:29 PM BRT +// + +//@javax.xml.bind.annotation.XmlSchema(namespace = "http://www.w3.org/2000/09/xmldsig#", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) +package org.w3._2000._09.xmldsig_; From 402401b320c0f6c5e7d2ab48743c92a10a4109ea Mon Sep 17 00:00:00 2001 From: fabiorj Date: Wed, 8 Dec 2021 18:57:20 -0300 Subject: [PATCH 02/34] ajuste para build --- .gitignore | 1 + pom.xml | 80 ++++++++++++------- .../routing/MultipleDataSource.java | 6 ++ 3 files changed, 56 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 7bf83a321..862cfbfe9 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ /.settings/org.eclipse.wst.validation.prefs /.settings/org.hibernate.eclipse.console.prefs /.settings/org.jboss.ide.eclipse.as.core.prefs +/target/ diff --git a/pom.xml b/pom.xml index a87f9c476..7613af840 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,31 @@ 4.0.0 br.com.rjconsultores modelWeb - 0.0.1-SNAPSHOT + 1.0.0 + + + src + + + src + + **/*.java + + + + + + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + ISO-8859-1 + + + + + br.com.rjconsultores @@ -202,6 +226,12 @@ org.apache.poi poi-ooxml 3.8 + + + stax + stax-api + + org.apache.poi @@ -223,6 +253,12 @@ org.codehaus.jettison jettison 1.0.1 + + + stax + stax-api + + net.sourceforge.jexcelapi @@ -237,12 +273,12 @@ br.com.rjconsultores GeneradorBoletosCNAB - 0.0.1-SNAPSHOT + 1.0.0 br.com.rjconsultores WSTotvs - 0.0.1-SNAPSHOT + 1.0.0 org.eclipse.tycho @@ -253,7 +289,7 @@ br.com.rjconsultores WSAG - 0.0.1-SNAPSHOT + 1.0.0 org.aspectj @@ -281,6 +317,14 @@ xml-apis 1.0.b2 + + + javax.xml.ws + jaxws-api + 2.3.1 + + + org.hibernate hibernate-core @@ -296,11 +340,7 @@ httpcore 4.1.2 - - stax - stax-api - 1.0.1 - + org.jboss.logging jboss-logging @@ -323,28 +363,6 @@ 4.3.1 - - src - - - src - - **/*.java - - - - - - maven-compiler-plugin - 3.3 - - 1.6 - 1.6 - Cp1252 - - - - \ No newline at end of file diff --git a/src/com/rjconsultores/routing/MultipleDataSource.java b/src/com/rjconsultores/routing/MultipleDataSource.java index 4c7e4f016..0d21b5909 100644 --- a/src/com/rjconsultores/routing/MultipleDataSource.java +++ b/src/com/rjconsultores/routing/MultipleDataSource.java @@ -1,5 +1,7 @@ package com.rjconsultores.routing; +import java.sql.SQLFeatureNotSupportedException; +import java.util.logging.Logger; import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; public class MultipleDataSource extends AbstractRoutingDataSource { @@ -7,4 +9,8 @@ public class MultipleDataSource extends AbstractRoutingDataSource { protected Object determineCurrentLookupKey() { return DynamicDataSourceHolder.getRouteKey(); } + + public Logger getParentLogger() throws SQLFeatureNotSupportedException{ + return null; + } } From 0e429dcb6b7f7314604739be8a2bddecd627e4c0 Mon Sep 17 00:00:00 2001 From: fabiorj Date: Fri, 10 Dec 2021 12:27:15 -0300 Subject: [PATCH 03/34] ajustes de projeto para build --- pom.xml | 253 +++++++------------------------------------------------- 1 file changed, 30 insertions(+), 223 deletions(-) diff --git a/pom.xml b/pom.xml index 7613af840..d6d978782 100644 --- a/pom.xml +++ b/pom.xml @@ -34,194 +34,67 @@ brazilutils 0.1.1 - - commons-codec - commons-codec - 1.3 - - - commons-io - commons-io - 1.3.1 - + commons-lang commons-lang 2.2 - - jdbc - jdbc-stdext - 2.0 - - - log4j - log4j - 1.2.16 - - - br.com.rjconsultores - ojdbc14 - 1.0 - provided - - - org.slf4j - slf4j-api - 1.6.1 - - - org.springframework - spring-beans - 3.0.6.RELEASE - - - org.springframework - spring-context - 3.0.6.RELEASE - - - org.springframework - spring-core - 3.0.6.RELEASE - - - org.springframework - spring-jdbc - 3.0.6.RELEASE - + org.springframework spring-orm 3.0.6.RELEASE - - org.springframework - spring-transaction - 3.0.6.RELEASE - + org.springframework spring-web 3.0.6.RELEASE - - org.springframework.security - spring-security-config - 3.0.7.RELEASE - runtime - + org.springframework.security spring-security-core 3.0.7.RELEASE - - org.springframework.security - spring-security-ldap - 3.0.7.RELEASE - runtime - - - org.springframework.security - spring-security-taglibs - 3.0.7.RELEASE - runtime - - - org.springframework.security - spring-security-web - 3.0.7.RELEASE - runtime - - - org.zkoss.common - zcommon - 5.0.9 - + org.zkoss.zk zkplus 5.0.9 + org.zkoss.zk zul 5.0.9 - - com.lowagie - itext - 2.1.7 - - - net.sf.jasperreports - jasperreports - 5.1.0 - + net.sf.jasperreports jasperreports-javaflow 5.1.0 - - net.sf.jasperreports - jasperreports-fonts - 5.1.0 - - - commons-digester - commons-digester - 1.7 - - - com.google.code.maven-play-plugin.org.apache.commons - commons-javaflow - 20060411 - - - org.hibernate - hibernate-validator-legacy - 4.0.2.GA - runtime - - - - hibernate-commons-annotations - - org.hibernate - - - hibernate-core - org.hibernate - - - slf4j-api - org.slf4j - - - - - org.hibernate.javax.persistence - hibernate-jpa-2.0-api - 1.0.1.Final - + commons-dbutils commons-dbutils 1.6 + com.google.code.gson gson - 2.3.1 + 2.8.9 - + commons-collections commons-collections 3.2.1 + org.apache.poi poi-ooxml @@ -233,22 +106,19 @@ - - org.apache.poi - poi - 3.8 - + org.json json 20140107 + org.jboss.resteasy - jaxrs-api - 2.3.1.GA - provided + resteasy-jaxrs + 3.15.3.Final + org.codehaus.jettison jettison @@ -260,108 +130,45 @@ - - net.sourceforge.jexcelapi - jxl - 1.0.0 - + com.sun.mail javax.mail 1.4.4 + br.com.rjconsultores GeneradorBoletosCNAB 1.0.0 + br.com.rjconsultores WSTotvs - 1.0.0 - - - org.eclipse.tycho - org.eclipse.jdt.core - - + 1.0.0 + br.com.rjconsultores WSAG 1.0.0 - - org.aspectj - aspectjweaver - 1.8.9 - - - org.jboss.spec.javax.servlet - jboss-servlet-api_3.0_spec - 1.0.0.Final - provided - - - javax.xml.bind - jaxb-api - 2.2.12 - - - javax.activation - activation - 1.1 - - - xml-apis - xml-apis - 1.0.b2 - - - javax.xml.ws - jaxws-api - 2.3.1 - - - - - org.hibernate - hibernate-core - 3.6.6.Final - - - org.apache.httpcomponents - httpclient - 4.1.2 - - - org.apache.httpcomponents - httpcore - 4.1.2 - - - - org.jboss.logging - jboss-logging - 3.0.0.GA - br.com.rjconsultores Auditador - 0.0.1-SNAPSHOT - - - commons-lang - commons-lang - - + 1.0.0 + - org.eclipse.jdt.core.compiler - ecj - 4.3.1 + javax.servlet + javax.servlet-api + 3.1.0 + provided + + From e77c5a05e324cdf8f459e1c406181d554afa92ac Mon Sep 17 00:00:00 2001 From: fabiorj Date: Sat, 18 Dec 2021 23:13:45 -0300 Subject: [PATCH 04/34] =?UTF-8?q?corre=C3=A7=C3=A3o=20de=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pom.xml b/pom.xml index d6d978782..cb19f2f5b 100644 --- a/pom.xml +++ b/pom.xml @@ -58,6 +58,18 @@ spring-security-core 3.0.7.RELEASE + + + org.springframework.security + spring-security-web + 3.0.7.RELEASE + + + + org.springframework.security + spring-security-config + 3.0.7.RELEASE + org.zkoss.zk From 884b68ce883196a0ec76fc433a1aa80b2bdf6e23 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Sat, 19 Mar 2022 10:52:06 -0300 Subject: [PATCH 05/34] envio para o nexus --- pom.xml | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index cb19f2f5b..dff4bcbc9 100644 --- a/pom.xml +++ b/pom.xml @@ -5,27 +5,41 @@ modelWeb 1.0.0 + + 1.8 + 1.8 + 1.8 + ISO-8859-1 + + + + + rj-releases + http://52.5.53.15:8081/nexus/content/repositories/releases/ + + + - src - - - src - - **/*.java - - - - maven-compiler-plugin + org.apache.maven.plugins + maven-release-plugin 3.8.1 - 1.8 - 1.8 - ISO-8859-1 + @{project.version} + + + + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.9.1 + + + From c362d498955316f682aea8e40c3de2cfbad450b9 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Sat, 19 Mar 2022 13:46:51 -0300 Subject: [PATCH 06/34] ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 862cfbfe9..6a5b94952 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /.settings/org.hibernate.eclipse.console.prefs /.settings/org.jboss.ide.eclipse.as.core.prefs /target/ +/.settings/ From 9e694510cea624d3843162f26dd660adac3d0fda Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Mon, 28 Mar 2022 19:53:47 -0300 Subject: [PATCH 07/34] =?UTF-8?q?RollBack=20para=20corre=C3=A7=C3=A3o=20do?= =?UTF-8?q?=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - pom.xml | 40 ++++------- .../dao/RemessaCNABBancosDAO.java | 5 ++ .../RemessaCNABBancosHibernateDAO.java | 67 +++++++++++++++++++ .../entidad/FechamentoBoleto.java | 17 +++++ 5 files changed, 102 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index 6a5b94952..862cfbfe9 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,3 @@ /.settings/org.hibernate.eclipse.console.prefs /.settings/org.jboss.ide.eclipse.as.core.prefs /target/ -/.settings/ diff --git a/pom.xml b/pom.xml index dff4bcbc9..cb19f2f5b 100644 --- a/pom.xml +++ b/pom.xml @@ -5,41 +5,27 @@ modelWeb 1.0.0 - - 1.8 - 1.8 - 1.8 - ISO-8859-1 - - - - - rj-releases - http://52.5.53.15:8081/nexus/content/repositories/releases/ - - - + src + + + src + + **/*.java + + + - org.apache.maven.plugins - maven-release-plugin + maven-compiler-plugin 3.8.1 - @{project.version} + 1.8 + 1.8 + ISO-8859-1 - - - - - org.sonarsource.scanner.maven - sonar-maven-plugin - 3.9.1 - - - diff --git a/src/com/rjconsultores/ventaboletos/dao/RemessaCNABBancosDAO.java b/src/com/rjconsultores/ventaboletos/dao/RemessaCNABBancosDAO.java index 6f63ac944..0002cb4b2 100644 --- a/src/com/rjconsultores/ventaboletos/dao/RemessaCNABBancosDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/RemessaCNABBancosDAO.java @@ -1,5 +1,6 @@ package com.rjconsultores.ventaboletos.dao; +import java.sql.SQLException; import java.util.Date; import java.util.List; @@ -30,4 +31,8 @@ public interface RemessaCNABBancosDAO extends GenericDAO public List getEmpresas(); public Boolean atualizaRemessa(Empresa empresa, ArquivoRemessa arquivoRemessa) throws Exception; + + public FechamentoBoleto obtenerFechamentoBoletoPorNossoNumero(String nossoNumero, Integer empresaId); + + public boolean quitarFechamentoBoleto(Long fechamentoboletoId, Integer usuarioId) throws SQLException; } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java index 8b9f16ae2..b7cc39179 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java @@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.dao.hibernate; import java.math.BigDecimal; import java.math.RoundingMode; import java.sql.Connection; +import java.sql.SQLException; import java.sql.Statement; import java.text.DateFormat; import java.text.DecimalFormat; @@ -15,6 +16,11 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.hibernate.Query; import org.hibernate.SessionFactory; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.BooleanType; +import org.hibernate.type.IntegerType; +import org.hibernate.type.LongType; +import org.hibernate.type.StringType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Repository; @@ -1677,5 +1683,66 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO Date: Mon, 28 Mar 2022 19:57:49 -0300 Subject: [PATCH 08/34] =?UTF-8?q?RollBack=20para=20corre=C3=A7=C3=A3o=20do?= =?UTF-8?q?=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ImportacaoRetornoBancarioService.java | 14 ++ .../ImportacaoRetornoBancarioServiceImpl.java | 162 ++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 src/com/rjconsultores/ventaboletos/service/ImportacaoRetornoBancarioService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java diff --git a/src/com/rjconsultores/ventaboletos/service/ImportacaoRetornoBancarioService.java b/src/com/rjconsultores/ventaboletos/service/ImportacaoRetornoBancarioService.java new file mode 100644 index 000000000..3755f67f8 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ImportacaoRetornoBancarioService.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.service; + + +import java.io.ByteArrayInputStream; + +import com.rjconsultores.ventaboletos.blocos.DetalheRetorno; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +public interface ImportacaoRetornoBancarioService { + public String lerArquivo(ByteArrayInputStream bais, Empresa empresa); + + public boolean salvarRetornoBancario(DetalheRetorno detalhe, Integer empresaId, Integer usuarioId) throws Exception; + +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java new file mode 100644 index 000000000..1316abf6c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java @@ -0,0 +1,162 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.sql.SQLException; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.ArquivoRetornoItem; +import com.rjconsultores.ventaboletos.blocos.CabecalhoRetorno; +import com.rjconsultores.ventaboletos.blocos.DetalheRetorno; +import com.rjconsultores.ventaboletos.blocos.itau.DetalheRetornoItau; +import com.rjconsultores.ventaboletos.dao.RemessaCNABBancosDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoBoleto; +import com.rjconsultores.ventaboletos.enuns.BancoLayout; +import com.rjconsultores.ventaboletos.service.ImportacaoRetornoBancarioService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("importacaoRetornoBancarioService") +public class ImportacaoRetornoBancarioServiceImpl implements ImportacaoRetornoBancarioService { + + @Autowired + private RemessaCNABBancosDAO remessaCNABBancosDAO; + + private static Logger log = Logger.getLogger(ImportacaoRetornoBancarioServiceImpl.class); + + @Override + public String lerArquivo(ByteArrayInputStream bais, Empresa empresa){ + + StringBuilder resultado = new StringBuilder(); + StringBuilder detalhado = new StringBuilder(); + Integer usuarioId = UsuarioLogado.getUsuarioLogado().getUsuarioId(); + + Integer atualizados = 0; + Integer erros = 0; + + try { + BancoLayout banco = BancoLayout.getInstanceByCodBanco(remessaCNABBancosDAO.findBanco(empresa)); + ArquivoRetornoItem retornoBancario = processaRetornoBancario(bais, empresa, banco); + + if( retornoBancario == null ) { + resultado.append("O banco cadastrado para a empresa não tem implementação de retorno bancário"); + return resultado.toString(); + } + + if(!banco.getCodBanco().equals(retornoBancario.getCabecalhoRetorno().getCodigoBanco())) { + resultado.append("O banco cadastrado para a empresa não é o mesmo do arquivo selecionado"); + return resultado.toString(); + } + + for (DetalheRetorno detalhe : retornoBancario.getTitulos()) { + try { + if( salvarRetornoBancario( detalhe, empresa.getEmpresaId(), usuarioId )) { + atualizados++; + detalhado.append("Quitado:").append(detalhe.getNossoNumero()).append(".\n"); + }else { + erros++; + detalhado.append("Nao Quitado: ").append(detalhe.getNossoNumero()).append(".\n"); + } + } catch (SQLException se) { + detalhado.append("Ocorreu um erro no banco de dados: ").append(detalhe.getNossoNumero()); + log.error(se); + erros++; + } catch (RuntimeException re) { + detalhado.append(re.getMessage()); + log.error(re); + erros++; + } + } + + resultado.append("Arquivo Processado "); + if(erros > 0) { + resultado.append("com ressalvas.\n"); + }else { + resultado.append("com sucesso. \n"); + } + resultado.append("Quitados ").append(atualizados).append(".\n"); + resultado.append("Nao Quitados ").append(erros).append(".\n"); + resultado.append(detalhado); + return resultado.toString(); + + } catch (IOException ioe) { + resultado.append("Ocorreu um erro ao processar o arquivo enviado"); + log.error(ioe); + return resultado.toString(); + } catch (Exception e) { + resultado.append("Ocorreu um erro ao processar o arquivo enviado"); + log.error(e); + return resultado.toString(); + } + } + + private ArquivoRetornoItem processaRetornoBancario(ByteArrayInputStream bais, Empresa empresa, BancoLayout banco) throws IOException{ + + if(BancoLayout.ITAU_400_Envio.equals(banco)){ + return geraRetornoBancarioItau(bais, empresa, banco); + }else if(BancoLayout.BB_240_Envio.equals(banco)){ + throw new RuntimeException("Retorno Bancário não implementado"); + }else if(BancoLayout.BRADESCO_400_Envio.equals(banco)){ + throw new RuntimeException("Retorno Bancário não implementado"); + }else if(BancoLayout.SANTANDER_400_Envio.equals(banco)){ + throw new RuntimeException("Retorno Bancário não implementado"); + }else { + throw new RuntimeException("Retorno Bancário não implementado"); + } + } + + private ArquivoRetornoItem geraRetornoBancarioItau(ByteArrayInputStream bais, Empresa empresa, BancoLayout banco) throws IOException { + String linha = null; + ArquivoRetornoItem arquivo = new ArquivoRetornoItem(); + CabecalhoRetorno cabecalho = new CabecalhoRetorno(); + + BufferedReader leitor = new BufferedReader(new InputStreamReader(bais)); + + while ((linha = leitor.readLine()) != null) { + + if( linha.startsWith("0")) { //cabecalho + cabecalho.setCodigoBanco(linha.substring(76, 79)); + continue; + } + + if(linha.startsWith("1")) { //detalhe + DetalheRetornoItau detalhe = new DetalheRetornoItau(); + detalhe.setNossoNumero(linha.substring(62, 70)); + arquivo.addTitulo(detalhe); + continue; + } + + if(linha.startsWith("9")) { //rodape + + } + } + + leitor.close(); + + arquivo.setCabecalhoRetorno(cabecalho); + + return arquivo; + } + + @Override + public boolean salvarRetornoBancario(DetalheRetorno detalhe, Integer empresaId, Integer usuarioId) throws SQLException { + FechamentoBoleto boleto = remessaCNABBancosDAO.obtenerFechamentoBoletoPorNossoNumero( detalhe.getNossoNumero(), empresaId ); + + if(boleto == null) { + throw new RuntimeException("Fechamento não encontrado para a empresa com o nosso numero: "+detalhe.getNossoNumero()+"\n"); + } + + if( boleto.getIndBoletoQuitado() !=null && boleto.getIndBoletoQuitado()) { + throw new RuntimeException("Boleto já quitado para a empresa com o nosso numero: "+detalhe.getNossoNumero()+"\n"); + } + + return remessaCNABBancosDAO.quitarFechamentoBoleto( boleto.getFechamentoboletoId(), usuarioId ); + + } + +} From 3f5260e94c70466915e844812922d235217ac4a3 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 13 Apr 2022 13:46:27 -0300 Subject: [PATCH 09/34] reenvio pro nexus --- pom.xml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index cb19f2f5b..8ea869bc4 100644 --- a/pom.xml +++ b/pom.xml @@ -5,16 +5,15 @@ modelWeb 1.0.0 + + + rj-releases + http://52.5.53.15:8081/nexus/content/repositories/releases/ + + + - src - - - src - - **/*.java - - - + src maven-compiler-plugin From 52dc7cf13be24147bfb22c671551eff514b8a178 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Tue, 17 May 2022 12:13:08 -0300 Subject: [PATCH 10/34] =?UTF-8?q?modifica=C3=A7=C3=A3o=20para=20JAVA=208?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 862cfbfe9..6a5b94952 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /.settings/org.hibernate.eclipse.console.prefs /.settings/org.jboss.ide.eclipse.as.core.prefs /target/ +/.settings/ From c1de02c0f9951ec803b3041402206591c799115e Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Tue, 17 May 2022 18:08:41 -0300 Subject: [PATCH 11/34] =?UTF-8?q?sincroniza=C3=A7=C3=A3o=20com=20trunk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../routing/MultipleDataSource.java | 8 +- .../constantes/TipoEventoExtra.java | 6 +- .../ventaboletos/dao/ConexionDAO.java | 2 +- .../dao/ConexionRutaTramoCtrlDAO.java | 2 +- .../ventaboletos/dao/CtrlSerieBPeDAO.java | 1 + .../ventaboletos/dao/ParadaDAO.java | 4 + .../ventaboletos/dao/SapDAO.java | 2 +- .../CategoriaDescuentoHibernateDAO.java | 9 +- .../dao/hibernate/ConexionHibernateDAO.java | 114 +++++++-- .../ConexionRutaTramoCtrlHibernateDAO.java | 5 +- .../dao/hibernate/CorridaHibernateDAO.java | 23 +- .../hibernate/CtrlSerieBPeHibernateDAO.java | 29 +++ .../dao/hibernate/ParadaHibernateDAO.java | 13 + .../RelatorioAgepanHibernateDAO.java | 6 +- .../RemessaCNABBancosHibernateDAO.java | 18 +- .../dao/hibernate/SapHibernateDAO.java | 15 +- .../entidad/AliquotaEstadoDestino.java | 32 ++- .../ventaboletos/entidad/Categoria.java | 3 + .../CategoriaBloqueioImpPosterior.java | 33 ++- .../ventaboletos/entidad/CategoriaOrgao.java | 35 ++- .../ventaboletos/entidad/ClaseServicio.java | 17 ++ .../entidad/CobrancaAdcPuntoVenta.java | 33 ++- .../entidad/CoeficienteTarifa.java | 29 ++- .../ventaboletos/entidad/Empresa.java | 45 +++- .../ventaboletos/entidad/EmpresaImposto.java | 30 ++- .../ventaboletos/entidad/EsquemaCorrida.java | 25 ++ .../entidad/FechamentoParamptovta.java | 24 +- .../ventaboletos/entidad/FormaPago.java | 32 ++- .../ventaboletos/entidad/FormaPagoDet.java | 31 ++- .../entidad/HistoricoPuntoVenta.java | 33 ++- .../ventaboletos/entidad/OCDParam.java | 11 + .../entidad/OrgaoCancelacion.java | 30 ++- .../ventaboletos/entidad/OrgaoConcedente.java | 62 ++++- .../ventaboletos/entidad/OrgaoEmpParam.java | 30 ++- .../ventaboletos/entidad/Parada.java | 36 ++- .../entidad/ParamRecoleccion.java | 33 ++- .../ventaboletos/entidad/PtoVtaCheckin.java | 32 ++- .../ventaboletos/entidad/PtoVtaSeguro.java | 34 ++- .../entidad/PtoVtaUsuarioBancario.java | 32 ++- .../entidad/PtovtaAntecipacomissao.java | 35 ++- .../entidad/PtovtaAntifraude.java | 33 ++- .../ventaboletos/entidad/PtovtaCatInd.java | 32 ++- .../ventaboletos/entidad/PtovtaComissao.java | 63 ++++- .../ventaboletos/entidad/PtovtaEmpresa.java | 33 ++- .../entidad/PtovtaEmpresaBloqueada.java | 32 ++- .../ventaboletos/entidad/PtovtaEstoque.java | 37 ++- .../ventaboletos/entidad/PtovtaHorario.java | 36 ++- .../ventaboletos/entidad/PtovtaTitular.java | 55 ++++- .../ventaboletos/entidad/PuntoVenta.java | 79 +++++- .../entidad/ReservacionPuntoVenta.java | 224 ++++++++++-------- .../ventaboletos/entidad/Ruta.java | 82 ++++--- .../entidad/RutaIcmsExcepcion.java | 11 + .../ventaboletos/enums/TipoFormapago.java | 4 +- .../ventaboletos/service/BoletoService.java | 7 +- .../service/CategoriaCtrlService.java | 2 +- .../service/ConexionRutaTramoCtrlService.java | 6 +- .../ventaboletos/service/ConexionService.java | 2 +- .../service/ConstanteService.java | 2 + .../ventaboletos/service/ParadaService.java | 3 + .../service/impl/BoletoServiceImpl.java | 50 +++- .../impl/CategoriaCtrlServiceImpl.java | 20 +- .../impl/CoeficienteTarifaServiceImpl.java | 52 +++- .../ConexionRutaCombinacionServiceImpl.java | 19 ++ .../ConexionRutaTramoCtrlServiceImpl.java | 41 +++- .../service/impl/ConexionServiceImpl.java | 4 +- .../impl/ConferenciaComissaoServiceImpl.java | 2 +- .../service/impl/ConstanteServiceImpl.java | 11 + .../ControleSerieEmbarcadaServiceImpl.java | 17 +- .../service/impl/CorridaServiceImpl.java | 15 +- .../service/impl/EmpresaServiceImpl.java | 28 ++- .../FechamentoParamptovtaServiceImpl.java | 33 ++- .../service/impl/FormaPagoServiceImpl.java | 54 ++++- .../ImportacaoClientesSrvpServiceImpl.java | 17 +- .../ImportacaoRetornoBancarioServiceImpl.java | 10 +- .../impl/OrgaoConcedenteServiceImpl.java | 42 +++- .../service/impl/ParadaServiceImpl.java | 5 + .../impl/PtovtaComissaoServiceImpl.java | 40 +++- .../impl/PtovtaTitularServiceImpl.java | 10 +- .../service/impl/PuntoVentaServiceImpl.java | 30 ++- .../service/impl/RutaServiceImpl.java | 57 ++++- .../service/impl/SapServiceImpl.java | 31 ++- .../service/impl/TramoRutaServiceImpl.java | 33 ++- .../service/impl/UsuarioServiceImpl.java | 8 +- .../ventaboletos/vo/conexion/ConexionVO.java | 10 + .../vo/esquemaoperacional/RutaTramoVO.java | 11 + .../SecuenciaRutaTramoCoeficienteVO.java | 11 + 86 files changed, 2043 insertions(+), 355 deletions(-) diff --git a/src/com/rjconsultores/routing/MultipleDataSource.java b/src/com/rjconsultores/routing/MultipleDataSource.java index 0d21b5909..1837e1598 100644 --- a/src/com/rjconsultores/routing/MultipleDataSource.java +++ b/src/com/rjconsultores/routing/MultipleDataSource.java @@ -1,7 +1,7 @@ package com.rjconsultores.routing; -import java.sql.SQLFeatureNotSupportedException; import java.util.logging.Logger; + import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; public class MultipleDataSource extends AbstractRoutingDataSource { @@ -9,8 +9,8 @@ public class MultipleDataSource extends AbstractRoutingDataSource { protected Object determineCurrentLookupKey() { return DynamicDataSourceHolder.getRouteKey(); } - - public Logger getParentLogger() throws SQLFeatureNotSupportedException{ - return null; + + public Logger getParentLogger(){ + return Logger.getLogger("MultipleDataSource"); } } diff --git a/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java b/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java index 3915ce346..5bd2fdc6d 100644 --- a/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java +++ b/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java @@ -90,6 +90,10 @@ public enum TipoEventoExtra { public String toString() { return "TAXA_CONVENIENCIA_SVI"; } + }, + TARIFA_SAFER{ + public String toString() { + return "TARIFA_SAFER"; + } }; - } diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java index 46ad72543..5e258ac4f 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java @@ -14,7 +14,7 @@ public interface ConexionDAO extends GenericDAO { */ public void generarConexiones(Integer usuarioId); - public List buscarConexiones(Integer origenId, Integer destinoId); + public List buscarConexiones(boolean isBuscaAgrupada, Integer origenId, Integer destinoId); public List buscarPorConexionCtrl(Long conexcionCtrlId); diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java index beb70298b..772b053a2 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java @@ -18,6 +18,6 @@ public interface ConexionRutaTramoCtrlDAO extends GenericDAO buscarTodasLocalidadesDestinoC(Integer conexionRutaConfId); - public List buscarPorConexionRutaConf(Integer conexionRutaConfId, char tipo); + public List buscarLocalidadesPorConexionRutaConfAndEixo(Integer conexionRutaConfId, char tipo); } diff --git a/src/com/rjconsultores/ventaboletos/dao/CtrlSerieBPeDAO.java b/src/com/rjconsultores/ventaboletos/dao/CtrlSerieBPeDAO.java index 4000f461e..ce770cc26 100644 --- a/src/com/rjconsultores/ventaboletos/dao/CtrlSerieBPeDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/CtrlSerieBPeDAO.java @@ -6,6 +6,7 @@ public interface CtrlSerieBPeDAO extends GenericDAO { public Boolean gerarSeqSerieBPe(Integer empresaId, String estado, Integer minvalue) throws RuntimeException; public Integer buscarSequencia(Integer empresaId, String estado); + public Integer buscarSerieEmb(Integer empresaId, String estado) throws RuntimeException; public CtrlSerieBPe buscarPorEmpresaEstado(Integer empresaId, Integer estadoId); diff --git a/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java index fd0dfc5ed..fc73b1f36 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java @@ -4,6 +4,7 @@ */ package com.rjconsultores.ventaboletos.dao; +import com.rjconsultores.ventaboletos.entidad.AgrupamentoParada; import com.rjconsultores.ventaboletos.entidad.Ciudad; import com.rjconsultores.ventaboletos.entidad.Nodo; import com.rjconsultores.ventaboletos.entidad.Parada; @@ -56,4 +57,7 @@ public interface ParadaDAO { public List buscarListaPorIds(List paradaIds); public Parada buscarPorId(Integer paradaId); + + public List buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada); + } diff --git a/src/com/rjconsultores/ventaboletos/dao/SapDAO.java b/src/com/rjconsultores/ventaboletos/dao/SapDAO.java index d9f4c8454..c21e2dc3e 100644 --- a/src/com/rjconsultores/ventaboletos/dao/SapDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/SapDAO.java @@ -11,6 +11,6 @@ public interface SapDAO extends GenericDAO { public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar); - public boolean atualizaFechamento(Long fechamentocntcorrenteId) throws Exception; + public boolean atualizaFechamento(Long fechamentocntcorrenteId, int status) throws Exception; } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java index 429da6817..b66deef44 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java @@ -58,7 +58,7 @@ public class CategoriaDescuentoHibernateDAO StringBuilder sql = new StringBuilder(); - sql.append(" SELECT coalesce(cd.indnaoaplicatarifaminima, 0) as tarifa "); + sql.append(" SELECT cd.indnaoaplicatarifaminima as tarifa "); sql.append(" from categoria_descuento cd "); sql.append(" inner join categoria_ctrl cc "); sql.append(" on cc.categoriactrl_id = cd.categoriactrl_id "); @@ -66,6 +66,7 @@ public class CategoriaDescuentoHibernateDAO sql.append(" and cc.activo = 1 "); sql.append(" where cd.categoria_id = :categoriaId "); sql.append(" and cd.activo = 1 "); + sql.append(" and cd.indnaoaplicatarifaminima = 1 "); Query query = getSession().createSQLQuery(sql.toString()) .addScalar("tarifa", BooleanType.INSTANCE); @@ -73,8 +74,8 @@ public class CategoriaDescuentoHibernateDAO query.setParameter("empresaId", empresaId ); query.setParameter("categoriaId", categoriaId ); - Boolean retorno = (Boolean)query.uniqueResult(); - - return Boolean.FALSE.equals(retorno); + List retorno = (List)query.list(); + + return retorno !=null && !retorno.isEmpty() && Boolean.TRUE.equals(retorno.get(0)) ? Boolean.TRUE : Boolean.FALSE; } } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java index 924c92899..de63cb287 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java @@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.dao.hibernate; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -78,6 +79,9 @@ public class ConexionHibernateDAO extends GenericHibernateDAO conexionVO.setGrupo(((BigDecimal) oc[3]).intValue()); conexionVO.setTramoOrigen((String) oc[4]); conexionVO.setTramoDestino((String) oc[5]); + + conexionVO.setBuscaAgruapada(false); + conexionVOs.add(conexionVO); } @@ -85,11 +89,85 @@ public class ConexionHibernateDAO extends GenericHibernateDAO } @Override - public List buscarConexiones(Integer origenId, Integer destinoId) { + public List buscarConexiones(boolean isBuscaAgrupada, Integer origenId, Integer destinoId) { + + String queryStr = getQueryConexiones(origenId, destinoId); + + Query query = getSession().createSQLQuery(queryStr); + List list = query.list(); + + List vos = new ArrayList(); + for (Object[] o : list) { + ConexionVO vo = new ConexionVO(); + vo.setGrupo(((BigDecimal) o[0]).intValue()); + vo.setConexionCtrlId(((BigDecimal) o[1]).longValue()); + vo.setConOrigen((String) o[2]); + vo.setConDestino((String) o[3]); + vo.setTramoOrigen((String) o[4]); + vo.setTramoDestino((String) o[5]); + vo.setBuscaAgruapada(isBuscaAgrupada); + + vos.add(vo); + } + + if (isBuscaAgrupada) { + return agruparConexiones(vos); + } + + return vos; + } + + private List agruparConexiones(List conexiones) { + + LinkedHashMap> map = new LinkedHashMap>(); + + List agrpVo = new ArrayList(); + + String grupoTrecho = null; + Integer grupo = null; + for (ConexionVO vo : conexiones) { + + if (grupo == null) + grupo = vo.getGrupo(); + + if (!grupo.equals(vo.getGrupo())) { + if (!map.containsKey(grupoTrecho)) { + map.put(grupoTrecho, agrpVo); + } + + grupo = vo.getGrupo(); + grupoTrecho = null; + agrpVo = new ArrayList(); + } + + if (grupo.equals(vo.getGrupo())) { + + if (grupoTrecho == null) { + grupoTrecho = vo.getTramoOrigen() + ";" + vo.getTramoDestino() + ";"; + } else { + grupoTrecho += vo.getTramoOrigen() + ";" + vo.getTramoDestino() + ";"; + } + + agrpVo.add(vo); + } + + } + + List agrupados = new ArrayList(); + for (Map.Entry> entry : map.entrySet()) { + agrupados.addAll(entry.getValue()); + } + + return agrupados; + } + + private String getQueryConexiones(Integer origenId, Integer destinoId) { StringBuilder sb = new StringBuilder(); - sb.append(" select cc.conexionctrl_id as conexionCtrlId, occ.descparada as conOrigen, dcc.descparada as conDestino, "); - sb.append(" c.numgrupo as grupo, oc.descparada as tramoOrigen, dc.descparada as tramoDestino "); + sb.append(" select "); + sb.append(" c.numgrupo as grupo, "); + sb.append(" cc.conexionctrl_id as conexionCtrlId, occ.descparada as conOrigen, dcc.descparada as conDestino, "); + sb.append(" oc.descparada as tramoOrigen, dc.descparada as tramoDestino, c.numsecuencia as numsecuencia "); sb.append(" from conexion_ctrl cc "); sb.append(" inner join conexion_conf conf "); sb.append(" on conf.conexionctrl_id = cc.conexionctrl_id, "); @@ -105,31 +183,17 @@ public class ConexionHibernateDAO extends GenericHibernateDAO sb.append(" and dcc.parada_id = cc.destino_id "); sb.append(" and oc.parada_id = c.origen_id "); sb.append(" and dc.parada_id = c.destino_id "); + if (origenId != null) { - sb.append(" and cc.origen_id = ").append(origenId); + sb.append(" and cc.origen_id = ").append(origenId); } + if (destinoId != null) { - sb.append(" and cc.destino_id = ").append(destinoId); - } - sb.append(" order by occ.descparada, dcc.descparada, cc.conexionctrl_id, c.numgrupo, c.numsecuencia, oc.descparada, dc.descparada "); - - Query query = getSession().createSQLQuery(sb.toString()); - List list = query.list(); - - List vos = new ArrayList(); - for (Object[] o : list) { - ConexionVO vo = new ConexionVO(); - vo.setConexionCtrlId(((BigDecimal) o[0]).longValue()); - vo.setConOrigen((String) o[1]); - vo.setConDestino((String) o[2]); - vo.setGrupo(((BigDecimal) o[3]).intValue()); - vo.setTramoOrigen((String) o[4]); - vo.setTramoDestino((String) o[5]); - - vos.add(vo); + sb.append(" and cc.destino_id = ").append(destinoId); } - return vos; + sb.append(" order by conOrigen, conDestino, conexionCtrlId, grupo, numsecuencia, tramoOrigen, tramoDestino "); + return sb.toString(); } @Override @@ -288,10 +352,10 @@ public class ConexionHibernateDAO extends GenericHibernateDAO @Override public Conexion buscarPorConexionRutaTramoCtrl(Integer conexionRutaTramoId) { - + Criteria c = getSession().createCriteria(getPersistentClass()); c.add(Restrictions.eq("conexionRutaTramoId", conexionRutaTramoId)); - c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); return (Conexion) c.uniqueResult(); } } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java index 8accbde22..110039032 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java @@ -116,9 +116,12 @@ public class ConexionRutaTramoCtrlHibernateDAO extends GenericHibernateDAO(paradas); } + /** + *Busca localidades de acordo com o conexionRutaConfId e pelo eixo informado ('A', 'B', 'C') + */ @Override @SuppressWarnings("unchecked") - public List buscarPorConexionRutaConf(Integer conexionRutaConfId, char tipo) { + public List buscarLocalidadesPorConexionRutaConfAndEixo(Integer conexionRutaConfId, char tipo) { String filtro = ""; String join = ""; diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java index d0cd6ab95..c60e0fbec 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java @@ -450,11 +450,28 @@ public class CorridaHibernateDAO extends GenericHibernateDAO lsCorridasAux = squery.list(); if (lsCorridasAux != null && !lsCorridasAux.isEmpty()) { diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieBPeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieBPeHibernateDAO.java index ab1625bb8..c07000d23 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieBPeHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieBPeHibernateDAO.java @@ -72,6 +72,33 @@ public class CtrlSerieBPeHibernateDAO extends GenericHibernateDAO imp return (Parada) c.uniqueResult(); } + + @Override + public List buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada) { + if(agrupamentoParada !=null && agrupamentoParada.getAgrupamentoParadaId() !=null) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("agrupamentoParada", agrupamentoParada)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + return null; + } } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RelatorioAgepanHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RelatorioAgepanHibernateDAO.java index e85f3eaec..050e0d2b7 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/RelatorioAgepanHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RelatorioAgepanHibernateDAO.java @@ -22,7 +22,7 @@ import com.rjconsultores.ventaboletos.vo.OrgaoConcedente.RelatorioGratuidadeAgep @Repository("relatorioAgepanDAO") public class RelatorioAgepanHibernateDAO extends HibernateDaoSupport implements RelatorioAgepanDAO { - public static int ORGAOCONCEDENTE_ID_AGEPAN = 4; +// public static int ORGAOCONCEDENTE_ID_AGEPAN = 4; @Autowired public RelatorioAgepanHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { @@ -45,6 +45,8 @@ public class RelatorioAgepanHibernateDAO extends HibernateDaoSupport implements String tipGratuIds = parametros.get("tipGratuIds").toString(); String linhaIds = parametros.get("linhaIds").toString(); Integer empresa = parametros.get("empresa") != null ? Integer.valueOf(parametros.get("empresa").toString()) : null; + Integer orgaoConcendenteAgepanId = parametros.get("orgaoConcendenteAgepanId") != null ? Integer.valueOf(parametros.get("orgaoConcendenteAgepanId").toString()) : null; + String sQuery = getSql(fecInicioVenda, fecFinalVenda, linhaIds, tipGratuIds, empresa); @@ -73,7 +75,7 @@ public class RelatorioAgepanHibernateDAO extends HibernateDaoSupport implements .setResultTransformer(new AliasToBeanResultTransformer(RelatorioGratuidadeAgepanVO.class)); - qr.setParameter("agepanId", ORGAOCONCEDENTE_ID_AGEPAN); + qr.setParameter("agepanId", orgaoConcendenteAgepanId); qr.setParameter("fecInicioVenda", fecInicioVenda); qr.setParameter("fecFinalVenda", fecFinalVenda); if (empresa != null){ diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java index b7cc39179..728199585 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java @@ -18,7 +18,6 @@ import org.hibernate.Query; import org.hibernate.SessionFactory; import org.hibernate.transform.AliasToBeanResultTransformer; import org.hibernate.type.BooleanType; -import org.hibernate.type.IntegerType; import org.hibernate.type.LongType; import org.hibernate.type.StringType; import org.springframework.beans.factory.annotation.Autowired; @@ -723,7 +722,7 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) { @@ -64,9 +65,9 @@ public class SapHibernateDAO extends GenericHibernateDAO 1) "); + sb.append(" AND fc.indintegradosap IS NULL "); } - + sb.append(" ORDER BY "); sb.append(" pv.nombpuntoventa, fc.fecfechamento "); @@ -79,9 +80,10 @@ public class SapHibernateDAO extends GenericHibernateDAO list = query.list(); List retorno = new ArrayList(); @@ -123,7 +125,7 @@ public class SapHibernateDAO extends GenericHibernateDAO { private static final long serialVersionUID = 1L; @Id @@ -50,6 +56,11 @@ public class AliquotaEstadoDestino implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + + @Transient + @NaoAuditar + private AliquotaEstadoDestino aliquotaEstadoDestinoClone; + @Override @@ -119,5 +130,24 @@ public class AliquotaEstadoDestino implements Serializable { public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } + + @Override + public void clonar() throws CloneNotSupportedException { + aliquotaEstadoDestinoClone = new AliquotaEstadoDestino(); + aliquotaEstadoDestinoClone = (AliquotaEstadoDestino) this.clone(); + Hibernate.initialize(aliquotaEstadoDestinoClone.getEmpresaImposto()); + + } + + @Override + public AliquotaEstadoDestino getCloneObject() throws CloneNotSupportedException { + return aliquotaEstadoDestinoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + // TODO Auto-generated method stub + return null; + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/Categoria.java b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java index 4584e5ae6..584566217 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Categoria.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java @@ -29,6 +29,8 @@ import javax.persistence.TemporalType; import com.rjconsultores.ventaboletos.enums.TipoDescontoBPe; import com.rjconsultores.ventaboletos.enums.TipoDescontoMonitrip; +import br.com.rjconsultores.auditador.annotations.AuditarLista; + /** * * @author Administrador @@ -68,6 +70,7 @@ public class Categoria implements Serializable { private GrupoCategoria grupoCategoria; @OneToMany(mappedBy = "categoria", cascade = CascadeType.ALL) + @AuditarLista(auditarEntidades = true, nome = "Categoria Orgao") private List orgaosConcedentes; @Column(name = "INDCONFERENCIAFISICACOMISSAO") diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java index 56aca4b8b..6efc6f269 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java @@ -10,11 +10,19 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "CategoriaBloqueioImpPosterior", tela = "Alteração Ponto de Venda/Categoria/Bloqueio/ImpPosterior") @Entity @SequenceGenerator(name = "CAT_BLOQ_IMPPOSTERIOR_SEQ", sequenceName = "CAT_BLOQ_IMPPOSTERIOR_SEQ", allocationSize = 1) @Table(name = "CATEGORIA_BLOQ_IMPPOSTERIOR") -public class CategoriaBloqueioImpPosterior { +public class CategoriaBloqueioImpPosterior implements Auditavel { @Id @Basic(optional = false) @GeneratedValue(strategy = GenerationType.AUTO, generator = "CAT_BLOQ_IMPPOSTERIOR_SEQ") @@ -26,6 +34,11 @@ public class CategoriaBloqueioImpPosterior { @ManyToOne() @JoinColumn(name = "CATEGORIA_ID") private Categoria categoria; + + @Transient + @NaoAuditar + private CategoriaBloqueioImpPosterior categoriaBloqueioImpPosteriorClone; + public Integer getCategoriaBloqueioImpPosteriorId() { return categoriaBloqueioImpPosteriorId; } @@ -65,4 +78,22 @@ public class CategoriaBloqueioImpPosterior { } return true; } + + @Override + public void clonar() throws CloneNotSupportedException { + categoriaBloqueioImpPosteriorClone = new CategoriaBloqueioImpPosterior(); + categoriaBloqueioImpPosteriorClone = (CategoriaBloqueioImpPosterior) this.clone(); + Hibernate.initialize(categoriaBloqueioImpPosteriorClone.getPuntoventa()); + + } + + @Override + public CategoriaBloqueioImpPosterior getCloneObject() throws CloneNotSupportedException { + return categoriaBloqueioImpPosteriorClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getCategoriaBloqueioImpPosteriorId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java index 62b23c495..22a294919 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java @@ -15,11 +15,20 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarEntidade; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "CategoriaOrgao", tela = "Alteração de Categoria Orgao Concedente") @Entity @SequenceGenerator(name = "CATEGORIA_ORGAO_SEQ", sequenceName = "CATEGORIA_ORGAO_SEQ", allocationSize = 1) @Table(name = "CATEGORIA_ORGAO") -public class CategoriaOrgao implements Serializable { +public class CategoriaOrgao implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -36,10 +45,15 @@ public class CategoriaOrgao implements Serializable { private Integer usuarioId; @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") @ManyToOne + @AuditarEntidade private OrgaoConcedente orgao; @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") @ManyToOne private CategoriaCtrl categoriaCtrl; + + @Transient + @NaoAuditar + private CategoriaOrgao categoriaOrgaoClone; public CategoriaOrgao() { } @@ -130,4 +144,23 @@ public class CategoriaOrgao implements Serializable { public String toString() { return "com.rjconsultores.ventaboletos.entidad.CategoriaOrgao[categoriaorgaoId=" + categoriaorgaoId + "]"; } + + @Override + public void clonar() throws CloneNotSupportedException { + + categoriaOrgaoClone = new CategoriaOrgao(); + categoriaOrgaoClone = (CategoriaOrgao) this.clone(); + Hibernate.initialize(categoriaOrgaoClone.getOrgao()); + + } + + @Override + public CategoriaOrgao getCloneObject() throws CloneNotSupportedException { + return categoriaOrgaoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getCategoriaorgaoId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java b/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java index 3e7e8aa86..e30c0dd29 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java @@ -13,6 +13,8 @@ import java.util.List; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; @@ -24,6 +26,9 @@ import javax.persistence.Transient; import org.hibernate.annotations.GenericGenerator; +import com.rjconsultores.ventaboletos.enums.TipoClasseServicoBPe; +import com.rjconsultores.ventaboletos.enums.TipoDescontoMonitrip; + import br.com.rjconsultores.auditador.annotations.NaoAuditar; import br.com.rjconsultores.auditador.interfaces.Auditavel; @@ -77,6 +82,10 @@ public class ClaseServicio implements Serializable, Auditavel { @Column(name = "INDNAOVENDESEGUROOPCIONAL") private Boolean indNaoVendeSeguroOpcional; + + @Enumerated(EnumType.STRING) + @Column(name = "desconto_monitrip") + private TipoClasseServicoBPe tipoDescontoMonitrip; @Transient @NaoAuditar @@ -271,4 +280,12 @@ public class ClaseServicio implements Serializable, Auditavel { this.indNaoVendeSeguroOpcional = indNaoVendeSeguroOpcional; } + public TipoClasseServicoBPe getTipoDescontoMonitrip() { + return tipoDescontoMonitrip; + } + + public void setTipoDescontoMonitrip(TipoClasseServicoBPe tipoClasseServicoBPe) { + this.tipoDescontoMonitrip = tipoClasseServicoBPe; + } + } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java index 5a3dfffee..759a6004a 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java @@ -17,15 +17,23 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * @author vjcor * */ +@AuditarClasse(nome = "CobrancaAdcPuntoVenta", tela = "Alteração Cobrança de Ponto de Venda") @Entity @SequenceGenerator(name = "COBRANCA_ADC_SEQ", sequenceName = "COBRANCA_ADC_SEQ", allocationSize = 1) @Table(name = "COBRANCA_ADC_PUNTO_VENTA") -public class CobrancaAdcPuntoVenta implements Serializable { +public class CobrancaAdcPuntoVenta implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -103,6 +111,10 @@ public class CobrancaAdcPuntoVenta implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + @Transient + @NaoAuditar + private CobrancaAdcPuntoVenta cobrancaAdcPuntoVentaClone; + private Boolean getBoolean(Boolean valor) { return valor == null ? false : valor; } @@ -315,5 +327,22 @@ public class CobrancaAdcPuntoVenta implements Serializable { return this.getDescricao(); } - + @Override + public void clonar() throws CloneNotSupportedException { + + cobrancaAdcPuntoVentaClone = new CobrancaAdcPuntoVenta(); + cobrancaAdcPuntoVentaClone = (CobrancaAdcPuntoVenta) this.clone(); + Hibernate.initialize(cobrancaAdcPuntoVentaClone.getPuntoVenta()); + + } + + @Override + public CobrancaAdcPuntoVenta getCloneObject() throws CloneNotSupportedException { + return cobrancaAdcPuntoVentaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getCobrancaAddPuntoVenta_id()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java b/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java index b2240a830..74325837f 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java +++ b/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java @@ -14,11 +14,17 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "CoeficienteTarifa", tela = "Alteração de Coeficiente Tarifario") @Entity @SequenceGenerator(name = "COEFICIENTE_TARIFA_SEQ", sequenceName = "COEFICIENTE_TARIFA_SEQ", allocationSize = 1) @Table(name = "COEFICIENTE_TARIFA") -public class CoeficienteTarifa implements Serializable { +public class CoeficienteTarifa implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -37,6 +43,10 @@ public class CoeficienteTarifa implements Serializable { private Date fecmodif; @Column(name = "USUARIO_ID") private Integer usuarioId; + + @Transient + @NaoAuditar + private CoeficienteTarifa coeficienteTarifaClone; public Integer getCoeficienteId() { return coeficienteId; @@ -85,6 +95,23 @@ public class CoeficienteTarifa implements Serializable { public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } + + @Override + public CoeficienteTarifa getCloneObject() throws CloneNotSupportedException { + return coeficienteTarifaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getCoeficienteId()); + } + + @Override + public void clonar() throws CloneNotSupportedException { + coeficienteTarifaClone = new CoeficienteTarifa(); + coeficienteTarifaClone = (CoeficienteTarifa) this.clone(); + + } @Override public String toString() { diff --git a/src/com/rjconsultores/ventaboletos/entidad/Empresa.java b/src/com/rjconsultores/ventaboletos/entidad/Empresa.java index f4ae5d35f..8843eeb74 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Empresa.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Empresa.java @@ -42,7 +42,7 @@ import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Rafius - */ + */ @Entity @SequenceGenerator(name = "EMPRESA_SEQ", sequenceName = "EMPRESA_SEQ", allocationSize = 1) @@ -341,9 +341,6 @@ public class Empresa implements Serializable, Auditavel { @Column(name = "INDENVIADADOSAGENCIABPE") private Boolean indEnviaDadosAgenciaBpe; - @Column(name = "INDPRECOPORDEMANDA") - private Boolean indPrecoPorDemanda; - @Column(name = "INDRATEIOCOMISSAOGRUPOLINHA") private Boolean indRateioComissaoGrupoLinha; @@ -396,7 +393,17 @@ public class Empresa implements Serializable, Auditavel { @Column(name = "INDSEGUROOPCIONALW2DIGITAL") private Boolean indSeguroOpcionalW2Digital; + @Column(name = "INDCHECKINBLOQUEADOREMARCACAO") + private Boolean indCheckinBloqueadoRemarcacao; + + @Column(name = "INDAGRUPLOCCONEXAO") + private Boolean indAgrupLocConexao; + + + @Column(name = "INDLIMITACATEGORIAPORCORRIDA") + private Boolean IndLimitaCategoriaPorCorrida; + @Transient @NaoAuditar private Empresa empresaClone; @@ -1287,13 +1294,6 @@ public class Empresa implements Serializable, Auditavel { this.indEnviaDadosAgenciaBpe = indEnviaDadosAgenciaBpe; } - public Boolean getIndPrecoPorDemanda() { - return indPrecoPorDemanda == null ? false : indPrecoPorDemanda; - } - - public void setIndPrecoPorDemanda(Boolean indPrecoPorDemanda) { - this.indPrecoPorDemanda = indPrecoPorDemanda; - } public Boolean getIndRateioComissaoGrupoLinha() { return indRateioComissaoGrupoLinha == null ? false : indRateioComissaoGrupoLinha; @@ -1471,5 +1471,28 @@ public class Empresa implements Serializable, Auditavel { this.indSeguroOpcionalW2Digital = indSeguroOpcionalW2Digital; } + public Boolean getIndCheckinBloqueadoRemarcacao() { + return indCheckinBloqueadoRemarcacao; + } + + public void setIndCheckinBloqueadoRemarcacao(Boolean indCheckinBloqueadoRemarcacao) { + this.indCheckinBloqueadoRemarcacao = indCheckinBloqueadoRemarcacao; + } + public Boolean getIndAgrupLocConexao() { + return indAgrupLocConexao!=null ? indAgrupLocConexao : Boolean.FALSE; + } + + public void setIndAgrupLocConexao(Boolean indAgrupLocConexao) { + this.indAgrupLocConexao = indAgrupLocConexao; + } + + + public Boolean getIndLimitaCategoriaPorCorrida() { + return IndLimitaCategoriaPorCorrida; + } + + public void setIndLimitaCategoriaPorCorrida(Boolean indLimitaCategoriaPorCorrida) { + IndLimitaCategoriaPorCorrida = indLimitaCategoriaPorCorrida; + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java index c9665c24a..18a9b4a22 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java @@ -24,11 +24,16 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import br.com.rjconsultores.auditador.annotations.AuditarLista; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; @Entity @SequenceGenerator(name = "EMPRESA_IMPOSTO_SEQ", sequenceName = "EMPRESA_IMPOSTO_SEQ", allocationSize = 1) @Table(name = "EMPRESA_IMPOSTO") -public class EmpresaImposto implements Serializable { +public class EmpresaImposto implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -161,9 +166,13 @@ public class EmpresaImposto implements Serializable { @Column(name = "PORCFECP") private BigDecimal porcFECP; + @Transient + private EmpresaImposto empresaImpostoClone; + @OneToMany(mappedBy = "empresaImposto", cascade = CascadeType.ALL, orphanRemoval=true) + @NaoAuditar private List lsAliquotaEstadoDestino; @@ -819,4 +828,23 @@ public class EmpresaImposto implements Serializable { public void setLsAliquotaEstadoDestino(List lsAliquotaEstadoDestino) { this.lsAliquotaEstadoDestino = lsAliquotaEstadoDestino; } + + @Override + public void clonar() throws CloneNotSupportedException { + + empresaImpostoClone = new EmpresaImposto(); + empresaImpostoClone = (EmpresaImposto) this.clone(); + + + } + + @Override + public EmpresaImposto getCloneObject() throws CloneNotSupportedException { + return empresaImpostoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getEmpresaImpostoId()); + } } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java b/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java index f0dc94caa..666513015 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java +++ b/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java @@ -234,6 +234,15 @@ public class EsquemaCorrida implements Serializable, Auditavel { @Column(name = "PLATAFORMASERVICOEXTRA") private String plataformaServicoExtra; + @Column(name = "HORASALIDA_EXTRA") + @Temporal(TemporalType.TIME) + @AuditarAtributo(pattern = "HH:mm") + private Date horasalidaExtra; + + @Column(name = "INDBLOQUEIAWEBAPOSSAIDA") + private Boolean indBloqueiaWebAposSaida; + + public enum GerarFeriado { // Declaração dos enum GERARSEMPRE("GERAR SEMPRE", "S"), @@ -846,4 +855,20 @@ public class EsquemaCorrida implements Serializable, Auditavel { public void setPlataformaServicoExtra(String plataformaServicoExtra) { this.plataformaServicoExtra = plataformaServicoExtra; } + + public Date getHorasalidaExtra() { + return horasalidaExtra; + } + + public void setHorasalidaExtra(Date horasalidaExtra) { + this.horasalidaExtra = horasalidaExtra; + } + + public Boolean getIndBloqueiaWebAposSaida() { + return indBloqueiaWebAposSaida == null ? false : indBloqueiaWebAposSaida; + } + + public void setIndBloqueiaWebAposSaida(Boolean indBloqueiaWebAposSaida) { + this.indBloqueiaWebAposSaida = indBloqueiaWebAposSaida; + } } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java b/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java index 870c54e12..2bb389a80 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java @@ -14,10 +14,16 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "FechamentoParamptovta", tela = "Alteração de Ponto de Venda/Fechamento Conta Corrente") @Entity @Table(name = "FECHAMENTO_PARAMPTOVTA") -public class FechamentoParamptovta implements Serializable { +public class FechamentoParamptovta implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -30,6 +36,9 @@ public class FechamentoParamptovta implements Serializable { private Boolean activo; private Integer diasemtransito; private String tipopagamento; + @Transient + @NaoAuditar + private FechamentoParamptovta fechamentoParamptovtaClone; public FechamentoParamptovta() { } @@ -146,7 +155,20 @@ public class FechamentoParamptovta implements Serializable { this.tipopagamento = tipopagamento; } + public void clonar() throws CloneNotSupportedException { + fechamentoParamptovtaClone = new FechamentoParamptovta(); + fechamentoParamptovtaClone = (FechamentoParamptovta) this.clone(); + + } + @Transient + public FechamentoParamptovta getCloneObject() throws CloneNotSupportedException { + return fechamentoParamptovtaClone; + } + @Transient + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getFechamentoparamptovtaId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java b/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java index 32ef4d739..9a4b5d103 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java +++ b/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java @@ -21,20 +21,26 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; import org.hibernate.annotations.GenericGenerator; import com.rjconsultores.ventaboletos.enums.TipoCarteiraDigital; import com.rjconsultores.ventaboletos.enums.TipoFormapago; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + /** * * @author Administrador */ +@AuditarClasse(nome = "Forma Pagamento", tela = "Forma Pagamento") @Entity @SequenceGenerator(name = "FORMA_PAGO_SEQ", sequenceName = "FORMA_PAGO_SEQ", allocationSize = 1) @Table(name = "FORMA_PAGO") -public class FormaPago implements Serializable { +public class FormaPago implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -61,8 +67,10 @@ public class FormaPago implements Serializable { private String cvePago; @Column(name = "IMPFISCAL") private Boolean impfiscal; + @NaoAuditar @OneToMany(mappedBy = "formaPago") private List configRestriccionPagoList; + @NaoAuditar @OneToMany(mappedBy = "formaPago") private List pricingFormapagoList; @Column(name = "INDCONFERENCIAFISICACOMISSAO") @@ -90,6 +98,10 @@ public class FormaPago implements Serializable { @Column(name = "TIPOEVENTOEXTRA_ID") private Long tipoEventoExtraId; + @Transient + @NaoAuditar + private FormaPago formaPagoClone; + public FormaPago() { super(); } @@ -312,4 +324,22 @@ public class FormaPago implements Serializable { public void setTipoEventoExtraId(Long tipoEventoExtraId) { this.tipoEventoExtraId = tipoEventoExtraId; } + + @Override + public FormaPago getCloneObject() throws CloneNotSupportedException { + return formaPagoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getFormapagoId()); + } + + @Override + public void clonar() throws CloneNotSupportedException { + formaPagoClone = new FormaPago(); + formaPagoClone = (FormaPago) this.clone(); + + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java b/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java index 893b1f596..ed1073907 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java +++ b/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java @@ -21,15 +21,23 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Administrador */ +@AuditarClasse(nome = "FormaPagoDet", tela = "Alteração de Forma Pago Detalhe Ponto de Venda") @Entity @SequenceGenerator(name = "FORMA_PAGO_DET_SEQ", sequenceName = "FORMA_PAGO_DET_SEQ", allocationSize = 1) @Table(name = "FORMA_PAGO_DET") -public class FormaPagoDet implements Serializable { +public class FormaPagoDet implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -60,6 +68,9 @@ public class FormaPagoDet implements Serializable { private Boolean indTotalBus; @Column(name = "INDEMBARCADA") private Boolean indEmbarcada; + @Transient + @NaoAuditar + private FormaPagoDet formaPagoDetClone; public FormaPagoDet() { } @@ -179,5 +190,23 @@ public class FormaPagoDet implements Serializable { public void setIndEmbarcada(Boolean indEmbarcada) { this.indEmbarcada = indEmbarcada; } + + @Override + public void clonar() throws CloneNotSupportedException { + formaPagoDetClone = new FormaPagoDet(); + formaPagoDetClone = (FormaPagoDet) this.clone(); + Hibernate.initialize(formaPagoDetClone.getPuntoVenta()); + + } + + @Override + public FormaPagoDet getCloneObject() throws CloneNotSupportedException { + return formaPagoDetClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getFormapagodetId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java index 9cf70205a..4870f5a98 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java @@ -15,11 +15,19 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "HistoricoPuntoVenta", tela = "Alteração Ponto de Venda/Historico") @Entity @SequenceGenerator(name = "HIST_PUNTOVENTA_SEQ", sequenceName = "HIST_PUNTOVENTA_SEQ", allocationSize = 1) @Table(name = "HIST_PUNTOVENTA") -public class HistoricoPuntoVenta implements Serializable { +public class HistoricoPuntoVenta implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -35,6 +43,7 @@ public class HistoricoPuntoVenta implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date fecBloqueio; + @NaoAuditar @ManyToOne @JoinColumn(name = "PUNTOVENTA_ID") private PuntoVenta puntoVenta; @@ -49,6 +58,10 @@ public class HistoricoPuntoVenta implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + @Transient + @NaoAuditar + private HistoricoPuntoVenta historicoPuntoVentaClone; + public Integer getHistoricoPuntoVentaId() { return historicoPuntoVentaId; } @@ -105,6 +118,24 @@ public class HistoricoPuntoVenta implements Serializable { this.usuarioId = usuarioId; } + @Override + public void clonar() throws CloneNotSupportedException { + historicoPuntoVentaClone = new HistoricoPuntoVenta(); + historicoPuntoVentaClone = (HistoricoPuntoVenta) this.clone(); + Hibernate.initialize(historicoPuntoVentaClone.getPuntoVenta()); + + } + + @Override + public HistoricoPuntoVenta getCloneObject() throws CloneNotSupportedException { + return historicoPuntoVentaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getHistoricoPuntoVentaId()); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java b/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java index 55a7d9b45..45483617f 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java +++ b/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java @@ -49,6 +49,7 @@ public class OCDParam implements java.io.Serializable { private Boolean indOcdDinheiro; private Boolean indtotalbilhete; private Boolean indsempregerarapagar; + private Boolean indOCDPorFormadePagamento; private BigDecimal tiempoLimitePenalizacion; private List listOCDPtoVtaParam; @@ -223,6 +224,16 @@ public class OCDParam implements java.io.Serializable { public void setTiempoLimitePenalizacion(BigDecimal tiempoLimitePenalizacion) { this.tiempoLimitePenalizacion = tiempoLimitePenalizacion; } + + + @Column(name = "INDOCDFORMAPAGAMENTO") + public Boolean getIndOCDPorFormadePagamento() { + return indOCDPorFormadePagamento; + } + + public void setIndOCDPorFormadePagamento(Boolean indOCDPorFormadePagamento) { + this.indOCDPorFormadePagamento = indOCDPorFormadePagamento; + } public OCDPtoVtaParam addOCDPtoVtaParam(OCDPtoVtaParam ocdPtoVtaParam) { OCDPtoVtaParam ocd = new OCDPtoVtaParam(); diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java index a1dfc64e0..6b71c9f55 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java @@ -16,11 +16,19 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "ORGAO_CANCELACION", tela = "Alteração de Orgao Cancelamento") @Entity @Table(name = "ORGAO_CANCELACION") @SequenceGenerator(name = "ORGAO_CANCELACION_SEQ", sequenceName = "ORGAO_CANCELACION_SEQ", allocationSize = 1) -public class OrgaoCancelacion implements Serializable { +public class OrgaoCancelacion implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -108,6 +116,10 @@ public class OrgaoCancelacion implements Serializable { @Column(name = "INDBLOQUEIOREMARCADO") private Boolean indBloqueioRemarcado; + + @Transient + @NaoAuditar + private OrgaoCancelacion orgaoCancelacionClone; public Integer getOrgaoCancelacionId() { return orgaoCancelacionId; @@ -364,6 +376,22 @@ public class OrgaoCancelacion implements Serializable { public void setIndBloqueioRemarcado(Boolean indBloqueioRemarcado) { this.indBloqueioRemarcado = indBloqueioRemarcado; + } + @Override + public void clonar() throws CloneNotSupportedException { + + orgaoCancelacionClone = new OrgaoCancelacion(); + orgaoCancelacionClone = (OrgaoCancelacion) this.clone(); + Hibernate.initialize(orgaoCancelacionClone.getOrgao()); + + } + @Override + public OrgaoCancelacion getCloneObject() throws CloneNotSupportedException { + return orgaoCancelacionClone; + } + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getOrgaoCancelacionId()); } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java index fded872ca..ec5ab2b3b 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java @@ -20,23 +20,34 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; import org.apache.commons.lang.BooleanUtils; import org.hibernate.annotations.Where; +import br.com.rjconsultores.auditador.annotations.AuditarAtributo; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarID; +import br.com.rjconsultores.auditador.annotations.AuditarLista; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "OrgaoConcedente", tela = "Alteração de Orgao Concedente") @Entity @SequenceGenerator(name = "ORGAO_CONCEDENTE_SEQ", sequenceName = "ORGAO_CONCEDENTE_SEQ", allocationSize = 1) @Table(name = "ORGAO_CONCEDENTE") -public class OrgaoConcedente implements Serializable { +public class OrgaoConcedente implements Serializable, Auditavel { private static final long serialVersionUID = 1L; public final static Integer CODIGO_ARTESP = 21; public final static Integer CODIGO_ANTT = 3; + @AuditarID @Id @Basic(optional = false) @GeneratedValue(strategy = GenerationType.AUTO, generator = "ORGAO_CONCEDENTE_SEQ") @Column(name = "ORGAOCONCEDENTE_ID") private Integer orgaoConcedenteId; + @AuditarAtributo(nome = "DESC ORGAO") @Column(name = "DESCORGAO") private String descOrgao; @Column(name = "INDDEFAULTSEGURO") @@ -50,14 +61,18 @@ public class OrgaoConcedente implements Serializable { private Date fecmodif; @Column(name = "USUARIO_ID") private Integer usuarioId; + @AuditarLista(auditarEntidades = true, nome = "CategoriaOrgao") @OneToMany(mappedBy = "orgao") private List categoriaOrgaoList; @Column(name = "INDNOMDOCOBLIGATORIO") private Boolean indNomDocObligatorio; + @AuditarLista(auditarEntidades = true, nome = "OrgaoCancelacion") @OneToMany(mappedBy = "orgao") private List orgaoCancelacionList; + @AuditarAtributo(nome = "INDICE PEDADIO") @Column(name = "INDICEPEAJE") private BigDecimal indicePeaje; + @AuditarAtributo(nome = "Idade Idoso") @Column(name = "IDADE_IDOSO") private Integer idadeIdoso; @Column(name = "IDADE_MINIMA") @@ -75,8 +90,10 @@ public class OrgaoConcedente implements Serializable { private Boolean indValDocObligatorioEmbarcada; @OneToMany(mappedBy = "orgaoConcedente", cascade = CascadeType.ALL) + @NaoAuditar private List classesIndicePeaje; + @AuditarLista(auditarEntidades = true, nome = "OrgaoEmpParam") @OneToMany(mappedBy = "orgaoConcedente", cascade = CascadeType.ALL) @Where(clause = "activo=1") private List orgaoEmpParams; @@ -92,6 +109,10 @@ public class OrgaoConcedente implements Serializable { @Column(name = "TAXA_CONVENIENCIA_SVI") private BigDecimal taxaConvenienciaSVI; + + @Transient + @NaoAuditar + private OrgaoConcedente orgaoConcedenteClone; public void addParametro(OrgaoCancelacion param) { this.orgaoCancelacionList.add(param); @@ -329,4 +350,43 @@ public class OrgaoConcedente implements Serializable { public void setTaxaConvenienciaSVI(BigDecimal taxaConvenienciaSVI) { this.taxaConvenienciaSVI = taxaConvenienciaSVI; } + + @Override + public void clonar() throws CloneNotSupportedException { + + orgaoConcedenteClone = new OrgaoConcedente(); + orgaoConcedenteClone = (OrgaoConcedente) this.clone(); + + if(this.getCategoriaOrgaoList() != null) { + List lsClones = new ArrayList(); + for (CategoriaOrgao categoriaOrgao : this.getCategoriaOrgaoList()) { + if(BooleanUtils.isTrue(categoriaOrgao.getActivo())) { + categoriaOrgao.clonar(); + lsClones.add(categoriaOrgao.getCloneObject()); + } + } + orgaoConcedenteClone.setCategoriaOrgaoList(lsClones); + } + + if(this.getOrgaoCancelacionList() != null) { + List lsClones = new ArrayList(); + for (OrgaoCancelacion orgaoCancelacion : this.getOrgaoCancelacionList()) { + if(BooleanUtils.isTrue(orgaoCancelacion.getActivo())) { + orgaoCancelacion.clonar(); + lsClones.add(orgaoCancelacion.getCloneObject()); + } + } + orgaoConcedenteClone.setOrgaoCancelacionList(lsClones); + } + } + + @Override + public OrgaoConcedente getCloneObject() throws CloneNotSupportedException { + return orgaoConcedenteClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getOrgaoConcedenteId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java index 95d7d8706..d96a62eb6 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java @@ -15,11 +15,18 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; +@AuditarClasse(nome = "OrgaoEmpParam", tela = "Alteração de Orgao Empresa Parametro") @Entity @SequenceGenerator(name = "ORGAO_EMP_PARAM_SEQ", sequenceName = "ORGAO_EMP_PARAM_SEQ", allocationSize = 1) @Table(name = "ORGAO_EMP_PARAM") -public class OrgaoEmpParam implements Serializable { +public class OrgaoEmpParam implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -59,6 +66,10 @@ public class OrgaoEmpParam implements Serializable { @Column(name = "CODEMPRESAPORORGAO", length=30) private String codEmpresaPorOrgao; + @Transient + @NaoAuditar + private OrgaoEmpParam orgaoEmpParamClone; + public String getCodEmpresaPorOrgao() { return codEmpresaPorOrgao; } @@ -139,6 +150,23 @@ public class OrgaoEmpParam implements Serializable { this.indNaoRestringe2ViaBPe = indNaoRestringe2ViaBPe; } + @Override + public void clonar() throws CloneNotSupportedException { + orgaoEmpParamClone = new OrgaoEmpParam(); + orgaoEmpParamClone = (OrgaoEmpParam) this.clone(); + Hibernate.initialize(orgaoEmpParamClone.getOrgaoConcedente()); + } + + @Override + public OrgaoEmpParam getCloneObject() throws CloneNotSupportedException { + return orgaoEmpParamClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getOrgaoempparamId()); + } + @Override public int hashCode() { final int prime = 31; diff --git a/src/com/rjconsultores/ventaboletos/entidad/Parada.java b/src/com/rjconsultores/ventaboletos/entidad/Parada.java index 6ea3b734e..629ed0b71 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Parada.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Parada.java @@ -107,9 +107,25 @@ public class Parada implements Serializable, Auditavel { @Fetch(value = FetchMode.SUBSELECT) private List codigosOrgaosConcedentes = new ArrayList(); + @Column(name="INDINTEGRACAOW2I") + private Boolean indIntegracaoW2i; + @Transient @NaoAuditar private Parada paradaClone; + + @Transient + @NaoAuditar + Boolean isParadaConexaoRutaExcluida; + + + public Boolean getIsParadaConexaoRutaExcluida() { + return isParadaConexaoRutaExcluida; + } + + public void setIsParadaConexaoRutaExcluida(Boolean isParadaConexaoRutaExcluida) { + this.isParadaConexaoRutaExcluida = isParadaConexaoRutaExcluida; + } public Parada() { super(); @@ -292,7 +308,7 @@ public class Parada implements Serializable, Auditavel { @Override public String toString() { - return getDescparada(); + return getDescparada(); } public String toStringCve() { @@ -355,8 +371,14 @@ public class Parada implements Serializable, Auditavel { this.indVisibleInternet = indVisibleInternet; } - - + public Boolean getIndIntegracaoW2i() { + return indIntegracaoW2i == null ? false : indIntegracaoW2i; + } + + public void setIndIntegracaoW2i(Boolean indIntegracaoW2i) { + this.indIntegracaoW2i = indIntegracaoW2i; + } + public AgrupamentoParada getAgrupamentoParada() { return agrupamentoParada; } @@ -373,9 +395,6 @@ public class Parada implements Serializable, Auditavel { @Override public Parada getCloneObject() throws CloneNotSupportedException { -// if(paradaClone == null) { -// this.clonar(); -// } return paradaClone; } @@ -384,4 +403,9 @@ public class Parada implements Serializable, Auditavel { return String.format("EsquemaAsientoID [%s]", getParadaId()); } + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java b/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java index 08a6a6d80..b2abf64a0 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java @@ -19,15 +19,23 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Desenvolvimento */ +@AuditarClasse(nome = "ParamRecoleccion", tela = "Alteração de Param Coleccion Pnoto de Venda") @Entity @SequenceGenerator(name = "PARAM_RECOLECCION_SEQ", sequenceName = "PARAM_RECOLECCION_SEQ", allocationSize = 1) @Table(name = "PARAM_RECOLECCION") -public class ParamRecoleccion implements Serializable { +public class ParamRecoleccion implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -49,6 +57,10 @@ public class ParamRecoleccion implements Serializable { @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") @ManyToOne private PuntoVenta puntoVenta; + @Transient + @NaoAuditar + private ParamRecoleccion paramRecoleccionClone; + public ParamRecoleccion() { } @@ -137,4 +149,23 @@ public class ParamRecoleccion implements Serializable { public String toString() { return "com.rjconsultores.ventaboletos.entidad.ParamRecoleccion[paramrecoleccionId=" + paramrecoleccionId + "]"; } + + @Override + public void clonar() throws CloneNotSupportedException { + + paramRecoleccionClone = new ParamRecoleccion(); + paramRecoleccionClone = (ParamRecoleccion) this.clone(); + Hibernate.initialize(paramRecoleccionClone.getPuntoVenta()); + + } + + @Override + public ParamRecoleccion getCloneObject() throws CloneNotSupportedException { + return paramRecoleccionClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getParamrecoleccionId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java index 3f748c7fc..de31a9e5d 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java @@ -20,15 +20,23 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author RJ */ +@AuditarClasse(nome = "PtoVtaCheckin", tela = "Alteração de Localidades/Permitidas/Checkin Ponto de Venda") @Entity @SequenceGenerator(name = "PTOVTA_CHECKIN_SEQ", sequenceName = "PTOVTA_CHECKIN_SEQ", allocationSize = 1) @Table(name = "PTOVTA_CHECKIN") -public class PtoVtaCheckin implements Serializable { +public class PtoVtaCheckin implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -54,6 +62,10 @@ public class PtoVtaCheckin implements Serializable { @Column(name = "USUARIO_ID") private int usuarioId; + + @Transient + @NaoAuditar + private PtoVtaCheckin ptoVtaCheckinClone; public PtoVtaCheckin() { } @@ -110,6 +122,24 @@ public class PtoVtaCheckin implements Serializable { this.usuarioId = usuarioId; } + @Override + public void clonar() throws CloneNotSupportedException { + ptoVtaCheckinClone = new PtoVtaCheckin(); + ptoVtaCheckinClone = (PtoVtaCheckin) this.clone(); + Hibernate.initialize(ptoVtaCheckinClone.getPuntoventaId()); + + } + + @Override + public PtoVtaCheckin getCloneObject() throws CloneNotSupportedException { + return ptoVtaCheckinClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtoVtaCheckinId()); + } + @Override public int hashCode() { int hash = 0; diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java index 5d7ea4073..ce1be4635 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java @@ -19,15 +19,23 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author RJ */ +@AuditarClasse(nome = "PtoVtaSeguro", tela = "Alteração de Seguro no Ponto de Venda") @Entity @SequenceGenerator(name = "PTOVTA_SEGURO_SEQ", sequenceName = "PTOVTA_SEGURO_SEQ", allocationSize = 1) @Table(name = "PTOVTA_SEGURO") -public class PtoVtaSeguro implements Serializable { +public class PtoVtaSeguro implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -100,6 +108,10 @@ public class PtoVtaSeguro implements Serializable { @Column(name = "INDTAXAEMBARQUEEMBARCADA") private Boolean indTaxaEmbarqueEmbarcada; + @Transient + @NaoAuditar + private PtoVtaSeguro ptoVtaSeguroClone; + public PtoVtaSeguro() { } @@ -267,4 +279,24 @@ public class PtoVtaSeguro implements Serializable { public void setIndTaxaEmbarqueEmbarcada(Boolean indTaxaEmbarqueEmbarcada) { this.indTaxaEmbarqueEmbarcada = indTaxaEmbarqueEmbarcada; } + + @Override + public void clonar() throws CloneNotSupportedException { + + ptoVtaSeguroClone = new PtoVtaSeguro(); + ptoVtaSeguroClone = (PtoVtaSeguro) this.clone(); + Hibernate.initialize(ptoVtaSeguroClone.getPuntoventaId()); + + } + + @Override + public PtoVtaSeguro getCloneObject() throws CloneNotSupportedException { + return ptoVtaSeguroClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtoVtaSeguroId()); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java index faea97fa4..9c9411c5e 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java @@ -17,14 +17,22 @@ import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Desenvolvimento */ +@AuditarClasse(nome = "PtoVtaUsuarioBancario", tela = "Alteração Ponto de Venda/Usuario Bancario") @Entity @Table(name = "PTOVTA_USUARIO_BANCARIO") -public class PtoVtaUsuarioBancario implements Serializable { +public class PtoVtaUsuarioBancario implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -48,6 +56,10 @@ public class PtoVtaUsuarioBancario implements Serializable { @JoinColumn(name = "USUARIOBANCARIO_ID", referencedColumnName = "USUARIOBANCARIO_ID") @ManyToOne private UsuarioBancario usuarioBancario; + + @Transient + @NaoAuditar + private PtoVtaUsuarioBancario ptoVtaUsuarioBancarioClone; public PtoVtaUsuarioBancario() { } @@ -107,6 +119,24 @@ public class PtoVtaUsuarioBancario implements Serializable { public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptoVtaUsuarioBancarioClone = new PtoVtaUsuarioBancario(); + ptoVtaUsuarioBancarioClone = (PtoVtaUsuarioBancario) this.clone(); + Hibernate.initialize(ptoVtaUsuarioBancarioClone.getPuntoVenta()); + + } + + @Override + public PtoVtaUsuarioBancario getCloneObject() throws CloneNotSupportedException { + return ptoVtaUsuarioBancarioClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaUsuarioBancarioID()); + } @Override public boolean equals(Object obj) { diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java index ea2216a1f..0d05fb748 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java @@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; + import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; @@ -15,22 +16,28 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Rafael */ +@AuditarClasse(nome = "PtovtaAntecipacomissao", tela = "Alteração Ponto de Venda/Antecipação Comissão") @Entity @SequenceGenerator(name = "PTOVTA_ANTECIPACOMISSAO_SEQ", sequenceName = "PTOVTA_ANTECIPACOMISSAO_SEQ", allocationSize = 1) @Table(name = "PTOVTA_ANTECIPACOMISSAO") -public class PtovtaAntecipacomissao implements Serializable { +public class PtovtaAntecipacomissao implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -61,6 +68,10 @@ public class PtovtaAntecipacomissao implements Serializable { @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") @ManyToOne private PuntoVenta puntoventaId; + + @Transient + @NaoAuditar + private PtovtaAntecipacomissao ptovtaAntecipacomissaoClone; public PtovtaAntecipacomissao() { } @@ -151,6 +162,24 @@ public class PtovtaAntecipacomissao implements Serializable { hash += (ptovtaAntecipaComissaoId != null ? ptovtaAntecipaComissaoId.hashCode() : 0); return hash; } + + @Override + public void clonar() throws CloneNotSupportedException { + + ptovtaAntecipacomissaoClone = new PtovtaAntecipacomissao(); + ptovtaAntecipacomissaoClone = (PtovtaAntecipacomissao) this.clone(); + Hibernate.initialize(ptovtaAntecipacomissaoClone.getPuntoventaId()); + } + + @Override + public PtovtaAntecipacomissao getCloneObject() throws CloneNotSupportedException { + return ptovtaAntecipacomissaoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaAntecipaComissaoId()); + } @Override public boolean equals(Object object) { diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java index 00c4bc556..2ff62c1c6 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java @@ -17,16 +17,24 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; import com.rjconsultores.ventaboletos.enums.TipoAntifraude; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + /** * @author Wilian */ +@AuditarClasse(nome = "PtovtaAntifraude", tela = "Alteração Ponto de Venda/Antifraude") @Entity @SequenceGenerator(name = "PTOVTA_ANTIFRAUDE_SEQ", sequenceName = "PTOVTA_ANTIFRAUDE_SEQ", allocationSize = 1) @Table(name = "PTOVTA_ANTIFRAUDE") -public class PtovtaAntifraude implements Serializable { +public class PtovtaAntifraude implements Serializable , Auditavel { private static final long serialVersionUID = 1L; @@ -60,6 +68,10 @@ public class PtovtaAntifraude implements Serializable { @Column(name = "USUARIO_ID") private int usuarioId; + + @Transient + @NaoAuditar + private PtovtaAntifraude ptovtaAntifraudeClone; public PtovtaAntifraude() { super(); @@ -159,5 +171,24 @@ public class PtovtaAntifraude implements Serializable { return false; return true; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaAntifraudeClone = new PtovtaAntifraude(); + ptovtaAntifraudeClone = (PtovtaAntifraude) this.clone(); + Hibernate.initialize(ptovtaAntifraudeClone.getPuntoventa()); + + } + + @Override + public PtovtaAntifraude getCloneObject() throws CloneNotSupportedException { + return ptovtaAntifraudeClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaAntifraudeId()); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java index 3cd733fe9..a56330fe9 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java @@ -15,11 +15,19 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "PtovtaCatInd", tela = "Alteração de Categoria Ponto de Venda") @Entity @SequenceGenerator(name = "PTOVTA_CAT_IND_SEQ", sequenceName = "PTOVTA_CAT_IND_SEQ", allocationSize = 1) @Table(name = "PTOVTA_CAT_IND") -public class PtovtaCatInd implements Serializable { +public class PtovtaCatInd implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -50,6 +58,10 @@ public class PtovtaCatInd implements Serializable { private Boolean indTotalBus; @Column(name = "INDEMBARCADA") private Boolean indEmbarcada; + + @Transient + @NaoAuditar + private PtovtaCatInd ptovtaCatIndConcedente; public Integer getPtovtaCategoriaId() { return ptovtaCategoriaId; @@ -133,6 +145,24 @@ public class PtovtaCatInd implements Serializable { public void setIndEmbarcada(Boolean indEmbarcada) { this.indEmbarcada = indEmbarcada; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaCatIndConcedente = new PtovtaCatInd(); + ptovtaCatIndConcedente = (PtovtaCatInd) this.clone(); + Hibernate.initialize(ptovtaCatIndConcedente.getPuntoVenta()); + + } + @Override + public PtovtaCatInd getCloneObject() throws CloneNotSupportedException { + return ptovtaCatIndConcedente; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaCategoriaId()); + } + @Override public int hashCode() { diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java index be6bddf03..406dcf020 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java @@ -23,17 +23,25 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.apache.commons.lang.BooleanUtils; import com.rjconsultores.ventaboletos.enums.ModeloComissaoImpressaoPosterior; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + /** * * @author Rafael */ +@AuditarClasse(nome = "PtovtaComissao", tela = "Alteração Ponto Veda/Comissão") @Entity @SequenceGenerator(name = "PTOVTA_COMISSAO_SEQ", sequenceName = "PTOVTA_COMISSAO_SEQ", allocationSize = 1) @Table(name = "PTOVTA_COMISSAO") -public class PtovtaComissao implements Serializable { +public class PtovtaComissao implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -161,7 +169,17 @@ public class PtovtaComissao implements Serializable { private BigDecimal seguroobrigatorioAlta; @Column(name = "SEGUROOBRIGATORIOBAIXA") - private BigDecimal seguroobrigatorioBaixa; + private BigDecimal seguroobrigatorioBaixa; + + @Column(name = "RECARGACELULARALTA") + private BigDecimal recargaCelularAlta; + + @Column(name = "RECARGACELULARBAIXA") + private BigDecimal recargaCelularBaixa; + + @Transient + @NaoAuditar + private PtovtaComissao ptovtaComissaoClone; public PtovtaComissao() { super(); @@ -599,4 +617,45 @@ public class PtovtaComissao implements Serializable { this.seguroobrigatorioBaixa = seguroobrigatorioBaixa; } + public BigDecimal getRecargaCelularAlta() { + return recargaCelularAlta; + } + + public void setRecargaCelularAlta(BigDecimal recargaCelularAlta) { + this.recargaCelularAlta = recargaCelularAlta; + } + + public BigDecimal getRecargaCelularBaixa() { + return recargaCelularBaixa; + } + + public void setRecargaCelularBaixa(BigDecimal recargaCelularBaixa) { + this.recargaCelularBaixa = recargaCelularBaixa; + } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaComissaoClone = new PtovtaComissao(); + ptovtaComissaoClone = (PtovtaComissao) this.clone(); + + if (this.getPuntoventaId() != null) { + if (BooleanUtils.isTrue(getPuntoventaId().getActivo())) { + getPuntoventaId().clonar(); + } + ptovtaComissaoClone.setPuntoventaId(getPuntoventaId()); + } + + } + + @Override + public PtovtaComissao getCloneObject() throws CloneNotSupportedException { + return ptovtaComissaoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaComissaoId()); + } + + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java index a2b9e67a9..0aedefef5 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java @@ -26,14 +26,21 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + /** * * @author Desenvolvimento */ +@AuditarClasse(nome = "PtovtaEmpresa", tela = "Alteração Ponto de Venda/de Empresas/Venda") @Entity @SequenceGenerator(name = "PTOVTA_EMPRESA_SEQ", sequenceName = "PTOVTA_EMPRESA_SEQ", allocationSize = 1) @Table(name = "PTOVTA_EMPRESA") -public class PtovtaEmpresa implements Serializable { +public class PtovtaEmpresa implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @@ -73,6 +80,7 @@ public class PtovtaEmpresa implements Serializable { @Column(name = "NUMSITEF") private String numeroSitef; + @NaoAuditar @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "PTOVTAEMPRESA_ID", referencedColumnName = "PTOVTAEMPRESA_ID") private List lsPtovtaEmpresaContaBancaria; @@ -84,9 +92,14 @@ public class PtovtaEmpresa implements Serializable { @Column(name = "INDIMPCOMPCARTAO") private Boolean indImpCompCartao; + @NaoAuditar @Transient private List contasBancaria; + @Transient + @NaoAuditar + private PtovtaEmpresa ptovtaEmpresaClone; + public PtovtaEmpresa() { } @@ -238,6 +251,24 @@ public class PtovtaEmpresa implements Serializable { return null; } + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaEmpresaClone = new PtovtaEmpresa(); + ptovtaEmpresaClone = (PtovtaEmpresa) this.clone(); + Hibernate.initialize(ptovtaEmpresaClone.getPuntoVenta()); + + } + + @Override + public PtovtaEmpresa getCloneObject() throws CloneNotSupportedException { + return ptovtaEmpresaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaempresaId()); + } + @Override public int hashCode() { final int prime = 31; diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java index da560d3a4..888096543 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java @@ -15,11 +15,19 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "PtovtaEmpresaBloqueada", tela = "Alteração Ponto de Venda/Empresa Bloqueada ") @Entity @SequenceGenerator(name = "PTOVTA_EMP_BLOQUEADA_SEQ", sequenceName = "PTOVTA_EMP_BLOQUEADA_SEQ", allocationSize = 1) @Table(name = "PTOVTA_EMP_BLOQUEADA") -public class PtovtaEmpresaBloqueada implements Serializable { +public class PtovtaEmpresaBloqueada implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -45,6 +53,10 @@ public class PtovtaEmpresaBloqueada implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + + @Transient + @NaoAuditar + private PtovtaEmpresaBloqueada ptovtaEmpresaBloqueadaClone; public Integer getPtovtaempbloqueadaId() { return ptovtaempbloqueadaId; @@ -105,4 +117,22 @@ public class PtovtaEmpresaBloqueada implements Serializable { } return true; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaEmpresaBloqueadaClone = new PtovtaEmpresaBloqueada(); + ptovtaEmpresaBloqueadaClone = (PtovtaEmpresaBloqueada) this.clone(); + Hibernate.initialize(ptovtaEmpresaBloqueadaClone.getPuntoventaId()); + + } + + @Override + public PtovtaEmpresaBloqueada getCloneObject() throws CloneNotSupportedException { + return ptovtaEmpresaBloqueadaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaempbloqueadaId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java index b3478d3b1..51eba52f3 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java @@ -5,10 +5,7 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; import java.util.Date; -import java.util.List; import javax.persistence.Basic; import javax.persistence.Column; @@ -18,22 +15,28 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Rafael */ +@AuditarClasse(nome = "PtoVtaUsuarioBancario", tela = "Alteração Estoque Ponto de Venda") @Entity @SequenceGenerator(name = "PTOVTA_ESTOQUE_SEQ ", sequenceName = "PTOVTA_ESTOQUE_SEQ ", allocationSize = 1) @Table(name = "PTOVTA_ESTOQUE") -public class PtovtaEstoque implements Serializable { +public class PtovtaEstoque implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -66,6 +69,10 @@ public class PtovtaEstoque implements Serializable { @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") @ManyToOne private PuntoVenta puntoventaId; + + @Transient + @NaoAuditar + private PtovtaEstoque ptovtaEstoqueClone; public PtovtaEstoque() { } @@ -215,4 +222,22 @@ public class PtovtaEstoque implements Serializable { return "com.rjconsultores.ventaboletos.entidad.PtovtaEstoque[ ptovtaEstoqueId=" + ptovtaEstoqueId + " ]"; } + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaEstoqueClone = new PtovtaEstoque(); + ptovtaEstoqueClone = (PtovtaEstoque) this.clone(); + Hibernate.initialize(ptovtaEstoqueClone.getPuntoventaId()); + + } + + @Override + public PtovtaEstoque getCloneObject() throws CloneNotSupportedException { + return ptovtaEstoqueClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaEstoqueId()); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java index 0fa630a17..e6e2647c3 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java @@ -15,22 +15,28 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Rafael */ +@AuditarClasse(nome = "PtovtaHorario", tela = "Alteração Ponto Venda/Horario") @Entity @SequenceGenerator(name = "PTOVTA_HORARIO_SEQ", sequenceName = "PTOVTA_HORARIO_SEQ", allocationSize = 1) @Table(name = "PTOVTA_HORARIO") -public class PtovtaHorario implements Serializable { +public class PtovtaHorario implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -56,10 +62,16 @@ public class PtovtaHorario implements Serializable { @Column(name = "USUARIO_ID") private int usuarioId; + + @NaoAuditar @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") @ManyToOne private PuntoVenta puntoventaId; + @Transient + @NaoAuditar + private PtovtaHorario ptovtaHorarioClone; + @Column(name = "INDLUNES") private Boolean indlunes; @Column(name = "INDMARTES") @@ -204,6 +216,24 @@ public class PtovtaHorario implements Serializable { public void setInddomingo(Boolean inddomingo) { this.inddomingo = inddomingo; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaHorarioClone = new PtovtaHorario(); + ptovtaHorarioClone = (PtovtaHorario) this.clone(); + Hibernate.initialize(ptovtaHorarioClone.getPuntoventaId()); + + } + + @Override + public PtovtaHorario getCloneObject() throws CloneNotSupportedException { + return ptovtaHorarioClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaHorarioId()); + } @Override public int hashCode() { diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java index 18f06f68c..766d7c480 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java @@ -5,6 +5,7 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -15,25 +16,31 @@ import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.JoinColumn; import javax.persistence.Lob; -import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.apache.commons.lang.BooleanUtils; + +import br.com.rjconsultores.auditador.annotations.AuditarAtributo; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarLista; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Rafael */ +@AuditarClasse(nome = "PtovtaTitular", tela = "Alteração Ponto Veda/Titular/Foto") @Entity @Table(name = "PTOVTA_TITULAR") @SequenceGenerator(name = "PTOVTA_TITULAR_SEQ ", sequenceName = "PTOVTA_TITULAR_SEQ ", allocationSize = 1) -public class PtovtaTitular implements Serializable { +public class PtovtaTitular implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -41,6 +48,7 @@ public class PtovtaTitular implements Serializable { @Column(name = "PTOVTATITULAR_ID") private Integer ptovtaTitularId; + @AuditarAtributo(nome = "NOME TITULAR/FOTO") @Column(name = "NOME") private String nome; @@ -65,9 +73,15 @@ public class PtovtaTitular implements Serializable { private Date fecmodif; @Column(name = "USUARIO_ID") - private int usuarioId; + private int usuarioId; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "titularId") private List puntoVentaList; + + @Transient + @NaoAuditar + private PtovtaTitular ptovtaTitularClone; public PtovtaTitular() { } @@ -195,4 +209,33 @@ public class PtovtaTitular implements Serializable { return "com.rjconsultores.ventaboletos.entidad.PtovtaTitular[ ptovtaTitularId=" + ptovtaTitularId + " ]"; } + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaTitularClone = new PtovtaTitular(); + ptovtaTitularClone = (PtovtaTitular) this.clone(); + + if(this.getPuntoVentaList() != null) { + List lsClones = new ArrayList(); + for (PuntoVenta puntoVenta : this.getPuntoVentaList()) { + if(BooleanUtils.isTrue(puntoVenta.getActivo())) { + puntoVenta.clonar(); + lsClones.add(puntoVenta.getCloneObject()); + } + } + ptovtaTitularClone.setPuntoVentaList(lsClones); + } + + } + + @Override + public PtovtaTitular getCloneObject() throws CloneNotSupportedException { + return ptovtaTitularClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaTitularId()); + } + + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java index 09dab4d7e..824c33c0f 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java @@ -29,8 +29,10 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; import org.apache.commons.lang.BooleanUtils; +import org.hibernate.Hibernate; import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; import org.hibernate.annotations.Where; @@ -38,14 +40,22 @@ import org.hibernate.annotations.Where; import com.rjconsultores.ventaboletos.enums.TipoSocio; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import br.com.rjconsultores.auditador.annotations.AuditarAtributo; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarEntidade; +import br.com.rjconsultores.auditador.annotations.AuditarLista; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + /** * * @author Rafius */ @Entity @SequenceGenerator(name = "PUNTO_VENTA_SEQ", sequenceName = "PUNTO_VENTA_SEQ", allocationSize = 1) +@AuditarClasse(nome = "PuntoVenta", tela = "Alteração de Ponto de Venda") @Table(name = "PUNTO_VENTA") -public class PuntoVenta implements Serializable { +public class PuntoVenta implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -53,6 +63,7 @@ public class PuntoVenta implements Serializable { @GeneratedValue(strategy = GenerationType.AUTO, generator = "PUNTO_VENTA_SEQ") @Column(name = "PUNTOVENTA_ID") private Integer puntoventaId; + @AuditarAtributo(nome = "NOME PONTO DE VENDA") @Column(name = "NOMBPUNTOVENTA") private String nombpuntoventa; @Column(name = "DIRECCIONCALLE") @@ -91,6 +102,7 @@ public class PuntoVenta implements Serializable { @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") @ManyToOne private TipoPuntoVenta tipoPuntoVenta; + @AuditarLista(auditarEntidades = true, nome = "ReservacionPuntoVenta") @OneToMany(mappedBy = "puntoVenta") private List reservacionPuntoventaList; @OneToOne @@ -105,40 +117,63 @@ public class PuntoVenta implements Serializable { @OneToOne @JoinColumn(name = "USUARIOBANCARIO_ID") private UsuarioBancario usuarioBancario; + + @AuditarLista(auditarEntidades = true, nome = "FormaPagoDet") @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") private List lsFormaPagoDet; + + @AuditarLista(auditarEntidades = true, nome = "ParamRecoleccion") @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") private List lsParamRecoleccion; + + @AuditarLista(auditarEntidades = true, nome = "PtovtaEmpresa") @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") private List lsPtovtaEmpresa; + + @AuditarLista(auditarEntidades = true, nome = "PtoVtaUsuarioBancario") @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") private List lsPtovtaUsuarioBancario; + @Column(name = "NUMFAX") private String numfax; @Column(name = "COMPLE") private String compl; + + @AuditarLista(auditarEntidades = true, nome = "PtovtaEstoque") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") private List ptovtaEstoqueList; + + + @AuditarLista(auditarEntidades = true, nome = "PtovtaHorario") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") private List ptovtaHorarioList; + + @AuditarLista(auditarEntidades = true, nome = "PtovtaAntecipacomissao") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") private List ptovtaAntecipacomissaoList; + + @AuditarEntidade @JoinColumn(name = "PTOVTACOMISSAO_ID") @OneToOne(cascade = CascadeType.ALL) private PtovtaComissao comissaoId; + @JoinColumn(name = "PTOVTADIVERSOS_ID") @OneToOne(cascade = CascadeType.ALL) private PtovtaDiversos diversosId; @JoinColumn(name = "PTOVTAAGENCIA_ID") @OneToOne(cascade = CascadeType.ALL) private PtovtaAgencia agenciaId; + + @AuditarEntidade @JoinColumn(name = "PTOVTATITULAR_ID") @OneToOne(cascade = CascadeType.ALL) private PtovtaTitular titularId; + + @AuditarAtributo(nome = "NUMERO PONTO DE VENDA") @Column(name = "NUMPUNTOVENTA") private String numPuntoVenta; @Column(name = "INDPERMISOTASAEMBARQUE") @@ -179,18 +214,22 @@ public class PuntoVenta implements Serializable { @Column(name = "MOTIVONAOINTEGRADOAG") private String motivoNaoIntegradoAG; + @AuditarLista(auditarEntidades = true, nome = "PtovtaEmpresaBloqueada") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") @LazyCollection(LazyCollectionOption.FALSE) private List ptovtaEmpresaBloqueadaList; + @AuditarLista(auditarEntidades = true, nome = "PtoVtaCheckin") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") @LazyCollection(LazyCollectionOption.FALSE) private List ptovtaCheckinList; + @AuditarLista(auditarEntidades = true, nome = "PtoVtaSeguro") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") @LazyCollection(LazyCollectionOption.FALSE) private List ptovtaSeguroList; + @AuditarLista(auditarEntidades = true, nome = "PtovtaCatInd") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoVenta") @LazyCollection(LazyCollectionOption.FALSE) private List ptovtaCatIndList; @@ -216,10 +255,12 @@ public class PuntoVenta implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date dateAbertura; + @AuditarLista(auditarEntidades = true, nome = "HistoricoPuntoVenta") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoVenta") @LazyCollection(LazyCollectionOption.FALSE) private List historicoPuntoVentaList; + @AuditarLista(auditarEntidades = true, nome = "CategoriaBloqueioImpPosterior") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventa") @LazyCollection(LazyCollectionOption.FALSE) private List categoriaBloqImpPosteriorList; @@ -239,6 +280,7 @@ public class PuntoVenta implements Serializable { @Column(name = "INDREPASSAUTR") private Boolean indRepassaUTR; + @AuditarLista(auditarEntidades = true, nome = "PtovtaAntifraude") @OneToMany(mappedBy = "puntoventa", cascade = CascadeType.ALL) @LazyCollection(LazyCollectionOption.FALSE) @Where(clause = "activo = 1") @@ -247,6 +289,7 @@ public class PuntoVenta implements Serializable { @Column(name = "INDBLOQUEIATIPOPASSAGEM") private Boolean indBloqueiaTipoPassagem; + @AuditarLista(auditarEntidades = true, nome = "CobrancaAdcPuntoVenta") @OneToMany(mappedBy = "puntoVenta", cascade = CascadeType.ALL) @LazyCollection(LazyCollectionOption.FALSE) @Where(clause = "activo = 1") @@ -270,7 +313,14 @@ public class PuntoVenta implements Serializable { @Column(name = "INDQRCODETAXAEMBARQUERODTTL") private Boolean indQrcodeTaxaEmbarqueRodTTL; + + @Transient + @NaoAuditar + private PuntoVenta puntoVentaClone; + @Column(name = "INDBLOQCANCBILHETEIMPRESSO ") + private Boolean indBloqueiaCancelamentoBilheteImpresso; + public List getCobrancaAdicionalList() { return cobrancaAdicionalList; } @@ -1199,5 +1249,32 @@ public class PuntoVenta implements Serializable { public void setIndQrcodeTaxaEmbarqueRodTTL(Boolean indQrcodeTaxaEmbarqueRodTTL) { this.indQrcodeTaxaEmbarqueRodTTL = indQrcodeTaxaEmbarqueRodTTL; } + @Override + public void clonar() throws CloneNotSupportedException { + puntoVentaClone = new PuntoVenta(); + puntoVentaClone = (PuntoVenta) this.clone(); + + if(this.getReservacionPuntoventaList() != null) { + List lsClones = new ArrayList(); + for (ReservacionPuntoVenta reservacionPuntoVenta : this.getReservacionPuntoventaList()) { + if(BooleanUtils.isTrue(reservacionPuntoVenta.getActivo())) { + reservacionPuntoVenta.clonar(); + lsClones.add(reservacionPuntoVenta.getCloneObject()); + } + } + puntoVentaClone.setReservacionPuntoventaList(lsClones); + } + + } + + @Override + public PuntoVenta getCloneObject() throws CloneNotSupportedException { + return puntoVentaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPuntoventaId()); + } } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java index 2afd57bcb..ef36ca540 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java @@ -17,126 +17,160 @@ import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + import javax.persistence.SequenceGenerator; /** * * @author Rafius */ + +@AuditarClasse(nome = "ReservacionPuntoVenta", tela = "Alteração de Reserva Punto Venta") @Entity -@SequenceGenerator(name = "RESERVACION_PUNTOVENTA_SEQ", sequenceName = "RESERVACION_PUNTOVENTA_SEQ", allocationSize=1) +@SequenceGenerator(name = "RESERVACION_PUNTOVENTA_SEQ", sequenceName = "RESERVACION_PUNTOVENTA_SEQ", allocationSize = 1) @Table(name = "RESERVACION_PUNTOVENTA") -public class ReservacionPuntoVenta implements Serializable { +public class ReservacionPuntoVenta implements Serializable, Auditavel { - private static final long serialVersionUID = 1L; - @Id - @Basic(optional = false) - @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_PUNTOVENTA_SEQ") - @Column(name = "RESERVACIONPTOVTA_ID") - private Integer reservacionptovtaId; - @Column(name = "ACTIVO") - private Boolean activo; - @Column(name = "FECMODIF") - @Temporal(TemporalType.TIMESTAMP) - private Date fecmodif; - @Column(name = "USUARIO_ID") - private Integer usuarioId; - @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") - @ManyToOne - private ReservacionCtrl reservacionCtrl; - @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") - @ManyToOne - private PuntoVenta puntoVenta; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_PUNTOVENTA_SEQ") + @Column(name = "RESERVACIONPTOVTA_ID") + private Integer reservacionptovtaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; - public ReservacionPuntoVenta() { - } + @NaoAuditar + @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") + @ManyToOne + private ReservacionCtrl reservacionCtrl; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") - public ReservacionPuntoVenta(Integer reservacionptovtaId) { - this.reservacionptovtaId = reservacionptovtaId; - } + @NaoAuditar + @ManyToOne + private PuntoVenta puntoVenta; - public Integer getReservacionptovtaId() { - return reservacionptovtaId; - } + @Transient + @NaoAuditar + private ReservacionPuntoVenta reservacionPuntoVentaClone; - public void setReservacionptovtaId(Integer reservacionptovtaId) { - this.reservacionptovtaId = reservacionptovtaId; - } + public ReservacionPuntoVenta() { + } - public Boolean getActivo() { - return activo; - } + public ReservacionPuntoVenta(Integer reservacionptovtaId) { + this.reservacionptovtaId = reservacionptovtaId; + } - public void setActivo(Boolean activo) { - this.activo = activo; - } + public Integer getReservacionptovtaId() { + return reservacionptovtaId; + } - public Date getFecmodif() { - return fecmodif; - } + public void setReservacionptovtaId(Integer reservacionptovtaId) { + this.reservacionptovtaId = reservacionptovtaId; + } - public void setFecmodif(Date fecmodif) { - this.fecmodif = fecmodif; - } + public Boolean getActivo() { + return activo; + } - public Integer getUsuarioId() { - return usuarioId; - } + public void setActivo(Boolean activo) { + this.activo = activo; + } - public void setUsuarioId(Integer usuarioId) { - this.usuarioId = usuarioId; - } + public Date getFecmodif() { + return fecmodif; + } - public ReservacionCtrl getReservacionCtrl() { - return reservacionCtrl; - } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } - public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { - this.reservacionCtrl = reservacionCtrl; - } + public Integer getUsuarioId() { + return usuarioId; + } - public PuntoVenta getPuntoVenta() { - return puntoVenta; - } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } - public void setPuntoVenta(PuntoVenta puntoVenta) { - this.puntoVenta = puntoVenta; - } + public ReservacionCtrl getReservacionCtrl() { + return reservacionCtrl; + } - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final ReservacionPuntoVenta other = (ReservacionPuntoVenta) obj; - if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { - return false; - } - if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { - return false; - } - if (this.puntoVenta != other.puntoVenta && (this.puntoVenta == null || !this.puntoVenta.equals(other.puntoVenta))) { - return false; - } - return true; - } + public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { + this.reservacionCtrl = reservacionCtrl; + } - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.activo != null ? this.activo.hashCode() : 0); - hash = 79 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); - hash = 79 * hash + (this.puntoVenta != null ? this.puntoVenta.hashCode() : 0); - return hash; - } + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } - + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } - @Override - public String toString() { - return "com.rjconsultores.ventaboletos.entidad.ReservacionPuntoventa[reservacionptovtaId=" + reservacionptovtaId + "]"; - } + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ReservacionPuntoVenta other = (ReservacionPuntoVenta) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { + return false; + } + if (this.puntoVenta != other.puntoVenta && (this.puntoVenta == null || !this.puntoVenta.equals(other.puntoVenta))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 79 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 79 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); + hash = 79 * hash + (this.puntoVenta != null ? this.puntoVenta.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionPuntoventa[reservacionptovtaId=" + reservacionptovtaId + "]"; + } + + @Override + public void clonar() throws CloneNotSupportedException { + reservacionPuntoVentaClone = new ReservacionPuntoVenta(); + reservacionPuntoVentaClone = (ReservacionPuntoVenta) this.clone(); + Hibernate.initialize(reservacionPuntoVentaClone.getPuntoVenta()); + + } + + @Override + public ReservacionPuntoVenta getCloneObject() throws CloneNotSupportedException { + return reservacionPuntoVentaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getReservacionptovtaId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/Ruta.java b/src/com/rjconsultores/ventaboletos/entidad/Ruta.java index 4c822a109..42aa36f41 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Ruta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Ruta.java @@ -137,15 +137,6 @@ public class Ruta implements Serializable, Comparable, Auditavel { @Column(name = "INDVENDAEMBARCADA") private Boolean indVendaEmbarcada; - @Column(name = "INDPRECIOPORDEMANDA") - private Boolean indPrecioPorDemanda; - - @Column(name = "FECINIPRECIODEMANDA") - private Date fecInicioPrecioDemanda; - - @Column(name = "FECFIMPRECIODEMANDA") - private Date fecFimPrecioDemanda; - @OneToMany(mappedBy = "ruta", cascade = CascadeType.ALL) private List lsRutaEmbarqueDesembarque; @@ -156,15 +147,27 @@ public class Ruta implements Serializable, Comparable, Auditavel { @Transient private Boolean isClone; + @Transient + @NaoAuditar + private Boolean isCadastro; + @Column(name = "indnumfidelidadobligatorio") private Boolean indNumFidelidadObligatorio; + @Transient + @NaoAuditar + private List rutaCombinacionTemporariaList; + @Transient @NaoAuditar private Ruta rutaClone; @Column(name = "STATUS_AUTORIZADORA") private Integer statusAutorizadora; + + @Transient + @NaoAuditar + private ClaseServicio claseServicioRutaOrigem; public Ruta() { super(); @@ -199,9 +202,7 @@ public class Ruta implements Serializable, Comparable, Auditavel { ruta.indTribTaxaEmbarque = other.indTribTaxaEmbarque; ruta.indVentaRioCard = other.indVentaRioCard; ruta.indRutaInternacional = other.indRutaInternacional; - ruta.indPrecioPorDemanda = other.indPrecioPorDemanda; - ruta.fecInicioPrecioDemanda = other.fecInicioPrecioDemanda; - ruta.fecFimPrecioDemanda = other.fecFimPrecioDemanda; + /******* ruta.lsRutaEmpresa *************/ if (ruta.lsRutaEmpresa == null) { @@ -253,6 +254,7 @@ public class Ruta implements Serializable, Comparable, Auditavel { ruta.usuarioId = other.usuarioId; ruta.ventaOffLine = other.ventaOffLine; + ruta.claseServicioRutaOrigem=other.claseServicioRutaOrigem; return ruta; } @@ -565,7 +567,7 @@ public class Ruta implements Serializable, Comparable, Auditavel { } public Boolean getIsClone() { - return isClone; + return isClone == null ? false: isClone; } public void setIsClone(Boolean isClone) { @@ -627,30 +629,6 @@ public class Ruta implements Serializable, Comparable, Auditavel { public String getTextoInclusaoExclusao() { return String.format("ID [%s]", getRutaId()); } - - public Boolean getIndPrecioPorDemanda() { - return indPrecioPorDemanda; - } - - public void setIndPrecioPorDemanda(Boolean indPrecioPorDemanda) { - this.indPrecioPorDemanda = indPrecioPorDemanda; - } - - public Date getFecInicioPrecioDemanda() { - return fecInicioPrecioDemanda; - } - - public void setFecInicioPrecioDemanda(Date fecInicioPrecioDemanda) { - this.fecInicioPrecioDemanda = fecInicioPrecioDemanda; - } - - public Date getFecFimPrecioDemanda() { - return fecFimPrecioDemanda; - } - - public void setFecFimPrecioDemanda(Date fecFimPrecioDemanda) { - this.fecFimPrecioDemanda = fecFimPrecioDemanda; - } public String getDescSentido() { return this.getIndSentidoIda() == null || Boolean.TRUE.equals(this.getIndSentidoIda()) ? "IDA" : "VOLTA"; @@ -663,4 +641,34 @@ public class Ruta implements Serializable, Comparable, Auditavel { public void setStatusAutorizadora(Integer statusAutorizadora) { this.statusAutorizadora = statusAutorizadora; } + + public List getRutaCombinacionTemporariaList() { + return rutaCombinacionTemporariaList; + } + + public void setRutaCombinacionTemporariaList(List rutaCombinacionTemporariaList) { + this.rutaCombinacionTemporariaList = rutaCombinacionTemporariaList; + } + + public Boolean getIsCadastro() { + return isCadastro==null?false:isCadastro; + } + + public void setIsCadastro(Boolean isCadastro) { + this.isCadastro = isCadastro; + } + + public ClaseServicio getClaseServicioRutaOrigem() { + return claseServicioRutaOrigem; + } + + public void setClaseServicioRutaOrigem(ClaseServicio claseServicioRutaOrigem) { + this.claseServicioRutaOrigem = claseServicioRutaOrigem; + } + + + + + + } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/RutaIcmsExcepcion.java b/src/com/rjconsultores/ventaboletos/entidad/RutaIcmsExcepcion.java index 54308f6e2..47412c1e9 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/RutaIcmsExcepcion.java +++ b/src/com/rjconsultores/ventaboletos/entidad/RutaIcmsExcepcion.java @@ -60,6 +60,9 @@ public class RutaIcmsExcepcion implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + @Column(name = "indCST41") + private Boolean indCST41; + public Integer getRutaIcmsExcepcionId() { return rutaIcmsExcepcionId; } @@ -139,6 +142,14 @@ public class RutaIcmsExcepcion implements Serializable { public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } + + public Boolean getIndCST41() { + return indCST41; + } + + public void setIndCST41(Boolean indCST41) { + this.indCST41 = indCST41; + } @Override public int hashCode() { diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java b/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java index e254c14fe..78921b454 100644 --- a/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java +++ b/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java @@ -18,7 +18,9 @@ public enum TipoFormapago { DEPOSITO(11,Labels.getLabel("editarFormaPagoController.lblDeposito.label")), CARTEIRA_DIGITAL(12,Labels.getLabel("editarFormaPagoController.lblCarteiraDigital.label")), SMART_CARD(13,Labels.getLabel("editarFormaPagoController.lblSmartCard.label")), - LOGPAY(14,Labels.getLabel("editarFormaPagoController.lblLogpay.label")); + LOGPAY(14,Labels.getLabel("editarFormaPagoController.lblLogpay.label")), + TPI(15, Labels.getLabel("editarFormaPagoController.lblTPI.label")), + MOBIPIX(16,Labels.getLabel("editarFormaPagoController.lblMobiPix.label")); private Integer valor; private String descricao; diff --git a/src/com/rjconsultores/ventaboletos/service/BoletoService.java b/src/com/rjconsultores/ventaboletos/service/BoletoService.java index 2a4a6a66a..73342618d 100644 --- a/src/com/rjconsultores/ventaboletos/service/BoletoService.java +++ b/src/com/rjconsultores/ventaboletos/service/BoletoService.java @@ -4,6 +4,7 @@ */ package com.rjconsultores.ventaboletos.service; +import java.math.BigDecimal; import java.util.Date; import com.rjconsultores.ventaboletos.entidad.Boleto; @@ -18,6 +19,10 @@ public interface BoletoService { public Boleto suscribir(Boleto boleto); - public void criaBoletoReserva(String unoAsientoSelec, Integer unaCorridaId, Date unaFecCorrida, Integer unoTerminalOrigenId, Integer unoTerminalDestinoId, Integer unoTipoVenta, Integer unaCategoriaSelec, String unoNumeOperacion, Integer unUsuarioId, Integer unPuntoVenta, Integer unClienteId, Integer rutaId, Float tarifa, Long tempoReserva, Integer estacionId, String cpf, String numFidelidade, Integer claseservicioId, Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro) throws Exception; + public void criaBoletoReserva(String unoAsientoSelec, Integer unaCorridaId, Date unaFecCorrida, Integer unoTerminalOrigenId, + Integer unoTerminalDestinoId, Integer unoTipoVenta, Integer unaCategoriaSelec, String unoNumeOperacion, Integer unUsuarioId, + Integer unPuntoVenta, Integer unClienteId, Integer rutaId, BigDecimal tarifa, Long tempoReserva, Integer estacionId, String cpf, + String numFidelidade, Integer claseservicioId, Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro, + BigDecimal valorSeguro, BigDecimal valorTaxaEmbarque, BigDecimal valorPedagio) throws Exception; } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java index dab713398..4c14b862d 100644 --- a/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java @@ -17,7 +17,7 @@ public interface CategoriaCtrlService { public CategoriaCtrl suscribir(CategoriaCtrl entidad); - public CategoriaCtrl checarCategoriaAdulto(CategoriaCtrl entidad); + public CategoriaCtrl checarCategoriaAdulto(CategoriaCtrl entidad, Boolean rdVendeAbertoSim, Boolean chkCancelaEmAberto, Boolean chkDevolveEmAberto, Boolean chkCancelaEmergencialEmAberto, Boolean chkTrocaTiturlidadeEmAberto, Boolean chkTrocaEmAberto); public CategoriaCtrl actualizacion(CategoriaCtrl entidad); diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java b/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java index 644ed4363..2c87366b9 100644 --- a/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java +++ b/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java @@ -24,11 +24,11 @@ public interface ConexionRutaTramoCtrlService { public boolean validarConexioneRutasExistentes(Integer rutaOrigenId, Integer rutaDestinoId, Integer paradaOrigenId, Integer paradaDestinoId, Integer origemTrechoId, Integer destinoTrechoId, Integer integer); - public List buscarLocalidadesOrigem(Integer conexionRutaConfId); + public List buscarLocalidadesEixoA(Integer conexionRutaConfId); - public List buscarLocalidadesDestino(Integer conexionRutaConfId); + public List buscarLocalidadeEixoB(Integer conexionRutaConfId); - public List buscarLocalidadesDestinoC(Integer conexionRutaConfId); + public List buscarLocalidadesEixoC(Integer conexionRutaConfId); public List buscarTodasLocalidadesOrigem(Integer conexionRutaConfId); diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionService.java b/src/com/rjconsultores/ventaboletos/service/ConexionService.java index 044ab4b5f..4813a1e75 100644 --- a/src/com/rjconsultores/ventaboletos/service/ConexionService.java +++ b/src/com/rjconsultores/ventaboletos/service/ConexionService.java @@ -13,7 +13,7 @@ public interface ConexionService { */ public void gerarConexiones(); - public List buscarConexiones(Integer origenId, Integer destinoId); + public List buscarConexiones(boolean isBuscaAgrupada, Integer origenId, Integer destinoId); public Conexion suscribir(Conexion conexion); diff --git a/src/com/rjconsultores/ventaboletos/service/ConstanteService.java b/src/com/rjconsultores/ventaboletos/service/ConstanteService.java index c3919acb4..203a5e07d 100644 --- a/src/com/rjconsultores/ventaboletos/service/ConstanteService.java +++ b/src/com/rjconsultores/ventaboletos/service/ConstanteService.java @@ -27,4 +27,6 @@ public interface ConstanteService extends GenericService { public String buscarURLAPI(); public Integer buscarValorConstantePorNomeConstante(String nomeConstante); + + public String buscarURLAPIEmb(); } diff --git a/src/com/rjconsultores/ventaboletos/service/ParadaService.java b/src/com/rjconsultores/ventaboletos/service/ParadaService.java index 6f0b64a65..aac9bbd51 100644 --- a/src/com/rjconsultores/ventaboletos/service/ParadaService.java +++ b/src/com/rjconsultores/ventaboletos/service/ParadaService.java @@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.service; import java.util.List; +import com.rjconsultores.ventaboletos.entidad.AgrupamentoParada; import com.rjconsultores.ventaboletos.entidad.Ciudad; import com.rjconsultores.ventaboletos.entidad.Nodo; import com.rjconsultores.ventaboletos.entidad.Parada; @@ -43,4 +44,6 @@ public interface ParadaService { public List obterPossiveisDestinos(Parada origem); public List buscaParadaRegionMetropolitana(RegionMetropolitana regionMetropolitana); + + public List buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada); } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/BoletoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/BoletoServiceImpl.java index 81d491d57..d936c5edc 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/BoletoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/BoletoServiceImpl.java @@ -14,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.constantes.Constantes; import com.rjconsultores.ventaboletos.dao.BoletoDAO; import com.rjconsultores.ventaboletos.entidad.Boleto; +import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; import com.rjconsultores.ventaboletos.entidad.Usuario; @@ -58,15 +59,14 @@ public class BoletoServiceImpl implements BoletoService { @Transactional public void criaBoletoReserva(String unoAsientoSelec, Integer unaCorridaId, Date unaFecCorrida, Integer unoTerminalOrigenId, Integer unoTerminalDestinoId, Integer unoTipoVenta, Integer unaCategoriaSelec, - String unoNumeOperacion, Integer unUsuarioId, Integer unPuntoVenta, - Integer unClienteId, Integer rutaId, Float tarifa, Long tempoReserva, - Integer estacionId, String docCPF, String numFidelidade, Integer claseservicioId, Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro) throws Exception { + String unoNumeOperacion, Integer unUsuarioId, Integer unPuntoVenta, Integer unClienteId, Integer rutaId, + BigDecimal tarifa, Long tempoReserva, Integer estacionId, String docCPF, String numFidelidade, Integer claseservicioId, + Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro, BigDecimal valorSeguro, + BigDecimal valorTaxaEmbarque, BigDecimal valorPedagio) throws Exception { PuntoVenta miPuntoVenta = puntoVentaService.obtenerID(unPuntoVenta.intValue()); - Boleto miBoletoTemporal = new Boleto(); - BigDecimal miPrecio = MoneyHelper.arredondar(tarifa) ; - miBoletoTemporal = new Boleto(); + atualizaValoresTarifaPedagioSeguroTaxaEmbarque(tarifa, empresaCorridaId, valorSeguro, valorTaxaEmbarque, valorPedagio, miPuntoVenta, miBoletoTemporal); miBoletoTemporal.setBoletoId(formataBoletoId(getSequenciaBoletoId())); miBoletoTemporal.setBoletooriginalId(miBoletoTemporal.getBoletoId()); // Sempre Categoria Normal (1) @@ -94,9 +94,6 @@ public class BoletoServiceImpl implements BoletoService { miBoletoTemporal.setIndreplica(Boolean.FALSE); miBoletoTemporal.setIndstatusboleto("S"); miBoletoTemporal.setIndreimpresion(Boolean.FALSE); - miBoletoTemporal.setImportetaxaembarque(BigDecimal.ZERO); - miBoletoTemporal.setImporteseguro(BigDecimal.ZERO); - miBoletoTemporal.setImportepedagio(BigDecimal.ZERO); miBoletoTemporal.setImporteoutros(BigDecimal.ZERO); miBoletoTemporal.setMarcaId(marcaId); miBoletoTemporal.setMonedaId(1); @@ -111,8 +108,6 @@ public class BoletoServiceImpl implements BoletoService { miBoletoTemporal.setOrigenId(unoTerminalOrigenId); miBoletoTemporal.setPreciopricing(BigDecimal.ZERO); miBoletoTemporal.setPorccategoria(null); - miBoletoTemporal.setPreciopagado(miPrecio); - miBoletoTemporal.setPreciobase(miPrecio); miBoletoTemporal.setPuntoVenta(miPuntoVenta); miBoletoTemporal.setPtovtaventaId(miPuntoVenta.getPuntoventaId()); miBoletoTemporal.setRutaId(rutaId); @@ -127,6 +122,39 @@ public class BoletoServiceImpl implements BoletoService { } + /** + * Verifica e atualiza valores tarifa, pedágio, seguro e taxa de embarque. + * Sendo que o seguro e taxa de embarque somente serão setados caso no ponto de venda marcado como vende default. + * @param tarifa + * @param empresaCorridaId + * @param valorSeguro + * @param valorTaxaEmbarque + * @param valorPedagio + * @param miPuntoVenta + * @param miBoletoTemporal + */ + private void atualizaValoresTarifaPedagioSeguroTaxaEmbarque(BigDecimal tarifa, Integer empresaCorridaId, BigDecimal valorSeguro, + BigDecimal valorTaxaEmbarque, BigDecimal valorPedagio, PuntoVenta miPuntoVenta, Boleto miBoletoTemporal) { + BigDecimal miPrecio = MoneyHelper.arredondar(tarifa) ; + miBoletoTemporal.setImportepedagio(valorPedagio); + miBoletoTemporal.setPreciopagado(miPrecio); + miBoletoTemporal.setPreciobase(miPrecio); + if(miPuntoVenta !=null && miPuntoVenta.getPtovtaSeguroList() !=null) { + for (PtoVtaSeguro ptoVtaSeguro : miPuntoVenta.getPtovtaSeguroList()) { + if(empresaCorridaId.equals(ptoVtaSeguro.getEmpresa().getEmpresaId()) && Boolean.TRUE.equals(miPuntoVenta.getActivo())) { + if(Boolean.TRUE.equals(ptoVtaSeguro.getIndEstanTasaEmbarque())) { + miBoletoTemporal.setImportetaxaembarque(valorTaxaEmbarque); + } + if(Boolean.TRUE.equals(ptoVtaSeguro.getIndEstanSegTabela())) { + miBoletoTemporal.setImporteseguro(valorSeguro); + } + break; + } + + } + } + } + public BigDecimal calcularKmViaje(int rutaId, Integer unoOrigenId, Integer unoDestinoId) { RutaCombinacion rutaCombinacion = rutaCombinacionService.busquedaTramoRutaOrigemDestino(rutaId, unoOrigenId, unoDestinoId); return rutaCombinacion.getTramo().getKmReal(); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java index d493d7c5b..3a594be6c 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java @@ -70,7 +70,7 @@ public class CategoriaCtrlServiceImpl implements CategoriaCtrlService { * @param categoriaCtrl */ @Override - public CategoriaCtrl checarCategoriaAdulto(CategoriaCtrl categoriaCtrl) { + public CategoriaCtrl checarCategoriaAdulto(CategoriaCtrl categoriaCtrl, Boolean rdVendeAbertoSim, Boolean chkCancelaEmAberto, Boolean chkDevolveEmAberto, Boolean chkCancelaEmergencialEmAberto, Boolean chkTrocaTiturlidadeEmAberto, Boolean chkTrocaEmAberto) { boolean existeAdulto = false; List lsCategorias = new ArrayList(); lsCategorias.addAll(categoriaCtrl.getCategoriaDescuentoList()); @@ -82,6 +82,24 @@ public class CategoriaCtrlServiceImpl implements CategoriaCtrlService { } if (!existeAdulto) { CategoriaDescuento categoriaDescuentoAdulto = this.getCategoriaDescuentoAdulto(categoriaCtrl); + + categoriaDescuentoAdulto.setIndVentaAbierto(rdVendeAbertoSim); + + if(rdVendeAbertoSim) { + //Aberto Vendido + categoriaDescuentoAdulto.setIndCancelaEmAberto(chkCancelaEmAberto); + categoriaDescuentoAdulto.setIndDevolveEmAberto(chkDevolveEmAberto); + categoriaDescuentoAdulto.setIndCancelaEmergencialEmAberto(chkCancelaEmergencialEmAberto); + categoriaDescuentoAdulto.setIndTrocaTitularidadeEmAberto(chkTrocaTiturlidadeEmAberto); + categoriaDescuentoAdulto.setIndTrocaEmAberto(chkTrocaEmAberto); + } else { + categoriaDescuentoAdulto.setIndCancelaEmAberto(false); + categoriaDescuentoAdulto.setIndDevolveEmAberto(false); + categoriaDescuentoAdulto.setIndCancelaEmergencialEmAberto(false); + categoriaDescuentoAdulto.setIndTrocaTitularidadeEmAberto(false); + categoriaDescuentoAdulto.setIndTrocaEmAberto(false); + } + lsCategorias.add(categoriaDescuentoAdulto); } categoriaCtrl.setCategoriaDescuentoList(lsCategorias); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java index 136f62ab2..8d771db86 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java @@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.Calendar; import java.util.List; +import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -10,7 +11,11 @@ import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.CoeficienteTarifaDAO; import com.rjconsultores.ventaboletos.dao.OrgaoTramoDAO; import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.service.CoeficienteTarifaService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -21,13 +26,26 @@ public class CoeficienteTarifaServiceImpl implements CoeficienteTarifaService { private CoeficienteTarifaDAO coeficienteTarifaDAO; @Autowired private OrgaoTramoDAO orgaoTramoDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; + private static Logger log = Logger.getLogger(OrgaoConcedenteServiceImpl.class); + public List obtenerTodos() { return coeficienteTarifaDAO.obtenerTodos(); } public CoeficienteTarifa obtenerID(Integer id) { - return coeficienteTarifaDAO.obtenerID(id); + + CoeficienteTarifa coeficienteTarifa = coeficienteTarifaDAO.obtenerID(id); + + try { + coeficienteTarifa.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return coeficienteTarifa; + } @Transactional @@ -36,16 +54,33 @@ public class CoeficienteTarifaServiceImpl implements CoeficienteTarifaService { entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - return coeficienteTarifaDAO.suscribir(entidad); + + entidad = coeficienteTarifaDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, null); + return entidad; } @Transactional public CoeficienteTarifa actualizacion(CoeficienteTarifa entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.TRUE); + + + try { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + CoeficienteTarifa originalClone = entidad.getCloneObject(); + entidad = coeficienteTarifaDAO.actualizacion(entidad); + + logAuditoriaService.auditar(originalClone, entidad, null); - return coeficienteTarifaDAO.actualizacion(entidad); + + } catch (Exception e) { + log.error(e); + } + + return entidad; } @Transactional @@ -62,8 +97,9 @@ public class CoeficienteTarifaServiceImpl implements CoeficienteTarifaService { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.FALSE); - - coeficienteTarifaDAO.actualizacion(entidad); + + entidad = coeficienteTarifaDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad, null); } public List buscar(String nomb) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java index 87b1af738..16164e4c0 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java @@ -14,9 +14,11 @@ import java.util.TreeSet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import com.rjconsultores.ventaboletos.dao.ParadaDAO; import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.Ruta; import com.rjconsultores.ventaboletos.service.ConexionRutaCombinacionService; +import com.rjconsultores.ventaboletos.service.ParadaService; import com.rjconsultores.ventaboletos.service.RutaCombinacionService; import com.rjconsultores.ventaboletos.vo.conexion.OrdenarLocalidadesGeradas; import com.rjconsultores.ventaboletos.vo.parada.ConexionCtrlVO; @@ -28,6 +30,9 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci @Autowired private RutaCombinacionService rutaCombinacionService; + + @Autowired + private ParadaService paradaService; private Map criandoCacheLocalidades(List list) { Map cacheLocalidades = new HashMap(); @@ -258,6 +263,20 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci localidades.addAll(listParada2); localidades.addAll(listParada3); localidades.addAll(listParada4); + List localidadesAux = new ArrayList(); + localidadesAux.addAll(localidades); + for (Parada parada : localidadesAux) { + if(parada.getAgrupamentoParada() !=null) { + List paradaAgrupamentoList = paradaService.buscarPorAgrupamentoParadaId(parada.getAgrupamentoParada()); + if(paradaAgrupamentoList!=null && !paradaAgrupamentoList.isEmpty()) { + for (Parada paradaAgrupamento : paradaAgrupamentoList) { + if(!localidades.contains(paradaAgrupamento)) { + localidades.add(paradaAgrupamento); + } + } + } + } + } Map cacheLocalidades = criandoCacheLocalidades(localidades); gerarCombinacao(lists, rutasEixoA, rutasEixoB, null, localidadesGeradas, conexoesCtrl, cacheLocalidades); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java index 7f64e39b2..1bc4bd16f 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java @@ -10,13 +10,21 @@ import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.ConexionRutaTramoCtrlDAO; import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; import com.rjconsultores.ventaboletos.entidad.ConexionRutaTramoCtrl; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.service.ConexionRutaTramoCtrlService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +/** + * @author valdevir.silva + * + */ @Service("conexionRutaTramoCtrlService") public class ConexionRutaTramoCtrlServiceImpl implements ConexionRutaTramoCtrlService { + private static final char EIXO_C = 'C'; + private static final char EIXO_B = 'B'; + private static final char EIXO_A = 'A'; @Autowired private ConexionRutaTramoCtrlDAO conexionRutaTramoCtrlDAO; @@ -80,19 +88,40 @@ public class ConexionRutaTramoCtrlServiceImpl implements ConexionRutaTramoCtrlSe return conexionRutaTramoCtrlDAO.validarConexioneRutasExistentes(rutaOrigenId, rutaDestinoId, rutaDestinoCId, paradaOrigenId, paradaDestinoId, origemTrechoId, destinoTrechoId); } + /** + *Busca localidades cadastradas para Eixo A + */ @Override - public List buscarLocalidadesOrigem(Integer conexionRutaConfId) { - return conexionRutaTramoCtrlDAO.buscarPorConexionRutaConf(conexionRutaConfId, 'A'); + public List buscarLocalidadesEixoA(Integer conexionRutaConfId) { + return validaAgrupamentoLocalidade(conexionRutaTramoCtrlDAO.buscarLocalidadesPorConexionRutaConfAndEixo(conexionRutaConfId, EIXO_A)); + + } + + public List validaAgrupamentoLocalidade(List localidadesList){ + for (Parada parada : localidadesList) { + if(parada.getAgrupamentoParada()!=null) { + parada.setDescparada(parada.getAgrupamentoParada().getDescAgrupamentoParada()); + parada.setCveparada(parada.getAgrupamentoParada().getCveAgrupamentoParada()); + } + } + return localidadesList; } + + /** + *Busca localidades castradas para Eixo B + */ @Override - public List buscarLocalidadesDestino(Integer conexionRutaConfId) { - return conexionRutaTramoCtrlDAO.buscarPorConexionRutaConf(conexionRutaConfId, 'B'); + public List buscarLocalidadeEixoB(Integer conexionRutaConfId) { + return validaAgrupamentoLocalidade(conexionRutaTramoCtrlDAO.buscarLocalidadesPorConexionRutaConfAndEixo(conexionRutaConfId, EIXO_B)); } + /** + *Busca localidades cadastradas para Eixo C + */ @Override - public List buscarLocalidadesDestinoC(Integer conexionRutaConfId) { - return conexionRutaTramoCtrlDAO.buscarPorConexionRutaConf(conexionRutaConfId, 'C'); + public List buscarLocalidadesEixoC(Integer conexionRutaConfId) { + return validaAgrupamentoLocalidade(conexionRutaTramoCtrlDAO.buscarLocalidadesPorConexionRutaConfAndEixo(conexionRutaConfId, EIXO_C)); } @Override diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java index 66f580703..2ea615f59 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java @@ -31,8 +31,8 @@ public class ConexionServiceImpl implements ConexionService { } @Override - public List buscarConexiones(Integer origenId, Integer destinoId) { - return conexionDAO.buscarConexiones(origenId, destinoId); + public List buscarConexiones(boolean isBuscaAgrupada, Integer origenId, Integer destinoId) { + return conexionDAO.buscarConexiones(isBuscaAgrupada, origenId, destinoId); } @Override diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java index 9b8231160..dc1b5e984 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java @@ -424,7 +424,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic public boolean isEventosFinanceirosSemConferencia(List lsEventosFinanceiros) throws BusinessException { for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { if ((eventosFinanceiros.isExigeConferencia() || eventosFinanceiros.getExigeConferenciaAba()) && - (!eventosFinanceiros.isConferido() && eventosFinanceiros.getLogconferenciaId() == null)) { + (!eventosFinanceiros.isConferido() && (eventosFinanceiros.getLogconferenciaId() == null || eventosFinanceiros.getLogconferenciaId() == 0))) { return true; } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java index 7ffb7d733..48f1e2071 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java @@ -29,6 +29,7 @@ public class ConstanteServiceImpl implements ConstanteService { public static final String URL_PAINEL_BPE = "URL_PAINEL_BPE"; public static final String URL_API = "URL_API"; + public static final String URL_API_EMB = "URL_API_EMB"; public List obtenerTodos() { return constanteDAO.obtenerTodos(); @@ -142,6 +143,16 @@ public class ConstanteServiceImpl implements ConstanteService { return ""; } + return constante.getValorconstante(); + } + @Override + public String buscarURLAPIEmb(){ + Constante constante = constanteDAO.buscarPorNomeConstante(URL_API_EMB); + + if (constante == null) { + return ""; + } + return constante.getValorconstante(); } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ControleSerieEmbarcadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ControleSerieEmbarcadaServiceImpl.java index 45ff6b92f..99129233b 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ControleSerieEmbarcadaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ControleSerieEmbarcadaServiceImpl.java @@ -53,16 +53,23 @@ public class ControleSerieEmbarcadaServiceImpl implements ControleSerieEmbarcada // Caso não haja reaproveitamento de série, devo buscar a próxima série disponível na sequência padrão if (serieembarcada == null) { log.info("BuscarSerieEmbarcada :: Reaproveitamento nao disponivel"); - + Integer serieVlmax, SerieEmbarcada, serieBpe, serie, serieBpeSeq; CtrlSerieBPe ctrlSerieBpe = ctrlSerieBPeDAO.buscarPorEmpresaEstado(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getEstadoId()); - - Integer serie = (ctrlSerieBpe == null ? 1 : Integer.valueOf(ctrlSerieBpe.getSerie()) + 1); + if( ctrlSerieBpe == null || ctrlSerieBpe.getSerie() == null ) { + log.info(String.format("BuscarSerieEmbarcada :: Serie não encontrada para Empresa:%s Estado:%s" , controleSerieEmbarcada.getEmpresa().getEmpresaId(),controleSerieEmbarcada.getEstado())); + throw new RuntimeException( String.format("Serie não encontrada para Empresa:%s Estado:%s" , controleSerieEmbarcada.getEmpresa().getEmpresaId(),controleSerieEmbarcada.getEstado()) ); + } + + serieBpe = Integer.valueOf(ctrlSerieBpe.getSerie()); + SerieEmbarcada = ctrlSerieBPeDAO.buscarSerieEmb(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getEstadoId().toString()); + serieVlmax = (serieBpe < SerieEmbarcada ? SerieEmbarcada : serieBpe); + serie = (serieVlmax == null ? 1 : serieVlmax + 1); log.info(String.format("BuscarSerieEmbarcada :: Serie em uso [%d]", serie)); ctrlSerieBPeDAO.gerarSeqSerieBPe(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getCveestado(), serie); - - serie = ctrlSerieBPeDAO.buscarSequencia(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getCveestado()); + serieBpeSeq = ctrlSerieBPeDAO.buscarSequencia(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getCveestado()); + serie = (serie <= serieBpeSeq ? serieBpeSeq : serie); log.info(String.format("BuscarSerieEmbarcada :: Serie selecionada [%d]", serie)); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java index 8b155b2da..e2e80e21b 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java @@ -4,6 +4,7 @@ */ package com.rjconsultores.ventaboletos.service.impl; +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; @@ -768,7 +769,7 @@ public class CorridaServiceImpl implements CorridaService { } } - } catch (org.springframework.dao.DataIntegrityViolationException ex) { + } catch (Exception ex) { log.error("", ex); } @@ -1060,7 +1061,7 @@ public class CorridaServiceImpl implements CorridaService { for (CorridaTramo corridaTramo : corrida.getCorridaTramoList()) { //(Se origem corridatramo = origem cadastrada && destino corridatramo = destino cadastrado) - // ou (se origem corridatramo = destino do cadastrado), tendo em vista que corridatramo são a sequencias e não as combinações + // ou (se origem corridatramo = destino do cadastrado), tendo em vista que corridatramo são as sequencias e não as combinações if(corridaTramo.getOrigem()!=null && corridaTramo.getOrigem().getParadaId().intValue()==unoTerminalOrigenId.intValue() && corridaTramo.getDestino()!=null && corridaTramo.getDestino().getParadaId().intValue()==unoTerminalDestinoId.intValue()) { fecViaje = corridaTramo.getFechorsalidaH(); @@ -1082,14 +1083,18 @@ public class CorridaServiceImpl implements CorridaService { log.error("Reserva não será realizada. Não foi encontrado Tarifa com Origem:" + unoTerminalOrigenId + " Destino:" +unoTerminalDestinoId + " para a corrida:" + corrida.getId().getCorridaId()); continue; } - Float valorTarifa= tarifa!=null ? tarifa.getPrecio().floatValue() : null ; + BigDecimal valorTarifa= tarifa!=null ? tarifa.getPrecio() : null ; + BigDecimal valorSeguro= tarifa!=null ? tarifa.getImporteseguro() : null ; + BigDecimal valorTaxaEmbarque= tarifa!=null ? tarifa.getImportetaxaembarque() : null ; + BigDecimal valorPedagio = tarifa!=null ? tarifa.getImportepedagio() : null ; Long tempoReserva = null; Cliente cliente = clienteService.obtenerID(reservaEspecialCliente.getClienteId().intValue()); boletoService.criaBoletoReserva(unoAsientoSelec, unaCorridaId, unaFecCorrida, unoTerminalOrigenId, unoTerminalDestinoId, unoTipoVenta, unaCategoriaSelec, unoNumeOperacion, unUsuarioId, unPuntoVenta, reservaEspecialCliente.getClienteId().intValue(), corrida.getRuta().getRutaId(), valorTarifa, tempoReserva, estacionId, cliente.getNumIdentificaUno(), cliente.getListClienteFidelidad().get(0).getClienteFidelidadId().toString(), - corrida.getClaseServicio().getClaseservicioId(), corrida.getMarca().getMarcaId(), fecViaje, corrida.getEmpresa().getEmpresaId(), cliente.getNombcliente()); + corrida.getClaseServicio().getClaseservicioId(), corrida.getMarca().getMarcaId(), fecViaje, corrida.getEmpresa().getEmpresaId(), + cliente.getNombcliente(), valorSeguro, valorTaxaEmbarque, valorPedagio); } } } @@ -1295,7 +1300,7 @@ public class CorridaServiceImpl implements CorridaService { log.info("commit bloco corridas"); transactionManager.commit(status); status = transactionManager.getTransaction(def); - } catch (Throwable ex) { + } catch (Exception ex) { log.error("", ex); log.error(" Erro ao gerar corrida = " + esquemaCorrida.getNumCorrida() + " esquemaCorrida = " + esquemaCorrida.getEsquemacorridaId()); transactionManager.rollback(status); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java index ff4ba511f..352ed5e62 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java @@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.Calendar; import java.util.List; +import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -24,6 +25,7 @@ import com.rjconsultores.ventaboletos.entidad.Marca; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.service.MarcaService; import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -46,13 +48,25 @@ public class EmpresaServiceImpl implements EmpresaService { @Autowired private EsquemaCorridaDAO esquemaCorridaDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; + private static Logger log = Logger.getLogger(EmpresaServiceImpl.class); + public List obtenerTodos() { return empresaDAO.obtenerTodos(); } public Empresa obtenerID(Integer id) { - return empresaDAO.obtenerID(id); + + Empresa empresa = empresaDAO.obtenerID(id); + try { + empresa.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return empresa; + } @Transactional @@ -69,11 +83,19 @@ public class EmpresaServiceImpl implements EmpresaService { if (entidad.getEmpresaId() == null) { entidad = empresaDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, null); + gerarMarca(entidad); } else { - entidad = empresaDAO.actualizacion(entidad); + try { + Empresa empresaClone = entidad.getCloneObject(); + entidad = empresaDAO.actualizacion(entidad); + logAuditoriaService.auditar(empresaClone, entidad, entidad.getEmpresaId()); + } catch (Exception e) { + log.error(e); + } } if (comEmpConferencia != null) { @@ -107,6 +129,8 @@ public class EmpresaServiceImpl implements EmpresaService { entidad.setActivo(Boolean.FALSE); empresaDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad,null); + } public List buscar(String nombempresa, Boolean indExterna, Short indTipo) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java index 8d1163706..cc4934f4a 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java @@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.Date; import java.util.List; +import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -12,12 +13,17 @@ import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.service.FechamentoParamptovtaService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; @Service("fechamentoParamptovtaService") public class FechamentoParamptovtaServiceImpl implements FechamentoParamptovtaService { @Autowired private FechamentoParamptovtaDAO fechamentoParamptovtaDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; + private static Logger log = Logger.getLogger(FechamentoParamptovtaServiceImpl.class); + @Override public List obtenerTodos() { @@ -26,26 +32,47 @@ public class FechamentoParamptovtaServiceImpl implements FechamentoParamptovtaSe @Override public FechamentoParamptovta obtenerID(Long id) { - return fechamentoParamptovtaDAO.obtenerID(id); + + FechamentoParamptovta fechamentoParamptovta = fechamentoParamptovtaDAO.obtenerID(id); + try { + fechamentoParamptovta.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return fechamentoParamptovta; + } @Override @Transactional public FechamentoParamptovta suscribir(FechamentoParamptovta entidad) { - return fechamentoParamptovtaDAO.suscribir(entidad); + + fechamentoParamptovtaDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, entidad.getEmpresa() != null && entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + return entidad; } @Override @Transactional public FechamentoParamptovta actualizacion(FechamentoParamptovta entidad) { entidad.setFecmodif(new Date()); - return fechamentoParamptovtaDAO.actualizacion(entidad); + FechamentoParamptovta originalClone = null; + try { + originalClone = entidad.getCloneObject(); + } catch (Exception e) { + log.error("",e); + } + fechamentoParamptovtaDAO.actualizacion(entidad); + logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + return entidad; } @Override @Transactional public void borrar(FechamentoParamptovta entidad) { + fechamentoParamptovtaDAO.borrar(entidad); + logAuditoriaService.auditarExclusao(entidad, entidad.getEmpresa() != null && entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java index 1dcce15a8..c398a7859 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java @@ -4,16 +4,22 @@ */ package com.rjconsultores.ventaboletos.service.impl; -import com.rjconsultores.ventaboletos.dao.FormaPagoDAO; -import com.rjconsultores.ventaboletos.entidad.FormaPago; -import com.rjconsultores.ventaboletos.service.FormaPagoService; -import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import java.util.Calendar; import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.rjconsultores.ventaboletos.dao.FormaPagoDAO; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.service.FormaPagoService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + /** * * @author Administrador @@ -25,13 +31,27 @@ public class FormaPagoServiceImpl implements FormaPagoService { @Autowired private FormaPagoDAO formaPagoDAO; + private static Logger log = LoggerFactory.getLogger(PuntoVentaServiceImpl.class); + @Autowired + private LogAuditoriaService logAuditoriaService; + public List obtenerTodos() { return formaPagoDAO.obtenerTodos(); } public FormaPago obtenerID(Short id) { - return formaPagoDAO.obtenerID(id); + + + FormaPago formaPago = formaPagoDAO.obtenerID(id); + + try { + formaPago.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return formaPago; + } @Transactional @@ -39,17 +59,32 @@ public class FormaPagoServiceImpl implements FormaPagoService { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - - return formaPagoDAO.suscribir(entidad); + + + formaPagoDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, null); + + return entidad; } @Transactional public FormaPago actualizacion(FormaPago entidad) { + + FormaPago originalClone = null; + try { + originalClone = entidad.getCloneObject(); + } catch (CloneNotSupportedException e) { + log.error(e.getMessage(), e); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - - return formaPagoDAO.actualizacion(entidad); + + formaPagoDAO.actualizacion(entidad); + logAuditoriaService.auditar(originalClone, entidad, -1); + + return entidad; } @Transactional @@ -59,6 +94,7 @@ public class FormaPagoServiceImpl implements FormaPagoService { entidad.setActivo(Boolean.FALSE); formaPagoDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad, null); } public List buscarPorDescricao(String descpago) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java index 82838b3b2..300608c6e 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java @@ -214,9 +214,20 @@ public class ImportacaoClientesSrvpServiceImpl implements ImportacaoClientesSrvp Cell cell = cellIterator.next(); switch (cell.getColumnIndex()) { case 0: - cell.setCellType(Cell.CELL_TYPE_NUMERIC); try { - cliente.setNumfidelidade(new Long(Math.round(cell.getNumericCellValue())).toString()); + if(cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { + cliente.setNumfidelidade(new Long(Math.round(cell.getNumericCellValue())).toString()); + }else { + if(StringUtils.isNotBlank(cell.getStringCellValue())) { + try { + cliente.setNumfidelidade(new Long(cell.getStringCellValue().trim().replaceAll(" ","")).toString()); + }catch (NumberFormatException e) { + cliente.setTelefone(""); + erros.append(cliente.getNumfidelidade() + " - Numero de Telefone incorreto: " + cell.getStringCellValue().trim().replaceAll(" ","").toString()); + erros.append("\n"); + } + } + } }catch(Exception e) { log.error("Erro na gravação do registro. Favor revisar",e); } @@ -230,7 +241,7 @@ public class ImportacaoClientesSrvpServiceImpl implements ImportacaoClientesSrvp cliente.setTipodoc(cell.getStringCellValue()); break; case 3: - cell.setCellType(Cell.CELL_TYPE_NUMERIC); + cell.setCellType(Cell.CELL_TYPE_STRING); String numDocString = null; try { numDocString = new Long(Math.round(cell.getNumericCellValue())).toString(); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java index 1316abf6c..a5241d8c7 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java @@ -63,11 +63,11 @@ public class ImportacaoRetornoBancarioServiceImpl implements ImportacaoRetornoBa detalhado.append("Nao Quitado: ").append(detalhe.getNossoNumero()).append(".\n"); } } catch (SQLException se) { - detalhado.append("Ocorreu um erro no banco de dados: ").append(detalhe.getNossoNumero()); + detalhado.append("Ocorreu um erro no banco de dados: ").append(detalhe.getNossoNumero()).append(".\n"); log.error(se); erros++; } catch (RuntimeException re) { - detalhado.append(re.getMessage()); + detalhado.append(re.getMessage()).append(".\n"); log.error(re); erros++; } @@ -126,7 +126,7 @@ public class ImportacaoRetornoBancarioServiceImpl implements ImportacaoRetornoBa if(linha.startsWith("1")) { //detalhe DetalheRetornoItau detalhe = new DetalheRetornoItau(); - detalhe.setNossoNumero(linha.substring(62, 70)); + detalhe.setNossoNumero(linha.substring(85, 93)+"-"+linha.substring(93, 94)); arquivo.addTitulo(detalhe); continue; } @@ -148,11 +148,11 @@ public class ImportacaoRetornoBancarioServiceImpl implements ImportacaoRetornoBa FechamentoBoleto boleto = remessaCNABBancosDAO.obtenerFechamentoBoletoPorNossoNumero( detalhe.getNossoNumero(), empresaId ); if(boleto == null) { - throw new RuntimeException("Fechamento não encontrado para a empresa com o nosso numero: "+detalhe.getNossoNumero()+"\n"); + throw new RuntimeException("Fechamento não encontrado para a empresa com o nosso numero: "+detalhe.getNossoNumero()); } if( boleto.getIndBoletoQuitado() !=null && boleto.getIndBoletoQuitado()) { - throw new RuntimeException("Boleto já quitado para a empresa com o nosso numero: "+detalhe.getNossoNumero()+"\n"); + throw new RuntimeException("Boleto já quitado para a empresa com o nosso numero: "+detalhe.getNossoNumero()); } return remessaCNABBancosDAO.quitarFechamentoBoleto( boleto.getFechamentoboletoId(), usuarioId ); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java index 893df71c6..03ced7a71 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java @@ -3,12 +3,14 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.Calendar; import java.util.List; +import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.OrgaoConcedenteDAO; import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -17,13 +19,24 @@ public class OrgaoConcedenteServiceImpl implements OrgaoConcedenteService { @Autowired private OrgaoConcedenteDAO orgaoConcedenteDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; + private static Logger log = Logger.getLogger(OrgaoConcedenteServiceImpl.class); public List obtenerTodos() { return orgaoConcedenteDAO.obtenerTodos(); } public OrgaoConcedente obtenerID(Integer id) { - return orgaoConcedenteDAO.obtenerID(id); + + OrgaoConcedente orgaoConcedente = orgaoConcedenteDAO.obtenerID(id); + try { + orgaoConcedente.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return orgaoConcedente; + } @Transactional @@ -31,17 +44,30 @@ public class OrgaoConcedenteServiceImpl implements OrgaoConcedenteService { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - - return orgaoConcedenteDAO.suscribir(entidad); + + orgaoConcedenteDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, null); + + return entidad; } @Transactional public OrgaoConcedente actualizacion(OrgaoConcedente entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.TRUE); + + try { + OrgaoConcedente originalClone = entidad.getCloneObject(); + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); - return orgaoConcedenteDAO.actualizacion(entidad); + entidad = orgaoConcedenteDAO.actualizacion(entidad); + logAuditoriaService.auditar(originalClone, entidad, null); + } catch (Exception e) { + log.error(e); + } + + return entidad; } @Transactional @@ -51,6 +77,8 @@ public class OrgaoConcedenteServiceImpl implements OrgaoConcedenteService { entidad.setActivo(Boolean.FALSE); orgaoConcedenteDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad, null); + } public List buscar(String desc) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java index cbf190d03..135b00701 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java @@ -15,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.ParadaDAO; import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.entidad.AgrupamentoParada; import com.rjconsultores.ventaboletos.entidad.Ciudad; import com.rjconsultores.ventaboletos.entidad.Nodo; import com.rjconsultores.ventaboletos.entidad.Parada; @@ -174,4 +175,8 @@ public class ParadaServiceImpl implements ParadaService { public List buscaParadaRegionMetropolitana(RegionMetropolitana regionMetropolitana){ return paradaDAO.buscaParadaRegionMetropolitana(regionMetropolitana); } + + public List buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada){ + return paradaDAO.buscarPorAgrupamentoParadaId(agrupamentoParada); + } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java index 7330b753c..8941e1eac 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java @@ -5,14 +5,18 @@ package com.rjconsultores.ventaboletos.service.impl; import com.rjconsultores.ventaboletos.dao.PtovtaComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.PtovtaComissao; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.service.PtovtaComissaoService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import java.util.Calendar; import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -24,15 +28,26 @@ import org.springframework.transaction.annotation.Transactional; @Service("ptovtaComissaoService") public class PtovtaComissaoServiceImpl implements PtovtaComissaoService { + private static Logger log = LoggerFactory.getLogger(PtovtaComissaoServiceImpl.class); + @Autowired private PtovtaComissaoDAO ptovtaComissaoDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; public List obtenerTodos() { return ptovtaComissaoDAO.obtenerTodos(); } public PtovtaComissao obtenerID(Integer id) { - return ptovtaComissaoDAO.obtenerID(id); + + PtovtaComissao ptovtaComissao = ptovtaComissaoDAO.obtenerID(id); + try { + ptovtaComissao.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return ptovtaComissao; } @Transactional @@ -41,16 +56,35 @@ public class PtovtaComissaoServiceImpl implements PtovtaComissaoService { entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - return ptovtaComissaoDAO.suscribir(entidad); + ptovtaComissaoDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, entidad.getEmpresaId() != null ? entidad.getEmpresaId().getEmpresaId() : null); + + return entidad; + + } @Transactional public PtovtaComissao actualizacion(PtovtaComissao entidad) { + + + PtovtaComissao originalClone = null; + try { + originalClone = entidad.getCloneObject(); + } catch (Exception e) { + log.error("",e); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); + + ptovtaComissaoDAO.actualizacion(entidad); + + logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresaId() != null ? entidad.getEmpresaId().getEmpresaId() : null); + + return entidad; - return ptovtaComissaoDAO.actualizacion(entidad); } @Transactional diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java index 2691c7140..c89d55af2 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java @@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.service.impl; import com.rjconsultores.ventaboletos.dao.PtovtaTitularDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.entidad.PtovtaTitular; import com.rjconsultores.ventaboletos.service.PtovtaTitularService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -31,7 +32,14 @@ public class PtovtaTitularServiceImpl implements PtovtaTitularService { } public PtovtaTitular obtenerID(Integer id) { - return ptovtaTitularDAO.obtenerID(id); + + PtovtaTitular ptovtaTitular = ptovtaTitularDAO.obtenerID(id); + try { + ptovtaTitular.clonar(); + } catch (Exception e) { + e.printStackTrace(); + } + return ptovtaTitular; } @Transactional diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java index b693105f9..47dd51eb9 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -38,6 +38,7 @@ import com.rjconsultores.ventaboletos.exception.IntegracionException; import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; import com.rjconsultores.ventaboletos.service.ConstanteService; import com.rjconsultores.ventaboletos.service.EstacionService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.service.PuntoVentaService; import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; import com.rjconsultores.ventaboletos.utilerias.CustomEnum; @@ -82,6 +83,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { private UsuarioUbicacionDAO usuarioUbicacionDAO; @Autowired private DataSource dataSource; + @Autowired + private LogAuditoriaService logAuditoriaService; // FIXME : Remover esse método de quem está usando. Esse método carrega muitos dados @Deprecated @@ -90,7 +93,15 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { } public PuntoVenta obtenerID(Integer id) { - return puntoVentaDAO.obtenerID(id); + + PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(id); + + try { + puntoVenta.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return puntoVenta; } @Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class}) @@ -161,7 +172,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { throw (IntegracionException) respEx; } } - entidad = puntoVentaDAO.suscribir(entidad); + entidad = puntoVentaDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + // Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso. // Integração AG @@ -418,6 +431,14 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { @Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class}) public PuntoVenta actualizacion(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException { + + PuntoVenta originalClone = null; + try { + originalClone = entidad.getCloneObject(); + originalClone.setTitularId(entidad.getTitularId().getCloneObject()); + } catch (Exception e) { + log.error("",e); + } entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); @@ -475,7 +496,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { } } } + entidad = puntoVentaDAO.actualizacion(entidad); + logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); if (respEx != null) { if (respEx instanceof IntegracionException) { @@ -549,6 +572,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { entidad.setActivo(Boolean.FALSE); puntoVentaDAO.actualizacion(entidad); + + logAuditoriaService.auditarExclusao(entidad, entidad.getEmpresa() != null && entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + } public List buscaLike(String strEstacion, boolean sinTodos) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java index 57bd3e17a..4d7ad79dc 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java @@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.ArrayList; import java.util.Calendar; +import java.util.Date; import java.util.HashMap; import java.util.List; @@ -234,6 +235,7 @@ public class RutaServiceImpl implements RutaService { } Boolean isClone = entidad.getIsClone() != null ? entidad.getIsClone() : Boolean.FALSE; + Boolean isCadastro = entidad.getIsCadastro(); if (entidad.getRutaId() == null) { entidad = rutaDAO.suscribir(entidad); @@ -241,7 +243,7 @@ public class RutaServiceImpl implements RutaService { entidad = rutaDAO.actualizacion(entidad); } if (lsParadasSequencia != null) { - if (!isClone) { + if (!isClone && !isCadastro) { generarSecuencias(entidad, lsParadasSequencia); } generarCombinacion(entidad); @@ -283,9 +285,10 @@ public class RutaServiceImpl implements RutaService { ClaseServicio claseServicio = ruta.getClaseServicio(); Tramo tramo = tramoService.obtenerTramoUnicoRuta(ori, des, via, claseServicio); - - if (tramo != null) { - + if (tramo == null && isCopiaComAlteracaoDeClasse(ruta)) { + tramo = tramoService.obtenerTramoUnicoRuta(ori, des, via, ruta.getClaseServicioRutaOrigem()); + } + if (tramo != null ) { RutaSecuencia rutaSecuencia = new RutaSecuencia(); rutaSecuencia.setRuta(ruta); rutaSecuencia.setTramo(tramo); @@ -295,10 +298,30 @@ public class RutaServiceImpl implements RutaService { rutaSecuencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); rutaSecuencia.setKmOriginal(tramo.getKmReal()); rutaSecuencia = rutaSecuenciaService.suscribir(rutaSecuencia); - - List lsRutaCaseta = rutaSecuenciaBackup.get(tramo.getTramoId()); - if( lsRutaCaseta != null && !lsRutaCaseta.isEmpty() ) { - rutaSecuencia.setLsRutaCase(lsRutaCaseta); + + List lsRutaCaseta; + if (ruta.getIsClone()) { + lsRutaCaseta = lsParadasSequencia.get(i).getCasetas(); + if (lsRutaCaseta != null && !lsRutaCaseta.isEmpty()) { + List rutasCaseta = new ArrayList(); + + for (RutaCaseta rc : lsRutaCaseta) { + RutaCaseta rutaCaseta = new RutaCaseta(); + rutaCaseta.setRutaSecuencia(rutaSecuencia); + rutaCaseta.setCasetaPeaje(rc.getCasetaPeaje()); + rutaCaseta.setActivo(Boolean.TRUE); + rutaCaseta.setFecmodif(new Date()); + rutaCaseta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rutasCaseta.add(rutaCaseta); + } + + rutaSecuencia.setLsRutaCase(rutasCaseta); + } + } else { + lsRutaCaseta = rutaSecuenciaBackup.get(tramo.getTramoId()); + if (lsRutaCaseta != null && !lsRutaCaseta.isEmpty()) { + rutaSecuencia.setLsRutaCase(lsRutaCaseta); + } } @@ -312,6 +335,10 @@ public class RutaServiceImpl implements RutaService { } } + private boolean isCopiaComAlteracaoDeClasse(Ruta ruta) { + return ruta.getIsClone() && ruta.getClaseServicioRutaOrigem() != null && (ruta.getClaseServicioRutaOrigem().getClaseservicioId() != ruta.getClaseServicio().getClaseservicioId()); + } + @Transactional(rollbackFor = BusinessException.class) public Ruta actualizacion(Ruta ruta, List lsParadasSequencia) throws BusinessException { if (lsParadasSequencia != null) { @@ -434,9 +461,17 @@ public class RutaServiceImpl implements RutaService { } private boolean indVenta(Ruta ruta, Tramo trBuscaOrigemDestino) { - for (RutaCombinacion rc : ruta.getRutaCombinacionList()) { - if (rc.getTramo().equals(trBuscaOrigemDestino)) { - return rc.getIndventa(); + if (!ruta.getIsClone()) { + for (RutaCombinacion rc : ruta.getRutaCombinacionList()) { + if (rc.getTramo().equals(trBuscaOrigemDestino)) { + return rc.getIndventa(); + } + } + } else { + for (RutaCombinacion rcTemporaria : ruta.getRutaCombinacionTemporariaList()) { + if (rcTemporaria.getTramo().equals(trBuscaOrigemDestino)) { + return rcTemporaria.getIndventa(); + } } } return true; diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java index 1e4a76a6f..24a35e7fe 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java @@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.Date; import java.util.List; +import org.apache.log4j.Logger; import org.codehaus.jettison.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -15,6 +16,7 @@ import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente; import com.rjconsultores.ventaboletos.rest.IntegracaoSapRest; import com.rjconsultores.ventaboletos.service.SapService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO; @Service("sapService") @@ -22,6 +24,9 @@ public class SapServiceImpl implements SapService{ private static final String INTEGRACAO_SAP_URL = "INTEGRACAO_SAP_URL"; private static final String INTEGRACAO_SAP_CREDENCIAL = "INTEGRACAO_SAP_CREDENCIAL"; + private static final int INTEGRACAO_SAP_OK = 1; + private static final int INTEGRACAO_SAP_ERRO = 2; + private static Logger log = Logger.getLogger(SapServiceImpl.class); @Autowired private SapDAO sapDAO; @@ -76,12 +81,14 @@ public class SapServiceImpl implements SapService{ JSONObject integrado = integracaoSapRest.enviarIntegracaoSap(fechamentoCntcorrente, url, credenciais); if(integrado == null) { - throw new RuntimeException("Erro no envio/retorno da requisicao para integração SAP"); + atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), INTEGRACAO_SAP_ERRO); + log.error("Erro no envio/retorno da requisicao para integração SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId()); }else if(integrado.getString("Integration").equals("S")) { - atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId()); + atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), INTEGRACAO_SAP_OK); contador++; }else if(integrado.getString("Integration").equals("E")) { - throw new RuntimeException("Retorno enviado pelo SAP: \r\n"+integrado.getString("Message")); + atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), INTEGRACAO_SAP_ERRO); + log.warn("Retorno enviado pelo SAP: \r\n"+integrado.getString("Message")); } } } @@ -94,8 +101,8 @@ public class SapServiceImpl implements SapService{ } } - private boolean atualizaFechamento(Long fechamentocntcorrenteId) throws Exception { - return sapDAO.atualizaFechamento( fechamentocntcorrenteId); + private boolean atualizaFechamento(Long fechamentocntcorrenteId, int status) throws Exception { + return sapDAO.atualizaFechamento( fechamentocntcorrenteId, status); } private String buscaConstante(String constanteString) { @@ -110,10 +117,18 @@ public class SapServiceImpl implements SapService{ @Override public void integracaoSapAutomatica() throws Exception { - List listaPendente = obtenerTodosParaRemessa(null, new Date(), new Date(), false); + List listaPendente = obtenerTodosParaRemessa(null, DateUtil.getYesterdayDate(), new Date(), false); - if(!listaPendente.isEmpty()) { - remessa(listaPendente); + while(!listaPendente.isEmpty()) { + log.info("IntegracaoSap: Registro a enviar:"+listaPendente.size()); + + try { + remessa(listaPendente); + } catch (Exception e) { + throw e; + } + + listaPendente = obtenerTodosParaRemessa(null, DateUtil.getYesterdayDate(), new Date(), false); } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java index 57f24ce36..fd271840a 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java @@ -397,6 +397,15 @@ public class TramoRutaServiceImpl implements TramoRutaService { nuevaSecuencia.setCoeficienteTarifa3(orgaoTramo.getCoeficienteTarifa3()); nuevaSecuencia.setKmCoeficiente3(orgaoTramo.getKmCoeficiente3()); nuevaSecuencia.setOrgaoTramoId(orgaoTramo.getOrgaoTramoId()); + } else if (IsClasseAlterada(rutaTramoVO)) { + orgaoTramo = orgaoTramoDAO.buscar(origen.getParadaId(), destino.getParadaId(), via.getViaId(), rutaTramoVO.getOrgaoConcedente().getOrgaoConcedenteId(), rutaTramoVO.getClaseServicioRutaOrigem().getClaseservicioId()); + if (orgaoTramo != null) { + nuevaSecuencia.setKmCoeficiente1(orgaoTramo.getKmCoeficiente1()); + nuevaSecuencia.setKmCoeficiente2(orgaoTramo.getKmCoeficiente2()); + nuevaSecuencia.setKmCoeficiente3(orgaoTramo.getKmCoeficiente3()); + nuevaSecuencia.setOrgaoTramoId(orgaoTramo.getOrgaoTramoId()); + nuevaSecuencia.setClaseServicioRutaOrigemUtilizadaNaPesquisa(true); + } } incluirCoeficiente(nuevaSecuencia, rutaTramoVO); } @@ -408,9 +417,21 @@ public class TramoRutaServiceImpl implements TramoRutaService { nuevaSecuencia.setTiempoRecorrido(new HoraSistema(tramoServicio.getTiemporecorrido())); nuevaSecuencia.setTramoId(tramoServicio.getTramo().getTramoId()); nuevaSecuencia.setTramoServicioId(tramoServicio.getTramoservicioId()); + } else if (IsClasseAlterada(rutaTramoVO)) { + tramoServicio = tramoServicioService.buscar(origen, destino, via, rutaTramoVO.getClaseServicioRutaOrigem()); + if (tramoServicio != null) { + nuevaSecuencia.setKmReal(tramoServicio.getTramo().getKmReal()); + nuevaSecuencia.setTiempoRecorrido(new HoraSistema(tramoServicio.getTiemporecorrido())); + nuevaSecuencia.setTramoId(tramoServicio.getTramo().getTramoId()); + nuevaSecuencia.setTramoServicioId(tramoServicio.getTramoservicioId()); + } } } + private boolean IsClasseAlterada(RutaTramoVO rutaTramoVO) { + return rutaTramoVO.getClaseServicioRutaOrigem() != null && rutaTramoVO.getClaseServicio().getClaseservicioId()!=rutaTramoVO.getClaseServicioRutaOrigem().getClaseservicioId(); + } + private void incluirCoeficiente(SecuenciaRutaTramoCoeficienteVO nuevaSecuencia, RutaTramoVO rutaTramoVO) { if (nuevaSecuencia.getKmCoeficiente1() == null && rutaTramoVO.getCoeficienteDefault1() != null) { nuevaSecuencia.setKmCoeficiente1(nuevaSecuencia.getKmReal()); @@ -532,7 +553,7 @@ public class TramoRutaServiceImpl implements TramoRutaService { } } - if (secuencia.getOrgaoTramoId() == null + if ((secuencia.getClaseServicioRutaOrigemUtilizadaNaPesquisa() || secuencia.getOrgaoTramoId() == null ) && secuencia.getCoeficienteTarifa1() != null) { OrgaoTramo orgaoTramo = new OrgaoTramo(); orgaoTramo.setClaseServicio(claseServicio); @@ -594,6 +615,16 @@ public class TramoRutaServiceImpl implements TramoRutaService { for (SecuenciaRutaTramoCoeficienteVO s : rutaTramoVO.getLsCombinacionRutaTramoVO()) { RutaCombinacion rutaCombinacion = new RutaCombinacion(); rutaCombinacion.setIndventa(s.getPermiteVenda() == null ? true : s.getPermiteVenda()); + if (ruta.getIsClone() ) { + Tramo tramoAtual = tramoService.obtenerTramotPorOrigemDestinoVia(s.getOrigen(), s.getDestino(), s.getVia()); + for (RutaCombinacion rcRuta : ruta.getRutaCombinacionList()) { + if (rcRuta.getTramo() != null && tramoAtual != null && rcRuta.getTramo().getTramoId() == tramoAtual.getTramoId()) { + rutaCombinacion.setIndventa(rcRuta.getIndventa() == null ? true : rcRuta.getIndventa()); + } + } + } + + rutaCombinacion.setRuta(ruta); rutaCombinacion.setTramo(tramoService.obtenerTramotPorOrigemDestinoVia(s.getOrigen(), s.getDestino(), s.getVia())); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java index 34f6fa709..d5d570bd8 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java @@ -128,8 +128,11 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService { entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - if (entidad.getUsuarioId() == null) { - return usuarioDAO.suscribir(entidad); + if (entidad.getUsuarioId() == null) { + usuarioDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, entidad.getEmpresa() != null && !entidad.getEmpresa().isEmpty()? entidad.getEmpresa().get(0).getEmpresaId(): null); + return entidad; + } else { entidad = usuarioDAO.actualizacion(entidad); logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresa() != null && !entidad.getEmpresa().isEmpty()? entidad.getEmpresa().get(0).getEmpresaId(): null); @@ -202,6 +205,7 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService { entidad.setActivo(Boolean.FALSE); usuarioDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad, entidad.getEmpresa() != null && !entidad.getEmpresa().isEmpty()? entidad.getEmpresa().get(0).getEmpresaId(): null); } public Usuario buscarPeloNomeSenha(String stUsuario, String senha) { diff --git a/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java b/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java index 18ed9e03f..d15f6e3d9 100644 --- a/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java +++ b/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java @@ -8,6 +8,8 @@ public class ConexionVO { private String tramoDestino; private Long conexionCtrlId; + private boolean buscaAgruapada; + public String getConOrigen() { return conOrigen; } @@ -56,6 +58,14 @@ public class ConexionVO { this.conexionCtrlId = conexionCtrlId; } + public boolean isBuscaAgruapada() { + return buscaAgruapada; + } + + public void setBuscaAgruapada(boolean buscaAgruapada) { + this.buscaAgruapada = buscaAgruapada; + } + @Override public String toString() { return "ConexionVO [conOrigen=" + conOrigen + ", conDestino=" + conDestino + ", grupo=" + grupo + ", tramoOrigen=" + tramoOrigen + ", tramoDestino=" + tramoDestino + ", conexionCtrlId=" + conexionCtrlId + "]"; diff --git a/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java index 3ff0f6d72..c8c58afd2 100644 --- a/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java +++ b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java @@ -19,6 +19,7 @@ public class RutaTramoVO { private Boolean ventaHandHeld; private Boolean solicitaNombrePasajero; private ClaseServicio claseServicio; + private ClaseServicio claseServicioRutaOrigem; private OrgaoConcedente orgaoConcedente; private List lsSecuenciaRutaTramoVO; private List lsCombinacionRutaTramoVO; @@ -169,6 +170,16 @@ public class RutaTramoVO { this.lsParadaSecuenciaCombinacaoLinhas = lsParadaSecuenciaCombinacaoLinhas; } + + + public ClaseServicio getClaseServicioRutaOrigem() { + return claseServicioRutaOrigem; + } + + public void setClaseServicioRutaOrigem(ClaseServicio claseServicioRutaOrigem) { + this.claseServicioRutaOrigem = claseServicioRutaOrigem; + } + public Map getParadasComKmEntradaSaida(){ Map kmEntradaSaida = new HashMap(); for (SecuenciaRutaTramoVO s : getLsSecuenciaRutaTramoVO()){ diff --git a/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java index 5d9465e9c..a9507206b 100644 --- a/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java +++ b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java @@ -28,6 +28,7 @@ public class SecuenciaRutaTramoCoeficienteVO { private CoeficienteTarifa coeficienteTarifa3; private BigDecimal kmCoeficiente3; private Boolean permiteVenda; + private Boolean claseServicioRutaOrigemUtilizadaNaPesquisa; public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, HoraSistema tiempoRecorrido) { super(); @@ -259,4 +260,14 @@ public class SecuenciaRutaTramoCoeficienteVO { this.kmEntradaDestino = kmEntradaDestino; } + public Boolean getClaseServicioRutaOrigemUtilizadaNaPesquisa() { + return claseServicioRutaOrigemUtilizadaNaPesquisa==null?false:claseServicioRutaOrigemUtilizadaNaPesquisa; + } + + public void setClaseServicioRutaOrigemUtilizadaNaPesquisa(Boolean claseServicioRutaOrigemUtilizadaNaPesquisa) { + this.claseServicioRutaOrigemUtilizadaNaPesquisa = claseServicioRutaOrigemUtilizadaNaPesquisa; + } + + + } From 3b481a4042957f724a68d51f99a5e461ed853438 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 18 May 2022 09:49:41 -0300 Subject: [PATCH 12/34] =?UTF-8?q?Sincroniza=C3=A7=C3=A3o=20com=20trunk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ConexionRutaLocalidadeRemovidaDAO.java | 27 ++++ ...ionRutaLocalidadeRemovidaHibernateDAO.java | 94 ++++++++++++ .../ConexionRutaLocalidadeRemovida.java | 138 ++++++++++++++++++ ...ConexionRutaLocalidadeRemovidaService.java | 29 ++++ ...xionRutaLocalidadeRemovidaServiceImpl.java | 83 +++++++++++ 5 files changed, 371 insertions(+) create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConexionRutaLocalidadeRemovidaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaLocalidadeRemovidaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConexionRutaLocalidadeRemovida.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConexionRutaLocalidadeRemovidaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaLocalidadeRemovidaServiceImpl.java diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaLocalidadeRemovidaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaLocalidadeRemovidaDAO.java new file mode 100644 index 000000000..62cf34f44 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaLocalidadeRemovidaDAO.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionRutaLocalidadeRemovida; +import com.rjconsultores.ventaboletos.entidad.Parada; + +/** + * + * @author valdevirsp + */ +public interface ConexionRutaLocalidadeRemovidaDAO extends GenericDAO { + + public void removerPorParada(Parada parada); + + public ConexionRutaLocalidadeRemovida obtenerPorParadaId(Integer id); + + public List obtenerPorParadaIdList(List paradaIdList); + + + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaLocalidadeRemovidaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaLocalidadeRemovidaHibernateDAO.java new file mode 100644 index 000000000..63aff17ca --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaLocalidadeRemovidaHibernateDAO.java @@ -0,0 +1,94 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionRutaLocalidadeRemovidaDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaLocalidadeRemovida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author valdevirsp + */ +@Repository("conexionRutaLocalidadeRemovidaDAO") +public class ConexionRutaLocalidadeRemovidaHibernateDAO extends GenericHibernateDAO implements ConexionRutaLocalidadeRemovidaDAO { + + private static Logger log = LoggerFactory.getLogger(ConexionRutaLocalidadeRemovidaHibernateDAO.class); + + @Autowired + public ConexionRutaLocalidadeRemovidaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public void removerPorParada(Parada parada) { + try { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("paradaId", parada.getParadaId().longValue())); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + ConexionRutaLocalidadeRemovida conexionRutaLocalidadeRemovida = (ConexionRutaLocalidadeRemovida) c.uniqueResult(); + borrar(conexionRutaLocalidadeRemovida); + } catch (Exception e) { + log.error("Erro ao remover por por paradaId", e); + } + + } + + @Transactional + public void borrar(ConexionRutaLocalidadeRemovida entidad) { + try { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + actualizacion(entidad); + } catch (Exception e) { + log.error("Erro ao borrar conexionRutaLocalidadeRemovida ", e); + } + } + + @SuppressWarnings("unchecked") + public ConexionRutaLocalidadeRemovida obtenerPorParadaId(Integer paradaId) { + try { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("paradaId", paradaId)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + List conexionRutaLocalidadeRemovidaList = c.list(); + return conexionRutaLocalidadeRemovidaList != null && conexionRutaLocalidadeRemovidaList.size() > 0 ? conexionRutaLocalidadeRemovidaList.get(0) : null; + } catch (Exception e) { + log.error("Erro ao obter paradas por por paradaId", e); + return null; + } + } + + @SuppressWarnings("unchecked") + public List obtenerPorParadaIdList(List paradaIdList) { + try { + Criteria c = this.makeCriteria(); + c.add(Restrictions.in("paradaId", paradaIdList)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + List conexionRutaLocalidadeRemovidaList = c.list(); + return conexionRutaLocalidadeRemovidaList; + } catch (Exception e) { + log.error("Erro ao obter paradas por por paradaIdList", e); + return null; + } + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaLocalidadeRemovida.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaLocalidadeRemovida.java new file mode 100644 index 000000000..d29c289e9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaLocalidadeRemovida.java @@ -0,0 +1,138 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * @author valdevir.silva + * + */ +@Entity +@SequenceGenerator(name = "CONEXION_RUTA_LOC_REMOVIDA_SEQ", sequenceName = "CONEXION_RUTA_LOC_REMOVIDA_SEQ", allocationSize = 1) +@Table(name = "CONEXION_RUTA_LOC_REMOVIDA") +public class ConexionRutaLocalidadeRemovida implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_RUTA_LOC_REMOVIDA_SEQ") + @Column(name = "CONEXIONRUTALOCREMOVIDA_ID") + private Integer conexionRutaLocRemovidaId; + @Column(name = "CONEXIONRUTACONF_ID") + private Integer conexionRutaConfId; + @Column(name = "PARADA_ID") + private Long paradaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + + public ConexionRutaLocalidadeRemovida() { + super(); + } + + + + public ConexionRutaLocalidadeRemovida(Integer conexionRutaLocRemovidaId, Integer conexionRutaConfId, Long paradaId, Boolean activo, Date fecmodif, Integer usuarioId) { + super(); + this.conexionRutaLocRemovidaId = conexionRutaLocRemovidaId; + this.conexionRutaConfId = conexionRutaConfId; + this.paradaId = paradaId; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + public Integer getConexionRutaLocRemovidaId() { + return conexionRutaLocRemovidaId; + } + + public void setConexionRutaLocRemovidaId(Integer conexionRutaLocRemovidaId) { + this.conexionRutaLocRemovidaId = conexionRutaLocRemovidaId; + } + + public Integer getConexionRutaConfId() { + return conexionRutaConfId; + } + + public void setConexionRutaConfId(Integer conexionRutaConfId) { + this.conexionRutaConfId = conexionRutaConfId; + } + + public Long getParadaId() { + return paradaId; + } + + public void setParadaId(Long paradaId) { + this.paradaId = paradaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return "ConexionRutaConf [conexionRutaLocRemovidasId=" + conexionRutaLocRemovidaId + "]"; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((conexionRutaLocRemovidaId == null) ? 0 : conexionRutaLocRemovidaId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ConexionRutaConf)) + return false; + ConexionRutaConf other = (ConexionRutaConf) obj; + if (getConexionRutaConfId() == null) { + if (other.getConexionRutaConfId() != null) + return false; + } else if (!getConexionRutaConfId().equals(other.getConexionRutaConfId())) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionRutaLocalidadeRemovidaService.java b/src/com/rjconsultores/ventaboletos/service/ConexionRutaLocalidadeRemovidaService.java new file mode 100644 index 000000000..efdb70556 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConexionRutaLocalidadeRemovidaService.java @@ -0,0 +1,29 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConexionRutaLocalidadeRemovida; +import com.rjconsultores.ventaboletos.entidad.Parada; + +/** + * + * @author valdevirsp + */ +public interface ConexionRutaLocalidadeRemovidaService extends GenericService { + + public void removerPorParada(Parada parada); + + public ConexionRutaLocalidadeRemovida suscribir(Integer ConexionRutaConfId, Integer paradaId); + + public ConexionRutaLocalidadeRemovida obtenerPorParadaId(Integer id); + + public List obtenerPorParadaList(List paradaList); + + + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaLocalidadeRemovidaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaLocalidadeRemovidaServiceImpl.java new file mode 100644 index 000000000..ad45a77bd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaLocalidadeRemovidaServiceImpl.java @@ -0,0 +1,83 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConexionRutaLocalidadeRemovidaDAO; +import com.rjconsultores.ventaboletos.entidad.ConexionRutaLocalidadeRemovida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.service.ConexionRutaLocalidadeRemovidaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author valdevisp + */ +@Service("conexionRutaLocalidadeRemovidaService") +public class ConexionRutaLocalidadeRemovidaServiceImpl implements ConexionRutaLocalidadeRemovidaService { + + @Autowired + private ConexionRutaLocalidadeRemovidaDAO conexionRutaLocalidadeRemovidaDAO; + + + @Transactional + public List obtenerTodos() { + return conexionRutaLocalidadeRemovidaDAO.obtenerTodos(); + } + + @Transactional + public ConexionRutaLocalidadeRemovida obtenerID(Integer id) { + return conexionRutaLocalidadeRemovidaDAO.obtenerID(id); + } + + @Transactional + public ConexionRutaLocalidadeRemovida suscribir(Integer ConexionRutaConfId, Integer paradaId) { + ConexionRutaLocalidadeRemovida conexionRutaLocalidadeRemovida = new ConexionRutaLocalidadeRemovida(null, ConexionRutaConfId, paradaId.longValue(), Boolean.TRUE, new Date(), UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return conexionRutaLocalidadeRemovidaDAO.suscribir(conexionRutaLocalidadeRemovida); + } + + @Transactional + public ConexionRutaLocalidadeRemovida actualizacion(ConexionRutaLocalidadeRemovida entidad) { + return conexionRutaLocalidadeRemovidaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(ConexionRutaLocalidadeRemovida entidad) { + conexionRutaLocalidadeRemovidaDAO.borrar(entidad); + + } + + @Transactional + public void removerPorParada(Parada parada) { + conexionRutaLocalidadeRemovidaDAO.removerPorParada(parada); + } + + @Override + @Transactional + public ConexionRutaLocalidadeRemovida suscribir(ConexionRutaLocalidadeRemovida entidad) { + return conexionRutaLocalidadeRemovidaDAO.suscribir(entidad); + } + + @Transactional + public ConexionRutaLocalidadeRemovida obtenerPorParadaId(Integer id) { + return conexionRutaLocalidadeRemovidaDAO.obtenerPorParadaId(id); + } + + /** + *Obtem a lista de paradas removidas pela lista de paradas + */ + @Transactional + public List obtenerPorParadaList(List paradaList) { + List paradaIdList = new ArrayList(); + for (Parada parada : paradaList) { + paradaIdList.add(parada.getParadaId().longValue()); + } + return conexionRutaLocalidadeRemovidaDAO.obtenerPorParadaIdList(paradaIdList); + } +} From 3666279c81ab1bde5815098115e05d2807d2bc7c Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Tue, 23 Aug 2022 18:48:45 -0300 Subject: [PATCH 13/34] =?UTF-8?q?atualiza=C3=A7=C3=A3o=20de=20fonte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/ConfTotemVentaRapidaDAO.java | 15 + .../ventaboletos/dao/ParadaDAO.java | 3 + .../dao/PtovtaExcecaoMultaCancDAO.java | 7 + .../dao/RemessaCNABBancosDAO.java | 4 +- .../ventaboletos/dao/SapDAO.java | 3 + .../ConfTotemVentaRapidaHibernateDAO.java | 48 +++ .../ConferenciaComissaoHibernateDAO.java | 15 +- .../dao/hibernate/ParadaHibernateDAO.java | 35 ++ .../PtovtaExcecaoMultaCancHibernateDAO.java | 20 ++ .../RemessaCNABBancosHibernateDAO.java | 19 +- .../dao/hibernate/SapHibernateDAO.java | 32 +- .../hibernate/TarifaOficialHibernateDAO.java | 10 +- .../hibernate/TipoOcupacionHibernateDAO.java | 59 ++-- .../entidad/CategoriaDescuento.java | 22 ++ .../ventaboletos/entidad/ConfTotem.java | 47 +-- .../entidad/ConfTotemVentaRapida.java | 139 ++++++++ .../ventaboletos/entidad/Empresa.java | 13 +- .../ventaboletos/entidad/Estado.java | 13 +- .../entidad/FechamentoBoleto.java | 32 ++ .../entidad/OrgaoCancelacion.java | 27 ++ .../ventaboletos/entidad/OrgaoConcedente.java | 3 + .../ventaboletos/entidad/Parada.java | 2 +- .../entidad/PtovtaExcecaoMultaCanc.java | 184 +++++++++++ .../ventaboletos/entidad/PuntoVenta.java | 33 +- .../ventaboletos/enums/TipoImpressora.java | 3 +- .../ConexionRutaCombinacionService.java | 6 +- .../service/ConfTotemVentaRapidaService.java | 26 ++ .../service/ImportacaoClientesService.java | 3 + .../ventaboletos/service/ParadaService.java | 4 + .../PtovtaExcecaoMultaCancService.java | 7 + .../ventaboletos/service/SapService.java | 3 + .../service/TipoOcupacionService.java | 2 + .../ConexionRutaCombinacionServiceImpl.java | 33 +- ...xionRutaLocalidadeRemovidaServiceImpl.java | 1 - .../impl/ConfTotemVentaRapidaServiceImpl.java | 98 ++++++ .../impl/ConferenciaComissaoServiceImpl.java | 21 +- .../impl/ImportacaoClientesServiceImpl.java | 300 +++++++++++++----- .../ImportacaoRetornoBancarioServiceImpl.java | 17 +- .../service/impl/ParadaServiceImpl.java | 6 + .../PtovtaExcecaoMultaCancServiceImpl.java | 57 ++++ .../service/impl/PuntoVentaServiceImpl.java | 6 +- .../service/impl/SapServiceImpl.java | 8 +- .../impl/TipoOcupacionServiceImpl.java | 74 +++-- .../utilerias/ApplicationProperties.java | 7 +- .../ventaboletos/utilerias/CustomEnum.java | 4 +- .../ventaboletos/utilerias/DateUtil.java | 10 + .../vo/comissao/EventosFinanceirosVO.java | 37 +++ .../FormaPagoEventosFinanceirosVO.java | 63 ++++ .../vo/conftotem/ConfTotemVentaRapidaVO.java | 67 ++++ 49 files changed, 1433 insertions(+), 215 deletions(-) create mode 100644 src/com/rjconsultores/ventaboletos/dao/ConfTotemVentaRapidaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaExcecaoMultaCancDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ConfTotemVentaRapidaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaExcecaoMultaCancHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ConfTotemVentaRapida.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaExcecaoMultaCanc.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ConfTotemVentaRapidaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PtovtaExcecaoMultaCancService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ConfTotemVentaRapidaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PtovtaExcecaoMultaCancServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/FormaPagoEventosFinanceirosVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/conftotem/ConfTotemVentaRapidaVO.java diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfTotemVentaRapidaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfTotemVentaRapidaDAO.java new file mode 100644 index 000000000..4e8ee6807 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ConfTotemVentaRapidaDAO.java @@ -0,0 +1,15 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConfTotemVentaRapida; +import com.rjconsultores.ventaboletos.entidad.Parada; + +public interface ConfTotemVentaRapidaDAO extends GenericDAO { + + ConfTotemVentaRapida buscarOrigemDestino(Parada origem, Parada destino); + + List buscarOrigem(Parada origem); + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java index fc73b1f36..bebbf5bb0 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java @@ -11,6 +11,7 @@ import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.RegionMetropolitana; import com.rjconsultores.ventaboletos.entidad.Ruta; import com.rjconsultores.ventaboletos.entidad.TipoParada; +import com.rjconsultores.ventaboletos.vo.parada.ParadaVO; import java.util.List; @@ -60,4 +61,6 @@ public interface ParadaDAO { public List buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada); + public List buscarDestinosPorOrigem(Integer origemId); + } diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaExcecaoMultaCancDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaExcecaoMultaCancDAO.java new file mode 100644 index 000000000..379f110dc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaExcecaoMultaCancDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaExcecaoMultaCanc; + +public interface PtovtaExcecaoMultaCancDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RemessaCNABBancosDAO.java b/src/com/rjconsultores/ventaboletos/dao/RemessaCNABBancosDAO.java index 0002cb4b2..19ccc64d7 100644 --- a/src/com/rjconsultores/ventaboletos/dao/RemessaCNABBancosDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/RemessaCNABBancosDAO.java @@ -5,6 +5,7 @@ import java.util.Date; import java.util.List; import com.rjconsultores.ventaboletos.ArquivoRemessa; +import com.rjconsultores.ventaboletos.blocos.DetalheRetorno; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.FechamentoBoleto; @@ -34,5 +35,6 @@ public interface RemessaCNABBancosDAO extends GenericDAO public FechamentoBoleto obtenerFechamentoBoletoPorNossoNumero(String nossoNumero, Integer empresaId); - public boolean quitarFechamentoBoleto(Long fechamentoboletoId, Integer usuarioId) throws SQLException; + public boolean quitarFechamentoBoleto(Long fechamentoboletoId, Integer usuarioId, DetalheRetorno detalhe) throws SQLException; + } diff --git a/src/com/rjconsultores/ventaboletos/dao/SapDAO.java b/src/com/rjconsultores/ventaboletos/dao/SapDAO.java index c21e2dc3e..473bfcc86 100644 --- a/src/com/rjconsultores/ventaboletos/dao/SapDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/SapDAO.java @@ -5,11 +5,14 @@ import java.util.List; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO; public interface SapDAO extends GenericDAO { public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar); + + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar, PuntoVenta puntoVenta); public boolean atualizaFechamento(Long fechamentocntcorrenteId, int status) throws Exception; diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfTotemVentaRapidaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfTotemVentaRapidaHibernateDAO.java new file mode 100644 index 000000000..33e9b8e01 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfTotemVentaRapidaHibernateDAO.java @@ -0,0 +1,48 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.ConfTotemVentaRapidaDAO; +import com.rjconsultores.ventaboletos.entidad.ConfTotemVentaRapida; +import com.rjconsultores.ventaboletos.entidad.Parada; + +/** + * + * @author Wallace + */ +@Repository("ConfTotemVentaRapidaDAO") +public class ConfTotemVentaRapidaHibernateDAO extends GenericHibernateDAO implements ConfTotemVentaRapidaDAO { + + @Autowired + public ConfTotemVentaRapidaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public ConfTotemVentaRapida buscarOrigemDestino(Parada origem, Parada destino) { + + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("origen", origem)); + c.add(Restrictions.eq("destino", destino)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (ConfTotemVentaRapida) c.uniqueResult(); + } + + @Override + public List buscarOrigem(Parada origem) { + + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("origen", origem)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java index 4b83a76db..14a1b7e55 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java @@ -52,6 +52,7 @@ import com.rjconsultores.ventaboletos.vo.comissao.BoletoComissao; import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO; import com.rjconsultores.ventaboletos.vo.comissao.DiaConferenciaComissaoVO; import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO; +import com.rjconsultores.ventaboletos.vo.comissao.FormaPagoEventosFinanceirosVO; import com.rjconsultores.ventaboletos.vo.comissao.FormapagoVO; import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO; import com.rjconsultores.ventaboletos.vo.comissao.OcdVO; @@ -709,8 +710,18 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO()); + eventosFinanceiros.getFormapagos().add(new FormaPagoEventosFinanceirosVO(eventosFinanceiros.getFormapagoId(),eventosFinanceiros.getDescpago(),eventosFinanceiros.getImpingreso())); + result.add(eventosFinanceiros); } } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java index 070227935..3539190d2 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java @@ -7,11 +7,15 @@ package com.rjconsultores.ventaboletos.dao.hibernate; import java.util.List; import org.hibernate.Criteria; +import org.hibernate.Query; import org.hibernate.SessionFactory; import org.hibernate.criterion.MatchMode; import org.hibernate.criterion.Order; import org.hibernate.criterion.Projections; import org.hibernate.criterion.Restrictions; +import org.hibernate.transform.AliasToBeanResultTransformer; +import org.hibernate.type.IntegerType; +import org.hibernate.type.StringType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Repository; @@ -24,6 +28,7 @@ import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.RegionMetropolitana; import com.rjconsultores.ventaboletos.entidad.Ruta; import com.rjconsultores.ventaboletos.entidad.TipoParada; +import com.rjconsultores.ventaboletos.vo.parada.ParadaVO; /** * @@ -139,6 +144,36 @@ public class ParadaHibernateDAO extends GenericHibernateDAO imp return getSession().createQuery(sql).setEntity("origem", origem).list(); } + + + @Override + public List buscarDestinosPorOrigem(Integer origenId){ + StringBuilder sb = new StringBuilder(); + + sb.append("select distinct p.PARADA_ID as paradaId, p.CVEPARADA as cveparada, p.DESCPARADA as descparada from RUTA_COMBINACION rc ") + .append("inner join ruta r on rc.RUTA_ID=r.RUTA_ID ") + .append("inner join ESQUEMA_CORRIDA ec on r.RUTA_ID=ec.RUTA_ID ") + .append("inner join corrida c on ec.NUMCORRIDA=c.CORRIDA_ID ") + .append("inner join parada p on p.parada_id=c.DESTINO_ID ") + .append("where rc.ACTIVO = 1 and r.activo=1 and ec.activo=1 and c.activo=1 and p.activo = 1 and c.ORIGEN_ID=:origenId"); + + Query qry = getSession().createSQLQuery(sb.toString()) + .addScalar("paradaId", IntegerType.INSTANCE) + .addScalar("cveparada", StringType.INSTANCE) + .addScalar("descparada", StringType.INSTANCE) + .setResultTransformer(new AliasToBeanResultTransformer(Parada.class)); + + qry.setInteger("origenId", origenId); + + List list = qry.list(); + + if (list.size() > 0) { + return list; + } + + return null; + + } public List buscaParadaRegionMetropolitana(RegionMetropolitana regionMetropolitana) { Criteria c = getSession().createCriteria(getPersistentClass()); diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaExcecaoMultaCancHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaExcecaoMultaCancHibernateDAO.java new file mode 100644 index 000000000..d5aa7ae7a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaExcecaoMultaCancHibernateDAO.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.PtovtaExcecaoMultaCancDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaExcecaoMultaCanc; + +@Repository("ptovtaExcecaoMultaCancHibernateDAO") +public class PtovtaExcecaoMultaCancHibernateDAO extends GenericHibernateDAO implements PtovtaExcecaoMultaCancDAO { + + @Autowired + public PtovtaExcecaoMultaCancHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java index 728199585..2d3b6ae04 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java @@ -28,6 +28,7 @@ import com.rjconsultores.ventaboletos.ArquivoRemessa; import com.rjconsultores.ventaboletos.ArquivoRemessaItem; import com.rjconsultores.ventaboletos.ArquivoRemessaItemInteface; import com.rjconsultores.ventaboletos.blocos.DetalheObrigatorio; +import com.rjconsultores.ventaboletos.blocos.DetalheRetorno; import com.rjconsultores.ventaboletos.blocos.RodapeRemessaPadrao; import com.rjconsultores.ventaboletos.blocos.bancobrasil.ArquivoRemessaBancoBrasil; import com.rjconsultores.ventaboletos.blocos.bancobrasil.CabecalhoLoteRemessaBancoBrasil; @@ -829,7 +830,7 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) { + return obtenerTodosParaRemessa(empresa, dataDe, dataAte, reenviar, null); + } @SuppressWarnings("unchecked") @Override - public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) { + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar, PuntoVenta puntoVenta) { StringBuilder sb = new StringBuilder(); sb.append(" SELECT "); @@ -51,11 +57,13 @@ public class SapHibernateDAO extends GenericHibernateDAO - implements TipoOcupacionDAO { + implements TipoOcupacionDAO { - @Autowired - public TipoOcupacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { - setSessionFactory(factory); - } + @Autowired + public TipoOcupacionHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } - @Override - public List obtenerTodos() { - Criteria c = getSession().createCriteria(getPersistentClass()); - c.add(Restrictions.eq("activo", Boolean.TRUE)); + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); - return c.list(); - } + return c.list(); + } - public List buscar(String desctipo, String cvetipoocupacion) { - Criteria c = getSession().createCriteria(getPersistentClass()); - c.add(Restrictions.eq("activo", Boolean.TRUE)); + public List buscar(String desctipo, String cvetipoocupacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); - c.add(Restrictions.eq("desctipo", desctipo)); - c.add(Restrictions.eq("cvetipoocupacion", cvetipoocupacion)); + if (desctipo != null) { + c.add(Restrictions.eq("desctipo", desctipo)); + } - return c.list(); - } + if (cvetipoocupacion != null) { + c.add(Restrictions.eq("cvetipoocupacion", cvetipoocupacion)); + } - public List buscarClave(String cvetipoocupacion) { - Criteria c = getSession().createCriteria(getPersistentClass()); - c.add(Restrictions.eq("activo", Boolean.TRUE)); + return c.list(); + } - c.add(Restrictions.eq("cvetipoocupacion", cvetipoocupacion)); + public List buscarClave(String cvetipoocupacion) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); - return c.list(); - } + c.add(Restrictions.eq("cvetipoocupacion", cvetipoocupacion)); + + return c.list(); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaDescuento.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaDescuento.java index 5a4fb4d0b..d67c311d3 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/CategoriaDescuento.java +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaDescuento.java @@ -230,6 +230,13 @@ public class CategoriaDescuento implements Serializable { @ManyToOne(cascade = CascadeType.ALL) private Categoria categoriaInterage; + @Column(name = "INDEXIGENUMFIDELIDADE") + private Boolean indExigeNumFidelidade; + + @JoinColumn(name = "TIPOOCUPACION_ID") + @ManyToOne(cascade = CascadeType.ALL) + private TipoOcupacion tipoOcupacion; + public enum DisponibilidadeFeriado { // Declaração dos enum GERARSEMPRE("SEMPRE", "S"), @@ -969,4 +976,19 @@ public class CategoriaDescuento implements Serializable { this.categoriaInterage = categoriaInterage; } + public Boolean getIndExigeNumFidelidade() { + return indExigeNumFidelidade == null ? false : indExigeNumFidelidade; + } + + public void setIndExigeNumFidelidade(Boolean indExigeNumFidelidade) { + this.indExigeNumFidelidade = indExigeNumFidelidade; + } + + public TipoOcupacion getTipoOcupacion() { + return tipoOcupacion; + } + + public void setTipoOcupacion(TipoOcupacion tipoOcupacion) { + this.tipoOcupacion = tipoOcupacion; + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfTotem.java b/src/com/rjconsultores/ventaboletos/entidad/ConfTotem.java index 551ba9e74..32b034c08 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ConfTotem.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfTotem.java @@ -51,29 +51,6 @@ public class ConfTotem implements Serializable { public ConfTotem() { super(); } - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((confTotemId == null) ? 0 : confTotemId.hashCode()); - return result; - } - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ConfTotem other = (ConfTotem) obj; - if (confTotemId == null) { - if (other.confTotemId != null) - return false; - } else if (!confTotemId.equals(other.confTotemId)) - return false; - return true; - } public String getValor() { return valor; @@ -107,4 +84,28 @@ public class ConfTotem implements Serializable { this.chave = chave; } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((confTotemId == null) ? 0 : confTotemId.hashCode()); + return result; + } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfTotem other = (ConfTotem) obj; + if (confTotemId == null) { + if (other.confTotemId != null) + return false; + } else if (!confTotemId.equals(other.confTotemId)) + return false; + return true; + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConfTotemVentaRapida.java b/src/com/rjconsultores/ventaboletos/entidad/ConfTotemVentaRapida.java new file mode 100644 index 000000000..af0b0ab27 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ConfTotemVentaRapida.java @@ -0,0 +1,139 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author wallace + */ +@Entity +@SequenceGenerator(name = "CONFTOTEM_VENTARAPIDA_SEQ", sequenceName = "CONFTOTEM_VENTARAPIDA_SEQ", allocationSize = 1) +@Table(name = "CONF_TOTEM_VENTARAPIDA") +public class ConfTotemVentaRapida implements Serializable { + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONFTOTEM_VENTARAPIDA_SEQ") + @Column(name = "CONFTOTEMVENTARAPIDA_ID") + private Integer confTotemVentaRapidaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + @ManyToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origen; + @ManyToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; + + public ConfTotemVentaRapida() { + super(); + } + + public ConfTotemVentaRapida(Parada origem, Parada destino) { + this.origen = origem; + this.destino = destino; + } + + public Integer getConfTotemVentaRapidaOri() { + return confTotemVentaRapidaId; + } + + public void setConfTotemVentaRapidaId(Integer confTotemVentaRapidaId) { + this.confTotemVentaRapidaId = confTotemVentaRapidaId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((destino == null) ? 0 : destino.hashCode()); + result = prime * result + ((origen == null) ? 0 : origen.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfTotemVentaRapida other = (ConfTotemVentaRapida) obj; + if (destino == null) { + if (other.destino != null) + return false; + } else if (!destino.equals(other.destino)) + return false; + if (origen == null) { + if (other.origen != null) + return false; + } else if (!origen.equals(other.origen)) + return false; + return true; + } + + + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Empresa.java b/src/com/rjconsultores/ventaboletos/entidad/Empresa.java index 8843eeb74..b988cc9de 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Empresa.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Empresa.java @@ -396,14 +396,15 @@ public class Empresa implements Serializable, Auditavel { @Column(name = "INDCHECKINBLOQUEADOREMARCACAO") private Boolean indCheckinBloqueadoRemarcacao; - @Column(name = "INDAGRUPLOCCONEXAO") private Boolean indAgrupLocConexao; - @Column(name = "INDLIMITACATEGORIAPORCORRIDA") private Boolean IndLimitaCategoriaPorCorrida; + @Column(name = "INDSEGUNDAVIASEGOPCIONAL") + private Boolean indSegundaViaSegOpcional; + @Transient @NaoAuditar private Empresa empresaClone; @@ -1495,4 +1496,12 @@ public class Empresa implements Serializable, Auditavel { public void setIndLimitaCategoriaPorCorrida(Boolean indLimitaCategoriaPorCorrida) { IndLimitaCategoriaPorCorrida = indLimitaCategoriaPorCorrida; } + + public Boolean getIndSegundaViaSegOpcional() { + return indSegundaViaSegOpcional == null ? false : indSegundaViaSegOpcional; + } + + public void setIndSegundaViaSegOpcional(Boolean indSegundaViaSegOpcional) { + this.indSegundaViaSegOpcional = indSegundaViaSegOpcional; + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/Estado.java b/src/com/rjconsultores/ventaboletos/entidad/Estado.java index 27fb88ea1..c5d29a9d6 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Estado.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Estado.java @@ -88,6 +88,9 @@ public class Estado implements Serializable { @Column(name = "CODIBGE") private Integer codibge; + @Column(name = "TIMEOUT_BPE") + private Integer timeoutBpe; + public Estado() { } @@ -225,8 +228,6 @@ public class Estado implements Serializable { this.centroResultadosAG = centroResultadosAG; } - - public String getMensagemPromocional1() { return mensagemPromocional1; } @@ -290,4 +291,12 @@ public class Estado implements Serializable { public void setCodibge(Integer codibge) { this.codibge = codibge; } + + public Integer getTimeoutBpe() { + return timeoutBpe; + } + + public void setTimeoutBpe(Integer timeoutBpe) { + this.timeoutBpe = timeoutBpe; + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/FechamentoBoleto.java b/src/com/rjconsultores/ventaboletos/entidad/FechamentoBoleto.java index 41341e914..02f98857e 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/FechamentoBoleto.java +++ b/src/com/rjconsultores/ventaboletos/entidad/FechamentoBoleto.java @@ -42,9 +42,16 @@ public class FechamentoBoleto implements java.io.Serializable{ @Temporal(TemporalType.TIMESTAMP) private Date fecvencimento; + @Column(name = "FECBAIXA", length = 7) + @Temporal(TemporalType.TIMESTAMP) + private Date fecbaixa; + @Column(name = "VALORDOCUMENTO") private BigDecimal valordocumento; + @Column(name = "VALOR_JUROS") + private BigDecimal valorjuros; + @Column(name = "DESCONTOS") private BigDecimal descontos; @@ -91,6 +98,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public Long getFechamentoboletoId() { return fechamentoboletoId; } + public void setFechamentoboletoId(Long fechamentoboletoId) { this.fechamentoboletoId = fechamentoboletoId; } @@ -98,6 +106,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public FechamentoCntcorrente getFechamentoCntcorrente() { return fechamentoCntcorrente; } + public void setFechamentoCntcorrente(FechamentoCntcorrente fechamentoCntcorrente) { this.fechamentoCntcorrente = fechamentoCntcorrente; } @@ -105,6 +114,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public String getNossonumero() { return nossonumero; } + public void setNossonumero(String nossonumero) { this.nossonumero = nossonumero; } @@ -112,6 +122,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public Date getFecdocumento() { return fecdocumento; } + public void setFecdocumento(Date fecdocumento) { this.fecdocumento = fecdocumento; } @@ -119,6 +130,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public Date getFecvencimento() { return fecvencimento; } + public void setFecvencimento(Date fecvencimento) { this.fecvencimento = fecvencimento; } @@ -126,6 +138,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public BigDecimal getValordocumento() { return valordocumento; } + public void setValordocumento(BigDecimal valordocumento) { this.valordocumento = valordocumento; } @@ -133,6 +146,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public BigDecimal getDescontos() { return descontos; } + public void setDescontos(BigDecimal descontos) { this.descontos = descontos; } @@ -140,6 +154,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public BigDecimal getDeducoes() { return deducoes; } + public void setDeducoes(BigDecimal deducoes) { this.deducoes = deducoes; } @@ -147,6 +162,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public BigDecimal getMora() { return mora; } + public void setMora(BigDecimal mora) { this.mora = mora; } @@ -154,6 +170,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public BigDecimal getAcrescimos() { return acrescimos; } + public void setAcrescimos(BigDecimal acrescimos) { this.acrescimos = acrescimos; } @@ -161,6 +178,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public BigDecimal getValorCobrado() { return valorCobrado; } + public void setValorCobrado(BigDecimal valorCobrado) { this.valorCobrado = valorCobrado; } @@ -168,6 +186,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public Date getFecmodif() { return fecmodif; } + public void setFecmodif(Date fecmodif) { this.fecmodif = fecmodif; } @@ -175,6 +194,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public Integer getUsuarioId() { return usuarioId; } + public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } @@ -182,6 +202,7 @@ public class FechamentoBoleto implements java.io.Serializable{ public Boolean getActivo() { return activo; } + public void setActivo(Boolean activo) { this.activo = activo; } @@ -189,36 +210,47 @@ public class FechamentoBoleto implements java.io.Serializable{ public String getStatus() { return status; } + public void setStatus(String status) { this.status = status; } + public Long getRemessaId() { return remessaId; } + public void setRemessaId(Long remessaId) { this.remessaId = remessaId; } + public BigDecimal getPorcentagemMulta() { return porcentagemMulta; } + public void setPorcentagemMulta(BigDecimal porcentagemMulta) { this.porcentagemMulta = porcentagemMulta; } + public BigDecimal getPorcentagemMora() { return porcentagemMora; } + public void setPorcentagemMora(BigDecimal porcentagemMora) { this.porcentagemMora = porcentagemMora; } + public Boolean getIndBoletoQuitado() { return indBoletoQuitado; } + public void setIndBoletoQuitado(Boolean indBoletoQuitado) { this.indBoletoQuitado = indBoletoQuitado; } + public Integer getUsuarioQuitacao() { return usuarioQuitacao; } + public void setUsuarioQuitacao(Integer usuarioQuitacao) { this.usuarioQuitacao = usuarioQuitacao; } diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java index 6b71c9f55..2965f0a87 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java @@ -117,6 +117,14 @@ public class OrgaoCancelacion implements Serializable, Auditavel @Column(name = "TAXA_CONVENIENCIA_SVI") private BigDecimal taxaConvenienciaSVI; + @Transient @NaoAuditar private OrgaoConcedente orgaoConcedenteClone; @@ -350,6 +351,8 @@ public class OrgaoConcedente implements Serializable, Auditavel public void setTaxaConvenienciaSVI(BigDecimal taxaConvenienciaSVI) { this.taxaConvenienciaSVI = taxaConvenienciaSVI; } + + @Override public void clonar() throws CloneNotSupportedException { diff --git a/src/com/rjconsultores/ventaboletos/entidad/Parada.java b/src/com/rjconsultores/ventaboletos/entidad/Parada.java index 629ed0b71..8707b1861 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Parada.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Parada.java @@ -300,7 +300,7 @@ public class Parada implements Serializable, Auditavel { return false; } Parada other = (Parada) object; - if ((this.getParadaId() == null && other.getParadaId() != null) || (this.getParadaId() != null && !this.getParadaId().equals(other.getParadaId()))) { + if ((this.getParadaId() == null && other.getParadaId() != null) || (this.getParadaId() != null && this.getParadaId().intValue() != other.getParadaId().intValue())) { return false; } return true; diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaExcecaoMultaCanc.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaExcecaoMultaCanc.java new file mode 100644 index 000000000..1ded1130e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaExcecaoMultaCanc.java @@ -0,0 +1,184 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +/** + * @author Valdevir + */ +@AuditarClasse(nome = "PtovtaExcecaoMultaCanc", tela = "Alteração Ponto de Venda/Excecao Multa Canc") +@Entity +@SequenceGenerator(name = "PTOVTA_EXCECAO_MULTA_CANC_SEQ", sequenceName = "PTOVTA_EXCECAO_MULTA_CANC_SEQ", allocationSize = 1) +@Table(name = "PTOVTA_EXCECAO_MULTA_CANC") +public class PtovtaExcecaoMultaCanc implements Serializable , Auditavel { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "PTOVTA_EXCECAO_MULTA_CANC_SEQ") + @Column(name = "PTOVTAEXCECAOMULTACANC_ID") + private Integer ptovtaExcecaoMultaCancId; + + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoventa; + + @ManyToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + + @ManyToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private int usuarioId; + + @Transient + @NaoAuditar + private PtovtaExcecaoMultaCanc ptovtaExcecaoMultaCancClone; + + public PtovtaExcecaoMultaCanc() { + super(); + this.activo = true; + this.fecmodif = new Date(); + } + + public Integer getPtovtaExcecaoMultaCancId() { + return ptovtaExcecaoMultaCancId; + } + + public void setPtovtaExcecaoMultaCancId(Integer ptovtaExcecaoMultaCancId) { + this.ptovtaExcecaoMultaCancId = ptovtaExcecaoMultaCancId; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + public PtovtaExcecaoMultaCanc getPtovtaExcecaoMultaCancClone() { + return ptovtaExcecaoMultaCancClone; + } + + public void setPtovtaExcecaoMultaCancClone(PtovtaExcecaoMultaCanc ptovtaExcecaoMultaCancClone) { + this.ptovtaExcecaoMultaCancClone = ptovtaExcecaoMultaCancClone; + } + + public PuntoVenta getPuntoventa() { + return puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public int getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(int usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((ptovtaExcecaoMultaCancId == null) ? 0 : ptovtaExcecaoMultaCancId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof PtovtaExcecaoMultaCanc)) + return false; + PtovtaExcecaoMultaCanc other = (PtovtaExcecaoMultaCanc) obj; + if (ptovtaExcecaoMultaCancId == null) { + if (other.ptovtaExcecaoMultaCancId != null) + return false; + } else if (!ptovtaExcecaoMultaCancId.equals(other.ptovtaExcecaoMultaCancId)) + return false; + return true; + } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaExcecaoMultaCancClone = new PtovtaExcecaoMultaCanc(); + ptovtaExcecaoMultaCancClone = (PtovtaExcecaoMultaCanc) this.clone(); + Hibernate.initialize(ptovtaExcecaoMultaCancClone.getPuntoventa()); + + } + + @Override + public PtovtaExcecaoMultaCanc getCloneObject() throws CloneNotSupportedException { + return ptovtaExcecaoMultaCancClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaExcecaoMultaCancId()); + } + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java index 824c33c0f..c1a85bd6a 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java @@ -32,7 +32,6 @@ import javax.persistence.TemporalType; import javax.persistence.Transient; import org.apache.commons.lang.BooleanUtils; -import org.hibernate.Hibernate; import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; import org.hibernate.annotations.Where; @@ -285,6 +284,12 @@ public class PuntoVenta implements Serializable, Auditavel { @LazyCollection(LazyCollectionOption.FALSE) @Where(clause = "activo = 1") private List ptovtaAntifraudes; + + @AuditarLista(auditarEntidades = true, nome = "PtovtaExcecaoMultaCanc") + @OneToMany(mappedBy = "puntoventa", cascade = CascadeType.ALL) + @LazyCollection(LazyCollectionOption.FALSE) + @Where(clause = "activo = 1") + private List ptovtaExcecaoMultaCancList; @Column(name = "INDBLOQUEIATIPOPASSAGEM") private Boolean indBloqueiaTipoPassagem; @@ -1193,6 +1198,12 @@ public class PuntoVenta implements Serializable, Auditavel { this.ptovtaAntifraudes.remove(cat); } } + + public void removePtovtaExcecaoMultaCanc(PtovtaExcecaoMultaCanc excecaoMulta){ + if(this.ptovtaExcecaoMultaCancList != null) { + this.ptovtaExcecaoMultaCancList.remove(excecaoMulta); + } + } public Boolean getIndBloqueiaTipoPassagem() { return BooleanUtils.toBoolean(indBloqueiaTipoPassagem); @@ -1249,6 +1260,26 @@ public class PuntoVenta implements Serializable, Auditavel { public void setIndQrcodeTaxaEmbarqueRodTTL(Boolean indQrcodeTaxaEmbarqueRodTTL) { this.indQrcodeTaxaEmbarqueRodTTL = indQrcodeTaxaEmbarqueRodTTL; } + + + public Boolean getIndBloqueiaCancelamentoBilheteImpresso() { + return indBloqueiaCancelamentoBilheteImpresso; + } + + public void setIndBloqueiaCancelamentoBilheteImpresso(Boolean indBloqueiaCancelamentoBilheteImpresso) { + this.indBloqueiaCancelamentoBilheteImpresso = indBloqueiaCancelamentoBilheteImpresso; + } + + + + public List getPtovtaExcecaoMultaCancList() { + return ptovtaExcecaoMultaCancList; + } + + public void setPtovtaExcecaoMultaCancList(List ptovtaExcecaoMultaCanc) { + this.ptovtaExcecaoMultaCancList = ptovtaExcecaoMultaCanc; + } + @Override public void clonar() throws CloneNotSupportedException { diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoImpressora.java b/src/com/rjconsultores/ventaboletos/enums/TipoImpressora.java index 4a153ef1e..27759497f 100644 --- a/src/com/rjconsultores/ventaboletos/enums/TipoImpressora.java +++ b/src/com/rjconsultores/ventaboletos/enums/TipoImpressora.java @@ -11,7 +11,8 @@ public enum TipoImpressora { DARUMA(4, Labels.getLabel("editarEstacionController.tipoImpressora.darumaFiscal"), true), DARUMA_BLINDADA(5, Labels.getLabel("editarEstacionController.tipoImpressora.darumaFiscalBlindada"), true), STOCK_CENTRAL(6, Labels.getLabel("editarEstacionController.tipoImpressora.stockCentral"), true), - BPE(7, Labels.getLabel("editarEstacionController.tipoImpressora.bpe"), true); + BPE(7, Labels.getLabel("editarEstacionController.tipoImpressora.bpe"), true), + MACON(8, Labels.getLabel("editarEstacionController.tipoImpressora.macon"), true); private final int codigo; private final String nome; diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionRutaCombinacionService.java b/src/com/rjconsultores/ventaboletos/service/ConexionRutaCombinacionService.java index b3630c256..2d228b624 100644 --- a/src/com/rjconsultores/ventaboletos/service/ConexionRutaCombinacionService.java +++ b/src/com/rjconsultores/ventaboletos/service/ConexionRutaCombinacionService.java @@ -10,10 +10,14 @@ import com.rjconsultores.ventaboletos.vo.parada.ParadaVOConexionRuta; public interface ConexionRutaCombinacionService { - public void gerarCombinacionEntre2Eixos(List listParada1, List rutasEixoA, List rutasEixoB, List lsLocalidadesComuns, List listParada4, List rutasEixoA2, List rutasEixoB2, List localidadesGeradas, List conexoesCtrl); + public void gerarCombinacionEntre2Eixos(List listParada1, List rutasEixoA, List rutasEixoB, List lsLocalidadesComuns, List listParada4, List rutasEixoA2, List rutasEixoB2, List localidadesGeradas, List conexoesCtrl, Boolean isConexaoPorAgrupamento); public void gerarCombinacionEntre3Eixos(List listParada1, List rutasEixoA, List rutasEixoB, List lsLocalidadesComuns, List listParada4, List listParadasC, List rutasEixoA2, List rutasEixoB2, List rutasEixoC, List localidadesGeradas, List conexoesCtrl); public List extrairConexionRutaCtrl(List localidadesGeradas); + + public List getParadasByAgrupamentoId(Parada parada); + + } diff --git a/src/com/rjconsultores/ventaboletos/service/ConfTotemVentaRapidaService.java b/src/com/rjconsultores/ventaboletos/service/ConfTotemVentaRapidaService.java new file mode 100644 index 000000000..c13ba0df5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ConfTotemVentaRapidaService.java @@ -0,0 +1,26 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ConfTotemVentaRapida; +import com.rjconsultores.ventaboletos.entidad.Parada; + +/** + * + * @author wallace + */ +public interface ConfTotemVentaRapidaService extends GenericService{ + + ConfTotemVentaRapida buscarOrigemDestino(Parada origem, Parada destino); + + List buscarOrigem(Parada origen); + + void apagarPorOrigem(Parada selectedObject); + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ImportacaoClientesService.java b/src/com/rjconsultores/ventaboletos/service/ImportacaoClientesService.java index f60fd219d..36ef4f502 100644 --- a/src/com/rjconsultores/ventaboletos/service/ImportacaoClientesService.java +++ b/src/com/rjconsultores/ventaboletos/service/ImportacaoClientesService.java @@ -14,4 +14,7 @@ public interface ImportacaoClientesService { public String[] lerArquivoExcel(Media media, List empresas); public Integer[] salvarClientes(String[] cliente, List empresas) throws Exception; + + public String[] lerArquivoPolicialExcel(Media media, List empresas); + } diff --git a/src/com/rjconsultores/ventaboletos/service/ParadaService.java b/src/com/rjconsultores/ventaboletos/service/ParadaService.java index aac9bbd51..68f193036 100644 --- a/src/com/rjconsultores/ventaboletos/service/ParadaService.java +++ b/src/com/rjconsultores/ventaboletos/service/ParadaService.java @@ -15,6 +15,7 @@ import com.rjconsultores.ventaboletos.entidad.Ruta; import com.rjconsultores.ventaboletos.entidad.TipoParada; import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; +import com.rjconsultores.ventaboletos.vo.parada.ParadaVO; /** * @@ -46,4 +47,7 @@ public interface ParadaService { public List buscaParadaRegionMetropolitana(RegionMetropolitana regionMetropolitana); public List buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada); + + public List buscarDestinosPorOrigem(Integer origemId); + } diff --git a/src/com/rjconsultores/ventaboletos/service/PtovtaExcecaoMultaCancService.java b/src/com/rjconsultores/ventaboletos/service/PtovtaExcecaoMultaCancService.java new file mode 100644 index 000000000..636fc73a5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PtovtaExcecaoMultaCancService.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.PtovtaExcecaoMultaCanc; + +public interface PtovtaExcecaoMultaCancService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/SapService.java b/src/com/rjconsultores/ventaboletos/service/SapService.java index 7a00c7397..6b73cf0e9 100644 --- a/src/com/rjconsultores/ventaboletos/service/SapService.java +++ b/src/com/rjconsultores/ventaboletos/service/SapService.java @@ -5,6 +5,7 @@ import java.util.List; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO; public interface SapService extends GenericService { @@ -13,6 +14,8 @@ public interface SapService extends GenericService public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar); + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar, PuntoVenta puntoVenta); + public void integracaoSapAutomatica() throws Exception; } diff --git a/src/com/rjconsultores/ventaboletos/service/TipoOcupacionService.java b/src/com/rjconsultores/ventaboletos/service/TipoOcupacionService.java index 62392e7b9..19239467d 100644 --- a/src/com/rjconsultores/ventaboletos/service/TipoOcupacionService.java +++ b/src/com/rjconsultores/ventaboletos/service/TipoOcupacionService.java @@ -13,6 +13,8 @@ import java.util.List; */ public interface TipoOcupacionService extends GenericService { + public List buscar(String desctipo); + public List buscar(String desctipo, String cvetipoocupacion); public List buscarClave(String cvetipoocupacion); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java index 16164e4c0..af0ce1a4c 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java @@ -42,7 +42,7 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci return cacheLocalidades; } - private void gerarCombinacao(LinkedList> lists, List rutasEixoA, List rutasEixoB, List rutasEixoC, List localidadesGeradas, List conexoesCtrl, Map cacheLocalidades) { + private void gerarCombinacao(LinkedList> lists, List rutasEixoA, List rutasEixoB, List rutasEixoC, List localidadesGeradas, List conexoesCtrl, Map cacheLocalidades, Boolean isConexaoPorAgrupamento) { Set combinacoes = new TreeSet(); @@ -66,7 +66,7 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci Set rutasVendaB = rutaCombinacionService.rutasCombinacionVenda(rutasEixoB); if(rutasEixoC == null) { - gerarLocalidadesEixoAB(rutasEixoA, rutasEixoB, localidadesGeradas, combinacoes, conexoesCtrl, cacheLocalidades, rutasVendaA, rutasVendaB); + gerarLocalidadesEixoAB(rutasEixoA, rutasEixoB, localidadesGeradas, combinacoes, conexoesCtrl, cacheLocalidades, rutasVendaA, rutasVendaB, isConexaoPorAgrupamento); }else { Set rutasVendaC = rutaCombinacionService.rutasCombinacionVenda(rutasEixoC); gerarLocalidadesEixoABC(rutasEixoA, rutasEixoB,rutasEixoC, localidadesGeradas, combinacoes, conexoesCtrl, cacheLocalidades, rutasVendaA, rutasVendaB, rutasVendaC ); @@ -76,7 +76,7 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci } - private void gerarLocalidadesEixoAB(List rutasEixoA, List rutasEixoB, List localidadesGeradas, Set combinacoes, List conexoesCtrl, Map cacheLocalidades, Set rutasVendaA, Set rutasVendaB) { + private void gerarLocalidadesEixoAB(List rutasEixoA, List rutasEixoB, List localidadesGeradas, Set combinacoes, List conexoesCtrl, Map cacheLocalidades, Set rutasVendaA, Set rutasVendaB, Boolean isConexaoPorAgrupamento) { short i = 1; String[] valoresCalculados; @@ -105,7 +105,7 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci conexionCtrl, conexionRutaCtrl, rutaEixoB.getDescSentido()); i++; - adicionarLocalidadeGerada(conexionCtrl, localidadesGeradas, trechoA, trechoB, null, rutasVendaA, rutasVendaB, new HashSet()); + adicionarLocalidadeGerada(conexionCtrl, localidadesGeradas, trechoA, trechoB, null, rutasVendaA, rutasVendaB, new HashSet(), isConexaoPorAgrupamento); i = 1; } @@ -151,7 +151,7 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci } - private void adicionarLocalidadeGerada(ConexionCtrlVO conexionCtrl, List localidadesGeradas, ParadaVOConexionRuta trechoA, ParadaVOConexionRuta trechoB, ParadaVOConexionRuta trechoC, Set rutasVendaA, Set rutasVendaB, Set rutasVendaC) { + private void adicionarLocalidadeGerada(ConexionCtrlVO conexionCtrl, List localidadesGeradas, ParadaVOConexionRuta trechoA, ParadaVOConexionRuta trechoB, ParadaVOConexionRuta trechoC, Set rutasVendaA, Set rutasVendaB, Set rutasVendaC, Boolean isConexaoPorAgrupamento) { boolean isTrechoAVende = false; boolean isTrechoBVende = false; @@ -172,7 +172,7 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci } } - if(isTrechoAVende && isTrechoBVende && isTrechoCVende) { + if((isTrechoAVende && isTrechoBVende && isTrechoCVende) || Boolean.TRUE.equals(isConexaoPorAgrupamento)) { localidadesGeradas.add(trechoA); localidadesGeradas.add(trechoB); if(trechoC != null) { @@ -220,7 +220,7 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci conexionCtrl, conexionRutaCtrl, rutaEixoC.getDescSentido()); i++; - adicionarLocalidadeGerada(conexionCtrl, localidadesGeradas, trechoA, trechoB, trechoC, rutasVendaA, rutasVendaB, rutasVendaC); + adicionarLocalidadeGerada(conexionCtrl, localidadesGeradas, trechoA, trechoB, trechoC, rutasVendaA, rutasVendaB, rutasVendaC, null); i = 1; } @@ -244,7 +244,7 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci conexoesCtrl.addAll(temp); } - public void gerarCombinacionEntre2Eixos(List listParada1, List rutasEixoA, List rutasEixoB, List lsLocalidadesComuns, List listParada4, List rutasEixoA2, List rutasEixoB2, List localidadesGeradas, List conexoesCtrl) { + public void gerarCombinacionEntre2Eixos(List listParada1, List rutasEixoA, List rutasEixoB, List lsLocalidadesComuns, List listParada4, List rutasEixoA2, List rutasEixoB2, List localidadesGeradas, List conexoesCtrl, Boolean isConexaoPorAgrupamento) { for (int i = 0; i < lsLocalidadesComuns.size(); i++) { @@ -279,11 +279,24 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci } Map cacheLocalidades = criandoCacheLocalidades(localidades); - gerarCombinacao(lists, rutasEixoA, rutasEixoB, null, localidadesGeradas, conexoesCtrl, cacheLocalidades); + gerarCombinacao(lists, rutasEixoA, rutasEixoB, null, localidadesGeradas, conexoesCtrl, cacheLocalidades, isConexaoPorAgrupamento); } } + + public List getParadasByAgrupamentoId(Parada parada) { + List localidades = new ArrayList(); + List paradaAgrupamentoList = paradaService.buscarPorAgrupamentoParadaId(parada.getAgrupamentoParada()); + if(paradaAgrupamentoList!=null && !paradaAgrupamentoList.isEmpty()) { + for (Parada paradaAgrupamento : paradaAgrupamentoList) { + if(!localidades.contains(paradaAgrupamento)) { + localidades.add(paradaAgrupamento); + } + } + } + return localidades; + } public void gerarCombinacionEntre3Eixos(List listParada1, List rutasEixoA, List rutasEixoB, List lsLocalidadesComuns, List listParada4, List listParadasC, List rutasEixoA2, List rutasEixoB2, List rutasEixoC, List localidadesGeradas, List conexoesCtrl) { @@ -308,7 +321,7 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci localidades.addAll(listParadasC); Map cacheLocalidades = criandoCacheLocalidades(localidades); - gerarCombinacao(lists, rutasEixoA, rutasEixoB, rutasEixoC, localidadesGeradas, conexoesCtrl, cacheLocalidades); + gerarCombinacao(lists, rutasEixoA, rutasEixoB, rutasEixoC, localidadesGeradas, conexoesCtrl, cacheLocalidades, null); } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaLocalidadeRemovidaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaLocalidadeRemovidaServiceImpl.java index ad45a77bd..b4254f219 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaLocalidadeRemovidaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaLocalidadeRemovidaServiceImpl.java @@ -72,7 +72,6 @@ public class ConexionRutaLocalidadeRemovidaServiceImpl implements ConexionRutaLo /** *Obtem a lista de paradas removidas pela lista de paradas */ - @Transactional public List obtenerPorParadaList(List paradaList) { List paradaIdList = new ArrayList(); for (Parada parada : paradaList) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfTotemVentaRapidaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfTotemVentaRapidaServiceImpl.java new file mode 100644 index 000000000..646673e5e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfTotemVentaRapidaServiceImpl.java @@ -0,0 +1,98 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.ConfTotemVentaRapidaDAO; +import com.rjconsultores.ventaboletos.entidad.ConfTotemVentaRapida; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.service.ConfTotemVentaRapidaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author wallace + */ +@Service("confTotemVentaRapidaService") +public class ConfTotemVentaRapidaServiceImpl implements ConfTotemVentaRapidaService { + + @Autowired + private ConfTotemVentaRapidaDAO confTotemVentaRapidaDAO; + + @Override + public List obtenerTodos() { + return confTotemVentaRapidaDAO.obtenerTodos(); + } + + @Override + public ConfTotemVentaRapida obtenerID(Integer id) { + return confTotemVentaRapidaDAO.obtenerID(id); + } + + @Transactional + @Override + public ConfTotemVentaRapida suscribir(ConfTotemVentaRapida entidad) { + + entidad.setActivo(Boolean.TRUE); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + + return confTotemVentaRapidaDAO.suscribir(entidad); + } + + @Transactional + @Override + public ConfTotemVentaRapida actualizacion(ConfTotemVentaRapida entidad) { + + + entidad.setActivo(Boolean.TRUE); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + return confTotemVentaRapidaDAO.actualizacion(entidad); + } + + @Transactional + @Override + public void borrar(ConfTotemVentaRapida entidad) { + + entidad.setActivo(Boolean.FALSE); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + + confTotemVentaRapidaDAO.actualizacion(entidad); + + } + + @Override + public ConfTotemVentaRapida buscarOrigemDestino(Parada origem, Parada destino) { + return confTotemVentaRapidaDAO.buscarOrigemDestino(origem, destino); + } + + @Override + public List buscarOrigem(Parada origem) { + return confTotemVentaRapidaDAO.buscarOrigem(origem); + } + + @Override + @Transactional + public void apagarPorOrigem(Parada paradaOrigem) { + + for (ConfTotemVentaRapida confTotemVentaRapida : confTotemVentaRapidaDAO.buscarOrigem(paradaOrigem)) { + confTotemVentaRapida.setActivo(Boolean.FALSE); + confTotemVentaRapida.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + confTotemVentaRapida.setFecmodif(Calendar.getInstance().getTime()); + confTotemVentaRapidaDAO.actualizacion(confTotemVentaRapida); + } + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java index dc1b5e984..bdd484945 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java @@ -47,6 +47,7 @@ import com.rjconsultores.ventaboletos.vo.comissao.ConferenciaComissaoVO; import com.rjconsultores.ventaboletos.vo.comissao.DiaConferenciaComissaoVO; import com.rjconsultores.ventaboletos.vo.comissao.EtiquetaMalote; import com.rjconsultores.ventaboletos.vo.comissao.EventosFinanceirosVO; +import com.rjconsultores.ventaboletos.vo.comissao.FormaPagoEventosFinanceirosVO; import com.rjconsultores.ventaboletos.vo.comissao.FormapagoVO; import com.rjconsultores.ventaboletos.vo.comissao.LogConferenciaVO; import com.rjconsultores.ventaboletos.vo.comissao.OcdVO; @@ -575,11 +576,13 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic // calculando os movimentos financeiros for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { - if (formaspagosDeposito.contains(eventosFinanceiros.getFormapagoId())) { - if (eventosFinanceiros.isCredito()) { - totalDeposito = MoneyHelper.somar(totalDeposito, eventosFinanceiros.getImpingreso()); - } else if (eventosFinanceiros.isDebito()) { - totalDeposito = MoneyHelper.subtrair(totalDeposito, eventosFinanceiros.getImpingreso().abs()); + for (FormaPagoEventosFinanceirosVO formaPagamento : eventosFinanceiros.getFormapagos()) { + if (formaspagosDeposito.contains(formaPagamento.getFormapagoId())) { + if (eventosFinanceiros.isCredito()) { + totalDeposito = MoneyHelper.somar(totalDeposito, formaPagamento.getImporte()); + } else if (eventosFinanceiros.isDebito()) { + totalDeposito = MoneyHelper.subtrair(totalDeposito, formaPagamento.getImporte().abs()); + } } } } @@ -630,7 +633,8 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic } for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { - FormapagoVO formapagoEventoFinanceiro = new FormapagoVO(eventosFinanceiros.getFormapagoId(), eventosFinanceiros.getDescpago(), null, BigDecimal.ZERO); + for(FormaPagoEventosFinanceirosVO formaPagoEventosFinanceirosVO: eventosFinanceiros.getFormapagos()) { + FormapagoVO formapagoEventoFinanceiro = new FormapagoVO(formaPagoEventosFinanceirosVO.getFormapagoId(), formaPagoEventosFinanceirosVO.getDescpago(), null, BigDecimal.ZERO); if (totalFormapagos.contains(formapagoEventoFinanceiro)) { formapagoEventoFinanceiro = totalFormapagos.get(totalFormapagos.indexOf(formapagoEventoFinanceiro)); } else { @@ -638,9 +642,10 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic } if (eventosFinanceiros.isCredito()) { - formapagoEventoFinanceiro.add(eventosFinanceiros.getImpingreso()); + formapagoEventoFinanceiro.add(formaPagoEventosFinanceirosVO.getImporte()); } else if (eventosFinanceiros.isDebito()) { - formapagoEventoFinanceiro.subtract(eventosFinanceiros.getImpingreso().abs()); + formapagoEventoFinanceiro.subtract(formaPagoEventosFinanceirosVO.getImporte().abs()); + } } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesServiceImpl.java index d8d8c1832..efbd2578d 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesServiceImpl.java @@ -32,10 +32,12 @@ import com.rjconsultores.ventaboletos.entidad.ClienteFidelidad; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.TarjetaFidelidad; import com.rjconsultores.ventaboletos.entidad.TipoIdentificacion; +import com.rjconsultores.ventaboletos.entidad.TipoOcupacion; import com.rjconsultores.ventaboletos.passageirofrequente.vo.ClienteExcelVo; import com.rjconsultores.ventaboletos.service.ClienteService; import com.rjconsultores.ventaboletos.service.ImportacaoClientesService; import com.rjconsultores.ventaboletos.service.TipoIdentificacionService; +import com.rjconsultores.ventaboletos.service.TipoOcupacionService; import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; import com.rjconsultores.ventaboletos.utilerias.CustomEnum; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -43,10 +45,15 @@ import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @Service("importacaoClientesService") public class ImportacaoClientesServiceImpl implements ImportacaoClientesService { + @Autowired + private TipoOcupacionService tipoOcupacionService; + @Autowired TipoIdentificacionService tipoIdentificacionService; + @Autowired private ClienteService clienteService; + private static Logger log = Logger.getLogger(ImportacaoClientesServiceImpl.class); @Override @@ -165,7 +172,7 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService StringBuilder erros = new StringBuilder(); Integer inseridos = 0; Integer atualizados = 0; - Integer desconsiderados =0; + Integer desconsiderados = 0; InputStream isMExcel = media.getStreamData(); Sheet sheet = null; @@ -184,30 +191,30 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService wb = new XSSFWorkbook(isMExcel); sheet = wb.getSheetAt(0); } catch (IOException e) { - log.error("",e); + log.error("", e); } } int rows = sheet.getPhysicalNumberOfRows(); - - log.info(String.format("Quantidade cliente:%s",rows)); + + log.info(String.format("Quantidade cliente:%s", rows)); if (validaSheet(sheet)) { usaCPFComoFidelidade = ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.USA_CPF_COMO_FIDELIDADE.getDescricao()); - log.info(String.format("usaCPFComoFidelidade:%s",usaCPFComoFidelidade)); + log.info(String.format("usaCPFComoFidelidade:%s", usaCPFComoFidelidade)); try { for (index = 1; index < rows; index++) { - log.info(String.format("index cliente:%s",index)); - + log.info(String.format("index cliente:%s", index)); + Row row = sheet.getRow(index); - if (row == null){ + if (row == null) { log.info("index/row empty"); continue; } - + Iterator cellIterator = row.cellIterator(); ClienteExcelVo cliente = new ClienteExcelVo(); - + while (cellIterator.hasNext()) { Cell cell = cellIterator.next(); switch (cell.getColumnIndex()) { @@ -241,7 +248,7 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService cliente.setFax(cell.getStringCellValue()); break; case 7: - + String dt = null; if (cell.getCellType() == Cell.CELL_TYPE_STRING) { @@ -250,7 +257,7 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService dt = cell.getDateCellValue() != null ? new SimpleDateFormat("dd/MM/yyyy").format(cell.getDateCellValue()) : null; } cliente.setNascimento(dt); - + break; case 8: cell.setCellType(Cell.CELL_TYPE_STRING); @@ -275,17 +282,17 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService } } - log.info(String.format("cliente:%s cpf:%s",cliente.getNome(),cliente.getCpf())); - + log.info(String.format("cliente:%s cpf:%s", cliente.getNome(), cliente.getCpf())); + if (validaDadosPlanilha(cliente, erros)) { log.info("enviado para gravação..."); - try{ - Integer[] gravados = salvarClienteExcel(empresas, usaCPFComoFidelidade, cliente, tipoIdentificacionUno, tipoIdentificacionDoos); + try { + Integer[] gravados = salvarClienteExcel(empresas, usaCPFComoFidelidade, cliente, tipoIdentificacionUno, tipoIdentificacionDoos, false); inseridos = gravados[0] + inseridos; atualizados = gravados[1] + atualizados; desconsiderados = gravados[2] + desconsiderados; - }catch(Throwable e){ - log.error("Erro na gravação do registro. Favor revisar",e); + } catch (Throwable e) { + log.error("Erro na gravação do registro. Favor revisar", e); log.info("continuando importação"); } @@ -295,14 +302,14 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService erros.append(index + 1).append(" do arquivo."); } } - qtdeGravados.append("Gravados ").append(inseridos + atualizados).append(" clientes de ").append(index-1).append(" importados.\n"); + qtdeGravados.append("Gravados ").append(inseridos + atualizados).append(" clientes de ").append(index - 1).append(" importados.\n"); qtdeGravados.append("Desconsiderados ").append(desconsiderados).append(" clientes.\n"); qtdeGravados.append("Atualizados ").append(atualizados).append(" clientes.\n"); qtdeGravados.append("Inseridos ").append(inseridos).append(" novos clientes."); String[] resultado = { qtdeGravados.toString(), erros.toString() }; - + log.info("importação finalizada"); - + return resultado; } catch (ArrayIndexOutOfBoundsException e) { @@ -326,13 +333,20 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService } - private Integer[] salvarClienteExcel(List empresas, Boolean usaCPFComoFidelidade, ClienteExcelVo cliente, TipoIdentificacion tipoIdentificacionUno, TipoIdentificacion tipoIdentificacionDoos) throws ParseException { + private Integer[] salvarClienteExcel(List empresas, Boolean usaCPFComoFidelidade, ClienteExcelVo cliente, + TipoIdentificacion tipoIdentificacionUno, TipoIdentificacion tipoIdentificacionDoos, boolean isImportacaoPolicial) throws ParseException { Integer inseridos = new Integer(0); Integer atualizados = new Integer(0); Integer desconsiderados = new Integer(0); Integer[] gravados = { 0, 0, 0 }; Cliente clienteGravar = new Cliente(); - List lsCliente = clienteService.buscarPorDocumento(cliente.getCpf()); + + String docBusca = cliente.getCpf(); + if (isImportacaoPolicial) { + docBusca = cliente.getRg(); + } + + List lsCliente = clienteService.buscarPorDocumento(docBusca); if (lsCliente != null && !lsCliente.isEmpty()) { if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.IS_DESCONSIDERA_CLIENTE_NA_BASE.getDescricao())) { @@ -344,23 +358,45 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService } } - // if (true) { - criarFidelidadesTodasEmpresas(clienteGravar, empresas, cliente); - // } - clienteGravar.setFecnacimiento(StringUtils.isEmpty(cliente.getNascimento()) ? null : retornaDate(cliente.getNascimento())); - clienteGravar.setDesccorreo(cliente.getEmail()); + if (usaCPFComoFidelidade == null) + usaCPFComoFidelidade = false; + + criarFidelidadesTodasEmpresas(clienteGravar, empresas, cliente, usaCPFComoFidelidade); + clienteGravar.setNombcliente(cliente.getNome()); - clienteGravar.setNumfax(cliente.getFax()); - clienteGravar.setNumtelefono(cliente.getTelefone()); - clienteGravar.setNumtelefonodos(cliente.getCelular()); - clienteGravar.setIndsexo(cliente.getSexo()); - clienteGravar.setNumIdentificaUno(cliente.getCpf()); - clienteGravar.setTipoIdentificacionUno(tipoIdentificacionUno); - if (!StringUtils.isEmpty(cliente.getRg())) { - clienteGravar.setNumIdentificaDos(cliente.getRg()); - clienteGravar.setTipoIdentificacionDos(tipoIdentificacionDoos); + + if (isImportacaoPolicial) { + if (!StringUtils.isEmpty(cliente.getRg())) { + clienteGravar.setNumIdentificaUno(cliente.getRg()); + clienteGravar.setTipoIdentificacionUno(tipoIdentificacionUno); + } + + List ls = tipoOcupacionService.buscar("POLICIAL MILITAR", null); + if (ls == null || ls.isEmpty()) { + return null; + } else { + clienteGravar.setTipoocupacionId(ls != null && !ls.isEmpty() ? ls.get(0) : null); + } + + } else { + clienteGravar.setFecnacimiento(StringUtils.isEmpty(cliente.getNascimento()) ? null : retornaDate(cliente.getNascimento())); + clienteGravar.setDesccorreo(cliente.getEmail()); + + clienteGravar.setNumfax(cliente.getFax()); + clienteGravar.setNumtelefono(cliente.getTelefone()); + clienteGravar.setNumtelefonodos(cliente.getCelular()); + clienteGravar.setIndsexo(cliente.getSexo()); + clienteGravar.setNumIdentificaUno(cliente.getCpf()); + clienteGravar.setTipoIdentificacionUno(tipoIdentificacionUno); + + if (!StringUtils.isEmpty(cliente.getRg())) { + clienteGravar.setNumIdentificaDos(cliente.getRg()); + clienteGravar.setTipoIdentificacionDos(tipoIdentificacionDoos); + } + + setDirecion(clienteGravar, cliente); } - setDirecion(clienteGravar, cliente); + if (clienteGravar.getClienteId() == null) { clienteGravar.setFecCadastro(new Date()); clienteService.suscribir(clienteGravar); @@ -397,7 +433,7 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService } - private void criarFidelidadesTodasEmpresas(Cliente cliente, List empresas, ClienteExcelVo cExce) { + private void criarFidelidadesTodasEmpresas(Cliente cliente, List empresas, ClienteExcelVo cExce, Boolean usaCPFComoFidelidade) { Boolean achou = false; List fidelidades = null; @@ -405,7 +441,7 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService if (cliente.getClienteId() == null) { fidelidades = new ArrayList(); for (Empresa e : empresas) { - fidelidades.add(criarFidelidade(e, cExce)); + fidelidades.add(criarFidelidade(e, cExce, usaCPFComoFidelidade)); } cliente.setListClienteFidelidad(fidelidades); @@ -413,7 +449,7 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService fidelidades = cliente.getListClienteFidelidad(); if (fidelidades == null || fidelidades.isEmpty()) { for (Empresa e : empresas) { - fidelidades.add(criarFidelidade(e, cExce)); + fidelidades.add(criarFidelidade(e, cExce, usaCPFComoFidelidade)); } } else { for (Empresa e : empresas) { @@ -432,7 +468,7 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService } } if (!achou) { - fidelidades.add(criarFidelidade(e, cExce)); + fidelidades.add(criarFidelidade(e, cExce, usaCPFComoFidelidade)); } achou = false; } @@ -441,43 +477,10 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService } - // private List criarFidelidadesTodasEmpresas(List fidelidades, List empresas, ClienteExcelVo cExce) { - // - // List result = new ArrayList(); - // Boolean achou = false; - // if (fidelidades==null || fidelidades.isEmpty()) { - // for (Empresa e : empresas) { - // result.add(criarFidelidade(e, cExce)); - // } - // } else { - // for (Empresa e : empresas) { - // for (ClienteFidelidad f : fidelidades) { - // if (f.getEmpresa().equals(e)) { - // f.setActivo(true); - // f.setFecmodif(new Date()); - // TarjetaFidelidad tarjetaFidelidad = f.getTarjetaFidelidad(); - // if(tarjetaFidelidad!=null){ - // tarjetaFidelidad.setActivo(true); - // tarjetaFidelidad.setFecmodif(new Date()); - // } - // result.add(f); - // achou = true; - // break; - // } - // } - // if (!achou) { - // result.add(criarFidelidade(e, cExce)); - // } - // achou = false; - // } - // } - // return result; - // } - - private ClienteFidelidad criarFidelidade(Empresa e, ClienteExcelVo cExcel) { + private ClienteFidelidad criarFidelidade(Empresa e, ClienteExcelVo cExcel, Boolean usaCPFComoFidelidade) { ClienteFidelidad clienteFidelidad = new ClienteFidelidad(); TarjetaFidelidad tarjetaFidelidad = new TarjetaFidelidad(); - tarjetaFidelidad.setNumTarjeta(cExcel.getCpf()); + tarjetaFidelidad.setNumTarjeta(usaCPFComoFidelidade ? cExcel.getCpf() : cExcel.getRg()); tarjetaFidelidad.setActivo(true); tarjetaFidelidad.setFecmodif(Calendar.getInstance().getTime()); tarjetaFidelidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); @@ -624,6 +627,29 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService return true; } + private Boolean validaSheetImportacaoPolicial(Sheet sheet) { + + Row row = sheet.getRow(0); + Iterator cellIterator = row.cellIterator(); + + while (cellIterator.hasNext()) { + Cell cell = cellIterator.next(); + switch (cell.getColumnIndex()) { + case 0: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesPolicialController.HEADERCOLUMN.nome"))) { + break; + } + return false; + case 1: + if (cell.getStringCellValue().equalsIgnoreCase(Labels.getLabel("importarClientesPolicialController.HEADERCOLUMN.rg"))) { + break; + } + return false; + } + } + return true; + } + private Date retornaDate(String date) throws ParseException { SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); @@ -655,4 +681,124 @@ public class ImportacaoClientesServiceImpl implements ImportacaoClientesService return true; } + @Override + public String[] lerArquivoPolicialExcel(Media media, List empresas) { + + List lsTipoIdentificacion = tipoIdentificacionService.obtenerTodos(); + TipoIdentificacion tipoIdentificacionUno = null; + + for (TipoIdentificacion t : lsTipoIdentificacion) { + + if (t.getDesctipo().equalsIgnoreCase("rg")) { + tipoIdentificacionUno = t; + } + if (tipoIdentificacionUno != null) + break; + } + + Integer index = 1; + StringBuilder qtdeGravados = new StringBuilder(); + StringBuilder erros = new StringBuilder(); + Integer inseridos = 0; + Integer atualizados = 0; + Integer desconsiderados = 0; + InputStream isMExcel = media.getStreamData(); + Sheet sheet = null; + + if (media.getFormat().equals("xls")) { + HSSFWorkbook wb; + try { + wb = new HSSFWorkbook(isMExcel); + sheet = wb.getSheetAt(0); + } catch (IOException e) { + e.printStackTrace(); + } + + } else if (media.getFormat().equals("xlsx")) { + XSSFWorkbook wb; + try { + wb = new XSSFWorkbook(isMExcel); + sheet = wb.getSheetAt(0); + } catch (IOException e) { + log.error("", e); + } + } + + int rows = sheet.getPhysicalNumberOfRows(); + + log.info(String.format("Quantidade cliente:%s", rows)); + + if (validaSheetImportacaoPolicial(sheet)) { + + try { + for (index = 1; index < rows; index++) { + log.info(String.format("index cliente:%s", index)); + + Row row = sheet.getRow(index); + if (row == null) { + log.info("index/row empty"); + continue; + } + + Iterator cellIterator = row.cellIterator(); + ClienteExcelVo cliente = new ClienteExcelVo(); + + while (cellIterator.hasNext()) { + Cell cell = cellIterator.next(); + switch (cell.getColumnIndex()) { + case 0: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setNome(cell.getStringCellValue()); + break; + case 1: + cell.setCellType(Cell.CELL_TYPE_STRING); + cliente.setRg(cell.getStringCellValue()); + break; + } + } + log.info(String.format("cliente:%s rg:%s", cliente.getNome(), cliente.getRg())); + + log.info("enviado para gravação..."); + try { + Integer[] gravados = salvarClienteExcel(empresas, false, cliente, tipoIdentificacionUno, null, true); + inseridos = gravados[0] + inseridos; + atualizados = gravados[1] + atualizados; + desconsiderados = gravados[2] + desconsiderados; + } catch (Throwable e) { + log.error("Erro na gravação do registro. Favor revisar", e); + log.info("continuando importação"); + } + + } + qtdeGravados.append("Gravados ").append(inseridos + atualizados).append(" clientes de ").append(index - 1).append(" importados.\n"); + qtdeGravados.append("Desconsiderados ").append(desconsiderados).append(" clientes.\n"); + qtdeGravados.append("Atualizados ").append(atualizados).append(" clientes.\n"); + qtdeGravados.append("Inseridos ").append(inseridos).append(" novos clientes."); + String[] resultado = { qtdeGravados.toString(), erros.toString() }; + + log.info("importação finalizada"); + + return resultado; + + } catch (ArrayIndexOutOfBoundsException e) { + e.printStackTrace(); + String msg = "Erro ao gravar cliente na linha " + (index + 1) + " do arquivo."; + erros.append(msg); + String[] resultado = { "Houve erro ao gravar os clientes, consulte o arquivo de erros.", erros.toString() }; + return resultado; + } catch (Exception e) { + e.printStackTrace(); + erros.append("Linha ").append(index).append(" do arquivo de clientes, erro: ").append(e.getCause().getCause()).append("\n"); + String[] resultado = { "Houve erro ao gravar os clientes, consulte o arquivo de erros.", erros.toString() }; + return resultado; + } + + } else { + erros.append("A estrutura do arquivo esta com erro ").append("\n"); + String[] resultado = { "Houve erro ao gravar os clientes, consulte o arquivo de erros.", erros.toString() }; + return resultado; + } + + } + } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java index a5241d8c7..1c7e0b86d 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java @@ -4,6 +4,7 @@ import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStreamReader; +import java.math.BigDecimal; import java.sql.SQLException; import org.apache.log4j.Logger; @@ -24,6 +25,9 @@ import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @Service("importacaoRetornoBancarioService") public class ImportacaoRetornoBancarioServiceImpl implements ImportacaoRetornoBancarioService { + private static final String LIQUIDACAO_NORMAL = "06"; + private static final String LIQUIDACAO_EM_CARTORIO = "08"; + @Autowired private RemessaCNABBancosDAO remessaCNABBancosDAO; @@ -55,7 +59,11 @@ public class ImportacaoRetornoBancarioServiceImpl implements ImportacaoRetornoBa for (DetalheRetorno detalhe : retornoBancario.getTitulos()) { try { - if( salvarRetornoBancario( detalhe, empresa.getEmpresaId(), usuarioId )) { + if( !detalhe.getCodigoOcorrencia().equals(LIQUIDACAO_NORMAL) + && !detalhe.getCodigoOcorrencia().equals(LIQUIDACAO_EM_CARTORIO) ) { + erros++; + detalhado.append("Registro sem ocorrencia de quitação: ").append(detalhe.getNossoNumero()).append(".\n"); + }else if( salvarRetornoBancario( detalhe, empresa.getEmpresaId(), usuarioId )) { atualizados++; detalhado.append("Quitado:").append(detalhe.getNossoNumero()).append(".\n"); }else { @@ -124,9 +132,12 @@ public class ImportacaoRetornoBancarioServiceImpl implements ImportacaoRetornoBa continue; } - if(linha.startsWith("1")) { //detalhe + if(linha.startsWith("1")) { //detalhe DetalheRetornoItau detalhe = new DetalheRetornoItau(); + detalhe.setCodigoOcorrencia(linha.substring(108, 110)); + detalhe.setValorJuros( new BigDecimal(linha.substring(266, 279)).divide(new BigDecimal(100)) ); detalhe.setNossoNumero(linha.substring(85, 93)+"-"+linha.substring(93, 94)); + detalhe.setDataBaixa(linha.substring(110, 116)); arquivo.addTitulo(detalhe); continue; } @@ -155,7 +166,7 @@ public class ImportacaoRetornoBancarioServiceImpl implements ImportacaoRetornoBa throw new RuntimeException("Boleto já quitado para a empresa com o nosso numero: "+detalhe.getNossoNumero()); } - return remessaCNABBancosDAO.quitarFechamentoBoleto( boleto.getFechamentoboletoId(), usuarioId ); + return remessaCNABBancosDAO.quitarFechamentoBoleto( boleto.getFechamentoboletoId(), usuarioId, detalhe ); } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java index 135b00701..9e19b748f 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java @@ -26,6 +26,7 @@ import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.service.ParadaService; import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.parada.ParadaVO; /** * @@ -179,4 +180,9 @@ public class ParadaServiceImpl implements ParadaService { public List buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada){ return paradaDAO.buscarPorAgrupamentoParadaId(agrupamentoParada); } + + @Override + public List buscarDestinosPorOrigem(Integer origemId) { + return paradaDAO.buscarDestinosPorOrigem(origemId); + } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaExcecaoMultaCancServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaExcecaoMultaCancServiceImpl.java new file mode 100644 index 000000000..c747ccc7c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaExcecaoMultaCancServiceImpl.java @@ -0,0 +1,57 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.PtovtaExcecaoMultaCancDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaExcecaoMultaCanc; +import com.rjconsultores.ventaboletos.service.PtovtaExcecaoMultaCancService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("ptovtaExcecaoMultaCancService") +public class PtovtaExcecaoMultaCancServiceImpl implements PtovtaExcecaoMultaCancService { + + @Autowired + PtovtaExcecaoMultaCancDAO ptovtaExcecaoMultaCancDAO; + + @Override + public List obtenerTodos() { + return ptovtaExcecaoMultaCancDAO.obtenerTodos(); + } + + @Override + public PtovtaExcecaoMultaCanc obtenerID(Integer id) { + return ptovtaExcecaoMultaCancDAO.obtenerID(id); + } + + @Override + @Transactional + public PtovtaExcecaoMultaCanc suscribir(PtovtaExcecaoMultaCanc entidad) { + entidad.setActivo(true); + entidad.setFecmodif(new Date()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return ptovtaExcecaoMultaCancDAO.suscribir(entidad); + } + + @Override + @Transactional + public PtovtaExcecaoMultaCanc actualizacion(PtovtaExcecaoMultaCanc entidad) { + entidad.setFecmodif(new Date()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return ptovtaExcecaoMultaCancDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(PtovtaExcecaoMultaCanc entidad) { + entidad.setActivo(false); + entidad.setFecmodif(new Date()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + ptovtaExcecaoMultaCancDAO.actualizacion(entidad); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java index 47dd51eb9..798b8b03a 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -435,9 +435,11 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { PuntoVenta originalClone = null; try { originalClone = entidad.getCloneObject(); - originalClone.setTitularId(entidad.getTitularId().getCloneObject()); + if(entidad.getTitularId()!=null) { + originalClone.setTitularId(entidad.getTitularId().getCloneObject()); + } } catch (Exception e) { - log.error("",e); + log.error("Erro ao clonar TitularId",e); } entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java index 24a35e7fe..f54a8e929 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java @@ -14,6 +14,7 @@ import com.rjconsultores.ventaboletos.dao.SapDAO; import com.rjconsultores.ventaboletos.entidad.Constante; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.rest.IntegracaoSapRest; import com.rjconsultores.ventaboletos.service.SapService; import com.rjconsultores.ventaboletos.utilerias.DateUtil; @@ -65,7 +66,12 @@ public class SapServiceImpl implements SapService{ @Override public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) { - return sapDAO.obtenerTodosParaRemessa(empresa, dataDe, dataAte, reenviar); + return sapDAO.obtenerTodosParaRemessa(empresa, dataDe, dataAte, reenviar, null); + } + + @Override + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar, PuntoVenta puntoVenta) { + return sapDAO.obtenerTodosParaRemessa(empresa, dataDe, dataAte, reenviar, puntoVenta); } @Override diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TipoOcupacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TipoOcupacionServiceImpl.java index 4ce1ccad7..f53128fd6 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/TipoOcupacionServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/TipoOcupacionServiceImpl.java @@ -21,49 +21,53 @@ import org.springframework.transaction.annotation.Transactional; @Service("tipoOcupacionService") public class TipoOcupacionServiceImpl implements TipoOcupacionService { - @Autowired - private TipoOcupacionDAO tipoOcupacionDAO; + @Autowired + private TipoOcupacionDAO tipoOcupacionDAO; - public List obtenerTodos() { - return tipoOcupacionDAO.obtenerTodos(); - } + public List obtenerTodos() { + return tipoOcupacionDAO.obtenerTodos(); + } - public TipoOcupacion obtenerID(Integer id) { - return tipoOcupacionDAO.obtenerID(id); - } + public TipoOcupacion obtenerID(Integer id) { + return tipoOcupacionDAO.obtenerID(id); + } - @Transactional - public TipoOcupacion suscribir(TipoOcupacion entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.TRUE); + @Transactional + public TipoOcupacion suscribir(TipoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); - return tipoOcupacionDAO.suscribir(entidad); - } + return tipoOcupacionDAO.suscribir(entidad); + } - @Transactional - public TipoOcupacion actualizacion(TipoOcupacion entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.TRUE); + @Transactional + public TipoOcupacion actualizacion(TipoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); - return tipoOcupacionDAO.actualizacion(entidad); - } + return tipoOcupacionDAO.actualizacion(entidad); + } - @Transactional - public void borrar(TipoOcupacion entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.FALSE); + @Transactional + public void borrar(TipoOcupacion entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); - tipoOcupacionDAO.actualizacion(entidad); - } + tipoOcupacionDAO.actualizacion(entidad); + } - public List buscar(String desctipo, String cvetipoocupacion) { - return tipoOcupacionDAO.buscar(desctipo, cvetipoocupacion); - } + public List buscar(String desctipo) { + return buscar(desctipo, null); + } - public List buscarClave(String cvetipoocupacion) { - return tipoOcupacionDAO.buscarClave(cvetipoocupacion); - } + public List buscar(String desctipo, String cvetipoocupacion) { + return tipoOcupacionDAO.buscar(desctipo, cvetipoocupacion); + } + + public List buscarClave(String cvetipoocupacion) { + return tipoOcupacionDAO.buscarClave(cvetipoocupacion); + } } diff --git a/src/com/rjconsultores/ventaboletos/utilerias/ApplicationProperties.java b/src/com/rjconsultores/ventaboletos/utilerias/ApplicationProperties.java index 240d2ceb4..c29fbed64 100644 --- a/src/com/rjconsultores/ventaboletos/utilerias/ApplicationProperties.java +++ b/src/com/rjconsultores/ventaboletos/utilerias/ApplicationProperties.java @@ -136,7 +136,12 @@ public class ApplicationProperties { */ public boolean isCustomHabilitado(String key, String defaultValue) { String property = getValuefromCustom(key, defaultValue); - return property.equals("1"); + return property.equals("1") ; + } + + public boolean isCustomHabilitado(String key, Boolean defaultValue) { + String property = getValuefromCustom(key, defaultValue.toString()); + return property.equals("true") ; } private InputStream readImagefromCustom(String imagene) throws FileNotFoundException, IOException { diff --git a/src/com/rjconsultores/ventaboletos/utilerias/CustomEnum.java b/src/com/rjconsultores/ventaboletos/utilerias/CustomEnum.java index 73c152814..0821146a1 100644 --- a/src/com/rjconsultores/ventaboletos/utilerias/CustomEnum.java +++ b/src/com/rjconsultores/ventaboletos/utilerias/CustomEnum.java @@ -153,7 +153,9 @@ public enum CustomEnum { IS_DESABILITA_USUARIO_ADMINISTRADORES_PERFIL("dasabilitaUsuarioAdministradoresPerfil"), - INTEGRACION_SAFER("integracion.safer"); + INTEGRACION_SAFER("integracion.safer"), + + IS_VENDA_MACON("IsVendaMacon"); private String descricao; diff --git a/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java b/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java index 55d0e4b8c..5e31f3549 100644 --- a/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java +++ b/src/com/rjconsultores/ventaboletos/utilerias/DateUtil.java @@ -206,6 +206,16 @@ public final class DateUtil { d = df.parse(data); return d; } + + public static java.sql.Timestamp getTimestampFromString(String data, String formato) throws java.text.ParseException { + Date d = new Date(); + DateFormat df = new SimpleDateFormat(formato); + + d = df.parse(data); + return new java.sql.Timestamp(d.getTime()); + } + + public static int compareDate(java.util.Date d1) { return compareDate(d1, new java.util.Date()); diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/EventosFinanceirosVO.java b/src/com/rjconsultores/ventaboletos/vo/comissao/EventosFinanceirosVO.java index 77c314a5d..ed44d84e9 100644 --- a/src/com/rjconsultores/ventaboletos/vo/comissao/EventosFinanceirosVO.java +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/EventosFinanceirosVO.java @@ -2,6 +2,7 @@ package com.rjconsultores.ventaboletos.vo.comissao; import java.math.BigDecimal; import java.util.Date; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.zkoss.util.resource.Labels; @@ -49,7 +50,10 @@ public class EventosFinanceirosVO { private Long cajaDiversosId; private Integer usuarioId; private Integer turnoId; + private List formapagos; + + public EventosFinanceirosVO(Long eventoextraId, Long logconferenciaId) { this.eventoextraId = eventoextraId; this.logconferenciaId = logconferenciaId; @@ -334,6 +338,36 @@ public class EventosFinanceirosVO { public void setTurnoId(Integer turnoId) { this.turnoId = turnoId; } + + + + public List getFormapagos() { + return formapagos; + } + + public void setFormapagos(List formapagos) { + this.formapagos = formapagos; + } + + public String getDescFormapagos() { + StringBuilder sFormapagos = new StringBuilder(); + for (FormaPagoEventosFinanceirosVO formapago : formapagos) { + if (sFormapagos.length() > 0) { + sFormapagos.append(", "); + } + sFormapagos.append(formapago.getDescpago()); + } + return sFormapagos.toString(); + } + + public BigDecimal getTotal() { + BigDecimal total = BigDecimal.ZERO; + for (FormaPagoEventosFinanceirosVO formapagoVO : formapagos) { + total = total.add(formapagoVO.getImporte()); + } + return total; + } + @Override public int hashCode() { @@ -366,4 +400,7 @@ public class EventosFinanceirosVO { return true; } + + + } diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/FormaPagoEventosFinanceirosVO.java b/src/com/rjconsultores/ventaboletos/vo/comissao/FormaPagoEventosFinanceirosVO.java new file mode 100644 index 000000000..155554846 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/FormaPagoEventosFinanceirosVO.java @@ -0,0 +1,63 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +import java.math.BigDecimal; + +import com.rjconsultores.ventaboletos.utilerias.BigDecimalUtil; +import com.rjconsultores.ventaboletos.utilerias.LocaleUtil; +import com.rjconsultores.ventaboletos.utilerias.MoneyHelper; + +public class FormaPagoEventosFinanceirosVO { + + private Integer formapagoId; + private String descpago; + private BigDecimal importe; + + + + + public FormaPagoEventosFinanceirosVO(Integer formapagoId, String descpago, BigDecimal importe) { + super(); + this.formapagoId = formapagoId; + this.descpago = descpago; + this.importe = importe; + } + public Integer getFormapagoId() { + return formapagoId; + } + public void setFormapagoId(Integer formapagoId) { + this.formapagoId = formapagoId; + } + public String getDescpago() { + return descpago; + } + public void setDescpago(String descpago) { + this.descpago = descpago; + } + public BigDecimal getImporte() { + return importe; + } + public void setImporte(BigDecimal importe) { + this.importe = importe; + } + + + public String getImporteFormatado() { + return BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(getImporte(), LocaleUtil.getLocale()); + } + + public void add(BigDecimal importe) { + this.importe = MoneyHelper.somar(this.importe, (importe != null ? importe : BigDecimal.ZERO)); + } + + public void subtract(BigDecimal importe) { + this.importe = MoneyHelper.subtrair(this.importe,(importe != null ? importe : BigDecimal.ZERO)); + } + + + + + + + + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/conftotem/ConfTotemVentaRapidaVO.java b/src/com/rjconsultores/ventaboletos/vo/conftotem/ConfTotemVentaRapidaVO.java new file mode 100644 index 000000000..e173d4f8e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/conftotem/ConfTotemVentaRapidaVO.java @@ -0,0 +1,67 @@ +package com.rjconsultores.ventaboletos.vo.conftotem; + +import com.rjconsultores.ventaboletos.entidad.Parada; + +public class ConfTotemVentaRapidaVO { + + private Parada origem; + private Parada destino; + + public Parada getOrigem() { + return origem; + } + + public void setOrigem(Parada origem) { + this.origem = origem; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + public ConfTotemVentaRapidaVO() { + super(); + } + + public ConfTotemVentaRapidaVO(Parada origem ,Parada destino) { + super(); + this.origem = origem; + this.destino = destino; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((destino == null) ? 0 : destino.hashCode()); + result = prime * result + ((origem == null) ? 0 : origem.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + ConfTotemVentaRapidaVO other = (ConfTotemVentaRapidaVO) obj; + if (destino == null) { + if (other.destino != null) + return false; + } else if (!destino.equals(other.destino)) + return false; + if (origem == null) { + if (other.origem != null) + return false; + } else if (!origem.equals(other.origem)) + return false; + return true; + } + + +} From 12027cf46163af56a55eb3dbc88029ebab7d1071 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Mon, 10 Oct 2022 14:17:00 -0300 Subject: [PATCH 14/34] sincronismo de fonte --- .../ventaboletos/dao/CalcularPeajeDAO.java | 4 +- .../dao/ConfRestricaoCanalVentaDAO.java | 4 + .../dao/EmpresaEmailEComerceDAO.java | 14 + .../ventaboletos/dao/ParadaDAO.java | 2 + .../ventaboletos/dao/RutaDAO.java | 7 +- .../ventaboletos/dao/TarifaMinimaDAO.java | 5 +- .../ventaboletos/dao/TarifaOficialDAO.java | 4 +- .../hibernate/CalcularPeajeHibernateDAO.java | 21 +- .../ConfRestricaoCanalVentaHibernateDAO.java | 24 ++ .../EmpresaEmailEComerceHibernateDAO.java | 42 +++ .../dao/hibernate/ParadaHibernateDAO.java | 35 +++ .../dao/hibernate/RutaHibernateDAO.java | 57 ++++ .../hibernate/TarifaMinimaHibernateDAO.java | 11 +- .../hibernate/TarifaOficialHibernateDAO.java | 14 +- .../dao/sqlbuilder/SQLBuilder.java | 8 +- .../dao/sqlbuilder/impl/SQLBuilderOracle.java | 149 ++++++----- .../entidad/EmpresaEmailEComerce.java | 248 ++++++++++++++++++ .../ventaboletos/entidad/RedondeoCtrl.java | 18 ++ .../entidad/RedondeoOrgaoConcedente.java | 143 ++++++++++ .../ventaboletos/enums/TipoEmail.java | 47 ++++ .../enums/TipoOperacaoECommerce.java | 49 ++++ .../service/CalcularPeajeService.java | 4 +- .../ConfRestricaoCanalVentaService.java | 5 + .../service/EmpresaEmailEComerceService.java | 10 + .../ventaboletos/service/ParadaService.java | 2 + .../ventaboletos/service/RutaService.java | 6 + .../service/TarifaMinimaService.java | 14 +- .../service/TarifaOficialService.java | 5 +- .../ventaboletos/service/TarifaService.java | 2 +- .../impl/CalcularPeajeServiceImpl.java | 9 +- .../ConfRestricaoCanalVentaServiceImpl.java | 17 ++ .../service/impl/CorridaServiceImpl.java | 130 ++++++++- .../impl/EmpresaEmailEComerceServiceImpl.java | 68 +++++ .../ImportacaoClientesSrvpServiceImpl.java | 15 +- .../service/impl/ParadaServiceImpl.java | 5 + .../service/impl/RutaServiceImpl.java | 19 +- .../service/impl/SapServiceImpl.java | 6 +- .../impl/TarifaEmbarcadaServiceImpl.java | 4 +- .../service/impl/TarifaMinimaServiceImpl.java | 13 +- .../impl/TarifaOficialServiceImpl.java | 10 +- .../service/impl/TarifaServiceImpl.java | 14 +- 41 files changed, 1123 insertions(+), 141 deletions(-) create mode 100644 src/com/rjconsultores/ventaboletos/dao/EmpresaEmailEComerceDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailEComerceHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/EmpresaEmailEComerce.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/RedondeoOrgaoConcedente.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoEmail.java create mode 100644 src/com/rjconsultores/ventaboletos/enums/TipoOperacaoECommerce.java create mode 100644 src/com/rjconsultores/ventaboletos/service/EmpresaEmailEComerceService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailEComerceServiceImpl.java diff --git a/src/com/rjconsultores/ventaboletos/dao/CalcularPeajeDAO.java b/src/com/rjconsultores/ventaboletos/dao/CalcularPeajeDAO.java index b545ca863..3bca26d20 100644 --- a/src/com/rjconsultores/ventaboletos/dao/CalcularPeajeDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/CalcularPeajeDAO.java @@ -6,9 +6,9 @@ import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.entidad.Ruta; public interface CalcularPeajeDAO { - public List buscarCasetasPeajeWithinTramo(Ruta ruta); + public List buscarCasetasPeajeWithinTramo(Ruta ruta,Integer[] listCasetaPeaje); - public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao, boolean usaICMS) throws Exception; + public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao, boolean usaICMS,Integer[] listCasetaPeaje) throws Exception; public List buscarRutaWithCasetaPeajeFromOrgao(OrgaoConcedente oc); } diff --git a/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoCanalVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoCanalVentaDAO.java index ea64a5793..ee30584e0 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoCanalVentaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ConfRestricaoCanalVentaDAO.java @@ -1,5 +1,7 @@ package com.rjconsultores.ventaboletos.dao; +import java.util.List; + import com.rjconsultores.ventaboletos.entidad.ConfRestricaoCanalVenta; public interface ConfRestricaoCanalVentaDAO{ @@ -13,4 +15,6 @@ public interface ConfRestricaoCanalVentaDAO{ public void borrar(ConfRestricaoCanalVenta entidad); public Long count(String campo, Object o); + + public Boolean inativarListConfRestricaoCanalVenta(List idsConfRestricaoCanalVenta, Integer usuarioId); } diff --git a/src/com/rjconsultores/ventaboletos/dao/EmpresaEmailEComerceDAO.java b/src/com/rjconsultores/ventaboletos/dao/EmpresaEmailEComerceDAO.java new file mode 100644 index 000000000..3038d6ef1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/EmpresaEmailEComerceDAO.java @@ -0,0 +1,14 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailEComerce; + +public interface EmpresaEmailEComerceDAO extends GenericDAO { + + public List obtenerTodos(); + + public EmpresaEmailEComerce buscarPorEmpresa(Empresa empresa, String tipoOperacao); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java index bebbf5bb0..fede3a35a 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java @@ -63,4 +63,6 @@ public interface ParadaDAO { public List buscarDestinosPorOrigem(Integer origemId); + public List obtenerOrigenPorListRutaIds(Integer orgaoConcendenteId, Integer empresaId,Integer[] listRuta); + } diff --git a/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java b/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java index fc27cc587..6af7ce7ed 100644 --- a/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java @@ -65,11 +65,16 @@ public interface RutaDAO extends GenericDAO { public List buscarPorRutaPorEmpresas(List lsEmpresas); public List buscarRutasPorEmpresaOrgaoConcedente(Empresa empresa, OrgaoConcedente orgao); - + + public List buscarRutasPorEmpresaOrgaoConcedenteParadaIds(Empresa empresa, OrgaoConcedente orgao, Integer[] lsParadaIds) ; + public void updateAsientosVendibles(Ruta ruta, Tramo viejoTramo, Tramo nuevoTramo); public List buscarRutasVendaEmbarcada(List empresasIds, Integer rutaId, String numeroLinha, String descRuta, ClaseServicio classe); public List buscaLikeComboBox(String stringConsulta); + public List buscarPorIds(Integer[] rutaIds); + + public List buscarPorOrgaoEcasetaPeaje(OrgaoConcedente orgao, Integer[] listCasetaPeaje); } diff --git a/src/com/rjconsultores/ventaboletos/dao/TarifaMinimaDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarifaMinimaDAO.java index 452a99607..bc0776afa 100644 --- a/src/com/rjconsultores/ventaboletos/dao/TarifaMinimaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/TarifaMinimaDAO.java @@ -14,6 +14,7 @@ import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.Plaza; import com.rjconsultores.ventaboletos.entidad.TarifaMinima; import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; /** * @@ -25,7 +26,7 @@ public interface TarifaMinimaDAO extends GenericDAO { ClaseServicio claseServicio, Plaza plaza); public List pesquisar(Marca marca, Parada origem, Parada destino, - ClaseServicio claseServicio, Moneda moneda); + ClaseServicio claseServicio, Moneda moneda,VigenciaTarifa vigenciaTarifa); public List pesquisar( TarifaMinima tarifaMinima); @@ -37,7 +38,7 @@ public interface TarifaMinimaDAO extends GenericDAO { Plaza plaza, Marca marca, Parada origem, Parada destino, ClaseServicio claseServicio); - public List pesquisarOrigemDestinoTodos(Marca marca, Parada origem,Parada destino,ClaseServicio claseServicio, Moneda moneda); + public List pesquisarOrigemDestinoTodos(Marca marca, Parada origem,Parada destino,ClaseServicio claseServicio, Moneda moneda,VigenciaTarifa vigenciaTarifa); public List buscarPorMarcaMoneda(Marca marca, Moneda moneda); diff --git a/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java index ef4058074..66e61eef2 100644 --- a/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java @@ -27,7 +27,7 @@ public interface TarifaOficialDAO extends GenericDAO { public Integer gerarTarifaArtesp(Integer ruta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); - public Integer gerarTabelaZerada(Integer ruta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + public Integer gerarTabelaZerada(Integer ruta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas,ListlsParadaId); /** * See {@link TarifaOficialService#atualizarTarifaPorCoeficiente(Integer, Integer)} @@ -57,7 +57,7 @@ public interface TarifaOficialDAO extends GenericDAO { * @param orgaoConcedenteId TODO * @param empresaId TODO */ - public void atualizarTaxaEmbarque(List lsRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + public void atualizarTaxaEmbarque(List lsRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas,List lsParadaIds); /** * See {@link TarifaOficialService#atualizarSeguroPorKm(Integer, Integer, Integer)} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CalcularPeajeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CalcularPeajeHibernateDAO.java index e7bbd66f3..4dae945c4 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/CalcularPeajeHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CalcularPeajeHibernateDAO.java @@ -16,6 +16,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.hibernate.Query; import org.hibernate.SessionFactory; @@ -85,7 +86,7 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO buscarCasetasPeajeWithinTramo(Ruta ruta) { + public List buscarCasetasPeajeWithinTramo(Ruta ruta, Integer[] listCasetaPeaje) { StringBuilder sql = new StringBuilder() .append("with tramo_tmp as ( ") .append(" select t.origen_id as orig, t.destino_id as dest, t.tramo_id as tra, ") @@ -132,8 +133,12 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO lsRuta, OrgaoConcedente orgao, boolean usaICMS) throws Exception { + public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao, boolean usaICMS,Integer[] listCasetaPeaje) throws Exception { boolean isOrgaoNull = orgao == null; List updates = new ArrayList(); Set peajes = new HashSet(); @@ -171,13 +177,16 @@ public class CalcularPeajeHibernateDAO extends GenericHibernateDAO lsObj = buscarCasetasPeajeWithinTramo(ruta); + List lsObj = buscarCasetasPeajeWithinTramo(ruta,listCasetaPeaje); log.info("****** QTD COMBINAÇÕES DE TRECHOS x QTD PEDAGIOS POR TRECHO: "+lsObj.size()+" ******"); if(isOrgaoNull){ orgao = orgaoConcedenteService.obtenerID(ruta.getOrgaoConcedente().getOrgaoConcedenteId()); classeIndicePeajes = orgao.getClassesIndicePeaje(); String update = " update peaje set activo = 0 where ruta_id ="+ruta.getRutaId(); + if(null!=listCasetaPeaje) { + update = update + " and casetapeaje_id in (" + StringUtils.join(listCasetaPeaje,",") + ") "; + } updates.add(update); } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoCanalVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoCanalVentaHibernateDAO.java index 718317700..602fd969c 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoCanalVentaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConfRestricaoCanalVentaHibernateDAO.java @@ -1,5 +1,9 @@ package com.rjconsultores.ventaboletos.dao.hibernate; +import java.util.Date; +import java.util.List; + +import org.hibernate.Query; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -15,4 +19,24 @@ public class ConfRestricaoCanalVentaHibernateDAO extends GenericHibernateDAO idsConfRestricaoCanalVenta, Integer usuarioId) { + if(idsConfRestricaoCanalVenta.isEmpty()) { + return false; + } + StringBuilder sb = new StringBuilder(); + sb.append(" UPDATE ConfRestricaoCanalVenta SET activo=0, "); + sb.append(" usuarioId=:usuarioId, "); + sb.append(" fecmodif=:data" ); + sb.append(" where confRestricaoCanalVentaId in ("); + sb.append(idsConfRestricaoCanalVenta.toString().substring(1, idsConfRestricaoCanalVenta.toString().length() - 1)).append(" ) "); + Query queryConfRestricaoCanalVenta = getSession().createQuery(sb.toString()); + queryConfRestricaoCanalVenta.setInteger("usuarioId", usuarioId); + queryConfRestricaoCanalVenta.setDate("data", new Date()); + + return queryConfRestricaoCanalVenta.executeUpdate()>1?true:false; + + + } } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailEComerceHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailEComerceHibernateDAO.java new file mode 100644 index 000000000..c30f06a24 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaEmailEComerceHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.EmpresaEmailEComerceDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailEComerce; + +@Repository("empresaEmailEComerceDAO") +public class EmpresaEmailEComerceHibernateDAO extends GenericHibernateDAO + implements EmpresaEmailEComerceDAO { + + @Autowired + public EmpresaEmailEComerceHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public EmpresaEmailEComerce buscarPorEmpresa(Empresa empresa, String tipoOperacao) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("empresa", empresa)); + c.add(Restrictions.eq("tipoOperacao", tipoOperacao)); + + return (EmpresaEmailEComerce) c.uniqueResult(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java index 3539190d2..fecf4f40b 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ParadaHibernateDAO.java @@ -128,6 +128,41 @@ public class ParadaHibernateDAO extends GenericHibernateDAO imp return c.list(); } + + @Override + public List obtenerOrigenPorListRutaIds(Integer orgaoConcendenteId, Integer empresaId,Integer[] listRuta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + Criteria criteriaTramo =c.createCriteria("tramoOrigemList"); + criteriaTramo.add(Restrictions.eq("activo", Boolean.TRUE)); + Criteria criteriaRutaCombinacionList =criteriaTramo.createCriteria("rutaCombinacionList"); + criteriaRutaCombinacionList.add(Restrictions.eq("activo", Boolean.TRUE)); + Criteria criteriaRuta = criteriaRutaCombinacionList.createCriteria("ruta"); + criteriaRuta.add(Restrictions.eq("activo", Boolean.TRUE)); + if(null!=orgaoConcendenteId) { + Criteria criteriaOrgaoConcendente = criteriaRuta.createCriteria("orgaoConcedente"); + criteriaOrgaoConcendente.add(Restrictions.eq("orgaoConcendenteID", orgaoConcendenteId)); + criteriaOrgaoConcendente.add(Restrictions.eq("activo", Boolean.TRUE)); + + } + if(null!=empresaId) { + Criteria criteriaRutaEmpresa = criteriaRuta.createCriteria("lsRutaEmpresa"); + criteriaRutaEmpresa.add(Restrictions.eq("empresaId", empresaId)); + criteriaRutaEmpresa.add(Restrictions.eq("activo", Boolean.TRUE)); + } + + + c.add(Restrictions.eq("activo", Boolean.TRUE)); + if(null!=listRuta) { + criteriaRuta.add(Restrictions.in("rutaId", listRuta)); + } + + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + return c.list(); + } + + + @Override public List obterPossiveisDestinos(Parada origem) { diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java index bda5e3db2..fee5d58b2 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java @@ -287,6 +287,33 @@ public class RutaHibernateDAO extends GenericHibernateDAO impleme return c.list(); } + + + @Override + public List buscarRutasPorEmpresaOrgaoConcedenteParadaIds(Empresa empresa, OrgaoConcedente orgao, Integer[] lsParadaIds) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.ne("rutaId", -1)); + + if (empresa != null && empresa.getEmpresaId() != -1) { + c.createCriteria("lsRutaEmpresa").add(Restrictions.eq("empresa", empresa)); + } + + if (orgao != null && orgao.getOrgaoConcedenteId() != -1) { + c.add(Restrictions.eq("orgaoConcedente", orgao)); + } + Criteria rutaCombinacionList = c.createCriteria("rutaCombinacionList"); + rutaCombinacionList.add(Restrictions.eq("activo", Boolean.TRUE)); + Criteria tramo = rutaCombinacionList.createCriteria("tramo"); + tramo.add(Restrictions.eq("activo", Boolean.TRUE)); + Criteria parada = tramo.createCriteria("origem"); + parada.add(Restrictions.in("paradaId", lsParadaIds)); + + c.addOrder(Order.asc("descruta")); + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + return c.list(); + } @Override public void updateAsientosVendibles(Ruta ruta, Tramo viejoTramo, Tramo nuevoTramo) { @@ -434,4 +461,34 @@ public class RutaHibernateDAO extends GenericHibernateDAO impleme return c.list(); } + + @Override + public List buscarPorIds(Integer[] rutaIds) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.in("rutaId", rutaIds)); + return c.list(); + } + + @Override + public List buscarPorOrgaoEcasetaPeaje(OrgaoConcedente orgao, Integer[] listCasetaPeaje){ + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("indRutaCancelada", Boolean.FALSE)); + Criteria criteriaRutaSecuencia = c.createCriteria("rutaSecuenciaList","secuencia"); + criteriaRutaSecuencia.add(Restrictions.eq("secuencia.activo", Boolean.TRUE)); + Criteria criteriaRutaCaseta = criteriaRutaSecuencia.createCriteria("lsRutaCase"); + criteriaRutaCaseta.add(Restrictions.eq("activo", Boolean.TRUE)); + Criteria criteriaCasetaPeaje=criteriaRutaCaseta.createCriteria("casetaPeaje"); + criteriaCasetaPeaje.add(Restrictions.in("casetaPeajeId", listCasetaPeaje)); + if(orgao!=null) { + Criteria crietriaOrgaoConcendente = c.createCriteria("orgaoConcedente"); + crietriaOrgaoConcendente.add(Restrictions.eq("activo", Boolean.TRUE)); + crietriaOrgaoConcendente.add(Restrictions.eq("orgaoConcedenteId", orgao.getOrgaoConcedenteId())); + } + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + return c.list(); + + + } + } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaMinimaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaMinimaHibernateDAO.java index a0aa46106..3f05da09f 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaMinimaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TarifaMinimaHibernateDAO.java @@ -26,6 +26,7 @@ import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.Plaza; import com.rjconsultores.ventaboletos.entidad.TarifaMinima; import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; /** * @@ -50,7 +51,7 @@ public class TarifaMinimaHibernateDAO extends GenericHibernateDAO pesquisar(Marca marca, Parada origem, Parada destino, - ClaseServicio claseServicio, Moneda moneda) { + ClaseServicio claseServicio, Moneda moneda,VigenciaTarifa vigenciaTarifa) { Criteria c = getSession().createCriteria(getPersistentClass()); c.add(Restrictions.eq("activo", Boolean.TRUE)); @@ -70,8 +71,8 @@ public class TarifaMinimaHibernateDAO extends GenericHibernateDAO pesquisarOrigemDestinoTodos(Marca marca, Parada origem, Parada destino, ClaseServicio claseServicio, Moneda moneda) { + public List pesquisarOrigemDestinoTodos(Marca marca, Parada origem, Parada destino, ClaseServicio claseServicio, Moneda moneda,VigenciaTarifa vigenciaTarifa) { Criteria criterioBusca = getSession().createCriteria(getPersistentClass()); @@ -179,6 +180,8 @@ public class TarifaMinimaHibernateDAO extends GenericHibernateDAO idsEmpresas) { + public Integer gerarTabelaZerada(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas,ListlsParadaId) { - String sql = sqlBuilder.getSQLGerarTabelaZerada(rutaId, usuarioId, orgaoConcedenteId, idsEmpresas); + String sql = sqlBuilder.getSQLGerarTabelaZerada(rutaId, usuarioId, orgaoConcedenteId, idsEmpresas,lsParadaId); int qtd = getSession().createSQLQuery(sql).executeUpdate(); @@ -210,7 +210,7 @@ public class TarifaOficialHibernateDAO extends GenericHibernateDAO lsRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas) { + public void atualizarTaxaEmbarque(List lsRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas,List lsParadaIds) { int x = 0; @@ -226,15 +226,15 @@ public class TarifaOficialHibernateDAO extends GenericHibernateDAO 0); @@ -379,7 +379,7 @@ public class TarifaOficialHibernateDAO extends GenericHibernateDAO idsEmpresas); - public String getSQLGerarTabelaZerada(Integer codRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + public String getSQLGerarTabelaZerada(Integer codRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas, List lsParadaId); public String getSQLAtualizarTarifaOficial(Integer rutaId, Integer usuarioId, OrgaoConcedente orgaoConcedente); public String getSQLGerarTarifaOficialArtesp(Integer codRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); - public String getAtualizarTaxaEmbarquePorKmParada(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + public String getAtualizarTaxaEmbarquePorKmParada(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas,ListlsParadaIds); - public String getSQLAtualizarTaxaEmbarquePorKmOrgao(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); + public String getSQLAtualizarTaxaEmbarquePorKmOrgao(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas, List lsParadaIds); - public String getSQLAtualizarTaxaEmbarquePorParadaFixo(Integer rutaId, Integer usuarioId,Integer orgaoConcedenteId, List idsEmpresas); + public String getSQLAtualizarTaxaEmbarquePorParadaFixo(Integer rutaId, Integer usuarioId,Integer orgaoConcedenteId, List idsEmpresas,List lsParadaIds); public String getSQLAtualizarSeguroPorKm(Integer rutaId, Integer usuarioId, Integer orgaoConcedenteId, TipoSeguro tipoSeguro); diff --git a/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java b/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java index c0e553e4c..d189be441 100644 --- a/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java +++ b/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java @@ -24,7 +24,7 @@ public class SQLBuilderOracle implements SQLBuilder { private static final Integer DER_PR = 2; @Override - public String getSQLGerarTabelaZerada(final Integer codRuta, final Integer usuarioId,final Integer orgaoConcedenteId, final List idsEmpresas){ + public String getSQLGerarTabelaZerada(final Integer codRuta, final Integer usuarioId, final Integer orgaoConcedenteId, final List idsEmpresas, List lsParadaId) { StringBuilder sb = new StringBuilder(); sb.append("INSERT "); @@ -102,7 +102,7 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" and mc.activo = 1 "); sb.append(" and re.activo = 1 "); if (idsEmpresas != null) { - sb.append(" and re.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + sb.append(" and re.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length() - 1)).append(" ) "); } sb.append(" and m.moneda_id = 1 "); if (orgaoConcedenteId != null) { @@ -117,14 +117,16 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" not in (select tao.tramo_id,tao.marca_id,tao.CLASESERVICIO_ID, "); sb.append(" tao.moneda_id,tao.orgaoconcedente_id, tao.ruta_id "); sb.append(" from tarifa_oficial tao where tao.activo = 1) "); + if (null != lsParadaId) { + sb.append(" and t.origen_id in (").append(lsParadaId.toString().substring(1, lsParadaId.toString().length() - 1)).append(" ) "); + } return sb.toString(); } @Override public String getSQLGerarTarifaOficialArtesp(final Integer codRuta, final Integer usuarioId, - final Integer orgaoConcedenteId, final List idsEmpresas) - { + final Integer orgaoConcedenteId, final List idsEmpresas) { StringBuilder sb = new StringBuilder(); sb.append(" INSERT "); sb.append(" INTO "); @@ -201,7 +203,7 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" inner join ruta_empresa re on r.ruta_id = re.ruta_id "); sb.append(" inner join marca ma on ma.empresa_id = re.empresa_id "); sb.append(" inner join orgao_concedente oc on oc.orgaoconcedente_id =r.orgaoconcedente_id "); - sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id and t.activo =1");//adicionei isso t.activo =1"); + sb.append(" inner join tramo t on t.tramo_id = rc.tramo_id and t.activo =1");// adicionei isso t.activo =1"); sb.append(" inner join parada po on po.parada_id = t.origen_id "); sb.append(" inner join parada pd on pd.parada_id = t.destino_id "); sb.append(" inner join ciudad c on c.ciudad_id = po.ciudad_id "); @@ -222,7 +224,7 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" and re.activo = 1 "); sb.append(" and r.orgaoconcedente_id = 21 "); if (idsEmpresas != null) { - sb.append(" and re.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + sb.append(" and re.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length() - 1)).append(" ) "); } sb.append(" and m.moneda_id = 1 "); if (orgaoConcedenteId != null) { @@ -275,12 +277,12 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" select "); sb.append(" "); sb.append(" TARIFA_OFICIAL_SEQ.NEXTVAL, "); - //>> SE ORGAO FOR DER-PR E SE O COEFICIENTE DA CLASSE NAO ESTA NULL - sb.append(" CASE R.ORGAOCONCEDENTE_ID WHEN "+DER_PR+" THEN CASE WHEN cl.COEFICIENTETARIFA IS NOT NULL THEN " ); - sb.append(" trunc(((coalesce(ct1.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente1,0) + 350,0.27)*16160 )) ) * COALESCE(tc.kmcoeficiente1,0)) * cl.COEFICIENTETARIFA " ); - sb.append(" + ((coalesce(ct2.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente2,0) + 350,0.27)*13470 )) ) * COALESCE(tc.kmcoeficiente2,0)) * cl.COEFICIENTETARIFA,2) " ); - sb.append(" ELSE " ); - //< COEFICIENTE DA CLASSE ESTA NULL + // >> SE ORGAO FOR DER-PR E SE O COEFICIENTE DA CLASSE NAO ESTA NULL + sb.append(" CASE R.ORGAOCONCEDENTE_ID WHEN " + DER_PR + " THEN CASE WHEN cl.COEFICIENTETARIFA IS NOT NULL THEN "); + sb.append(" trunc(((coalesce(ct1.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente1,0) + 350,0.27)*16160 )) ) * COALESCE(tc.kmcoeficiente1,0)) * cl.COEFICIENTETARIFA "); + sb.append(" + ((coalesce(ct2.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente2,0) + 350,0.27)*13470 )) ) * COALESCE(tc.kmcoeficiente2,0)) * cl.COEFICIENTETARIFA,2) "); + sb.append(" ELSE "); + // < COEFICIENTE DA CLASSE ESTA NULL sb.append(" ROUND( "); sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + "); sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + "); @@ -291,8 +293,8 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" 1, 2 ) "); } // - sb.append(" end else " ); - //< ORGAO NAO EH DER-PR + sb.append(" end else "); + // < ORGAO NAO EH DER-PR sb.append(" ROUND( "); sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + "); sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + "); @@ -302,14 +304,14 @@ public class SQLBuilderOracle implements SQLBuilder { } else { sb.append(" 1, 2 ) "); } - sb.append(" end , " ); + sb.append(" end , "); // - //>> SE ORGAO FOR DER-PR E SE O COEFICIENTE DA CLASSE NAO ESTA NULL - sb.append(" CASE R.ORGAOCONCEDENTE_ID WHEN "+DER_PR+" THEN CASE WHEN cl.COEFICIENTETARIFA IS NOT NULL THEN " ); - sb.append(" trunc(((coalesce(ct1.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente1,0) + 350,0.27)*16160 )) ) * COALESCE(tc.kmcoeficiente1,0)) * cl.COEFICIENTETARIFA " ); - sb.append(" + ((coalesce(ct2.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente2,0) + 350,0.27)*13470 )) ) * COALESCE(tc.kmcoeficiente2,0)) * cl.COEFICIENTETARIFA,2) " ); - sb.append(" ELSE " ); - //< COEFICIENTE DA CLASSE ESTA NULL + // >> SE ORGAO FOR DER-PR E SE O COEFICIENTE DA CLASSE NAO ESTA NULL + sb.append(" CASE R.ORGAOCONCEDENTE_ID WHEN " + DER_PR + " THEN CASE WHEN cl.COEFICIENTETARIFA IS NOT NULL THEN "); + sb.append(" trunc(((coalesce(ct1.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente1,0) + 350,0.27)*16160 )) ) * COALESCE(tc.kmcoeficiente1,0)) * cl.COEFICIENTETARIFA "); + sb.append(" + ((coalesce(ct2.coeficiente,0) + oc.coeficientetarifa / ((POWER(COALESCE(tc.kmcoeficiente2,0) + 350,0.27)*13470 )) ) * COALESCE(tc.kmcoeficiente2,0)) * cl.COEFICIENTETARIFA,2) "); + sb.append(" ELSE "); + // < COEFICIENTE DA CLASSE ESTA NULL sb.append(" ROUND( "); sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + "); sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + "); @@ -320,8 +322,8 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" 1, 2 ) "); } // - sb.append(" end else " ); - //< ORGAO NAO EH DER-PR + sb.append(" end else "); + // < ORGAO NAO EH DER-PR sb.append(" ROUND( "); sb.append(" (coalesce(ct1.coeficiente,0) * coalesce(tc.kmcoeficiente1,0) + "); sb.append(" coalesce(ct2.coeficiente,0) * coalesce(tc.kmcoeficiente2,0) + "); @@ -331,7 +333,7 @@ public class SQLBuilderOracle implements SQLBuilder { } else { sb.append(" 1, 2 ) "); } - sb.append(" end , " ); + sb.append(" end , "); // sb.append(" t.tramo_id, "); sb.append(" mc.marca_id, "); @@ -386,11 +388,11 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" and mc.activo = 1 "); sb.append(" and re.activo = 1 "); sb.append(" and r.orgaoconcedente_id <> 21 "); - if(ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CRIAR_TARIFA_APENAS_TRECHO_VENDIDO.getDescricao())){ + if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.CRIAR_TARIFA_APENAS_TRECHO_VENDIDO.getDescricao())) { sb.append(" and rc.indventa = 1 "); } if (idsEmpresas != null) { - sb.append(" and re.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + sb.append(" and re.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length() - 1)).append(" ) "); } sb.append(" and m.moneda_id = 1 "); if (orgaoConcedente != null && orgaoConcedente.getOrgaoConcedenteId() != null && orgaoConcedente.getOrgaoConcedenteId() != SELECAO_TODOS) { @@ -475,7 +477,7 @@ public class SQLBuilderOracle implements SQLBuilder { } @Override - public String getAtualizarTaxaEmbarquePorKmParada(final Integer rutaId, final Integer usuarioId,final Integer orgaoConcedenteId, List idsEmpresas) { + public String getAtualizarTaxaEmbarquePorKmParada(final Integer rutaId, final Integer usuarioId, final Integer orgaoConcedenteId, List idsEmpresas, List lsParadaIds) { StringBuilder sb = new StringBuilder(""); sb.append("update tarifa_oficial set IMPORTETAXAEMBARQUE = "); sb.append("( "); @@ -488,7 +490,11 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" inner join tramo t on t.tramo_id = tao.tramo_id "); sb.append(" inner join TAXA_EMBARQUE_PARADA tepKm on "); sb.append(" tepKm.parada_id = t.origen_id and tepKm.KMATE >= "); - sb.append(" t.CANTKMREAL and tepKm.activo = 1 and tepKm.indtipo = 'K' and tepKm.empresa_id in (-1, ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + sb.append(" t.CANTKMREAL and tepKm.activo = 1 and tepKm.indtipo = 'K' and tepKm.empresa_id in (-1, ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length() - 1)).append(" ) "); + if (null != lsParadaIds) { + sb.append(" and t.origen_id in (").append(lsParadaIds.toString().substring(1, lsParadaIds.toString().length() - 1)).append(" ) "); + } + sb.append(" inner join marca m on m.marca_id = tao.marca_id "); sb.append("where "); sb.append(" tepKm.kmate= "); @@ -507,7 +513,7 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" and tao.tramo_id = tarifa_oficial.tramo_id "); sb.append(" and tepKm.orgaoconcedente_id = tarifa_oficial.orgaoconcedente_id "); if (idsEmpresas != null) { - sb.append(" and m.empresa_id in (-1,").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + sb.append(" and m.empresa_id in (-1,").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length() - 1)).append(" ) "); } sb.append(") "); sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); @@ -520,13 +526,14 @@ public class SQLBuilderOracle implements SQLBuilder { if (orgaoConcedenteId != null) { sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); } - - + if (null != lsParadaIds) { + sb.append(" and tarifa_oficial.origen_id in (").append(lsParadaIds.toString().substring(1, lsParadaIds.toString().length() - 1)).append(" ) "); + } return sb.toString(); } @Override - public String getSQLAtualizarTaxaEmbarquePorKmOrgao(final Integer rutaId, final Integer usuarioId,final Integer orgaoConcedenteId, List idsEmpresas) { + public String getSQLAtualizarTaxaEmbarquePorKmOrgao(final Integer rutaId, final Integer usuarioId, final Integer orgaoConcedenteId, List idsEmpresas,List lsParadaIds) { StringBuilder sb = new StringBuilder(""); sb.append("update tarifa_oficial set IMPORTETAXAEMBARQUE = "); sb.append("coalesce( "); @@ -560,8 +567,14 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" and tao.tramo_id = tarifa_oficial.tramo_id "); if (idsEmpresas != null) { - sb.append(" and m.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1)).append(" ) "); + sb.append(" and m.empresa_id in ( ").append(idsEmpresas.toString().substring(1, idsEmpresas.toString().length() - 1)).append(" ) "); } + + if (null != lsParadaIds) { + sb.append(" and t.origen_id in (").append(lsParadaIds.toString().substring(1, lsParadaIds.toString().length() - 1)).append(" ) "); + } + + sb.append("),IMPORTETAXAEMBARQUE) "); sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); @@ -576,11 +589,15 @@ public class SQLBuilderOracle implements SQLBuilder { if (orgaoConcedenteId != null) { sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); } + + if (null != lsParadaIds) { + sb.append(" and tarifa_oficial.origen_id in (").append(lsParadaIds.toString().substring(1, lsParadaIds.toString().length() - 1)).append(" ) "); + } return sb.toString(); } @Override - public String getSQLAtualizarTaxaEmbarquePorParadaFixo(final Integer rutaId, final Integer usuarioId,final Integer orgaoConcedenteId, List idsEmpresas) { + public String getSQLAtualizarTaxaEmbarquePorParadaFixo(final Integer rutaId, final Integer usuarioId, final Integer orgaoConcedenteId, List idsEmpresas,List lsParadaIds) { StringBuilder sb = new StringBuilder(""); sb.append("update tarifa_oficial set IMPORTETAXAEMBARQUE = "); @@ -593,7 +610,7 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" tarifa_oficial tao "); sb.append(" inner join tramo t on t.tramo_id = tao.tramo_id "); sb.append(" inner join TAXA_EMBARQUE_PARADA tepFixo on "); - sb.append(" tepFixo.parada_id = t.origen_id and tepFixo.empresa_id in ("+obtemEmpresas(idsEmpresas)+" ) "); + sb.append(" tepFixo.parada_id = t.origen_id and tepFixo.empresa_id in (" + obtemEmpresas(idsEmpresas) + " ) "); sb.append(" and tepFixo.indtipo = 'F' and tepFixo.activo = 1 "); sb.append(" inner join marca m on m.marca_id = tao.marca_id "); sb.append("where "); @@ -604,7 +621,11 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" and tao.moneda_id = tarifa_oficial.moneda_id "); sb.append(" and tao.ruta_id = tarifa_oficial.ruta_id "); sb.append(" and tao.tramo_id = tarifa_oficial.tramo_id "); - sb.append(" and m.empresa_id in ("+obtemEmpresas(idsEmpresas)+" ) and tao.activo = 1 "); + sb.append(" and m.empresa_id in (" + obtemEmpresas(idsEmpresas) + " ) and tao.activo = 1 "); + if (null != lsParadaIds) { + sb.append(" and t.origen_id in (").append(lsParadaIds.toString().substring(1, lsParadaIds.toString().length() - 1)).append(" ) "); + } + sb.append("),IMPORTETAXAEMBARQUE) "); sb.append(", usuario_id = ").append(usuarioId).append(",fecmodif = ").append(DBUtil.getInstance().dbSysdate()).append(" "); sb.append(" "); @@ -616,15 +637,19 @@ public class SQLBuilderOracle implements SQLBuilder { if (orgaoConcedenteId != null) { sb.append(" and tarifa_oficial.orgaoconcedente_id = ").append(orgaoConcedenteId); } - sb.append(" and tarifa_oficial.MARCA_ID in (select m2.marca_id from marca m2 where m2.activo = 1 and m2.empresa_id in (" +obtemEmpresas(idsEmpresas)+ " ) ) "); + sb.append(" and tarifa_oficial.MARCA_ID in (select m2.marca_id from marca m2 where m2.activo = 1 and m2.empresa_id in (" + obtemEmpresas(idsEmpresas) + " ) ) "); + + if (null != lsParadaIds) { + sb.append(" and tarifa_oficial.origen_id in (").append(lsParadaIds.toString().substring(1, lsParadaIds.toString().length() - 1)).append(" ) "); + } return sb.toString(); } - + private String obtemEmpresas(List idsEmpresas) { if (idsEmpresas == null || idsEmpresas.contains(SELECAO_TODOS)) { return Integer.toString(SELECAO_TODOS); } - return idsEmpresas.toString().substring(1, idsEmpresas.toString().length()-1); + return idsEmpresas.toString().substring(1, idsEmpresas.toString().length() - 1); } @Override @@ -751,7 +776,7 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" tao.IMPORTEOUTROS AS \"taoimporteoutros\", "); sb.append(" ta.TARIFA_ID AS \"tarifaId\" "); - sb.append("FROM TARIFA_OFICIAL tao " ); + sb.append("FROM TARIFA_OFICIAL tao "); sb.append("INNER JOIN TARIFA ta ON (tao.MARCA_ID = ta.MARCA_ID "); sb.append(" AND tao.CLASESERVICIO_ID = ta.CLASESERVICIO_ID "); sb.append(" AND tao.TRAMO_ID = ta.TRAMO_ID "); @@ -764,10 +789,10 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append("WHERE ta.VIGENCIATARIFA_ID = ").append(vigenciaTarifaId); - if(orgao != null){ + if (orgao != null) { sb.append(" AND tao.ORGAOCONCEDENTE_ID = ").append(orgao.getOrgaoConcedenteId()); } - if(empresa != null){ + if (empresa != null) { sb.append(" AND mTa.EMPRESA_ID = ").append(empresa.getEmpresaId()); sb.append(" AND mTao.EMPRESA_ID = ").append(empresa.getEmpresaId()); } @@ -776,25 +801,25 @@ public class SQLBuilderOracle implements SQLBuilder { } @Override - public String getSQLAtualizarTarifaPorTarifaOfical(Map dados, Integer usuarioId, Boolean calculaPegagio, - Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP){ + public String getSQLAtualizarTarifaPorTarifaOfical(Map dados, Integer usuarioId, Boolean calculaPegagio, + Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP) { StringBuilder sb = new StringBuilder(""); sb.append("UPDATE TARIFA SET "); - if(calculaPegagio){ + if (calculaPegagio) { sb.append("IMPORTEPEDAGIO=").append(dados.get("taoimportepedagio")).append(","); } - if(calculaTarifa){ + if (calculaTarifa) { sb.append("PRECIO=").append(dados.get("taoprecio")).append(",PRECIOORIGINAL=").append(dados.get("taopreciooriginal")).append(","); } - if(calculaTaxaEmbarque){ + if (calculaTaxaEmbarque) { sb.append("IMPORTETAXAEMBARQUE=").append(dados.get("taoimportetaxaembarque")).append(","); } - if(calculaSeguro){ + if (calculaSeguro) { sb.append("IMPORTESEGURO=").append(dados.get("taoimporteseguro")).append(","); } - if(calculaTPP){ + if (calculaTPP) { sb.append("IMPORTETPP=").append(dados.get("taoimportetpp")).append(","); } sb.append("IMPORTEOUTROS=").append(dados.get("taoimporteoutros")).append(","); @@ -1287,7 +1312,7 @@ public class SQLBuilderOracle implements SQLBuilder { public String getSQLObterSequenciaNumOperacion() { return "select numeoperacion_seq.nextval from dual"; } - + @Override public String getSQLInserirTarifaEmbarcadaPelaTarifaOficial(final Integer vigenciaTarifaId, final Integer usuarioId, Empresa empresa, OrgaoConcedente orgao) { StringBuilder sb = new StringBuilder(""); @@ -1354,7 +1379,7 @@ public class SQLBuilderOracle implements SQLBuilder { return sb.toString(); } - + @Override public String getSQLSelecionarTarifaEmbarcadaPorTarifaOficalParaAtualizar(final Integer vigenciaTarifaId, Empresa empresa, OrgaoConcedente orgao) { StringBuilder sb = new StringBuilder(""); @@ -1368,7 +1393,7 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" tao.IMPORTEOUTROS AS \"taoimporteoutros\", "); sb.append(" ta.TARIFAEMBARCADA_ID AS \"tarifaId\" "); - sb.append("FROM TARIFA_OFICIAL tao " ); + sb.append("FROM TARIFA_OFICIAL tao "); sb.append("INNER JOIN TARIFA_EMBARCADA ta ON (tao.MARCA_ID = ta.MARCA_ID "); sb.append(" AND tao.CLASESERVICIO_ID = ta.CLASESERVICIO_ID "); sb.append(" AND tao.TRAMO_ID = ta.TRAMO_ID "); @@ -1381,37 +1406,37 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append("WHERE ta.VIGENCIATARIFA_ID = ").append(vigenciaTarifaId); - if(orgao != null){ + if (orgao != null) { sb.append(" AND tao.ORGAOCONCEDENTE_ID = ").append(orgao.getOrgaoConcedenteId()); } - if(empresa != null){ + if (empresa != null) { sb.append(" AND mTa.EMPRESA_ID = ").append(empresa.getEmpresaId()); sb.append(" AND mTao.EMPRESA_ID = ").append(empresa.getEmpresaId()); } return sb.toString(); } - + @Override - public String getSQLAtualizarTarifaEmbarcadaPorTarifaOfical(Map dados, Integer usuarioId, Boolean calculaPegagio, - Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP){ + public String getSQLAtualizarTarifaEmbarcadaPorTarifaOfical(Map dados, Integer usuarioId, Boolean calculaPegagio, + Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP) { StringBuilder sb = new StringBuilder(""); sb.append("UPDATE TARIFA_EMBARCADA SET "); - if(calculaPegagio){ + if (calculaPegagio) { sb.append("IMPORTEPEDAGIO=").append(dados.get("taoimportepedagio")).append(","); } - if(calculaTarifa){ + if (calculaTarifa) { sb.append("PRECIO=").append(dados.get("taoprecio")).append(",PRECIOORIGINAL=").append(dados.get("taopreciooriginal")).append(","); } - if(calculaTaxaEmbarque){ + if (calculaTaxaEmbarque) { sb.append("IMPORTETAXAEMBARQUE=").append(dados.get("taoimportetaxaembarque")).append(","); } - if(calculaSeguro){ + if (calculaSeguro) { sb.append("IMPORTESEGURO=").append(dados.get("taoimporteseguro")).append(","); } - if(calculaTPP){ + if (calculaTPP) { sb.append("IMPORTETPP=").append(dados.get("taoimportetpp")).append(","); } sb.append("IMPORTEOUTROS=").append(dados.get("taoimporteoutros")).append(","); diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaEmailEComerce.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaEmailEComerce.java new file mode 100644 index 000000000..b8a39aae0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaEmailEComerce.java @@ -0,0 +1,248 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "EMPRESA_EMAIL_ECOMERCE_SEQ", sequenceName = "EMPRESA_EMAIL_ECOMERCE_SEQ", allocationSize = 1) +@Table(name = "EMPRESA_EMAIL_ECOMERCE") +public class EmpresaEmailEComerce implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "EMPRESA_EMAIL_ECOMERCE_SEQ") + @Column(name = "EMPRESAEMAILECOMERCE_ID") + private Integer empresaEmailEComerceId; + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "SMTP") + private String smtp; + @Column(name = "SENHA") + private String senha; + @Column(name = "SMTPPORTA") + private String smtpPorta; + @Column(name = "SMTPEMAIL") + private String smtpEmail; + @Column(name = "TEXTOEMAIL") + private String textoEmail; + @Column(name = "TEXTOCUPOMEMBARQUE") + private String textoCupomEmbarque; + @Column(name = "ASSUNTO") + private String assunto; + @Column(name = "EMAILDE") + private String emailDe; + @Column(name = "EMAILCOPIAOCULTA") + private String emailCopiaOculta; + @Column(name = "TIPOOPERACAO") + private String tipoOperacao; + @Column(name = "TIPOAUTORIZACAO") + private String tipoAutorizacao; + @Column(name = "INDAUTENTICACAO") + private Boolean indAutenticacao; + + @Column(name = "ANEXO1") + private String anexo1; + + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public EmpresaEmailEComerce() { + + } + + public Integer getEmpresaEmailEComerceId() { + return empresaEmailEComerceId; + } + + public void setEmpresaEmailEComerceId(Integer empresaEmailEComerceId) { + this.empresaEmailEComerceId = empresaEmailEComerceId; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public String getSmtp() { + return smtp; + } + + public void setSmtp(String smtp) { + this.smtp = smtp; + } + + public String getSenha() { + return senha; + } + + public void setSenha(String senha) { + this.senha = senha; + } + + public String getSmtpPorta() { + return smtpPorta; + } + + public void setSmtpPorta(String smtpPorta) { + this.smtpPorta = smtpPorta; + } + + public String getSmtpEmail() { + return smtpEmail; + } + + public void setSmtpEmail(String smtpEmail) { + this.smtpEmail = smtpEmail; + } + + public String getTextoEmail() { + return textoEmail; + } + + public void setTextoEmail(String textoEmail) { + this.textoEmail = textoEmail; + } + + public String getTextoCupomEmbarque() { + return textoCupomEmbarque; + } + + public void setTextoCupomEmbarque(String textoCupomEmbarque) { + this.textoCupomEmbarque = textoCupomEmbarque; + } + + public String getAssunto() { + return assunto; + } + + public void setAssunto(String assunto) { + this.assunto = assunto; + } + + public String getEmailDe() { + return emailDe; + } + + public void setEmailDe(String emailDe) { + this.emailDe = emailDe; + } + + public String getEmailCopiaOculta() { + return emailCopiaOculta; + } + + public void setEmailCopiaOculta(String emailCopiaOculta) { + this.emailCopiaOculta = emailCopiaOculta; + } + + public String getTipoOperacao() { + return tipoOperacao; + } + + public void setTipoOperacao(String tipoOperacao) { + this.tipoOperacao = tipoOperacao; + } + + public String getTipoAutorizacao() { + return tipoAutorizacao; + } + + public void setTipoAutorizacao(String tipoAutorizacao) { + this.tipoAutorizacao = tipoAutorizacao; + } + + public Boolean getIndAutenticacao() { + return indAutenticacao; + } + + public void setIndAutenticacao(Boolean indAutenticacao) { + this.indAutenticacao = indAutenticacao; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public String getAnexo1() { + return anexo1; + } + + public void setAnexo1(String anexo1) { + this.anexo1 = anexo1; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + + ((empresaEmailEComerceId == null) ? 0 : empresaEmailEComerceId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + EmpresaEmailEComerce other = (EmpresaEmailEComerce) obj; + if (empresaEmailEComerceId == null) { + if (other.empresaEmailEComerceId != null) + return false; + } else if (!empresaEmailEComerceId.equals(other.empresaEmailEComerceId)) + return false; + return true; + } + + @Override + public String toString() { + return String.valueOf(this.getEmpresaEmailEComerceId()); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/RedondeoCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/RedondeoCtrl.java index 61154f3c8..8ad6d5bd7 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/RedondeoCtrl.java +++ b/src/com/rjconsultores/ventaboletos/entidad/RedondeoCtrl.java @@ -54,6 +54,9 @@ public class RedondeoCtrl implements Serializable { @OneToMany(mappedBy = "redondeoCtrl", cascade = CascadeType.ALL) private List redondeoList; + @OneToMany(mappedBy = "redondeoCtrl", cascade = CascadeType.ALL) + private List redondeoOrgaoList; + public RedondeoCtrl() { } @@ -169,4 +172,19 @@ public class RedondeoCtrl implements Serializable { public void setIndaplicaArtesp(Boolean indaplicaArtesp) { this.indaplicaArtesp = indaplicaArtesp; } + + public List getRedondeoOrgaoList() { + List rmList = new ArrayList(); + for (RedondeoOrgaoConcedente roc : this.redondeoOrgaoList) { + if (roc.getActivo() == Boolean.TRUE) { + rmList.add(roc); + } + } + + return rmList; + } + + public void setRedondeoOrgaoList(List redondeoOrgaoList) { + this.redondeoOrgaoList = redondeoOrgaoList; + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/RedondeoOrgaoConcedente.java b/src/com/rjconsultores/ventaboletos/entidad/RedondeoOrgaoConcedente.java new file mode 100644 index 000000000..696ec2352 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/RedondeoOrgaoConcedente.java @@ -0,0 +1,143 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * + * @author valdir.cordeiro + */ +@Entity +@SequenceGenerator(name = "REDONDEO_ORGAOCONCEDENTE_SEQ", sequenceName = "REDONDEO_ORGAOCONCEDENTE_SEQ", allocationSize = 1) +@Table(name = "REDONDEO_ORGAOCONCEDENTE") +public class RedondeoOrgaoConcedente implements Serializable { + + private static final long serialVersionUID = 1L; + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "REDONDEO_ORGAOCONCEDENTE_SEQ") + @Basic(optional = false) + @Column(name = "REDONDEOORGAOCONCEDENTE_ID") + private Long redondeoOrgaoConcedenteId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @JoinColumn(name = "REDONDEOCTRL_ID", referencedColumnName = "REDONDEOCTRL_ID") + @ManyToOne + private RedondeoCtrl redondeoCtrl; + + @OneToOne + @JoinColumn(name = "ORGAOCONCEDENTE_ID") + private OrgaoConcedente orgaoConcedente; + + public RedondeoOrgaoConcedente() { + } + + public RedondeoOrgaoConcedente(Long redondeoOrgaoConcedenteId) { + this.redondeoOrgaoConcedenteId = redondeoOrgaoConcedenteId; + } + + public Long getRedondeoOrgaoConcedenteId() { + return redondeoOrgaoConcedenteId; + } + + public void setRedondeoOrgaoConcedenteId(Long redondeoOrgaoConcedenteId) { + this.redondeoOrgaoConcedenteId = redondeoOrgaoConcedenteId; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public RedondeoCtrl getRedondeoCtrl() { + return redondeoCtrl; + } + + public void setRedondeoCtrl(RedondeoCtrl redondeoCtrl) { + this.redondeoCtrl = redondeoCtrl; + } + + public OrgaoConcedente getOrgaoConcedente() { + return orgaoConcedente; + } + + public void setOrgaoConcedente(OrgaoConcedente orgaoConcedente) { + this.orgaoConcedente = orgaoConcedente; + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final RedondeoOrgaoConcedente other = (RedondeoOrgaoConcedente) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.redondeoCtrl != other.redondeoCtrl && (this.redondeoCtrl == null || !this.redondeoCtrl.equals(other.redondeoCtrl))) { + return false; + } + if (this.orgaoConcedente != other.orgaoConcedente && (this.orgaoConcedente == null || !this.orgaoConcedente.equals(other.orgaoConcedente))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 47 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 47 * hash + (this.redondeoCtrl != null ? this.redondeoCtrl.hashCode() : 0); + hash = 47 * hash + (this.orgaoConcedente != null ? this.orgaoConcedente.hashCode() : 0); + return hash; + } + + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.RedondeoOrgaoConcedente[redondeoOrgaoConcedente=" + redondeoOrgaoConcedenteId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoEmail.java b/src/com/rjconsultores/ventaboletos/enums/TipoEmail.java new file mode 100644 index 000000000..7b1fa280d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoEmail.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum TipoEmail { + + CALL_CENTER(1, "Call Center"), + ECOMMERCE(2, "E-Commerce"), + ; + + private Integer id; + private String descricao; + + private TipoEmail(Integer id, String descricao) { + this.descricao = descricao; + this.id = id; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public static TipoEmail buscarPorId(Integer id) { + for (TipoEmail ids : TipoEmail.values()) { + if (ids.getId() == id) { + return ids; + } + } + return null; + } + + @Override + public String toString() { + return descricao; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoOperacaoECommerce.java b/src/com/rjconsultores/ventaboletos/enums/TipoOperacaoECommerce.java new file mode 100644 index 000000000..1d0795675 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/TipoOperacaoECommerce.java @@ -0,0 +1,49 @@ +package com.rjconsultores.ventaboletos.enums; + +public enum TipoOperacaoECommerce { + + CADASTRO_CLIENTE(1, "Cadastro Cliente"), + ESQUECER_SENHA(2, "Esquecer Senha"), + COMPRA_PASSAGEM(3, "Compra de passagem"), + COMPRA_CANCELAMENTO(4, "Cancelamento de compra"), + ; + + private Integer id; + private String descricao; + + private TipoOperacaoECommerce(Integer id, String descricao) { + this.descricao = descricao; + this.id = id; + } + + public String getDescricao() { + return descricao; + } + + public void setDescricao(String descricao) { + this.descricao = descricao; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public static TipoOperacaoECommerce buscarPorId(Integer id) { + for (TipoOperacaoECommerce ids : TipoOperacaoECommerce.values()) { + if (ids.getId() == id) { + return ids; + } + } + return null; + } + + @Override + public String toString() { + return descricao; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/CalcularPeajeService.java b/src/com/rjconsultores/ventaboletos/service/CalcularPeajeService.java index bfd547db1..e5ee0ced9 100644 --- a/src/com/rjconsultores/ventaboletos/service/CalcularPeajeService.java +++ b/src/com/rjconsultores/ventaboletos/service/CalcularPeajeService.java @@ -6,7 +6,7 @@ import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.entidad.Ruta; public interface CalcularPeajeService { - public List buscarCasetasPeajeWithinTramo(Ruta ruta); + public List buscarCasetasPeajeWithinTramo(Ruta ruta,Integer[] listCasetaPeaje); public List buscarRutaWithCasetaPeajeFromOrgao(OrgaoConcedente oc); - public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao, boolean usaICMS) throws Exception; + public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao, boolean usaICMS,Integer[] listCasetaPeaje) throws Exception; } diff --git a/src/com/rjconsultores/ventaboletos/service/ConfRestricaoCanalVentaService.java b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoCanalVentaService.java index 73fd5fdb2..87bfb484a 100644 --- a/src/com/rjconsultores/ventaboletos/service/ConfRestricaoCanalVentaService.java +++ b/src/com/rjconsultores/ventaboletos/service/ConfRestricaoCanalVentaService.java @@ -1,5 +1,7 @@ package com.rjconsultores.ventaboletos.service; +import java.util.Set; + import com.rjconsultores.ventaboletos.entidad.ConfRestricaoCanalVenta; import com.rjconsultores.ventaboletos.exception.BusinessException; @@ -10,5 +12,8 @@ public interface ConfRestricaoCanalVentaService{ public void borrar(ConfRestricaoCanalVenta entidad); public ConfRestricaoCanalVenta suscribirActualizar(ConfRestricaoCanalVenta entidad) throws BusinessException; + + public void borrarList(Set confRestricaoCanalVentaSelecionadas); + } diff --git a/src/com/rjconsultores/ventaboletos/service/EmpresaEmailEComerceService.java b/src/com/rjconsultores/ventaboletos/service/EmpresaEmailEComerceService.java new file mode 100644 index 000000000..db06e92db --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/EmpresaEmailEComerceService.java @@ -0,0 +1,10 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailEComerce; + +public interface EmpresaEmailEComerceService extends GenericService { + + public EmpresaEmailEComerce buscarPorEmpresa(Empresa empresa, String tipoOperacao); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/ParadaService.java b/src/com/rjconsultores/ventaboletos/service/ParadaService.java index 68f193036..f2450eaee 100644 --- a/src/com/rjconsultores/ventaboletos/service/ParadaService.java +++ b/src/com/rjconsultores/ventaboletos/service/ParadaService.java @@ -49,5 +49,7 @@ public interface ParadaService { public List buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada); public List buscarDestinosPorOrigem(Integer origemId); + + public List obtenerOrigenPorListRutaIds(Integer orgaoConcendenteId, Integer empresaId,Integer[] listRuta); } diff --git a/src/com/rjconsultores/ventaboletos/service/RutaService.java b/src/com/rjconsultores/ventaboletos/service/RutaService.java index 3be36fad0..4e46c59b9 100644 --- a/src/com/rjconsultores/ventaboletos/service/RutaService.java +++ b/src/com/rjconsultores/ventaboletos/service/RutaService.java @@ -118,4 +118,10 @@ public interface RutaService { public List buscaLikeComboBox(String stringConsulta); + public List buscarPorIds(Integer[] rutaIds); + + public List buscarPorOrgaoEcasetaPeaje(OrgaoConcedente orgao, Integer[] listCasetaPeaje); + + public List buscarRutasPorEmpresaOrgaoConcedenteParadaIds(Empresa empresa, OrgaoConcedente orgao, Integer[] lsParadaIds) ; + } diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaMinimaService.java b/src/com/rjconsultores/ventaboletos/service/TarifaMinimaService.java index 5e66423bf..733206583 100644 --- a/src/com/rjconsultores/ventaboletos/service/TarifaMinimaService.java +++ b/src/com/rjconsultores/ventaboletos/service/TarifaMinimaService.java @@ -4,17 +4,17 @@ */ package com.rjconsultores.ventaboletos.service; +import java.math.BigDecimal; +import java.util.List; + import com.rjconsultores.ventaboletos.entidad.ClaseServicio; import com.rjconsultores.ventaboletos.entidad.Marca; import com.rjconsultores.ventaboletos.entidad.Moneda; -import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.Plaza; import com.rjconsultores.ventaboletos.entidad.TarifaMinima; import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria; - -import java.math.BigDecimal; -import java.util.List; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; /** * @@ -23,10 +23,10 @@ import java.util.List; public interface TarifaMinimaService extends GenericService { public List pesquisarEspecifico(Marca marca, Parada origem, Parada destino, - ClaseServicio claseServicio, Moneda moneda); + ClaseServicio claseServicio, Moneda moneda, VigenciaTarifa vigenciaTarifa); public List pesquisar(Marca marca, Parada origem, Parada destino, - ClaseServicio claseServicio, Moneda moneda); + ClaseServicio claseServicio, Moneda moneda,VigenciaTarifa vigenciaTarifa); public List buscarPorPlaza(Plaza plaza); @@ -37,7 +37,7 @@ public interface TarifaMinimaService extends GenericService pesquisar(TarifaMinima tarifaMinima); - public List pesquisarOrigemDestinoTodos(Marca marca,Parada origem, Parada destino,ClaseServicio claseServicio, Moneda moneda); + public List pesquisarOrigemDestinoTodos(Marca marca,Parada origem, Parada destino,ClaseServicio claseServicio, Moneda moneda,VigenciaTarifa vigenciaTarifa); public List buscarPorMarca(Marca marca, Moneda moneda); diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java b/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java index 76dbcdfa4..a07de71c3 100644 --- a/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java +++ b/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java @@ -95,8 +95,7 @@ public interface TarifaOficialService { * @param empresaId - Empresa para ser filtrada * @throws BusinessException */ - public void atualizarTaxaEmbarque(List lsRuta, Integer orgaoConcedenteId,boolean gerarTabelaZerada, List lsEmpresaSelected) throws BusinessException; - + public void atualizarTaxaEmbarque(List lsRuta, Integer orgaoConcedenteId,boolean gerarTabelaZerada, List lsEmpresaSelected, List lsParadaIds) throws BusinessException; /** * Atualiza o seguro de acordo a kilometragem do trecho @@ -137,7 +136,7 @@ public interface TarifaOficialService { public void borrar(TarifaOficial tarifaOficial); - public void gerarAtualizarTabelaZerada(List lsRuta, Integer orgaoConcedenteId, List lsEmpresaSelected) throws BusinessException ; + public void gerarAtualizarTabelaZerada(List lsRuta, Integer orgaoConcedenteId, List lsEmpresaSelected,List lsParadaId) throws BusinessException ; public void atualizarPedagio(); diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaService.java b/src/com/rjconsultores/ventaboletos/service/TarifaService.java index e5cb7eecf..fcd15562f 100644 --- a/src/com/rjconsultores/ventaboletos/service/TarifaService.java +++ b/src/com/rjconsultores/ventaboletos/service/TarifaService.java @@ -51,7 +51,7 @@ public interface TarifaService extends GenericService { public List buscarPorVigencia(VigenciaTarifa vigencia,Empresa empresa); - public Boolean podeAlterarTarifaMinima(Tarifa tarifa, Marca marca, Parada origem,Parada destino, ClaseServicio claseServicio, Plaza plaza, Moneda moneda); + public Boolean podeAlterarTarifaMinima(Tarifa tarifa, Marca marca, Parada origem,Parada destino, ClaseServicio claseServicio, Plaza plaza, Moneda moneda, VigenciaTarifa vigenciaTarifa); public List buscarExisteVigencia(VigenciaTarifa vigenciaTarifa); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CalcularPeajeServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CalcularPeajeServiceImpl.java index b73cf3d94..82fd3f942 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/CalcularPeajeServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/CalcularPeajeServiceImpl.java @@ -7,6 +7,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.CalcularPeajeDAO; +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.entidad.Ruta; import com.rjconsultores.ventaboletos.exception.BusinessException; @@ -19,8 +20,8 @@ public class CalcularPeajeServiceImpl implements CalcularPeajeService{ private CalcularPeajeDAO calcularPeajeDAO; @Override - public List buscarCasetasPeajeWithinTramo(Ruta ruta){ - return calcularPeajeDAO.buscarCasetasPeajeWithinTramo(ruta); + public List buscarCasetasPeajeWithinTramo(Ruta ruta,Integer[] listCasetaPeaje){ + return calcularPeajeDAO.buscarCasetasPeajeWithinTramo(ruta,listCasetaPeaje); } @Override @@ -30,7 +31,7 @@ public class CalcularPeajeServiceImpl implements CalcularPeajeService{ @Override @Transactional(rollbackFor = BusinessException.class) - public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao, boolean usaICMS) throws Exception { - return calcularPeajeDAO.gerarSQLInserirPeajes(lsRuta, orgao, usaICMS); + public int[] gerarSQLInserirPeajes(List lsRuta, OrgaoConcedente orgao, boolean usaICMS,Integer[] listCasetaPeaje) throws Exception { + return calcularPeajeDAO.gerarSQLInserirPeajes(lsRuta, orgao, usaICMS,listCasetaPeaje); } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoCanalVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoCanalVentaServiceImpl.java index 3c7bb4c4b..eb8f859ac 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoCanalVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConfRestricaoCanalVentaServiceImpl.java @@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.ArrayList; import java.util.Calendar; import java.util.List; +import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -47,6 +48,22 @@ public class ConfRestricaoCanalVentaServiceImpl implements ConfRestricaoCanalVen confRestricaoCanalVentaDAO.actualizacion(entidad); } + + @Override + public void borrarList(Set confRestricaoCanalVentaSelecionadas) { + List listConfRestricaoCanalVentaIds =retornarListConfRestricaoCanalVentaIds(confRestricaoCanalVentaSelecionadas); + confRestricaoCanalVentaDAO.inativarListConfRestricaoCanalVenta(listConfRestricaoCanalVentaIds, UsuarioLogado.getUsuarioLogado().getUsuarioId()); + } + + + private List retornarListConfRestricaoCanalVentaIds(Set ConfRestricaoCanalVentaSelecionadas) { + List listConfRestricaoCanalVentaIds = new ArrayList(); + for (ConfRestricaoCanalVenta c : ConfRestricaoCanalVentaSelecionadas) { + listConfRestricaoCanalVentaIds.add(c.getConfRestricaoCanalVentaId().intValue()); + } + return listConfRestricaoCanalVentaIds; + } + @SuppressWarnings("unused") private boolean isBloqueoExistente(ConfRestricaoCanalVenta c , List confRestricaoCanalVentaList){ diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java index e2e80e21b..3e49f434d 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java @@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.service.impl; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; @@ -855,8 +856,8 @@ public class CorridaServiceImpl implements CorridaService { return b - a; } - private void generarCorrida(Date dataGeracao, List lsEsquemaCorrida, boolean isGeracaoAutomaticaCorrida) { - + private Boolean generarCorrida(Date dataGeracao, List lsEsquemaCorrida, boolean isGeracaoAutomaticaCorrida) { + DefaultTransactionDefinition def = new DefaultTransactionDefinition(DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW); // TODO: Melhorar o tratamento às transações manuais em caso de erro,etc @@ -869,6 +870,8 @@ public class CorridaServiceImpl implements CorridaService { Integer unPuntoVenta= constanteService.buscarValorConstantePorNomeConstante("PUNTOVENTA_RESERVA_CLIENTES"); Integer estacionId = constanteService.buscarValorConstantePorNomeConstante("ESTACION_RESERVA_CLIENTES"); + boolean corridaGerada = true; + Corrida corrida = null; try { @@ -884,6 +887,7 @@ public class CorridaServiceImpl implements CorridaService { //Nessas duas condições, o "filho" só é gerado a partir do esquema corrida "pai" if (esHijoRebote || esSegundoPiso) { log.info(String.format("Esquema nao gerado. esHijoRebote:%s ; esSegundoPiso: %s",esHijoRebote,esSegundoPiso)); + corridaGerada = false; continue; } } @@ -895,6 +899,7 @@ public class CorridaServiceImpl implements CorridaService { if (corrida == null) {// Si no genera la corrida, no va a // generar el rebote log.info("No fue generado corrida. Esquema " + esquemaCorrida.getEsquemacorridaId() + " Data" + dataGeracao); + corridaGerada = false; continue; } @@ -1030,6 +1035,8 @@ public class CorridaServiceImpl implements CorridaService { validaCriaReservaCliente(corrida, unUsuarioId, unPuntoVenta, estacionId); } } + + return corridaGerada; } private void validaCriaReservaCliente(Corrida corrida, Integer unUsuarioId, Integer unPuntoVenta, Integer estacionId) { @@ -1228,9 +1235,29 @@ public class CorridaServiceImpl implements CorridaService { return dataAte; } + + private boolean generaCorridaAprimorada() { + try { + Constante constante = constanteService.buscarPorNomeConstante("GENERACION_CORRIDA_APRIMORADA"); + return (constante != null && StringUtils.isNotBlank(constante.getValorconstante()) + && Boolean.valueOf(constante.getValorconstante())) ? Boolean.TRUE : Boolean.FALSE; + } catch (Exception e) { + } + + return Boolean.FALSE; + } @Transactional(readOnly = true, propagation = Propagation.SUPPORTS) public boolean generarCorridaAutomatica() { + + if (generaCorridaAprimorada()) { + return generarCorridaAutomaticaAprimorada(); + } else { + return generarCorridaAutomaticaPadrao(); + } + } + + private boolean generarCorridaAutomaticaPadrao() { feriadoCache.limpar(); Date dataDe = Calendar.getInstance().getTime(); @@ -1246,6 +1273,19 @@ public class CorridaServiceImpl implements CorridaService { return hayErroConstante && hayErroQtdeDias; } + + private boolean generarCorridaAutomaticaAprimorada() { + feriadoCache.limpar(); + + Date dataDe = Calendar.getInstance().getTime(); + + Date dataAteConstante = calcularDataFinalGeneracionCorrida(); + Boolean hayErroConstante = !generarCorridaAutomaticaAprimorada(dataDe, dataAteConstante); + + log.debug("corrida generadas aprimorada por la cant de dias.hayError=" + hayErroConstante); + + return hayErroConstante; + } private boolean generarCorridaAutomaticaQtdeDias(Date dataDeOriginal) { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); @@ -1353,6 +1393,92 @@ public class CorridaServiceImpl implements CorridaService { return generacionExitosa; } + + private boolean generarCorridaAutomaticaAprimorada(final Date dataInicial, final Date dataConstanteFim) { + boolean generacionExitosa = true; + SimpleDateFormat sdfData = new SimpleDateFormat("dd/MM/yyyy"); + + log.debug("** AUTO - Data De: " + sdfData.format(dataInicial) + " **Data Ateh: " + sdfData.format(dataConstanteFim)); + + // TODO: Melhorar o tratamento às transações manuais em caso de erro,etc + DefaultTransactionDefinition def = new DefaultTransactionDefinition(DefaultTransactionDefinition.PROPAGATION_REQUIRES_NEW); + TransactionStatus status = transactionManager.getTransaction(def); + + Calendar calendarData = Calendar.getInstance(); + calendarData.setTime(dataConstanteFim); + + Date dataAte = calendarData.getTime(); + + try { + log.debug("*** Data: " + sdfData.format(dataAte)); + List lsEsquemaCorrida = esquemaCorridaService.buscaDentroVigencia(dataInicial); + + Boolean dentroVigenciaEsquemaOperacional = !lsEsquemaCorrida.isEmpty(); + if (dentroVigenciaEsquemaOperacional) { + + for (EsquemaCorrida esquemaCorrida : lsEsquemaCorrida) { + log.debug("esquemaCorrida=" + esquemaCorrida.getEsquemacorridaId()); + + Integer qtdeDiasGerar = esquemaCorrida.getCantDiasGeneracion(); + + if (qtdeDiasGerar != null && qtdeDiasGerar >= 0) { + log.debug("cantDiasGenerar=" + qtdeDiasGerar); + + Calendar calendarDiasGenerar = Calendar.getInstance(); + calendarDiasGenerar.setTime(dataInicial); + calendarDiasGenerar.add(Calendar.DATE, qtdeDiasGerar); + dataAte = calendarDiasGenerar.getTime(); + } else { + calendarData.setTime(dataConstanteFim); + dataAte = calendarData.getTime(); + } + + log.debug("Periodo generacion = " + sdf.format(dataInicial) + " hasta " + sdf.format(dataAte)); + + if (DateUtil.compareOnlyDate(dataAte, esquemaCorrida.getEsquemaOperacional().getFecfinvigencia()) > 0) { + log.info("Cant dias excede final de la vigencia"); + dataAte = esquemaCorrida.getEsquemaOperacional().getFecfinvigencia(); + } + + try { + while (DateUtil.compareOnlyDate(dataAte, dataInicial) >= 0) { + + boolean corridaGerada = this.generarCorrida(dataAte, Arrays.asList(esquemaCorrida), false); + if (corridaGerada) { + calendarData.setTime(dataAte); + calendarData.add(Calendar.DATE, -1); + dataAte = calendarData.getTime(); + + } else { + log.info("Corrida do dia: " + sdfData.format(dataAte) + " já gerada"); + break; + } + + } + + log.info("commit bloco corridas"); + + transactionManager.commit(status); + status = transactionManager.getTransaction(def); + } catch (Exception ex) { + log.error("", ex); + log.error(" Erro ao gerar corrida = " + esquemaCorrida.getNumCorrida() + " esquemaCorrida = " + esquemaCorrida.getEsquemacorridaId()); + transactionManager.rollback(status); + status = transactionManager.getTransaction(def); + } + } + + } else { + log.info("No hay esquema vigente para la fecha " + sdfData.format(dataInicial)); + } + + } catch (Exception ex) { + log.error("Erro ao gerar corridas: " + ex, ex); + generacionExitosa = false; + } + + return generacionExitosa; + } private int cantDiasMaxGerarCorridasManual() { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailEComerceServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailEComerceServiceImpl.java new file mode 100644 index 000000000..13b4cdebb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaEmailEComerceServiceImpl.java @@ -0,0 +1,68 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.EmpresaEmailEComerceDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.EmpresaEmailEComerce; +import com.rjconsultores.ventaboletos.service.EmpresaEmailEComerceService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("empresaEmailEComerceService") +public class EmpresaEmailEComerceServiceImpl implements EmpresaEmailEComerceService { + + @Autowired + private EmpresaEmailEComerceDAO empresaEmailEComerceDAO; + + @Override + public List obtenerTodos() { + return empresaEmailEComerceDAO.obtenerTodos(); + } + + @Override + public EmpresaEmailEComerce obtenerID(Integer id) { + return empresaEmailEComerceDAO.obtenerID(id); + } + + @Override + @Transactional + public EmpresaEmailEComerce suscribir(EmpresaEmailEComerce entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaEmailEComerceDAO.suscribir(entidad); + } + + @Override + @Transactional + public EmpresaEmailEComerce actualizacion(EmpresaEmailEComerce entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return empresaEmailEComerceDAO.actualizacion(entidad); + } + + @Override + @Transactional + public void borrar(EmpresaEmailEComerce entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + empresaEmailEComerceDAO.actualizacion(entidad); + + } + + @Override + public EmpresaEmailEComerce buscarPorEmpresa(Empresa empresa, String tipoOperacao) { + return empresaEmailEComerceDAO.buscarPorEmpresa(empresa, tipoOperacao); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java index 300608c6e..d3a5c4899 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java @@ -242,15 +242,10 @@ public class ImportacaoClientesSrvpServiceImpl implements ImportacaoClientesSrvp break; case 3: cell.setCellType(Cell.CELL_TYPE_STRING); - String numDocString = null; - try { - numDocString = new Long(Math.round(cell.getNumericCellValue())).toString(); - }catch(Exception e) { - log.error("Erro na gravação do registro. Favor revisar",e); - erros.append(cliente.getNumfidelidade() + " - Numero doc nao numerico: " + new Long(Math.round(cell.getNumericCellValue())).toString()); - erros.append("\n"); - - } + String numDocString = null; + + numDocString = cell.getStringCellValue(); + cliente.setNumerodoc(numDocString); cliente.setCpf(numDocString); cliente.setRg(numDocString); @@ -337,7 +332,7 @@ public class ImportacaoClientesSrvpServiceImpl implements ImportacaoClientesSrvp break; case 14: try { - cliente.setCep(new Long(Math.round(cell.getNumericCellValue())).toString()); + cliente.setCep(cell.getStringCellValue()); }catch(Exception e) { log.error("Erro na gravação do registro. Favor revisar",e); } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java index 9e19b748f..c67827ade 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java @@ -185,4 +185,9 @@ public class ParadaServiceImpl implements ParadaService { public List buscarDestinosPorOrigem(Integer origemId) { return paradaDAO.buscarDestinosPorOrigem(origemId); } + + @Override + public List obtenerOrigenPorListRutaIds(Integer orgaoConcendenteId, Integer empresaId, Integer[] listRuta){ + return paradaDAO.obtenerOrigenPorListRutaIds(orgaoConcendenteId,empresaId,listRuta); + } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java index 4d7ad79dc..bbbf59375 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java @@ -666,4 +666,21 @@ public class RutaServiceImpl implements RutaService { public List buscaLikeComboBox(String stringConsulta) { return rutaDAO.buscaLikeComboBox(stringConsulta); } -} + + @Override + public List buscarPorIds(Integer[] rutaIds){ + return rutaDAO.buscarPorIds(rutaIds); + + } + + @Override + public List buscarPorOrgaoEcasetaPeaje(OrgaoConcedente orgao, Integer[] listCasetaPeaje){ + return rutaDAO.buscarPorOrgaoEcasetaPeaje(orgao,listCasetaPeaje); + } + + @Override + public List buscarRutasPorEmpresaOrgaoConcedenteParadaIds(Empresa empresa, OrgaoConcedente orgao, Integer[] lsParadaIds) { + return rutaDAO.buscarRutasPorEmpresaOrgaoConcedenteParadaIds(empresa,orgao,lsParadaIds); + } + + } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java index f54a8e929..a72eab0db 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java @@ -88,13 +88,15 @@ public class SapServiceImpl implements SapService{ if(integrado == null) { atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), INTEGRACAO_SAP_ERRO); - log.error("Erro no envio/retorno da requisicao para integração SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId()); + log.error("Erro no envio/retorno da requisicao para integra��o SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId()); + throw new RuntimeException("Erro no envio/retorno da requisicao para integração SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId()); }else if(integrado.getString("Integration").equals("S")) { atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), INTEGRACAO_SAP_OK); contador++; }else if(integrado.getString("Integration").equals("E")) { atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), INTEGRACAO_SAP_ERRO); log.warn("Retorno enviado pelo SAP: \r\n"+integrado.getString("Message")); + throw new RuntimeException("Fechamento: "+fechamentoCntcorrente.getFechamentocntcorrenteId()+"\r\nRetorno enviado pelo SAP: \r\n"+integrado.getString("Message")); } } } @@ -115,7 +117,7 @@ public class SapServiceImpl implements SapService{ Constante constante = constanteDAO.buscarPorNomeConstante(constanteString); if( constante == null || constante.getValorconstante() == null || constante.getValorconstante().isEmpty() ) { - throw new RuntimeException("Constante "+constanteString+" não cadastrada"); + throw new RuntimeException("Constante "+constanteString+" n�o cadastrada"); } return constante.getValorconstante(); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaEmbarcadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaEmbarcadaServiceImpl.java index 2d0832802..053804545 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/TarifaEmbarcadaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaEmbarcadaServiceImpl.java @@ -136,10 +136,10 @@ public class TarifaEmbarcadaServiceImpl implements TarifaEmbarcadaService { Boolean podeAlterarTarifaMinima = Boolean.TRUE; - List lsTarifaMinima = tarifaMinimaService.pesquisarEspecifico(marca, origem, destino, claseServicio, moneda); + List lsTarifaMinima = tarifaMinimaService.pesquisarEspecifico(marca, origem, destino, claseServicio, moneda,null); if (lsTarifaMinima.isEmpty()) { - lsTarifaMinima = tarifaMinimaService.pesquisarOrigemDestinoTodos(marca, origem, destino, claseServicio, moneda); + lsTarifaMinima = tarifaMinimaService.pesquisarOrigemDestinoTodos(marca, origem, destino, claseServicio, moneda,null); } log.debug("Moneda : " + moneda.getDescmoneda()); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaMinimaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaMinimaServiceImpl.java index 3d1ab1a19..b91219b83 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/TarifaMinimaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaMinimaServiceImpl.java @@ -13,6 +13,7 @@ import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.Plaza; import com.rjconsultores.ventaboletos.entidad.TarifaMinima; import com.rjconsultores.ventaboletos.entidad.TarifaMinimaCategoria; +import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; import com.rjconsultores.ventaboletos.service.TarifaMinimaService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -75,8 +76,8 @@ public class TarifaMinimaServiceImpl implements TarifaMinimaService { } public List pesquisar(Marca marca, Parada origem, Parada destino, - ClaseServicio claseServicio, Moneda moneda) { - return tarifaMinimaDAO.pesquisar(marca, origem, destino, claseServicio, moneda); + ClaseServicio claseServicio, Moneda moneda,VigenciaTarifa vigenciaTarifa) { + return tarifaMinimaDAO.pesquisar(marca, origem, destino, claseServicio, moneda,vigenciaTarifa); } public List pesquisar(BigDecimal valor, Moneda moneda, @@ -91,12 +92,12 @@ public class TarifaMinimaServiceImpl implements TarifaMinimaService { } public List pesquisarEspecifico(Marca marca, Parada origem, - Parada destino, ClaseServicio claseServicio, Moneda moneda) { - return tarifaMinimaDAO.pesquisar(marca, origem, destino, claseServicio, moneda); + Parada destino, ClaseServicio claseServicio, Moneda moneda, VigenciaTarifa vigenciaTarifa) { + return tarifaMinimaDAO.pesquisar(marca, origem, destino, claseServicio, moneda,vigenciaTarifa); } - public List pesquisarOrigemDestinoTodos(Marca marca, Parada origem,Parada destino,ClaseServicio claseServicio, Moneda moneda) { - return tarifaMinimaDAO.pesquisarOrigemDestinoTodos(marca, origem, destino, claseServicio, moneda); + public List pesquisarOrigemDestinoTodos(Marca marca, Parada origem,Parada destino,ClaseServicio claseServicio, Moneda moneda,VigenciaTarifa vigenciaTarifa) { + return tarifaMinimaDAO.pesquisarOrigemDestinoTodos(marca, origem, destino, claseServicio, moneda,vigenciaTarifa); } public List buscarPorMarca(Marca marca, Moneda moneda) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java index 5d0b890a9..e62ed15be 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java @@ -113,7 +113,7 @@ public class TarifaOficialServiceImpl implements TarifaOficialService { @Override @Transactional(rollbackFor = BusinessException.class) - public void gerarAtualizarTabelaZerada(List lsRuta, Integer orgaoConcedenteId, List lsEmpresaSelected) throws BusinessException { + public void gerarAtualizarTabelaZerada(List lsRuta, Integer orgaoConcedenteId, List lsEmpresaSelected,List lsParadaIds) throws BusinessException { // Limpando a tabela de TARIFA_OFICIAL tarifaOficialDAO.limparTarifasOficiais(lsEmpresaSelected); @@ -134,7 +134,7 @@ public class TarifaOficialServiceImpl implements TarifaOficialService { } //Gerando as tarifas - tarifaOficialDAO.gerarTabelaZerada(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, idsEmpresas); + tarifaOficialDAO.gerarTabelaZerada(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, idsEmpresas,lsParadaIds); x--; }while(x > 0); @@ -142,10 +142,10 @@ public class TarifaOficialServiceImpl implements TarifaOficialService { @Override @Transactional(rollbackFor = BusinessException.class) - public void atualizarTaxaEmbarque(List lsRuta, Integer orgaoConcedenteId,boolean gerarTabelaZerada, List lsEmpresaSelected) throws BusinessException{ + public void atualizarTaxaEmbarque(List lsRuta, Integer orgaoConcedenteId,boolean gerarTabelaZerada, List lsEmpresaSelected, List lsParadaIds) throws BusinessException{ if (gerarTabelaZerada){ - gerarAtualizarTabelaZerada(lsRuta, orgaoConcedenteId, lsEmpresaSelected); + gerarAtualizarTabelaZerada(lsRuta, orgaoConcedenteId, lsEmpresaSelected,lsParadaIds); } List idsEmpresas = new ArrayList(); @@ -153,7 +153,7 @@ public class TarifaOficialServiceImpl implements TarifaOficialService { idsEmpresas.add(e.getEmpresaId()); } - tarifaOficialDAO.atualizarTaxaEmbarque(lsRuta, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, idsEmpresas); + tarifaOficialDAO.atualizarTaxaEmbarque(lsRuta, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedenteId, idsEmpresas,lsParadaIds); } @Override diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java index 942463bf5..8a2869c8d 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaServiceImpl.java @@ -209,14 +209,14 @@ public class TarifaServiceImpl implements TarifaService { } public Boolean podeAlterarTarifaMinima(Tarifa tarifa, Marca marca, Parada origem, - Parada destino, ClaseServicio claseServicio, Plaza plaza, Moneda moneda) { + Parada destino, ClaseServicio claseServicio, Plaza plaza, Moneda moneda, VigenciaTarifa vigenciaTarifa) { Boolean podeAlterarTarifaMinima = Boolean.TRUE; - List lsTarifaMinima = tarifaMinimaService.pesquisarEspecifico(marca, origem, destino, claseServicio, moneda); + List lsTarifaMinima = tarifaMinimaService.pesquisarEspecifico(marca, origem, destino, claseServicio, moneda,vigenciaTarifa); if (lsTarifaMinima.isEmpty()) { - lsTarifaMinima = tarifaMinimaService.pesquisarOrigemDestinoTodos(marca, origem, destino, claseServicio, moneda); + lsTarifaMinima = tarifaMinimaService.pesquisarOrigemDestinoTodos(marca, origem, destino, claseServicio, moneda,vigenciaTarifa); } log.debug("Moneda : " + moneda.getDescmoneda()); @@ -237,11 +237,12 @@ public class TarifaServiceImpl implements TarifaService { return podeAlterarTarifaMinima; } - + public List buscarExisteVigencia(VigenciaTarifa vigenciaTarifa) { return tarifaDAO.buscarTarifasAtivasPorVigencia(vigenciaTarifa); } - + + // Metodo para gerar todas as tarifas possiveis @Transactional public Boolean generarTarifas(VigenciaTarifa vigencia, Marca marca) { @@ -375,6 +376,7 @@ public class TarifaServiceImpl implements TarifaService { } - return lsTarifa; + return lsTarifa ; } + } From 8d742a0a2c83e5e350b29d9348eed083d81dc94a Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Tue, 11 Oct 2022 13:52:25 -0300 Subject: [PATCH 15/34] teste de block --- pom.xml | 2 +- .../rjconsultores/ventaboletos/enums/SituacaoBoleto.java | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8ea869bc4..8c029b500 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 br.com.rjconsultores modelWeb - 1.0.0 + 1.0.1 diff --git a/src/com/rjconsultores/ventaboletos/enums/SituacaoBoleto.java b/src/com/rjconsultores/ventaboletos/enums/SituacaoBoleto.java index 68755dfee..17e113cb5 100644 --- a/src/com/rjconsultores/ventaboletos/enums/SituacaoBoleto.java +++ b/src/com/rjconsultores/ventaboletos/enums/SituacaoBoleto.java @@ -2,7 +2,12 @@ package com.rjconsultores.ventaboletos.enums; public enum SituacaoBoleto { - TODAS(-1, "Todas"), ANULADO(31, "Anulado"), DEVOLVIDO(32, "Devolvido"), REMARCADO(23, "Remarcado"), TROCADO(10, "Trocado"), VENDIDO(1, "Vendido"); + TODAS(-1, "Todas"), + ANULADO(31, "Anulado"), + DEVOLVIDO(32, "Devolvido"), + REMARCADO(23, "Remarcado"), + TROCADO(10, "Trocado"), + VENDIDO(1, "Vendido"); private String situacao; private Integer codigo; From f175a8ccb6d21f6361770d28eeefeb4d595e402e Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Mon, 21 Nov 2022 16:05:55 -0300 Subject: [PATCH 16/34] sincronismo com fonte atual --- pom.xml | 2 +- .../dao/HistoricoFormaPagoPuntoVentaDAO.java | 20 ++ .../ventaboletos/dao/PeajeDao.java | 8 + .../ventaboletos/dao/RutaDAO.java | 2 +- .../ventaboletos/dao/SapDAO.java | 4 +- .../ventaboletos/dao/TarifaOficialDAO.java | 9 +- ...toricoFormaPagoPuntoVentaHibernateDAO.java | 49 +++++ .../dao/hibernate/PeajeHibernateDao.java | 20 ++ .../dao/hibernate/RutaHibernateDAO.java | 5 +- .../dao/hibernate/SapHibernateDAO.java | 29 +-- .../hibernate/TarifaOficialHibernateDAO.java | 76 +++++++- .../dao/sqlbuilder/SQLBuilder.java | 2 +- .../dao/sqlbuilder/impl/SQLBuilderOracle.java | 21 +- .../ventaboletos/entidad/Categoria.java | 13 ++ .../entidad/HistoricoFormaPagoPuntoVenta.java | 183 ++++++++++++++++++ .../ventaboletos/entidad/PuntoVenta.java | 38 +++- .../ventaboletos/entidad/Tarifa.java | 15 ++ .../ventaboletos/entidad/TarifaOficial.java | 14 ++ .../enums/StatusIntegracaoSap.java | 34 +++- .../HistoricoFormaPagoPuntoVentaService.java | 21 ++ .../ventaboletos/service/PeajeService.java | 9 + .../ventaboletos/service/RutaService.java | 2 + .../ventaboletos/service/SapService.java | 10 +- .../service/TarifaOficialService.java | 7 +- .../impl/ConferenciaComissaoServiceImpl.java | 6 +- .../service/impl/ContingenciaServiceImpl.java | 59 +++--- .../service/impl/CorridaServiceImpl.java | 29 ++- ...storicoFormaPagoPuntoVentaServiceImpl.java | 75 +++++++ .../service/impl/PeajeServiceImpl.java | 20 ++ .../service/impl/PuntoVentaServiceImpl.java | 48 ++--- .../service/impl/RutaServiceImpl.java | 7 +- .../service/impl/SapServiceImpl.java | 37 ++-- .../impl/TarifaOficialServiceImpl.java | 131 ++++++++++++- .../vo/comissao/BoletoComissao.java | 8 +- ...TarifaOficialComComposicaoDoPedagioVo.java | 29 +++ .../integracao/FechamentoCntCorrenteVO.java | 12 +- 36 files changed, 920 insertions(+), 134 deletions(-) create mode 100644 src/com/rjconsultores/ventaboletos/dao/HistoricoFormaPagoPuntoVentaDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PeajeDao.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/HistoricoFormaPagoPuntoVentaHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PeajeHibernateDao.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/HistoricoFormaPagoPuntoVenta.java create mode 100644 src/com/rjconsultores/ventaboletos/service/HistoricoFormaPagoPuntoVentaService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/PeajeService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/HistoricoFormaPagoPuntoVentaServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/PeajeServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/comissao/TarifaOficialComComposicaoDoPedagioVo.java diff --git a/pom.xml b/pom.xml index 8ea869bc4..8ce4b5dc0 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 br.com.rjconsultores modelWeb - 1.0.0 + 1.0.3 diff --git a/src/com/rjconsultores/ventaboletos/dao/HistoricoFormaPagoPuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/HistoricoFormaPagoPuntoVentaDAO.java new file mode 100644 index 000000000..75966b2f0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/HistoricoFormaPagoPuntoVentaDAO.java @@ -0,0 +1,20 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.HistoricoFormaPagoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +/** + * + * @author Wallace + */ +public interface HistoricoFormaPagoPuntoVentaDAO extends GenericDAO { + + List obtenerTodosPorPuntoVenta(PuntoVenta puntoVenta); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PeajeDao.java b/src/com/rjconsultores/ventaboletos/dao/PeajeDao.java new file mode 100644 index 000000000..7f0415b31 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PeajeDao.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.Peaje; + +public interface PeajeDao extends GenericDAO { + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java b/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java index 6af7ce7ed..0e34d5ade 100644 --- a/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java @@ -76,5 +76,5 @@ public interface RutaDAO extends GenericDAO { public List buscarPorIds(Integer[] rutaIds); - public List buscarPorOrgaoEcasetaPeaje(OrgaoConcedente orgao, Integer[] listCasetaPeaje); + public List buscarPorOrgaoEcasetaPeaje(OrgaoConcedente orgao, Integer[] listCasetaPeaje, Empresa empresa); } diff --git a/src/com/rjconsultores/ventaboletos/dao/SapDAO.java b/src/com/rjconsultores/ventaboletos/dao/SapDAO.java index 473bfcc86..112a0a26e 100644 --- a/src/com/rjconsultores/ventaboletos/dao/SapDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/SapDAO.java @@ -10,9 +10,9 @@ import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO; public interface SapDAO extends GenericDAO { - public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar); + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, String status); - public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar, PuntoVenta puntoVenta); + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, String status, PuntoVenta puntoVenta); public boolean atualizaFechamento(Long fechamentocntcorrenteId, int status) throws Exception; diff --git a/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java b/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java index 66e61eef2..c1c0bc3b3 100644 --- a/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/TarifaOficialDAO.java @@ -1,8 +1,10 @@ package com.rjconsultores.ventaboletos.dao; +import java.math.BigDecimal; import java.util.List; import com.rjconsultores.ventaboletos.constantes.TipoSeguro; +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; import com.rjconsultores.ventaboletos.entidad.ClaseServicio; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Marca; @@ -13,6 +15,7 @@ import com.rjconsultores.ventaboletos.entidad.Ruta; import com.rjconsultores.ventaboletos.entidad.TarifaOficial; import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; import com.rjconsultores.ventaboletos.service.TarifaOficialService; +import com.rjconsultores.ventaboletos.vo.comissao.TarifaOficialComComposicaoDoPedagioVo; import com.rjconsultores.ventaboletos.vo.comissao.TarifaOficialVO; public interface TarifaOficialDAO extends GenericDAO { @@ -23,7 +26,7 @@ public interface TarifaOficialDAO extends GenericDAO { * @param orgaoConcedenteId TODO * @return TODO */ - public Integer gerarTarifaPorCoeficiente(Integer ruta, Integer usuarioId, OrgaoConcedente orgaoConcedente, List idsEmpresas); + public Integer gerarTarifaPorCoeficiente(Integer ruta, Integer usuarioId, OrgaoConcedente orgaoConcedente, List idsEmpresas,Integer[] lsCasetaPeaje); public Integer gerarTarifaArtesp(Integer ruta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas); @@ -98,4 +101,8 @@ public interface TarifaOficialDAO extends GenericDAO { public long obtenerCount(List lsEmpresaSelected); public List obterTarifaOficialPorFiltroVO(Moneda moneda, Marca marca,List lsMarcas,Parada origem, Parada destino, ClaseServicio claseServicio, Ruta ruta, String numRuta, Boolean vende); + + public List oberTarifaOficialComComposicaoDoPedagioVo(Integer empresaId); + + public void atualizarPedagioComFiltroDePracaDePedagio(Integer tarifaOficialId, BigDecimal importePedagio, String composicaoPedagio ); } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/HistoricoFormaPagoPuntoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/HistoricoFormaPagoPuntoVentaHibernateDAO.java new file mode 100644 index 000000000..29201ff13 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/HistoricoFormaPagoPuntoVentaHibernateDAO.java @@ -0,0 +1,49 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.HistoricoFormaPagoPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.HistoricoFormaPagoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +/** + * + * @author Administrador + */ +@Repository("historicoFormaPagoPuntoVentaDAO") +public class HistoricoFormaPagoPuntoVentaHibernateDAO extends GenericHibernateDAO implements HistoricoFormaPagoPuntoVentaDAO { + + @Autowired + public HistoricoFormaPagoPuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + + @Override + public List obtenerTodosPorPuntoVenta(PuntoVenta puntoVenta) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("puntoVenta", puntoVenta)); + + return c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PeajeHibernateDao.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PeajeHibernateDao.java new file mode 100644 index 000000000..a4d293e69 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PeajeHibernateDao.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +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.PeajeDao; +import com.rjconsultores.ventaboletos.entidad.Peaje; + + +@Repository("peajeDao") +public class PeajeHibernateDao extends GenericHibernateDAO implements PeajeDao { + + @Autowired + public PeajeHibernateDao(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java index fee5d58b2..f09a5e060 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaHibernateDAO.java @@ -470,7 +470,7 @@ public class RutaHibernateDAO extends GenericHibernateDAO impleme } @Override - public List buscarPorOrgaoEcasetaPeaje(OrgaoConcedente orgao, Integer[] listCasetaPeaje){ + public List buscarPorOrgaoEcasetaPeaje(OrgaoConcedente orgao, Integer[] listCasetaPeaje,Empresa empresa){ Criteria c = getSession().createCriteria(getPersistentClass()); c.add(Restrictions.eq("activo", Boolean.TRUE)); c.add(Restrictions.eq("indRutaCancelada", Boolean.FALSE)); @@ -485,6 +485,9 @@ public class RutaHibernateDAO extends GenericHibernateDAO impleme crietriaOrgaoConcendente.add(Restrictions.eq("activo", Boolean.TRUE)); crietriaOrgaoConcendente.add(Restrictions.eq("orgaoConcedenteId", orgao.getOrgaoConcedenteId())); } + if (empresa != null && empresa.getEmpresaId() != -1) { + c.createCriteria("lsRutaEmpresa").add(Restrictions.eq("empresa", empresa)); + } c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); return c.list(); diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/SapHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/SapHibernateDAO.java index 74cb6f8f2..6a9a3ef45 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/SapHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/SapHibernateDAO.java @@ -7,19 +7,20 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; +import com.rjconsultores.ventaboletos.dao.SapDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enums.StatusIntegracaoSap; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; +import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO; + import org.hibernate.Query; 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.SapDAO; -import com.rjconsultores.ventaboletos.entidad.Empresa; -import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente; -import com.rjconsultores.ventaboletos.entidad.PuntoVenta; -import com.rjconsultores.ventaboletos.utilerias.DateUtil; -import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO; - @Repository("sapDAO") public class SapHibernateDAO extends GenericHibernateDAO implements SapDAO { @@ -29,13 +30,13 @@ public class SapHibernateDAO extends GenericHibernateDAO obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) { - return obtenerTodosParaRemessa(empresa, dataDe, dataAte, reenviar, null); + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, String status) { + return obtenerTodosParaRemessa(empresa, dataDe, dataAte, status, null); } @SuppressWarnings("unchecked") @Override - public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar, PuntoVenta puntoVenta) { + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, String status, PuntoVenta puntoVenta) { StringBuilder sb = new StringBuilder(); sb.append(" SELECT "); @@ -76,8 +77,8 @@ public class SapHibernateDAO extends GenericHibernateDAO idsEmpresas) { + public Integer gerarTarifaPorCoeficiente(Integer rutaId, Integer usuarioId, OrgaoConcedente orgaoConcedente, List idsEmpresas, Integer[] lsCasetaPeaje) { - String sql = sqlBuilder.getSQLGerarTarifaOficial(rutaId, usuarioId, orgaoConcedente, idsEmpresas); + String sql = sqlBuilder.getSQLGerarTarifaOficial(rutaId, usuarioId, orgaoConcedente, idsEmpresas,lsCasetaPeaje); int qtd = getSession().createSQLQuery(sql).executeUpdate(); @@ -369,7 +373,7 @@ public class TarifaOficialHibernateDAO extends GenericHibernateDAO= TO_DATE(:dataFinal,'DD/MM/YYYY hh24:mi')"); + sql.append(" INNER JOIN PEAJE p"); + sql.append(" ON p.ORGAOCONCEDENTE_ID = tof.ORGAOCONCEDENTE_ID"); + sql.append(" AND p.ruta_id= tof.ruta_id"); + sql.append(" AND p.ORIGEN_ID = tof.ORIGEN_ID"); + sql.append(" AND p.DESTINO_ID = tof.DESTINO_ID"); + sql.append(" AND p.activo = 1"); + sql.append(" AND m.empresa_id=:empresaId "); + sql.append(" group by ta.tarifa_id,tof.tarifaoficial_id,ta.tarifa_id,ta.COMPOSICAO_DO_PEAJE"); + + Query query = getSession().createSQLQuery(sql.toString()); + + Query qr = getSession().createSQLQuery(sql.toString()).addScalar("tarifaOficialId", Hibernate.INTEGER).addScalar("composicaoDoPedagioNaTarifa", Hibernate.STRING).addScalar("composicaoDoPedagioNaTarifaOficialComPeaje", Hibernate.STRING).setResultTransformer(Transformers.aliasToBean(TarifaOficialComComposicaoDoPedagioVo.class)); + qr.setParameter("empresaId", empresaId); + qr.setParameter("dataInicial", DateUtil.getStringDate(DateUtil.inicioFecha(new Date()), "dd/MM/yyyy HH:mm")); + qr.setParameter("dataFinal", DateUtil.getStringDate(DateUtil.fimFecha(new Date()), "dd/MM/yyyy HH:mm")); + + return (List) qr.list(); + + + + + } + + @Override + public void atualizarPedagioComFiltroDePracaDePedagio(Integer tarifaOficialId, BigDecimal importePedagio, String composicaoPedagio) { + StringBuilder sb = new StringBuilder(""); + sb.append("update tarifa_oficial set IMPORTEPEDAGIO =:importePedagio, "); + sb.append("COMPOSICAO_DO_PEAJE =:composicaoDoPedagio "); + sb.append("WHERE tarifaoficial_id=:tarifaOficialId"); + + Query query = getSession().createSQLQuery(sb.toString()); + query.setBigDecimal("importePedagio", importePedagio); + query.setString("composicaoDoPedagio", composicaoPedagio); + query.setInteger("tarifaOficialId", tarifaOficialId); + + query.executeUpdate(); + + } + } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLBuilder.java b/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLBuilder.java index 93847780c..deac6d043 100644 --- a/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLBuilder.java +++ b/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/SQLBuilder.java @@ -21,7 +21,7 @@ import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; */ public interface SQLBuilder { - public String getSQLGerarTarifaOficial(Integer codRuta, Integer usuarioId, OrgaoConcedente orgaoConcedente, List idsEmpresas); + public String getSQLGerarTarifaOficial(Integer codRuta, Integer usuarioId, OrgaoConcedente orgaoConcedente, List idsEmpresas, Integer[] listCasetaPeaje); public String getSQLGerarTabelaZerada(Integer codRuta, Integer usuarioId, Integer orgaoConcedenteId, List idsEmpresas, List lsParadaId); diff --git a/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java b/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java index d189be441..b14c162e8 100644 --- a/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java +++ b/src/com/rjconsultores/ventaboletos/dao/sqlbuilder/impl/SQLBuilderOracle.java @@ -5,6 +5,8 @@ import java.util.Date; import java.util.List; import java.util.Map; +import org.apache.commons.lang.StringUtils; + import com.rjconsultores.ventaboletos.constantes.Constantes; import com.rjconsultores.ventaboletos.constantes.TipoSeguro; import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder; @@ -245,7 +247,7 @@ public class SQLBuilderOracle implements SQLBuilder { @Override public String getSQLGerarTarifaOficial(final Integer codRuta, final Integer usuarioId, - final OrgaoConcedente orgaoConcedente, final List idsEmpresas) { + final OrgaoConcedente orgaoConcedente, final List idsEmpresas,Integer[] listCasetaPeaje) { StringBuilder sb = new StringBuilder(); sb.append(" INSERT "); @@ -374,8 +376,12 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" inner join estado e on e.estado_id = c.estado_id "); sb.append(" inner join MARCA_CLASESERVICIO mc on "); sb.append(" mc.CLASESERVICIO_ID = r.CLASESERVICIO_ID and ma.marca_id = mc.marca_id "); + if(null !=listCasetaPeaje) { + sb.append(" inner join peaje p on p.ruta_id=r.ruta_id and p.origen_id=po.parada_id and p.destino_id=pd.parada_id and p.orgaoconcedente_id =oc.orgaoconcedente_id "); + } sb.append(" inner join CLASE_SERVICIO cl on cl.claseservicio_id = r.CLASESERVICIO_ID, "); sb.append(" moneda m "); + sb.append(" "); sb.append("where "); sb.append(" rc.activo = 1 "); @@ -406,7 +412,11 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" oc.orgaoconcedente_id, r.ruta_id) "); sb.append(" not in (select tao.tramo_id,tao.marca_id,tao.CLASESERVICIO_ID, "); sb.append(" tao.moneda_id,tao.orgaoconcedente_id, tao.ruta_id "); - sb.append(" from tarifa_oficial tao where tao.activo = 1) "); + sb.append(" from tarifa_oficial tao where tao.activo = 1) "); + if(null !=listCasetaPeaje) { + sb.append(" and p.activo=1 "); + sb.append(" and p.casetapeaje_id in ( " + StringUtils.join(listCasetaPeaje,",") + ") "); + } return sb.toString(); } @@ -768,6 +778,7 @@ public class SQLBuilderOracle implements SQLBuilder { StringBuilder sb = new StringBuilder(""); sb.append("SELECT tao.IMPORTEPEDAGIO AS \"taoimportepedagio\", "); + sb.append(" tao.COMPOSICAO_DO_PEAJE AS \"taocomposicaodopeaje\", "); sb.append(" tao.PRECIO AS \"taoprecio\", "); sb.append(" tao.PRECIOORIGINAL AS \"taopreciooriginal\", "); sb.append(" tao.IMPORTETAXAEMBARQUE AS \"taoimportetaxaembarque\", "); @@ -809,6 +820,7 @@ public class SQLBuilderOracle implements SQLBuilder { if (calculaPegagio) { sb.append("IMPORTEPEDAGIO=").append(dados.get("taoimportepedagio")).append(","); + sb.append(" COMPOSICAO_DO_PEAJE='").append(dados.get("taocomposicaodopeaje")).append("',"); } if (calculaTarifa) { sb.append("PRECIO=").append(dados.get("taoprecio")).append(",PRECIOORIGINAL=").append(dados.get("taopreciooriginal")).append(","); @@ -839,7 +851,7 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" MARCA_ID, CLASESERVICIO_ID, PRECIOORIGINAL, MONEDA_ID, "); sb.append(" VIGENCIATARIFA_ID, STATUSTARIFA, ACTIVO, FECMODIF, "); sb.append(" USUARIO_ID, IMPORTETAXAEMBARQUE, IMPORTEPEDAGIO, IMPORTEOUTROS, "); - sb.append(" IMPORTESEGURO, IMPORTETPP, ORGAOCONCEDENTE_ID, RUTA_ID, ORIGEN_ID, DESTINO_ID ) "); + sb.append(" IMPORTESEGURO, IMPORTETPP, ORGAOCONCEDENTE_ID, RUTA_ID, ORIGEN_ID, DESTINO_ID, COMPOSICAO_DO_PEAJE ) "); sb.append(" select "); sb.append(" TARIFA_SEQ.nextval, "); sb.append(" tao.PRECIO , "); @@ -862,7 +874,8 @@ public class SQLBuilderOracle implements SQLBuilder { sb.append(" tao.ORGAOCONCEDENTE_ID , "); sb.append(" tao.RUTA_ID , "); sb.append(" tao.ORIGEN_ID , "); - sb.append(" tao.DESTINO_ID "); + sb.append(" tao.DESTINO_ID, "); + sb.append(" tao.COMPOSICAO_DO_PEAJE "); sb.append(" from "); sb.append(" TARIFA_OFICIAL tao, "); sb.append(" VIGENCIA_TARIFA v, "); diff --git a/src/com/rjconsultores/ventaboletos/entidad/Categoria.java b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java index 584566217..2d27484e2 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Categoria.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java @@ -102,6 +102,9 @@ public class Categoria implements Serializable { @Column(name = "INDVENDEAPI") private Boolean indvendeapi; + @Column(name = "INDEXIGEIDENTIDADE") + private Boolean indExigeIdentidade; + public Categoria() { } @@ -292,4 +295,14 @@ public class Categoria implements Serializable { public void setIndvendeapi(Boolean indvendeapi) { this.indvendeapi = indvendeapi; } + + public Boolean getIndExigeIdentidade() { + return indExigeIdentidade; + + } + + public void setIndExigeIdentidade(Boolean indExigeIdentidade) { + this.indExigeIdentidade = indExigeIdentidade; + + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/HistoricoFormaPagoPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/HistoricoFormaPagoPuntoVenta.java new file mode 100644 index 000000000..167a6fe74 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/HistoricoFormaPagoPuntoVenta.java @@ -0,0 +1,183 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "HistoricoFormaPagoPuntoVenta", tela = "Alteracao Forma Pago Ponto de Venda/Historico") +@Entity +@SequenceGenerator(name = "HIST_FORMAPAGOPUNTOVENTA_SEQ", sequenceName = "HIST_FORMAPAGOPUNTOVENTA_SEQ", allocationSize = 1) +@Table(name = "HIST_FORMAPAGO_PUNTOVENTA") +public class HistoricoFormaPagoPuntoVenta implements Serializable, Auditavel { + + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "HIST_FORMAPAGOPUNTOVENTA_SEQ") + @Column(name = "HIST_FORMAPAGO_PUNTOVENTA_ID") + private Integer historicoFormaPagoPuntoVentaId; + + @Column(name = "IND_INCLUSAO") + private Boolean indInclusao; + + @Column(name = "MOTIVO") + private String motivo; + + @Column(name = "FEC_ALTERACAO") + @Temporal(TemporalType.TIMESTAMP) + private Date fecAlteracao; + + @NaoAuditar + @ManyToOne + @JoinColumn(name = "PUNTOVENTA_ID") + private PuntoVenta puntoVenta; + + @Column(name = "FORMAPAGO_ID") + private Integer formaPagoId; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Column(name = "EMPRESA_ID") + private Integer empresaId; + + @Transient + @NaoAuditar + private HistoricoFormaPagoPuntoVenta historicoPuntoVentaClone; + + + public Integer getHistoricoFormaPagoPuntoVentaId() { + return historicoFormaPagoPuntoVentaId; + } + + public void setHistoricoFormaPagoPuntoVentaId(Integer historicoFormaPagoPuntoVentaId) { + this.historicoFormaPagoPuntoVentaId = historicoFormaPagoPuntoVentaId; + } + + public Boolean getIndInclusao() { + return indInclusao; + } + + public void setIndInclusao(Boolean indInclusao) { + this.indInclusao = indInclusao; + } + + public Date getFecAlteracao() { + return fecAlteracao; + } + + public void setFecAlteracao(Date fecAlteracao) { + this.fecAlteracao = fecAlteracao; + } + + public HistoricoFormaPagoPuntoVenta getHistoricoPuntoVentaClone() { + return historicoPuntoVentaClone; + } + + public void setHistoricoPuntoVentaClone(HistoricoFormaPagoPuntoVenta historicoPuntoVentaClone) { + this.historicoPuntoVentaClone = historicoPuntoVentaClone; + } + + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } + + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + public Integer getEmpresaId() { + return empresaId; + } + + public void setEmpresaId(Integer empresaId) { + this.empresaId = empresaId; + } + + public String getMotivo() { + return motivo; + } + + public void setMotivo(String motivo) { + this.motivo = motivo; + } + + public Integer getFormaPagoId() { + return formaPagoId; + } + + public void setFormaPagoId(Integer formaPagoId) { + this.formaPagoId = formaPagoId; + } + + @Override + public void clonar() throws CloneNotSupportedException { + historicoPuntoVentaClone = new HistoricoFormaPagoPuntoVenta(); + historicoPuntoVentaClone = (HistoricoFormaPagoPuntoVenta) this.clone(); + Hibernate.initialize(historicoPuntoVentaClone.getPuntoVenta()); + + } + + @Override + public HistoricoFormaPagoPuntoVenta getCloneObject() throws CloneNotSupportedException { + return historicoPuntoVentaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getHistoricoFormaPagoPuntoVentaId()); + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java index c1a85bd6a..d77961506 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java @@ -52,7 +52,7 @@ import br.com.rjconsultores.auditador.interfaces.Auditavel; */ @Entity @SequenceGenerator(name = "PUNTO_VENTA_SEQ", sequenceName = "PUNTO_VENTA_SEQ", allocationSize = 1) -@AuditarClasse(nome = "PuntoVenta", tela = "Alteração de Ponto de Venda") +@AuditarClasse(nome = "PuntoVenta", tela = "Altera��o de Ponto de Venda") @Table(name = "PUNTO_VENTA") public class PuntoVenta implements Serializable, Auditavel { @@ -259,6 +259,11 @@ public class PuntoVenta implements Serializable, Auditavel { @LazyCollection(LazyCollectionOption.FALSE) private List historicoPuntoVentaList; + @NaoAuditar + @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoVenta") + @LazyCollection(LazyCollectionOption.FALSE) + private List historicoFormaPagoPuntoVentaList; + @AuditarLista(auditarEntidades = true, nome = "CategoriaBloqueioImpPosterior") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventa") @LazyCollection(LazyCollectionOption.FALSE) @@ -326,6 +331,12 @@ public class PuntoVenta implements Serializable, Auditavel { @Column(name = "INDBLOQCANCBILHETEIMPRESSO ") private Boolean indBloqueiaCancelamentoBilheteImpresso; + @Column(name = "LATITUDE ") + private Double latitude; + + @Column(name = "LONGITUDE ") + private Double longitude; + public List getCobrancaAdicionalList() { return cobrancaAdicionalList; } @@ -424,6 +435,7 @@ public class PuntoVenta implements Serializable, Auditavel { this.ptovtaCatIndList = new ArrayList(); this.ptovtaEmpresaBloqueadaList = new ArrayList(); this.historicoPuntoVentaList = new ArrayList(); + this.historicoFormaPagoPuntoVentaList = new ArrayList(); } public PuntoVenta(Integer puntoventaId) { @@ -1093,6 +1105,14 @@ public class PuntoVenta implements Serializable, Auditavel { this.historicoPuntoVentaList = historicoPuntoVentaList; } + public List getHistoricoFormaPagoPuntoVentaList() { + return historicoFormaPagoPuntoVentaList; + } + + public void setHistoricoFormaPagoPuntoVentaList(List historicoFormaPagoPuntoVentaList) { + this.historicoFormaPagoPuntoVentaList = historicoFormaPagoPuntoVentaList; + } + public List getCategoriaBloqImpPosteriorList() { return categoriaBloqImpPosteriorList; } @@ -1280,6 +1300,22 @@ public class PuntoVenta implements Serializable, Auditavel { this.ptovtaExcecaoMultaCancList = ptovtaExcecaoMultaCanc; } + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + @Override public void clonar() throws CloneNotSupportedException { diff --git a/src/com/rjconsultores/ventaboletos/entidad/Tarifa.java b/src/com/rjconsultores/ventaboletos/entidad/Tarifa.java index 16be316b4..8e7729292 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Tarifa.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Tarifa.java @@ -162,6 +162,11 @@ public class Tarifa implements Serializable, Auditavel, AuditavelTelaAlt @Transient private String telaAlternativa; + + @Column(name = "COMPOSICAO_DO_PEAJE") + @NaoAuditar + private String composicaoDoPeaje; + public Tarifa() { } @@ -407,6 +412,16 @@ public class Tarifa implements Serializable, Auditavel, AuditavelTelaAlt public void setImporteseguro(BigDecimal importeseguro) { this.importeseguro = importeseguro; } + + + + public String getComposicaoDoPeaje() { + return composicaoDoPeaje; + } + + public void setComposicaoDoPeaje(String composicaoDoPeaje) { + this.composicaoDoPeaje = composicaoDoPeaje; + } @Override public void clonar() throws CloneNotSupportedException { diff --git a/src/com/rjconsultores/ventaboletos/entidad/TarifaOficial.java b/src/com/rjconsultores/ventaboletos/entidad/TarifaOficial.java index 06dc2a4b4..2d1c8b244 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/TarifaOficial.java +++ b/src/com/rjconsultores/ventaboletos/entidad/TarifaOficial.java @@ -138,6 +138,10 @@ public class TarifaOficial implements Serializable, Auditavel { @Transient private Integer empresaId; + + @Column(name = "COMPOSICAO_DO_PEAJE") + @NaoAuditar + private String composicaoDoPeaje; public TarifaOficial() { } @@ -285,6 +289,16 @@ public class TarifaOficial implements Serializable, Auditavel { public void setDestino(Parada destino) { this.destino = destino; } + + + + public String getComposicaoDoPeaje() { + return composicaoDoPeaje; + } + + public void setComposicaoDoPeaje(String composicaoDoPeaje) { + this.composicaoDoPeaje = composicaoDoPeaje; + } @Override public int hashCode() { diff --git a/src/com/rjconsultores/ventaboletos/enums/StatusIntegracaoSap.java b/src/com/rjconsultores/ventaboletos/enums/StatusIntegracaoSap.java index d72837cdf..e45dbc58d 100644 --- a/src/com/rjconsultores/ventaboletos/enums/StatusIntegracaoSap.java +++ b/src/com/rjconsultores/ventaboletos/enums/StatusIntegracaoSap.java @@ -1,7 +1,35 @@ package com.rjconsultores.ventaboletos.enums; +import java.util.Arrays; +import java.util.List; + public enum StatusIntegracaoSap { - INTEGRADO, - NAO_INTEGRADO, - PENDENTE; + INTEGRADO("Integrado"), + NAO_ENVIADO("Nao Enviado"), + PENDENTE("Pendente"), + RECUSADO("Recusado SAP"); + + private String descricao; + + private StatusIntegracaoSap(String descricao) { + this.descricao = descricao; + } + + @Override + public String toString() { + return descricao; + } + + public static List list() { + return Arrays.asList(values()); + } + + public static StatusIntegracaoSap getStatusIntegracaoSap(Integer tValor) { + for (StatusIntegracaoSap valor : StatusIntegracaoSap.values()) { + if (tValor.equals(valor.ordinal())) { + return valor; + } + } + return null; + } } diff --git a/src/com/rjconsultores/ventaboletos/service/HistoricoFormaPagoPuntoVentaService.java b/src/com/rjconsultores/ventaboletos/service/HistoricoFormaPagoPuntoVentaService.java new file mode 100644 index 000000000..81d8bbabc --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/HistoricoFormaPagoPuntoVentaService.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.HistoricoFormaPagoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +/** + * + * @author Wallace + */ +public interface HistoricoFormaPagoPuntoVentaService extends GenericService { + + List obtenerTodosPorPuntoVenta(PuntoVenta puntoVenta); + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PeajeService.java b/src/com/rjconsultores/ventaboletos/service/PeajeService.java new file mode 100644 index 000000000..e2e398a0b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/PeajeService.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.Peaje; + +public interface PeajeService { + + public Peaje buscarPeajePorId(Integer peajeId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/RutaService.java b/src/com/rjconsultores/ventaboletos/service/RutaService.java index 4e46c59b9..ccb4286e2 100644 --- a/src/com/rjconsultores/ventaboletos/service/RutaService.java +++ b/src/com/rjconsultores/ventaboletos/service/RutaService.java @@ -124,4 +124,6 @@ public interface RutaService { public List buscarRutasPorEmpresaOrgaoConcedenteParadaIds(Empresa empresa, OrgaoConcedente orgao, Integer[] lsParadaIds) ; + public List buscarPorOrgaoEcasetaPeaje(OrgaoConcedente orgao, Integer[] listCasetaPeaje, Empresa empresa); + } diff --git a/src/com/rjconsultores/ventaboletos/service/SapService.java b/src/com/rjconsultores/ventaboletos/service/SapService.java index 6b73cf0e9..f3c940887 100644 --- a/src/com/rjconsultores/ventaboletos/service/SapService.java +++ b/src/com/rjconsultores/ventaboletos/service/SapService.java @@ -9,12 +9,12 @@ import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO; public interface SapService extends GenericService { - - public int remessa(List fechamentos) throws Exception ; - - public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar); - public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar, PuntoVenta puntoVenta); + public int remessa(List fechamentos, boolean processoManual) throws Exception ; + + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, String status); + + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, String status, PuntoVenta puntoVenta); public void integracaoSapAutomatica() throws Exception; diff --git a/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java b/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java index a07de71c3..749159676 100644 --- a/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java +++ b/src/com/rjconsultores/ventaboletos/service/TarifaOficialService.java @@ -4,6 +4,7 @@ import java.util.List; import com.rjconsultores.ventaboletos.constantes.TipoSeguro; import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO; +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; import com.rjconsultores.ventaboletos.entidad.ClaseServicio; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Marca; @@ -35,7 +36,7 @@ public interface TarifaOficialService { * @param orgaoConcedenteId * @return A quantidade de registros afetadas */ - public Integer gerarTarifaPorCoeficiente(Integer rutaId, OrgaoConcedente orgaoConcedente, List idsEmpresas); + public Integer gerarTarifaPorCoeficiente(Integer rutaId, OrgaoConcedente orgaoConcedente, List idsEmpresas,Integer[] lsCasetaPeaje); /** @@ -66,7 +67,7 @@ public interface TarifaOficialService { * @param empresaId * @throws BusinessException */ - public void gerarAtualizarTarifa(List lsRuta, OrgaoConcedente orgaoConcedenteId, List lsEmpresaSelected) throws BusinessException; + public void gerarAtualizarTarifa(List lsRuta, OrgaoConcedente orgaoConcedenteId, List lsEmpresaSelected, Integer[] lsCasetaPeaje) throws BusinessException; /** * Copia a tarifa oficial para a tabela de tarifa de acordo com a vigencia especificada.
@@ -148,5 +149,7 @@ public interface TarifaOficialService { public List obterTarifaOficialPorFiltro(Moneda moneda, Marca marca,List lsMarcas,Parada origem, Parada destino, ClaseServicio claseServicio, Ruta ruta, String numRuta, Boolean vende); + public void atualizarPedagioPorListaDePracaDePagio(List lsCasetaPeaje,Integer empresaId); + } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java index bdd484945..7297983ce 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java @@ -617,14 +617,14 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic if (boletoComissao.isMotivocancelacionQuitacaoOcd()) { formapago.subtract(formapagoBoleto.getImporte()); // somando as vendas - } else if (boletoComissao.isAbaBilheteVendido() || boletoComissao.isAbaGapVendido() || boletoComissao.isAbaBilheteManual()) { + } else if (boletoComissao.isAbaBilheteVendido() || boletoComissao.isAbaGapVendido() || boletoComissao.isAbaBilheteManual() || (boletoComissao.isVendaBilheteTransferencia(boletoComissao.getTipoVenta()) && formapago.getFormapagoId() == 1)) { formapago.add(formapagoBoleto.getImporte()); // subtraindo os cancelamentos } else if (boletoComissao.isAbaBilheteCancelado() || boletoComissao.isAbaGapCancelado()) { formapago.subtract(formapagoBoleto.getImporte()); // subtraindo as trocas e devolucoes - } else if (boletoComissao.isAbaBilheteDevolvido() || boletoComissao.isAbaGapDevolvido()) { - if (boletoComissao.isMotivocancelacionTrocado() || boletoComissao.isMotivocancelacionDevolvido() || boletoComissao.isMotivocancelacionQuitacaoOcd()) { + } else if (boletoComissao.isAbaBilheteDevolvido() || boletoComissao.isAbaGapDevolvido() || boletoComissao.isMotivocancelacionTransferido()) { + if (boletoComissao.isMotivocancelacionTrocado() || boletoComissao.isMotivocancelacionDevolvido() || boletoComissao.isMotivocancelacionQuitacaoOcd() || (boletoComissao.isVendaBilheteTransferencia(boletoComissao.getTipoVenta()) && formapago.getFormapagoId() == 1)) { formapago.subtract(formapagoBoleto.getImporte()); } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ContingenciaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ContingenciaServiceImpl.java index 9f032d20a..2985117b7 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ContingenciaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ContingenciaServiceImpl.java @@ -67,15 +67,15 @@ public class ContingenciaServiceImpl implements ContingenciaService { historicoCont.setDataHora(Calendar.getInstance().getTime()); if (historicoCont.getEmpresa() == null) { - throw new BusinessException("Não é possível salvar sem a empresa"); + throw new BusinessException("N�o � poss�vel salvar sem a empresa"); } if (historicoCont.getEstado() == null) { - throw new BusinessException("Não é possível salvar sem o estado referente"); + throw new BusinessException("N�o � poss�vel salvar sem o estado referente"); } if (historicoCont.getMotivo() == null) { - throw new BusinessException("Não é possível salvar sem o motivo referente"); + throw new BusinessException("N�o � poss�vel salvar sem o motivo referente"); } try { @@ -102,10 +102,10 @@ public class ContingenciaServiceImpl implements ContingenciaService { } private void setMotivoNaoTrocaStatus(LogHistoricoContingencia historicoCont, Exception e) { - log.error(String.format("Erro no envio de e-mail de contingência da empresa %s para o estado %s.", historicoCont.getEmpresa().getEmpresaId(),historicoCont.getEstado()), e); + log.error(String.format("Erro no envio de e-mail de conting�ncia da empresa %s para o estado %s.", historicoCont.getEmpresa().getEmpresaId(),historicoCont.getEstado()), e); String motivo = historicoCont.getMotivo(); - motivo = motivo.concat("**Problema no envio de E-mail de notificação. Favor checar."); + motivo = motivo.concat("**Problema no envio de E-mail de notifica��o. Favor checar."); historicoCont.setMotivo(motivo); } @@ -164,35 +164,44 @@ public class ContingenciaServiceImpl implements ContingenciaService { return EStatusContingencia.getStatusContingencia(Integer.valueOf(historicoCont.getStatus())); } - private void enviaEmail(LogHistoricoContingencia historicoCont) throws SendFailedException, AuthenticationFailedException { - SendMail mail = new SendMail(); + private void enviaEmail(LogHistoricoContingencia historicoCont) throws SendFailedException, AuthenticationFailedException { + EmpresaEmail empresaEmail = empresaEmailService.buscarPorEmpresa(historicoCont.getEmpresa()); EmpresaEmailConfig empresaEmailConfig = empresaEmailConfigService.buscarPorEmpresa(historicoCont.getEmpresa()); - mail.setAuth(empresaEmailConfig.getIndAutenticacao()); - if (StringUtils.isNotEmpty(empresaEmailConfig.getTipoAutorizacao())) { - mail.setAuthType(AuthType.valueOf(empresaEmailConfig.getTipoAutorizacao())); + + if (empresaEmail != null && empresaEmailConfig != null && + empresaEmailConfig.getIndAutenticacao() != null && empresaEmail.getEmailDe() != null && + empresaEmailConfig.getTipoAutorizacao() != null && empresaEmailConfig.getSmtp() != null && + empresaEmailConfig.getSenha() != null && empresaEmailConfig.getSmtpPorta() != null && + empresaEmailConfig.getSmtpEmail() != null && empresaEmail.getDestinatario() != null) { + + SendMail mail = new SendMail(); + mail.setAuth(empresaEmailConfig.getIndAutenticacao()); + if (StringUtils.isNotEmpty(empresaEmailConfig.getTipoAutorizacao())) { + mail.setAuthType(AuthType.valueOf(empresaEmailConfig.getTipoAutorizacao())); + } + mail.setEmailFrom(empresaEmail.getEmailDe()); + mail.setSmtpHost(empresaEmailConfig.getSmtp()); + mail.setSmtpPassword(empresaEmailConfig.getSenha()); + mail.setSmtpPort(empresaEmailConfig.getSmtpPorta()); + mail.setSmtpUser(empresaEmailConfig.getSmtpEmail()); + mail.setSubject("Conting�ncia Off-line BP-e"); + mail.setText(getMensagem(historicoCont)); + mail.setEmailTo(empresaEmail.getDestinatario()); + mail.setEmailToCO(EMAIL_COPIA_OCULTA); + mail.send(); } - mail.setEmailFrom(empresaEmail.getEmailDe()); - mail.setSmtpHost(empresaEmailConfig.getSmtp()); - mail.setSmtpPassword(empresaEmailConfig.getSenha()); - mail.setSmtpPort(empresaEmailConfig.getSmtpPorta()); - mail.setSmtpUser(empresaEmailConfig.getSmtpEmail()); - mail.setSubject("Contingência Off-line BP-e"); - mail.setText(getMensagem(historicoCont)); - mail.setEmailTo(empresaEmail.getDestinatario()); - mail.setEmailToCO(EMAIL_COPIA_OCULTA); - mail.send(); } private String getMensagem(LogHistoricoContingencia historicoContingencia) { StringBuilder mensagem = new StringBuilder(); - mensagem.append(String.format("A empresa %s está com a emissão do BP-e em contingência off-line para a UF %s no ambiente de %s. ", + mensagem.append(String.format("A empresa %s est� com a emiss�o do BP-e em conting�ncia off-line para a UF %s no ambiente de %s. ", historicoContingencia.getEmpresa().getNombempresa(), historicoContingencia.getEstado().getCveestado(), EAmbienteContingencia.getAmbienteContingencia(historicoContingencia.getAmbiente()).getDescricao())); - mensagem.append("A emissão em contingência deve ser tratada como exceção, sendo que a regra deve ser a emissão com autorização em tempo real."); - mensagem.append("O Fisco poderá solicitar esclarecimentos, e até mesmo restringir ao contribuinte a utilização da modalidade de contingência off-line, caso seja identificado que o emissor do BP-e utiliza a contingência em demasia e sem justificativa aceitável, quando comparado a outros contribuintes em situação similar."); - mensagem.append("Na utilização de contingência off-line, o contribuinte assume o risco de perda da informação dos "); - mensagem.append("BP-e emitidos em contingência, até que os mesmos constem da base de dados do Fisco."); + mensagem.append("A emiss�o em conting�ncia deve ser tratada como exce��o, sendo que a regra deve ser a emiss�o com autoriza��o em tempo real."); + mensagem.append("O Fisco poder� solicitar esclarecimentos, e at� mesmo restringir ao contribuinte a utiliza��o da modalidade de conting�ncia off-line, caso seja identificado que o emissor do BP-e utiliza a conting�ncia em demasia e sem justificativa aceit�vel, quando comparado a outros contribuintes em situa��o similar."); + mensagem.append("Na utiliza��o de conting�ncia off-line, o contribuinte assume o risco de perda da informa��o dos "); + mensagem.append("BP-e emitidos em conting�ncia, at� que os mesmos constem da base de dados do Fisco."); return mensagem.toString(); } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java index 3e49f434d..f551b210c 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java @@ -1443,17 +1443,28 @@ public class CorridaServiceImpl implements CorridaService { try { while (DateUtil.compareOnlyDate(dataAte, dataInicial) >= 0) { - boolean corridaGerada = this.generarCorrida(dataAte, Arrays.asList(esquemaCorrida), false); - if (corridaGerada) { - calendarData.setTime(dataAte); - calendarData.add(Calendar.DATE, -1); - dataAte = calendarData.getTime(); - - } else { - log.info("Corrida do dia: " + sdfData.format(dataAte) + " já gerada"); + boolean corridaExiste = corridaDAO.existe(new Corrida.Id(esquemaCorrida.getNumCorrida(), dataAte)); + String strDataGeracao = DateUtil.getStringDate(dataAte); + + log.info(String.format("Corrida existe = %s [%s - %s]",corridaExiste,esquemaCorrida.getNumCorrida() ,strDataGeracao)); + + //A corrida já existir é a única condição para parar de gerar. + //Se a corrida não for gerada (rotina mais abaixo), podem haver várias condições: o dia da semana, feriado, etc + if (corridaExiste){ + log.info(String.format("Corrida % do dia % já gerada",esquemaCorrida.getNumCorrida(), strDataGeracao)); + break; } - + + + boolean corridaGerada = this.generarCorrida(dataAte, Arrays.asList(esquemaCorrida), false); + + log.info(String.format("Corrida gerada = %s [%s - %s]",corridaGerada,esquemaCorrida.getNumCorrida() ,strDataGeracao)); + + + calendarData.setTime(dataAte); + calendarData.add(Calendar.DATE, -1); + dataAte = calendarData.getTime(); } log.info("commit bloco corridas"); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/HistoricoFormaPagoPuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/HistoricoFormaPagoPuntoVentaServiceImpl.java new file mode 100644 index 000000000..27ea05e1b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/HistoricoFormaPagoPuntoVentaServiceImpl.java @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.HistoricoFormaPagoPuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.HistoricoFormaPagoPuntoVenta; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.HistoricoFormaPagoPuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +/** + * + * @author Wallace + */ +@Service("historicoFormaPagoPuntoVentaService") +public class HistoricoFormaPagoPuntoVentaServiceImpl implements HistoricoFormaPagoPuntoVentaService { + + @Autowired + private HistoricoFormaPagoPuntoVentaDAO historicoFormaPagoPuntoVentaDAO; + + public List obtenerTodos() { + return historicoFormaPagoPuntoVentaDAO.obtenerTodos(); + } + + public HistoricoFormaPagoPuntoVenta obtenerID(Integer id) { + return historicoFormaPagoPuntoVentaDAO.obtenerID(id); + } + + @Transactional + public HistoricoFormaPagoPuntoVenta suscribir(HistoricoFormaPagoPuntoVenta entidad) { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + entidad.setIndInclusao(Boolean.TRUE); + entidad.setFecAlteracao(Calendar.getInstance().getTime()); + + return historicoFormaPagoPuntoVentaDAO.suscribir(entidad); + } + + @Transactional + public HistoricoFormaPagoPuntoVenta actualizacion(HistoricoFormaPagoPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return historicoFormaPagoPuntoVentaDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(HistoricoFormaPagoPuntoVenta entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + entidad.setIndInclusao(Boolean.FALSE); + entidad.setFecAlteracao(Calendar.getInstance().getTime()); + + historicoFormaPagoPuntoVentaDAO.actualizacion(entidad); + } + + @Override + public List obtenerTodosPorPuntoVenta(PuntoVenta puntoVenta) { + return historicoFormaPagoPuntoVentaDAO.obtenerTodosPorPuntoVenta(puntoVenta); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PeajeServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PeajeServiceImpl.java new file mode 100644 index 000000000..0c75725a5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/PeajeServiceImpl.java @@ -0,0 +1,20 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.PeajeDao; +import com.rjconsultores.ventaboletos.entidad.Peaje; +import com.rjconsultores.ventaboletos.service.PeajeService; + +@Service("peajeService") +public class PeajeServiceImpl implements PeajeService{ + + @Autowired + private PeajeDao peajeDao; + + + public Peaje buscarPeajePorId(Integer peajeId) { + return peajeDao.obtenerID(peajeId); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java index 798b8b03a..da64f2713 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -86,7 +86,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { @Autowired private LogAuditoriaService logAuditoriaService; - // FIXME : Remover esse método de quem está usando. Esse método carrega muitos dados + // FIXME : Remover esse m�todo de quem est� usando. Esse m�todo carrega muitos dados @Deprecated public List obtenerTodos() { return puntoVentaDAO.obtenerTodos(); @@ -114,13 +114,13 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { Constante constDesativaTotvs = constanteService.buscarPorNomeConstante("WS_TOTVS_DESATIVA_INTEGRACAO"); Boolean desativaTotvs = constDesativaTotvs != null && constDesativaTotvs.getValorconstante().equals("1"); - // Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso. - // Integração AG + // Mantis 15739 - A integra��o AG deve ser acionada ap�s a persist�ncia dos dados com sucesso. + // Integra��o AG /* - * Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if (entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { log.debug("iniciando integração com AG"); integraAG(entidad); log.debug("fim da integração com AG"); } + * Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if (entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { log.debug("iniciando integra��o com AG"); integraAG(entidad); log.debug("fim da integra��o com AG"); } */ - // Integração Totvs + // Integra��o Totvs if (!desativaTotvs){ if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) { try { @@ -176,13 +176,13 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { logAuditoriaService.auditar(null, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); - // Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso. - // Integração AG + // Mantis 15739 - A integra��o AG deve ser acionada ap�s a persist�ncia dos dados com sucesso. + // Integra��o AG Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if (entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { - log.debug("iniciando integração com AG"); + log.debug("iniciando integra��o com AG"); integraAG(entidad); - log.debug("fim da integração com AG"); + log.debug("fim da integra��o com AG"); } return entidad; @@ -214,7 +214,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { connection.close(); } } catch (SQLException e) { - log.error("error fechar conexão", e); + log.error("error fechar conex�o", e); throw new RuntimeException(e); } } @@ -236,9 +236,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { return; } if (!strFornecedor.contains("ERRO")){ - // retornar msg a informação de registro já cadastrado + // retornar msg a informa��o de registro j� cadastrado entidad.setIndIntegradoAG(false); - entidad.setMotivoNaoIntegradoAG("Fornecedor já cadastrado"); + entidad.setMotivoNaoIntegradoAG("Fornecedor j� cadastrado"); } else { fornecedor = new TFornecedor(); fornecedor.setNome(entidad.getRazonSocial()); @@ -307,9 +307,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { return; } if (!cliStr.contains("ERRO")) { - // retornar msg a informação de registro já cadastrado + // retornar msg a informa��o de registro j� cadastrado entidad.setIndIntegradoAG(false); - entidad.setMotivoNaoIntegradoAG("Cliente já cadastrado"); + entidad.setMotivoNaoIntegradoAG("Cliente j� cadastrado"); } else { cli = new TCliente(); cli.setCodigo(""); @@ -435,7 +435,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { PuntoVenta originalClone = null; try { originalClone = entidad.getCloneObject(); - if(entidad.getTitularId()!=null) { + if(entidad.getTitularId()!=null && originalClone != null) { originalClone.setTitularId(entidad.getTitularId().getCloneObject()); } } catch (Exception e) { @@ -449,13 +449,13 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { Constante constDesativaTotvs = constanteService.buscarPorNomeConstante("WS_TOTVS_DESATIVA_INTEGRACAO"); Boolean desativaTotvs = constDesativaTotvs != null && constDesativaTotvs.getValorconstante().equals("1"); - // Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso. - // Integração AG + // Mantis 15739 - A integra��o AG deve ser acionada ap�s a persist�ncia dos dados com sucesso. + // Integra��o AG /* - * Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if ( entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { log.debug("iniciando integração com AG"); integraAG(entidad); log.debug("fim da integração com AG"); } + * Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if ( entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { log.debug("iniciando integra��o com AG"); integraAG(entidad); log.debug("fim da integra��o com AG"); } */ - // Integração Totvs + // Integra��o Totvs if (!desativaTotvs){ if (ApplicationProperties.getInstance().isCustomHabilitado(CustomEnum.INTEGRACION_TOTVS.getDescricao())) { @@ -510,13 +510,13 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { } } - // Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso. - // Integração AG + // Mantis 15739 - A integra��o AG deve ser acionada ap�s a persist�ncia dos dados com sucesso. + // Integra��o AG Constante empresasIntegraAG = constanteService.buscarPorNomeConstante("EMPRESAS_INTEGRACAO_AG"); if (entidad.getStatusaprobacion().equals("A") && empresasIntegraAG != null && empresasIntegraAG.getValorconstante() != null && empresasIntegraAG.getValorconstante().contains(entidad.getEmpresa().getEmpresaId().toString())) { - log.debug("iniciando integração com AG"); + log.debug("iniciando integra��o com AG"); integraAG(entidad); - log.debug("fim da integração com AG"); + log.debug("fim da integra��o com AG"); } return entidad; @@ -765,7 +765,7 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { String contrib = ContribuinteICMS.NAO.getValor(); String entid = TipoEntidade.TRANSPORTE_PASSAGEIRO.getValor(); - String pais = "";// segundo orientação da TOTVS, passar em branco + String pais = "";// segundo orienta��o da TOTVS, passar em branco try { resp = TotvsService.cadastrarCliente(endpointCliente, bairro, cep, cgc, codmun, codpais, complemen, contaCliente, contrib, ddd, email, cnpjEmpresaProtheus, diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java index bbbf59375..8317b6cde 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java @@ -675,12 +675,17 @@ public class RutaServiceImpl implements RutaService { @Override public List buscarPorOrgaoEcasetaPeaje(OrgaoConcedente orgao, Integer[] listCasetaPeaje){ - return rutaDAO.buscarPorOrgaoEcasetaPeaje(orgao,listCasetaPeaje); + return buscarPorOrgaoEcasetaPeaje(orgao,listCasetaPeaje,null); } @Override public List buscarRutasPorEmpresaOrgaoConcedenteParadaIds(Empresa empresa, OrgaoConcedente orgao, Integer[] lsParadaIds) { return rutaDAO.buscarRutasPorEmpresaOrgaoConcedenteParadaIds(empresa,orgao,lsParadaIds); } + + @Override + public List buscarPorOrgaoEcasetaPeaje(OrgaoConcedente orgao, Integer[] listCasetaPeaje, Empresa empresa){ + return rutaDAO.buscarPorOrgaoEcasetaPeaje(orgao,listCasetaPeaje,empresa); + } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java index a72eab0db..f743ca86f 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java @@ -15,6 +15,7 @@ import com.rjconsultores.ventaboletos.entidad.Constante; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.enums.StatusIntegracaoSap; import com.rjconsultores.ventaboletos.rest.IntegracaoSapRest; import com.rjconsultores.ventaboletos.service.SapService; import com.rjconsultores.ventaboletos.utilerias.DateUtil; @@ -25,8 +26,6 @@ public class SapServiceImpl implements SapService{ private static final String INTEGRACAO_SAP_URL = "INTEGRACAO_SAP_URL"; private static final String INTEGRACAO_SAP_CREDENCIAL = "INTEGRACAO_SAP_CREDENCIAL"; - private static final int INTEGRACAO_SAP_OK = 1; - private static final int INTEGRACAO_SAP_ERRO = 2; private static Logger log = Logger.getLogger(SapServiceImpl.class); @Autowired @@ -65,17 +64,17 @@ public class SapServiceImpl implements SapService{ } @Override - public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) { - return sapDAO.obtenerTodosParaRemessa(empresa, dataDe, dataAte, reenviar, null); + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, String status) { + return sapDAO.obtenerTodosParaRemessa(empresa, dataDe, dataAte, status, null); } @Override - public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar, PuntoVenta puntoVenta) { - return sapDAO.obtenerTodosParaRemessa(empresa, dataDe, dataAte, reenviar, puntoVenta); + public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, String status, PuntoVenta puntoVenta) { + return sapDAO.obtenerTodosParaRemessa(empresa, dataDe, dataAte, status, puntoVenta); } - + @Override - public int remessa(List fechamentos) throws Exception { + public int remessa(List fechamentos, boolean processoManual) throws Exception { try { int contador = 0; IntegracaoSapRest integracaoSapRest = IntegracaoSapRest.getInstance(); @@ -87,16 +86,20 @@ public class SapServiceImpl implements SapService{ JSONObject integrado = integracaoSapRest.enviarIntegracaoSap(fechamentoCntcorrente, url, credenciais); if(integrado == null) { - atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), INTEGRACAO_SAP_ERRO); - log.error("Erro no envio/retorno da requisicao para integra��o SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId()); - throw new RuntimeException("Erro no envio/retorno da requisicao para integração SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId()); + atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), StatusIntegracaoSap.NAO_ENVIADO.ordinal()); + log.error("Erro no envio/retorno da requisicao para integracao SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId()); + if(processoManual) { + throw new RuntimeException("Erro no envio/retorno da requisicao para integracao SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId()); + } }else if(integrado.getString("Integration").equals("S")) { - atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), INTEGRACAO_SAP_OK); + atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), StatusIntegracaoSap.INTEGRADO.ordinal()); contador++; }else if(integrado.getString("Integration").equals("E")) { - atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), INTEGRACAO_SAP_ERRO); + atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), StatusIntegracaoSap.RECUSADO.ordinal()); log.warn("Retorno enviado pelo SAP: \r\n"+integrado.getString("Message")); - throw new RuntimeException("Fechamento: "+fechamentoCntcorrente.getFechamentocntcorrenteId()+"\r\nRetorno enviado pelo SAP: \r\n"+integrado.getString("Message")); + if(processoManual) { + throw new RuntimeException("Fechamento: "+fechamentoCntcorrente.getFechamentocntcorrenteId()+"\r\nRetorno enviado pelo SAP: \r\n"+integrado.getString("Message")); + } } } } @@ -125,18 +128,18 @@ public class SapServiceImpl implements SapService{ @Override public void integracaoSapAutomatica() throws Exception { - List listaPendente = obtenerTodosParaRemessa(null, DateUtil.getYesterdayDate(), new Date(), false); + List listaPendente = obtenerTodosParaRemessa(null, DateUtil.getYesterdayDate(), new Date(), "2"); while(!listaPendente.isEmpty()) { log.info("IntegracaoSap: Registro a enviar:"+listaPendente.size()); try { - remessa(listaPendente); + remessa(listaPendente, false); } catch (Exception e) { throw e; } - listaPendente = obtenerTodosParaRemessa(null, DateUtil.getYesterdayDate(), new Date(), false); + listaPendente = obtenerTodosParaRemessa(null, DateUtil.getYesterdayDate(), new Date(), "2"); } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java index e62ed15be..be5891be0 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/TarifaOficialServiceImpl.java @@ -1,7 +1,12 @@ package com.rjconsultores.ventaboletos.service.impl; +import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -14,12 +19,14 @@ import com.rjconsultores.ventaboletos.dao.OrgaoConcedenteDAO; import com.rjconsultores.ventaboletos.dao.SeguroKmDAO; import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO; import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO; +import com.rjconsultores.ventaboletos.entidad.CasetaPeaje; import com.rjconsultores.ventaboletos.entidad.ClaseServicio; import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Marca; import com.rjconsultores.ventaboletos.entidad.Moneda; import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.Peaje; import com.rjconsultores.ventaboletos.entidad.Ruta; import com.rjconsultores.ventaboletos.entidad.TarifaOficial; import com.rjconsultores.ventaboletos.entidad.Tramo; @@ -27,8 +34,10 @@ import com.rjconsultores.ventaboletos.entidad.Via; import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa; import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.service.LogAuditoriaService; +import com.rjconsultores.ventaboletos.service.PeajeService; import com.rjconsultores.ventaboletos.service.TarifaOficialService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import com.rjconsultores.ventaboletos.vo.comissao.TarifaOficialComComposicaoDoPedagioVo; import com.rjconsultores.ventaboletos.vo.comissao.TarifaOficialVO; @Service("tarifaOficialService") @@ -47,11 +56,15 @@ public class TarifaOficialServiceImpl implements TarifaOficialService { @Autowired private LogAuditoriaService logAuditoriaService; + + + @Autowired + private PeajeService peajeService; @Override @Transactional - public Integer gerarTarifaPorCoeficiente(Integer rutaId, OrgaoConcedente orgaoConcedente, List idsEmpresas) { - return tarifaOficialDAO.gerarTarifaPorCoeficiente(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedente, idsEmpresas); + public Integer gerarTarifaPorCoeficiente(Integer rutaId, OrgaoConcedente orgaoConcedente, List idsEmpresas,Integer[] lsCasetaPeaje) { + return tarifaOficialDAO.gerarTarifaPorCoeficiente(rutaId, UsuarioLogado.getUsuarioLogado().getUsuarioId(), orgaoConcedente, idsEmpresas,lsCasetaPeaje ); } @Override @@ -69,7 +82,7 @@ public class TarifaOficialServiceImpl implements TarifaOficialService { @Override @Transactional(rollbackFor = BusinessException.class) - public void gerarAtualizarTarifa(List lsRuta, OrgaoConcedente orgaoConcedente, List lsEmpresaSelected) throws BusinessException { + public void gerarAtualizarTarifa(List lsRuta, OrgaoConcedente orgaoConcedente, List lsEmpresaSelected, Integer[] lsCasetaPeaje) throws BusinessException { // Limpando a tabela de TARIFA_OFICIAL tarifaOficialDAO.limparTarifasOficiais(lsEmpresaSelected); @@ -96,7 +109,7 @@ public class TarifaOficialServiceImpl implements TarifaOficialService { // Gerando as tarifas pelo coeficiente if (orgaoConcedente == null || (orgaoConcedente.getOrgaoConcedenteId() == null || orgaoConcedente.getOrgaoConcedenteId() != OrgaoConcedente.CODIGO_ARTESP)) { - Integer qtdTarifaCoeficiente = gerarTarifaPorCoeficiente(rutaId, orgaoConcedente, idsEmpresas); + Integer qtdTarifaCoeficiente = gerarTarifaPorCoeficiente(rutaId, orgaoConcedente, idsEmpresas,lsCasetaPeaje); log.info("qtdTarifaCoeficiente=" + qtdTarifaCoeficiente); } @@ -340,5 +353,115 @@ public class TarifaOficialServiceImpl implements TarifaOficialService { } return lsTarifa; } + + + public void atualizarPedagioPorListaDePracaDePagio(List lsCasetaPeaje,Integer empresaId) { + try { + List lsTarifaOficialComComposicaoDoPedagioVo = tarifaOficialDAO.oberTarifaOficialComComposicaoDoPedagioVo(empresaId); + + if (!lsTarifaOficialComComposicaoDoPedagioVo.isEmpty()) { + + + for (TarifaOficialComComposicaoDoPedagioVo tarifaOficialComComposicaoDoPedagioVo : lsTarifaOficialComComposicaoDoPedagioVo) { + log.info("tarifaOficiald:" + tarifaOficialComComposicaoDoPedagioVo.getTarifaOficialId() + " | composicao do pedágio no cálculo:" + tarifaOficialComComposicaoDoPedagioVo.getComposicaoDoPedagioNaTarifaOficialComPeaje() + " | composicao do pedágio na tarifa:" + tarifaOficialComComposicaoDoPedagioVo.getComposicaoDoPedagioNaTarifa()); + + if (tarifaOficialComComposicaoDoPedagioVo.getComposicaoDoPedagioNaTarifa() == null) { + HashMap mapComposicaoDoPedagioNaTarifaOficialComPeaje = new HashMap(); + String[] parDeChavePeajeMaisCasetaPeaje1 = tarifaOficialComComposicaoDoPedagioVo.getComposicaoDoPedagioNaTarifaOficialComPeaje().replace(" ", "").split(","); + montaMapComposicao(mapComposicaoDoPedagioNaTarifaOficialComPeaje, parDeChavePeajeMaisCasetaPeaje1); + BigDecimal valorPedagio = montarObterValorImportePedagio(mapComposicaoDoPedagioNaTarifaOficialComPeaje); + String stringComposicaoDoPedagio = tarifaOficialComComposicaoDoPedagioVo.getComposicaoDoPedagioNaTarifaOficialComPeaje(); + + atualizarPedagioComFiltroDePracaDePedagio(tarifaOficialComComposicaoDoPedagioVo, valorPedagio, stringComposicaoDoPedagio); + + } else { + HashMap mapComposicaoDoPedagioNaTarifa = new HashMap(); + String[] parDeChavePeajeMaisCasetaPeaje = tarifaOficialComComposicaoDoPedagioVo.getComposicaoDoPedagioNaTarifa().replace(" ", "").split(","); + montaMapComposicao(mapComposicaoDoPedagioNaTarifa, parDeChavePeajeMaisCasetaPeaje); + + HashMap mapComposicaoDoPedagioNaTarifaOficialComPeaje = new HashMap(); + String[] parDeChavePeajeMaisCasetaPeaje1 = tarifaOficialComComposicaoDoPedagioVo.getComposicaoDoPedagioNaTarifaOficialComPeaje().replace(" ", "").split(","); + montaMapComposicao(mapComposicaoDoPedagioNaTarifaOficialComPeaje, parDeChavePeajeMaisCasetaPeaje1); + + atualizarComposicaoDoPedagioNaTarifa(lsCasetaPeaje, mapComposicaoDoPedagioNaTarifa, mapComposicaoDoPedagioNaTarifaOficialComPeaje); + + BigDecimal valorPedagio = montarObterValorImportePedagio(mapComposicaoDoPedagioNaTarifa); + + String stringComposicaoDoPedagio = ""; + stringComposicaoDoPedagio = remontarAStringDeComposicaoDoPedagio(mapComposicaoDoPedagioNaTarifa, stringComposicaoDoPedagio); + + atualizarPedagioComFiltroDePracaDePedagio(tarifaOficialComComposicaoDoPedagioVo, valorPedagio, stringComposicaoDoPedagio); + + } + + } + } else { + log.info("Não retornou nenhum registro da consulta oberTarifaOficialComComposicaoDoPedagioVo "); + } + }catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + + } + + private void atualizarPedagioComFiltroDePracaDePedagio(TarifaOficialComComposicaoDoPedagioVo tarifaOficialComComposicaoDoPedagioVo, BigDecimal valorPedagio, String stringComposicaoDoPedagio) { + log.info("tarifaOficiald:"+tarifaOficialComComposicaoDoPedagioVo.getTarifaOficialId()+" | composicao do pedágio na tarifa oficial:" + tarifaOficialComComposicaoDoPedagioVo.getComposicaoDoPedagioNaTarifaOficialComPeaje() +" | importePedagio:"+valorPedagio); + + tarifaOficialDAO.atualizarPedagioComFiltroDePracaDePedagio(tarifaOficialComComposicaoDoPedagioVo.getTarifaOficialId(), valorPedagio, stringComposicaoDoPedagio); + } + + private String remontarAStringDeComposicaoDoPedagio(HashMap mapComposicaoDoPedagioNaTarifa, String stringComposicaoDoPedagio) { + Boolean inicio =true; + + for(Entry map : mapComposicaoDoPedagioNaTarifa.entrySet()) { + if(!inicio) { + stringComposicaoDoPedagio += ","; + } + stringComposicaoDoPedagio += map.getKey()+";"+map.getValue(); + inicio=false; + } + return stringComposicaoDoPedagio; + } + + private BigDecimal montarObterValorImportePedagio(HashMap mapComposicaoDoPedagioNaTarifa) { + BigDecimal valorPedagio = new BigDecimal("0.0"); + for(Entry map : mapComposicaoDoPedagioNaTarifa.entrySet()) { + Peaje peaje = peajeService.buscarPeajePorId(map.getValue()); + valorPedagio=valorPedagio.add(peaje.getImportePeaje().setScale(2,RoundingMode.HALF_UP)); + + } + return valorPedagio.setScale(2,RoundingMode.HALF_UP); + + } + + private void atualizarComposicaoDoPedagioNaTarifa(List lsCasetaPeaje, HashMap mapComposicaoDoPedagioNaTarifa, Map mapComposicaoDoPedagioNaTarifaOficialComPeaje) { + for(CasetaPeaje casetaPeaje : lsCasetaPeaje) { + if(mapComposicaoDoPedagioNaTarifa.containsKey(casetaPeaje.getCasetaPeajeId())) { + mapComposicaoDoPedagioNaTarifa.remove(casetaPeaje.getCasetaPeajeId()); + } + + if(mapComposicaoDoPedagioNaTarifaOficialComPeaje.containsKey(casetaPeaje.getCasetaPeajeId())) { + mapComposicaoDoPedagioNaTarifa.put(casetaPeaje.getCasetaPeajeId(),mapComposicaoDoPedagioNaTarifaOficialComPeaje.get(casetaPeaje.getCasetaPeajeId())); + } + + } + } + + private void montaMapComposicao(Map mapComposicaoDoPedagioNaTarifa, String[] parDeChavePeajeMaisCasetaPeaje) { + for(String chavePeajeMaisCasetaPeaje:parDeChavePeajeMaisCasetaPeaje) { + String[] composicao = chavePeajeMaisCasetaPeaje.split(";"); + Integer casetaPeaje = Integer.parseInt(composicao[0].trim()); + Integer peaje = Integer.parseInt(composicao[1].trim()); + mapComposicaoDoPedagioNaTarifa.put(casetaPeaje,peaje); + } + } + + public static void main(String[] args) { + BigDecimal valorPedagio = new BigDecimal("0.0"); + + valorPedagio=valorPedagio.add(new BigDecimal("100.005")); + System.out.println(valorPedagio.setScale(2,RoundingMode.HALF_UP)); + } } diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java b/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java index cb5c27e79..2671dfdd4 100644 --- a/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java @@ -845,12 +845,8 @@ public class BoletoComissao { if(isVendaGap(getTipoVenta()) && !isStatusEntregue()) { return false; } - - if(isVendaBilheteTransferencia(getTipoVenta())) { - return false; - } - - return isStatusVendido() || isStatusTroca() || isStatusEntregue(); + + return isStatusVendido() || isStatusTroca() || isStatusEntregue() || isVendaBilheteTransferencia(getTipoVenta()); } public boolean isQuitacaoOCD() { if(getMotivoCancelacionId() != null){ diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/TarifaOficialComComposicaoDoPedagioVo.java b/src/com/rjconsultores/ventaboletos/vo/comissao/TarifaOficialComComposicaoDoPedagioVo.java new file mode 100644 index 000000000..8545b69f9 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/TarifaOficialComComposicaoDoPedagioVo.java @@ -0,0 +1,29 @@ +package com.rjconsultores.ventaboletos.vo.comissao; + +public class TarifaOficialComComposicaoDoPedagioVo { + private Integer tarifaOficialId; + private String composicaoDoPedagioNaTarifa; + private String composicaoDoPedagioNaTarifaOficialComPeaje; + + public Integer getTarifaOficialId() { + return tarifaOficialId; + } + public void setTarifaOficialId(Integer tarifaOficialId) { + this.tarifaOficialId = tarifaOficialId; + } + public String getComposicaoDoPedagioNaTarifa() { + return composicaoDoPedagioNaTarifa; + } + public void setComposicaoDoPedagioNaTarifa(String composicaoDoPedagioNaTarifa) { + this.composicaoDoPedagioNaTarifa = composicaoDoPedagioNaTarifa; + } + public String getComposicaoDoPedagioNaTarifaOficialComPeaje() { + return composicaoDoPedagioNaTarifaOficialComPeaje; + } + public void setComposicaoDoPedagioNaTarifaOficialComPeaje(String composicaoDoPedagioNaTarifaOficialComPeaje) { + this.composicaoDoPedagioNaTarifaOficialComPeaje = composicaoDoPedagioNaTarifaOficialComPeaje; + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/integracao/FechamentoCntCorrenteVO.java b/src/com/rjconsultores/ventaboletos/vo/integracao/FechamentoCntCorrenteVO.java index 8996cae45..782f93436 100644 --- a/src/com/rjconsultores/ventaboletos/vo/integracao/FechamentoCntCorrenteVO.java +++ b/src/com/rjconsultores/ventaboletos/vo/integracao/FechamentoCntCorrenteVO.java @@ -2,6 +2,8 @@ package com.rjconsultores.ventaboletos.vo.integracao; import java.math.BigDecimal; +import com.rjconsultores.ventaboletos.enums.StatusIntegracaoSap; + public class FechamentoCntCorrenteVO { public FechamentoCntCorrenteVO() { @@ -21,10 +23,10 @@ public class FechamentoCntCorrenteVO { private Integer empresaId; private String nombEmpresa; private String ufEmpresa; - private Boolean integradoSap; + private StatusIntegracaoSap integradoSap; private boolean enviar; - public FechamentoCntCorrenteVO(Long fechamentocntcorrenteId, String fecfechamento, String feclancamento, String anofechamento, String mesfechamento, BigDecimal total, String nombpuntoventa, String cnpjPuntoVenta, Integer empresaId, String nombEmpresa, String ufEmpresa, Boolean integradoSap) { + public FechamentoCntCorrenteVO(Long fechamentocntcorrenteId, String fecfechamento, String feclancamento, String anofechamento, String mesfechamento, BigDecimal total, String nombpuntoventa, String cnpjPuntoVenta, Integer empresaId, String nombEmpresa, String ufEmpresa, StatusIntegracaoSap integradoSap) { super(); this.fechamentocntcorrenteId = fechamentocntcorrenteId; this.fecfechamento = fecfechamento; @@ -104,11 +106,11 @@ public class FechamentoCntCorrenteVO { this.ufEmpresa = ufEmpresa; } - public boolean isIntegradoSap() { - return Boolean.TRUE.equals(integradoSap); + public StatusIntegracaoSap getIntegradoSap() { + return integradoSap; } - public void setIntegradoSap(boolean integradoSap) { + public void setIntegradoSap(StatusIntegracaoSap integradoSap) { this.integradoSap = integradoSap; } From 46b03ada41576760d8f504e2390ac19d64291d70 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Mon, 21 Nov 2022 16:13:49 -0300 Subject: [PATCH 17/34] sincronismo com fonte atual --- src/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/META-INF/MANIFEST.MF b/src/META-INF/MANIFEST.MF index b9f956e28..38bd0ecfb 100644 --- a/src/META-INF/MANIFEST.MF +++ b/src/META-INF/MANIFEST.MF @@ -1,3 +1,3 @@ Manifest-Version: 1.0 Ant-Version: Apache Ant 1.8.3 -Created-By: 1.7.0-b147 (Oracle Corporation) \ No newline at end of file +Created-By: 1.7.0-b147 (Oracle Corporation) \ No newline at end of file From ca73f52418f504cb8e2ce0d2ba44f9564992a369 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 09:52:50 -0300 Subject: [PATCH 18/34] bug#AL-1802 --- .../ventaboletos/web/utilerias/spring/AppContext.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java index f90b46633..8afccbe51 100644 --- a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java @@ -10,7 +10,6 @@ import org.springframework.context.ApplicationContext; * This class provides application-wide access to the Spring ApplicationContext. * The ApplicationContext is injected by the class "ApplicationContextProvider". * - * @author Siegfried Bolz */ public class AppContext { @@ -32,4 +31,4 @@ public class AppContext { public static ApplicationContext getApplicationContext() { return ctx; } -} +} \ No newline at end of file From 9d23a8ef7260d206558c6c1f63833c527578b039 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 10:06:54 -0300 Subject: [PATCH 19/34] bug#AL-1802 --- .../ventaboletos/web/utilerias/spring/AppContext.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java index 8afccbe51..dbb8aa280 100644 --- a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java @@ -1,7 +1,3 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ package com.rjconsultores.ventaboletos.web.utilerias.spring; import org.springframework.context.ApplicationContext; From b60a7711cceeb69d3721859e9dd6505f0046a883 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 10:07:25 -0300 Subject: [PATCH 20/34] bug#AL-1802 --- .../web/utilerias/spring/ApplicationContextProvider.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java index 4210b4f91..6065ab813 100644 --- a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java @@ -24,4 +24,4 @@ public class ApplicationContextProvider implements ApplicationContextAware { // Wiring the ApplicationContext into a static method AppContext.setApplicationContext(ctx); } -} +} \ No newline at end of file From b91bfe491dd40d71c37982bdd67dc6b827fa6445 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 10:15:29 -0300 Subject: [PATCH 21/34] bug#AL-1802 --- .../web/utilerias/spring/ApplicationContextProvider.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java index 6065ab813..c317d6b13 100644 --- a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java @@ -1,7 +1,3 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ package com.rjconsultores.ventaboletos.web.utilerias.spring; import org.springframework.beans.BeansException; From 13362185c7e5077d509bb49fd6e2ec4923a8ad51 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 10:22:34 -0300 Subject: [PATCH 22/34] bug#AL-1802 --- .../web/utilerias/spring/ApplicationContextProvider.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java index c317d6b13..4210b4f91 100644 --- a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java @@ -1,3 +1,7 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ package com.rjconsultores.ventaboletos.web.utilerias.spring; import org.springframework.beans.BeansException; @@ -20,4 +24,4 @@ public class ApplicationContextProvider implements ApplicationContextAware { // Wiring the ApplicationContext into a static method AppContext.setApplicationContext(ctx); } -} \ No newline at end of file +} From 339a734c81380e149e21dc54ddfc8eb2349021b6 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 10:26:28 -0300 Subject: [PATCH 23/34] bug#AL-1802 --- .../web/utilerias/spring/ApplicationContextProvider.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java index 4210b4f91..c317d6b13 100644 --- a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java @@ -1,7 +1,3 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ package com.rjconsultores.ventaboletos.web.utilerias.spring; import org.springframework.beans.BeansException; @@ -24,4 +20,4 @@ public class ApplicationContextProvider implements ApplicationContextAware { // Wiring the ApplicationContext into a static method AppContext.setApplicationContext(ctx); } -} +} \ No newline at end of file From bb9cd485aa9b16150d75fee4bafdd4a470eca0d1 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 10:29:39 -0300 Subject: [PATCH 24/34] bug#AL-1802 --- .../web/utilerias/spring/ApplicationContextProvider.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java index c317d6b13..6065ab813 100644 --- a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java @@ -1,3 +1,7 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ package com.rjconsultores.ventaboletos.web.utilerias.spring; import org.springframework.beans.BeansException; From dd69f9d67329170546f918b1c61adb6a7c3c3d4b Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 10:43:05 -0300 Subject: [PATCH 25/34] bug#AL-1802 --- .../web/utilerias/spring/ApplicationContextProvider.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java index 6065ab813..c317d6b13 100644 --- a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java @@ -1,7 +1,3 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ package com.rjconsultores.ventaboletos.web.utilerias.spring; import org.springframework.beans.BeansException; From e8f277e79b0837d73c72bfc38c9adf19f237953e Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 10:43:29 -0300 Subject: [PATCH 26/34] bug#AL-1802 --- .../ventaboletos/web/utilerias/spring/AppContext.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java index dbb8aa280..8afccbe51 100644 --- a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java @@ -1,3 +1,7 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ package com.rjconsultores.ventaboletos.web.utilerias.spring; import org.springframework.context.ApplicationContext; From e4e94503688aeb7740b7d44ae32b5f7ed77342fd Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 11:08:20 -0300 Subject: [PATCH 27/34] bug#AL-1802 --- .../ventaboletos/web/utilerias/spring/AppContext.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java index 8afccbe51..dbb8aa280 100644 --- a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java @@ -1,7 +1,3 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ package com.rjconsultores.ventaboletos.web.utilerias.spring; import org.springframework.context.ApplicationContext; From 724256a44151debd4b6d911611ae0333af5a55f3 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 11:15:16 -0300 Subject: [PATCH 28/34] bug#AL-1802 --- .../utilerias/spring/ApplicationContextProvider.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java index c317d6b13..59219640e 100644 --- a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/ApplicationContextProvider.java @@ -4,16 +4,6 @@ import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; -/** - * This class provides an application-wide access to the - * Spring ApplicationContext! The ApplicationContext is - * injected in a static method of the class "AppContext". - * - * Use AppContext.getApplicationContext() to get access - * to all Spring Beans. - * - * @author Siegfried Bolz - */ public class ApplicationContextProvider implements ApplicationContextAware { public void setApplicationContext(ApplicationContext ctx) throws BeansException { From 36916f18be7cfd1ccd2bfa095416ee3368fcb52e Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 11:20:09 -0300 Subject: [PATCH 29/34] bug#AL-1802 --- .../ventaboletos/web/utilerias/spring/AppContext.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java index dbb8aa280..f03d292ff 100644 --- a/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java +++ b/src/com/rjconsultores/ventaboletos/web/utilerias/spring/AppContext.java @@ -2,11 +2,6 @@ package com.rjconsultores.ventaboletos.web.utilerias.spring; import org.springframework.context.ApplicationContext; -/** - * This class provides application-wide access to the Spring ApplicationContext. - * The ApplicationContext is injected by the class "ApplicationContextProvider". - * - */ public class AppContext { private static ApplicationContext ctx; From ee619183372b9fff2a9cb6b712a17d2cc854d8c2 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 11:20:44 -0300 Subject: [PATCH 30/34] bug#AL-1802 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8ce4b5dc0..97bdb9f84 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 br.com.rjconsultores modelWeb - 1.0.3 + 1.0.4 From a229a7c8fb36e7ae6d98889b428c99b04c769805 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 12:21:49 -0300 Subject: [PATCH 31/34] =?UTF-8?q?corre=C3=A7ao=20de=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/pom.xml b/pom.xml index 97bdb9f84..130e7d247 100644 --- a/pom.xml +++ b/pom.xml @@ -178,7 +178,6 @@ 3.1.0 provided - From 972338e29b73550f8ba7d83b486232f6b32f6a9a Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Wed, 23 Nov 2022 14:34:00 -0300 Subject: [PATCH 32/34] bug#AL-1802 --- pom.xml | 2 +- .../receitaDespesa/RelatorioFinanceiroReceitasDespesasBean.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 130e7d247..149766b10 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 br.com.rjconsultores modelWeb - 1.0.4 + 1.0.5 diff --git a/src/com/rjconsultores/ventaboletos/relatorios/receitaDespesa/RelatorioFinanceiroReceitasDespesasBean.java b/src/com/rjconsultores/ventaboletos/relatorios/receitaDespesa/RelatorioFinanceiroReceitasDespesasBean.java index 986011a48..1516802dc 100644 --- a/src/com/rjconsultores/ventaboletos/relatorios/receitaDespesa/RelatorioFinanceiroReceitasDespesasBean.java +++ b/src/com/rjconsultores/ventaboletos/relatorios/receitaDespesa/RelatorioFinanceiroReceitasDespesasBean.java @@ -205,4 +205,4 @@ public class RelatorioFinanceiroReceitasDespesasBean { ValorFormaPagamento3 = valorFormaPagamento3; } -} +} \ No newline at end of file From f532788ebec2f09ca6fe057eb841271b9b198202 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Thu, 24 Nov 2022 11:38:05 -0300 Subject: [PATCH 33/34] fixes bug#AL-1819 --- pom.xml | 2 +- src/com/rjconsultores/ventaboletos/dao/AliasServicoDAO.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 149766b10..1411cafd4 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 br.com.rjconsultores modelWeb - 1.0.5 + 1.0.6 diff --git a/src/com/rjconsultores/ventaboletos/dao/AliasServicoDAO.java b/src/com/rjconsultores/ventaboletos/dao/AliasServicoDAO.java index 787d46bea..9c8165c98 100644 --- a/src/com/rjconsultores/ventaboletos/dao/AliasServicoDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/AliasServicoDAO.java @@ -57,4 +57,4 @@ public interface AliasServicoDAO extends GenericDAO{ List buscarPorRuta(Integer rutaId); -} +} \ No newline at end of file From 68e0ec881761d2119a3b70cd17691cd27c18c938 Mon Sep 17 00:00:00 2001 From: Fabio Faria Date: Tue, 29 Nov 2022 14:39:22 -0300 Subject: [PATCH 34/34] =?UTF-8?q?Adi=C3=A7=C3=A3o=20de=20historico?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1411cafd4..6be4bbf5a 100644 --- a/pom.xml +++ b/pom.xml @@ -169,7 +169,7 @@ br.com.rjconsultores Auditador - 1.0.0 + 1.0.1