bug fixed #6091: WS - Buscar Vendas Integração SISARE
Descrição Desenvolver as classes de negócio que respondam à informação do xml em anexo. A princípio, utilizaremos Rest, que é o utilizado na ADM. git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@41985 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
03910f46ca
commit
0f95b29633
|
@ -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<PacoteVO> buscaDatosTickets(Date fecInicial, Date fecFinal);
|
||||
|
||||
}
|
|
@ -3,5 +3,5 @@ package com.rjconsultores.ventaboletos.dao;
|
|||
import com.rjconsultores.ventaboletos.entidad.Pacote;
|
||||
|
||||
public interface PacoteDAO extends GenericDAO<Pacote, Integer> {
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
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.LongType;
|
||||
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.BusquedaDatosTicketDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Pacote;
|
||||
import com.rjconsultores.ventaboletos.vo.busquedapacotes.DatosTicketResultTransformer;
|
||||
import com.rjconsultores.ventaboletos.vo.busquedapacotes.PacoteVO;
|
||||
|
||||
@Repository("busquedaDatosTicketDAO")
|
||||
public class BusquedaDatosTicketHibernateDAO extends GenericHibernateDAO<Pacote, Integer> implements BusquedaDatosTicketDAO {
|
||||
|
||||
private static Logger log = org.slf4j.LoggerFactory.getLogger(BusquedaDatosTicketHibernateDAO.class);
|
||||
|
||||
@Autowired
|
||||
public BusquedaDatosTicketHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PacoteVO> buscaDatosTickets(Date fecInicial, Date fecFinal) {
|
||||
|
||||
StringBuilder sql = new StringBuilder("");
|
||||
|
||||
sql.append("SELECT blt.boleto_id as \"boletoId\", ")
|
||||
.append("blt.numfoliosistema as \"numBoleto\", ")
|
||||
.append("blt.categoria_id as \"categoriaId\", ")
|
||||
.append("ctg.desccategoria as \"categoria\", ")
|
||||
.append("blt.origen_id as \"origenId\", ")
|
||||
.append("blt.destino_id as \"destinoId\", ")
|
||||
.append("blt.nombpasajero as \"nombPasajero\", ")
|
||||
.append("blt.fechorviaje as \"fechorViaje\", ")
|
||||
.append("blt.fechorventa as \"fechorVenta\", ")
|
||||
.append("blt.numoperacion as \"numOperacion\", ")
|
||||
.append("blt.tipoidentificacion_id as \"tipoIdentificacionId\", ")
|
||||
.append("blt.numidentificacion as \"numIdentificacion\", ")
|
||||
.append("blt.usuario_id as \"usuarioId\", ")
|
||||
.append("fpg.cvepago as \"cvePago\", ")
|
||||
.append("fpg.descpago as \"descPago\", ")
|
||||
.append("bfp.importe as \"importe\" ")
|
||||
.append("FROM boleto blt, ")
|
||||
.append("categoria ctg, ")
|
||||
.append("boleto_formapago bfp, ")
|
||||
.append("forma_pago fpg ")
|
||||
.append("WHERE bfp.boleto_id = blt.boleto_id ")
|
||||
.append("AND blt.categoria_id = ctg.categoria_id ")
|
||||
.append("AND bfp.formapago_id = fpg.formapago_id ")
|
||||
.append("AND blt.motivocancelacion_id is null ")
|
||||
.append("AND blt.indstatusoperacion = 'F' ")
|
||||
.append("AND blt.activo = 1 ")
|
||||
.append("AND blt.fechorviaje BETWEEN :fechaInicial AND :fechaFinal ")
|
||||
.append("ORDER BY bfp.boleto_id desc ");
|
||||
|
||||
SQLQuery query = getSession().createSQLQuery(sql.toString())
|
||||
.addScalar("boletoId", LongType.INSTANCE)
|
||||
.addScalar("numBoleto", StringType.INSTANCE)
|
||||
.addScalar("categoriaId", IntegerType.INSTANCE)
|
||||
.addScalar("categoria", StringType.INSTANCE)
|
||||
.addScalar("origenId", IntegerType.INSTANCE)
|
||||
.addScalar("destinoId", IntegerType.INSTANCE)
|
||||
.addScalar("nombPasajero", StringType.INSTANCE)
|
||||
.addScalar("fechorViaje", DateType.INSTANCE)
|
||||
.addScalar("fechorVenta", DateType.INSTANCE)
|
||||
.addScalar("numOperacion", StringType.INSTANCE)
|
||||
.addScalar("tipoIdentificacionId", IntegerType.INSTANCE)
|
||||
.addScalar("numIdentificacion", StringType.INSTANCE)
|
||||
.addScalar("usuarioId", IntegerType.INSTANCE)
|
||||
.addScalar("cvePago", StringType.INSTANCE)
|
||||
.addScalar("descPago", StringType.INSTANCE)
|
||||
.addScalar("importe", BigDecimalType.INSTANCE)
|
||||
;
|
||||
|
||||
query.setResultTransformer(new DatosTicketResultTransformer());
|
||||
|
||||
query.setParameter("fechaInicial", fecInicial, DateType.INSTANCE)
|
||||
.setParameter("fechaFinal", fecFinal, DateType.INSTANCE);
|
||||
|
||||
List<PacoteVO> pacotes = new ArrayList<PacoteVO>();
|
||||
|
||||
try{
|
||||
pacotes = query.list();
|
||||
}catch(Exception ex){
|
||||
log.error("", ex);
|
||||
return null;
|
||||
}
|
||||
|
||||
return pacotes;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -11,9 +12,14 @@ import com.rjconsultores.ventaboletos.entidad.Pacote;
|
|||
@Repository("pacoteDAO")
|
||||
public class PacoteHibernateDAO extends GenericHibernateDAO<Pacote, Integer> implements PacoteDAO {
|
||||
|
||||
private static Logger log = org.slf4j.LoggerFactory.getLogger(PacoteHibernateDAO.class);
|
||||
|
||||
@Autowired
|
||||
public PacoteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,273 @@
|
|||
package com.rjconsultores.ventaboletos.vo.busquedapacotes;
|
||||
|
||||
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;
|
||||
|
||||
public class DatosTicketResultTransformer implements ResultTransformer {
|
||||
|
||||
@Override
|
||||
public List<PacoteVO> transformList(List mapList) {
|
||||
|
||||
Map<String, PacoteVO> pacotes = new HashMap<String, PacoteVO>();
|
||||
|
||||
for(Object objmap : mapList ){
|
||||
|
||||
Map<String, Object> tupleMap = (Map<String, Object>) objmap;
|
||||
|
||||
String numOperacao = (String) tupleMap.get("numOperacion");
|
||||
|
||||
if(!pacotes.containsKey(numOperacao)){
|
||||
|
||||
PacoteVO pacote = new PacoteVO();
|
||||
|
||||
setDatosPacote(pacote, tupleMap);
|
||||
|
||||
pacotes.put(numOperacao, pacote);
|
||||
}
|
||||
|
||||
PacoteVO pacote = pacotes.get(numOperacao);
|
||||
|
||||
setServico(pacote, tupleMap);
|
||||
|
||||
setFormasPagamento(pacote, tupleMap);
|
||||
}
|
||||
|
||||
List<PacoteVO> pacotesList = new ArrayList<PacoteVO>();
|
||||
pacotesList.addAll(pacotes.values());
|
||||
|
||||
return pacotesList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object transformTuple(Object[] data, String[] aliases) {
|
||||
|
||||
Map<String,Object> row = new HashMap<String,Object>();
|
||||
|
||||
for(int index = 0; index < aliases.length; index++){
|
||||
row.put(aliases[index], data[index]);
|
||||
}
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
private void setDatosPacote(PacoteVO pacote, Map<String, Object> tupleMap){
|
||||
|
||||
String numoperacao = (String) tupleMap.get("numOperacion");
|
||||
pacote.setNumoperacao(numoperacao);
|
||||
|
||||
Integer usuariovenda = (Integer) tupleMap.get("usuarioId");
|
||||
pacote.setUsuariovenda(usuariovenda);
|
||||
|
||||
Date datavenda = (Date)tupleMap.get("fechorVenta");
|
||||
pacote.setDatavenda(datavenda);
|
||||
|
||||
}
|
||||
|
||||
private void setFormasPagamento(PacoteVO pacote, Map<String, Object> tupleMap){
|
||||
|
||||
Pagamento pagamento = new Pagamento();
|
||||
pagamento.setMoeda("R$");
|
||||
|
||||
BigDecimal valorPagamento = (BigDecimal)tupleMap.get("importe");
|
||||
pagamento.setValor(valorPagamento);
|
||||
|
||||
String cvePago = (String)tupleMap.get("cvePago");
|
||||
|
||||
boolean isVentaCartaoCredito = isVentaCartaoCredito(cvePago);
|
||||
boolean isVentaCartaoDebito = isVentaCartaoDebito(cvePago);
|
||||
|
||||
if(isVentaCartaoCredito || isVentaCartaoDebito){
|
||||
PagamentoCartao pgtoCartao = new PagamentoCartao();
|
||||
Integer tipo = (isVentaCartaoCredito) ? PagamentoCartao.TIPO_CREDITO : PagamentoCartao.TIPO_DEBITO;
|
||||
pgtoCartao.setTipo(tipo);
|
||||
pgtoCartao.setBandeira(getBandeiraCartao(cvePago));
|
||||
pagamento.setCartao(pgtoCartao);
|
||||
pagamento.setFormapagamento("CARTAO");
|
||||
} else {
|
||||
String descPago = (String)tupleMap.get("descPago");
|
||||
pagamento.setFormapagamento(descPago);
|
||||
}
|
||||
|
||||
pacote.setValortotal(pacote.getValortotal().add(valorPagamento));
|
||||
|
||||
pacote.getFormaspagamento().add(pagamento);
|
||||
}
|
||||
|
||||
private boolean isVentaCartaoCredito(String cvePago){
|
||||
return PagamentoCartao.CREDITO.equals(cvePago)
|
||||
|| PagamentoCartao.VISA_CREDITO.equals(cvePago)
|
||||
|| PagamentoCartao.MASTER_CREDITO.equals(cvePago);
|
||||
}
|
||||
|
||||
private boolean isVentaCartaoDebito(String cvePago){
|
||||
return PagamentoCartao.DEBITO.equals(cvePago)
|
||||
|| PagamentoCartao.VISA_ELECTRON.equals(cvePago)
|
||||
|| PagamentoCartao.MAESTRO.equals(cvePago);
|
||||
}
|
||||
|
||||
private boolean isVentaCartaoVisa(String cvePago){
|
||||
return PagamentoCartao.MAESTRO.equals(cvePago)
|
||||
|| PagamentoCartao.MASTER_CREDITO.equals(cvePago);
|
||||
}
|
||||
|
||||
private boolean isVentaDebitoMaster(String cvePago){
|
||||
return PagamentoCartao.VISA_ELECTRON.equals(cvePago)
|
||||
|| PagamentoCartao.VISA_CREDITO.equals(cvePago);
|
||||
}
|
||||
|
||||
private String getBandeiraCartao(String cvePago){
|
||||
String bandeiraCartao = "";
|
||||
|
||||
if(isVentaCartaoVisa(cvePago)){
|
||||
bandeiraCartao = "VISA";
|
||||
}else if(isVentaDebitoMaster(cvePago)){
|
||||
bandeiraCartao = "MASTERCARD";
|
||||
} else {
|
||||
bandeiraCartao = String.format("OUTROS(%s)",cvePago);
|
||||
}
|
||||
|
||||
return bandeiraCartao;
|
||||
}
|
||||
|
||||
private void setServico(PacoteVO pacote, Map<String, Object> tupleMap){
|
||||
|
||||
Servico servico = pacote.getServico();
|
||||
servico = (servico == null) ? new Servico() : servico;
|
||||
|
||||
Date dataviagem = (Date)tupleMap.get("fechorViaje");
|
||||
servico.setDataviagem(dataviagem);
|
||||
|
||||
setDatosPassageiro(servico, pacote, tupleMap);
|
||||
|
||||
Integer quantidade = pacote.getQuantidade();
|
||||
pacote.setQuantidade(++quantidade);
|
||||
|
||||
Integer origenId = (Integer)tupleMap.get("origenId");
|
||||
servico.setLocalorigem(origenId);
|
||||
|
||||
Date fechorViaje = (Date)tupleMap.get("fechorViaje");
|
||||
servico.setDataviagem(fechorViaje);
|
||||
|
||||
pacote.setServico(servico);
|
||||
}
|
||||
|
||||
private void setDatosPassageiro(Servico servico, PacoteVO pacote, Map<String, Object> tupleMap){
|
||||
|
||||
Passageiro passageiro = new Passageiro();
|
||||
|
||||
String docPassageiro = (String) tupleMap.get("numIdentificacion");
|
||||
passageiro.setDocumento(docPassageiro);
|
||||
|
||||
String nomePassageiro = (String) tupleMap.get("nombPasajero");
|
||||
passageiro.setNome(nomePassageiro);
|
||||
|
||||
Long boletoId = (Long) tupleMap.get("boletoId");
|
||||
passageiro.setBoletoId(boletoId);
|
||||
|
||||
String numBoleto = (String) tupleMap.get("numBoleto");
|
||||
passageiro.setNumboleto(numBoleto);
|
||||
|
||||
setCategoriaPassageiro(passageiro, tupleMap);
|
||||
|
||||
List<Passageiro> pax = servico.getPax();
|
||||
|
||||
if(!pax.contains(passageiro)){
|
||||
pax.add(passageiro);
|
||||
}
|
||||
}
|
||||
|
||||
private void setCategoriaPassageiro(Passageiro passageiro, Map<String, Object> tupleMap){
|
||||
|
||||
Integer categoriaId = (Integer) tupleMap.get("categoriaId");
|
||||
String categoria = (String) tupleMap.get("categoria");
|
||||
String categoriaWS = "";
|
||||
|
||||
if(isCategoriaAdult(categoriaId)){
|
||||
|
||||
categoriaWS = Passageiro.CATEGORIA_ADULT;
|
||||
|
||||
}else if(isCategoriaInfant(categoriaId)){
|
||||
|
||||
categoriaWS = Passageiro.CATEGORIA_INFANT;
|
||||
|
||||
}else if(isCategoriaChild(categoriaId)){
|
||||
|
||||
categoriaWS = Passageiro.CATEGORIA_CHILD;
|
||||
|
||||
}else if(isCategoriaSenior(categoriaId)){
|
||||
|
||||
categoriaWS = Passageiro.CATEGORIA_SENIOR;
|
||||
|
||||
}else{
|
||||
categoriaWS = String.format("%s-%s", categoriaId.toString(), categoria);
|
||||
}
|
||||
|
||||
passageiro.setCategoria(categoriaWS);
|
||||
|
||||
}
|
||||
|
||||
private boolean isCategoriaSenior(Integer categoriaId){
|
||||
|
||||
return (Passageiro.CATEGORIA_IDOSO_100 == categoriaId
|
||||
|| Passageiro.CATEGORIA_IDOSO_50 == categoriaId
|
||||
|| Passageiro.CATEGORIA_IDOSO_CE == categoriaId
|
||||
|| Passageiro.CATEGORIA_IDOSO_MA == categoriaId
|
||||
|| Passageiro.CATEGORIA_IDOSO_50_MA == categoriaId
|
||||
|| Passageiro.CATEGORIA_IDOSO_100_PB_BIL == categoriaId
|
||||
|| Passageiro.CATEGORIA_IDOSO_50_PB_BIL == categoriaId
|
||||
|| Passageiro.CATEGORIA_IDOSO_100_SP == categoriaId
|
||||
|| Passageiro.CATEGORIA_IDOSO_100_GO == categoriaId
|
||||
|| Passageiro.CATEGORIA_IDOSO_50_GO == categoriaId
|
||||
|| Passageiro.CATEGORIA_IDOSO_100_TO == categoriaId
|
||||
|| Passageiro.CATEGORIA_IDOSO_50_TO == categoriaId);
|
||||
}
|
||||
|
||||
private boolean isCategoriaAdult(Integer categoriaId){
|
||||
|
||||
return (Passageiro.CATEGORIA_DEFICIENTE == categoriaId
|
||||
|| Passageiro.CATEGORIA_DEFICIENTE_GO == categoriaId
|
||||
|| Passageiro.CATEGORIA_DEFICIENTE_TO == categoriaId
|
||||
|| Passageiro.CATEGORIA_DEFICIENTE_PB == categoriaId
|
||||
|| Passageiro.CATEGORIA_DEFICIENTE_BA == categoriaId
|
||||
|| Passageiro.CATEGORIA_DEFICIENTE_MA == categoriaId
|
||||
|| Passageiro.CATEGORIA_DEFICIENTE_PI == categoriaId
|
||||
|| Passageiro.CATEGORIA_ESTUDANTE == categoriaId
|
||||
|| Passageiro.CATEGORIA_ESTUDANTE_PB == categoriaId
|
||||
|| Passageiro.CATEGORIA_ESTUDANTE_CE_LIBERCAD == categoriaId
|
||||
|| Passageiro.CATEGORIA_FISCAL_DO_TRABALHO == categoriaId
|
||||
|| Passageiro.CATEGORIA_OPERADOR_A_TRABALHO == categoriaId
|
||||
|| Passageiro.CATEGORIA_PRF == categoriaId
|
||||
|| Passageiro.CATEGORIA_POL_MILITAR_MA == categoriaId
|
||||
|| Passageiro.CATEGORIA_MILITAR_PI_POL == categoriaId
|
||||
|| Passageiro.CATEGORIA_CE_PM_BOMBEIRO == categoriaId
|
||||
|| Passageiro.CATEGORIA_CE_DETRAN == categoriaId
|
||||
|| Passageiro.CATEGORIA_MA_OFI_JUSTICA == categoriaId
|
||||
|| Passageiro.CATEGORIA_ERFP == categoriaId
|
||||
|| Passageiro.CATEGORIA_MA_SINFRA == categoriaId
|
||||
|| Passageiro.CATEGORIA_SINDICATO_PB == categoriaId
|
||||
|| Passageiro.CATEGORIA_SINDICATO_CE == categoriaId
|
||||
|| Passageiro.CATEGORIA_SINDICATO_PI == categoriaId
|
||||
|| Passageiro.CATEGORIA_PB_PORTADOR_DE_CA == categoriaId
|
||||
|| Passageiro.CATEGORIA_PB_ACOMP_PORT_CA == categoriaId
|
||||
|| Passageiro.CATEGORIA_PB_INTEG_PARAIBA == categoriaId
|
||||
|| Passageiro.CATEGORIA_CORTESIA_AFETIVIDADE == categoriaId
|
||||
|| Passageiro.CATEGORIA_CORTESIA_EMPRESA == categoriaId
|
||||
|| Passageiro.CATEGORIA_NORMAL == categoriaId );
|
||||
}
|
||||
|
||||
private boolean isCategoriaInfant(Integer categoriaId){
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isCategoriaChild(Integer categoriaId){
|
||||
|
||||
return (Passageiro.CATEGORIA_CRIANCA_GRATUIDADE == categoriaId);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
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.XmlType;
|
||||
|
||||
@XmlRootElement(name="pacote")
|
||||
@XmlType(propOrder={"datavenda", "numoperacao", "quantidade", "usuariovenda", "valortotal", "valordesconto", "status", "formaspagamento", "servico"})
|
||||
public class PacoteVO {
|
||||
|
||||
private Date datavenda;
|
||||
private String numoperacao;
|
||||
private Integer quantidade = 0;
|
||||
private Integer usuariovenda;
|
||||
private BigDecimal valortotal = BigDecimal.ZERO;
|
||||
private BigDecimal valordesconto;
|
||||
private String status;
|
||||
|
||||
private List<Pagamento> formaspagamento = new ArrayList<Pagamento>();
|
||||
|
||||
private Servico servico;
|
||||
|
||||
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=Pagamento.class)
|
||||
public List<Pagamento> getFormaspagamento() {
|
||||
return formaspagamento;
|
||||
}
|
||||
|
||||
public void setFormaspagamento(List<Pagamento> formaspagamento) {
|
||||
this.formaspagamento = formaspagamento;
|
||||
}
|
||||
|
||||
public Servico getServico() {
|
||||
return servico;
|
||||
}
|
||||
|
||||
public void setServico(Servico servico) {
|
||||
this.servico = servico;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.rjconsultores.ventaboletos.vo.busquedapacotes;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
@XmlRootElement(name="pagamento")
|
||||
@XmlType(propOrder={"formapagamento", "moeda", "valor", "cartao"})
|
||||
public class Pagamento {
|
||||
|
||||
private String formapagamento;
|
||||
private String moeda;
|
||||
private BigDecimal valor;
|
||||
private PagamentoCartao cartao;
|
||||
|
||||
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 PagamentoCartao getCartao() {
|
||||
return cartao;
|
||||
}
|
||||
public void setCartao(PagamentoCartao cartao) {
|
||||
this.cartao = cartao;
|
||||
}
|
||||
public BigDecimal getValor() {
|
||||
return valor;
|
||||
}
|
||||
public void setValor(BigDecimal valor) {
|
||||
this.valor = valor;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.rjconsultores.ventaboletos.vo.busquedapacotes;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name="cartao")
|
||||
public class PagamentoCartao {
|
||||
|
||||
public static final String DINHEIRO="DI";
|
||||
public static final String DOLAR="DO";
|
||||
|
||||
public static final String CREDITO="CR";
|
||||
public static final String DEBITO="DE";
|
||||
public static final String VISA_CREDITO="CM";
|
||||
public static final String VISA_ELECTRON="DM";
|
||||
public static final String MASTER_CREDITO="RC";
|
||||
public static final String MAESTRO="RD";
|
||||
|
||||
public static final String CORTESIA="CO";
|
||||
public static final String TROCA_DE_PASSGEM="TP";
|
||||
public static final String ORDEM_DE_SERVIC="OS";
|
||||
public static final String PASSAGENS_SRVP="PS";
|
||||
public static final String CORTESIA_SINTETI="CS";
|
||||
public static final String REIMPRESSAO_DE_PASSAGEM="RP";
|
||||
public static final String IMPRESSAO_PASSAGEM="IM";
|
||||
public static final String IMPRESSAO_CALL_CENTER="CC";
|
||||
public static final String IMPRESSÃO_INTERNET="II";
|
||||
|
||||
public static final int TIPO_CREDITO = 1;
|
||||
public static final int TIPO_DEBITO = 2;
|
||||
|
||||
// <!-- 1-credito/2-debito -->
|
||||
private Integer tipo;
|
||||
private String bandeira;
|
||||
|
||||
public Integer getTipo() {
|
||||
return tipo;
|
||||
}
|
||||
public void setTipo(Integer tipo) {
|
||||
this.tipo = tipo;
|
||||
}
|
||||
public String getBandeira() {
|
||||
return bandeira;
|
||||
}
|
||||
public void setBandeira(String bandeira) {
|
||||
this.bandeira = bandeira;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
package com.rjconsultores.ventaboletos.vo.busquedapacotes;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
@XmlRootElement(name="passageiro")
|
||||
public class Passageiro {
|
||||
|
||||
public static final String CATEGORIA_ADULT = "ADT";
|
||||
public static final String CATEGORIA_CHILD = "CHD";
|
||||
public static final String CATEGORIA_INFANT = "INF";
|
||||
public static final String CATEGORIA_SENIOR = "SEN";
|
||||
|
||||
public static final int CATEGORIA_NORMAL=1;
|
||||
|
||||
public static final int CATEGORIA_CRIANCA_GRATUIDADE=52;
|
||||
|
||||
public static final int CATEGORIA_ESTUDANTE=22;
|
||||
public static final int CATEGORIA_ESTUDANTE_PB=38;
|
||||
public static final int CATEGORIA_ESTUDANTE_CE_LIBERCAD=49;
|
||||
|
||||
public static final int CATEGORIA_CORTESIA_AFETIVIDADE=20;
|
||||
public static final int CATEGORIA_CORTESIA_EMPRESA=21;
|
||||
|
||||
public static final int CATEGORIA_FISCAL_DO_TRABALHO=24;
|
||||
public static final int CATEGORIA_OPERADOR_A_TRABALHO=29;
|
||||
|
||||
public static final int CATEGORIA_PRF=23;
|
||||
public static final int CATEGORIA_POL_MILITAR_MA=32;
|
||||
public static final int CATEGORIA_MILITAR_PI_POL=37;
|
||||
public static final int CATEGORIA_CE_PM_BOMBEIRO=46;
|
||||
public static final int CATEGORIA_CE_DETRAN=48;
|
||||
public static final int CATEGORIA_MA_OFI_JUSTICA=30;
|
||||
|
||||
public static final int CATEGORIA_ERFP=25;
|
||||
|
||||
public static final int CATEGORIA_MA_SINFRA=31;
|
||||
|
||||
public static final int CATEGORIA_SINDICATO_PB=40;
|
||||
public static final int CATEGORIA_SINDICATO_CE=50;
|
||||
public static final int CATEGORIA_SINDICATO_PI=51;
|
||||
|
||||
public static final int CATEGORIA_PB_PORTADOR_DE_CA=43;
|
||||
public static final int CATEGORIA_PB_ACOMP_PORT_CA=44;
|
||||
public static final int CATEGORIA_PB_INTEG_PARAIBA=45;
|
||||
|
||||
public static final int CATEGORIA_IDOSO_100=12;
|
||||
public static final int CATEGORIA_IDOSO_50=13;
|
||||
public static final int CATEGORIA_IDOSO_CE=47;
|
||||
public static final int CATEGORIA_IDOSO_MA=34;
|
||||
public static final int CATEGORIA_IDOSO_50_MA=35;
|
||||
public static final int CATEGORIA_IDOSO_100_PB_BIL=41;
|
||||
public static final int CATEGORIA_IDOSO_50_PB_BIL=42;
|
||||
public static final int CATEGORIA_IDOSO_100_SP=27;
|
||||
public static final int CATEGORIA_IDOSO_100_GO=15;
|
||||
public static final int CATEGORIA_IDOSO_50_GO=16;
|
||||
public static final int CATEGORIA_IDOSO_100_TO=18;
|
||||
public static final int CATEGORIA_IDOSO_50_TO=19;
|
||||
|
||||
public static final int CATEGORIA_DEFICIENTE=11;
|
||||
public static final int CATEGORIA_DEFICIENTE_GO=14;
|
||||
public static final int CATEGORIA_DEFICIENTE_TO=17;
|
||||
public static final int CATEGORIA_DEFICIENTE_PB=39;
|
||||
public static final int CATEGORIA_DEFICIENTE_BA=26;
|
||||
public static final int CATEGORIA_DEFICIENTE_MA=33;
|
||||
public static final int CATEGORIA_DEFICIENTE_PI=36;
|
||||
|
||||
|
||||
private Long boletoId;
|
||||
private String numboleto;
|
||||
private String nome;
|
||||
private String documento;
|
||||
// ADT|CHD|INF|SEN
|
||||
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;
|
||||
}
|
||||
public String getNumboleto() {
|
||||
return numboleto;
|
||||
}
|
||||
public void setNumboleto(String numboleto) {
|
||||
this.numboleto = numboleto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
Passageiro param = (Passageiro)obj;
|
||||
return this.boletoId.equals(param.getBoletoId());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
package com.rjconsultores.ventaboletos.vo.busquedapacotes;
|
||||
|
||||
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;
|
||||
|
||||
@XmlRootElement
|
||||
public class Servico {
|
||||
|
||||
private Integer localorigem;
|
||||
private Date dataviagem;
|
||||
private Date horario;
|
||||
private Date horarioapanhe;
|
||||
private Boolean faturado;
|
||||
private String observacoes;
|
||||
|
||||
private List<Passageiro> pax = new ArrayList<Passageiro>();
|
||||
|
||||
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 Boolean getFaturado() {
|
||||
return faturado;
|
||||
}
|
||||
|
||||
public void setFaturado(Boolean faturado) {
|
||||
this.faturado = faturado;
|
||||
}
|
||||
|
||||
public String getObservacoes() {
|
||||
return observacoes;
|
||||
}
|
||||
|
||||
public void setObservacoes(String observacoes) {
|
||||
this.observacoes = observacoes;
|
||||
}
|
||||
|
||||
@XmlElementWrapper
|
||||
@XmlElement(name="passageiro", type=Passageiro.class)
|
||||
public List<Passageiro> getPax() {
|
||||
return pax;
|
||||
}
|
||||
|
||||
public void setPax(List<Passageiro> pax) {
|
||||
this.pax = pax;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
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 com.rjconsultores.ventaboletos.dao.BusquedaDatosTicketDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.CajaDAO;
|
||||
import com.rjconsultores.ventaboletos.vo.busquedapacotes.PacoteVO;
|
||||
import com.rjconsultores.ventaboletos.vo.caja.UsuarioVO;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||
|
||||
@Path("")
|
||||
public class BusquedaDatosTicketsRS {
|
||||
|
||||
@GET
|
||||
@Path("/busquedadatostickets")
|
||||
@Produces({ MediaType.APPLICATION_XML })
|
||||
public List<PacoteVO> busquedaDatosTickets(@QueryParam("fecinicial") String fechaIniParam, @QueryParam("fecfinal") String fechaFinParam) throws ParseException{
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||
|
||||
Date fecInicial = sdf.parse(fechaIniParam);
|
||||
Date fecFinal = sdf.parse(fechaFinParam);
|
||||
|
||||
BusquedaDatosTicketDAO pacoteDao = (BusquedaDatosTicketDAO)AppContext.getApplicationContext().getBean("busquedaDatosTicketDAO");
|
||||
List<PacoteVO> pacotes = pacoteDao.buscaDatosTickets(fecInicial, fecFinal);
|
||||
|
||||
return pacotes;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue