Definir o banco (Principal/Replica) por método
bug#15223 dev:trevezani qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@97920 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
5935a83fad
commit
204297d535
|
@ -5,8 +5,7 @@ import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.ConstanteDAO;
|
import com.rjconsultores.ventaboletos.rest.service.AmbienteService;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Constante;
|
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
@Path("/ambiente")
|
@Path("/ambiente")
|
||||||
|
@ -14,11 +13,9 @@ public class AmbienteRS {
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public String getVersao() {
|
public String getReplica() {
|
||||||
ConstanteDAO constanteDAO = (ConstanteDAO) AppContext.getApplicationContext().getBean("constanteDAO");
|
AmbienteService service = (AmbienteService) AppContext.getApplicationContext().getBean("ambienteService");
|
||||||
Constante constante = constanteDAO.buscarPorNomeConstante("NOMBRE_AMBIENTE");
|
return service.getAmbienteReadOnly();
|
||||||
|
|
||||||
return constante.getValorconstante();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
package com.rjconsultores.ventaboletos.rest;
|
package com.rjconsultores.ventaboletos.rest;
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.annotation.security.RolesAllowed;
|
import javax.annotation.security.RolesAllowed;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
|
@ -15,21 +9,9 @@ import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaDAO;
|
import com.rjconsultores.ventaboletos.rest.bean.ParamsSincronizarOperador;
|
||||||
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaLinhaDAO;
|
import com.rjconsultores.ventaboletos.rest.service.ConsultarOperadorService;
|
||||||
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaServicoDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.FormaPagoDet;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcada;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO;
|
|
||||||
import com.rjconsultores.ventaboletos.rest.SincronizarOperador.ParamsSincronizarOperador;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.corrida.CorridaVO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.FormaPagamentoVO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.OperadorEmbarcadaVO;
|
import com.rjconsultores.ventaboletos.vo.embarcada.OperadorEmbarcadaVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.SeguroTaxaEmbarqueVO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.TiposPassagensBloqueadasVO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.ruta.RutaVO;
|
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
@Path("/consultarOperadorProxy")
|
@Path("/consultarOperadorProxy")
|
||||||
|
@ -43,77 +25,8 @@ public class ConsultarOperador {
|
||||||
public OperadorEmbarcadaVO buscarDadosOperador(ParamsSincronizarOperador params) {
|
public OperadorEmbarcadaVO buscarDadosOperador(ParamsSincronizarOperador params) {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmm");
|
ConsultarOperadorService service = (ConsultarOperadorService) AppContext.getApplicationContext().getBean("consultarOperadorService");
|
||||||
|
OperadorEmbarcadaVO vo = service.buscarDadosOperador(params);
|
||||||
Date dtIni = null;
|
|
||||||
Date dtFim = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
dtIni = sdf.parse(params.dataInicial);
|
|
||||||
dtFim = sdf.parse(params.dataFinal);
|
|
||||||
} catch (ParseException e) {
|
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
|
|
||||||
OperadorEmbarcadaDAO operadorEmbarcadaDAO = (OperadorEmbarcadaDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaDAO");
|
|
||||||
OperadorEmbarcadaLinhaDAO operadorEmbarcadaLinhaDAO = (OperadorEmbarcadaLinhaDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaLinhaDAO");
|
|
||||||
OperadorEmbarcadaServicoDAO operadorEmbarcadaServicoDAO = (OperadorEmbarcadaServicoDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaServicoDAO");
|
|
||||||
OperadorEmbarcada operadorEmbarcada = operadorEmbarcadaDAO.buscarOperadorEmbarcadaPorUsuario(params.operador);
|
|
||||||
|
|
||||||
PuntoVentaVO puntoVentaVO = operadorEmbarcadaDAO.getPuntoVentaVO(params.operador);
|
|
||||||
|
|
||||||
List<RutaVO> lsRutaVO = operadorEmbarcadaLinhaDAO.getListaRutaVO(params.operador);
|
|
||||||
|
|
||||||
List<CorridaVO> lsCorridaVO = operadorEmbarcadaServicoDAO.getListaCorridaProxyVO(params.operador, params.empresa, dtIni, dtFim);
|
|
||||||
|
|
||||||
OperadorEmbarcadaVO vo = new OperadorEmbarcadaVO();
|
|
||||||
vo.setIdOperador(operadorEmbarcada.getUsuarioId());
|
|
||||||
vo.setOperador(operadorEmbarcada.getUsername());
|
|
||||||
vo.setDescOperador(operadorEmbarcada.getName());
|
|
||||||
|
|
||||||
if (puntoVentaVO != null) {
|
|
||||||
vo.setIdAgencia(puntoVentaVO.getPuntoventaId());
|
|
||||||
vo.setDescAgencia(puntoVentaVO.nombpuntoventa);
|
|
||||||
|
|
||||||
vo.setLsFormasPagamento(new ArrayList<FormaPagamentoVO>());
|
|
||||||
vo.setLsSeguroTaxaEmbarque(new ArrayList<SeguroTaxaEmbarqueVO>());
|
|
||||||
vo.setLsTiposPassagensBloqueadas(new ArrayList<TiposPassagensBloqueadasVO>());
|
|
||||||
|
|
||||||
List<FormaPagoDet> listFP = operadorEmbarcadaDAO.getListaFormaPago(puntoVentaVO.getPuntoventaId());
|
|
||||||
|
|
||||||
for (FormaPagoDet dp : listFP) {
|
|
||||||
vo.getLsFormasPagamento().add(
|
|
||||||
new FormaPagamentoVO(
|
|
||||||
dp.getEmpresa().getEmpresaId(),
|
|
||||||
dp.getEmpresa().getNombempresa(),
|
|
||||||
dp.getFormaPago().getFormapagoId().intValue(),
|
|
||||||
dp.getFormaPago().getDescpago()));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<PtoVtaSeguro> listSTx = operadorEmbarcadaDAO.getListaSeguroTaxaEmbarque(puntoVentaVO.getPuntoventaId());
|
|
||||||
|
|
||||||
for (PtoVtaSeguro st : listSTx) {
|
|
||||||
vo.getLsSeguroTaxaEmbarque().add(
|
|
||||||
new SeguroTaxaEmbarqueVO(
|
|
||||||
st.getEmpresa().getEmpresaId(),
|
|
||||||
st.getIndVendeSeguroOpcEmbarcada(),
|
|
||||||
st.getIndVendeSeguroTabelaEmbarcada(),
|
|
||||||
st.getIndTaxaEmbarqueEmbarcada()));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<PtovtaCatInd> listTPB = operadorEmbarcadaDAO.getListaTiposPassagensBloqueadas(puntoVentaVO.getPuntoventaId());
|
|
||||||
|
|
||||||
for (PtovtaCatInd tpb : listTPB) {
|
|
||||||
vo.getLsTiposPassagensBloqueadas().add(
|
|
||||||
new TiposPassagensBloqueadasVO(
|
|
||||||
tpb.getCategoria().getCategoriaId(),
|
|
||||||
tpb.getUsuarioBloqueado().getUsuarioId(),
|
|
||||||
tpb.getEmpresa().getEmpresaId()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vo.setLsRutas(lsRutaVO);
|
|
||||||
vo.setLsCorridas(lsCorridaVO);
|
|
||||||
|
|
||||||
printInfo("/consultarOperadorProxy", start);
|
printInfo("/consultarOperadorProxy", start);
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,10 @@ import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.MarcaDAO;
|
import com.rjconsultores.ventaboletos.rest.bean.ParamsOperadorDetalhesCorrida;
|
||||||
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaServicoDAO;
|
import com.rjconsultores.ventaboletos.rest.service.ConsultarOperadorDetalhesCorridaService;
|
||||||
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Marca;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.corrida.CorridaVO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.DetalheCorridaVO;
|
import com.rjconsultores.ventaboletos.vo.embarcada.DetalheCorridaVO;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
@ -29,27 +25,8 @@ public class ConsultarOperadorDetalhesCorrida {
|
||||||
public DetalheCorridaVO buscarDetalhesCorrida(ParamsOperadorDetalhesCorrida params) {
|
public DetalheCorridaVO buscarDetalhesCorrida(ParamsOperadorDetalhesCorrida params) {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
CorridaVO corrida = new CorridaVO();
|
ConsultarOperadorDetalhesCorridaService service = (ConsultarOperadorDetalhesCorridaService) AppContext.getApplicationContext().getBean("consultarOperadorDetalhesCorridaService");
|
||||||
corrida.setCorridaId(params.corridaId);
|
DetalheCorridaVO vo = service.buscarDetalhesCorrida(params);
|
||||||
corrida.setFeccorrida(params.feccorrida);
|
|
||||||
corrida.setRutaId(params.rutaId);
|
|
||||||
corrida.setMarcaId(params.marcaId);
|
|
||||||
corrida.setClaseServicioId(params.claseServicioId);
|
|
||||||
|
|
||||||
OperadorEmbarcadaServicoDAO operadorEmbarcadaServicoDAO = (OperadorEmbarcadaServicoDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaServicoDAO");
|
|
||||||
PuntoVentaDAO puntoventaDAO = (PuntoVentaDAO)AppContext.getApplicationContext().getBean("puntoVentaDAO");
|
|
||||||
MarcaDAO marcaDAO = (MarcaDAO)AppContext.getApplicationContext().getBean("marcaDAO");
|
|
||||||
|
|
||||||
Marca marca = marcaDAO.obtenerID(params.marcaId.shortValue());
|
|
||||||
if (marca != null){
|
|
||||||
corrida.setEmpresaId(marca.getEmpresa().getEmpresaId());
|
|
||||||
}
|
|
||||||
|
|
||||||
operadorEmbarcadaServicoDAO.preencherCorrida(corrida, puntoventaDAO.obtenerID(params.puntoVentaId));
|
|
||||||
|
|
||||||
DetalheCorridaVO vo = new DetalheCorridaVO();
|
|
||||||
vo.setLsTramoVO(corrida.getLsTramoVO());
|
|
||||||
vo.setLsSecuenciaVO(corrida.getLsSecuenciaVO());
|
|
||||||
|
|
||||||
printInfo("/consultarOperadorDetalhesCorrida", start);
|
printInfo("/consultarOperadorDetalhesCorrida", start);
|
||||||
|
|
||||||
|
@ -69,50 +46,4 @@ public class ConsultarOperadorDetalhesCorrida {
|
||||||
|
|
||||||
log.info(info);
|
log.info(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
static class ParamsOperadorDetalhesCorrida {
|
|
||||||
Integer corridaId;
|
|
||||||
String feccorrida;
|
|
||||||
Integer rutaId;
|
|
||||||
Integer marcaId;
|
|
||||||
Integer puntoVentaId;
|
|
||||||
Integer claseServicioId;
|
|
||||||
public Integer getCorridaId() {
|
|
||||||
return corridaId;
|
|
||||||
}
|
|
||||||
public void setCorridaId(Integer corridaId) {
|
|
||||||
this.corridaId = corridaId;
|
|
||||||
}
|
|
||||||
public String getFeccorrida() {
|
|
||||||
return feccorrida;
|
|
||||||
}
|
|
||||||
public void setFeccorrida(String feccorrida) {
|
|
||||||
this.feccorrida = feccorrida;
|
|
||||||
}
|
|
||||||
public Integer getRutaId() {
|
|
||||||
return rutaId;
|
|
||||||
}
|
|
||||||
public void setRutaId(Integer rutaId) {
|
|
||||||
this.rutaId = rutaId;
|
|
||||||
}
|
|
||||||
public Integer getMarcaId() {
|
|
||||||
return marcaId;
|
|
||||||
}
|
|
||||||
public void setMarcaId(Integer marcaId) {
|
|
||||||
this.marcaId = marcaId;
|
|
||||||
}
|
|
||||||
public Integer getPuntoVentaId() {
|
|
||||||
return puntoVentaId;
|
|
||||||
}
|
|
||||||
public void setPuntoVentaId(Integer puntoVentaId) {
|
|
||||||
this.puntoVentaId = puntoVentaId;
|
|
||||||
}
|
|
||||||
public Integer getClaseServicioId() {
|
|
||||||
return claseServicioId;
|
|
||||||
}
|
|
||||||
public void setClaseServicioId(Integer claseServicioId) {
|
|
||||||
this.claseServicioId = claseServicioId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package com.rjconsultores.ventaboletos.rest;
|
package com.rjconsultores.ventaboletos.rest;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.annotation.security.RolesAllowed;
|
import javax.annotation.security.RolesAllowed;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
|
@ -11,26 +8,9 @@ import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
import com.rjconsultores.ventaboletos.rest.bean.ParamsSincronizarDispositivo;
|
||||||
|
import com.rjconsultores.ventaboletos.rest.service.SincronizarService;
|
||||||
import com.rjconsultores.ventaboletos.constantes.Constantes;
|
import com.rjconsultores.ventaboletos.rest.service.exception.ServiceEmbarcadaException;
|
||||||
import com.rjconsultores.ventaboletos.dao.ConstanteDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.dao.DispositivoEmbarcadaDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.dao.EmpresaDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Constante;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.CtrlSerieEmbarcada;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcada;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.EmpresaImposto;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Estado;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.DispositivoEmbarcadaVO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.EmpresaVO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.EstadoDispositivoEmbarcadaVO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.InscricaoEstadualVO;
|
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
@Path("/sincronizarDispositivo")
|
@Path("/sincronizarDispositivo")
|
||||||
|
@ -41,100 +21,12 @@ public class SincronizarDispositivo {
|
||||||
@RolesAllowed("EMBARCADA")
|
@RolesAllowed("EMBARCADA")
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public Response buscarDispositivo(ParamsSincronizarDispositivo params) throws Exception {
|
public Response buscarDispositivo(ParamsSincronizarDispositivo params) throws Exception {
|
||||||
DispositivoEmbarcadaDAO dispositivoEmbarcadaDAO = (DispositivoEmbarcadaDAO)AppContext.getApplicationContext().getBean("dispositivoEmbarcadaDAO");
|
SincronizarService service = (SincronizarService) AppContext.getApplicationContext().getBean("sincronizarService");
|
||||||
EmpresaDAO empresaDAO = (EmpresaDAO)AppContext.getApplicationContext().getBean("empresaDAO");
|
|
||||||
PuntoVentaDAO puntoVentaDAO = (PuntoVentaDAO)AppContext.getApplicationContext().getBean("puntoVentaDAO");
|
|
||||||
DispositivoEmbarcada dispositivo = dispositivoEmbarcadaDAO.buscarImei(params.imei);
|
|
||||||
ConstanteDAO constanteDAO = (ConstanteDAO)AppContext.getApplicationContext().getBean("constanteDAO");
|
|
||||||
|
|
||||||
if (dispositivo == null){
|
try {
|
||||||
DispositivoEmbarcadaVO dispositivoVo = new DispositivoEmbarcadaVO();
|
return Response.ok(service.getDispositivoEmbarcada(params), MediaType.APPLICATION_JSON).build();
|
||||||
dispositivoVo.setMsg("Dispositivo não encontrado");
|
} catch (ServiceEmbarcadaException e) {
|
||||||
return Response.ok(dispositivoVo, MediaType.APPLICATION_JSON).build();
|
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build();
|
||||||
}
|
|
||||||
PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(dispositivo.getPuntoVenta().getPuntoventaId().intValue());
|
|
||||||
Empresa empresa = empresaDAO.obtenerID(dispositivo.getEmpresa().getEmpresaId().intValue());
|
|
||||||
|
|
||||||
DispositivoEmbarcadaVO vo = new DispositivoEmbarcadaVO();
|
|
||||||
vo.setDispositivoId(dispositivo.getDispositivoEmbarcadaId());
|
|
||||||
vo.setBaixado(dispositivo.getIndDispBaixado() ? 1 : 0);
|
|
||||||
vo.setBloqueado(dispositivo.getIndDispBloqueado() ? 1 : 0);
|
|
||||||
vo.setDescAgencia(puntoVenta.getNombpuntoventa());
|
|
||||||
vo.setNumagencia(puntoVenta.getNumPuntoVenta());
|
|
||||||
vo.setDescEmpresa(empresa.getNombempresa());
|
|
||||||
vo.setDescEquipamento(dispositivo.getDescricao());
|
|
||||||
vo.setIdAgencia(dispositivo.getPuntoVenta().getPuntoventaId().longValue());
|
|
||||||
vo.setIdempresa(dispositivo.getEmpresa().getEmpresaId().longValue());
|
|
||||||
vo.setManutencao(dispositivo.getIndDispManutencao() ? 1 : 0);
|
|
||||||
vo.setCnpjAgencia(puntoVenta.getNumDoCPuntoVenta());
|
|
||||||
vo.setEnderecoAgencia(puntoVenta.getDireccioncalle()+", nº: "+puntoVenta.getDireccionnumero()+". Cidade: "+puntoVenta.getCidade());
|
|
||||||
vo.setCnpjEmpresa(empresa.getCnpj());
|
|
||||||
|
|
||||||
Map<Estado, EmpresaImposto> impostos = getImpostos(empresa);
|
|
||||||
|
|
||||||
for (PtovtaEmpresa e : puntoVenta.getLsPtovtaEmpresa()){
|
|
||||||
EmpresaVO emp = new EmpresaVO();
|
|
||||||
emp.setEmpresaId(e.getEmpresa().getEmpresaId().longValue());
|
|
||||||
emp.setNombempresa(e.getEmpresa().getNombempresa());
|
|
||||||
emp.setCnpj(e.getEmpresa().getCnpj());
|
|
||||||
emp.setIndImprimeRelFechamentoViagemDetalhadoEmarcada(e.getEmpresa().getIndImprimeRelFechamentoViagemDetalhadoEmarcada() != null ? e.getEmpresa().getIndImprimeRelFechamentoViagemDetalhadoEmarcada() : Boolean.FALSE);
|
|
||||||
emp.setIndImprimeLogoBilheteVendaEmbarcada(e.getEmpresa().getIndImprimeLogoBilheteVendaEmbarcada() != null ? e.getEmpresa().getIndImprimeLogoBilheteVendaEmbarcada() : Boolean.FALSE);
|
|
||||||
vo.getEmpresasVenda().add(emp);
|
|
||||||
for (InscricaoEstadual insc : e.getEmpresa().getInscricoesEstaduais()){
|
|
||||||
EmpresaImposto imposto = impostos.get(insc.getEstado());
|
|
||||||
InscricaoEstadualVO ie;
|
|
||||||
if (insc.getActivo()){
|
|
||||||
ie = new InscricaoEstadualVO(insc);
|
|
||||||
if (imposto != null) {
|
|
||||||
ie.setPorctributo(imposto.getPorctributo());
|
|
||||||
ie.setTributacaoImportacao(imposto.getTributacaoImportacao());
|
|
||||||
ie.setTributacaoImportacaoIM(imposto.getTributacaoImportacaoIM());
|
|
||||||
}
|
|
||||||
emp.getInscricoesEstaduais().add(ie);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vo.setEnderecoEmpresa(empresa.getLogradouro()+", nº: "+empresa.getNumero()+". Cidade: "+empresa.getBairro());
|
|
||||||
Constante estacionEmbarcadaConst = constanteDAO.buscarPorNomeConstante(Constantes.ESTACAO_EMBARCADA);
|
|
||||||
if (estacionEmbarcadaConst == null || (estacionEmbarcadaConst != null && estacionEmbarcadaConst.getValorconstante() == null) ||
|
|
||||||
(estacionEmbarcadaConst != null && estacionEmbarcadaConst.getValorconstante().isEmpty())){
|
|
||||||
return Response.status(Response.Status.NOT_FOUND).entity("Error: Constante ESTACAO_EMBARCADA não cadastrada!").build();
|
|
||||||
}
|
|
||||||
String estacionIdEmbarcada = estacionEmbarcadaConst.getValorconstante();
|
|
||||||
vo.setEstacionId(estacionIdEmbarcada != null && !estacionIdEmbarcada.isEmpty() ? Integer.parseInt(estacionIdEmbarcada) : null);
|
|
||||||
|
|
||||||
for (CtrlSerieEmbarcada serie : dispositivo.getSeries()){
|
|
||||||
EstadoDispositivoEmbarcadaVO estado = new EstadoDispositivoEmbarcadaVO();
|
|
||||||
estado.setDescUf(serie.getEstado().getCveestado());
|
|
||||||
estado.setIdUf(serie.getEstado().getEstadoId().longValue());
|
|
||||||
estado.setNumBpe(serie.getNumeroCorrente());
|
|
||||||
estado.setSerie(serie.getSerie());
|
|
||||||
vo.add(estado);
|
|
||||||
}
|
|
||||||
return Response.ok(vo, MediaType.APPLICATION_JSON).build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<Estado, EmpresaImposto> getImpostos(Empresa e){
|
|
||||||
Map<Estado, EmpresaImposto> result = new HashMap<Estado, EmpresaImposto>();
|
|
||||||
|
|
||||||
for (EmpresaImposto ei : e.getEmpresaImpostoList()) {
|
|
||||||
if (ei.getActivo()) {
|
|
||||||
result.put(ei.getEstado(), ei);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
static class ParamsSincronizarDispositivo {
|
|
||||||
String imei;
|
|
||||||
|
|
||||||
public String getImei() {
|
|
||||||
return imei;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImei(String imei) {
|
|
||||||
this.imei = imei;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
package com.rjconsultores.ventaboletos.rest;
|
package com.rjconsultores.ventaboletos.rest;
|
||||||
|
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.annotation.security.RolesAllowed;
|
import javax.annotation.security.RolesAllowed;
|
||||||
import javax.ws.rs.Consumes;
|
import javax.ws.rs.Consumes;
|
||||||
import javax.ws.rs.POST;
|
import javax.ws.rs.POST;
|
||||||
|
@ -14,24 +8,12 @@ import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaDAO;
|
import com.rjconsultores.ventaboletos.rest.bean.ParamsSincronizarOperador;
|
||||||
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaLinhaDAO;
|
import com.rjconsultores.ventaboletos.rest.service.SincronizarOperadorService;
|
||||||
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaServicoDAO;
|
import com.rjconsultores.ventaboletos.rest.service.exception.ServiceEmbarcadaException;
|
||||||
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.FormaPagoDet;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcada;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd;
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.corrida.CorridaVO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.FormaPagamentoVO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.OperadorEmbarcadaVO;
|
import com.rjconsultores.ventaboletos.vo.embarcada.OperadorEmbarcadaVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.SeguroTaxaEmbarqueVO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.TiposPassagensBloqueadasVO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.ruta.RutaVO;
|
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
@Path("/sincronizarOperador")
|
@Path("/sincronizarOperador")
|
||||||
|
@ -45,86 +27,16 @@ public class SincronizarOperador {
|
||||||
public Response buscarDadosOperador(ParamsSincronizarOperador params) {
|
public Response buscarDadosOperador(ParamsSincronizarOperador params) {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmm");
|
SincronizarOperadorService service = (SincronizarOperadorService) AppContext.getApplicationContext().getBean("sincronizarOperadorService");
|
||||||
|
|
||||||
Date dtIni = null;
|
OperadorEmbarcadaVO vo = null;
|
||||||
Date dtFim = null;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
dtIni = sdf.parse(params.dataInicial);
|
vo = service.buscarDadosOperador(params);
|
||||||
dtFim = sdf.parse(params.dataFinal);
|
} catch (ServiceEmbarcadaException e) {
|
||||||
} catch (ParseException e) {
|
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build();
|
||||||
log.error(e.getMessage(), e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OperadorEmbarcadaDAO operadorEmbarcadaDAO = (OperadorEmbarcadaDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaDAO");
|
|
||||||
OperadorEmbarcadaLinhaDAO operadorEmbarcadaLinhaDAO = (OperadorEmbarcadaLinhaDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaLinhaDAO");
|
|
||||||
OperadorEmbarcadaServicoDAO operadorEmbarcadaServicoDAO = (OperadorEmbarcadaServicoDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaServicoDAO");
|
|
||||||
PuntoVentaDAO puntoventaDAO = (PuntoVentaDAO)AppContext.getApplicationContext().getBean("puntoVentaDAO");
|
|
||||||
OperadorEmbarcada operadorEmbarcada;
|
|
||||||
try{
|
|
||||||
operadorEmbarcada = operadorEmbarcadaDAO.buscarOperadorEmbarcadaPorUsuario(params.operador);
|
|
||||||
} catch (Exception e){
|
|
||||||
return Response.status(Response.Status.NOT_FOUND).entity("Error: Buscar Operador Embarcada por Usuario retornou mais de um registro.").build();
|
|
||||||
}
|
|
||||||
// List<OperadorEmbarcadaLinha> lsOperadorEmbarcadaLinha = operadorEmbarcadaLinhaDAO.buscarPorOperador(operadorEmbarcada);
|
|
||||||
|
|
||||||
PuntoVentaVO puntoVentaVO = operadorEmbarcadaDAO.getPuntoVentaVO(params.operador);
|
|
||||||
|
|
||||||
List<RutaVO>lsRutaVO = operadorEmbarcadaLinhaDAO.getListaRutaVO(params.operador);
|
|
||||||
|
|
||||||
List<CorridaVO>lsCorridaVO = operadorEmbarcadaServicoDAO.getListaCorridaVO(params.operador, params.empresa, dtIni, dtFim, puntoventaDAO.obtenerID(puntoVentaVO.getPuntoventaId()));
|
|
||||||
|
|
||||||
OperadorEmbarcadaVO vo = new OperadorEmbarcadaVO();
|
|
||||||
vo.setIdOperador(operadorEmbarcada.getUsuarioId());
|
|
||||||
vo.setOperador(operadorEmbarcada.getUsername());
|
|
||||||
vo.setDescOperador(operadorEmbarcada.getName());
|
|
||||||
vo.setIndcorteautomatico(operadorEmbarcada.getUsuario().getIndCorteAutomatico());
|
|
||||||
|
|
||||||
if (puntoVentaVO != null) {
|
|
||||||
vo.setIdAgencia(puntoVentaVO.getPuntoventaId());
|
|
||||||
vo.setDescAgencia(puntoVentaVO.nombpuntoventa);
|
|
||||||
|
|
||||||
vo.setLsFormasPagamento(new ArrayList<FormaPagamentoVO>());
|
|
||||||
vo.setLsSeguroTaxaEmbarque(new ArrayList<SeguroTaxaEmbarqueVO>());
|
|
||||||
vo.setLsTiposPassagensBloqueadas(new ArrayList<TiposPassagensBloqueadasVO>());
|
|
||||||
|
|
||||||
List<FormaPagoDet> listFP = operadorEmbarcadaDAO.getListaFormaPago(puntoVentaVO.getPuntoventaId());
|
|
||||||
|
|
||||||
for (FormaPagoDet dp : listFP) {
|
|
||||||
vo.getLsFormasPagamento().add(
|
|
||||||
new FormaPagamentoVO(
|
|
||||||
dp.getEmpresa().getEmpresaId(),
|
|
||||||
dp.getEmpresa().getNombempresa(),
|
|
||||||
dp.getFormaPago().getFormapagoId().intValue(),
|
|
||||||
dp.getFormaPago().getDescpago()));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<PtoVtaSeguro> listSTx = operadorEmbarcadaDAO.getListaSeguroTaxaEmbarque(puntoVentaVO.getPuntoventaId());
|
|
||||||
|
|
||||||
for (PtoVtaSeguro st : listSTx) {
|
|
||||||
vo.getLsSeguroTaxaEmbarque().add(
|
|
||||||
new SeguroTaxaEmbarqueVO(
|
|
||||||
st.getEmpresa().getEmpresaId(),
|
|
||||||
st.getIndVendeSeguroOpcEmbarcada(),
|
|
||||||
st.getIndVendeSeguroTabelaEmbarcada(),
|
|
||||||
st.getIndTaxaEmbarqueEmbarcada()));
|
|
||||||
}
|
|
||||||
|
|
||||||
List<PtovtaCatInd> listTPB = operadorEmbarcadaDAO.getListaTiposPassagensBloqueadas(puntoVentaVO.getPuntoventaId());
|
|
||||||
|
|
||||||
for (PtovtaCatInd tpb : listTPB) {
|
|
||||||
vo.getLsTiposPassagensBloqueadas().add(
|
|
||||||
new TiposPassagensBloqueadasVO(
|
|
||||||
tpb.getCategoria().getCategoriaId(),
|
|
||||||
tpb.getUsuarioBloqueado().getUsuarioId(),
|
|
||||||
tpb.getEmpresa().getEmpresaId()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
vo.setLsRutas(lsRutaVO);
|
|
||||||
vo.setLsCorridas(lsCorridaVO);
|
|
||||||
|
|
||||||
printInfo("/sincronizarOperador", start);
|
printInfo("/sincronizarOperador", start);
|
||||||
|
|
||||||
return Response.ok(vo, MediaType.APPLICATION_JSON).build();
|
return Response.ok(vo, MediaType.APPLICATION_JSON).build();
|
||||||
|
@ -143,36 +55,4 @@ public class SincronizarOperador {
|
||||||
|
|
||||||
log.info(info);
|
log.info(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
static class ParamsSincronizarOperador {
|
|
||||||
Integer operador;
|
|
||||||
Integer empresa;
|
|
||||||
String dataInicial;
|
|
||||||
String dataFinal;
|
|
||||||
public Integer getOperador() {
|
|
||||||
return operador;
|
|
||||||
}
|
|
||||||
public void setOperador(Integer operador) {
|
|
||||||
this.operador = operador;
|
|
||||||
}
|
|
||||||
public Integer getEmpresa() {
|
|
||||||
return empresa;
|
|
||||||
}
|
|
||||||
public void setEmpresa(Integer empresa) {
|
|
||||||
this.empresa = empresa;
|
|
||||||
}
|
|
||||||
public String getDataInicial() {
|
|
||||||
return dataInicial;
|
|
||||||
}
|
|
||||||
public void setDataInicial(String dataInicial) {
|
|
||||||
this.dataInicial = dataInicial;
|
|
||||||
}
|
|
||||||
public String getDataFinal() {
|
|
||||||
return dataFinal;
|
|
||||||
}
|
|
||||||
public void setDataFinal(String dataFinal) {
|
|
||||||
this.dataFinal = dataFinal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,8 @@ import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
import com.rjconsultores.ventaboletos.rest.bean.ParamsDadosOperador;
|
||||||
|
import com.rjconsultores.ventaboletos.rest.service.SincronizarOperadoresService;
|
||||||
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO;
|
import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
@ -23,23 +22,8 @@ public class SincronizarOperadores {
|
||||||
@RolesAllowed("EMBARCADA")
|
@RolesAllowed("EMBARCADA")
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public List<UsuarioEmbarcadaVO> buscarDadosOperador(ParamsDadosOperador params) {
|
public List<UsuarioEmbarcadaVO> buscarDadosOperador(ParamsDadosOperador params) {
|
||||||
|
SincronizarOperadoresService service = (SincronizarOperadoresService) AppContext.getApplicationContext().getBean("sincronizarOperadoresService");
|
||||||
PuntoVentaDAO puntoVentaDAO = (PuntoVentaDAO)AppContext.getApplicationContext().getBean("puntoVentaDAO");
|
return service.buscarDadosOperador(params);
|
||||||
|
|
||||||
return puntoVentaDAO.buscaUsuariosDoPuntoVenta(params.getPuntoVentaId());
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
static class ParamsDadosOperador {
|
|
||||||
Long puntoVentaId;
|
|
||||||
|
|
||||||
public Long getPuntoVentaId() {
|
|
||||||
return puntoVentaId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPuntoVentaId(Long puntoVentaId) {
|
|
||||||
this.puntoVentaId = puntoVentaId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,9 +9,8 @@ import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
import com.rjconsultores.ventaboletos.rest.bean.ParamsSincronizarUsuarios;
|
||||||
|
import com.rjconsultores.ventaboletos.rest.service.SincronizarUsuariosControleEmbarqueService;
|
||||||
import com.rjconsultores.ventaboletos.dao.UsuarioDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO;
|
import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO;
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
@ -23,23 +22,8 @@ public class SincronizarUsuariosControleEmbarque {
|
||||||
@RolesAllowed("EMBARCADA")
|
@RolesAllowed("EMBARCADA")
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
public List<UsuarioEmbarcadaVO> buscarUsuariosControleEmbarque(ParamsSincronizarUsuarios params) {
|
public List<UsuarioEmbarcadaVO> buscarUsuariosControleEmbarque(ParamsSincronizarUsuarios params) {
|
||||||
|
SincronizarUsuariosControleEmbarqueService service = (SincronizarUsuariosControleEmbarqueService) AppContext.getApplicationContext().getBean("sincronizarUsuariosControleEmbarqueService");
|
||||||
UsuarioDAO usuarioDAO = (UsuarioDAO)AppContext.getApplicationContext().getBean("usuarioDAO");
|
return service.buscarUsuariosControleEmbarque(params);
|
||||||
|
|
||||||
return usuarioDAO.buscarPorFuncionSistema(params.funcionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
static class ParamsSincronizarUsuarios {
|
|
||||||
Long funcionId;
|
|
||||||
|
|
||||||
public Long getFuncionId() {
|
|
||||||
return funcionId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFuncionId(Long funcionId) {
|
|
||||||
this.funcionId = funcionId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.bean;
|
||||||
|
|
||||||
|
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||||
|
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class ParamsDadosOperador {
|
||||||
|
Long puntoVentaId;
|
||||||
|
|
||||||
|
public Long getPuntoVentaId() {
|
||||||
|
return puntoVentaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPuntoVentaId(Long puntoVentaId) {
|
||||||
|
this.puntoVentaId = puntoVentaId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.bean;
|
||||||
|
|
||||||
|
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||||
|
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class ParamsOperadorDetalhesCorrida {
|
||||||
|
Integer corridaId;
|
||||||
|
String feccorrida;
|
||||||
|
Integer rutaId;
|
||||||
|
Integer marcaId;
|
||||||
|
Integer puntoVentaId;
|
||||||
|
Integer claseServicioId;
|
||||||
|
public Integer getCorridaId() {
|
||||||
|
return corridaId;
|
||||||
|
}
|
||||||
|
public void setCorridaId(Integer corridaId) {
|
||||||
|
this.corridaId = corridaId;
|
||||||
|
}
|
||||||
|
public String getFeccorrida() {
|
||||||
|
return feccorrida;
|
||||||
|
}
|
||||||
|
public void setFeccorrida(String feccorrida) {
|
||||||
|
this.feccorrida = feccorrida;
|
||||||
|
}
|
||||||
|
public Integer getRutaId() {
|
||||||
|
return rutaId;
|
||||||
|
}
|
||||||
|
public void setRutaId(Integer rutaId) {
|
||||||
|
this.rutaId = rutaId;
|
||||||
|
}
|
||||||
|
public Integer getMarcaId() {
|
||||||
|
return marcaId;
|
||||||
|
}
|
||||||
|
public void setMarcaId(Integer marcaId) {
|
||||||
|
this.marcaId = marcaId;
|
||||||
|
}
|
||||||
|
public Integer getPuntoVentaId() {
|
||||||
|
return puntoVentaId;
|
||||||
|
}
|
||||||
|
public void setPuntoVentaId(Integer puntoVentaId) {
|
||||||
|
this.puntoVentaId = puntoVentaId;
|
||||||
|
}
|
||||||
|
public Integer getClaseServicioId() {
|
||||||
|
return claseServicioId;
|
||||||
|
}
|
||||||
|
public void setClaseServicioId(Integer claseServicioId) {
|
||||||
|
this.claseServicioId = claseServicioId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.bean;
|
||||||
|
|
||||||
|
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||||
|
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class ParamsSincronizarDispositivo {
|
||||||
|
String imei;
|
||||||
|
|
||||||
|
public String getImei() {
|
||||||
|
return imei;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setImei(String imei) {
|
||||||
|
this.imei = imei;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.bean;
|
||||||
|
|
||||||
|
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||||
|
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class ParamsSincronizarOperador {
|
||||||
|
Integer operador;
|
||||||
|
Integer empresa;
|
||||||
|
String dataInicial;
|
||||||
|
String dataFinal;
|
||||||
|
|
||||||
|
public Integer getOperador() {
|
||||||
|
return operador;
|
||||||
|
}
|
||||||
|
public void setOperador(Integer operador) {
|
||||||
|
this.operador = operador;
|
||||||
|
}
|
||||||
|
public Integer getEmpresa() {
|
||||||
|
return empresa;
|
||||||
|
}
|
||||||
|
public void setEmpresa(Integer empresa) {
|
||||||
|
this.empresa = empresa;
|
||||||
|
}
|
||||||
|
public String getDataInicial() {
|
||||||
|
return dataInicial;
|
||||||
|
}
|
||||||
|
public void setDataInicial(String dataInicial) {
|
||||||
|
this.dataInicial = dataInicial;
|
||||||
|
}
|
||||||
|
public String getDataFinal() {
|
||||||
|
return dataFinal;
|
||||||
|
}
|
||||||
|
public void setDataFinal(String dataFinal) {
|
||||||
|
this.dataFinal = dataFinal;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.bean;
|
||||||
|
|
||||||
|
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
||||||
|
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
|
public class ParamsSincronizarUsuarios {
|
||||||
|
Long funcionId;
|
||||||
|
|
||||||
|
public Long getFuncionId() {
|
||||||
|
return funcionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFuncionId(Long funcionId) {
|
||||||
|
this.funcionId = funcionId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.service;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.rjconsultores.routing.ReadOnlyConnection;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ConstanteDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Constante;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
@Service("ambienteService")
|
||||||
|
public class AmbienteService {
|
||||||
|
|
||||||
|
public String getAmbienteReadWrite() {
|
||||||
|
ConstanteDAO constanteDAO = (ConstanteDAO) AppContext.getApplicationContext().getBean("constanteDAO");
|
||||||
|
Constante constante = constanteDAO.buscarPorNomeConstante("NOMBRE_AMBIENTE");
|
||||||
|
|
||||||
|
return constante.getValorconstante();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ReadOnlyConnection
|
||||||
|
public String getAmbienteReadOnly() {
|
||||||
|
return getAmbienteReadWrite();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.service;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.rjconsultores.routing.ReadOnlyConnection;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.MarcaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaServicoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||||
|
import com.rjconsultores.ventaboletos.rest.bean.ParamsOperadorDetalhesCorrida;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.corrida.CorridaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.DetalheCorridaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
@Service("consultarOperadorDetalhesCorridaService")
|
||||||
|
public class ConsultarOperadorDetalhesCorridaService {
|
||||||
|
|
||||||
|
@ReadOnlyConnection
|
||||||
|
public DetalheCorridaVO buscarDetalhesCorrida(ParamsOperadorDetalhesCorrida params) {
|
||||||
|
CorridaVO corrida = new CorridaVO();
|
||||||
|
corrida.setCorridaId(params.getCorridaId());
|
||||||
|
corrida.setFeccorrida(params.getFeccorrida());
|
||||||
|
corrida.setRutaId(params.getRutaId());
|
||||||
|
corrida.setMarcaId(params.getMarcaId());
|
||||||
|
corrida.setClaseServicioId(params.getClaseServicioId());
|
||||||
|
|
||||||
|
OperadorEmbarcadaServicoDAO operadorEmbarcadaServicoDAO = (OperadorEmbarcadaServicoDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaServicoDAO");
|
||||||
|
PuntoVentaDAO puntoventaDAO = (PuntoVentaDAO)AppContext.getApplicationContext().getBean("puntoVentaDAO");
|
||||||
|
MarcaDAO marcaDAO = (MarcaDAO)AppContext.getApplicationContext().getBean("marcaDAO");
|
||||||
|
|
||||||
|
Marca marca = marcaDAO.obtenerID(params.getMarcaId().shortValue());
|
||||||
|
if (marca != null){
|
||||||
|
corrida.setEmpresaId(marca.getEmpresa().getEmpresaId());
|
||||||
|
}
|
||||||
|
|
||||||
|
operadorEmbarcadaServicoDAO.preencherCorrida(corrida, puntoventaDAO.obtenerID(params.getPuntoVentaId()));
|
||||||
|
|
||||||
|
DetalheCorridaVO vo = new DetalheCorridaVO();
|
||||||
|
vo.setLsTramoVO(corrida.getLsTramoVO());
|
||||||
|
vo.setLsSecuenciaVO(corrida.getLsSecuenciaVO());
|
||||||
|
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,110 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.service;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.rjconsultores.routing.ReadOnlyConnection;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaLinhaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaServicoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.FormaPagoDet;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcada;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.rest.bean.ParamsSincronizarOperador;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.corrida.CorridaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.FormaPagamentoVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.OperadorEmbarcadaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.SeguroTaxaEmbarqueVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.TiposPassagensBloqueadasVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.ruta.RutaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
@Service("consultarOperadorService")
|
||||||
|
public class ConsultarOperadorService {
|
||||||
|
private static Logger log = org.slf4j.LoggerFactory.getLogger(ConsultarOperadorService.class);
|
||||||
|
|
||||||
|
@ReadOnlyConnection
|
||||||
|
public OperadorEmbarcadaVO buscarDadosOperador(ParamsSincronizarOperador params) {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmm");
|
||||||
|
|
||||||
|
Date dtIni = null;
|
||||||
|
Date dtFim = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
dtIni = sdf.parse(params.getDataInicial());
|
||||||
|
dtFim = sdf.parse(params.getDataFinal());
|
||||||
|
} catch (ParseException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
OperadorEmbarcadaDAO operadorEmbarcadaDAO = (OperadorEmbarcadaDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaDAO");
|
||||||
|
OperadorEmbarcadaLinhaDAO operadorEmbarcadaLinhaDAO = (OperadorEmbarcadaLinhaDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaLinhaDAO");
|
||||||
|
OperadorEmbarcadaServicoDAO operadorEmbarcadaServicoDAO = (OperadorEmbarcadaServicoDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaServicoDAO");
|
||||||
|
OperadorEmbarcada operadorEmbarcada = operadorEmbarcadaDAO.buscarOperadorEmbarcadaPorUsuario(params.getOperador());
|
||||||
|
|
||||||
|
PuntoVentaVO puntoVentaVO = operadorEmbarcadaDAO.getPuntoVentaVO(params.getOperador());
|
||||||
|
|
||||||
|
List<RutaVO> lsRutaVO = operadorEmbarcadaLinhaDAO.getListaRutaVO(params.getOperador());
|
||||||
|
|
||||||
|
List<CorridaVO> lsCorridaVO = operadorEmbarcadaServicoDAO.getListaCorridaProxyVO(params.getOperador(), params.getEmpresa(), dtIni, dtFim);
|
||||||
|
|
||||||
|
OperadorEmbarcadaVO vo = new OperadorEmbarcadaVO();
|
||||||
|
vo.setIdOperador(operadorEmbarcada.getUsuarioId());
|
||||||
|
vo.setOperador(operadorEmbarcada.getUsername());
|
||||||
|
vo.setDescOperador(operadorEmbarcada.getName());
|
||||||
|
|
||||||
|
if (puntoVentaVO != null) {
|
||||||
|
vo.setIdAgencia(puntoVentaVO.getPuntoventaId());
|
||||||
|
vo.setDescAgencia(puntoVentaVO.nombpuntoventa);
|
||||||
|
|
||||||
|
vo.setLsFormasPagamento(new ArrayList<FormaPagamentoVO>());
|
||||||
|
vo.setLsSeguroTaxaEmbarque(new ArrayList<SeguroTaxaEmbarqueVO>());
|
||||||
|
vo.setLsTiposPassagensBloqueadas(new ArrayList<TiposPassagensBloqueadasVO>());
|
||||||
|
|
||||||
|
List<FormaPagoDet> listFP = operadorEmbarcadaDAO.getListaFormaPago(puntoVentaVO.getPuntoventaId());
|
||||||
|
|
||||||
|
for (FormaPagoDet dp : listFP) {
|
||||||
|
vo.getLsFormasPagamento().add(
|
||||||
|
new FormaPagamentoVO(
|
||||||
|
dp.getEmpresa().getEmpresaId(),
|
||||||
|
dp.getEmpresa().getNombempresa(),
|
||||||
|
dp.getFormaPago().getFormapagoId().intValue(),
|
||||||
|
dp.getFormaPago().getDescpago()));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PtoVtaSeguro> listSTx = operadorEmbarcadaDAO.getListaSeguroTaxaEmbarque(puntoVentaVO.getPuntoventaId());
|
||||||
|
|
||||||
|
for (PtoVtaSeguro st : listSTx) {
|
||||||
|
vo.getLsSeguroTaxaEmbarque().add(
|
||||||
|
new SeguroTaxaEmbarqueVO(
|
||||||
|
st.getEmpresa().getEmpresaId(),
|
||||||
|
st.getIndVendeSeguroOpcEmbarcada(),
|
||||||
|
st.getIndVendeSeguroTabelaEmbarcada(),
|
||||||
|
st.getIndTaxaEmbarqueEmbarcada()));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PtovtaCatInd> listTPB = operadorEmbarcadaDAO.getListaTiposPassagensBloqueadas(puntoVentaVO.getPuntoventaId());
|
||||||
|
|
||||||
|
for (PtovtaCatInd tpb : listTPB) {
|
||||||
|
vo.getLsTiposPassagensBloqueadas().add(
|
||||||
|
new TiposPassagensBloqueadasVO(
|
||||||
|
tpb.getCategoria().getCategoriaId(),
|
||||||
|
tpb.getUsuarioBloqueado().getUsuarioId(),
|
||||||
|
tpb.getEmpresa().getEmpresaId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vo.setLsRutas(lsRutaVO);
|
||||||
|
vo.setLsCorridas(lsCorridaVO);
|
||||||
|
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.service;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.rjconsultores.routing.ReadOnlyConnection;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaLinhaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.OperadorEmbarcadaServicoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.FormaPagoDet;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.OperadorEmbarcada;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PtovtaCatInd;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVentaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.rest.bean.ParamsSincronizarOperador;
|
||||||
|
import com.rjconsultores.ventaboletos.rest.service.exception.ServiceEmbarcadaException;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.corrida.CorridaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.FormaPagamentoVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.OperadorEmbarcadaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.SeguroTaxaEmbarqueVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.TiposPassagensBloqueadasVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.ruta.RutaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
@Service("sincronizarOperadorService")
|
||||||
|
public class SincronizarOperadorService {
|
||||||
|
private static Logger log = org.slf4j.LoggerFactory.getLogger(SincronizarOperadorService.class);
|
||||||
|
|
||||||
|
@ReadOnlyConnection
|
||||||
|
public OperadorEmbarcadaVO buscarDadosOperador(ParamsSincronizarOperador params) throws ServiceEmbarcadaException {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmm");
|
||||||
|
|
||||||
|
Date dtIni = null;
|
||||||
|
Date dtFim = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
dtIni = sdf.parse(params.getDataInicial());
|
||||||
|
dtFim = sdf.parse(params.getDataFinal());
|
||||||
|
} catch (ParseException e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
OperadorEmbarcadaDAO operadorEmbarcadaDAO = (OperadorEmbarcadaDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaDAO");
|
||||||
|
OperadorEmbarcadaLinhaDAO operadorEmbarcadaLinhaDAO = (OperadorEmbarcadaLinhaDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaLinhaDAO");
|
||||||
|
OperadorEmbarcadaServicoDAO operadorEmbarcadaServicoDAO = (OperadorEmbarcadaServicoDAO)AppContext.getApplicationContext().getBean("operadorEmbarcadaServicoDAO");
|
||||||
|
PuntoVentaDAO puntoventaDAO = (PuntoVentaDAO)AppContext.getApplicationContext().getBean("puntoVentaDAO");
|
||||||
|
OperadorEmbarcada operadorEmbarcada;
|
||||||
|
try{
|
||||||
|
operadorEmbarcada = operadorEmbarcadaDAO.buscarOperadorEmbarcadaPorUsuario(params.getOperador());
|
||||||
|
} catch (Exception e){
|
||||||
|
throw new ServiceEmbarcadaException("Error: Buscar Operador Embarcada por Usuario retornou mais de um registro.");
|
||||||
|
}
|
||||||
|
// List<OperadorEmbarcadaLinha> lsOperadorEmbarcadaLinha = operadorEmbarcadaLinhaDAO.buscarPorOperador(operadorEmbarcada);
|
||||||
|
|
||||||
|
PuntoVentaVO puntoVentaVO = operadorEmbarcadaDAO.getPuntoVentaVO(params.getOperador());
|
||||||
|
|
||||||
|
List<RutaVO>lsRutaVO = operadorEmbarcadaLinhaDAO.getListaRutaVO(params.getOperador());
|
||||||
|
|
||||||
|
List<CorridaVO>lsCorridaVO = operadorEmbarcadaServicoDAO.getListaCorridaVO(params.getOperador(), params.getEmpresa(), dtIni, dtFim, puntoventaDAO.obtenerID(puntoVentaVO.getPuntoventaId()));
|
||||||
|
|
||||||
|
OperadorEmbarcadaVO vo = new OperadorEmbarcadaVO();
|
||||||
|
vo.setIdOperador(operadorEmbarcada.getUsuarioId());
|
||||||
|
vo.setOperador(operadorEmbarcada.getUsername());
|
||||||
|
vo.setDescOperador(operadorEmbarcada.getName());
|
||||||
|
vo.setIndcorteautomatico(operadorEmbarcada.getUsuario().getIndCorteAutomatico());
|
||||||
|
|
||||||
|
if (puntoVentaVO != null) {
|
||||||
|
vo.setIdAgencia(puntoVentaVO.getPuntoventaId());
|
||||||
|
vo.setDescAgencia(puntoVentaVO.nombpuntoventa);
|
||||||
|
|
||||||
|
vo.setLsFormasPagamento(new ArrayList<FormaPagamentoVO>());
|
||||||
|
vo.setLsSeguroTaxaEmbarque(new ArrayList<SeguroTaxaEmbarqueVO>());
|
||||||
|
vo.setLsTiposPassagensBloqueadas(new ArrayList<TiposPassagensBloqueadasVO>());
|
||||||
|
|
||||||
|
List<FormaPagoDet> listFP = operadorEmbarcadaDAO.getListaFormaPago(puntoVentaVO.getPuntoventaId());
|
||||||
|
|
||||||
|
for (FormaPagoDet dp : listFP) {
|
||||||
|
vo.getLsFormasPagamento().add(
|
||||||
|
new FormaPagamentoVO(
|
||||||
|
dp.getEmpresa().getEmpresaId(),
|
||||||
|
dp.getEmpresa().getNombempresa(),
|
||||||
|
dp.getFormaPago().getFormapagoId().intValue(),
|
||||||
|
dp.getFormaPago().getDescpago()));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PtoVtaSeguro> listSTx = operadorEmbarcadaDAO.getListaSeguroTaxaEmbarque(puntoVentaVO.getPuntoventaId());
|
||||||
|
|
||||||
|
for (PtoVtaSeguro st : listSTx) {
|
||||||
|
vo.getLsSeguroTaxaEmbarque().add(
|
||||||
|
new SeguroTaxaEmbarqueVO(
|
||||||
|
st.getEmpresa().getEmpresaId(),
|
||||||
|
st.getIndVendeSeguroOpcEmbarcada(),
|
||||||
|
st.getIndVendeSeguroTabelaEmbarcada(),
|
||||||
|
st.getIndTaxaEmbarqueEmbarcada()));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PtovtaCatInd> listTPB = operadorEmbarcadaDAO.getListaTiposPassagensBloqueadas(puntoVentaVO.getPuntoventaId());
|
||||||
|
|
||||||
|
for (PtovtaCatInd tpb : listTPB) {
|
||||||
|
vo.getLsTiposPassagensBloqueadas().add(
|
||||||
|
new TiposPassagensBloqueadasVO(
|
||||||
|
tpb.getCategoria().getCategoriaId(),
|
||||||
|
tpb.getUsuarioBloqueado().getUsuarioId(),
|
||||||
|
tpb.getEmpresa().getEmpresaId()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vo.setLsRutas(lsRutaVO);
|
||||||
|
vo.setLsCorridas(lsCorridaVO);
|
||||||
|
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.rjconsultores.routing.ReadOnlyConnection;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.rest.bean.ParamsDadosOperador;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
@Service("sincronizarOperadoresService")
|
||||||
|
public class SincronizarOperadoresService {
|
||||||
|
|
||||||
|
@ReadOnlyConnection
|
||||||
|
public List<UsuarioEmbarcadaVO> buscarDadosOperador(ParamsDadosOperador params) {
|
||||||
|
PuntoVentaDAO puntoVentaDAO = (PuntoVentaDAO)AppContext.getApplicationContext().getBean("puntoVentaDAO");
|
||||||
|
return puntoVentaDAO.buscaUsuariosDoPuntoVenta(params.getPuntoVentaId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,123 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.rjconsultores.routing.ReadOnlyConnection;
|
||||||
|
import com.rjconsultores.ventaboletos.constantes.Constantes;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ConstanteDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.DispositivoEmbarcadaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.EmpresaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Constante;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.CtrlSerieEmbarcada;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcada;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.EmpresaImposto;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.InscricaoEstadual;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PtovtaEmpresa;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.rest.bean.ParamsSincronizarDispositivo;
|
||||||
|
import com.rjconsultores.ventaboletos.rest.service.exception.ServiceEmbarcadaException;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.DispositivoEmbarcadaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.EmpresaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.EstadoDispositivoEmbarcadaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.InscricaoEstadualVO;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
@Service("sincronizarService")
|
||||||
|
public class SincronizarService {
|
||||||
|
|
||||||
|
@ReadOnlyConnection
|
||||||
|
public DispositivoEmbarcadaVO getDispositivoEmbarcada(ParamsSincronizarDispositivo params) throws ServiceEmbarcadaException {
|
||||||
|
DispositivoEmbarcadaDAO dispositivoEmbarcadaDAO = (DispositivoEmbarcadaDAO)AppContext.getApplicationContext().getBean("dispositivoEmbarcadaDAO");
|
||||||
|
EmpresaDAO empresaDAO = (EmpresaDAO)AppContext.getApplicationContext().getBean("empresaDAO");
|
||||||
|
PuntoVentaDAO puntoVentaDAO = (PuntoVentaDAO)AppContext.getApplicationContext().getBean("puntoVentaDAO");
|
||||||
|
DispositivoEmbarcada dispositivo = dispositivoEmbarcadaDAO.buscarImei(params.getImei());
|
||||||
|
ConstanteDAO constanteDAO = (ConstanteDAO)AppContext.getApplicationContext().getBean("constanteDAO");
|
||||||
|
|
||||||
|
if (dispositivo == null){
|
||||||
|
DispositivoEmbarcadaVO dispositivoVo = new DispositivoEmbarcadaVO();
|
||||||
|
dispositivoVo.setMsg("Dispositivo não encontrado");
|
||||||
|
return dispositivoVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(dispositivo.getPuntoVenta().getPuntoventaId().intValue());
|
||||||
|
Empresa empresa = empresaDAO.obtenerID(dispositivo.getEmpresa().getEmpresaId().intValue());
|
||||||
|
|
||||||
|
DispositivoEmbarcadaVO vo = new DispositivoEmbarcadaVO();
|
||||||
|
vo.setDispositivoId(dispositivo.getDispositivoEmbarcadaId());
|
||||||
|
vo.setBaixado(dispositivo.getIndDispBaixado() ? 1 : 0);
|
||||||
|
vo.setBloqueado(dispositivo.getIndDispBloqueado() ? 1 : 0);
|
||||||
|
vo.setDescAgencia(puntoVenta.getNombpuntoventa());
|
||||||
|
vo.setNumagencia(puntoVenta.getNumPuntoVenta());
|
||||||
|
vo.setDescEmpresa(empresa.getNombempresa());
|
||||||
|
vo.setDescEquipamento(dispositivo.getDescricao());
|
||||||
|
vo.setIdAgencia(dispositivo.getPuntoVenta().getPuntoventaId().longValue());
|
||||||
|
vo.setIdempresa(dispositivo.getEmpresa().getEmpresaId().longValue());
|
||||||
|
vo.setManutencao(dispositivo.getIndDispManutencao() ? 1 : 0);
|
||||||
|
vo.setCnpjAgencia(puntoVenta.getNumDoCPuntoVenta());
|
||||||
|
vo.setEnderecoAgencia(puntoVenta.getDireccioncalle()+", nº: "+puntoVenta.getDireccionnumero()+". Cidade: "+puntoVenta.getCidade());
|
||||||
|
vo.setCnpjEmpresa(empresa.getCnpj());
|
||||||
|
|
||||||
|
Map<Estado, EmpresaImposto> impostos = getImpostos(empresa);
|
||||||
|
|
||||||
|
for (PtovtaEmpresa e : puntoVenta.getLsPtovtaEmpresa()){
|
||||||
|
EmpresaVO emp = new EmpresaVO();
|
||||||
|
emp.setEmpresaId(e.getEmpresa().getEmpresaId().longValue());
|
||||||
|
emp.setNombempresa(e.getEmpresa().getNombempresa());
|
||||||
|
emp.setCnpj(e.getEmpresa().getCnpj());
|
||||||
|
emp.setIndImprimeRelFechamentoViagemDetalhadoEmarcada(e.getEmpresa().getIndImprimeRelFechamentoViagemDetalhadoEmarcada() != null ? e.getEmpresa().getIndImprimeRelFechamentoViagemDetalhadoEmarcada() : Boolean.FALSE);
|
||||||
|
emp.setIndImprimeLogoBilheteVendaEmbarcada(e.getEmpresa().getIndImprimeLogoBilheteVendaEmbarcada() != null ? e.getEmpresa().getIndImprimeLogoBilheteVendaEmbarcada() : Boolean.FALSE);
|
||||||
|
vo.getEmpresasVenda().add(emp);
|
||||||
|
for (InscricaoEstadual insc : e.getEmpresa().getInscricoesEstaduais()){
|
||||||
|
EmpresaImposto imposto = impostos.get(insc.getEstado());
|
||||||
|
InscricaoEstadualVO ie;
|
||||||
|
if (insc.getActivo()){
|
||||||
|
ie = new InscricaoEstadualVO(insc);
|
||||||
|
if (imposto != null) {
|
||||||
|
ie.setPorctributo(imposto.getPorctributo());
|
||||||
|
ie.setTributacaoImportacao(imposto.getTributacaoImportacao());
|
||||||
|
ie.setTributacaoImportacaoIM(imposto.getTributacaoImportacaoIM());
|
||||||
|
}
|
||||||
|
emp.getInscricoesEstaduais().add(ie);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vo.setEnderecoEmpresa(empresa.getLogradouro()+", nº: "+empresa.getNumero()+". Cidade: "+empresa.getBairro());
|
||||||
|
Constante estacionEmbarcadaConst = constanteDAO.buscarPorNomeConstante(Constantes.ESTACAO_EMBARCADA);
|
||||||
|
|
||||||
|
if (estacionEmbarcadaConst == null || (estacionEmbarcadaConst != null && estacionEmbarcadaConst.getValorconstante() == null) ||
|
||||||
|
(estacionEmbarcadaConst != null && estacionEmbarcadaConst.getValorconstante().isEmpty())){
|
||||||
|
throw new ServiceEmbarcadaException("Error: Constante ESTACAO_EMBARCADA não cadastrada!");
|
||||||
|
}
|
||||||
|
|
||||||
|
String estacionIdEmbarcada = estacionEmbarcadaConst.getValorconstante();
|
||||||
|
vo.setEstacionId(estacionIdEmbarcada != null && !estacionIdEmbarcada.isEmpty() ? Integer.parseInt(estacionIdEmbarcada) : null);
|
||||||
|
|
||||||
|
for (CtrlSerieEmbarcada serie : dispositivo.getSeries()){
|
||||||
|
EstadoDispositivoEmbarcadaVO estado = new EstadoDispositivoEmbarcadaVO();
|
||||||
|
estado.setDescUf(serie.getEstado().getCveestado());
|
||||||
|
estado.setIdUf(serie.getEstado().getEstadoId().longValue());
|
||||||
|
estado.setNumBpe(serie.getNumeroCorrente());
|
||||||
|
estado.setSerie(serie.getSerie());
|
||||||
|
vo.add(estado);
|
||||||
|
}
|
||||||
|
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<Estado, EmpresaImposto> getImpostos(Empresa e){
|
||||||
|
Map<Estado, EmpresaImposto> result = new HashMap<Estado, EmpresaImposto>();
|
||||||
|
|
||||||
|
for (EmpresaImposto ei : e.getEmpresaImpostoList()) {
|
||||||
|
if (ei.getActivo()) {
|
||||||
|
result.put(ei.getEstado(), ei);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.rjconsultores.routing.ReadOnlyConnection;
|
||||||
|
import com.rjconsultores.ventaboletos.dao.UsuarioDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.rest.bean.ParamsSincronizarUsuarios;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.embarcada.UsuarioEmbarcadaVO;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
@Service("sincronizarUsuariosControleEmbarqueService")
|
||||||
|
public class SincronizarUsuariosControleEmbarqueService {
|
||||||
|
|
||||||
|
@ReadOnlyConnection
|
||||||
|
public List<UsuarioEmbarcadaVO> buscarUsuariosControleEmbarque(ParamsSincronizarUsuarios params) {
|
||||||
|
UsuarioDAO usuarioDAO = (UsuarioDAO) AppContext.getApplicationContext().getBean("usuarioDAO");
|
||||||
|
return usuarioDAO.buscarPorFuncionSistema(params.getFuncionId());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.rjconsultores.ventaboletos.rest.service.exception;
|
||||||
|
|
||||||
|
public class ServiceEmbarcadaException extends Exception {
|
||||||
|
private static final long serialVersionUID = 8226405077123451667L;
|
||||||
|
|
||||||
|
public ServiceEmbarcadaException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.rjconsultores.ventaboletos.web.utilerias.servlet;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.rest.service.AmbienteService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
public class ReloadDBConnection extends HttpServlet {
|
||||||
|
private static final long serialVersionUID = -2076848353707789950L;
|
||||||
|
|
||||||
|
private PrintWriter out = null;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||||
|
out = resp.getWriter();
|
||||||
|
out.println("<h2>Reload DB Connection</h2>");
|
||||||
|
|
||||||
|
ApplicationProperties.getInstance().readReadOnlyConnection();
|
||||||
|
|
||||||
|
AmbienteService service = (AmbienteService) AppContext.getApplicationContext().getBean("ambienteService");
|
||||||
|
|
||||||
|
out.println("Ambiente: " + service.getAmbienteReadOnly());
|
||||||
|
|
||||||
|
out.println("Processo realizado com sucesso.");
|
||||||
|
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
|
||||||
|
doGet(req, resp);
|
||||||
|
}
|
||||||
|
}
|
|
@ -517,7 +517,19 @@
|
||||||
class="com.rjconsultores.ventaboletos.web.utilerias.spring.ApplicationContextProvider">
|
class="com.rjconsultores.ventaboletos.web.utilerias.spring.ApplicationContextProvider">
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
|
<bean id="dataSource" class="com.rjconsultores.routing.MultipleDataSource" >
|
||||||
|
<property name="targetDataSources">
|
||||||
|
<map key-type="java.lang.String">
|
||||||
|
<entry value-ref="dataSourceWrite" key="dataSourceWrite"></entry>
|
||||||
|
<entry value-ref="dataSourceRead" key="dataSourceRead"></entry>
|
||||||
|
</map>
|
||||||
|
</property>
|
||||||
|
|
||||||
|
<property name="defaultTargetDataSource" ref="dataSourceWrite">
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="dataSourceWrite" class="org.springframework.jndi.JndiObjectFactoryBean">
|
||||||
<property name="resourceRef" value="true" />
|
<property name="resourceRef" value="true" />
|
||||||
<property name="jndiName" value="${database.jndi.name}" />
|
<property name="jndiName" value="${database.jndi.name}" />
|
||||||
</bean>
|
</bean>
|
||||||
|
@ -529,6 +541,11 @@
|
||||||
|
|
||||||
<bean id="app" class="com.rjconsultores.ventaboletos.utilerias.Application" />
|
<bean id="app" class="com.rjconsultores.ventaboletos.utilerias.Application" />
|
||||||
|
|
||||||
|
<aop:aspectj-autoproxy />
|
||||||
|
<context:component-scan base-package="com.rjconsultores.routing" />
|
||||||
|
|
||||||
|
<bean id="readOnlyRouteInterceptor" class="com.rjconsultores.routing.ReadOnlyRouteInterceptor" />
|
||||||
|
|
||||||
<!-- <bean id="dataSource" -->
|
<!-- <bean id="dataSource" -->
|
||||||
<!-- class="org.springframework.jdbc.datasource.DriverManagerDataSource"> -->
|
<!-- class="org.springframework.jdbc.datasource.DriverManagerDataSource"> -->
|
||||||
<!-- <property name="driverClassName" value="${database.driver}" /> -->
|
<!-- <property name="driverClassName" value="${database.driver}" /> -->
|
||||||
|
|
|
@ -3,9 +3,6 @@
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<module name="org.apache.log4j" />
|
<module name="org.apache.log4j" />
|
||||||
</exclusions>
|
</exclusions>
|
||||||
<dependencies>
|
|
||||||
<module name="br.com.rjconsultores.adm" export="true" meta-inf="export"/>
|
|
||||||
</dependencies>
|
|
||||||
</deployment>
|
</deployment>
|
||||||
</jboss-deployment-structure>
|
</jboss-deployment-structure>
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -163,6 +163,13 @@
|
||||||
<servlet-name>ReloadFlyway</servlet-name>
|
<servlet-name>ReloadFlyway</servlet-name>
|
||||||
<servlet-class>com.rjconsultores.ventaboletos.servlet.ReloadFlyway</servlet-class>
|
<servlet-class>com.rjconsultores.ventaboletos.servlet.ReloadFlyway</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
<servlet>
|
||||||
|
<description>
|
||||||
|
</description>
|
||||||
|
<display-name>ReloadDBConnection</display-name>
|
||||||
|
<servlet-name>ReloadDBConnection</servlet-name>
|
||||||
|
<servlet-class>com.rjconsultores.ventaboletos.web.utilerias.servlet.ReloadDBConnection</servlet-class>
|
||||||
|
</servlet>
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>dspLoader</servlet-name>
|
<servlet-name>dspLoader</servlet-name>
|
||||||
<url-pattern>*.dsp</url-pattern>
|
<url-pattern>*.dsp</url-pattern>
|
||||||
|
@ -175,6 +182,10 @@
|
||||||
<servlet-name>ReloadFlyway</servlet-name>
|
<servlet-name>ReloadFlyway</servlet-name>
|
||||||
<url-pattern>/ReloadFlyway</url-pattern>
|
<url-pattern>/ReloadFlyway</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>ReloadDBConnection</servlet-name>
|
||||||
|
<url-pattern>/ReloadDBConnection</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
<!-- /////////// -->
|
<!-- /////////// -->
|
||||||
<!-- Miscellaneous -->
|
<!-- Miscellaneous -->
|
||||||
|
|
Loading…
Reference in New Issue