fix bug #6937
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@51197 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d2b5898dc1
commit
6653ba8e54
|
@ -5,9 +5,11 @@ import java.util.List;
|
|||
|
||||
import com.rjconsultores.ventaboletos.vo.caja.CajaVO;
|
||||
import com.rjconsultores.ventaboletos.vo.caja.UsuarioVO;
|
||||
import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO;
|
||||
|
||||
public interface CajaDAO {
|
||||
public List<CajaVO> buscarCajaFecha(boolean yaCerrado, Date fechaDesde, Date fechaHasta);
|
||||
public List<UsuarioVO> buscarCajaCerrado(Date fecha, String cveusuario, String turnoid);
|
||||
List<UsuarioVO> buscarUsuarioCerrado(Date fecha);
|
||||
public boolean gerarVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.rjconsultores.ventaboletos.vo.caja.CajaCerradoVO;
|
|||
import com.rjconsultores.ventaboletos.vo.caja.CajaVO;
|
||||
import com.rjconsultores.ventaboletos.vo.caja.ReceitaDespesaVO;
|
||||
import com.rjconsultores.ventaboletos.vo.caja.UsuarioVO;
|
||||
import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO;
|
||||
|
||||
@Repository("cajaDAO")
|
||||
public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implements CajaDAO {
|
||||
|
@ -174,4 +175,159 @@ public class CajaHibernateDAO extends GenericHibernateDAO<Object, Long> implemen
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean gerarVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) {
|
||||
boolean statusBoleto = inserirBoletoVendaEmbarcada(vendaEmbarcada);
|
||||
boolean statusBoletoFormaPago = inserirBoletoFormaPagoVendaEmbarcada(vendaEmbarcada);
|
||||
boolean statusCaja = inserirCajaVendaEmbarcada(vendaEmbarcada);
|
||||
boolean statusCajaFormaPago = inserirCajaFormaPagoVendaEmbarcada(vendaEmbarcada);
|
||||
|
||||
return statusBoleto && statusCaja && statusCajaFormaPago && statusBoletoFormaPago;
|
||||
}
|
||||
|
||||
private boolean inserirCajaVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada){
|
||||
|
||||
SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirCajaVendaEmbarcada());
|
||||
|
||||
vendaEmbarcada.setCajaId(obterIdCaja().longValue());
|
||||
|
||||
query.setLong("cajaId", vendaEmbarcada.getCajaId());
|
||||
query.setString("numAsiento", vendaEmbarcada.getNumAsiento());
|
||||
query.setInteger("categoriaId", vendaEmbarcada.getCategoriaId());
|
||||
query.setInteger("claseServicioId", vendaEmbarcada.getClaseServicioId());
|
||||
query.setInteger("marcaId",vendaEmbarcada.getMarcaId());
|
||||
query.setInteger("origemId",vendaEmbarcada.getOrigemId());
|
||||
query.setInteger("destinoId",vendaEmbarcada.getDestinoId());
|
||||
query.setInteger("corridaId",vendaEmbarcada.getCorridaId());
|
||||
query.setDate("fecCorrida",vendaEmbarcada.getFecCorrida());
|
||||
query.setBigDecimal("precioBase",vendaEmbarcada.getPrecio());
|
||||
query.setBigDecimal("precioPagado",vendaEmbarcada.getPrecio());
|
||||
query.setInteger("tipoVentaId",vendaEmbarcada.getTipoVentaId());
|
||||
query.setDate("fechorViaje",vendaEmbarcada.getFechorViaje());
|
||||
query.setDate("fechorVenta",vendaEmbarcada.getFechorVenta());
|
||||
query.setInteger("puntoVentaId",vendaEmbarcada.getPuntoVentaId());
|
||||
query.setString("numOperacion",vendaEmbarcada.getNumOperacion());
|
||||
query.setBigInteger("empresaPuntoVentaId",vendaEmbarcada.getEmpresaId());
|
||||
query.setBigInteger("empresaCorridaId",vendaEmbarcada.getEmpresaId());
|
||||
query.setInteger("estacionId",vendaEmbarcada.getEstacionId());
|
||||
query.setInteger("usuarioId",vendaEmbarcada.getUsuarioId());
|
||||
query.setBigDecimal("importeTaxaEmbarque",vendaEmbarcada.getImporteTaxaEmbarque());
|
||||
query.setBigDecimal("importePedagio",vendaEmbarcada.getImportePedagio());
|
||||
query.setBigDecimal("importeOutros",vendaEmbarcada.getImporteOutros());
|
||||
query.setBigDecimal("importeSeguro",vendaEmbarcada.getImporteSeguro());
|
||||
query.setDate("fecCreacion", vendaEmbarcada.getFechorVenta());
|
||||
query.setInteger("rutaId", vendaEmbarcada.getRutaId());
|
||||
query.setDate("fecModIf", vendaEmbarcada.getFecModIf());
|
||||
|
||||
return (query.executeUpdate() == 1);
|
||||
}
|
||||
|
||||
private boolean inserirCajaFormaPagoVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada){
|
||||
SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirCajaFormaPagoVendaEmbarcada());
|
||||
|
||||
query.setInteger("formaPagoId", vendaEmbarcada.getFormaPagoId());
|
||||
query.setLong("cajaId", vendaEmbarcada.getCajaId());
|
||||
query.setBigDecimal("importe", vendaEmbarcada.getPrecio());
|
||||
query.setInteger("usuarioId", vendaEmbarcada.getUsuarioId());
|
||||
query.setInteger("cajaFormaPagoId", obterIdCajaFormaPago().intValue());
|
||||
query.setDate("fecModIf", vendaEmbarcada.getFecModIf());
|
||||
|
||||
return (query.executeUpdate() == 1);
|
||||
}
|
||||
|
||||
private boolean inserirBoletoVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada) {
|
||||
SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirBoletoVendaEmbarcada());
|
||||
|
||||
vendaEmbarcada.setBoletoId(obterIdBoleto().longValue());
|
||||
vendaEmbarcada.setNumOperacion(obterNumOperacion().toString());
|
||||
|
||||
query.setBigInteger("empresaCorridaId", vendaEmbarcada.getEmpresaId());
|
||||
query.setInteger("destinoId", vendaEmbarcada.getDestinoId());
|
||||
query.setInteger("tipoVentaId",vendaEmbarcada.getTipoVentaId());
|
||||
query.setInteger("categoriaId",vendaEmbarcada.getCategoriaId());
|
||||
query.setInteger("corridaId", vendaEmbarcada.getCorridaId());
|
||||
query.setInteger("claseServicioId", vendaEmbarcada.getClaseServicioId());
|
||||
query.setDate("fecCorrida", vendaEmbarcada.getFecCorrida());
|
||||
query.setInteger("puntoVentaId", vendaEmbarcada.getPuntoVentaId());
|
||||
query.setBigInteger("empresaPuntoVentaId", vendaEmbarcada.getEmpresaId());
|
||||
query.setInteger("origemId", vendaEmbarcada.getOrigemId());
|
||||
query.setInteger("marcaId", vendaEmbarcada.getMarcaId());
|
||||
query.setString("numAsiento", vendaEmbarcada.getNumAsiento());
|
||||
query.setBigDecimal("precioPagado", vendaEmbarcada.getPrecio());
|
||||
query.setDate("fechorViaje", vendaEmbarcada.getFechorViaje());
|
||||
query.setDate("fechorVenta", vendaEmbarcada.getFechorVenta());
|
||||
query.setString("numOperacion", vendaEmbarcada.getNumOperacion());
|
||||
query.setInteger("usuarioId",vendaEmbarcada.getUsuarioId());
|
||||
query.setBigDecimal("precioBase", vendaEmbarcada.getPrecio());
|
||||
query.setInteger("estacionId", vendaEmbarcada.getEstacionId());
|
||||
query.setBigDecimal("importeTaxaEmbarque", vendaEmbarcada.getImporteTaxaEmbarque());
|
||||
query.setBigDecimal("importePedagio", vendaEmbarcada.getImportePedagio());
|
||||
query.setBigDecimal("importeOutros", vendaEmbarcada.getImporteOutros());
|
||||
query.setBigDecimal("importeSeguro", vendaEmbarcada.getImporteSeguro());
|
||||
query.setInteger("rutaId", vendaEmbarcada.getRutaId());
|
||||
query.setLong("boletoId", vendaEmbarcada.getBoletoId());
|
||||
query.setDate("fecModIf", vendaEmbarcada.getFecModIf());
|
||||
query.setBigDecimal("precioPricing", vendaEmbarcada.getPrecio());
|
||||
|
||||
return (query.executeUpdate() == 1);
|
||||
}
|
||||
|
||||
private boolean inserirBoletoFormaPagoVendaEmbarcada(VendaEmbarcadaVO vendaEmbarcada){
|
||||
SQLQuery query = getSession().createSQLQuery(sqlBuilder.getSQLInserirBoletoFormaPagoVendaEmbarcada());
|
||||
|
||||
query.setInteger("formaPagoId", vendaEmbarcada.getFormaPagoId());
|
||||
query.setLong("boletoId", vendaEmbarcada.getBoletoId());
|
||||
query.setBigDecimal("importe", vendaEmbarcada.getPrecio());
|
||||
query.setDate("fecModIf", vendaEmbarcada.getFecModIf());
|
||||
query.setInteger("usuarioId", vendaEmbarcada.getUsuarioId());
|
||||
query.setBigDecimal("boletoFormaPagoId", obterIdBoletoFormaPago());
|
||||
|
||||
|
||||
return (query.executeUpdate() == 1);
|
||||
}
|
||||
|
||||
private BigDecimal obterIdBoletoFormaPago(){
|
||||
SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceBoletoFormaPago());
|
||||
|
||||
return gerarChave((BigDecimal)sql.uniqueResult());
|
||||
}
|
||||
|
||||
private BigDecimal obterIdCajaFormaPago(){
|
||||
SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCajaFormaPago());
|
||||
|
||||
return gerarChave((BigDecimal)sql.uniqueResult());
|
||||
}
|
||||
|
||||
private BigDecimal obterIdBoleto(){
|
||||
SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCajaFormaPago());
|
||||
|
||||
return gerarChave((BigDecimal)sql.uniqueResult());
|
||||
}
|
||||
|
||||
private BigDecimal obterIdCaja(){
|
||||
SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenceCaja());
|
||||
|
||||
return gerarChave((BigDecimal)sql.uniqueResult());
|
||||
}
|
||||
|
||||
private BigDecimal obterNumOperacion(){
|
||||
SQLQuery sql = getSession().createSQLQuery(sqlBuilder.getSQLObterSequenciaNumOperacion());
|
||||
|
||||
return gerarChave((BigDecimal)sql.uniqueResult());
|
||||
}
|
||||
|
||||
private BigDecimal gerarChave(BigDecimal seq){
|
||||
Integer tamChave = 13;
|
||||
|
||||
String chave = "1";
|
||||
|
||||
--tamChave;
|
||||
|
||||
while ((seq.toString().length() + chave.length()) <= (tamChave)){
|
||||
chave += "0";
|
||||
}
|
||||
|
||||
return new BigDecimal(chave += seq);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,4 +56,57 @@ public interface SQLBuilder {
|
|||
|
||||
public String getSQLBuscarUsuariosActivo();
|
||||
|
||||
/**
|
||||
* Venda Embarcada
|
||||
* @return Retorna a Query para a inserção dos valores da venda na tabela de Caja
|
||||
*/
|
||||
public String getSQLInserirCajaVendaEmbarcada();
|
||||
|
||||
/**
|
||||
* Venda Embarcada
|
||||
* @return Retorna a Query para a inserção dos valores da venda na tabela de CajaFormaPago
|
||||
*/
|
||||
public String getSQLInserirCajaFormaPagoVendaEmbarcada();
|
||||
|
||||
/**
|
||||
* Venda Embarcada
|
||||
* @return Retorna a Query para a inserção dos valores da venda na tabela de Boleto
|
||||
*/
|
||||
public String getSQLInserirBoletoVendaEmbarcada();
|
||||
|
||||
/**
|
||||
* Venda Embarcada
|
||||
* @return Retorna a Query para a inserção dos valores da venda na tabela de BoletoFormaPago
|
||||
*/
|
||||
public String getSQLInserirBoletoFormaPagoVendaEmbarcada();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Retorna o valor gerado pela sequence para a tabela BoletoFormaPago
|
||||
*/
|
||||
public String getSQLObterSequenceBoletoFormaPago();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Retorna o valor gerado pela sequence para a tabela CajaFormaPago
|
||||
*/
|
||||
public String getSQLObterSequenceCajaFormaPago();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Retorna o valor gerado pela sequence da tabela Boleto
|
||||
*/
|
||||
public String getSQLObterSequenceBoleto();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Retorna o valor gerado pela sequence da tabela Caja
|
||||
*/
|
||||
public String getSQLObterSequenceCaja();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Retorna o valor gerado pela sequence do Numero de Operacao
|
||||
*/
|
||||
public String getSQLObterSequenciaNumOperacion();
|
||||
}
|
||||
|
|
|
@ -976,4 +976,104 @@ public class SQLBuilderOracle implements SQLBuilder {
|
|||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLInserirCajaVendaEmbarcada() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("insert into caja ");
|
||||
sb.append("(caja_id, numasiento, categoria_id,numfoliosistema,claseservicio_id, marca_id, origen_id, destino_id, corrida_id, feccorrida,nombpasajero, preciobase, ");
|
||||
sb.append("preciopagado,descuentoamparado, tipoventa_id, numseriepreimpresa, numfoliopreimpreso, fechorviaje, fechorventa, puntoventa_id,numkmviaje, numoperacion,");
|
||||
sb.append("indstatusoperacion,motivocancelacion_id, motivoreimpresion_id, cantpuntos, empresapuntoventa_id, empresacorrida_id, numreservacion, turno_id,");
|
||||
sb.append("indstatusboleto,indcancelacion, indreimpresion,indviajeredondo, feccorte, indextraviado, paridad, feccreacion, conveniodet_id, moneda_id, estacion_id,");
|
||||
sb.append("indreplica, usuarioautorizacion_id, tipoidentificacion_id, numidentificacion,clientefidelidad_id, opcional1, opcional2, opcional3, preciocargoextra,");
|
||||
sb.append("preciopricing, cajaoriginal_id, usuarioremoto_id, puntoventaremoto_id, numdocdescuento, canttransferencia,activo, fecmodif, usuario_id, nodo_id,");
|
||||
sb.append("porccategoria,importecategoria, cliente_id, pagorecaudacion_id, pagorecaudacion2_id, importetaxaembarque, importepedagio, importeoutros,");
|
||||
sb.append("importeseguro, indconexion, levante_id, ruta_id, serieimpfiscal, fecintegracion, ptovtaventa_id, indremotoinverso, fecnacimiento)");
|
||||
sb.append("values (");
|
||||
sb.append(":cajaId,:numAsiento,:categoriaId,null,:claseServicioId,:marcaId,:origemId,:destinoId,:corridaId,:fecCorrida,null,:precioBase,");
|
||||
sb.append(":precioPagado,null, :tipoVentaId, null, null, :fechorViaje, :fechorVenta, :puntoVentaId,null, :numOperacion,");
|
||||
sb.append("'F',null, null, null, :empresaPuntoVentaId, :empresaCorridaId, null, null,");
|
||||
sb.append("'V',null, null, null, null, null, null, :fecCreacion, null, null, :estacionId,");
|
||||
sb.append("null, null, null, null,null, null, null, null, null,");
|
||||
sb.append("null, null, null, null, null, null, 1, :fecModIf, :usuarioId, 1,");
|
||||
sb.append("null, null, null, null, null, :importeTaxaEmbarque, :importePedagio, :importeOutros,");
|
||||
sb.append(":importeSeguro, null, null, :rutaId, null, null, null, null, null)");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLInserirCajaFormaPagoVendaEmbarcada() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("insert into caja_formapago ");
|
||||
sb.append("(formapago_id, caja_id, importe, activo, fecmodif, usuario_id, indreplica, nodo_id, cajaformapago_id) values ");
|
||||
sb.append("(:formaPagoId, :cajaId, :importe, 1, :fecModIf, :usuarioId, null, 1, :cajaFormaPagoId)");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLInserirBoletoVendaEmbarcada() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("insert into boleto ");
|
||||
sb.append("(empresacorrida_id, destino_id, tipoventa_id, categoria_id, motivoreimpresion_id, claseservicio_id, corrida_id, feccorrida, puntoventa_id,");
|
||||
sb.append("empresapuntoventa_id, turno_id, motivocancelacion_id, origen_id, marca_id, conveniodet_id, cliente_id, numasiento, numfoliosistema,");
|
||||
sb.append("nombpasajero,fecnacimiento,preciopagado,paridad, numseriepreimpresa, numfoliopreimpreso, fechorviaje, fechorventa, numkmviaje, numoperacion,");
|
||||
sb.append("indstatusoperacion, cantpuntos, numreservacion, indstatusboleto, indcancelacion, indreimpresion, indviajeredondo, feccreacion, activo,");
|
||||
sb.append("indconexion, fecmodif, usuario_id, usuarioautorizacion_id, tipoidentificacion_id, numidentificacion, indextraviado, preciobase, entregaboleto_id,");
|
||||
sb.append("opcional1,opcional2, opcional3, descuentoamparado, moneda_id, estacion_id, usuarioremoto_id, puntoventaremoto_id, preciocargoextra, nodo_id,");
|
||||
sb.append("indreplica, numdocdescuento, canttransferencia, porccategoria, preciopricing, importecategoria, boletooriginal_id, importetaxaembarque,");
|
||||
sb.append("importepedagio, importeoutros, importeseguro, desctipodoc, desctipodoc2, descnumdoc, descnumdoc2, tipoidentificaciondoc_id, descorgaodoc,");
|
||||
sb.append("NUMFIDELIDAD, INFOPASAJERO, LEVANTE_ID, ESTADOFOLIO_ID, RUTA_ID, DESCCORREO, DESCTELEFONO, SERIEIMPFISCAL,NUMASIENTOVINCULADO, BOLETO_ID) values ");
|
||||
sb.append("(:empresaCorridaId, :destinoId, :tipoVentaId, :categoriaId, null, :claseServicioId, :corridaId, :fecCorrida, :puntoVentaId, ");
|
||||
sb.append(":empresaPuntoVentaId, null, null, :origemId, :marcaId, null, null, :numAsiento, null,");
|
||||
sb.append("null,null,:precioPagado,null,null, null, :fechorViaje, :fechorVenta, null, :numOperacion,");
|
||||
sb.append("'F', null, null, 'V', 0, 0, null, null, 1,");
|
||||
sb.append("null, :fecModIf, :usuarioId,null, null, null, null, :precioBase, null,");
|
||||
sb.append("null,null, null, null, null, :estacionId, null, null, null,1,");
|
||||
sb.append("null, null, null, null, :precioPricing, null, null, :importeTaxaEmbarque,");
|
||||
sb.append(":importePedagio, :importeOutros, :importeSeguro, null, null, null, null, null, null,");
|
||||
sb.append("null, null, null, null, :rutaId, null, null, null,null, :boletoId)");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLInserirBoletoFormaPagoVendaEmbarcada() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("insert into boleto_formapago ");
|
||||
sb.append("(formapago_id, boleto_id, importe, fecmodif, usuario_id, activo, indreplica, nodo_id, boletoformapago_id) values ");
|
||||
sb.append("(:formaPagoId, :boletoId, :importe, :fecModIf, :usuarioId, 1, 0, 1,:boletoFormaPagoId)");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLObterSequenceBoletoFormaPago() {
|
||||
return "select boleto_formapago_seq.nextval from dual";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLObterSequenceCajaFormaPago() {
|
||||
return "select caja_formapago_seq.nextval from dual";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLObterSequenceBoleto() {
|
||||
return "select boleto_seq.nextval from dual";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLObterSequenceCaja() {
|
||||
return "select caja_seq.nextval from dual";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLObterSequenciaNumOperacion() {
|
||||
return "select numeoperacion_seq.nextval from dual";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,273 @@
|
|||
package com.rjconsultores.ventaboletos.vo.caja;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Date;
|
||||
|
||||
public class VendaEmbarcadaVO {
|
||||
private Long cajaId;
|
||||
private String numAsiento;
|
||||
private Integer categoriaId;
|
||||
private Integer claseServicioId;
|
||||
private Integer marcaId;
|
||||
private Integer origemId;
|
||||
private Integer destinoId;
|
||||
private Integer corridaId;
|
||||
private Date fecCorrida;
|
||||
private Integer tipoVentaId;
|
||||
private Date fechorViaje;
|
||||
private Date fechorVenta;
|
||||
private Integer puntoVentaId;
|
||||
private String numOperacion;
|
||||
private Integer empresaPuntoVentaId;
|
||||
private Integer empresaCorridaId;
|
||||
private Integer estacionId;
|
||||
private Integer usuarioId;
|
||||
private Integer clienteId;
|
||||
private BigDecimal precio;
|
||||
private BigDecimal importeTaxaEmbarque;
|
||||
private BigDecimal importePedagio;
|
||||
private BigDecimal importeOutros;
|
||||
private BigDecimal importeSeguro;
|
||||
private Integer rutaId;
|
||||
private Integer formaPagoId;
|
||||
private BigInteger empresaId;
|
||||
private Long boletoId;
|
||||
private Date fecModIf;
|
||||
|
||||
public VendaEmbarcadaVO() {
|
||||
fecModIf = new Date(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public Long getBoletoId() {
|
||||
return boletoId;
|
||||
}
|
||||
|
||||
public void setBoletoId(Long boletoId) {
|
||||
this.boletoId = boletoId;
|
||||
}
|
||||
|
||||
public BigInteger getEmpresaId() {
|
||||
return empresaId;
|
||||
}
|
||||
|
||||
public void setEmpresaId(BigInteger empresaId) {
|
||||
this.empresaId = empresaId;
|
||||
}
|
||||
|
||||
public Integer getFormaPagoId() {
|
||||
return formaPagoId;
|
||||
}
|
||||
|
||||
public void setFormaPagoId(Integer formaPagoId) {
|
||||
this.formaPagoId = formaPagoId;
|
||||
}
|
||||
|
||||
public Long getCajaId() {
|
||||
return cajaId;
|
||||
}
|
||||
|
||||
public void setCajaId(Long cajaId) {
|
||||
this.cajaId = cajaId;
|
||||
}
|
||||
|
||||
public String getNumAsiento() {
|
||||
return numAsiento;
|
||||
}
|
||||
|
||||
public void setNumAsiento(String numAsiento) {
|
||||
this.numAsiento = numAsiento;
|
||||
}
|
||||
|
||||
public Integer getCategoriaId() {
|
||||
return categoriaId;
|
||||
}
|
||||
|
||||
public void setCategoriaId(Integer categoriaId) {
|
||||
this.categoriaId = categoriaId;
|
||||
}
|
||||
|
||||
public Integer getClaseServicioId() {
|
||||
return claseServicioId;
|
||||
}
|
||||
|
||||
public void setClaseServicioId(Integer claseServicioId) {
|
||||
this.claseServicioId = claseServicioId;
|
||||
}
|
||||
|
||||
public Integer getMarcaId() {
|
||||
return marcaId;
|
||||
}
|
||||
|
||||
public void setMarcaId(Integer marcaId) {
|
||||
this.marcaId = marcaId;
|
||||
}
|
||||
|
||||
public Integer getOrigemId() {
|
||||
return origemId;
|
||||
}
|
||||
|
||||
public void setOrigemId(Integer origemId) {
|
||||
this.origemId = origemId;
|
||||
}
|
||||
|
||||
public Integer getDestinoId() {
|
||||
return destinoId;
|
||||
}
|
||||
|
||||
public void setDestinoId(Integer destinoId) {
|
||||
this.destinoId = destinoId;
|
||||
}
|
||||
|
||||
public Integer getCorridaId() {
|
||||
return corridaId;
|
||||
}
|
||||
|
||||
public void setCorridaId(Integer corridaId) {
|
||||
this.corridaId = corridaId;
|
||||
}
|
||||
|
||||
public Date getFecCorrida() {
|
||||
return fecCorrida;
|
||||
}
|
||||
|
||||
public void setFecCorrida(Date fecCorrida) {
|
||||
this.fecCorrida = fecCorrida;
|
||||
}
|
||||
|
||||
public Integer getTipoVentaId() {
|
||||
return tipoVentaId;
|
||||
}
|
||||
|
||||
public void setTipoVentaId(Integer tipoVentaId) {
|
||||
this.tipoVentaId = tipoVentaId;
|
||||
}
|
||||
|
||||
public Date getFechorViaje() {
|
||||
return fechorViaje;
|
||||
}
|
||||
|
||||
public void setFechorViaje(Date fechorViaje) {
|
||||
this.fechorViaje = fechorViaje;
|
||||
}
|
||||
|
||||
public Date getFechorVenta() {
|
||||
return fechorVenta;
|
||||
}
|
||||
|
||||
public void setFechorVenta(Date fechorVenta) {
|
||||
this.fechorVenta = fechorVenta;
|
||||
}
|
||||
|
||||
public Integer getPuntoVentaId() {
|
||||
return puntoVentaId;
|
||||
}
|
||||
|
||||
public void setPuntoVentaId(Integer puntoVentaId) {
|
||||
this.puntoVentaId = puntoVentaId;
|
||||
}
|
||||
|
||||
public String getNumOperacion() {
|
||||
return numOperacion;
|
||||
}
|
||||
|
||||
public void setNumOperacion(String numOperacion) {
|
||||
this.numOperacion = numOperacion;
|
||||
}
|
||||
|
||||
public Integer getEmpresaPuntoVentaId() {
|
||||
return empresaPuntoVentaId;
|
||||
}
|
||||
|
||||
public void setEmpresaPuntoVentaId(Integer empresaPuntoVentaId) {
|
||||
this.empresaPuntoVentaId = empresaPuntoVentaId;
|
||||
}
|
||||
|
||||
public Integer getEmpresaCorridaId() {
|
||||
return empresaCorridaId;
|
||||
}
|
||||
|
||||
public void setEmpresaCorridaId(Integer empresaCorridaId) {
|
||||
this.empresaCorridaId = empresaCorridaId;
|
||||
}
|
||||
|
||||
public Integer getEstacionId() {
|
||||
return estacionId;
|
||||
}
|
||||
|
||||
public void setEstacionId(Integer estacionId) {
|
||||
this.estacionId = estacionId;
|
||||
}
|
||||
|
||||
public Integer getUsuarioId() {
|
||||
return usuarioId;
|
||||
}
|
||||
|
||||
public void setUsuarioId(Integer usuarioId) {
|
||||
this.usuarioId = usuarioId;
|
||||
}
|
||||
|
||||
public Integer getClienteId() {
|
||||
return clienteId;
|
||||
}
|
||||
|
||||
public void setClienteId(Integer clienteId) {
|
||||
this.clienteId = clienteId;
|
||||
}
|
||||
|
||||
public BigDecimal getPrecio() {
|
||||
return precio;
|
||||
}
|
||||
|
||||
public void setPrecio(BigDecimal precio) {
|
||||
this.precio = precio;
|
||||
}
|
||||
|
||||
public BigDecimal getImporteTaxaEmbarque() {
|
||||
return importeTaxaEmbarque;
|
||||
}
|
||||
|
||||
public void setImporteTaxaEmbarque(BigDecimal importeTaxaEmbarque) {
|
||||
this.importeTaxaEmbarque = importeTaxaEmbarque;
|
||||
}
|
||||
|
||||
public BigDecimal getImportePedagio() {
|
||||
return importePedagio;
|
||||
}
|
||||
|
||||
public void setImportePedagio(BigDecimal importePedagio) {
|
||||
this.importePedagio = importePedagio;
|
||||
}
|
||||
|
||||
public BigDecimal getImporteOutros() {
|
||||
return importeOutros;
|
||||
}
|
||||
|
||||
public void setImporteOutros(BigDecimal importeOutros) {
|
||||
this.importeOutros = importeOutros;
|
||||
}
|
||||
|
||||
public BigDecimal getImporteSeguro() {
|
||||
return importeSeguro;
|
||||
}
|
||||
|
||||
public void setImporteSeguro(BigDecimal importeSeguro) {
|
||||
this.importeSeguro = importeSeguro;
|
||||
}
|
||||
|
||||
public Integer getRutaId() {
|
||||
return rutaId;
|
||||
}
|
||||
|
||||
public void setRutaId(Integer rutaId) {
|
||||
this.rutaId = rutaId;
|
||||
}
|
||||
|
||||
public Date getFecModIf() {
|
||||
return fecModIf;
|
||||
}
|
||||
|
||||
public void setFecModIf(Date fecModIf) {
|
||||
this.fecModIf = fecModIf;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package com.rjconsultores.ventaboletos.ws.rs;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.sql.Date;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.CajaDAO;
|
||||
import com.rjconsultores.ventaboletos.vo.caja.VendaEmbarcadaVO;
|
||||
import com.rjconsultores.ventaboletos.web.utilerias.spring.AppContext;
|
||||
|
||||
@Path("vendaEmbarcada")
|
||||
public class VendaEmbarcadaRS {
|
||||
|
||||
private final int VENDA_GERADA_COM_SUCESSO = 0;
|
||||
private final int CATEGORIA_NAO_SUPORTADA = 1;
|
||||
private final int DATA_COM_FORMATO_INVALIDO = 2;
|
||||
private final int ERRO_PROCESSO_VENDA = 3;
|
||||
|
||||
private final int TIPO_VENDA_NORMAL = 3;
|
||||
|
||||
@POST
|
||||
@Path("/gerarVenda/{numeroAssento}/{categoria}/{origemId}/{destinoId}/{servicoId}/{dataCorrida}/{dataVenda}/{preco}/{tipoVendaId}/{pontoVendaId}/{empresaCorridaId}/{estacaoId}/{usuarioId}/{empresaId}/{taxaEmbarque}/{pedagio}/{outros}/{seguro}/{rutaId}/{formaPagoId}/{classeServicoId}")
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
public int gerarVenda(@PathParam("numeroAssento") String numeroAssento, @PathParam("categoria") String categoria, @PathParam("origemId") Integer origemId,
|
||||
@PathParam("destinoId") Integer destinoId, @PathParam("servicoId") Integer servicoId, @PathParam("dataCorrida") String dataCorrida, @PathParam("dataVenda") String dataVenda,
|
||||
@PathParam("preco") BigDecimal preco, @PathParam("tipoVendaId") Integer tipoVendaId, @PathParam("pontoVendaId") Integer pontoVendaId,
|
||||
@PathParam("empresaCorridaId") Integer empresaCorridaId, @PathParam("estacaoId") Integer estacaoId, @PathParam("usuarioId") Integer usuarioId,
|
||||
@PathParam("empresaId") BigInteger empresaId, @PathParam("taxaEmbarque") BigDecimal importeTaxaEmbarque, @PathParam("pedagio") BigDecimal importePedagio,
|
||||
@PathParam("outros") BigDecimal importeOutros, @PathParam("seguro") BigDecimal importeSeguro, @PathParam("rutaId") Integer rutaId, @PathParam("formaPagoId") Integer formaPagoId,
|
||||
@PathParam("classeServicoId") Integer classeServicoId){
|
||||
|
||||
try {
|
||||
|
||||
int categoriaId = 1;
|
||||
|
||||
if (!categoria.equalsIgnoreCase("normal")){
|
||||
return CATEGORIA_NAO_SUPORTADA;
|
||||
}
|
||||
|
||||
VendaEmbarcadaVO vendaEmbarcada = new VendaEmbarcadaVO();
|
||||
vendaEmbarcada.setUsuarioId(usuarioId);
|
||||
vendaEmbarcada.setClienteId(vendaEmbarcada.getUsuarioId());
|
||||
vendaEmbarcada.setCategoriaId(categoriaId);
|
||||
vendaEmbarcada.setCorridaId(servicoId);
|
||||
vendaEmbarcada.setDestinoId(destinoId);
|
||||
vendaEmbarcada.setOrigemId(origemId);
|
||||
vendaEmbarcada.setEmpresaCorridaId(empresaCorridaId);
|
||||
vendaEmbarcada.setTipoVentaId(TIPO_VENDA_NORMAL);
|
||||
vendaEmbarcada.setEmpresaId(empresaId);
|
||||
vendaEmbarcada.setPrecio(preco);
|
||||
vendaEmbarcada.setNumAsiento(numeroAssento);
|
||||
vendaEmbarcada.setPuntoVentaId(pontoVendaId);
|
||||
//fixme verificar campo empresaPuntoVentaId
|
||||
vendaEmbarcada.setEmpresaPuntoVentaId(empresaId.intValue());
|
||||
vendaEmbarcada.setEstacionId(estacaoId);
|
||||
vendaEmbarcada.setRutaId(rutaId);
|
||||
vendaEmbarcada.setClaseServicioId(classeServicoId);
|
||||
vendaEmbarcada.setFormaPagoId(formaPagoId);
|
||||
|
||||
String data[] = dataCorrida.split("__");
|
||||
|
||||
if (data.length != 2){
|
||||
return DATA_COM_FORMATO_INVALIDO;
|
||||
}
|
||||
|
||||
vendaEmbarcada.setFecCorrida(new Date(new SimpleDateFormat("dd/MM/yyyy hh:mm:ss").parse(data[0].replace("_", "/").concat(" ").concat(data[1].replace("_", ":"))).getTime()));
|
||||
|
||||
vendaEmbarcada.setFechorViaje(vendaEmbarcada.getFecCorrida());
|
||||
vendaEmbarcada.setFechorVenta(vendaEmbarcada.getFecCorrida());
|
||||
vendaEmbarcada.setMarcaId(empresaId.intValue());
|
||||
vendaEmbarcada.setImporteTaxaEmbarque(importeTaxaEmbarque);
|
||||
vendaEmbarcada.setImportePedagio(importePedagio);
|
||||
vendaEmbarcada.setImporteOutros(importeOutros);
|
||||
vendaEmbarcada.setImporteSeguro(importeSeguro);
|
||||
|
||||
CajaDAO cajaDAO = (CajaDAO) AppContext.getApplicationContext().getBean("cajaDAO");
|
||||
|
||||
if (!cajaDAO.gerarVendaEmbarcada(vendaEmbarcada)){
|
||||
return ERRO_PROCESSO_VENDA;
|
||||
}
|
||||
|
||||
return VENDA_GERADA_COM_SUCESSO;
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
return DATA_COM_FORMATO_INVALIDO;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue