13750: Método Sincronizar Dispositivo
bug#13750 dev:alberto qua:Rogerio git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@91217 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
4600437d8d
commit
716ba4cd88
|
@ -0,0 +1,58 @@
|
|||
package com.rjconsultores.ventaboletos.rest;
|
||||
|
||||
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.dao.DispositivoEmbarcadaDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.EmpresaDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.CtrlSerieEmbarcada;
|
||||
import com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcada;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.vo.embarcada.DispositivoEmbarcadaVO;
|
||||
import com.rjconsultores.ventaboletos.vo.embarcada.EstadoDispositivoEmbarcadaVO;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||
|
||||
@Path("/sincronizarDispositivo")
|
||||
public class SincronizarDispositivo {
|
||||
|
||||
@GET
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
public DispositivoEmbarcadaVO buscarDispositivo(@QueryParam("imei") String imei) {
|
||||
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(imei);
|
||||
PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(dispositivo.getPuntoVentaId().intValue());
|
||||
Empresa empresa = empresaDAO.obtenerID(dispositivo.getEmpresaId().intValue());
|
||||
|
||||
DispositivoEmbarcadaVO vo = new DispositivoEmbarcadaVO();
|
||||
vo.setBaixado(dispositivo.getIndDispBaixado() ? 1 : 0);
|
||||
vo.setBloqueado(dispositivo.getIndDispBloqueado() ? 1 : 0);
|
||||
vo.setDescAgencia(puntoVenta.getNombpuntoventa());
|
||||
vo.setDescEmpresa(empresa.getNombempresa());
|
||||
vo.setDescEquipamento(dispositivo.getDescricao());
|
||||
vo.setIdAgencia(dispositivo.getPuntoVentaId());
|
||||
vo.setIdempresa(dispositivo.getEmpresaId());
|
||||
vo.setManutencao(dispositivo.getIndDispManutencao() ? 1 : 0);
|
||||
vo.setCnpjAgencia(puntoVenta.getNumDoCPuntoVenta());
|
||||
vo.setEnderecoAgencia(puntoVenta.getDireccioncalle()+", nº: "+puntoVenta.getDireccionnumero()+". Cidade: "+puntoVenta.getCidade());
|
||||
vo.setCnpjEmpresa(empresa.getCnpj());
|
||||
vo.setEnderecoEmpresa(empresa.getLogradouro()+", nº: "+empresa.getNumero()+". Cidade: "+empresa.getBairro());
|
||||
|
||||
for (CtrlSerieEmbarcada serie : dispositivo.getSeries()){
|
||||
EstadoDispositivoEmbarcadaVO estado = new EstadoDispositivoEmbarcadaVO();
|
||||
estado.setDescUf(serie.getEstado().getCveestado());
|
||||
estado.setIdUf(serie.getEstado().getEstadoId().longValue());
|
||||
estado.setNumBpe(serie.getNumeroInicial());
|
||||
estado.setSerie(serie.getSerie());
|
||||
vo.add(estado);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
|
@ -115,8 +115,8 @@
|
|||
<value>com.rjconsultores.ventaboletos.entidad.ConexionCtrlTemp</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.ConexionDescuento</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.ConexionExcepcion</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta
|
||||
</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.ConexionExcepcionRuta</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.CtrlSerieEmbarcada</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.CuponConvenio</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.CuponSecretaria
|
||||
</value>
|
||||
|
@ -126,8 +126,8 @@
|
|||
</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.DepositoBancario
|
||||
</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.DiagramaAutobus
|
||||
</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.DiagramaAutobus</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.DispositivoEmbarcada</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.Division</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.Empleado</value>
|
||||
<value>com.rjconsultores.ventaboletos.entidad.Empresa</value>
|
||||
|
|
Loading…
Reference in New Issue