fixes bug#21460
dev:valdevir qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@105915 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
df255b166b
commit
068c571cab
|
@ -4,10 +4,13 @@
|
|||
*/
|
||||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||
import com.rjconsultores.ventaboletos.entidad.Pais;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -20,4 +23,8 @@ public interface EstadoDAO extends GenericDAO<Estado, Integer> {
|
|||
public List<Estado> buscarNotInEmpresaImposto(Empresa empresa);
|
||||
|
||||
public List<Estado> buscarCveEstado(String cveEstado);
|
||||
|
||||
public Map<String, Integer> getConfiguracoesFusoVeraoParada(Integer paradaId, Date data);
|
||||
|
||||
public Map<String, Integer> getConfiguracoesFusoVeraoPuntoventa(Integer puntoventaId, Date data);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.vo.OrgaoConcedente.RelatorioGratuidadeAgepanVO;
|
||||
|
||||
public interface RelatorioAgepanDAO {
|
||||
|
||||
public List<RelatorioGratuidadeAgepanVO> listar(Map<String, Object> parametros) throws BusinessException;
|
||||
|
||||
}
|
|
@ -4,21 +4,32 @@
|
|||
*/
|
||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.EstadoDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||
import com.rjconsultores.ventaboletos.entidad.Pais;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.criterion.Order;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.hibernate.transform.AliasToBeanResultTransformer;
|
||||
import org.hibernate.type.DateType;
|
||||
import org.hibernate.type.IntegerType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.EstadoDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||
import com.rjconsultores.ventaboletos.entidad.Pais;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author MCosso
|
||||
|
@ -27,6 +38,8 @@ import org.springframework.stereotype.Repository;
|
|||
public class EstadoHibernateDAO extends GenericHibernateDAO<Estado, Integer>
|
||||
implements EstadoDAO {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(EstadoHibernateDAO.class);
|
||||
|
||||
@Autowired
|
||||
public EstadoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
|
@ -77,4 +90,92 @@ public class EstadoHibernateDAO extends GenericHibernateDAO<Estado, Integer>
|
|||
c.add(Restrictions.eq("cveestado", cveEstado));
|
||||
return c.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getConfiguracoesFusoVeraoParada(Integer paradaId, Date data) {
|
||||
return getConfiguracoesFusoVerao(null, paradaId, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getConfiguracoesFusoVeraoPuntoventa(Integer puntoventaId, Date data) {
|
||||
return getConfiguracoesFusoVerao(puntoventaId, null, data);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<String, Integer> getConfiguracoesFusoVerao(final Integer puntoventaId, final Integer paradaId, final Date data) {
|
||||
Map<String, Integer> retorno = new HashMap<String, Integer>();
|
||||
|
||||
if(puntoventaId == null && paradaId == null) {
|
||||
return retorno;
|
||||
}
|
||||
|
||||
Calendar dataServidorFuso = new GregorianCalendar();
|
||||
dataServidorFuso.setTime(data);
|
||||
|
||||
final StringBuilder sql = new StringBuilder();
|
||||
sql.append(" select e.tiempohorhuso as tiempoHorHuso, e.tiempohorverano as tiempoHorVerano, ");
|
||||
sql.append(" e.feciniciohorverano as fecInicioHorVerano, e.fecfinohorverano as fecFinoHorVerano ");
|
||||
sql.append(" from estado e");
|
||||
sql.append(" join ciudad c on c.estado_id = e.estado_id");
|
||||
|
||||
if (puntoventaId != null) {
|
||||
sql.append(" join colonia o on o.ciudad_id = c.ciudad_id");
|
||||
sql.append(" join punto_venta p on p.colonia_id = o.colonia_id");
|
||||
}
|
||||
|
||||
if(paradaId != null) {
|
||||
sql.append(" join parada p on c.ciudad_id = p.ciudad_id");
|
||||
}
|
||||
|
||||
sql.append(" where e.activo = 1");
|
||||
if (puntoventaId != null) {
|
||||
sql.append(" and p.puntoventa_id = :puntoventaId");
|
||||
}
|
||||
|
||||
if(paradaId != null) {
|
||||
sql.append(" and p.parada_id = :paradaId");
|
||||
}
|
||||
|
||||
try {
|
||||
Query qr = getSession().createSQLQuery(sql.toString())
|
||||
.addScalar("tiempoHorHuso", IntegerType.INSTANCE)
|
||||
.addScalar("tiempoHorVerano", IntegerType.INSTANCE)
|
||||
.addScalar("fecInicioHorVerano", DateType.INSTANCE)
|
||||
.addScalar("fecFinoHorVerano", DateType.INSTANCE)
|
||||
.setResultTransformer(new AliasToBeanResultTransformer(Estado.class));
|
||||
if (puntoventaId != null) {
|
||||
qr.setParameter("puntoventaId", puntoventaId);
|
||||
}
|
||||
if(paradaId != null) {
|
||||
qr.setParameter("paradaId", paradaId);
|
||||
}
|
||||
|
||||
List<Estado> resultado = qr.list();
|
||||
for (Estado estado : resultado) {
|
||||
Integer tiempohorhuso = estado.getTiempoHorHuso();
|
||||
Integer tiempohorverano = estado.getTiempoHorVerano();
|
||||
Date feciniciohorverano = estado.getFecInicioHorVerano();
|
||||
Date fecfinohorverano = estado.getFecFinoHorVerano();
|
||||
|
||||
if (tiempohorhuso != null) {
|
||||
retorno.put("tiempohorhuso", tiempohorhuso);
|
||||
}
|
||||
|
||||
if (fecfinohorverano != null && feciniciohorverano != null) {
|
||||
if ((dataServidorFuso.getTime().equals(feciniciohorverano)
|
||||
|| dataServidorFuso.getTime().after(feciniciohorverano))
|
||||
&& dataServidorFuso.getTime().before(fecfinohorverano)) {
|
||||
retorno.put("tiempohorverano", tiempohorverano);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return retorno;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.transform.AliasToBeanResultTransformer;
|
||||
import org.hibernate.type.BigDecimalType;
|
||||
import org.hibernate.type.DateType;
|
||||
import org.hibernate.type.IntegerType;
|
||||
import org.hibernate.type.StringType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.RelatorioAgepanDAO;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.vo.OrgaoConcedente.RelatorioGratuidadeAgepanVO;
|
||||
|
||||
@Repository("relatorioAgepanDAO")
|
||||
public class RelatorioAgepanHibernateDAO extends HibernateDaoSupport implements RelatorioAgepanDAO {
|
||||
|
||||
public static int ORGAOCONCEDENTE_ID_AGEPAN = 4;
|
||||
|
||||
@Autowired
|
||||
public RelatorioAgepanHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RelatorioGratuidadeAgepanVO> listar(Map<String, Object> parametros) throws BusinessException {
|
||||
try {
|
||||
|
||||
String fecInicioVenda = null;
|
||||
if (parametros.get("fecInicioVenda") != null) {
|
||||
fecInicioVenda = parametros.get("fecInicioVenda").toString() + " 00:00";
|
||||
}
|
||||
String fecFinalVenda = null;
|
||||
if (parametros.get("fecFinalVenda") != null) {
|
||||
fecFinalVenda = parametros.get("fecFinalVenda").toString() + " 23:59";
|
||||
}
|
||||
|
||||
String tipGratuIds = parametros.get("tipGratuIds").toString();
|
||||
String linhaIds = parametros.get("linhaIds").toString();
|
||||
Integer empresa = parametros.get("empresa") != null ? Integer.valueOf(parametros.get("empresa").toString()) : null;
|
||||
|
||||
String sQuery = getSql(fecInicioVenda, fecFinalVenda, linhaIds, tipGratuIds, empresa);
|
||||
|
||||
Query qr = getSession().createSQLQuery(sQuery)
|
||||
.addScalar("numBpe", StringType.INSTANCE)
|
||||
.addScalar("fechorventa", DateType.INSTANCE)
|
||||
.addScalar("origenId", IntegerType.INSTANCE)
|
||||
.addScalar("puntoventaId", IntegerType.INSTANCE)
|
||||
.addScalar("origem", StringType.INSTANCE)
|
||||
.addScalar("destino", StringType.INSTANCE)
|
||||
.addScalar("dhemb", StringType.INSTANCE)
|
||||
.addScalar("nombpasajero", StringType.INSTANCE)
|
||||
.addScalar("desctipodoc", StringType.INSTANCE)
|
||||
.addScalar("descnumdoc", StringType.INSTANCE)
|
||||
.addScalar("desctipodoc2", StringType.INSTANCE)
|
||||
.addScalar("descnumdoc2", StringType.INSTANCE)
|
||||
.addScalar("corridaextra", StringType.INSTANCE)
|
||||
.addScalar("tiposervicobpe", StringType.INSTANCE)
|
||||
.addScalar("fechorviaje", DateType.INSTANCE)
|
||||
.addScalar("prefixo", StringType.INSTANCE)
|
||||
.addScalar("numasiento", StringType.INSTANCE)
|
||||
.addScalar("totalbilhete", BigDecimalType.INSTANCE)
|
||||
.addScalar("totalbase", BigDecimalType.INSTANCE)
|
||||
.addScalar("descontobpe", StringType.INSTANCE)
|
||||
.addScalar("chbpe", StringType.INSTANCE)
|
||||
.setResultTransformer(new AliasToBeanResultTransformer(RelatorioGratuidadeAgepanVO.class));
|
||||
|
||||
|
||||
qr.setParameter("agepanId", ORGAOCONCEDENTE_ID_AGEPAN);
|
||||
qr.setParameter("fecInicioVenda", fecInicioVenda);
|
||||
qr.setParameter("fecFinalVenda", fecFinalVenda);
|
||||
if (empresa != null){
|
||||
qr.setParameter("empresaId", empresa);
|
||||
}
|
||||
|
||||
List<RelatorioGratuidadeAgepanVO> retorno = qr.list();
|
||||
if(retorno == null || retorno.isEmpty()) {
|
||||
throw new BusinessException("MSG.ningunRegistroRelatorio");
|
||||
}
|
||||
|
||||
return retorno;
|
||||
|
||||
} catch (BusinessException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage(), e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String getSql(String fecInicioVenda, String fecFinalVenda, String linha, String tipoGratu, Integer empresa) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("SELECT b.num_bpe numBpe, COALESCE(b.fechorventa_h,b.fechorventa) fechorventa, b.origen_id origenId, b.puntoventa_id puntoventaId, ");
|
||||
sb.append("ori.descparada origem, des.descparada destino, bpe.dhemb, b.nombpasajero, b.desctipodoc, b.descnumdoc, b.desctipodoc2, b.descnumdoc2, ");
|
||||
sb.append("CASE WHEN co.tiposervicio_id = 2 THEN '00' ELSE '01' END corridaextra, cs.tiposervicobpe, b.fechorviaje, r.prefixo, ");
|
||||
sb.append("CASE WHEN b.numasiento like 'P%' THEN '0' ELSE b.numasiento END numasiento, ");
|
||||
sb.append("NVL(b.preciobase,0) + NVL(b.importetaxaembarque,0) + NVL(b.importeseguro,0) + NVL(b.importeoutros,0) + NVL(b.importepedagio,0) as totalbase, ");
|
||||
sb.append("NVL(b.preciopagado,0) + NVL(b.importetaxaembarque,0) + NVL(b.importeseguro,0) + NVL(b.importeoutros,0) + NVL(b.importepedagio,0) as totalbilhete, ");
|
||||
sb.append("cat.descontobpe, bpe.chbpe ");
|
||||
sb.append("from boleto b ");
|
||||
sb.append("join bpe bpe on bpe.boleto_id = b.boleto_id ");
|
||||
sb.append("join parada ori on ori.parada_id = b.origen_id ");
|
||||
sb.append("join parada des on des.parada_id = b.destino_id ");
|
||||
sb.append("join corrida co on co.corrida_id = b.corrida_id and co.feccorrida = b.feccorrida ");
|
||||
sb.append("join clase_servicio cs on cs.claseservicio_id = co.claseservicio_id ");
|
||||
sb.append("join ruta r on r.ruta_id = co.ruta_id ");
|
||||
sb.append("join categoria cat on cat.categoria_id = b.categoria_id ");
|
||||
sb.append("join marca m on m.marca_id = b.marca_id ");
|
||||
sb.append("WHERE b.activo = 1 ");
|
||||
sb.append("AND COALESCE(b.fechorventa_h,b.fechorventa) BETWEEN to_date(:fecInicioVenda,'dd/mm/yyyy hh24:mi') AND to_date(:fecFinalVenda,'dd/mm/yyyy hh24:mi') ");
|
||||
sb.append("AND r.orgaoconcedente_id = :agepanId ");
|
||||
sb.append("AND b.motivocancelacion_id is null ");
|
||||
sb.append("AND bpe.codstat in ('100','102','150','-1') ");
|
||||
|
||||
if( tipoGratu != null ) {
|
||||
sb.append(" AND b.categoria_id in (").append(tipoGratu).append(") ");
|
||||
}
|
||||
|
||||
if( linha != null && !linha.equals("Todas")) {
|
||||
sb.append(" AND r.ruta_id in (").append(linha).append(") ");
|
||||
}
|
||||
|
||||
if (empresa != null){
|
||||
sb.append("AND m.empresa_id = :empresaId ");
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
package com.rjconsultores.ventaboletos.enums;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.brazilutils.br.cpfcnpj.Cnpj;
|
||||
import org.brazilutils.br.cpfcnpj.Cpf;
|
||||
import org.brazilutils.validation.ValidationException;
|
||||
|
||||
public enum TipoIdentificacionDoc {
|
||||
RG(1),
|
||||
CPF(2),
|
||||
CI(12),
|
||||
PASPT(13),
|
||||
RUT(14),
|
||||
DOCX(22),
|
||||
CNPJ(15),
|
||||
CN(23),
|
||||
RNE(24),
|
||||
DOC_IDOSO(25),
|
||||
DNI(26),
|
||||
TODOS(0);
|
||||
|
||||
private Integer id;
|
||||
|
||||
private TipoIdentificacionDoc(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public static TipoIdentificacionDoc getById(Byte id) {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
TipoIdentificacionDoc tmp = null;
|
||||
switch (id.intValue()) {
|
||||
case 1:
|
||||
tmp = TipoIdentificacionDoc.RG;
|
||||
break;
|
||||
case 2:
|
||||
tmp = TipoIdentificacionDoc.CPF;
|
||||
break;
|
||||
case 12:
|
||||
tmp = TipoIdentificacionDoc.CI;
|
||||
break;
|
||||
case 13:
|
||||
tmp = TipoIdentificacionDoc.PASPT;
|
||||
break;
|
||||
case 14:
|
||||
tmp = TipoIdentificacionDoc.RUT;
|
||||
break;
|
||||
case 22:
|
||||
tmp = TipoIdentificacionDoc.DOCX;
|
||||
break;
|
||||
case 15:
|
||||
tmp = TipoIdentificacionDoc.CNPJ;
|
||||
break;
|
||||
case 23:
|
||||
tmp = TipoIdentificacionDoc.CN;
|
||||
break;
|
||||
case 24:
|
||||
tmp = TipoIdentificacionDoc.RNE;
|
||||
break;
|
||||
case 25:
|
||||
tmp = TipoIdentificacionDoc.DOC_IDOSO;
|
||||
break;
|
||||
case 26:
|
||||
tmp = TipoIdentificacionDoc.DNI;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public static TipoIdentificacionDoc[] getTodos() {
|
||||
return new TipoIdentificacionDoc[]{TipoIdentificacionDoc.RG,
|
||||
TipoIdentificacionDoc.CPF,
|
||||
TipoIdentificacionDoc.CI,
|
||||
TipoIdentificacionDoc.PASPT,
|
||||
TipoIdentificacionDoc.RUT,
|
||||
TipoIdentificacionDoc.DOCX,
|
||||
TipoIdentificacionDoc.CNPJ,
|
||||
TipoIdentificacionDoc.CN,
|
||||
TipoIdentificacionDoc.RNE,
|
||||
TipoIdentificacionDoc.DOC_IDOSO,
|
||||
TipoIdentificacionDoc.DNI
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String getDescricao(Byte id) {
|
||||
if (id == null) {
|
||||
return null;
|
||||
}
|
||||
switch (id) {
|
||||
case 1: case 10:
|
||||
return "RG";
|
||||
case 2: case 11:
|
||||
return "CPF";
|
||||
case 12:
|
||||
return "CI";
|
||||
case 13:
|
||||
return "PASPT";
|
||||
case 14:
|
||||
return "RUT";
|
||||
case 22:
|
||||
return "DOCX";
|
||||
case 15:
|
||||
return "CNPJ";
|
||||
case 23:
|
||||
return "CN";
|
||||
case 24:
|
||||
return "RNE";
|
||||
case 25:
|
||||
return "DOC_IDOSO";
|
||||
case 26:
|
||||
return "DNI";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static TipoIdentificacionDoc[] getTipoDocExcluindoCPF() {
|
||||
return new TipoIdentificacionDoc[]{TipoIdentificacionDoc.RG,
|
||||
TipoIdentificacionDoc.CI,
|
||||
TipoIdentificacionDoc.PASPT,
|
||||
TipoIdentificacionDoc.RUT,
|
||||
TipoIdentificacionDoc.DOCX,
|
||||
TipoIdentificacionDoc.CNPJ,
|
||||
TipoIdentificacionDoc.CN,
|
||||
TipoIdentificacionDoc.RNE,
|
||||
TipoIdentificacionDoc.DOC_IDOSO,
|
||||
TipoIdentificacionDoc.DNI
|
||||
};
|
||||
}
|
||||
|
||||
public static TipoIdentificacionDoc getTipo(String descTipoDoc) {
|
||||
if(descTipoDoc != null) {
|
||||
if(descTipoDoc.equals("RG")) {
|
||||
return TipoIdentificacionDoc.RG;
|
||||
} else if(descTipoDoc.equals("CPF")) {
|
||||
return TipoIdentificacionDoc.CPF;
|
||||
} else if(descTipoDoc.equals("CI")) {
|
||||
return TipoIdentificacionDoc.RG;
|
||||
} else if(descTipoDoc.equals("PASPT")) {
|
||||
return TipoIdentificacionDoc.PASPT;
|
||||
} else if(descTipoDoc.equals("RUT")) {
|
||||
return TipoIdentificacionDoc.RUT;
|
||||
} else if(descTipoDoc.equals("DOCX")) {
|
||||
return TipoIdentificacionDoc.DOCX;
|
||||
} else if(descTipoDoc.equals("CNPJ")) {
|
||||
return TipoIdentificacionDoc.CNPJ;
|
||||
} else if(descTipoDoc.equals("CN")) {
|
||||
return TipoIdentificacionDoc.CN;
|
||||
} else if(descTipoDoc.equals("RNE")) {
|
||||
return TipoIdentificacionDoc.RNE;
|
||||
} else if(descTipoDoc.equals("DOC_IDOSO")) {
|
||||
return TipoIdentificacionDoc.DOC_IDOSO;
|
||||
} else if(descTipoDoc.equals("DNI")) {
|
||||
return TipoIdentificacionDoc.DNI;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isExisteTipoIdentificacionDoc(String descTipoDoc) {
|
||||
return getTipo(descTipoDoc) != null;
|
||||
}
|
||||
|
||||
public static boolean isRGBPeValido(String value) {
|
||||
return value == null ? false : value.trim().matches("\\d.*\\d.*|[a-zA-Z]+\\d.*\\d.*");
|
||||
}
|
||||
|
||||
public static boolean isCPFValido(String doc) {
|
||||
try {
|
||||
String tmp = StringUtils.isBlank(doc) ? "" : doc;
|
||||
Cpf cpf = new Cpf(tmp.trim());
|
||||
|
||||
return cpf.isValid();
|
||||
} catch (ValidationException e1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isCNPJValido(String doc) {
|
||||
try {
|
||||
String tmp = StringUtils.isBlank(doc) ? "" : doc;
|
||||
Cnpj cnpj = new Cnpj(tmp.trim());
|
||||
|
||||
return cnpj.isValid();
|
||||
} catch (ValidationException e1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isRUTValido(String rut) {
|
||||
boolean validacion = false;
|
||||
try {
|
||||
rut = rut.toUpperCase();
|
||||
rut = rut.replace(".", "");
|
||||
rut = rut.replace("-", "");
|
||||
int rutAux = Integer.parseInt(rut.substring(0, rut.length() - 1));
|
||||
|
||||
char dv = rut.charAt(rut.length() - 1);
|
||||
|
||||
int m = 0, s = 1;
|
||||
for (; rutAux != 0; rutAux /= 10) {
|
||||
s = (s + rutAux % 10 * (9 - m++ % 6)) % 11;
|
||||
}
|
||||
if (dv == (char) (s != 0 ? s + 47 : 75)) {
|
||||
validacion = true;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
return validacion;
|
||||
}
|
||||
|
||||
public static boolean isPASPTValido(String numDoc) {
|
||||
String paspt = numDoc.replaceAll("[^\\d]", "");
|
||||
|
||||
//O passaporte não aceita menos de 4 numeros ou somente letras
|
||||
if (!StringUtils.isBlank(paspt) && paspt.length() < 4) {
|
||||
return false;
|
||||
} else if (StringUtils.isBlank(paspt) && !StringUtils.isBlank(numDoc)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -4,7 +4,9 @@
|
|||
*/
|
||||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||
|
@ -32,4 +34,8 @@ public interface EstadoService {
|
|||
public List<Estado> buscarNotInEmpresaImposto(Empresa empresa);
|
||||
|
||||
public List<Estado> buscarCveEstado(String cveEstado);
|
||||
|
||||
public Map<String, Integer> getConfiguracoesFusoVeraoParada(Integer paradaId, Date data);
|
||||
|
||||
public Map<String, Integer> getConfiguracoesFusoVeraoPuntoventa(Integer puntoventaId, Date data);
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.vo.OrgaoConcedente.RelatorioGratuidadeAgepanVO;
|
||||
|
||||
public interface RelatorioAgepanService {
|
||||
|
||||
public List<RelatorioGratuidadeAgepanVO> listar(Map<String, Object> parametros) throws BusinessException;
|
||||
|
||||
public InputStream gerarArquivoGratuidadeAgepan(Map<String, Object> parametros) throws IOException, BusinessException;
|
||||
|
||||
}
|
|
@ -5,7 +5,9 @@
|
|||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -100,4 +102,14 @@ public class EstadoServiceImpl implements EstadoService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getConfiguracoesFusoVeraoParada(Integer paradaId, Date data) {
|
||||
return estadoDAO.getConfiguracoesFusoVeraoParada(paradaId, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Integer> getConfiguracoesFusoVeraoPuntoventa(Integer puntoventaId, Date data) {
|
||||
return estadoDAO.getConfiguracoesFusoVeraoPuntoventa(puntoventaId, data);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,243 @@
|
|||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
||||
import org.apache.poi.hssf.usermodel.HSSFRow;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.EstadoDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.RelatorioAgepanDAO;
|
||||
import com.rjconsultores.ventaboletos.enums.TipoDescontoBPe;
|
||||
import com.rjconsultores.ventaboletos.enums.TipoIdentificacionDoc;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.RelatorioAgepanService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.MoneyHelper;
|
||||
import com.rjconsultores.ventaboletos.utilerias.TimeZoneUtil;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.vo.OrgaoConcedente.RelatorioGratuidadeAgepanVO;
|
||||
|
||||
@Service("relatorioAgepanService")
|
||||
public class RelatorioAgepanServiceImpl implements RelatorioAgepanService {
|
||||
|
||||
@Autowired
|
||||
RelatorioAgepanDAO relatorioAgepanDAO;
|
||||
|
||||
@Autowired
|
||||
EstadoDAO estadoDAO;
|
||||
|
||||
@Override
|
||||
public List<RelatorioGratuidadeAgepanVO> listar(Map<String, Object> parametros) throws BusinessException {
|
||||
return relatorioAgepanDAO.listar(parametros);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream gerarArquivoGratuidadeAgepan(Map<String, Object> parametros) throws IOException, BusinessException {
|
||||
InputStream arquivo = null;
|
||||
|
||||
List<RelatorioGratuidadeAgepanVO> retorno = listar(parametros);
|
||||
|
||||
arquivo = gerarArquivo(retorno);
|
||||
|
||||
return arquivo;
|
||||
}
|
||||
|
||||
private InputStream gerarArquivo(List<RelatorioGratuidadeAgepanVO> retorno) throws IOException {
|
||||
HSSFWorkbook wb = new HSSFWorkbook();
|
||||
|
||||
criarArquivoExcel(wb, retorno);
|
||||
|
||||
String nomeArquivo = UsuarioLogado.getUsuarioLogado().getNombusuario()
|
||||
+ "_" + Calendar.getInstance().getTime().getTime()
|
||||
+ "_" + "arquivoAgepan";
|
||||
|
||||
File fNomeArquivo = File.createTempFile(nomeArquivo, ".tmp");
|
||||
|
||||
FileOutputStream stream = new FileOutputStream(fNomeArquivo);
|
||||
stream.flush();
|
||||
wb.write(stream);
|
||||
stream.close();
|
||||
|
||||
InputStream is = new FileInputStream(fNomeArquivo);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
private void criarArquivoExcel(HSSFWorkbook wb, List<RelatorioGratuidadeAgepanVO> dados) {
|
||||
HSSFSheet sheet = wb.createSheet("dados");
|
||||
int contRow = 0;
|
||||
String[] cabecalho1 = new String[] {"nBP","dhEmi","xLocOrig","xLocDest","dhEmb","xNome","CPF","tpDoc","nDoc","xDoc","tpViagem","tpServico","dhViagem","prefixo","poltrona","vBP","vDesconto","tpDesconto","xDesconto","qrCodBPe"};
|
||||
String[] cabecalho2 = new String[] {"[9]","[13]","[85]","[87]","[88]","[91]","[92]","[93]","[94]","[95]","[102]","[103]","[106]","[108]","[109]","[115]","[116]","[119]","[120]","[189]"};
|
||||
criarRow(contRow++, sheet, cabecalho1);
|
||||
criarRow(contRow++, sheet, cabecalho2);
|
||||
|
||||
for (RelatorioGratuidadeAgepanVO vo : dados) {
|
||||
String[] vetVO = transformarVOToVetor(vo);
|
||||
criarRow(contRow++, sheet, vetVO);
|
||||
}
|
||||
|
||||
for (int i = 0; i < cabecalho1.length; i++) {
|
||||
sheet.autoSizeColumn(i);
|
||||
}
|
||||
}
|
||||
|
||||
private String[] transformarVOToVetor(RelatorioGratuidadeAgepanVO vo) {
|
||||
Map<String, Integer> dadosTimezoneParada = estadoDAO.getConfiguracoesFusoVeraoParada(vo.getOrigenId(), vo.getFechorventa());
|
||||
Map<String, Integer> dadosTimezonePuntoventa = estadoDAO.getConfiguracoesFusoVeraoPuntoventa(vo.getPuntoventaId(), vo.getFechorventa());
|
||||
|
||||
List<String> retorno = new ArrayList<String>();
|
||||
|
||||
//"nBP",
|
||||
retorno.add(vo.getNumBpe());
|
||||
|
||||
//"dhEmi",
|
||||
String dataEmissao = TimeZoneUtil.ajustarPuntoVentaEmissaoOrigemViagemTimeZone(dadosTimezoneParada, dadosTimezonePuntoventa, vo.getFechorventa());
|
||||
retorno.add(dataEmissao);
|
||||
|
||||
//"xLocOrig",
|
||||
retorno.add(vo.getOrigem());
|
||||
|
||||
//"xLocDest",
|
||||
retorno.add(vo.getDestino());
|
||||
|
||||
//"dhEmb",
|
||||
String dhEmbarque = TimeZoneUtil.ajustarTimeZone(dadosTimezoneParada, vo.getFechorviaje());
|
||||
retorno.add(dhEmbarque);
|
||||
|
||||
//"xNome",
|
||||
retorno.add(StringUtils.isNotBlank(vo.getNombpasajero()) ? vo.getNombpasajero() : "");
|
||||
|
||||
//"CPF",
|
||||
String cpf = carregarCpfBpe(vo.getDesctipodoc(), vo.getDesctipodoc2(), vo.getDescnumdoc(), vo.getDescnumdoc2());
|
||||
retorno.add(cpf);
|
||||
|
||||
//"tpDoc",
|
||||
String descTipoDoc = carregarDescTipoDoc(vo.getDesctipodoc(), vo.getDesctipodoc2());
|
||||
TipoIdentificacionDoc identificacionDoc = TipoIdentificacionDoc.getTipo(descTipoDoc);
|
||||
String tpDoc = "5";
|
||||
if(identificacionDoc != null) {
|
||||
if (identificacionDoc.equals(TipoIdentificacionDoc.RG)) {
|
||||
tpDoc = "1";
|
||||
} else if (identificacionDoc.equals(TipoIdentificacionDoc.PASPT)) {
|
||||
tpDoc = "3";
|
||||
} else if (identificacionDoc.equals(TipoIdentificacionDoc.CN)) {
|
||||
tpDoc = "4";
|
||||
}
|
||||
}
|
||||
retorno.add(tpDoc);
|
||||
|
||||
//"nDoc",
|
||||
String nDoc = carregarNumDoc(vo.getDescnumdoc(), vo.getDescnumdoc2());
|
||||
retorno.add(nDoc);
|
||||
|
||||
//"xDoc",
|
||||
retorno.add("");
|
||||
|
||||
//"tpViagem",
|
||||
retorno.add(vo.getCorridaextra());
|
||||
|
||||
//"tpServico",
|
||||
retorno.add(vo.getTiposervicobpe());
|
||||
|
||||
//"dhViagem",
|
||||
String dhViagem = TimeZoneUtil.ajustarTimeZone(dadosTimezoneParada, vo.getFechorviaje());
|
||||
retorno.add(dhViagem);
|
||||
|
||||
//"prefixo",
|
||||
retorno.add(vo.getPrefixo());
|
||||
|
||||
//"poltrona",
|
||||
retorno.add(vo.getNumasiento());
|
||||
|
||||
//"vBP",
|
||||
retorno.add(MoneyHelper.arredondar(vo.getTotalbase()).toString());
|
||||
|
||||
if(MoneyHelper.isMaior(vo.getDesconto(), BigDecimal.ZERO)) {
|
||||
//"vDesconto",
|
||||
retorno.add(MoneyHelper.arredondar(vo.getDesconto()).toString());
|
||||
|
||||
//"tpDesconto",
|
||||
TipoDescontoBPe tipoDescontoBPe = null;
|
||||
if(StringUtils.isNotBlank(vo.getDescontobpe())) {
|
||||
tipoDescontoBPe = TipoDescontoBPe.valueOf(vo.getDescontobpe());
|
||||
}
|
||||
if(tipoDescontoBPe == null) {
|
||||
tipoDescontoBPe = TipoDescontoBPe.TARIFA_PROMOCIONAL;
|
||||
}
|
||||
retorno.add(tipoDescontoBPe.getValor());
|
||||
|
||||
//"xDesconto",
|
||||
retorno.add(tipoDescontoBPe.getDescricao());
|
||||
|
||||
} else {
|
||||
retorno.add("");
|
||||
retorno.add("");
|
||||
retorno.add("");
|
||||
}
|
||||
|
||||
//"qrCodBPe"
|
||||
retorno.add(vo.getChbpe());
|
||||
|
||||
return retorno.toArray(new String[retorno.size()]);
|
||||
}
|
||||
|
||||
private void criarRow(int numRow, HSSFSheet sheet, String[] dados) {
|
||||
int numColumn = 0;
|
||||
HSSFRow row = sheet.createRow(numRow);
|
||||
for (String dado : dados) {
|
||||
HSSFCell cell = row.createCell(numColumn++);
|
||||
cell.setCellValue(dado);
|
||||
}
|
||||
}
|
||||
|
||||
private String carregarCpfBpe(String desctipodoc, String desctipodoc2, String descnumdoc, String descnumdoc2) {
|
||||
String cpfBpe = null;
|
||||
TipoIdentificacionDoc identificacionDoc = TipoIdentificacionDoc.getTipo(desctipodoc);
|
||||
if(identificacionDoc != null && (TipoIdentificacionDoc.CPF.equals(identificacionDoc) || TipoIdentificacionDoc.CNPJ.equals(identificacionDoc))) {
|
||||
cpfBpe = descnumdoc;
|
||||
}
|
||||
identificacionDoc = TipoIdentificacionDoc.getTipo(desctipodoc2);
|
||||
if(identificacionDoc != null && (TipoIdentificacionDoc.CPF.equals(identificacionDoc) || TipoIdentificacionDoc.CNPJ.equals(identificacionDoc))) {
|
||||
cpfBpe = descnumdoc2;
|
||||
}
|
||||
cpfBpe = cpfBpe == null ? "" : cpfBpe.trim().replaceAll("\\D", "");
|
||||
|
||||
return cpfBpe;
|
||||
}
|
||||
|
||||
private String carregarNumDoc(String descnumdoc, String descnumdoc2) {
|
||||
String lDescDoc = null;
|
||||
if(StringUtils.isNotBlank(descnumdoc)){
|
||||
lDescDoc = descnumdoc;
|
||||
}
|
||||
if(StringUtils.isBlank(lDescDoc)){
|
||||
lDescDoc = descnumdoc2;
|
||||
}
|
||||
return lDescDoc == null ? "" : lDescDoc.trim().replaceAll("\\D", "");
|
||||
}
|
||||
|
||||
private String carregarDescTipoDoc(String desctipodoc, String desctipodoc2) {
|
||||
String lDescTipoDoc = null;
|
||||
if(StringUtils.isNotBlank(desctipodoc)){
|
||||
lDescTipoDoc = desctipodoc;
|
||||
}
|
||||
if(StringUtils.isBlank(lDescTipoDoc)) {
|
||||
lDescTipoDoc = desctipodoc2;
|
||||
}
|
||||
return lDescTipoDoc != null ? lDescTipoDoc.trim() : "";
|
||||
}
|
||||
|
||||
}
|
|
@ -39,6 +39,7 @@ public final class DateUtil {
|
|||
public static String formatGMT = "yyyy-MM-dd'T'HH:mm:ss";
|
||||
public static String formatJson = "yyyy-MM-dd'T'HH:mm:ss.SSS";
|
||||
public static String formatExp = "yyyyMMdd";
|
||||
public static String YYYY_MM_DD_T_HH_MM_SS_Z = "yyyy-MM-dd'T'HH:mm:ssZ";
|
||||
|
||||
/**
|
||||
* No need for an instance
|
||||
|
@ -732,4 +733,34 @@ public final class DateUtil {
|
|||
return (int) (quantidadeHoras / DIA);
|
||||
}
|
||||
|
||||
public static String dataFormatoBPe(Date data){
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat(YYYY_MM_DD_T_HH_MM_SS_Z) {
|
||||
private static final long serialVersionUID = 1L;
|
||||
public StringBuffer format(Date date, StringBuffer toAppendTo, java.text.FieldPosition pos) {
|
||||
StringBuffer toFix = super.format(date, toAppendTo, pos);
|
||||
return toFix.insert(toFix.length()-2, ':');
|
||||
};
|
||||
};
|
||||
|
||||
return dateFormat.format(data);
|
||||
}
|
||||
|
||||
public static Date dateFormatBPe(final String data) {
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD_T_HH_MM_SS_Z);
|
||||
|
||||
String value = data;
|
||||
|
||||
if (value.substring(value.length()-3,value.length()-2).equals(":")) {
|
||||
StringBuilder dx = new StringBuilder(value);
|
||||
dx = dx.delete(dx.length() - 3, dx.length() - 2);
|
||||
value = dx.toString();
|
||||
}
|
||||
|
||||
return sdf.parse(value);
|
||||
} catch (ParseException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
package com.rjconsultores.ventaboletos.utilerias;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class TimeZoneUtil {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(TimeZoneUtil.class);
|
||||
|
||||
/**
|
||||
* Ajusta o timezone conforme a origem ou ponto de venda informado de acordo com o horario de verao e fuso horario,
|
||||
* nao alterando a data informada, apenas o GMT
|
||||
*
|
||||
* Retorna a data formatada para envio do BPe
|
||||
*
|
||||
* @param puntoventaId
|
||||
* @param paradaId
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static String ajustarTimeZone(Map<String, Integer> mConfiguracoesFusoHorario, Date data) {
|
||||
try {
|
||||
Integer gmtBrasil = -3;
|
||||
|
||||
if(mConfiguracoesFusoHorario != null) {
|
||||
StringBuilder sDataBpeFormatada = new StringBuilder(DateUtil.getStringDate(data, "yyyy-MM-dd'T'HH:mm:ss"));
|
||||
Integer tiempohorhuso = mConfiguracoesFusoHorario.get("tiempohorhuso");
|
||||
|
||||
if (tiempohorhuso != null) {
|
||||
gmtBrasil += tiempohorhuso;
|
||||
}
|
||||
Integer tiempohorverano = mConfiguracoesFusoHorario.get("tiempohorverano");
|
||||
|
||||
if (tiempohorverano != null) {
|
||||
gmtBrasil += tiempohorverano;
|
||||
}
|
||||
|
||||
StringBuilder sGmtBrasil = new StringBuilder();
|
||||
if(gmtBrasil >= 0) {
|
||||
sGmtBrasil.append("+");
|
||||
}
|
||||
sGmtBrasil.append(gmtBrasil.toString());
|
||||
|
||||
if(gmtBrasil.toString().length() <= 2) {
|
||||
sGmtBrasil.insert(1, "0");
|
||||
}
|
||||
sDataBpeFormatada.append(sGmtBrasil).append(":00");
|
||||
|
||||
return sDataBpeFormatada.toString();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return DateUtil.dataFormatoBPe(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajusta o timezone da data de acordo com a diferença da agencia de venda com a origem da viagem.
|
||||
* @param puntoventaId
|
||||
* @param paradaId
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static String ajustarPuntoVentaEmissaoOrigemViagemTimeZone(Map<String, Integer> mConfiguracoesFusoHorarioParada, Map<String, Integer> mConfiguracoesFusoHorarioPuntoVenta, Date data) {
|
||||
try {
|
||||
Integer gmtParada = -3;
|
||||
Integer gmtPuntoventa = -3;
|
||||
|
||||
if(mConfiguracoesFusoHorarioParada != null) {
|
||||
Integer tiempohorhuso = mConfiguracoesFusoHorarioParada.get("tiempohorhuso");
|
||||
|
||||
if (tiempohorhuso != null) {
|
||||
gmtParada += tiempohorhuso;
|
||||
}
|
||||
Integer tiempohorverano = mConfiguracoesFusoHorarioParada.get("tiempohorverano");
|
||||
|
||||
if (tiempohorverano != null) {
|
||||
gmtParada += tiempohorverano;
|
||||
}
|
||||
}
|
||||
|
||||
if(mConfiguracoesFusoHorarioPuntoVenta != null) {
|
||||
Integer tiempohorhuso = mConfiguracoesFusoHorarioPuntoVenta.get("tiempohorhuso");
|
||||
|
||||
if (tiempohorhuso != null) {
|
||||
gmtPuntoventa += tiempohorhuso;
|
||||
}
|
||||
Integer tiempohorverano = mConfiguracoesFusoHorarioPuntoVenta.get("tiempohorverano");
|
||||
|
||||
if (tiempohorverano != null) {
|
||||
gmtPuntoventa += tiempohorverano;
|
||||
}
|
||||
}
|
||||
|
||||
Integer qtdHoraAjustaData = new BigDecimal(gmtPuntoventa).abs().intValue() - new BigDecimal(gmtParada).abs().intValue();
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(data);
|
||||
cal.add(Calendar.HOUR_OF_DAY, qtdHoraAjustaData);
|
||||
|
||||
StringBuilder sDataBpeFormatada = new StringBuilder(DateUtil.getStringDate(cal.getTime(), "yyyy-MM-dd'T'HH:mm:ss"));
|
||||
|
||||
StringBuilder sGmtData = new StringBuilder();
|
||||
if(gmtParada >= 0) {
|
||||
sGmtData.append("+");
|
||||
}
|
||||
sGmtData.append(gmtParada.toString());
|
||||
|
||||
if(gmtParada.toString().length() <= 2) {
|
||||
sGmtData.insert(1, "0");
|
||||
}
|
||||
|
||||
sDataBpeFormatada.append(sGmtData).append(":00");
|
||||
|
||||
return sDataBpeFormatada.toString();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
return DateUtil.dataFormatoBPe(data);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,204 @@
|
|||
package com.rjconsultores.ventaboletos.vo.OrgaoConcedente;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.rjconsultores.ventaboletos.utilerias.MoneyHelper;
|
||||
|
||||
public class RelatorioGratuidadeAgepanVO {
|
||||
|
||||
private String numBpe;
|
||||
private Date fechorventa;
|
||||
private Integer origenId;
|
||||
private Integer puntoventaId;
|
||||
private String origem;
|
||||
private String destino;
|
||||
private String dhemb;
|
||||
private String nombpasajero;
|
||||
private String desctipodoc;
|
||||
private String descnumdoc;
|
||||
private String desctipodoc2;
|
||||
private String descnumdoc2;
|
||||
private String corridaextra;
|
||||
private String tiposervicobpe;
|
||||
private Date fechorviaje;
|
||||
private String prefixo;
|
||||
private String numasiento;
|
||||
private BigDecimal totalbilhete;
|
||||
private BigDecimal totalbase;
|
||||
private String descontobpe;
|
||||
private String chbpe;
|
||||
|
||||
public String getNumBpe() {
|
||||
return numBpe;
|
||||
}
|
||||
|
||||
public void setNumBpe(String numBpe) {
|
||||
this.numBpe = numBpe;
|
||||
}
|
||||
|
||||
public Date getFechorventa() {
|
||||
return fechorventa;
|
||||
}
|
||||
|
||||
public void setFechorventa(Date fechorventa) {
|
||||
this.fechorventa = fechorventa;
|
||||
}
|
||||
|
||||
public Integer getOrigenId() {
|
||||
return origenId;
|
||||
}
|
||||
|
||||
public void setOrigenId(Integer origenId) {
|
||||
this.origenId = origenId;
|
||||
}
|
||||
|
||||
public Integer getPuntoventaId() {
|
||||
return puntoventaId;
|
||||
}
|
||||
|
||||
public void setPuntoventaId(Integer puntoventaId) {
|
||||
this.puntoventaId = puntoventaId;
|
||||
}
|
||||
|
||||
public String getOrigem() {
|
||||
return origem;
|
||||
}
|
||||
|
||||
public void setOrigem(String origem) {
|
||||
this.origem = origem;
|
||||
}
|
||||
|
||||
public String getDestino() {
|
||||
return destino;
|
||||
}
|
||||
|
||||
public void setDestino(String destino) {
|
||||
this.destino = destino;
|
||||
}
|
||||
|
||||
public String getDhemb() {
|
||||
return dhemb;
|
||||
}
|
||||
|
||||
public void setDhemb(String dhemb) {
|
||||
this.dhemb = dhemb;
|
||||
}
|
||||
|
||||
public String getNombpasajero() {
|
||||
return nombpasajero;
|
||||
}
|
||||
|
||||
public void setNombpasajero(String nombpasajero) {
|
||||
this.nombpasajero = nombpasajero;
|
||||
}
|
||||
|
||||
public String getDesctipodoc() {
|
||||
return desctipodoc;
|
||||
}
|
||||
|
||||
public void setDesctipodoc(String desctipodoc) {
|
||||
this.desctipodoc = desctipodoc;
|
||||
}
|
||||
|
||||
public String getDescnumdoc() {
|
||||
return descnumdoc;
|
||||
}
|
||||
|
||||
public void setDescnumdoc(String descnumdoc) {
|
||||
this.descnumdoc = descnumdoc;
|
||||
}
|
||||
|
||||
public String getDesctipodoc2() {
|
||||
return desctipodoc2;
|
||||
}
|
||||
|
||||
public void setDesctipodoc2(String desctipodoc2) {
|
||||
this.desctipodoc2 = desctipodoc2;
|
||||
}
|
||||
|
||||
public String getDescnumdoc2() {
|
||||
return descnumdoc2;
|
||||
}
|
||||
|
||||
public void setDescnumdoc2(String descnumdoc2) {
|
||||
this.descnumdoc2 = descnumdoc2;
|
||||
}
|
||||
|
||||
public String getCorridaextra() {
|
||||
return corridaextra;
|
||||
}
|
||||
|
||||
public void setCorridaextra(String corridaextra) {
|
||||
this.corridaextra = corridaextra;
|
||||
}
|
||||
|
||||
public String getTiposervicobpe() {
|
||||
return tiposervicobpe;
|
||||
}
|
||||
|
||||
public void setTiposervicobpe(String tiposervicobpe) {
|
||||
this.tiposervicobpe = tiposervicobpe;
|
||||
}
|
||||
|
||||
public Date getFechorviaje() {
|
||||
return fechorviaje;
|
||||
}
|
||||
|
||||
public void setFechorviaje(Date fechorviaje) {
|
||||
this.fechorviaje = fechorviaje;
|
||||
}
|
||||
|
||||
public String getPrefixo() {
|
||||
return prefixo;
|
||||
}
|
||||
|
||||
public void setPrefixo(String prefixo) {
|
||||
this.prefixo = prefixo;
|
||||
}
|
||||
|
||||
public String getNumasiento() {
|
||||
return numasiento;
|
||||
}
|
||||
|
||||
public void setNumasiento(String numasiento) {
|
||||
this.numasiento = numasiento;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalbilhete() {
|
||||
return totalbilhete;
|
||||
}
|
||||
|
||||
public void setTotalbilhete(BigDecimal totalbilhete) {
|
||||
this.totalbilhete = totalbilhete;
|
||||
}
|
||||
|
||||
public BigDecimal getTotalbase() {
|
||||
return totalbase;
|
||||
}
|
||||
|
||||
public void setTotalbase(BigDecimal totalbase) {
|
||||
this.totalbase = totalbase;
|
||||
}
|
||||
|
||||
public String getDescontobpe() {
|
||||
return descontobpe;
|
||||
}
|
||||
|
||||
public void setDescontobpe(String descontobpe) {
|
||||
this.descontobpe = descontobpe;
|
||||
}
|
||||
|
||||
public String getChbpe() {
|
||||
return chbpe;
|
||||
}
|
||||
|
||||
public void setChbpe(String chbpe) {
|
||||
this.chbpe = chbpe;
|
||||
}
|
||||
|
||||
public BigDecimal getDesconto() {
|
||||
return MoneyHelper.subtrair(getTotalbase(), getTotalbilhete());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue