fixes bug #6543
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@46647 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
8dbf2f6a08
commit
37e4b1483a
|
@ -0,0 +1,12 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClientePacote;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO;
|
||||||
|
|
||||||
|
public interface ClientePacoteDAO extends GenericDAO<ClientePacote, Long> {
|
||||||
|
|
||||||
|
public List<ClientePacoteVO> busquedaDatosClientePacote(String cpfCnpj);
|
||||||
|
|
||||||
|
}
|
|
@ -37,57 +37,56 @@ public class BusquedaDatosTicketHibernateDAO extends GenericHibernateDAO<Pacote,
|
||||||
StringBuilder sql = new StringBuilder("");
|
StringBuilder sql = new StringBuilder("");
|
||||||
|
|
||||||
sql.append("SELECT blt.boleto_id as \"boletoId\", ")
|
sql.append("SELECT blt.boleto_id as \"boletoId\", ")
|
||||||
.append("blt.numfoliosistema as \"numBoleto\", ")
|
.append("blt.numfoliosistema as \"numBoleto\", ")
|
||||||
.append("blt.categoria_id as \"categoriaId\", ")
|
.append("blt.categoria_id as \"categoriaId\", ")
|
||||||
.append("ctg.desccategoria as \"categoria\", ")
|
.append("ctg.desccategoria as \"categoria\", ")
|
||||||
.append("blt.origen_id as \"origenId\", ")
|
.append("blt.origen_id as \"origenId\", ")
|
||||||
.append("blt.destino_id as \"destinoId\", ")
|
.append("blt.destino_id as \"destinoId\", ")
|
||||||
.append("blt.nombpasajero as \"nombPasajero\", ")
|
.append("blt.nombpasajero as \"nombPasajero\", ")
|
||||||
.append("blt.fechorviaje as \"fechorViaje\", ")
|
.append("blt.fechorviaje as \"fechorViaje\", ")
|
||||||
.append("blt.fechorventa as \"fechorVenta\", ")
|
.append("blt.fechorventa as \"fechorVenta\", ")
|
||||||
.append("blt.numoperacion as \"numOperacion\", ")
|
.append("blt.numoperacion as \"numOperacion\", ")
|
||||||
.append("blt.tipoidentificacion_id as \"tipoIdentificacionId\", ")
|
.append("blt.tipoidentificacion_id as \"tipoIdentificacionId\", ")
|
||||||
.append("blt.numidentificacion as \"numIdentificacion\", ")
|
.append("blt.numidentificacion as \"numIdentificacion\", ")
|
||||||
.append("blt.usuario_id as \"usuarioId\", ")
|
.append("blt.usuario_id as \"usuarioId\", ")
|
||||||
.append("fpg.cvepago as \"cvePago\", ")
|
.append("fpg.cvepago as \"cvePago\", ")
|
||||||
.append("fpg.descpago as \"descPago\", ")
|
.append("fpg.descpago as \"descPago\", ")
|
||||||
.append("bfp.importe as \"importe\" ")
|
.append("bfp.importe as \"importe\" ")
|
||||||
.append("FROM boleto blt, ")
|
.append("FROM boleto blt, ")
|
||||||
.append("categoria ctg, ")
|
.append("categoria ctg, ")
|
||||||
.append("boleto_formapago bfp, ")
|
.append("boleto_formapago bfp, ")
|
||||||
.append("forma_pago fpg ")
|
.append("forma_pago fpg ")
|
||||||
.append("WHERE bfp.boleto_id = blt.boleto_id ")
|
.append("WHERE bfp.boleto_id = blt.boleto_id ")
|
||||||
.append("AND blt.categoria_id = ctg.categoria_id ")
|
.append("AND blt.categoria_id = ctg.categoria_id ")
|
||||||
.append("AND bfp.formapago_id = fpg.formapago_id ")
|
.append("AND bfp.formapago_id = fpg.formapago_id ")
|
||||||
.append("AND blt.motivocancelacion_id is null ")
|
.append("AND blt.motivocancelacion_id is null ")
|
||||||
.append("AND blt.indstatusoperacion = 'F' ")
|
.append("AND blt.indstatusoperacion = 'F' ")
|
||||||
.append("AND blt.activo = 1 ")
|
.append("AND blt.activo = 1 ")
|
||||||
.append("AND blt.fechorviaje BETWEEN :fechaInicial AND :fechaFinal ")
|
.append("AND blt.fechorviaje BETWEEN :fechaInicial AND :fechaFinal ")
|
||||||
.append("ORDER BY bfp.boleto_id desc ");
|
.append("ORDER BY bfp.boleto_id desc ");
|
||||||
|
|
||||||
SQLQuery query = getSession().createSQLQuery(sql.toString())
|
SQLQuery query = getSession().createSQLQuery(sql.toString())
|
||||||
.addScalar("boletoId", LongType.INSTANCE)
|
.addScalar("boletoId", LongType.INSTANCE)
|
||||||
.addScalar("numBoleto", StringType.INSTANCE)
|
.addScalar("numBoleto", StringType.INSTANCE)
|
||||||
.addScalar("categoriaId", IntegerType.INSTANCE)
|
.addScalar("categoriaId", IntegerType.INSTANCE)
|
||||||
.addScalar("categoria", StringType.INSTANCE)
|
.addScalar("categoria", StringType.INSTANCE)
|
||||||
.addScalar("origenId", IntegerType.INSTANCE)
|
.addScalar("origenId", IntegerType.INSTANCE)
|
||||||
.addScalar("destinoId", IntegerType.INSTANCE)
|
.addScalar("destinoId", IntegerType.INSTANCE)
|
||||||
.addScalar("nombPasajero", StringType.INSTANCE)
|
.addScalar("nombPasajero", StringType.INSTANCE)
|
||||||
.addScalar("fechorViaje", DateType.INSTANCE)
|
.addScalar("fechorViaje", DateType.INSTANCE)
|
||||||
.addScalar("fechorVenta", DateType.INSTANCE)
|
.addScalar("fechorVenta", DateType.INSTANCE)
|
||||||
.addScalar("numOperacion", StringType.INSTANCE)
|
.addScalar("numOperacion", StringType.INSTANCE)
|
||||||
.addScalar("tipoIdentificacionId", IntegerType.INSTANCE)
|
.addScalar("tipoIdentificacionId", IntegerType.INSTANCE)
|
||||||
.addScalar("numIdentificacion", StringType.INSTANCE)
|
.addScalar("numIdentificacion", StringType.INSTANCE)
|
||||||
.addScalar("usuarioId", IntegerType.INSTANCE)
|
.addScalar("usuarioId", IntegerType.INSTANCE)
|
||||||
.addScalar("cvePago", StringType.INSTANCE)
|
.addScalar("cvePago", StringType.INSTANCE)
|
||||||
.addScalar("descPago", StringType.INSTANCE)
|
.addScalar("descPago", StringType.INSTANCE)
|
||||||
.addScalar("importe", BigDecimalType.INSTANCE)
|
.addScalar("importe", BigDecimalType.INSTANCE);
|
||||||
;
|
|
||||||
|
|
||||||
query.setResultTransformer(new DatosTicketResultTransformer());
|
query.setResultTransformer(new DatosTicketResultTransformer());
|
||||||
|
|
||||||
query.setParameter("fechaInicial", fecInicial, DateType.INSTANCE)
|
query.setParameter("fechaInicial", fecInicial, DateType.INSTANCE)
|
||||||
.setParameter("fechaFinal", fecFinal, DateType.INSTANCE);
|
.setParameter("fechaFinal", fecFinal, DateType.INSTANCE);
|
||||||
|
|
||||||
List<PacoteVO> pacotes = new ArrayList<PacoteVO>();
|
List<PacoteVO> pacotes = new ArrayList<PacoteVO>();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.hibernate.Query;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ClientePacoteDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ClientePacote;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO;
|
||||||
|
|
||||||
|
@Repository("clientePacoteDAO")
|
||||||
|
public class ClientePacoteHibernateDAO extends GenericHibernateDAO<ClientePacote, Long> implements ClientePacoteDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ClientePacoteHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public List<ClientePacoteVO> busquedaDatosClientePacote(String cpfCnpj) {
|
||||||
|
List<ClientePacoteVO> clientePacoteVOs = new ArrayList<ClientePacoteVO>();
|
||||||
|
if(StringUtils.isNotBlank(cpfCnpj)) {
|
||||||
|
Map<String, Object> parametros = new HashMap<String, Object>();
|
||||||
|
StringBuilder sQuery = new StringBuilder();
|
||||||
|
sQuery.append("SELECT DISTINCT NEW com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO(cp.razaoSocial, cp.cpfCnpj, cp.tipoPessoa, cp.descemail, cp.desctelefone, cp.descfax, cp.cep, ")
|
||||||
|
.append("cp.endereco, cp.numero, cp.complemento, cp.pais, cp.estado, cp.cidade, cp.bairro) ")
|
||||||
|
.append("FROM ClientePacote cp ");
|
||||||
|
|
||||||
|
if(StringUtils.isNotBlank(cpfCnpj)) {
|
||||||
|
sQuery.append("WHERE cp.cpfCnpj = :cpfCnpj ");
|
||||||
|
parametros.put("cpfCnpj", cpfCnpj.replaceAll("[^0-9]", ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
sQuery.append("ORDER BY cp.razaoSocial ");
|
||||||
|
Query qr = getSession().createQuery(sQuery.toString());
|
||||||
|
for (Entry<String, Object> parametro : parametros.entrySet()) {
|
||||||
|
qr.setParameter(parametro.getKey(), parametro.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
clientePacoteVOs = qr.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
return clientePacoteVOs;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,163 @@
|
||||||
|
package com.rjconsultores.ventaboletos.vo.busquedapacotes;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import javax.xml.bind.annotation.XmlType;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.enums.TipoPessoa;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "cliente")
|
||||||
|
@XmlType(propOrder = {"razaoSocial", "cpfCnpj", "tipoPessoa", "descemail", "desctelefone", "descfax", "endereco", "numero", "complemento",
|
||||||
|
"bairro", "cidade", "estado", "cep", "pais"})
|
||||||
|
public class ClientePacoteVO {
|
||||||
|
|
||||||
|
private String razaoSocial;
|
||||||
|
private String cpfCnpj;
|
||||||
|
private String tipoPessoa;
|
||||||
|
private String descemail;
|
||||||
|
private String desctelefone;
|
||||||
|
private String descfax;
|
||||||
|
private String endereco;
|
||||||
|
private String numero;
|
||||||
|
private String complemento;
|
||||||
|
private String bairro;
|
||||||
|
private String cidade;
|
||||||
|
private String estado;
|
||||||
|
private String cep;
|
||||||
|
private String pais;
|
||||||
|
|
||||||
|
public ClientePacoteVO() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientePacoteVO(String razaoSocial, String cpfCnpj, TipoPessoa tipoPessoa, String descemail, String desctelefone, String descfax, String cep,
|
||||||
|
String endereco, String numero, String complemento, String pais, String estado, String cidade, String bairro) {
|
||||||
|
this();
|
||||||
|
setRazaoSocial(razaoSocial);
|
||||||
|
setCpfCnpj(cpfCnpj);
|
||||||
|
setTipoPessoa(tipoPessoa.toString());
|
||||||
|
setDescemail(descemail);
|
||||||
|
setDesctelefone(desctelefone);
|
||||||
|
setDescfax(descfax);
|
||||||
|
setCep(cep);
|
||||||
|
setEndereco(endereco);
|
||||||
|
setNumero(numero);
|
||||||
|
setComplemento(complemento);
|
||||||
|
setPais(pais);
|
||||||
|
setEstado(estado);
|
||||||
|
setCidade(cidade);
|
||||||
|
setBairro(bairro);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRazaoSocial() {
|
||||||
|
return razaoSocial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRazaoSocial(String razaoSocial) {
|
||||||
|
this.razaoSocial = razaoSocial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCpfCnpj() {
|
||||||
|
return cpfCnpj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCpfCnpj(String cpfCnpj) {
|
||||||
|
this.cpfCnpj = cpfCnpj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTipoPessoa() {
|
||||||
|
return tipoPessoa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTipoPessoa(String tipoPessoa) {
|
||||||
|
this.tipoPessoa = tipoPessoa;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescemail() {
|
||||||
|
return descemail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescemail(String descemail) {
|
||||||
|
this.descemail = descemail;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesctelefone() {
|
||||||
|
return desctelefone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDesctelefone(String desctelefone) {
|
||||||
|
this.desctelefone = desctelefone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescfax() {
|
||||||
|
return descfax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescfax(String descfax) {
|
||||||
|
this.descfax = descfax;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCep() {
|
||||||
|
return cep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCep(String cep) {
|
||||||
|
this.cep = cep;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEndereco() {
|
||||||
|
return endereco;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndereco(String endereco) {
|
||||||
|
this.endereco = endereco;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getNumero() {
|
||||||
|
return numero;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumero(String numero) {
|
||||||
|
this.numero = numero;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getComplemento() {
|
||||||
|
return complemento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setComplemento(String complemento) {
|
||||||
|
this.complemento = complemento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPais() {
|
||||||
|
return pais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPais(String pais) {
|
||||||
|
this.pais = pais;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEstado() {
|
||||||
|
return estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEstado(String estado) {
|
||||||
|
this.estado = estado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCidade() {
|
||||||
|
return cidade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCidade(String cidade) {
|
||||||
|
this.cidade = cidade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBairro() {
|
||||||
|
return bairro;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBairro(String bairro) {
|
||||||
|
this.bairro = bairro;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -11,7 +11,10 @@ import org.hibernate.transform.ResultTransformer;
|
||||||
|
|
||||||
public class DatosTicketResultTransformer implements ResultTransformer {
|
public class DatosTicketResultTransformer implements ResultTransformer {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
public List<PacoteVO> transformList(List mapList) {
|
public List<PacoteVO> transformList(List mapList) {
|
||||||
|
|
||||||
Map<String, PacoteVO> pacotes = new HashMap<String, PacoteVO>();
|
Map<String, PacoteVO> pacotes = new HashMap<String, PacoteVO>();
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.rjconsultores.ventaboletos.ws.rs;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.QueryParam;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ClientePacoteDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.vo.busquedapacotes.ClientePacoteVO;
|
||||||
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
|
@Path("")
|
||||||
|
public class BusquedaDatosClientePacoteRS {
|
||||||
|
|
||||||
|
private static Logger log = LoggerFactory.getLogger(BusquedaDatosClientePacoteRS.class);
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/busquedadatosclientepacote")
|
||||||
|
@Produces({ MediaType.APPLICATION_XML })
|
||||||
|
public List<ClientePacoteVO> busquedaDatosClientePacote(@QueryParam("cpfcnpj") String cpfCnpjParam) {
|
||||||
|
try {
|
||||||
|
ClientePacoteDAO clientePacoteDao = (ClientePacoteDAO)AppContext.getApplicationContext().getBean("clientePacoteDAO");
|
||||||
|
return clientePacoteDao.busquedaDatosClientePacote(cpfCnpjParam);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e.getCause());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -12,9 +12,7 @@ import javax.ws.rs.QueryParam;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.dao.BusquedaDatosTicketDAO;
|
import com.rjconsultores.ventaboletos.dao.BusquedaDatosTicketDAO;
|
||||||
import com.rjconsultores.ventaboletos.dao.CajaDAO;
|
|
||||||
import com.rjconsultores.ventaboletos.vo.busquedapacotes.PacoteVO;
|
import com.rjconsultores.ventaboletos.vo.busquedapacotes.PacoteVO;
|
||||||
import com.rjconsultores.ventaboletos.vo.caja.UsuarioVO;
|
|
||||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||||
|
|
||||||
@Path("")
|
@Path("")
|
||||||
|
|
Loading…
Reference in New Issue